@splinetool/viewer 2.0.157 → 2.0.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/hana-ui.js +28 -28
- package/build/hana-ui.wasm +0 -0
- package/build/spline-viewer.cjs +29 -9
- package/build/spline-viewer.js +29 -9
- package/build/spline-viewer.webgl.js +29 -9
- package/build/spline-viewer.webgpu.js +29 -9
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@ property scaling ${t.scaling.method}
|
|
|
32
32
|
property quaternion ${t.quaternion.method}`;if(t.harmonics&&t.harmonics.length>0)for(let E=0;E<t.harmonics.length;E++)r=`${r}
|
|
33
33
|
property harmonics_${E} ${t.harmonics[E].method}`;r=`${r}
|
|
34
34
|
end_header
|
|
35
|
-
`;let s=new TextEncoder().encode(r),a=n*2*4,o=t.xyz.quantized.data.buffer.byteLength,l=t.xyz instanceof Ji?a:0,c=t.color.quantized.data.buffer.byteLength,h=t.color instanceof Ji?a:0,d=t.opacity.quantized.data.buffer.byteLength,u=t.opacity instanceof Ji?a:0,p=t.scaling.quantized.data.buffer.byteLength,f=t.scaling instanceof Ji?a:0,g=t.quaternion.quantized.data.buffer.byteLength,m=t.quaternion instanceof Ji?a:0,v=t.variableChunkSize?Uint16Array.from(t.variableChunkSize):void 0,y=v?v.byteLength:0,_=s.byteLength+y+o+l+c+h+d+u+p+f+g+m,b=0,x=0;if(t.harmonics&&t.harmonics.length>0)for(let E=0;E<t.harmonics.length;E++)b+=t.harmonics[E].quantized.data.buffer.byteLength,x+=t.harmonics[E]instanceof Ji?a:0;b=0,x=0,_+=b+x;let w=new Uint8Array(_),S=0;if(w.set(s,S),S+=s.byteLength,y>0&&(w.set(new Uint8Array(v.buffer),S),S+=y),t.xyz instanceof Ji&&(w.set(new Uint8Array(t.xyz.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.xyz.quantized.data.buffer),S),S+=o,t.color instanceof Ji&&(w.set(new Uint8Array(t.color.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.color.quantized.data.buffer),S),S+=c,t.opacity instanceof Ji&&(w.set(new Uint8Array(t.opacity.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.opacity.quantized.data.buffer),S),S+=d,t.scaling instanceof Ji&&(w.set(new Uint8Array(t.scaling.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.scaling.quantized.data.buffer),S),S+=p,t.quaternion instanceof Ji&&(w.set(new Uint8Array(t.quaternion.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.quaternion.quantized.data.buffer),S),S+=g,b>0&&t.harmonics&&t.harmonics.length>0)for(let E=0;E<t.harmonics.length;E++){let A=t.harmonics[E];A instanceof Ji&&(w.set(new Uint8Array(A.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(A.quantized.data.buffer),S),S+=A.quantized.data.byteLength}return new Pw(w.buffer)}}});async function eR(t){return createImageBitmap(new Blob([t]))}async function iR(t){return fetch(t).then(e=>{if(!e.ok)throw new Error(`Failed to fetch image: ${e.statusText}`);return e.blob()}).then(e=>createImageBitmap(e))}function vq(t){if(typeof t.requestVideoFrameCallback!="function"){t.hanaClockBase=++Ow*fq;return}t.hanaPresentedFrames=++Ow;let e=()=>{t.hanaDisposed||(t.hanaPresentedFrames=++Ow)};t.addEventListener("seeked",e);let i=()=>{e(),!t.hanaDisposed&&(t.hanaFrameCallback=t.requestVideoFrameCallback(i))};t.hanaFrameCallback=t.requestVideoFrameCallback(i)}function nR(t){let e=t.hanaPresentedFrames;return e===void 0?t.hanaClockBase+t.currentTime:e}function yq(t,e){t.hanaObjectUrl=URL.createObjectURL(e),t.src=t.hanaObjectUrl}function Iw(t){if(t.hanaDisposed)return;t.hanaDisposed=!0;let e=t.hanaFrameCallback;e!==void 0&&(t.hanaFrameCallback=void 0,typeof t.cancelVideoFrameCallback=="function"&&t.cancelVideoFrameCallback(e));let i=t.hanaObjectUrl;i!==void 0&&(t.hanaObjectUrl=void 0,URL.revokeObjectURL(i)),t.pause(),t.removeAttribute("src"),t.load()}function _q(t){let e=n=>{let r=t.error;return new Error(r===null?n:`${n} (code ${r.code}: ${r.message})`)},i=n=>{let r=e(n);return Iw(t),r};return t.error!==null?Promise.reject(i("video failed to load")):t.readyState>=mq?Promise.resolve(t):new Promise((n,r)=>{let s=setTimeout(()=>a(r,i("video timed out before presenting a frame")),gq),a=(c,h)=>{clearTimeout(s),t.removeEventListener("loadeddata",o),t.removeEventListener("canplay",o),t.removeEventListener("error",l),c(h)},o=()=>a(n,t),l=()=>a(r,i("video failed to load"));t.addEventListener("loadeddata",o),t.addEventListener("canplay",o),t.addEventListener("error",l)})}function rR(t){return t.preload="auto",t.autoplay=!0,t.loop=!0,t.muted=!0,t.playsInline=!0,t.currentTime=.01,t.load(),t.onloadeddata=()=>{t.muted=!0;let e=t.play();e!==void 0&&e.then(i=>{}).catch(()=>{t.play()}).finally(()=>{t.pause()})},vq(t),_q(t)}async function sR(t){let e=document.createElement("video");return yq(e,new Blob([t])),rR(e)}async function aR(t){let e=document.createElement("video");return e.crossOrigin="anonymous",e.src=t,rR(e)}var Ow,fq,mq,gq,oR=Kp(()=>{"use strict";Ow=0,fq=1e6,mq=2,gq=3e4});var xR={};yw(xR,{DeviceLostPromise:()=>Al,Engine:()=>Tl,HeadlessEngine:()=>Cl,PixelReadPromise:()=>wo,SceneController:()=>yf,addRealizedChild:()=>bq,componentInstanceRefreshOps:()=>xq,default:()=>wX,dematerializeInstance:()=>wq,duplicateComponentInstance:()=>Sq,initSync:()=>xX,overrideForRealizedEdit:()=>Mq,realizeComponentInstance:()=>Eq,removeRealizedNode:()=>Aq,web_init:()=>Tq});function bq(t,e,i,n,r){let s=X.addRealizedChild(G(t),G(e),G(i),G(n),G(r));return Kt(s)}function xq(t,e,i,n,r){let s=X.componentInstanceRefreshOps(G(t),G(e),G(i),G(n),G(r));return Kt(s)}function wq(t,e,i,n){let r=X.dematerializeInstance(G(t),G(e),G(i),G(n));return Kt(r)}function Sq(t,e,i,n){let r=X.duplicateComponentInstance(G(t),G(e),G(i),G(n));return Kt(r)}function Mq(t,e,i,n,r){let s=X.overrideForRealizedEdit(G(t),G(e),G(i),G(n),G(r));return Kt(s)}function Eq(t,e,i){let n=X.realizeComponentInstance(G(t),G(e),G(i));return Kt(n)}function Aq(t,e,i,n){let r=X.removeRealizedNode(G(t),G(e),G(i),G(n));return Kt(r)}function Tq(){X.web_init()}function _R(){return{__proto__:null,"./hana_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(e,i){let n=Error(Te(e,i));return G(n)},__wbg_Number_6b506e6536831eaa:function(e){return Number(M(e))},__wbg_Window_afcc911b2f9c92e2:function(e){let i=M(e).Window;return G(i)},__wbg_WorkerGlobalScope_5d19ebc889ff397e:function(e){let i=M(e).WorkerGlobalScope;return G(i)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(e,i){let n=M(i),r=typeof n=="bigint"?n:void 0;ie().setBigInt64(e+8,ne(r)?BigInt(0):r,!0),ie().setInt32(e+0,!ne(r),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(e){let i=M(e),n=typeof i=="boolean"?i:void 0;return ne(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,i){let n=Gw(M(i)),r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg___wbindgen_in_70a403a56e771704:function(e,i){return M(e)in M(i)},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(e){return typeof M(e)=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(e){return typeof M(e)=="function"},__wbg___wbindgen_is_null_87c3bfe968c6a5ad:function(e){return M(e)===null},__wbg___wbindgen_is_null_or_undefined_cf617b836541fad3:function(e){return M(e)==null},__wbg___wbindgen_is_object_56732c2bc353f41d:function(e){let i=M(e);return typeof i=="object"&&i!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(e){return typeof M(e)=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(e){return M(e)===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(e,i){return M(e)===M(i)},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(e,i){return M(e)==M(i)},__wbg___wbindgen_number_get_9bb1761122181af2:function(e,i){let n=M(i),r=typeof n=="number"?n:void 0;ie().setFloat64(e+8,ne(r)?0:r,!0),ie().setInt32(e+0,!ne(r),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(e,i){let n=M(i),r=typeof n=="string"?n:void 0;var s=ne(r)?0:tn(r,X.__wbindgen_export,X.__wbindgen_export2),a=Ai;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(e,i){throw new Error(Te(e,i))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(e){M(e)._wbg_cb_unref()},__wbg_activeTexture_7a0d6fe7120979ce:function(e,i){M(e).activeTexture(i>>>0)},__wbg_activeTexture_dd15c31d50b73529:function(e,i){M(e).activeTexture(i>>>0)},__wbg_addEventListener_5593b0efd622abd6:function(){return Zt(function(e,i,n,r,s){M(e).addEventListener(Te(i,n),M(r),M(s))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return Zt(function(e){let i=M(e).arrayBuffer();return G(i)},arguments)},__wbg_assign_551ec2d000f70c24:function(){return Zt(function(e,i,n){M(e).assign(Te(i,n))},arguments)},__wbg_attachShader_5c6a46e7c0fc637a:function(e,i,n){M(e).attachShader(M(i),M(n))},__wbg_attachShader_c2b12b36afa45936:function(e,i,n){M(e).attachShader(M(i),M(n))},__wbg_beginComputePass_431a159006c13c7c:function(e,i){let n=M(e).beginComputePass(M(i));return G(n)},__wbg_beginRenderPass_aa22c432e793359a:function(){return Zt(function(e,i){let n=M(e).beginRenderPass(M(i));return G(n)},arguments)},__wbg_bindBuffer_3841df88ccee4ed0:function(e,i,n){M(e).bindBuffer(i>>>0,M(n))},__wbg_bindBuffer_aa5dc7dc1c8ad1c8:function(e,i,n){M(e).bindBuffer(i>>>0,M(n))},__wbg_bindFramebuffer_10bbdf7040d89a17:function(e,i,n){M(e).bindFramebuffer(i>>>0,M(n))},__wbg_bindFramebuffer_ee8e42543c29c602:function(e,i,n){M(e).bindFramebuffer(i>>>0,M(n))},__wbg_bindRenderbuffer_7808d8eabbe18554:function(e,i,n){M(e).bindRenderbuffer(i>>>0,M(n))},__wbg_bindRenderbuffer_c0360bfb79c193c2:function(e,i,n){M(e).bindRenderbuffer(i>>>0,M(n))},__wbg_bindTexture_28d1d695d4801955:function(e,i,n){M(e).bindTexture(i>>>0,M(n))},__wbg_bindTexture_a1a012a31e1419d5:function(e,i,n){M(e).bindTexture(i>>>0,M(n))},__wbg_bindVertexArrayOES_15e48910a5d208b1:function(e,i){M(e).bindVertexArrayOES(M(i))},__wbg_bindVertexArray_4f2f0a7892280041:function(e,i){M(e).bindVertexArray(M(i))},__wbg_blendEquation_1ced323efc9ce0f8:function(e,i){M(e).blendEquation(i>>>0)},__wbg_blendEquation_a12f5acd9d14fb9b:function(e,i){M(e).blendEquation(i>>>0)},__wbg_blendFunc_d5202c7fe94c67ee:function(e,i,n){M(e).blendFunc(i>>>0,n>>>0)},__wbg_blendFunc_fbff85cd0fce280e:function(e,i,n){M(e).blendFunc(i>>>0,n>>>0)},__wbg_blitFramebuffer_acb954bfb30ed714:function(e,i,n,r,s,a,o,l,c,h,d){M(e).blitFramebuffer(i,n,r,s,a,o,l,c,h>>>0,d>>>0)},__wbg_bufferData_043a7e5da22f40d9:function(e,i,n,r){M(e).bufferData(i>>>0,n,r>>>0)},__wbg_bufferData_7b6881381d415425:function(e,i,n,r){M(e).bufferData(i>>>0,M(n),r>>>0)},__wbg_bufferData_9fddca30299e6114:function(e,i,n,r){M(e).bufferData(i>>>0,n,r>>>0)},__wbg_bufferData_f0837cec09725cc0:function(e,i,n,r){M(e).bufferData(i>>>0,M(n),r>>>0)},__wbg_bufferSubData_885e4f8d5833cf11:function(e,i,n,r){M(e).bufferSubData(i>>>0,n,M(r))},__wbg_bufferSubData_8fc824b6a9503f12:function(e,i,n,r){M(e).bufferSubData(i>>>0,n,M(r))},__wbg_call_8a89609d89f6608a:function(){return Zt(function(e,i){let n=M(e).call(M(i));return G(n)},arguments)},__wbg_call_9c758de292015997:function(){return Zt(function(e,i,n){let r=M(e).call(M(i),M(n));return G(r)},arguments)},__wbg_clearBufferfv_2e2858bd8bcf1715:function(e,i,n,r,s){M(e).clearBufferfv(i>>>0,n,ds(r,s))},__wbg_clearBufferiv_e356514eb1d165fe:function(e,i,n,r,s){M(e).clearBufferiv(i>>>0,n,vR(r,s))},__wbg_compileShader_8810a4868b23621b:function(e,i){M(e).compileShader(M(i))},__wbg_compileShader_ec8d5eb7f2b70a48:function(e,i){M(e).compileShader(M(i))},__wbg_configure_0e4789c0f6b35c8e:function(){return Zt(function(e,i){M(e).configure(M(i))},arguments)},__wbg_copyBufferSubData_9936fdf5e53e1832:function(e,i,n,r,s,a){M(e).copyBufferSubData(i>>>0,n>>>0,r,s,a)},__wbg_copyBufferToBuffer_5e2cd8f10ae78183:function(){return Zt(function(e,i,n,r,s){M(e).copyBufferToBuffer(M(i),n,M(r),s)},arguments)},__wbg_copyBufferToBuffer_ca30deb8de65f5d5:function(){return Zt(function(e,i,n,r,s,a){M(e).copyBufferToBuffer(M(i),n,M(r),s,a)},arguments)},__wbg_copyExternalImageToTexture_4df105bb39517948:function(){return Zt(function(e,i,n,r){M(e).copyExternalImageToTexture(M(i),M(n),M(r))},arguments)},__wbg_copyTextureToBuffer_ed6e67a77ecb768d:function(){return Zt(function(e,i,n,r){M(e).copyTextureToBuffer(M(i),M(n),M(r))},arguments)},__wbg_createBindGroupLayout_49a7e2b3d076afcf:function(){return Zt(function(e,i){let n=M(e).createBindGroupLayout(M(i));return G(n)},arguments)},__wbg_createBindGroup_655c6e6c0258530e:function(e,i){let n=M(e).createBindGroup(M(i));return G(n)},__wbg_createBuffer_0726dd2ab09ea1d2:function(){return Zt(function(e,i){let n=M(e).createBuffer(M(i));return G(n)},arguments)},__wbg_createBuffer_333d6aae40284594:function(e){let i=M(e).createBuffer();return ne(i)?0:G(i)},__wbg_createBuffer_3ae54605e5676c83:function(e){let i=M(e).createBuffer();return ne(i)?0:G(i)},__wbg_createCommandEncoder_ec1f40f0cb4d09df:function(e,i){let n=M(e).createCommandEncoder(M(i));return G(n)},__wbg_createComputePipelineAsync_afe7021ac5a02993:function(e,i){let n=M(e).createComputePipelineAsync(M(i));return G(n)},__wbg_createFramebuffer_6f42ff976bb98152:function(e){let i=M(e).createFramebuffer();return ne(i)?0:G(i)},__wbg_createFramebuffer_ef1247e8b2e9b09f:function(e){let i=M(e).createFramebuffer();return ne(i)?0:G(i)},__wbg_createPipelineLayout_2c8cd4528b06c108:function(e,i){let n=M(e).createPipelineLayout(M(i));return G(n)},__wbg_createProgram_b48c3323af547213:function(e){let i=M(e).createProgram();return ne(i)?0:G(i)},__wbg_createProgram_f6a8df4491031d57:function(e){let i=M(e).createProgram();return ne(i)?0:G(i)},__wbg_createQuerySet_cb7b21d1d405b890:function(){return Zt(function(e,i){let n=M(e).createQuerySet(M(i));return G(n)},arguments)},__wbg_createRenderPipelineAsync_eecad1e54ef27acf:function(e,i){let n=M(e).createRenderPipelineAsync(M(i));return G(n)},__wbg_createRenderPipeline_cf98d4d699bfb03c:function(){return Zt(function(e,i){let n=M(e).createRenderPipeline(M(i));return G(n)},arguments)},__wbg_createRenderbuffer_a2f947c7fa8c8bf0:function(e){let i=M(e).createRenderbuffer();return ne(i)?0:G(i)},__wbg_createRenderbuffer_c09d5809ac95924e:function(e){let i=M(e).createRenderbuffer();return ne(i)?0:G(i)},__wbg_createSampler_c8ffb3c8d565f704:function(e,i){let n=M(e).createSampler(M(i));return G(n)},__wbg_createShaderModule_2e44fc7677c6288b:function(e,i){let n=M(e).createShaderModule(M(i));return G(n)},__wbg_createShader_0e3f814b69e9e184:function(e,i){let n=M(e).createShader(i>>>0);return ne(n)?0:G(n)},__wbg_createShader_383b3295276271d2:function(e,i){let n=M(e).createShader(i>>>0);return ne(n)?0:G(n)},__wbg_createTexture_1bac74c999b8a48e:function(){return Zt(function(e,i){let n=M(e).createTexture(M(i));return G(n)},arguments)},__wbg_createTexture_461a3048c40e7175:function(e){let i=M(e).createTexture();return ne(i)?0:G(i)},__wbg_createTexture_d6e2c1f04a554a15:function(e){let i=M(e).createTexture();return ne(i)?0:G(i)},__wbg_createVertexArrayOES_2f67d3679ba9a29c:function(e){let i=M(e).createVertexArrayOES();return ne(i)?0:G(i)},__wbg_createVertexArray_febd1d11636d15ad:function(e){let i=M(e).createVertexArray();return ne(i)?0:G(i)},__wbg_createView_ceaf2f5881adbd34:function(){return Zt(function(e,i){let n=M(e).createView(M(i));return G(n)},arguments)},__wbg_cullFace_a4ee8b8c3c126388:function(e,i){M(e).cullFace(i>>>0)},__wbg_cullFace_c6b39a55ccade015:function(e,i){M(e).cullFace(i>>>0)},__wbg_currentTime_0b40b60bc76843cb:function(e){return M(e).currentTime},__wbg_debug_78b457f1effb3792:function(e){console.debug(M(e))},__wbg_deleteBuffer_520156dc8a1f81af:function(e,i){M(e).deleteBuffer(M(i))},__wbg_deleteBuffer_a925fdd1b590fbbc:function(e,i){M(e).deleteBuffer(M(i))},__wbg_deleteFramebuffer_aa4bf9f184123318:function(e,i){M(e).deleteFramebuffer(M(i))},__wbg_deleteFramebuffer_cc043e5a8cb9a556:function(e,i){M(e).deleteFramebuffer(M(i))},__wbg_deleteProgram_0c859ebcab2b7b5a:function(e,i){M(e).deleteProgram(M(i))},__wbg_deleteProgram_df6a6609c7d91a6e:function(e,i){M(e).deleteProgram(M(i))},__wbg_deleteRenderbuffer_37c079dbc257fcf9:function(e,i){M(e).deleteRenderbuffer(M(i))},__wbg_deleteRenderbuffer_4b7a888363766554:function(e,i){M(e).deleteRenderbuffer(M(i))},__wbg_deleteShader_170dea06bd074d01:function(e,i){M(e).deleteShader(M(i))},__wbg_deleteShader_944accd60733a9cb:function(e,i){M(e).deleteShader(M(i))},__wbg_deleteTexture_54dee8e15570751e:function(e,i){M(e).deleteTexture(M(i))},__wbg_deleteTexture_be3eaabebb89a85e:function(e,i){M(e).deleteTexture(M(i))},__wbg_deleteVertexArrayOES_4262d2d0e9fb77c5:function(e,i){M(e).deleteVertexArrayOES(M(i))},__wbg_deleteVertexArray_8f0fb3b3d54c7483:function(e,i){M(e).deleteVertexArray(M(i))},__wbg_depthMask_95332b64c5ef8b45:function(e,i){M(e).depthMask(i!==0)},__wbg_depthMask_f55bea4b6c3b9531:function(e,i){M(e).depthMask(i!==0)},__wbg_description_02485704e69b1e7f:function(e,i){let n=M(i).description,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_disable_2cf98ccb81612ef9:function(e,i){M(e).disable(i>>>0)},__wbg_disable_6b825656c54f5646:function(e,i){M(e).disable(i>>>0)},__wbg_dispatchWorkgroups_afb2344298c62227:function(e,i,n,r){M(e).dispatchWorkgroups(i>>>0,n>>>0,r>>>0)},__wbg_displayHeight_465673c1823a1db3:function(e){return M(e).displayHeight},__wbg_displayWidth_73729fd8eb965076:function(e){return M(e).displayWidth},__wbg_disposeVideo_c94c1ccd57a63f68:function(e){Iw(M(e))},__wbg_document_aceb08cd6489baf5:function(e){let i=M(e).document;return ne(i)?0:G(i)},__wbg_done_60cf307fcc680536:function(e){return M(e).done},__wbg_drawArrays_6eb87620c1dcbfb4:function(e,i,n,r){M(e).drawArrays(i>>>0,n,r)},__wbg_drawArrays_f332b526550a641e:function(e,i,n,r){M(e).drawArrays(i>>>0,n,r)},__wbg_drawBuffersWEBGL_10cdfe87c17cd93f:function(e,i){M(e).drawBuffersWEBGL(M(i))},__wbg_drawBuffers_c5a9ee312b2d6fa8:function(e,i){M(e).drawBuffers(M(i))},__wbg_drawElements_23ec4847dad548e0:function(e,i,n,r,s){M(e).drawElements(i>>>0,n,r>>>0,s)},__wbg_drawElements_fe4671e9c358058d:function(e,i,n,r,s){M(e).drawElements(i>>>0,n,r>>>0,s)},__wbg_drawIndexed_d31913e79d58fbac:function(e,i,n,r,s,a){M(e).drawIndexed(i>>>0,n>>>0,r>>>0,s,a>>>0)},__wbg_draw_6877f98847e1e36c:function(e,i,n,r,s){M(e).draw(i>>>0,n>>>0,r>>>0,s>>>0)},__wbg_duration_d6a6a568a0baf72d:function(e){return M(e).duration},__wbg_enableVertexAttribArray_cc09a0312b6adee5:function(e,i){M(e).enableVertexAttribArray(i>>>0)},__wbg_enableVertexAttribArray_f88d3d499ab40ea6:function(e,i){M(e).enableVertexAttribArray(i>>>0)},__wbg_enable_1928c361308989d5:function(e,i){M(e).enable(i>>>0)},__wbg_enable_2cc4ff32a0fd985f:function(e,i){M(e).enable(i>>>0)},__wbg_end_c36889de8ddef882:function(e){M(e).end()},__wbg_end_f99ebed53d4e198a:function(e){M(e).end()},__wbg_engine_new:function(e){let i=Tl.__wrap(e);return G(i)},__wbg_entries_04b37a02507f1713:function(e){let i=Object.entries(M(e));return G(i)},__wbg_error_78ff5b3a29b770e0:function(e){console.error(M(e))},__wbg_error_a6fa202b58aa1cd3:function(e,i){let n,r;try{n=e,r=i,console.error(Te(e,i))}finally{X.__wbindgen_export4(n,r,1)}},__wbg_features_2b07a28fe18ad0ce:function(e){let i=M(e).features;return G(i)},__wbg_features_d4d2020319592cbe:function(e){let i=M(e).features;return G(i)},__wbg_fetch_aee1ab744a69f263:function(){return Zt(function(e,i,n){let r=fetch(Te(e,i),M(n));return G(r)},arguments)},__wbg_finish_4d91de5e927dd13f:function(e,i){let n=M(e).finish(M(i));return G(n)},__wbg_finish_6e06b68ab68cd9f6:function(e){let i=M(e).finish();return G(i)},__wbg_flush_2088ebca1fd13068:function(e){M(e).flush()},__wbg_flush_3be48fce9f195fa5:function(e){M(e).flush()},__wbg_framebufferRenderbuffer_0c9d0e5587497683:function(e,i,n,r,s){M(e).framebufferRenderbuffer(i>>>0,n>>>0,r>>>0,M(s))},__wbg_framebufferRenderbuffer_599e58ad30dcfeb3:function(e,i,n,r,s){M(e).framebufferRenderbuffer(i>>>0,n>>>0,r>>>0,M(s))},__wbg_framebufferTexture2D_44caed1725e57636:function(e,i,n,r,s,a){M(e).framebufferTexture2D(i>>>0,n>>>0,r>>>0,M(s),a)},__wbg_framebufferTexture2D_fbba21b750c2316a:function(e,i,n,r,s,a){M(e).framebufferTexture2D(i>>>0,n>>>0,r>>>0,M(s),a)},__wbg_from_d300fe49deab18f5:function(e){let i=Array.from(M(e));return G(i)},__wbg_generateMipmap_1403959fc241438f:function(e,i){M(e).generateMipmap(i>>>0)},__wbg_generateMipmap_b261c040d5707fe5:function(e,i){M(e).generateMipmap(i>>>0)},__wbg_getActiveUniform_3a275fd8fdf7a327:function(e,i,n){let r=M(e).getActiveUniform(M(i),n>>>0);return ne(r)?0:G(r)},__wbg_getActiveUniform_86f7a30e1a52aca4:function(e,i,n){let r=M(e).getActiveUniform(M(i),n>>>0);return ne(r)?0:G(r)},__wbg_getContext_469d34698d869fc1:function(){return Zt(function(e,i,n){let r=M(e).getContext(Te(i,n));return ne(r)?0:G(r)},arguments)},__wbg_getContext_5b39fff76491fded:function(){return Zt(function(e,i,n,r){let s=M(e).getContext(Te(i,n),M(r));return ne(s)?0:G(s)},arguments)},__wbg_getContext_7d3a8f461c828713:function(){return Zt(function(e,i,n){let r=M(e).getContext(Te(i,n));return ne(r)?0:G(r)},arguments)},__wbg_getCurrentTexture_20714d1bd9051cab:function(){return Zt(function(e){let i=M(e).getCurrentTexture();return G(i)},arguments)},__wbg_getExtension_454cdc5ffd07bf03:function(){return Zt(function(e,i,n){let r=M(e).getExtension(Te(i,n));return ne(r)?0:G(r)},arguments)},__wbg_getMappedRange_d0bf3141224111b6:function(){return Zt(function(e,i,n){let r=M(e).getMappedRange(i,n);return G(r)},arguments)},__wbg_getParameter_015942a7ad566b20:function(){return Zt(function(e,i){let n=M(e).getParameter(i>>>0);return G(n)},arguments)},__wbg_getParameter_1e77e23f5ccf0300:function(){return Zt(function(e,i){let n=M(e).getParameter(i>>>0);return G(n)},arguments)},__wbg_getPreferredCanvasFormat_8b57039d1801a506:function(e){let i=M(e).getPreferredCanvasFormat();return(jh.indexOf(i)+1||102)-1},__wbg_getProgramInfoLog_2f9cfcecc4f772e1:function(e,i,n){let r=M(i).getProgramInfoLog(M(n));var s=ne(r)?0:tn(r,X.__wbindgen_export,X.__wbindgen_export2),a=Ai;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getProgramInfoLog_f0d48f606547aed7:function(e,i,n){let r=M(i).getProgramInfoLog(M(n));var s=ne(r)?0:tn(r,X.__wbindgen_export,X.__wbindgen_export2),a=Ai;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getProgramParameter_08beabb2736d5769:function(e,i,n){let r=M(e).getProgramParameter(M(i),n>>>0);return G(r)},__wbg_getProgramParameter_aee848e1db52b7cd:function(e,i,n){let r=M(e).getProgramParameter(M(i),n>>>0);return G(r)},__wbg_getRandomValues_3f44b700395062e5:function(){return Zt(function(e,i){globalThis.crypto.getRandomValues(El(e,i))},arguments)},__wbg_getRandomValues_bf16787eede473f5:function(){return Zt(function(e,i){globalThis.crypto.getRandomValues(El(e,i))},arguments)},__wbg_getShaderInfoLog_510365af17f29a35:function(e,i,n){let r=M(i).getShaderInfoLog(M(n));var s=ne(r)?0:tn(r,X.__wbindgen_export,X.__wbindgen_export2),a=Ai;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getShaderInfoLog_cd77c7b7bdb9ce65:function(e,i,n){let r=M(i).getShaderInfoLog(M(n));var s=ne(r)?0:tn(r,X.__wbindgen_export,X.__wbindgen_export2),a=Ai;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getSupportedExtensions_7a31b3412a25d9ba:function(e){let i=M(e).getSupportedExtensions();return ne(i)?0:G(i)},__wbg_getUniformLocation_010256f946f9a865:function(e,i,n,r){let s=M(e).getUniformLocation(M(i),Te(n,r));return ne(s)?0:G(s)},__wbg_getUniformLocation_f9774d4f157f5914:function(e,i,n,r){let s=M(e).getUniformLocation(M(i),Te(n,r));return ne(s)?0:G(s)},__wbg_get_1f8f054ddbaa7db2:function(){return Zt(function(e,i){let n=Reflect.get(M(e),M(i));return G(n)},arguments)},__wbg_get_2b48c7d0d006a781:function(e,i){let n=M(e)[i>>>0];return G(n)},__wbg_get_cb935c1402921898:function(e,i){let n=M(e)[i>>>0];return ne(n)?0:G(n)},__wbg_get_de6a0f7d4d18a304:function(){return Zt(function(e,i){let n=Reflect.get(M(e),M(i));return G(n)},arguments)},__wbg_get_index_ab123d64c89e3156:function(e,i){return M(e)[i>>>0]},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(e,i){let n=M(e)[i>>>0];return G(n)},__wbg_get_with_ref_key_6412cf3094599694:function(e,i){let n=M(e)[M(i)];return G(n)},__wbg_get_with_ref_key_7e638bba08a44478:function(e,i){let n=M(e)[M(i)];return G(n)},__wbg_gpu_2ccc250735d24a2a:function(e){let i=M(e).gpu;return G(i)},__wbg_has_0c97053e877f47cc:function(e,i,n){return M(e).has(Te(i,n))},__wbg_has_73740b27f436fed3:function(){return Zt(function(e,i){return Reflect.has(M(e),M(i))},arguments)},__wbg_height_4e7694e4e2110bdb:function(e){return M(e).height},__wbg_info_af7f45292ba9b0ea:function(e){console.info(M(e))},__wbg_info_cf0d9a286850cd24:function(e){let i=M(e).info;return G(i)},__wbg_innerHeight_8b6ee2571dbedb9d:function(){return Zt(function(e){let i=M(e).innerHeight;return G(i)},arguments)},__wbg_innerWidth_7475bec19f48fe43:function(){return Zt(function(e){let i=M(e).innerWidth;return G(i)},arguments)},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(e){let i;try{i=M(e)instanceof ArrayBuffer}catch{i=!1}return i},__wbg_instanceof_GpuOutOfMemoryError_6429c750997f1c8d:function(e){let i;try{i=M(e)instanceof GPUOutOfMemoryError}catch{i=!1}return i},__wbg_instanceof_GpuValidationError_75fa3611f065f4df:function(e){let i;try{i=M(e)instanceof GPUValidationError}catch{i=!1}return i},__wbg_instanceof_HtmlVideoElement_95590e1ff107ba83:function(e){let i;try{i=M(e)instanceof HTMLVideoElement}catch{i=!1}return i},__wbg_instanceof_ImageBitmap_beed1259521cd66d:function(e){let i;try{i=M(e)instanceof ImageBitmap}catch{i=!1}return i},__wbg_instanceof_Response_cb984bd66d7bd408:function(e){let i;try{i=M(e)instanceof Response}catch{i=!1}return i},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(e){let i;try{i=M(e)instanceof Uint8Array}catch{i=!1}return i},__wbg_instanceof_WebGl2RenderingContext_39d13e3f953130c7:function(e){let i;try{i=M(e)instanceof WebGL2RenderingContext}catch{i=!1}return i},__wbg_instanceof_Window_e093be59ee9a8e14:function(e){let i;try{i=M(e)instanceof Window}catch{i=!1}return i},__wbg_invalidateFramebuffer_6b8dae55a3debb1d:function(){return Zt(function(e,i,n){M(e).invalidateFramebuffer(i>>>0,M(n))},arguments)},__wbg_isArray_67c2c9c4313f4448:function(e){return Array.isArray(M(e))},__wbg_isFallbackAdapter_8ccb967428491dcb:function(e){return M(e).isFallbackAdapter},__wbg_isSafeInteger_66acec27e09e99a7:function(e){return Number.isSafeInteger(M(e))},__wbg_iterator_8732428d309e270e:function(){return G(Symbol.iterator)},__wbg_label_7ed42f25f841996b:function(e,i){let n=M(i).label,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_length_280688879ee7deb5:function(e){return M(e).length},__wbg_length_4a591ecaa01354d9:function(e){return M(e).length},__wbg_length_66f1a4b2e9026940:function(e){return M(e).length},__wbg_limits_20c6f56636df7d38:function(e){let i=M(e).limits;return G(i)},__wbg_limits_328c61cd41512420:function(e){let i=M(e).limits;return G(i)},__wbg_linkProgram_3ccc9beaa6dace28:function(e,i){M(e).linkProgram(M(i))},__wbg_linkProgram_fe2b1bf26336c4a5:function(e,i){M(e).linkProgram(M(i))},__wbg_loadImageFromBytes_3d42766b73aca4ca:function(e){let i=eR(Kt(e));return G(i)},__wbg_loadImageFromUrl_50be99dbf040255b:function(e,i){let n,r;try{n=e,r=i;let s=iR(Te(e,i));return G(s)}finally{X.__wbindgen_export4(n,r,1)}},__wbg_loadVideoFromBytes_3d884aadcf4d2139:function(e){let i=sR(Kt(e));return G(i)},__wbg_loadVideoFromUrl_7997ffb030d4b08b:function(e,i){let n,r;try{n=e,r=i;let s=aR(Te(e,i));return G(s)}finally{X.__wbindgen_export4(n,r,1)}},__wbg_location_efdf1fea18b5552a:function(e){let i=M(e).location;return G(i)},__wbg_log_cf2e968649f3384e:function(e){console.log(M(e))},__wbg_lost_0fa164c88f543338:function(e){let i=M(e).lost;return G(i)},__wbg_mapAsync_52b01fa9e8f765fd:function(e,i,n,r){let s=M(e).mapAsync(i>>>0,n,r);return G(s)},__wbg_maxBindGroupsPlusVertexBuffers_33e5006b23e20478:function(e){return M(e).maxBindGroupsPlusVertexBuffers},__wbg_maxBindGroups_f6d26f3a67826666:function(e){return M(e).maxBindGroups},__wbg_maxBindingsPerBindGroup_edab2e8dabbf6060:function(e){return M(e).maxBindingsPerBindGroup},__wbg_maxBufferSize_bbc69284c14aa7da:function(e){return M(e).maxBufferSize},__wbg_maxColorAttachmentBytesPerSample_63ebe4f81de2f34c:function(e){return M(e).maxColorAttachmentBytesPerSample},__wbg_maxColorAttachments_aed8c38beabf3a5c:function(e){return M(e).maxColorAttachments},__wbg_maxComputeInvocationsPerWorkgroup_2d964564c37f1c65:function(e){return M(e).maxComputeInvocationsPerWorkgroup},__wbg_maxComputeWorkgroupSizeX_a3e3206570da184f:function(e){return M(e).maxComputeWorkgroupSizeX},__wbg_maxComputeWorkgroupSizeY_dffa4a62244b7563:function(e){return M(e).maxComputeWorkgroupSizeY},__wbg_maxComputeWorkgroupSizeZ_976ebcb760f6d07d:function(e){return M(e).maxComputeWorkgroupSizeZ},__wbg_maxComputeWorkgroupStorageSize_2e8dbece6e532e2a:function(e){return M(e).maxComputeWorkgroupStorageSize},__wbg_maxComputeWorkgroupsPerDimension_bb7d36b4d20c80f4:function(e){return M(e).maxComputeWorkgroupsPerDimension},__wbg_maxDynamicStorageBuffersPerPipelineLayout_1ca859cb96a414e0:function(e){return M(e).maxDynamicStorageBuffersPerPipelineLayout},__wbg_maxDynamicUniformBuffersPerPipelineLayout_e968f2c8cd8f4d46:function(e){return M(e).maxDynamicUniformBuffersPerPipelineLayout},__wbg_maxInterStageShaderVariables_138ac882c4d6a3d3:function(e){return M(e).maxInterStageShaderVariables},__wbg_maxSampledTexturesPerShaderStage_bb3e6b2698321fa6:function(e){return M(e).maxSampledTexturesPerShaderStage},__wbg_maxSamplersPerShaderStage_98c00a1829fa414b:function(e){return M(e).maxSamplersPerShaderStage},__wbg_maxStorageBufferBindingSize_e500e31f479e669e:function(e){return M(e).maxStorageBufferBindingSize},__wbg_maxStorageBuffersPerShaderStage_eb663f6d7521b6a7:function(e){return M(e).maxStorageBuffersPerShaderStage},__wbg_maxStorageTexturesPerShaderStage_bb3ad93b53e618c0:function(e){return M(e).maxStorageTexturesPerShaderStage},__wbg_maxTextureArrayLayers_2a56d05fb261c99a:function(e){return M(e).maxTextureArrayLayers},__wbg_maxTextureDimension1D_84590c1d4770d319:function(e){return M(e).maxTextureDimension1D},__wbg_maxTextureDimension2D_7f2b5c8b2727e3fc:function(e){return M(e).maxTextureDimension2D},__wbg_maxTextureDimension3D_7f3babddf55c32a6:function(e){return M(e).maxTextureDimension3D},__wbg_maxUniformBufferBindingSize_d80a09e23c0b284c:function(e){return M(e).maxUniformBufferBindingSize},__wbg_maxUniformBuffersPerShaderStage_0b8b2de676fa740e:function(e){return M(e).maxUniformBuffersPerShaderStage},__wbg_maxVertexAttributes_a693dd921316649b:function(e){return M(e).maxVertexAttributes},__wbg_maxVertexBufferArrayStride_f256d91f281076cb:function(e){return M(e).maxVertexBufferArrayStride},__wbg_maxVertexBuffers_70ab564b25d5ac20:function(e){return M(e).maxVertexBuffers},__wbg_message_28959d6ca4d7dda0:function(e,i){let n=M(i).message,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_message_4ada57a3710f1502:function(e,i){let n=M(i).message,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_minStorageBufferOffsetAlignment_3248ed00dcdbf79f:function(e){return M(e).minStorageBufferOffsetAlignment},__wbg_minUniformBufferOffsetAlignment_3b9fa4caae03e903:function(e){return M(e).minUniformBufferOffsetAlignment},__wbg_name_b7fa2500fc153b89:function(e,i){let n=M(i).name,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_navigator_3833ecdbc19d2757:function(e){let i=M(e).navigator;return G(i)},__wbg_navigator_391291470f58c650:function(e){let i=M(e).navigator;return G(i)},__wbg_new_227d7c05414eb861:function(){let e=new Error;return G(e)},__wbg_new_3b242422c588a8f3:function(){return Zt(function(e,i){let n=new OffscreenCanvas(e>>>0,i>>>0);return G(n)},arguments)},__wbg_new_578aeef4b6b94378:function(e){let i=new Uint8Array(M(e));return G(i)},__wbg_new_b682b81e8eaaf027:function(e,i){try{var n={a:e,b:i},r=(a,o)=>{let l=n.a;n.a=0;try{return lR(l,n.b,a,o)}finally{n.a=l}};let s=new Promise(r);return G(s)}finally{n.a=0}},__wbg_new_ce1ab61c1c2b300d:function(){let e=new Object;return G(e)},__wbg_new_d90091b82fdf5b91:function(){let e=new Array;return G(e)},__wbg_new_from_slice_18fa1f71286d66b8:function(e,i){let n=new Uint8Array(El(e,i));return G(n)},__wbg_new_from_slice_3c93d0bc613de8f0:function(e,i){let n=new Float64Array(sX(e,i));return G(n)},__wbg_new_from_slice_47be4219028de35d:function(e,i){let n=new Uint32Array(af(e,i));return G(n)},__wbg_new_from_slice_956df4f769fb782c:function(e,i){let n=new Float32Array(ds(e,i));return G(n)},__wbg_new_typed_41c97238ee4583e3:function(){let e=new Object;return G(e)},__wbg_new_typed_bf31d18f92484486:function(e,i){try{var n={a:e,b:i},r=(a,o)=>{let l=n.a;n.a=0;try{return lR(l,n.b,a,o)}finally{n.a=l}};let s=new Promise(r);return G(s)}finally{n.a=0}},__wbg_new_with_byte_offset_and_length_d836f26d916dd9ad:function(e,i,n){let r=new Uint8Array(M(e),i>>>0,n>>>0);return G(r)},__wbg_new_with_length_36a4998e27b014c5:function(e){let i=new Uint8Array(e>>>0);return G(i)},__wbg_new_with_length_b4a87ccced374381:function(e){let i=new Float64Array(e>>>0);return G(i)},__wbg_next_9e03acdf51c4960d:function(e){let i=M(e).next;return G(i)},__wbg_next_eb8ca7351fa27906:function(){return Zt(function(e){let i=M(e).next();return G(i)},arguments)},__wbg_now_f565250295e2d180:function(e){return M(e).now()},__wbg_of_57145fdec12d159f:function(e){let i=Array.of(M(e));return G(i)},__wbg_ok_fb13c30bc1893039:function(e){return M(e).ok},__wbg_onSubmittedWorkDone_270d6b5a45520e79:function(e){let i=M(e).onSubmittedWorkDone();return G(i)},__wbg_open_177ad1dcc06b9106:function(){return Zt(function(e,i,n,r,s,a,o){let l=M(e).open(Te(i,n),Te(r,s),Te(a,o));return ne(l)?0:G(l)},arguments)},__wbg_open_feb75fe4d9971c50:function(){return Zt(function(e,i,n,r,s){let a=M(e).open(Te(i,n),Te(r,s));return ne(a)?0:G(a)},arguments)},__wbg_ownKeys_0587b8fe286a40e6:function(){return Zt(function(e){let i=Reflect.ownKeys(M(e));return G(i)},arguments)},__wbg_pause_adce2b37e004ae49:function(){return Zt(function(e){M(e).pause()},arguments)},__wbg_performance_68499ca0718837f5:function(e){let i=M(e).performance;return ne(i)?0:G(i)},__wbg_pixelStorei_6e42d231aa75bd00:function(e,i,n){M(e).pixelStorei(i>>>0,n)},__wbg_pixelStorei_84dc1952dc699c94:function(e,i,n){M(e).pixelStorei(i>>>0,n)},__wbg_play_4ed9ece3cae2c100:function(){return Zt(function(e){let i=M(e).play();return G(i)},arguments)},__wbg_popErrorScope_8e7f4cbff8b758dd:function(e){let i=M(e).popErrorScope();return G(i)},__wbg_prototypesetcall_3249fc62a0fafa30:function(e,i,n){Uint8Array.prototype.set.call(El(e,i),M(n))},__wbg_prototypesetcall_59640349d2c6d881:function(e,i,n){Uint32Array.prototype.set.call(af(e,i),M(n))},__wbg_provokingVertexWEBGL_0354dc7ad44d69bf:function(e,i){M(e).provokingVertexWEBGL(i>>>0)},__wbg_pushErrorScope_fa23d1206bc26dce:function(e,i){M(e).pushErrorScope(Gq[i])},__wbg_push_a6822215aa43e71c:function(e,i){return M(e).push(M(i))},__wbg_querySelectorAll_4dcc230a2f8a2498:function(){return Zt(function(e,i,n){let r=M(e).querySelectorAll(Te(i,n));return G(r)},arguments)},__wbg_queueMicrotask_35c611f4a14830b2:function(e){queueMicrotask(M(e))},__wbg_queueMicrotask_404ed0a58e0b63cc:function(e){let i=M(e).queueMicrotask;return G(i)},__wbg_queue_adce34608fd0c893:function(e){let i=M(e).queue;return G(i)},__wbg_readBuffer_2027f7cdd7533f2d:function(e,i){M(e).readBuffer(i>>>0)},__wbg_readPixels_a04f5cf5019be695:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_readPixels_bf9ee726d9179d3c:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_readPixels_d00c1cae608273d8:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,l)},arguments)},__wbg_readyState_77b1b1db1b8c2a5f:function(e){return M(e).readyState},__wbg_reason_b02cd587d1a09948:function(e){let i=M(e).reason;return(jq.indexOf(i)+1||3)-1},__wbg_renderbufferStorageMultisample_75bba97a8e59bc6e:function(e,i,n,r,s,a){M(e).renderbufferStorageMultisample(i>>>0,n,r>>>0,s,a)},__wbg_renderbufferStorage_3f5b0ec8fca2f9f8:function(e,i,n,r,s){M(e).renderbufferStorage(i>>>0,n>>>0,r,s)},__wbg_renderbufferStorage_c34a47cacbbc5fff:function(e,i,n,r,s){M(e).renderbufferStorage(i>>>0,n>>>0,r,s)},__wbg_requestAdapter_2e6718811c735a57:function(e,i){let n=M(e).requestAdapter(M(i));return G(n)},__wbg_requestDevice_ab46d0519ea1cc34:function(e,i){let n=M(e).requestDevice(M(i));return G(n)},__wbg_resolveQuerySet_0f32dc3de3f09701:function(e,i,n,r,s,a){M(e).resolveQuerySet(M(i),n>>>0,r>>>0,M(s),a>>>0)},__wbg_resolve_25a7e548d5881dca:function(e){let i=Promise.resolve(M(e));return G(i)},__wbg_scissor_079b7c4a5c9fcb63:function(e,i,n,r,s){M(e).scissor(i,n,r,s)},__wbg_scissor_e69faa631ab6fdc0:function(e,i,n,r,s){M(e).scissor(i,n,r,s)},__wbg_setBindGroup_268fd1714fff0ef5:function(){return Zt(function(e,i,n,r,s,a,o){M(e).setBindGroup(i>>>0,M(n),af(r,s),a,o>>>0)},arguments)},__wbg_setBindGroup_3e4ce136bc833ea1:function(){return Zt(function(e,i,n,r,s,a,o){M(e).setBindGroup(i>>>0,M(n),af(r,s),a,o>>>0)},arguments)},__wbg_setBindGroup_c22a1b95c0b17f37:function(e,i,n){M(e).setBindGroup(i>>>0,M(n))},__wbg_setBindGroup_f0de6cb2c7dbfc2c:function(e,i,n){M(e).setBindGroup(i>>>0,M(n))},__wbg_setIndexBuffer_2531a9103450445e:function(e,i,n,r){M(e).setIndexBuffer(M(i),Uw[n],r)},__wbg_setIndexBuffer_7f3cf667b4d71566:function(e,i,n,r,s){M(e).setIndexBuffer(M(i),Uw[n],r,s)},__wbg_setPipeline_c41bf46790f27f9e:function(e,i){M(e).setPipeline(M(i))},__wbg_setPipeline_d73f019e98c76d2d:function(e,i){M(e).setPipeline(M(i))},__wbg_setStencilReference_66c74be6232bb9da:function(e,i){M(e).setStencilReference(i>>>0)},__wbg_setTimeout_b5f25e402b6e8ff9:function(){return Zt(function(e,i,n){return M(e).setTimeout(M(i),n)},arguments)},__wbg_setVertexBuffer_1e448859663dd400:function(e,i,n,r){M(e).setVertexBuffer(i>>>0,M(n),r)},__wbg_setVertexBuffer_7cf533d694e747f3:function(e,i,n,r,s){M(e).setVertexBuffer(i>>>0,M(n),r,s)},__wbg_setViewport_d9fc3eac343de7d0:function(e,i,n,r,s,a,o){M(e).setViewport(i,n,r,s,a,o)},__wbg_set_29c99a8aac1c01e5:function(e,i,n){M(e).set(El(i,n))},__wbg_set_6e30c9374c26414c:function(){return Zt(function(e,i,n){return Reflect.set(M(e),M(i),M(n))},arguments)},__wbg_set_6f7e2d6e41d9a122:function(e,i,n){M(e)[Kt(i)]=Kt(n)},__wbg_set_a_88262a42340d0b1c:function(e,i){M(e).a=i},__wbg_set_access_9a5092f05dc45fad:function(e,i){M(e).access=Zq[i]},__wbg_set_address_mode_u_9e2695575a219e33:function(e,i){M(e).addressModeU=Lw[i]},__wbg_set_address_mode_v_f479b2e6cccbcac4:function(e,i){M(e).addressModeV=Lw[i]},__wbg_set_address_mode_w_46273e153230180d:function(e,i){M(e).addressModeW=Lw[i]},__wbg_set_alpha_bfd2df62e7bc581b:function(e,i){M(e).alpha=M(i)},__wbg_set_alpha_mode_df805952892caa9c:function(e,i){M(e).alphaMode=Nq[i]},__wbg_set_alpha_to_coverage_enabled_8b5dc2b0a225b3b2:function(e,i){M(e).alphaToCoverageEnabled=i!==0},__wbg_set_array_layer_count_7312f0f31af94e7c:function(e,i){M(e).arrayLayerCount=i>>>0},__wbg_set_array_stride_f64_27ffaf4fffd74e61:function(e,i){M(e).arrayStride=i},__wbg_set_aspect_0d453bca3d012f02:function(e,i){M(e).aspect=kw[i]},__wbg_set_aspect_210da747c9d77aba:function(e,i){M(e).aspect=kw[i]},__wbg_set_aspect_4962514fe99e68e6:function(e,i){M(e).aspect=kw[i]},__wbg_set_attributes_7537844a7e6dafdc:function(e,i,n){M(e).attributes=Zs(i,n)},__wbg_set_b_c47befe0af3261eb:function(e,i){M(e).b=i},__wbg_set_base_array_layer_f176bb9f1b37b342:function(e,i){M(e).baseArrayLayer=i>>>0},__wbg_set_base_mip_level_1df145d9f8db32a9:function(e,i){M(e).baseMipLevel=i>>>0},__wbg_set_beginning_of_pass_write_index_0d4fa06109208ad7:function(e,i){M(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_beginning_of_pass_write_index_e9f5d016947893bd:function(e,i){M(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_bind_group_layouts_5a9cfea401c020ab:function(e,i,n){M(e).bindGroupLayouts=Zs(i,n)},__wbg_set_binding_155b0440b4307793:function(e,i){M(e).binding=i>>>0},__wbg_set_binding_f74df3510792aba1:function(e,i){M(e).binding=i>>>0},__wbg_set_blend_7493c2066c3e9970:function(e,i){M(e).blend=M(i)},__wbg_set_buffer_9c01e3b6d6765ea2:function(e,i){M(e).buffer=M(i)},__wbg_set_buffer_c3410572051920ba:function(e,i){M(e).buffer=M(i)},__wbg_set_buffer_ef7f75306cf663ed:function(e,i){M(e).buffer=M(i)},__wbg_set_buffers_7d0d8f507699e956:function(e,i,n){M(e).buffers=Zs(i,n)},__wbg_set_bytes_per_row_c54ca96953f35774:function(e,i){M(e).bytesPerRow=i>>>0},__wbg_set_bytes_per_row_d69b88eee3929c07:function(e,i){M(e).bytesPerRow=i>>>0},__wbg_set_c775d84916be79ea:function(e,i,n){M(e).set(M(i),n>>>0)},__wbg_set_clear_value_gpu_color_dict_6211425789c76e59:function(e,i){M(e).clearValue=M(i)},__wbg_set_code_b4f37f81f45b5b25:function(e,i,n){M(e).code=Te(i,n)},__wbg_set_color_83aa977526e88cbb:function(e,i){M(e).color=M(i)},__wbg_set_color_attachments_581fdb3310e4abfa:function(e,i,n){M(e).colorAttachments=Zs(i,n)},__wbg_set_compare_cd9b62cdb92eb580:function(e,i){M(e).compare=Bw[i]},__wbg_set_compare_f36b34abfaa08ccb:function(e,i){M(e).compare=Bw[i]},__wbg_set_compute_d0c2d276b6d4b18d:function(e,i){M(e).compute=M(i)},__wbg_set_count_069a4eac409bac55:function(e,i){M(e).count=i>>>0},__wbg_set_count_3ab1c1220e4ceeb3:function(e,i){M(e).count=i>>>0},__wbg_set_cull_mode_fc649853947a3d0c:function(e,i){M(e).cullMode=Vq[i]},__wbg_set_currentTime_7c37e2312e9d2687:function(e,i){M(e).currentTime=i},__wbg_set_depth_bias_clamp_1c0d695df7f092e5:function(e,i){M(e).depthBiasClamp=i},__wbg_set_depth_bias_d7cd16096242a657:function(e,i){M(e).depthBias=i},__wbg_set_depth_bias_slope_scale_c4e52ec743ef55ba:function(e,i){M(e).depthBiasSlopeScale=i},__wbg_set_depth_clear_value_beda3ec5b1a5c43a:function(e,i){M(e).depthClearValue=i},__wbg_set_depth_compare_0c8631eb2eae98e3:function(e,i){M(e).depthCompare=Bw[i]},__wbg_set_depth_fail_op_668155ae33d3c06f:function(e,i){M(e).depthFailOp=Fw[i]},__wbg_set_depth_load_op_511c513eab4e56a9:function(e,i){M(e).depthLoadOp=zw[i]},__wbg_set_depth_or_array_layers_89371305ed0bd962:function(e,i){M(e).depthOrArrayLayers=i>>>0},__wbg_set_depth_read_only_7f41a74741c144ec:function(e,i){M(e).depthReadOnly=i!==0},__wbg_set_depth_stencil_97506c7bea4f53da:function(e,i){M(e).depthStencil=M(i)},__wbg_set_depth_stencil_attachment_73b79e8b4e948222:function(e,i){M(e).depthStencilAttachment=M(i)},__wbg_set_depth_store_op_c89f33b39b43361c:function(e,i){M(e).depthStoreOp=Nw[i]},__wbg_set_depth_write_enabled_ce89750042940350:function(e,i){M(e).depthWriteEnabled=i!==0},__wbg_set_device_e275d1d4f3c9eb74:function(e,i){M(e).device=M(i)},__wbg_set_dimension_868eee80f4b90011:function(e,i){M(e).dimension=Kq[i]},__wbg_set_dimension_e325282e613ca0a4:function(e,i){M(e).dimension=Vw[i]},__wbg_set_dst_factor_ec7407f19be1aff9:function(e,i){M(e).dstFactor=cR[i]},__wbg_set_end_of_pass_write_index_0d546e46b86ea069:function(e,i){M(e).endOfPassWriteIndex=i>>>0},__wbg_set_end_of_pass_write_index_49a6ddbb2b888bfa:function(e,i){M(e).endOfPassWriteIndex=i>>>0},__wbg_set_entries_86a29dd6291c95e7:function(e,i,n){M(e).entries=Zs(i,n)},__wbg_set_entries_a12aca1e458b0456:function(e,i,n){M(e).entries=Zs(i,n)},__wbg_set_entry_point_207540f042015ce5:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_entry_point_5f26aacbe4c545eb:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_entry_point_e87e79251dd3144f:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_external_texture_386483d8dd82ab56:function(e,i){M(e).externalTexture=M(i)},__wbg_set_fail_op_92f716dbc88b6973:function(e,i){M(e).failOp=Fw[i]},__wbg_set_flip_y_4e1632b36ad0413a:function(e,i){M(e).flipY=i!==0},__wbg_set_format_1fcaa7d60546b490:function(e,i){M(e).format=jh[i]},__wbg_set_format_2c1414a817c213f8:function(e,i){M(e).format=jh[i]},__wbg_set_format_533f9ffa7eef563d:function(e,i){M(e).format=jh[i]},__wbg_set_format_5d2f25cc93654ecc:function(e,i){M(e).format=Jq[i]},__wbg_set_format_5ff53724ed6cedf2:function(e,i){M(e).format=jh[i]},__wbg_set_format_815efd4dc4817bbb:function(e,i){M(e).format=jh[i]},__wbg_set_format_e52bdcca880d2c8e:function(e,i){M(e).format=jh[i]},__wbg_set_fragment_8b780f00a0b0e6f3:function(e,i){M(e).fragment=M(i)},__wbg_set_front_face_28ffdf524eedce5b:function(e,i){M(e).frontFace=Hq[i]},__wbg_set_g_5983abfc46e0cf4e:function(e,i){M(e).g=i},__wbg_set_has_dynamic_offset_62bc230bdb7c54d0:function(e,i){M(e).hasDynamicOffset=i!==0},__wbg_set_height_0739170de8653cc4:function(e,i){M(e).height=i>>>0},__wbg_set_height_14335c4047cf9c1b:function(e,i){M(e).height=i>>>0},__wbg_set_height_c661af0c0b5376f9:function(e,i){M(e).height=i>>>0},__wbg_set_label_08d9be3e4719c226:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_17eb9fe3a02f62b0:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_206558c8adc3780f:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_48e6b787d256f621:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_547d0d4aec39fbe9:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_5ee7427342869829:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_60ad96c811e0d109:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_6db0393d3fdc90a5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_72bb4f41ef0cb893:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_79387decda299036:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_9556af8b5cda3c9d:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_d010f237b26f2c55:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e16e2dbe51349c7f:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e3944e54881b8c50:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e922700240417ab5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_ef44793ddf4455c5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_layout_41021cfd2a2f62df:function(e,i){M(e).layout=M(i)},__wbg_set_layout_50ab727f44b38f26:function(e,i){M(e).layout=M(i)},__wbg_set_layout_913d53c17194c989:function(e,i){M(e).layout=M(i)},__wbg_set_layout_gpu_auto_layout_mode_0a5a185b3d52b726:function(e,i){M(e).layout=hR[i]},__wbg_set_layout_gpu_auto_layout_mode_aeba193938b47882:function(e,i){M(e).layout=hR[i]},__wbg_set_load_op_99661da6c4eab9b0:function(e,i){M(e).loadOp=zw[i]},__wbg_set_lod_max_clamp_dd2d9f9f052f4f44:function(e,i){M(e).lodMaxClamp=i},__wbg_set_lod_min_clamp_6d20c97916baeb93:function(e,i){M(e).lodMinClamp=i},__wbg_set_loop_b622b726769860be:function(e,i){M(e).loop=i!==0},__wbg_set_mag_filter_b5adebc99cb938e1:function(e,i){M(e).magFilter=dR[i]},__wbg_set_mapped_at_creation_81b586dc90a50347:function(e,i){M(e).mappedAtCreation=i!==0},__wbg_set_mask_70a8a59ce09e5997:function(e,i){M(e).mask=i>>>0},__wbg_set_max_anisotropy_2beada0e2db62c45:function(e,i){M(e).maxAnisotropy=i},__wbg_set_method_7a6811dec7a4feff:function(e,i,n){M(e).method=Te(i,n)},__wbg_set_min_binding_size_f64_5005a6904cdf43da:function(e,i){M(e).minBindingSize=i},__wbg_set_min_filter_c72f17375e135f0a:function(e,i){M(e).minFilter=dR[i]},__wbg_set_mip_level_13253f3afc7aa58a:function(e,i){M(e).mipLevel=i>>>0},__wbg_set_mip_level_count_534caaa7e68e68b8:function(e,i){M(e).mipLevelCount=i>>>0},__wbg_set_mip_level_count_776c8c218b65bc08:function(e,i){M(e).mipLevelCount=i>>>0},__wbg_set_mip_level_f7ac79e8c54f59ad:function(e,i){M(e).mipLevel=i>>>0},__wbg_set_mipmap_filter_5bf66195a3639700:function(e,i){M(e).mipmapFilter=Wq[i]},__wbg_set_mode_9990b3393ba469ae:function(e,i){M(e).mode=kq[i]},__wbg_set_mode_c90e3667002857d4:function(e,i){M(e).mode=eX[i]},__wbg_set_module_5db9b76ee2dd2a59:function(e,i){M(e).module=M(i)},__wbg_set_module_d0e2098713606cae:function(e,i){M(e).module=M(i)},__wbg_set_module_f02e076ca7e7daf8:function(e,i){M(e).module=M(i)},__wbg_set_multisample_37ddafe88b5cd466:function(e,i){M(e).multisample=M(i)},__wbg_set_multisampled_7913fd7183272840:function(e,i){M(e).multisampled=i!==0},__wbg_set_muted_16f1e7acd8244e28:function(e,i){M(e).muted=i!==0},__wbg_set_offset_f64_28c24dc15000932e:function(e,i){M(e).offset=i},__wbg_set_offset_f64_89f0ce01a689839e:function(e,i){M(e).offset=i},__wbg_set_offset_f64_b562d1367e34ef93:function(e,i){M(e).offset=i},__wbg_set_offset_f64_fa66068813376ca3:function(e,i){M(e).offset=i},__wbg_set_once_27df5233613a51cd:function(e,i){M(e).once=i!==0},__wbg_set_operation_62ce44e1728c4047:function(e,i){M(e).operation=zq[i]},__wbg_set_origin_gpu_origin_2d_dict_1240202973e56f92:function(e,i){M(e).origin=M(i)},__wbg_set_origin_gpu_origin_3d_dict_37222d7b3d238123:function(e,i){M(e).origin=M(i)},__wbg_set_origin_gpu_origin_3d_dict_631c04520718091f:function(e,i){M(e).origin=M(i)},__wbg_set_pass_op_cf02fa088d6352a7:function(e,i){M(e).passOp=Fw[i]},__wbg_set_power_preference_8fdca0b7af640d49:function(e,i){M(e).powerPreference=qq[i]},__wbg_set_premultiplied_alpha_3f27816ad319d5a9:function(e,i){M(e).premultipliedAlpha=i!==0},__wbg_set_primitive_43c23761a55b4088:function(e,i){M(e).primitive=M(i)},__wbg_set_query_set_41de86d2401aee04:function(e,i){M(e).querySet=M(i)},__wbg_set_query_set_4889dd944d5ec0fd:function(e,i){M(e).querySet=M(i)},__wbg_set_r_c6f4c68f4804d655:function(e,i){M(e).r=i},__wbg_set_required_features_1baf274a8669db60:function(e,i,n){M(e).requiredFeatures=Zs(i,n)},__wbg_set_required_limits_871ed33c68613dcb:function(e,i){M(e).requiredLimits=M(i)},__wbg_set_resolve_target_gpu_texture_view_b19a4f2debf79b96:function(e,i){M(e).resolveTarget=M(i)},__wbg_set_resource_5ae7b5e67924f234:function(e,i){M(e).resource=M(i)},__wbg_set_resource_gpu_buffer_binding_e5dbca063e7cb67b:function(e,i){M(e).resource=M(i)},__wbg_set_resource_gpu_texture_view_eb46c355d51ad7e5:function(e,i){M(e).resource=M(i)},__wbg_set_rows_per_image_5011f97318ee71af:function(e,i){M(e).rowsPerImage=i>>>0},__wbg_set_rows_per_image_59a813ac5006e10e:function(e,i){M(e).rowsPerImage=i>>>0},__wbg_set_sample_count_eb86a8b18545b54f:function(e,i){M(e).sampleCount=i>>>0},__wbg_set_sample_type_c32e1dfff94e63eb:function(e,i){M(e).sampleType=Qq[i]},__wbg_set_sampler_c0e1258543a33bce:function(e,i){M(e).sampler=M(i)},__wbg_set_shader_location_7e1832a74f912217:function(e,i){M(e).shaderLocation=i>>>0},__wbg_set_size_f64_6bcd40704bf4cfdc:function(e,i){M(e).size=i},__wbg_set_size_f64_8b8f6bba5d678162:function(e,i){M(e).size=i},__wbg_set_size_gpu_extent_3d_dict_7e42e1c98fa36434:function(e,i){M(e).size=M(i)},__wbg_set_source_0c40b87cfdd5d704:function(e,i){M(e).source=M(i)},__wbg_set_source_html_canvas_element_f657e39507ba2fe5:function(e,i){M(e).source=M(i)},__wbg_set_source_html_image_element_fcc7cba0635adac1:function(e,i){M(e).source=M(i)},__wbg_set_source_html_video_element_e63a39653665f651:function(e,i){M(e).source=M(i)},__wbg_set_source_image_data_68478f1afce208b8:function(e,i){M(e).source=M(i)},__wbg_set_source_offscreen_canvas_266a3de949693e62:function(e,i){M(e).source=M(i)},__wbg_set_source_video_frame_3083c0ce54b9cb73:function(e,i){M(e).source=M(i)},__wbg_set_src_factor_9bfe84af9b7b5cac:function(e,i){M(e).srcFactor=cR[i]},__wbg_set_stencil_back_85b22f1db5b1940a:function(e,i){M(e).stencilBack=M(i)},__wbg_set_stencil_clear_value_42be608809151e2a:function(e,i){M(e).stencilClearValue=i>>>0},__wbg_set_stencil_front_525526164a798a44:function(e,i){M(e).stencilFront=M(i)},__wbg_set_stencil_load_op_31838c036993098a:function(e,i){M(e).stencilLoadOp=zw[i]},__wbg_set_stencil_read_mask_5cc26495e8b3ae82:function(e,i){M(e).stencilReadMask=i>>>0},__wbg_set_stencil_read_only_bf1d0c1897e25c62:function(e,i){M(e).stencilReadOnly=i!==0},__wbg_set_stencil_store_op_e6be1cbc3a8fc210:function(e,i){M(e).stencilStoreOp=Nw[i]},__wbg_set_stencil_write_mask_d9cb40ec4b4bee5b:function(e,i){M(e).stencilWriteMask=i>>>0},__wbg_set_step_mode_a97bb24714da41a9:function(e,i){M(e).stepMode=tX[i]},__wbg_set_storage_texture_939a097db4b18bd4:function(e,i){M(e).storageTexture=M(i)},__wbg_set_store_op_b5fdf672436f13f3:function(e,i){M(e).storeOp=Nw[i]},__wbg_set_strip_index_format_9f787be6c5fc9e87:function(e,i){M(e).stripIndexFormat=Uw[i]},__wbg_set_targets_c38bd200c836d66f:function(e,i,n){M(e).targets=Zs(i,n)},__wbg_set_texture_016561d5911339e5:function(e,i){M(e).texture=M(i)},__wbg_set_texture_1f64653a5d2d7b4d:function(e,i){M(e).texture=M(i)},__wbg_set_texture_9dcedde1bb31eda6:function(e,i){M(e).texture=M(i)},__wbg_set_timestamp_writes_59c2d19ed8aecd97:function(e,i){M(e).timestampWrites=M(i)},__wbg_set_timestamp_writes_98bed1a8bbc6682d:function(e,i){M(e).timestampWrites=M(i)},__wbg_set_tone_mapping_b3464f1baa4cff92:function(e,i){M(e).toneMapping=M(i)},__wbg_set_topology_da25f2cc5af203d2:function(e,i){M(e).topology=Xq[i]},__wbg_set_type_7f0457c6084dde9b:function(e,i){M(e).type=$q[i]},__wbg_set_type_ccf8472d40abcddf:function(e,i){M(e).type=Yq[i]},__wbg_set_type_d09829f59932a0fc:function(e,i){M(e).type=Fq[i]},__wbg_set_unclipped_depth_04524a2b44e1e3c1:function(e,i){M(e).unclippedDepth=i!==0},__wbg_set_usage_a137f82ca163b0a9:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_b2a2935f37bf3d08:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_ba5b0f8b333ab325:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_ddd42599bbba7779:function(e,i){M(e).usage=i>>>0},__wbg_set_vertex_0be5d146f9ff6f36:function(e,i){M(e).vertex=M(i)},__wbg_set_view_dimension_0df554032f1f3a85:function(e,i){M(e).viewDimension=Vw[i]},__wbg_set_view_dimension_4818d4c18ce5815e:function(e,i){M(e).viewDimension=Vw[i]},__wbg_set_view_formats_4347dc8363331086:function(e,i,n){M(e).viewFormats=Zs(i,n)},__wbg_set_view_formats_5797d2fff3c11808:function(e,i,n){M(e).viewFormats=Zs(i,n)},__wbg_set_view_gpu_texture_view_9b2d86b6b99d9fd9:function(e,i){M(e).view=M(i)},__wbg_set_view_gpu_texture_view_c0f35f8857c25206:function(e,i){M(e).view=M(i)},__wbg_set_visibility_9570b037224c4cc2:function(e,i){M(e).visibility=i>>>0},__wbg_set_volume_520cdc6b7ada8f76:function(e,i){M(e).volume=i},__wbg_set_width_7ca43f32db1cfe8e:function(e,i){M(e).width=i>>>0},__wbg_set_width_87301412247f3343:function(e,i){M(e).width=i>>>0},__wbg_set_width_9f685402c2cbee70:function(e,i){M(e).width=i>>>0},__wbg_set_write_mask_d45279e56abbfcb5:function(e,i){M(e).writeMask=i>>>0},__wbg_set_x_232d24fdc32d8351:function(e,i){M(e).x=i>>>0},__wbg_set_x_876d592971db129a:function(e,i){M(e).x=i>>>0},__wbg_set_y_18fe375093e59dfb:function(e,i){M(e).y=i>>>0},__wbg_set_y_2b1f5ac0dd5586a5:function(e,i){M(e).y=i>>>0},__wbg_set_z_ef005d82bc9d24e3:function(e,i){M(e).z=i>>>0},__wbg_shaderSource_7d18b5a43a504f5c:function(e,i,n,r){M(e).shaderSource(M(i),Te(n,r))},__wbg_shaderSource_df5bb6320451f3cd:function(e,i,n,r){M(e).shaderSource(M(i),Te(n,r))},__wbg_size_211f88d386430781:function(e){return M(e).size},__wbg_src_f0e9281991fbd919:function(e,i){let n=M(i).src,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_stack_3b0d974bbf31e44f:function(e,i){let n=M(i).stack,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){let e=typeof global>"u"?null:global;return ne(e)?0:G(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){let e=typeof globalThis>"u"?null:globalThis;return ne(e)?0:G(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){let e=typeof self>"u"?null:self;return ne(e)?0:G(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){let e=typeof window>"u"?null:window;return ne(e)?0:G(e)},__wbg_stencilFunc_8f53a5508560354d:function(e,i,n,r){M(e).stencilFunc(i>>>0,n,r>>>0)},__wbg_stencilFunc_c7553215f237ee38:function(e,i,n,r){M(e).stencilFunc(i>>>0,n,r>>>0)},__wbg_stencilOp_a844a4e9824eee70:function(e,i,n,r){M(e).stencilOp(i>>>0,n>>>0,r>>>0)},__wbg_stencilOp_e82bd7ea13f18adf:function(e,i,n,r){M(e).stencilOp(i>>>0,n>>>0,r>>>0)},__wbg_subgroupMaxSize_1527c5f7a8fe91bb:function(e){return M(e).subgroupMaxSize},__wbg_subgroupMinSize_d6c5ad4bddc828e9:function(e){return M(e).subgroupMinSize},__wbg_submit_ce44115121cd166c:function(e,i,n){M(e).submit(Zs(i,n))},__wbg_texImage2D_01c22558517ee8db:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_152e9dcd4bc3a464:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texImage2D_3704db20a16b6c35:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texImage2D_63d0b87d5ebe4a7f:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_90633e994ded3d2b:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_ea94e8a2df5f97e2:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,h)},arguments)},__wbg_texImage2D_facfa039fb461b66:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texParameteri_87ebfcefb0af2c50:function(e,i,n,r){M(e).texParameteri(i>>>0,n>>>0,r)},__wbg_texParameteri_e5ad2054e239066e:function(e,i,n,r){M(e).texParameteri(i>>>0,n>>>0,r)},__wbg_texStorage2D_bb2a1bd1ab0b9184:function(e,i,n,r,s,a){M(e).texStorage2D(i>>>0,n,r>>>0,s,a)},__wbg_texSubImage2D_3483ba5f10ee42c2:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).texSubImage2D(i>>>0,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_texSubImage2D_4ca4c3faa4392438:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texSubImage2D_54d18572b1ba74ab:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,h)},arguments)},__wbg_texSubImage2D_5bebe93724e6ed61:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texSubImage2D_5e1594de0416e9f6:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).texSubImage2D(i>>>0,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_then_18f476d590e58992:function(e,i,n){let r=M(e).then(M(i),M(n));return G(r)},__wbg_then_47213a40b6aeb86c:function(e,i){let n=M(e).then(M(i));return G(n)},__wbg_then_ac7b025999b52837:function(e,i){let n=M(e).then(M(i));return G(n)},__wbg_type_71742b859467fa3c:function(e){return M(e).type},__wbg_unconfigure_0a07a0a40de8988d:function(e){M(e).unconfigure()},__wbg_uniform1f_8c3b3e6e3723fe14:function(e,i,n){M(e).uniform1f(M(i),n)},__wbg_uniform1f_d6619faa73c2a45f:function(e,i,n){M(e).uniform1f(M(i),n)},__wbg_uniform1fv_11d5842aff79c8a3:function(e,i,n,r){M(e).uniform1fv(M(i),ds(n,r))},__wbg_uniform1fv_b4b087b4d6e2bb25:function(e,i,n,r){M(e).uniform1fv(M(i),ds(n,r))},__wbg_uniform1i_14982bb8438243b4:function(e,i,n){M(e).uniform1i(M(i),n)},__wbg_uniform1i_cf11d5b364eed1c8:function(e,i,n){M(e).uniform1i(M(i),n)},__wbg_uniform1ui_d177882f473d2afc:function(e,i,n){M(e).uniform1ui(M(i),n>>>0)},__wbg_uniform2f_19fb96222ae72e1a:function(e,i,n,r){M(e).uniform2f(M(i),n,r)},__wbg_uniform2f_44cee47e30b82f96:function(e,i,n,r){M(e).uniform2f(M(i),n,r)},__wbg_uniform2fv_2f06d989ec4b5d8f:function(e,i,n,r){M(e).uniform2fv(M(i),ds(n,r))},__wbg_uniform2fv_f022309b362a80c3:function(e,i,n,r){M(e).uniform2fv(M(i),ds(n,r))},__wbg_uniform2i_16e8a2c966614be6:function(e,i,n,r){M(e).uniform2i(M(i),n,r)},__wbg_uniform2i_d353da02172ea38d:function(e,i,n,r){M(e).uniform2i(M(i),n,r)},__wbg_uniform3f_360c1ea4c73cacef:function(e,i,n,r,s){M(e).uniform3f(M(i),n,r,s)},__wbg_uniform3f_b616f9e06266a25f:function(e,i,n,r,s){M(e).uniform3f(M(i),n,r,s)},__wbg_uniform4f_f1a670d511b34878:function(e,i,n,r,s,a){M(e).uniform4f(M(i),n,r,s,a)},__wbg_uniform4f_f97f3f59af09856f:function(e,i,n,r,s,a){M(e).uniform4f(M(i),n,r,s,a)},__wbg_uniformMatrix3fv_f45b91f173d7fbed:function(e,i,n,r,s){M(e).uniformMatrix3fv(M(i),n!==0,ds(r,s))},__wbg_uniformMatrix3fv_feab3f952d705f51:function(e,i,n,r,s){M(e).uniformMatrix3fv(M(i),n!==0,ds(r,s))},__wbg_uniformMatrix3x2fv_ab13f9742e5fcb2f:function(e,i,n,r,s){M(e).uniformMatrix3x2fv(M(i),n!==0,ds(r,s))},__wbg_uniformMatrix4fv_540dc6bf792eba8f:function(e,i,n,r,s){M(e).uniformMatrix4fv(M(i),n!==0,ds(r,s))},__wbg_uniformMatrix4fv_e3dac9dd429d6adc:function(e,i,n,r,s){M(e).uniformMatrix4fv(M(i),n!==0,ds(r,s))},__wbg_uniformMatrix4x3fv_115d029ad3124cef:function(e,i,n,r,s){M(e).uniformMatrix4x3fv(M(i),n!==0,ds(r,s))},__wbg_unmap_adaf93276fdf9aaf:function(e){M(e).unmap()},__wbg_useProgram_55a3e940abb19137:function(e,i){M(e).useProgram(M(i))},__wbg_useProgram_e24dadf4c06636f5:function(e,i){M(e).useProgram(M(i))},__wbg_userAgent_8def8135d886414b:function(){return Zt(function(e,i){let n=M(i).userAgent,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},arguments)},__wbg_valueOf_41ae57308c1f031c:function(e){return M(e).valueOf()},__wbg_value_f3625092ee4b37f4:function(e){let i=M(e).value;return G(i)},__wbg_vertexAttrib4f_6444504b25f4d43e:function(e,i,n,r,s,a){M(e).vertexAttrib4f(i>>>0,n,r,s,a)},__wbg_vertexAttrib4f_aad41fe000407191:function(e,i,n,r,s,a){M(e).vertexAttrib4f(i>>>0,n,r,s,a)},__wbg_vertexAttribIPointer_ed1c3507e84527e2:function(e,i,n,r,s,a){M(e).vertexAttribIPointer(i>>>0,n,r>>>0,s,a)},__wbg_vertexAttribPointer_39eddea7c20e350c:function(e,i,n,r,s,a,o){M(e).vertexAttribPointer(i>>>0,n,r>>>0,s!==0,a,o)},__wbg_vertexAttribPointer_3bc50c0431082f73:function(e,i,n,r,s,a,o){M(e).vertexAttribPointer(i>>>0,n,r>>>0,s!==0,a,o)},__wbg_videoFrameToken_6f05524e85fa2b75:function(e){return nR(M(e))},__wbg_videoHeight_e267fd1e74bb1b06:function(e){return M(e).videoHeight},__wbg_videoWidth_670b8e775ea04b5d:function(e){return M(e).videoWidth},__wbg_viewport_14d947f2faf58e85:function(e,i,n,r,s){M(e).viewport(i,n,r,s)},__wbg_viewport_24055b0754803788:function(e,i,n,r,s){M(e).viewport(i,n,r,s)},__wbg_warn_410c3261e3c6d686:function(e){console.warn(M(e))},__wbg_width_f1791280fae1517a:function(e){return M(e).width},__wbg_writeTexture_53ba204c494b042c:function(){return Zt(function(e,i,n,r,s,a){M(e).writeTexture(M(i),El(n,r),M(s),M(a))},arguments)},__wbindgen_cast_0000000000000001:function(e,i){let n=xo(e,i,Rq);return G(n)},__wbindgen_cast_0000000000000002:function(e,i){let n=xo(e,i,Pq);return G(n)},__wbindgen_cast_0000000000000003:function(e,i){let n=xo(e,i,Oq);return G(n)},__wbindgen_cast_0000000000000004:function(e,i){let n=xo(e,i,Iq);return G(n)},__wbindgen_cast_0000000000000005:function(e,i){let n=xo(e,i,Dq);return G(n)},__wbindgen_cast_0000000000000006:function(e,i){let n=xo(e,i,Lq);return G(n)},__wbindgen_cast_0000000000000007:function(e,i){let n=xo(e,i,Bq);return G(n)},__wbindgen_cast_0000000000000008:function(e,i){let n=xo(e,i,Uq);return G(n)},__wbindgen_cast_0000000000000009:function(e,i){let n=xo(e,i,Cq);return G(n)},__wbindgen_cast_000000000000000a:function(e){return G(e)},__wbindgen_cast_000000000000000b:function(e,i){let n=ds(e,i);return G(n)},__wbindgen_cast_000000000000000c:function(e,i){let n=aX(e,i);return G(n)},__wbindgen_cast_000000000000000d:function(e,i){let n=vR(e,i);return G(n)},__wbindgen_cast_000000000000000e:function(e,i){let n=oX(e,i);return G(n)},__wbindgen_cast_000000000000000f:function(e,i){let n=lX(e,i);return G(n)},__wbindgen_cast_0000000000000010:function(e,i){let n=af(e,i);return G(n)},__wbindgen_cast_0000000000000011:function(e,i){let n=El(e,i);return G(n)},__wbindgen_cast_0000000000000012:function(e,i){let n=Te(e,i);return G(n)},__wbindgen_cast_0000000000000013:function(e){let i=BigInt.asUintN(64,e);return G(i)},__wbindgen_cast_0000000000000014:function(e,i){var n=El(e,i).slice();return X.__wbindgen_export4(e,i*1,1),G(n)},__wbindgen_object_clone_ref:function(e){let i=M(e);return G(i)},__wbindgen_object_drop_ref:function(e){Kt(e)}}}}function Cq(t,e){X.__wasm_bindgen_func_elem_12530(t,e)}function Pq(t,e,i){X.__wasm_bindgen_func_elem_5131(t,e,G(i))}function Dq(t,e,i){X.__wasm_bindgen_func_elem_11166(t,e,G(i))}function Rq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_14165(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function Oq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_11165(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function Iq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_11165_3(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function Lq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_11165_5(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function Bq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_11165_6(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function Uq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_11165_7(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function lR(t,e,i,n){X.__wasm_bindgen_func_elem_14167(t,e,G(i),G(n))}function G(t){gf===Ks.length&&Ks.push(Ks.length+1);let e=gf;return gf=Ks[e],Ks[e]=t,e}function nX(t){if(W0==1)throw new Error("out of js stack");return Ks[--W0]=t,W0}function Gw(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){let r=t.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){let r=t.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(t)){let r=t.length,s="[";r>0&&(s+=Gw(t[0]));for(let a=1;a<r;a++)s+=", "+Gw(t[a]);return s+="]",s}let i=/\[object ([^\]]+)\]/.exec(toString.call(t)),n;if(i&&i.length>1)n=i[1];else return toString.call(t);if(n=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
|
|
35
|
+
`;let s=new TextEncoder().encode(r),a=n*2*4,o=t.xyz.quantized.data.buffer.byteLength,l=t.xyz instanceof Ji?a:0,c=t.color.quantized.data.buffer.byteLength,h=t.color instanceof Ji?a:0,d=t.opacity.quantized.data.buffer.byteLength,u=t.opacity instanceof Ji?a:0,p=t.scaling.quantized.data.buffer.byteLength,f=t.scaling instanceof Ji?a:0,g=t.quaternion.quantized.data.buffer.byteLength,m=t.quaternion instanceof Ji?a:0,v=t.variableChunkSize?Uint16Array.from(t.variableChunkSize):void 0,y=v?v.byteLength:0,_=s.byteLength+y+o+l+c+h+d+u+p+f+g+m,b=0,x=0;if(t.harmonics&&t.harmonics.length>0)for(let E=0;E<t.harmonics.length;E++)b+=t.harmonics[E].quantized.data.buffer.byteLength,x+=t.harmonics[E]instanceof Ji?a:0;b=0,x=0,_+=b+x;let w=new Uint8Array(_),S=0;if(w.set(s,S),S+=s.byteLength,y>0&&(w.set(new Uint8Array(v.buffer),S),S+=y),t.xyz instanceof Ji&&(w.set(new Uint8Array(t.xyz.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.xyz.quantized.data.buffer),S),S+=o,t.color instanceof Ji&&(w.set(new Uint8Array(t.color.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.color.quantized.data.buffer),S),S+=c,t.opacity instanceof Ji&&(w.set(new Uint8Array(t.opacity.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.opacity.quantized.data.buffer),S),S+=d,t.scaling instanceof Ji&&(w.set(new Uint8Array(t.scaling.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.scaling.quantized.data.buffer),S),S+=p,t.quaternion instanceof Ji&&(w.set(new Uint8Array(t.quaternion.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(t.quaternion.quantized.data.buffer),S),S+=g,b>0&&t.harmonics&&t.harmonics.length>0)for(let E=0;E<t.harmonics.length;E++){let A=t.harmonics[E];A instanceof Ji&&(w.set(new Uint8Array(A.minmaxMatrix.data.buffer),S),S+=a),w.set(new Uint8Array(A.quantized.data.buffer),S),S+=A.quantized.data.byteLength}return new Pw(w.buffer)}}});async function eR(t){return createImageBitmap(new Blob([t]))}async function iR(t){return fetch(t).then(e=>{if(!e.ok)throw new Error(`Failed to fetch image: ${e.statusText}`);return e.blob()}).then(e=>createImageBitmap(e))}function vq(t){if(typeof t.requestVideoFrameCallback!="function"){t.hanaClockBase=++Ow*fq;return}t.hanaPresentedFrames=++Ow;let e=()=>{t.hanaDisposed||(t.hanaPresentedFrames=++Ow)};t.addEventListener("seeked",e);let i=()=>{e(),!t.hanaDisposed&&(t.hanaFrameCallback=t.requestVideoFrameCallback(i))};t.hanaFrameCallback=t.requestVideoFrameCallback(i)}function nR(t){let e=t.hanaPresentedFrames;return e===void 0?t.hanaClockBase+t.currentTime:e}function yq(t,e){t.hanaObjectUrl=URL.createObjectURL(e),t.src=t.hanaObjectUrl}function Iw(t){if(t.hanaDisposed)return;t.hanaDisposed=!0;let e=t.hanaFrameCallback;e!==void 0&&(t.hanaFrameCallback=void 0,typeof t.cancelVideoFrameCallback=="function"&&t.cancelVideoFrameCallback(e));let i=t.hanaObjectUrl;i!==void 0&&(t.hanaObjectUrl=void 0,URL.revokeObjectURL(i)),t.pause(),t.removeAttribute("src"),t.load()}function _q(t){let e=n=>{let r=t.error;return new Error(r===null?n:`${n} (code ${r.code}: ${r.message})`)},i=n=>{let r=e(n);return Iw(t),r};return t.error!==null?Promise.reject(i("video failed to load")):t.readyState>=mq?Promise.resolve(t):new Promise((n,r)=>{let s=setTimeout(()=>a(r,i("video timed out before presenting a frame")),gq),a=(c,h)=>{clearTimeout(s),t.removeEventListener("loadeddata",o),t.removeEventListener("canplay",o),t.removeEventListener("error",l),c(h)},o=()=>a(n,t),l=()=>a(r,i("video failed to load"));t.addEventListener("loadeddata",o),t.addEventListener("canplay",o),t.addEventListener("error",l)})}function rR(t){return t.preload="auto",t.autoplay=!0,t.loop=!0,t.muted=!0,t.playsInline=!0,t.currentTime=.01,t.load(),t.onloadeddata=()=>{t.muted=!0;let e=t.play();e!==void 0&&e.then(i=>{}).catch(()=>{t.play()}).finally(()=>{t.pause()})},vq(t),_q(t)}async function sR(t){let e=document.createElement("video");return yq(e,new Blob([t])),rR(e)}async function aR(t){let e=document.createElement("video");return e.crossOrigin="anonymous",e.src=t,rR(e)}var Ow,fq,mq,gq,oR=Kp(()=>{"use strict";Ow=0,fq=1e6,mq=2,gq=3e4});var xR={};yw(xR,{DeviceLostPromise:()=>Al,Engine:()=>Tl,HeadlessEngine:()=>Cl,PixelReadPromise:()=>wo,SceneController:()=>yf,addRealizedChild:()=>bq,componentInstanceRefreshOps:()=>xq,default:()=>wX,dematerializeInstance:()=>wq,duplicateComponentInstance:()=>Sq,initSync:()=>xX,overrideForRealizedEdit:()=>Mq,realizeComponentInstance:()=>Eq,removeRealizedNode:()=>Aq,web_init:()=>Tq});function bq(t,e,i,n,r){let s=X.addRealizedChild(G(t),G(e),G(i),G(n),G(r));return Kt(s)}function xq(t,e,i,n,r){let s=X.componentInstanceRefreshOps(G(t),G(e),G(i),G(n),G(r));return Kt(s)}function wq(t,e,i,n){let r=X.dematerializeInstance(G(t),G(e),G(i),G(n));return Kt(r)}function Sq(t,e,i,n){let r=X.duplicateComponentInstance(G(t),G(e),G(i),G(n));return Kt(r)}function Mq(t,e,i,n,r){let s=X.overrideForRealizedEdit(G(t),G(e),G(i),G(n),G(r));return Kt(s)}function Eq(t,e,i){let n=X.realizeComponentInstance(G(t),G(e),G(i));return Kt(n)}function Aq(t,e,i,n){let r=X.removeRealizedNode(G(t),G(e),G(i),G(n));return Kt(r)}function Tq(){X.web_init()}function _R(){return{__proto__:null,"./hana_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(e,i){let n=Error(Te(e,i));return G(n)},__wbg_Number_6b506e6536831eaa:function(e){return Number(M(e))},__wbg_Window_afcc911b2f9c92e2:function(e){let i=M(e).Window;return G(i)},__wbg_WorkerGlobalScope_5d19ebc889ff397e:function(e){let i=M(e).WorkerGlobalScope;return G(i)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d:function(e,i){let n=M(i),r=typeof n=="bigint"?n:void 0;ie().setBigInt64(e+8,ne(r)?BigInt(0):r,!0),ie().setInt32(e+0,!ne(r),!0)},__wbg___wbindgen_boolean_get_1a45e2c38d4d41b9:function(e){let i=M(e),n=typeof i=="boolean"?i:void 0;return ne(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,i){let n=Gw(M(i)),r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg___wbindgen_in_70a403a56e771704:function(e,i){return M(e)in M(i)},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(e){return typeof M(e)=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(e){return typeof M(e)=="function"},__wbg___wbindgen_is_null_87c3bfe968c6a5ad:function(e){return M(e)===null},__wbg___wbindgen_is_null_or_undefined_cf617b836541fad3:function(e){return M(e)==null},__wbg___wbindgen_is_object_56732c2bc353f41d:function(e){let i=M(e);return typeof i=="object"&&i!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(e){return typeof M(e)=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(e){return M(e)===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(e,i){return M(e)===M(i)},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(e,i){return M(e)==M(i)},__wbg___wbindgen_number_get_9bb1761122181af2:function(e,i){let n=M(i),r=typeof n=="number"?n:void 0;ie().setFloat64(e+8,ne(r)?0:r,!0),ie().setInt32(e+0,!ne(r),!0)},__wbg___wbindgen_string_get_72bdf95d3ae505b1:function(e,i){let n=M(i),r=typeof n=="string"?n:void 0;var s=ne(r)?0:tn(r,X.__wbindgen_export,X.__wbindgen_export2),a=Ai;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(e,i){throw new Error(Te(e,i))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(e){M(e)._wbg_cb_unref()},__wbg_activeTexture_7a0d6fe7120979ce:function(e,i){M(e).activeTexture(i>>>0)},__wbg_activeTexture_dd15c31d50b73529:function(e,i){M(e).activeTexture(i>>>0)},__wbg_addEventListener_5593b0efd622abd6:function(){return Zt(function(e,i,n,r,s){M(e).addEventListener(Te(i,n),M(r),M(s))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return Zt(function(e){let i=M(e).arrayBuffer();return G(i)},arguments)},__wbg_assign_551ec2d000f70c24:function(){return Zt(function(e,i,n){M(e).assign(Te(i,n))},arguments)},__wbg_attachShader_5c6a46e7c0fc637a:function(e,i,n){M(e).attachShader(M(i),M(n))},__wbg_attachShader_c2b12b36afa45936:function(e,i,n){M(e).attachShader(M(i),M(n))},__wbg_beginComputePass_431a159006c13c7c:function(e,i){let n=M(e).beginComputePass(M(i));return G(n)},__wbg_beginRenderPass_aa22c432e793359a:function(){return Zt(function(e,i){let n=M(e).beginRenderPass(M(i));return G(n)},arguments)},__wbg_bindBuffer_3841df88ccee4ed0:function(e,i,n){M(e).bindBuffer(i>>>0,M(n))},__wbg_bindBuffer_aa5dc7dc1c8ad1c8:function(e,i,n){M(e).bindBuffer(i>>>0,M(n))},__wbg_bindFramebuffer_10bbdf7040d89a17:function(e,i,n){M(e).bindFramebuffer(i>>>0,M(n))},__wbg_bindFramebuffer_ee8e42543c29c602:function(e,i,n){M(e).bindFramebuffer(i>>>0,M(n))},__wbg_bindRenderbuffer_7808d8eabbe18554:function(e,i,n){M(e).bindRenderbuffer(i>>>0,M(n))},__wbg_bindRenderbuffer_c0360bfb79c193c2:function(e,i,n){M(e).bindRenderbuffer(i>>>0,M(n))},__wbg_bindTexture_28d1d695d4801955:function(e,i,n){M(e).bindTexture(i>>>0,M(n))},__wbg_bindTexture_a1a012a31e1419d5:function(e,i,n){M(e).bindTexture(i>>>0,M(n))},__wbg_bindVertexArrayOES_15e48910a5d208b1:function(e,i){M(e).bindVertexArrayOES(M(i))},__wbg_bindVertexArray_4f2f0a7892280041:function(e,i){M(e).bindVertexArray(M(i))},__wbg_blendEquation_1ced323efc9ce0f8:function(e,i){M(e).blendEquation(i>>>0)},__wbg_blendEquation_a12f5acd9d14fb9b:function(e,i){M(e).blendEquation(i>>>0)},__wbg_blendFunc_d5202c7fe94c67ee:function(e,i,n){M(e).blendFunc(i>>>0,n>>>0)},__wbg_blendFunc_fbff85cd0fce280e:function(e,i,n){M(e).blendFunc(i>>>0,n>>>0)},__wbg_blitFramebuffer_acb954bfb30ed714:function(e,i,n,r,s,a,o,l,c,h,d){M(e).blitFramebuffer(i,n,r,s,a,o,l,c,h>>>0,d>>>0)},__wbg_bufferData_043a7e5da22f40d9:function(e,i,n,r){M(e).bufferData(i>>>0,n,r>>>0)},__wbg_bufferData_7b6881381d415425:function(e,i,n,r){M(e).bufferData(i>>>0,M(n),r>>>0)},__wbg_bufferData_9fddca30299e6114:function(e,i,n,r){M(e).bufferData(i>>>0,n,r>>>0)},__wbg_bufferData_f0837cec09725cc0:function(e,i,n,r){M(e).bufferData(i>>>0,M(n),r>>>0)},__wbg_bufferSubData_885e4f8d5833cf11:function(e,i,n,r){M(e).bufferSubData(i>>>0,n,M(r))},__wbg_bufferSubData_8fc824b6a9503f12:function(e,i,n,r){M(e).bufferSubData(i>>>0,n,M(r))},__wbg_call_8a89609d89f6608a:function(){return Zt(function(e,i){let n=M(e).call(M(i));return G(n)},arguments)},__wbg_call_9c758de292015997:function(){return Zt(function(e,i,n){let r=M(e).call(M(i),M(n));return G(r)},arguments)},__wbg_clearBufferfv_2e2858bd8bcf1715:function(e,i,n,r,s){M(e).clearBufferfv(i>>>0,n,ds(r,s))},__wbg_clearBufferiv_e356514eb1d165fe:function(e,i,n,r,s){M(e).clearBufferiv(i>>>0,n,vR(r,s))},__wbg_compileShader_8810a4868b23621b:function(e,i){M(e).compileShader(M(i))},__wbg_compileShader_ec8d5eb7f2b70a48:function(e,i){M(e).compileShader(M(i))},__wbg_configure_0e4789c0f6b35c8e:function(){return Zt(function(e,i){M(e).configure(M(i))},arguments)},__wbg_copyBufferSubData_9936fdf5e53e1832:function(e,i,n,r,s,a){M(e).copyBufferSubData(i>>>0,n>>>0,r,s,a)},__wbg_copyBufferToBuffer_5e2cd8f10ae78183:function(){return Zt(function(e,i,n,r,s){M(e).copyBufferToBuffer(M(i),n,M(r),s)},arguments)},__wbg_copyBufferToBuffer_ca30deb8de65f5d5:function(){return Zt(function(e,i,n,r,s,a){M(e).copyBufferToBuffer(M(i),n,M(r),s,a)},arguments)},__wbg_copyExternalImageToTexture_4df105bb39517948:function(){return Zt(function(e,i,n,r){M(e).copyExternalImageToTexture(M(i),M(n),M(r))},arguments)},__wbg_copyTextureToBuffer_ed6e67a77ecb768d:function(){return Zt(function(e,i,n,r){M(e).copyTextureToBuffer(M(i),M(n),M(r))},arguments)},__wbg_createBindGroupLayout_49a7e2b3d076afcf:function(){return Zt(function(e,i){let n=M(e).createBindGroupLayout(M(i));return G(n)},arguments)},__wbg_createBindGroup_655c6e6c0258530e:function(e,i){let n=M(e).createBindGroup(M(i));return G(n)},__wbg_createBuffer_0726dd2ab09ea1d2:function(){return Zt(function(e,i){let n=M(e).createBuffer(M(i));return G(n)},arguments)},__wbg_createBuffer_333d6aae40284594:function(e){let i=M(e).createBuffer();return ne(i)?0:G(i)},__wbg_createBuffer_3ae54605e5676c83:function(e){let i=M(e).createBuffer();return ne(i)?0:G(i)},__wbg_createCommandEncoder_ec1f40f0cb4d09df:function(e,i){let n=M(e).createCommandEncoder(M(i));return G(n)},__wbg_createComputePipelineAsync_afe7021ac5a02993:function(e,i){let n=M(e).createComputePipelineAsync(M(i));return G(n)},__wbg_createFramebuffer_6f42ff976bb98152:function(e){let i=M(e).createFramebuffer();return ne(i)?0:G(i)},__wbg_createFramebuffer_ef1247e8b2e9b09f:function(e){let i=M(e).createFramebuffer();return ne(i)?0:G(i)},__wbg_createPipelineLayout_2c8cd4528b06c108:function(e,i){let n=M(e).createPipelineLayout(M(i));return G(n)},__wbg_createProgram_b48c3323af547213:function(e){let i=M(e).createProgram();return ne(i)?0:G(i)},__wbg_createProgram_f6a8df4491031d57:function(e){let i=M(e).createProgram();return ne(i)?0:G(i)},__wbg_createQuerySet_cb7b21d1d405b890:function(){return Zt(function(e,i){let n=M(e).createQuerySet(M(i));return G(n)},arguments)},__wbg_createRenderPipelineAsync_eecad1e54ef27acf:function(e,i){let n=M(e).createRenderPipelineAsync(M(i));return G(n)},__wbg_createRenderPipeline_cf98d4d699bfb03c:function(){return Zt(function(e,i){let n=M(e).createRenderPipeline(M(i));return G(n)},arguments)},__wbg_createRenderbuffer_a2f947c7fa8c8bf0:function(e){let i=M(e).createRenderbuffer();return ne(i)?0:G(i)},__wbg_createRenderbuffer_c09d5809ac95924e:function(e){let i=M(e).createRenderbuffer();return ne(i)?0:G(i)},__wbg_createSampler_c8ffb3c8d565f704:function(e,i){let n=M(e).createSampler(M(i));return G(n)},__wbg_createShaderModule_2e44fc7677c6288b:function(e,i){let n=M(e).createShaderModule(M(i));return G(n)},__wbg_createShader_0e3f814b69e9e184:function(e,i){let n=M(e).createShader(i>>>0);return ne(n)?0:G(n)},__wbg_createShader_383b3295276271d2:function(e,i){let n=M(e).createShader(i>>>0);return ne(n)?0:G(n)},__wbg_createTexture_1bac74c999b8a48e:function(){return Zt(function(e,i){let n=M(e).createTexture(M(i));return G(n)},arguments)},__wbg_createTexture_461a3048c40e7175:function(e){let i=M(e).createTexture();return ne(i)?0:G(i)},__wbg_createTexture_d6e2c1f04a554a15:function(e){let i=M(e).createTexture();return ne(i)?0:G(i)},__wbg_createVertexArrayOES_2f67d3679ba9a29c:function(e){let i=M(e).createVertexArrayOES();return ne(i)?0:G(i)},__wbg_createVertexArray_febd1d11636d15ad:function(e){let i=M(e).createVertexArray();return ne(i)?0:G(i)},__wbg_createView_ceaf2f5881adbd34:function(){return Zt(function(e,i){let n=M(e).createView(M(i));return G(n)},arguments)},__wbg_cullFace_a4ee8b8c3c126388:function(e,i){M(e).cullFace(i>>>0)},__wbg_cullFace_c6b39a55ccade015:function(e,i){M(e).cullFace(i>>>0)},__wbg_currentTime_0b40b60bc76843cb:function(e){return M(e).currentTime},__wbg_debug_78b457f1effb3792:function(e){console.debug(M(e))},__wbg_deleteBuffer_520156dc8a1f81af:function(e,i){M(e).deleteBuffer(M(i))},__wbg_deleteBuffer_a925fdd1b590fbbc:function(e,i){M(e).deleteBuffer(M(i))},__wbg_deleteFramebuffer_aa4bf9f184123318:function(e,i){M(e).deleteFramebuffer(M(i))},__wbg_deleteFramebuffer_cc043e5a8cb9a556:function(e,i){M(e).deleteFramebuffer(M(i))},__wbg_deleteProgram_0c859ebcab2b7b5a:function(e,i){M(e).deleteProgram(M(i))},__wbg_deleteProgram_df6a6609c7d91a6e:function(e,i){M(e).deleteProgram(M(i))},__wbg_deleteRenderbuffer_37c079dbc257fcf9:function(e,i){M(e).deleteRenderbuffer(M(i))},__wbg_deleteRenderbuffer_4b7a888363766554:function(e,i){M(e).deleteRenderbuffer(M(i))},__wbg_deleteShader_170dea06bd074d01:function(e,i){M(e).deleteShader(M(i))},__wbg_deleteShader_944accd60733a9cb:function(e,i){M(e).deleteShader(M(i))},__wbg_deleteTexture_54dee8e15570751e:function(e,i){M(e).deleteTexture(M(i))},__wbg_deleteTexture_be3eaabebb89a85e:function(e,i){M(e).deleteTexture(M(i))},__wbg_deleteVertexArrayOES_4262d2d0e9fb77c5:function(e,i){M(e).deleteVertexArrayOES(M(i))},__wbg_deleteVertexArray_8f0fb3b3d54c7483:function(e,i){M(e).deleteVertexArray(M(i))},__wbg_depthMask_95332b64c5ef8b45:function(e,i){M(e).depthMask(i!==0)},__wbg_depthMask_f55bea4b6c3b9531:function(e,i){M(e).depthMask(i!==0)},__wbg_description_02485704e69b1e7f:function(e,i){let n=M(i).description,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_disable_2cf98ccb81612ef9:function(e,i){M(e).disable(i>>>0)},__wbg_disable_6b825656c54f5646:function(e,i){M(e).disable(i>>>0)},__wbg_dispatchWorkgroups_afb2344298c62227:function(e,i,n,r){M(e).dispatchWorkgroups(i>>>0,n>>>0,r>>>0)},__wbg_displayHeight_465673c1823a1db3:function(e){return M(e).displayHeight},__wbg_displayWidth_73729fd8eb965076:function(e){return M(e).displayWidth},__wbg_disposeVideo_c94c1ccd57a63f68:function(e){Iw(M(e))},__wbg_document_aceb08cd6489baf5:function(e){let i=M(e).document;return ne(i)?0:G(i)},__wbg_done_60cf307fcc680536:function(e){return M(e).done},__wbg_drawArrays_6eb87620c1dcbfb4:function(e,i,n,r){M(e).drawArrays(i>>>0,n,r)},__wbg_drawArrays_f332b526550a641e:function(e,i,n,r){M(e).drawArrays(i>>>0,n,r)},__wbg_drawBuffersWEBGL_10cdfe87c17cd93f:function(e,i){M(e).drawBuffersWEBGL(M(i))},__wbg_drawBuffers_c5a9ee312b2d6fa8:function(e,i){M(e).drawBuffers(M(i))},__wbg_drawElements_23ec4847dad548e0:function(e,i,n,r,s){M(e).drawElements(i>>>0,n,r>>>0,s)},__wbg_drawElements_fe4671e9c358058d:function(e,i,n,r,s){M(e).drawElements(i>>>0,n,r>>>0,s)},__wbg_drawIndexed_d31913e79d58fbac:function(e,i,n,r,s,a){M(e).drawIndexed(i>>>0,n>>>0,r>>>0,s,a>>>0)},__wbg_draw_6877f98847e1e36c:function(e,i,n,r,s){M(e).draw(i>>>0,n>>>0,r>>>0,s>>>0)},__wbg_duration_d6a6a568a0baf72d:function(e){return M(e).duration},__wbg_enableVertexAttribArray_cc09a0312b6adee5:function(e,i){M(e).enableVertexAttribArray(i>>>0)},__wbg_enableVertexAttribArray_f88d3d499ab40ea6:function(e,i){M(e).enableVertexAttribArray(i>>>0)},__wbg_enable_1928c361308989d5:function(e,i){M(e).enable(i>>>0)},__wbg_enable_2cc4ff32a0fd985f:function(e,i){M(e).enable(i>>>0)},__wbg_end_c36889de8ddef882:function(e){M(e).end()},__wbg_end_f99ebed53d4e198a:function(e){M(e).end()},__wbg_engine_new:function(e){let i=Tl.__wrap(e);return G(i)},__wbg_entries_04b37a02507f1713:function(e){let i=Object.entries(M(e));return G(i)},__wbg_error_78ff5b3a29b770e0:function(e){console.error(M(e))},__wbg_error_a6fa202b58aa1cd3:function(e,i){let n,r;try{n=e,r=i,console.error(Te(e,i))}finally{X.__wbindgen_export4(n,r,1)}},__wbg_features_2b07a28fe18ad0ce:function(e){let i=M(e).features;return G(i)},__wbg_features_d4d2020319592cbe:function(e){let i=M(e).features;return G(i)},__wbg_fetch_aee1ab744a69f263:function(){return Zt(function(e,i,n){let r=fetch(Te(e,i),M(n));return G(r)},arguments)},__wbg_finish_4d91de5e927dd13f:function(e,i){let n=M(e).finish(M(i));return G(n)},__wbg_finish_6e06b68ab68cd9f6:function(e){let i=M(e).finish();return G(i)},__wbg_flush_2088ebca1fd13068:function(e){M(e).flush()},__wbg_flush_3be48fce9f195fa5:function(e){M(e).flush()},__wbg_framebufferRenderbuffer_0c9d0e5587497683:function(e,i,n,r,s){M(e).framebufferRenderbuffer(i>>>0,n>>>0,r>>>0,M(s))},__wbg_framebufferRenderbuffer_599e58ad30dcfeb3:function(e,i,n,r,s){M(e).framebufferRenderbuffer(i>>>0,n>>>0,r>>>0,M(s))},__wbg_framebufferTexture2D_44caed1725e57636:function(e,i,n,r,s,a){M(e).framebufferTexture2D(i>>>0,n>>>0,r>>>0,M(s),a)},__wbg_framebufferTexture2D_fbba21b750c2316a:function(e,i,n,r,s,a){M(e).framebufferTexture2D(i>>>0,n>>>0,r>>>0,M(s),a)},__wbg_from_d300fe49deab18f5:function(e){let i=Array.from(M(e));return G(i)},__wbg_generateMipmap_1403959fc241438f:function(e,i){M(e).generateMipmap(i>>>0)},__wbg_generateMipmap_b261c040d5707fe5:function(e,i){M(e).generateMipmap(i>>>0)},__wbg_getActiveUniform_3a275fd8fdf7a327:function(e,i,n){let r=M(e).getActiveUniform(M(i),n>>>0);return ne(r)?0:G(r)},__wbg_getActiveUniform_86f7a30e1a52aca4:function(e,i,n){let r=M(e).getActiveUniform(M(i),n>>>0);return ne(r)?0:G(r)},__wbg_getContext_469d34698d869fc1:function(){return Zt(function(e,i,n){let r=M(e).getContext(Te(i,n));return ne(r)?0:G(r)},arguments)},__wbg_getContext_5b39fff76491fded:function(){return Zt(function(e,i,n,r){let s=M(e).getContext(Te(i,n),M(r));return ne(s)?0:G(s)},arguments)},__wbg_getContext_7d3a8f461c828713:function(){return Zt(function(e,i,n){let r=M(e).getContext(Te(i,n));return ne(r)?0:G(r)},arguments)},__wbg_getCurrentTexture_20714d1bd9051cab:function(){return Zt(function(e){let i=M(e).getCurrentTexture();return G(i)},arguments)},__wbg_getExtension_454cdc5ffd07bf03:function(){return Zt(function(e,i,n){let r=M(e).getExtension(Te(i,n));return ne(r)?0:G(r)},arguments)},__wbg_getMappedRange_d0bf3141224111b6:function(){return Zt(function(e,i,n){let r=M(e).getMappedRange(i,n);return G(r)},arguments)},__wbg_getParameter_015942a7ad566b20:function(){return Zt(function(e,i){let n=M(e).getParameter(i>>>0);return G(n)},arguments)},__wbg_getParameter_1e77e23f5ccf0300:function(){return Zt(function(e,i){let n=M(e).getParameter(i>>>0);return G(n)},arguments)},__wbg_getPreferredCanvasFormat_8b57039d1801a506:function(e){let i=M(e).getPreferredCanvasFormat();return(jh.indexOf(i)+1||102)-1},__wbg_getProgramInfoLog_2f9cfcecc4f772e1:function(e,i,n){let r=M(i).getProgramInfoLog(M(n));var s=ne(r)?0:tn(r,X.__wbindgen_export,X.__wbindgen_export2),a=Ai;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getProgramInfoLog_f0d48f606547aed7:function(e,i,n){let r=M(i).getProgramInfoLog(M(n));var s=ne(r)?0:tn(r,X.__wbindgen_export,X.__wbindgen_export2),a=Ai;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getProgramParameter_08beabb2736d5769:function(e,i,n){let r=M(e).getProgramParameter(M(i),n>>>0);return G(r)},__wbg_getProgramParameter_aee848e1db52b7cd:function(e,i,n){let r=M(e).getProgramParameter(M(i),n>>>0);return G(r)},__wbg_getRandomValues_3f44b700395062e5:function(){return Zt(function(e,i){globalThis.crypto.getRandomValues(El(e,i))},arguments)},__wbg_getRandomValues_bf16787eede473f5:function(){return Zt(function(e,i){globalThis.crypto.getRandomValues(El(e,i))},arguments)},__wbg_getShaderInfoLog_510365af17f29a35:function(e,i,n){let r=M(i).getShaderInfoLog(M(n));var s=ne(r)?0:tn(r,X.__wbindgen_export,X.__wbindgen_export2),a=Ai;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getShaderInfoLog_cd77c7b7bdb9ce65:function(e,i,n){let r=M(i).getShaderInfoLog(M(n));var s=ne(r)?0:tn(r,X.__wbindgen_export,X.__wbindgen_export2),a=Ai;ie().setInt32(e+4,a,!0),ie().setInt32(e+0,s,!0)},__wbg_getSupportedExtensions_7a31b3412a25d9ba:function(e){let i=M(e).getSupportedExtensions();return ne(i)?0:G(i)},__wbg_getUniformLocation_010256f946f9a865:function(e,i,n,r){let s=M(e).getUniformLocation(M(i),Te(n,r));return ne(s)?0:G(s)},__wbg_getUniformLocation_f9774d4f157f5914:function(e,i,n,r){let s=M(e).getUniformLocation(M(i),Te(n,r));return ne(s)?0:G(s)},__wbg_get_1f8f054ddbaa7db2:function(){return Zt(function(e,i){let n=Reflect.get(M(e),M(i));return G(n)},arguments)},__wbg_get_2b48c7d0d006a781:function(e,i){let n=M(e)[i>>>0];return G(n)},__wbg_get_cb935c1402921898:function(e,i){let n=M(e)[i>>>0];return ne(n)?0:G(n)},__wbg_get_de6a0f7d4d18a304:function(){return Zt(function(e,i){let n=Reflect.get(M(e),M(i));return G(n)},arguments)},__wbg_get_index_ab123d64c89e3156:function(e,i){return M(e)[i>>>0]},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(e,i){let n=M(e)[i>>>0];return G(n)},__wbg_get_with_ref_key_6412cf3094599694:function(e,i){let n=M(e)[M(i)];return G(n)},__wbg_get_with_ref_key_7e638bba08a44478:function(e,i){let n=M(e)[M(i)];return G(n)},__wbg_gpu_2ccc250735d24a2a:function(e){let i=M(e).gpu;return G(i)},__wbg_has_0c97053e877f47cc:function(e,i,n){return M(e).has(Te(i,n))},__wbg_has_73740b27f436fed3:function(){return Zt(function(e,i){return Reflect.has(M(e),M(i))},arguments)},__wbg_height_4e7694e4e2110bdb:function(e){return M(e).height},__wbg_info_af7f45292ba9b0ea:function(e){console.info(M(e))},__wbg_info_cf0d9a286850cd24:function(e){let i=M(e).info;return G(i)},__wbg_innerHeight_8b6ee2571dbedb9d:function(){return Zt(function(e){let i=M(e).innerHeight;return G(i)},arguments)},__wbg_innerWidth_7475bec19f48fe43:function(){return Zt(function(e){let i=M(e).innerWidth;return G(i)},arguments)},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(e){let i;try{i=M(e)instanceof ArrayBuffer}catch{i=!1}return i},__wbg_instanceof_GpuOutOfMemoryError_6429c750997f1c8d:function(e){let i;try{i=M(e)instanceof GPUOutOfMemoryError}catch{i=!1}return i},__wbg_instanceof_GpuValidationError_75fa3611f065f4df:function(e){let i;try{i=M(e)instanceof GPUValidationError}catch{i=!1}return i},__wbg_instanceof_HtmlVideoElement_95590e1ff107ba83:function(e){let i;try{i=M(e)instanceof HTMLVideoElement}catch{i=!1}return i},__wbg_instanceof_ImageBitmap_beed1259521cd66d:function(e){let i;try{i=M(e)instanceof ImageBitmap}catch{i=!1}return i},__wbg_instanceof_Response_cb984bd66d7bd408:function(e){let i;try{i=M(e)instanceof Response}catch{i=!1}return i},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(e){let i;try{i=M(e)instanceof Uint8Array}catch{i=!1}return i},__wbg_instanceof_WebGl2RenderingContext_39d13e3f953130c7:function(e){let i;try{i=M(e)instanceof WebGL2RenderingContext}catch{i=!1}return i},__wbg_instanceof_Window_e093be59ee9a8e14:function(e){let i;try{i=M(e)instanceof Window}catch{i=!1}return i},__wbg_invalidateFramebuffer_6b8dae55a3debb1d:function(){return Zt(function(e,i,n){M(e).invalidateFramebuffer(i>>>0,M(n))},arguments)},__wbg_isArray_67c2c9c4313f4448:function(e){return Array.isArray(M(e))},__wbg_isFallbackAdapter_8ccb967428491dcb:function(e){return M(e).isFallbackAdapter},__wbg_isSafeInteger_66acec27e09e99a7:function(e){return Number.isSafeInteger(M(e))},__wbg_iterator_8732428d309e270e:function(){return G(Symbol.iterator)},__wbg_label_7ed42f25f841996b:function(e,i){let n=M(i).label,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_length_280688879ee7deb5:function(e){return M(e).length},__wbg_length_4a591ecaa01354d9:function(e){return M(e).length},__wbg_length_66f1a4b2e9026940:function(e){return M(e).length},__wbg_limits_20c6f56636df7d38:function(e){let i=M(e).limits;return G(i)},__wbg_limits_328c61cd41512420:function(e){let i=M(e).limits;return G(i)},__wbg_linkProgram_3ccc9beaa6dace28:function(e,i){M(e).linkProgram(M(i))},__wbg_linkProgram_fe2b1bf26336c4a5:function(e,i){M(e).linkProgram(M(i))},__wbg_loadImageFromBytes_3d42766b73aca4ca:function(e){let i=eR(Kt(e));return G(i)},__wbg_loadImageFromUrl_50be99dbf040255b:function(e,i){let n,r;try{n=e,r=i;let s=iR(Te(e,i));return G(s)}finally{X.__wbindgen_export4(n,r,1)}},__wbg_loadVideoFromBytes_3d884aadcf4d2139:function(e){let i=sR(Kt(e));return G(i)},__wbg_loadVideoFromUrl_7997ffb030d4b08b:function(e,i){let n,r;try{n=e,r=i;let s=aR(Te(e,i));return G(s)}finally{X.__wbindgen_export4(n,r,1)}},__wbg_location_efdf1fea18b5552a:function(e){let i=M(e).location;return G(i)},__wbg_log_cf2e968649f3384e:function(e){console.log(M(e))},__wbg_lost_0fa164c88f543338:function(e){let i=M(e).lost;return G(i)},__wbg_mapAsync_52b01fa9e8f765fd:function(e,i,n,r){let s=M(e).mapAsync(i>>>0,n,r);return G(s)},__wbg_maxBindGroupsPlusVertexBuffers_33e5006b23e20478:function(e){return M(e).maxBindGroupsPlusVertexBuffers},__wbg_maxBindGroups_f6d26f3a67826666:function(e){return M(e).maxBindGroups},__wbg_maxBindingsPerBindGroup_edab2e8dabbf6060:function(e){return M(e).maxBindingsPerBindGroup},__wbg_maxBufferSize_bbc69284c14aa7da:function(e){return M(e).maxBufferSize},__wbg_maxColorAttachmentBytesPerSample_63ebe4f81de2f34c:function(e){return M(e).maxColorAttachmentBytesPerSample},__wbg_maxColorAttachments_aed8c38beabf3a5c:function(e){return M(e).maxColorAttachments},__wbg_maxComputeInvocationsPerWorkgroup_2d964564c37f1c65:function(e){return M(e).maxComputeInvocationsPerWorkgroup},__wbg_maxComputeWorkgroupSizeX_a3e3206570da184f:function(e){return M(e).maxComputeWorkgroupSizeX},__wbg_maxComputeWorkgroupSizeY_dffa4a62244b7563:function(e){return M(e).maxComputeWorkgroupSizeY},__wbg_maxComputeWorkgroupSizeZ_976ebcb760f6d07d:function(e){return M(e).maxComputeWorkgroupSizeZ},__wbg_maxComputeWorkgroupStorageSize_2e8dbece6e532e2a:function(e){return M(e).maxComputeWorkgroupStorageSize},__wbg_maxComputeWorkgroupsPerDimension_bb7d36b4d20c80f4:function(e){return M(e).maxComputeWorkgroupsPerDimension},__wbg_maxDynamicStorageBuffersPerPipelineLayout_1ca859cb96a414e0:function(e){return M(e).maxDynamicStorageBuffersPerPipelineLayout},__wbg_maxDynamicUniformBuffersPerPipelineLayout_e968f2c8cd8f4d46:function(e){return M(e).maxDynamicUniformBuffersPerPipelineLayout},__wbg_maxInterStageShaderVariables_138ac882c4d6a3d3:function(e){return M(e).maxInterStageShaderVariables},__wbg_maxSampledTexturesPerShaderStage_bb3e6b2698321fa6:function(e){return M(e).maxSampledTexturesPerShaderStage},__wbg_maxSamplersPerShaderStage_98c00a1829fa414b:function(e){return M(e).maxSamplersPerShaderStage},__wbg_maxStorageBufferBindingSize_e500e31f479e669e:function(e){return M(e).maxStorageBufferBindingSize},__wbg_maxStorageBuffersPerShaderStage_eb663f6d7521b6a7:function(e){return M(e).maxStorageBuffersPerShaderStage},__wbg_maxStorageTexturesPerShaderStage_bb3ad93b53e618c0:function(e){return M(e).maxStorageTexturesPerShaderStage},__wbg_maxTextureArrayLayers_2a56d05fb261c99a:function(e){return M(e).maxTextureArrayLayers},__wbg_maxTextureDimension1D_84590c1d4770d319:function(e){return M(e).maxTextureDimension1D},__wbg_maxTextureDimension2D_7f2b5c8b2727e3fc:function(e){return M(e).maxTextureDimension2D},__wbg_maxTextureDimension3D_7f3babddf55c32a6:function(e){return M(e).maxTextureDimension3D},__wbg_maxUniformBufferBindingSize_d80a09e23c0b284c:function(e){return M(e).maxUniformBufferBindingSize},__wbg_maxUniformBuffersPerShaderStage_0b8b2de676fa740e:function(e){return M(e).maxUniformBuffersPerShaderStage},__wbg_maxVertexAttributes_a693dd921316649b:function(e){return M(e).maxVertexAttributes},__wbg_maxVertexBufferArrayStride_f256d91f281076cb:function(e){return M(e).maxVertexBufferArrayStride},__wbg_maxVertexBuffers_70ab564b25d5ac20:function(e){return M(e).maxVertexBuffers},__wbg_message_28959d6ca4d7dda0:function(e,i){let n=M(i).message,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_message_4ada57a3710f1502:function(e,i){let n=M(i).message,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_minStorageBufferOffsetAlignment_3248ed00dcdbf79f:function(e){return M(e).minStorageBufferOffsetAlignment},__wbg_minUniformBufferOffsetAlignment_3b9fa4caae03e903:function(e){return M(e).minUniformBufferOffsetAlignment},__wbg_name_b7fa2500fc153b89:function(e,i){let n=M(i).name,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_navigator_3833ecdbc19d2757:function(e){let i=M(e).navigator;return G(i)},__wbg_navigator_391291470f58c650:function(e){let i=M(e).navigator;return G(i)},__wbg_new_227d7c05414eb861:function(){let e=new Error;return G(e)},__wbg_new_3b242422c588a8f3:function(){return Zt(function(e,i){let n=new OffscreenCanvas(e>>>0,i>>>0);return G(n)},arguments)},__wbg_new_578aeef4b6b94378:function(e){let i=new Uint8Array(M(e));return G(i)},__wbg_new_b682b81e8eaaf027:function(e,i){try{var n={a:e,b:i},r=(a,o)=>{let l=n.a;n.a=0;try{return lR(l,n.b,a,o)}finally{n.a=l}};let s=new Promise(r);return G(s)}finally{n.a=0}},__wbg_new_ce1ab61c1c2b300d:function(){let e=new Object;return G(e)},__wbg_new_d90091b82fdf5b91:function(){let e=new Array;return G(e)},__wbg_new_from_slice_18fa1f71286d66b8:function(e,i){let n=new Uint8Array(El(e,i));return G(n)},__wbg_new_from_slice_3c93d0bc613de8f0:function(e,i){let n=new Float64Array(sX(e,i));return G(n)},__wbg_new_from_slice_47be4219028de35d:function(e,i){let n=new Uint32Array(af(e,i));return G(n)},__wbg_new_from_slice_956df4f769fb782c:function(e,i){let n=new Float32Array(ds(e,i));return G(n)},__wbg_new_typed_41c97238ee4583e3:function(){let e=new Object;return G(e)},__wbg_new_typed_bf31d18f92484486:function(e,i){try{var n={a:e,b:i},r=(a,o)=>{let l=n.a;n.a=0;try{return lR(l,n.b,a,o)}finally{n.a=l}};let s=new Promise(r);return G(s)}finally{n.a=0}},__wbg_new_with_byte_offset_and_length_d836f26d916dd9ad:function(e,i,n){let r=new Uint8Array(M(e),i>>>0,n>>>0);return G(r)},__wbg_new_with_length_36a4998e27b014c5:function(e){let i=new Uint8Array(e>>>0);return G(i)},__wbg_new_with_length_b4a87ccced374381:function(e){let i=new Float64Array(e>>>0);return G(i)},__wbg_next_9e03acdf51c4960d:function(e){let i=M(e).next;return G(i)},__wbg_next_eb8ca7351fa27906:function(){return Zt(function(e){let i=M(e).next();return G(i)},arguments)},__wbg_now_f565250295e2d180:function(e){return M(e).now()},__wbg_of_57145fdec12d159f:function(e){let i=Array.of(M(e));return G(i)},__wbg_ok_fb13c30bc1893039:function(e){return M(e).ok},__wbg_onSubmittedWorkDone_270d6b5a45520e79:function(e){let i=M(e).onSubmittedWorkDone();return G(i)},__wbg_open_177ad1dcc06b9106:function(){return Zt(function(e,i,n,r,s,a,o){let l=M(e).open(Te(i,n),Te(r,s),Te(a,o));return ne(l)?0:G(l)},arguments)},__wbg_open_feb75fe4d9971c50:function(){return Zt(function(e,i,n,r,s){let a=M(e).open(Te(i,n),Te(r,s));return ne(a)?0:G(a)},arguments)},__wbg_ownKeys_0587b8fe286a40e6:function(){return Zt(function(e){let i=Reflect.ownKeys(M(e));return G(i)},arguments)},__wbg_pause_adce2b37e004ae49:function(){return Zt(function(e){M(e).pause()},arguments)},__wbg_performance_68499ca0718837f5:function(e){let i=M(e).performance;return ne(i)?0:G(i)},__wbg_pixelStorei_6e42d231aa75bd00:function(e,i,n){M(e).pixelStorei(i>>>0,n)},__wbg_pixelStorei_84dc1952dc699c94:function(e,i,n){M(e).pixelStorei(i>>>0,n)},__wbg_play_4ed9ece3cae2c100:function(){return Zt(function(e){let i=M(e).play();return G(i)},arguments)},__wbg_popErrorScope_8e7f4cbff8b758dd:function(e){let i=M(e).popErrorScope();return G(i)},__wbg_prototypesetcall_3249fc62a0fafa30:function(e,i,n){Uint8Array.prototype.set.call(El(e,i),M(n))},__wbg_prototypesetcall_59640349d2c6d881:function(e,i,n){Uint32Array.prototype.set.call(af(e,i),M(n))},__wbg_provokingVertexWEBGL_0354dc7ad44d69bf:function(e,i){M(e).provokingVertexWEBGL(i>>>0)},__wbg_pushErrorScope_fa23d1206bc26dce:function(e,i){M(e).pushErrorScope(Gq[i])},__wbg_push_a6822215aa43e71c:function(e,i){return M(e).push(M(i))},__wbg_querySelectorAll_4dcc230a2f8a2498:function(){return Zt(function(e,i,n){let r=M(e).querySelectorAll(Te(i,n));return G(r)},arguments)},__wbg_queueMicrotask_35c611f4a14830b2:function(e){queueMicrotask(M(e))},__wbg_queueMicrotask_404ed0a58e0b63cc:function(e){let i=M(e).queueMicrotask;return G(i)},__wbg_queue_adce34608fd0c893:function(e){let i=M(e).queue;return G(i)},__wbg_readBuffer_2027f7cdd7533f2d:function(e,i){M(e).readBuffer(i>>>0)},__wbg_readPixels_a04f5cf5019be695:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_readPixels_bf9ee726d9179d3c:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_readPixels_d00c1cae608273d8:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).readPixels(i,n,r,s,a>>>0,o>>>0,l)},arguments)},__wbg_readyState_77b1b1db1b8c2a5f:function(e){return M(e).readyState},__wbg_reason_b02cd587d1a09948:function(e){let i=M(e).reason;return(jq.indexOf(i)+1||3)-1},__wbg_renderbufferStorageMultisample_75bba97a8e59bc6e:function(e,i,n,r,s,a){M(e).renderbufferStorageMultisample(i>>>0,n,r>>>0,s,a)},__wbg_renderbufferStorage_3f5b0ec8fca2f9f8:function(e,i,n,r,s){M(e).renderbufferStorage(i>>>0,n>>>0,r,s)},__wbg_renderbufferStorage_c34a47cacbbc5fff:function(e,i,n,r,s){M(e).renderbufferStorage(i>>>0,n>>>0,r,s)},__wbg_requestAdapter_2e6718811c735a57:function(e,i){let n=M(e).requestAdapter(M(i));return G(n)},__wbg_requestDevice_ab46d0519ea1cc34:function(e,i){let n=M(e).requestDevice(M(i));return G(n)},__wbg_resolveQuerySet_0f32dc3de3f09701:function(e,i,n,r,s,a){M(e).resolveQuerySet(M(i),n>>>0,r>>>0,M(s),a>>>0)},__wbg_resolve_25a7e548d5881dca:function(e){let i=Promise.resolve(M(e));return G(i)},__wbg_scissor_079b7c4a5c9fcb63:function(e,i,n,r,s){M(e).scissor(i,n,r,s)},__wbg_scissor_e69faa631ab6fdc0:function(e,i,n,r,s){M(e).scissor(i,n,r,s)},__wbg_setBindGroup_268fd1714fff0ef5:function(){return Zt(function(e,i,n,r,s,a,o){M(e).setBindGroup(i>>>0,M(n),af(r,s),a,o>>>0)},arguments)},__wbg_setBindGroup_3e4ce136bc833ea1:function(){return Zt(function(e,i,n,r,s,a,o){M(e).setBindGroup(i>>>0,M(n),af(r,s),a,o>>>0)},arguments)},__wbg_setBindGroup_c22a1b95c0b17f37:function(e,i,n){M(e).setBindGroup(i>>>0,M(n))},__wbg_setBindGroup_f0de6cb2c7dbfc2c:function(e,i,n){M(e).setBindGroup(i>>>0,M(n))},__wbg_setIndexBuffer_2531a9103450445e:function(e,i,n,r){M(e).setIndexBuffer(M(i),Uw[n],r)},__wbg_setIndexBuffer_7f3cf667b4d71566:function(e,i,n,r,s){M(e).setIndexBuffer(M(i),Uw[n],r,s)},__wbg_setPipeline_c41bf46790f27f9e:function(e,i){M(e).setPipeline(M(i))},__wbg_setPipeline_d73f019e98c76d2d:function(e,i){M(e).setPipeline(M(i))},__wbg_setStencilReference_66c74be6232bb9da:function(e,i){M(e).setStencilReference(i>>>0)},__wbg_setTimeout_b5f25e402b6e8ff9:function(){return Zt(function(e,i,n){return M(e).setTimeout(M(i),n)},arguments)},__wbg_setVertexBuffer_1e448859663dd400:function(e,i,n,r){M(e).setVertexBuffer(i>>>0,M(n),r)},__wbg_setVertexBuffer_7cf533d694e747f3:function(e,i,n,r,s){M(e).setVertexBuffer(i>>>0,M(n),r,s)},__wbg_setViewport_d9fc3eac343de7d0:function(e,i,n,r,s,a,o){M(e).setViewport(i,n,r,s,a,o)},__wbg_set_29c99a8aac1c01e5:function(e,i,n){M(e).set(El(i,n))},__wbg_set_6e30c9374c26414c:function(){return Zt(function(e,i,n){return Reflect.set(M(e),M(i),M(n))},arguments)},__wbg_set_6f7e2d6e41d9a122:function(e,i,n){M(e)[Kt(i)]=Kt(n)},__wbg_set_a_88262a42340d0b1c:function(e,i){M(e).a=i},__wbg_set_access_9a5092f05dc45fad:function(e,i){M(e).access=Zq[i]},__wbg_set_address_mode_u_9e2695575a219e33:function(e,i){M(e).addressModeU=Lw[i]},__wbg_set_address_mode_v_f479b2e6cccbcac4:function(e,i){M(e).addressModeV=Lw[i]},__wbg_set_address_mode_w_46273e153230180d:function(e,i){M(e).addressModeW=Lw[i]},__wbg_set_alpha_bfd2df62e7bc581b:function(e,i){M(e).alpha=M(i)},__wbg_set_alpha_mode_df805952892caa9c:function(e,i){M(e).alphaMode=Nq[i]},__wbg_set_alpha_to_coverage_enabled_8b5dc2b0a225b3b2:function(e,i){M(e).alphaToCoverageEnabled=i!==0},__wbg_set_array_layer_count_7312f0f31af94e7c:function(e,i){M(e).arrayLayerCount=i>>>0},__wbg_set_array_stride_f64_27ffaf4fffd74e61:function(e,i){M(e).arrayStride=i},__wbg_set_aspect_0d453bca3d012f02:function(e,i){M(e).aspect=kw[i]},__wbg_set_aspect_210da747c9d77aba:function(e,i){M(e).aspect=kw[i]},__wbg_set_aspect_4962514fe99e68e6:function(e,i){M(e).aspect=kw[i]},__wbg_set_attributes_7537844a7e6dafdc:function(e,i,n){M(e).attributes=Zs(i,n)},__wbg_set_b_c47befe0af3261eb:function(e,i){M(e).b=i},__wbg_set_base_array_layer_f176bb9f1b37b342:function(e,i){M(e).baseArrayLayer=i>>>0},__wbg_set_base_mip_level_1df145d9f8db32a9:function(e,i){M(e).baseMipLevel=i>>>0},__wbg_set_beginning_of_pass_write_index_0d4fa06109208ad7:function(e,i){M(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_beginning_of_pass_write_index_e9f5d016947893bd:function(e,i){M(e).beginningOfPassWriteIndex=i>>>0},__wbg_set_bind_group_layouts_5a9cfea401c020ab:function(e,i,n){M(e).bindGroupLayouts=Zs(i,n)},__wbg_set_binding_155b0440b4307793:function(e,i){M(e).binding=i>>>0},__wbg_set_binding_f74df3510792aba1:function(e,i){M(e).binding=i>>>0},__wbg_set_blend_7493c2066c3e9970:function(e,i){M(e).blend=M(i)},__wbg_set_buffer_9c01e3b6d6765ea2:function(e,i){M(e).buffer=M(i)},__wbg_set_buffer_c3410572051920ba:function(e,i){M(e).buffer=M(i)},__wbg_set_buffer_ef7f75306cf663ed:function(e,i){M(e).buffer=M(i)},__wbg_set_buffers_7d0d8f507699e956:function(e,i,n){M(e).buffers=Zs(i,n)},__wbg_set_bytes_per_row_c54ca96953f35774:function(e,i){M(e).bytesPerRow=i>>>0},__wbg_set_bytes_per_row_d69b88eee3929c07:function(e,i){M(e).bytesPerRow=i>>>0},__wbg_set_c775d84916be79ea:function(e,i,n){M(e).set(M(i),n>>>0)},__wbg_set_clear_value_gpu_color_dict_6211425789c76e59:function(e,i){M(e).clearValue=M(i)},__wbg_set_code_b4f37f81f45b5b25:function(e,i,n){M(e).code=Te(i,n)},__wbg_set_color_83aa977526e88cbb:function(e,i){M(e).color=M(i)},__wbg_set_color_attachments_581fdb3310e4abfa:function(e,i,n){M(e).colorAttachments=Zs(i,n)},__wbg_set_compare_cd9b62cdb92eb580:function(e,i){M(e).compare=Bw[i]},__wbg_set_compare_f36b34abfaa08ccb:function(e,i){M(e).compare=Bw[i]},__wbg_set_compute_d0c2d276b6d4b18d:function(e,i){M(e).compute=M(i)},__wbg_set_count_069a4eac409bac55:function(e,i){M(e).count=i>>>0},__wbg_set_count_3ab1c1220e4ceeb3:function(e,i){M(e).count=i>>>0},__wbg_set_cull_mode_fc649853947a3d0c:function(e,i){M(e).cullMode=Vq[i]},__wbg_set_currentTime_7c37e2312e9d2687:function(e,i){M(e).currentTime=i},__wbg_set_depth_bias_clamp_1c0d695df7f092e5:function(e,i){M(e).depthBiasClamp=i},__wbg_set_depth_bias_d7cd16096242a657:function(e,i){M(e).depthBias=i},__wbg_set_depth_bias_slope_scale_c4e52ec743ef55ba:function(e,i){M(e).depthBiasSlopeScale=i},__wbg_set_depth_clear_value_beda3ec5b1a5c43a:function(e,i){M(e).depthClearValue=i},__wbg_set_depth_compare_0c8631eb2eae98e3:function(e,i){M(e).depthCompare=Bw[i]},__wbg_set_depth_fail_op_668155ae33d3c06f:function(e,i){M(e).depthFailOp=Fw[i]},__wbg_set_depth_load_op_511c513eab4e56a9:function(e,i){M(e).depthLoadOp=zw[i]},__wbg_set_depth_or_array_layers_89371305ed0bd962:function(e,i){M(e).depthOrArrayLayers=i>>>0},__wbg_set_depth_read_only_7f41a74741c144ec:function(e,i){M(e).depthReadOnly=i!==0},__wbg_set_depth_stencil_97506c7bea4f53da:function(e,i){M(e).depthStencil=M(i)},__wbg_set_depth_stencil_attachment_73b79e8b4e948222:function(e,i){M(e).depthStencilAttachment=M(i)},__wbg_set_depth_store_op_c89f33b39b43361c:function(e,i){M(e).depthStoreOp=Nw[i]},__wbg_set_depth_write_enabled_ce89750042940350:function(e,i){M(e).depthWriteEnabled=i!==0},__wbg_set_device_e275d1d4f3c9eb74:function(e,i){M(e).device=M(i)},__wbg_set_dimension_868eee80f4b90011:function(e,i){M(e).dimension=Kq[i]},__wbg_set_dimension_e325282e613ca0a4:function(e,i){M(e).dimension=Vw[i]},__wbg_set_dst_factor_ec7407f19be1aff9:function(e,i){M(e).dstFactor=cR[i]},__wbg_set_end_of_pass_write_index_0d546e46b86ea069:function(e,i){M(e).endOfPassWriteIndex=i>>>0},__wbg_set_end_of_pass_write_index_49a6ddbb2b888bfa:function(e,i){M(e).endOfPassWriteIndex=i>>>0},__wbg_set_entries_86a29dd6291c95e7:function(e,i,n){M(e).entries=Zs(i,n)},__wbg_set_entries_a12aca1e458b0456:function(e,i,n){M(e).entries=Zs(i,n)},__wbg_set_entry_point_207540f042015ce5:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_entry_point_5f26aacbe4c545eb:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_entry_point_e87e79251dd3144f:function(e,i,n){M(e).entryPoint=Te(i,n)},__wbg_set_external_texture_386483d8dd82ab56:function(e,i){M(e).externalTexture=M(i)},__wbg_set_fail_op_92f716dbc88b6973:function(e,i){M(e).failOp=Fw[i]},__wbg_set_flip_y_4e1632b36ad0413a:function(e,i){M(e).flipY=i!==0},__wbg_set_format_1fcaa7d60546b490:function(e,i){M(e).format=jh[i]},__wbg_set_format_2c1414a817c213f8:function(e,i){M(e).format=jh[i]},__wbg_set_format_533f9ffa7eef563d:function(e,i){M(e).format=jh[i]},__wbg_set_format_5d2f25cc93654ecc:function(e,i){M(e).format=Jq[i]},__wbg_set_format_5ff53724ed6cedf2:function(e,i){M(e).format=jh[i]},__wbg_set_format_815efd4dc4817bbb:function(e,i){M(e).format=jh[i]},__wbg_set_format_e52bdcca880d2c8e:function(e,i){M(e).format=jh[i]},__wbg_set_fragment_8b780f00a0b0e6f3:function(e,i){M(e).fragment=M(i)},__wbg_set_front_face_28ffdf524eedce5b:function(e,i){M(e).frontFace=Hq[i]},__wbg_set_g_5983abfc46e0cf4e:function(e,i){M(e).g=i},__wbg_set_has_dynamic_offset_62bc230bdb7c54d0:function(e,i){M(e).hasDynamicOffset=i!==0},__wbg_set_height_0739170de8653cc4:function(e,i){M(e).height=i>>>0},__wbg_set_height_14335c4047cf9c1b:function(e,i){M(e).height=i>>>0},__wbg_set_height_c661af0c0b5376f9:function(e,i){M(e).height=i>>>0},__wbg_set_label_08d9be3e4719c226:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_17eb9fe3a02f62b0:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_206558c8adc3780f:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_48e6b787d256f621:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_547d0d4aec39fbe9:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_5ee7427342869829:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_60ad96c811e0d109:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_6db0393d3fdc90a5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_72bb4f41ef0cb893:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_79387decda299036:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_9556af8b5cda3c9d:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_d010f237b26f2c55:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e16e2dbe51349c7f:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e3944e54881b8c50:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_e922700240417ab5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_label_ef44793ddf4455c5:function(e,i,n){M(e).label=Te(i,n)},__wbg_set_layout_41021cfd2a2f62df:function(e,i){M(e).layout=M(i)},__wbg_set_layout_50ab727f44b38f26:function(e,i){M(e).layout=M(i)},__wbg_set_layout_913d53c17194c989:function(e,i){M(e).layout=M(i)},__wbg_set_layout_gpu_auto_layout_mode_0a5a185b3d52b726:function(e,i){M(e).layout=hR[i]},__wbg_set_layout_gpu_auto_layout_mode_aeba193938b47882:function(e,i){M(e).layout=hR[i]},__wbg_set_load_op_99661da6c4eab9b0:function(e,i){M(e).loadOp=zw[i]},__wbg_set_lod_max_clamp_dd2d9f9f052f4f44:function(e,i){M(e).lodMaxClamp=i},__wbg_set_lod_min_clamp_6d20c97916baeb93:function(e,i){M(e).lodMinClamp=i},__wbg_set_loop_b622b726769860be:function(e,i){M(e).loop=i!==0},__wbg_set_mag_filter_b5adebc99cb938e1:function(e,i){M(e).magFilter=dR[i]},__wbg_set_mapped_at_creation_81b586dc90a50347:function(e,i){M(e).mappedAtCreation=i!==0},__wbg_set_mask_70a8a59ce09e5997:function(e,i){M(e).mask=i>>>0},__wbg_set_max_anisotropy_2beada0e2db62c45:function(e,i){M(e).maxAnisotropy=i},__wbg_set_method_7a6811dec7a4feff:function(e,i,n){M(e).method=Te(i,n)},__wbg_set_min_binding_size_f64_5005a6904cdf43da:function(e,i){M(e).minBindingSize=i},__wbg_set_min_filter_c72f17375e135f0a:function(e,i){M(e).minFilter=dR[i]},__wbg_set_mip_level_13253f3afc7aa58a:function(e,i){M(e).mipLevel=i>>>0},__wbg_set_mip_level_count_534caaa7e68e68b8:function(e,i){M(e).mipLevelCount=i>>>0},__wbg_set_mip_level_count_776c8c218b65bc08:function(e,i){M(e).mipLevelCount=i>>>0},__wbg_set_mip_level_f7ac79e8c54f59ad:function(e,i){M(e).mipLevel=i>>>0},__wbg_set_mipmap_filter_5bf66195a3639700:function(e,i){M(e).mipmapFilter=Wq[i]},__wbg_set_mode_9990b3393ba469ae:function(e,i){M(e).mode=kq[i]},__wbg_set_mode_c90e3667002857d4:function(e,i){M(e).mode=eX[i]},__wbg_set_module_5db9b76ee2dd2a59:function(e,i){M(e).module=M(i)},__wbg_set_module_d0e2098713606cae:function(e,i){M(e).module=M(i)},__wbg_set_module_f02e076ca7e7daf8:function(e,i){M(e).module=M(i)},__wbg_set_multisample_37ddafe88b5cd466:function(e,i){M(e).multisample=M(i)},__wbg_set_multisampled_7913fd7183272840:function(e,i){M(e).multisampled=i!==0},__wbg_set_muted_16f1e7acd8244e28:function(e,i){M(e).muted=i!==0},__wbg_set_offset_f64_28c24dc15000932e:function(e,i){M(e).offset=i},__wbg_set_offset_f64_89f0ce01a689839e:function(e,i){M(e).offset=i},__wbg_set_offset_f64_b562d1367e34ef93:function(e,i){M(e).offset=i},__wbg_set_offset_f64_fa66068813376ca3:function(e,i){M(e).offset=i},__wbg_set_once_27df5233613a51cd:function(e,i){M(e).once=i!==0},__wbg_set_operation_62ce44e1728c4047:function(e,i){M(e).operation=zq[i]},__wbg_set_origin_gpu_origin_2d_dict_1240202973e56f92:function(e,i){M(e).origin=M(i)},__wbg_set_origin_gpu_origin_3d_dict_37222d7b3d238123:function(e,i){M(e).origin=M(i)},__wbg_set_origin_gpu_origin_3d_dict_631c04520718091f:function(e,i){M(e).origin=M(i)},__wbg_set_pass_op_cf02fa088d6352a7:function(e,i){M(e).passOp=Fw[i]},__wbg_set_power_preference_8fdca0b7af640d49:function(e,i){M(e).powerPreference=qq[i]},__wbg_set_premultiplied_alpha_3f27816ad319d5a9:function(e,i){M(e).premultipliedAlpha=i!==0},__wbg_set_primitive_43c23761a55b4088:function(e,i){M(e).primitive=M(i)},__wbg_set_query_set_41de86d2401aee04:function(e,i){M(e).querySet=M(i)},__wbg_set_query_set_4889dd944d5ec0fd:function(e,i){M(e).querySet=M(i)},__wbg_set_r_c6f4c68f4804d655:function(e,i){M(e).r=i},__wbg_set_required_features_1baf274a8669db60:function(e,i,n){M(e).requiredFeatures=Zs(i,n)},__wbg_set_required_limits_871ed33c68613dcb:function(e,i){M(e).requiredLimits=M(i)},__wbg_set_resolve_target_gpu_texture_view_b19a4f2debf79b96:function(e,i){M(e).resolveTarget=M(i)},__wbg_set_resource_5ae7b5e67924f234:function(e,i){M(e).resource=M(i)},__wbg_set_resource_gpu_buffer_binding_e5dbca063e7cb67b:function(e,i){M(e).resource=M(i)},__wbg_set_resource_gpu_texture_view_eb46c355d51ad7e5:function(e,i){M(e).resource=M(i)},__wbg_set_rows_per_image_5011f97318ee71af:function(e,i){M(e).rowsPerImage=i>>>0},__wbg_set_rows_per_image_59a813ac5006e10e:function(e,i){M(e).rowsPerImage=i>>>0},__wbg_set_sample_count_eb86a8b18545b54f:function(e,i){M(e).sampleCount=i>>>0},__wbg_set_sample_type_c32e1dfff94e63eb:function(e,i){M(e).sampleType=Qq[i]},__wbg_set_sampler_c0e1258543a33bce:function(e,i){M(e).sampler=M(i)},__wbg_set_shader_location_7e1832a74f912217:function(e,i){M(e).shaderLocation=i>>>0},__wbg_set_size_f64_6bcd40704bf4cfdc:function(e,i){M(e).size=i},__wbg_set_size_f64_8b8f6bba5d678162:function(e,i){M(e).size=i},__wbg_set_size_gpu_extent_3d_dict_7e42e1c98fa36434:function(e,i){M(e).size=M(i)},__wbg_set_source_0c40b87cfdd5d704:function(e,i){M(e).source=M(i)},__wbg_set_source_html_canvas_element_f657e39507ba2fe5:function(e,i){M(e).source=M(i)},__wbg_set_source_html_image_element_fcc7cba0635adac1:function(e,i){M(e).source=M(i)},__wbg_set_source_html_video_element_e63a39653665f651:function(e,i){M(e).source=M(i)},__wbg_set_source_image_data_68478f1afce208b8:function(e,i){M(e).source=M(i)},__wbg_set_source_offscreen_canvas_266a3de949693e62:function(e,i){M(e).source=M(i)},__wbg_set_source_video_frame_3083c0ce54b9cb73:function(e,i){M(e).source=M(i)},__wbg_set_src_factor_9bfe84af9b7b5cac:function(e,i){M(e).srcFactor=cR[i]},__wbg_set_stencil_back_85b22f1db5b1940a:function(e,i){M(e).stencilBack=M(i)},__wbg_set_stencil_clear_value_42be608809151e2a:function(e,i){M(e).stencilClearValue=i>>>0},__wbg_set_stencil_front_525526164a798a44:function(e,i){M(e).stencilFront=M(i)},__wbg_set_stencil_load_op_31838c036993098a:function(e,i){M(e).stencilLoadOp=zw[i]},__wbg_set_stencil_read_mask_5cc26495e8b3ae82:function(e,i){M(e).stencilReadMask=i>>>0},__wbg_set_stencil_read_only_bf1d0c1897e25c62:function(e,i){M(e).stencilReadOnly=i!==0},__wbg_set_stencil_store_op_e6be1cbc3a8fc210:function(e,i){M(e).stencilStoreOp=Nw[i]},__wbg_set_stencil_write_mask_d9cb40ec4b4bee5b:function(e,i){M(e).stencilWriteMask=i>>>0},__wbg_set_step_mode_a97bb24714da41a9:function(e,i){M(e).stepMode=tX[i]},__wbg_set_storage_texture_939a097db4b18bd4:function(e,i){M(e).storageTexture=M(i)},__wbg_set_store_op_b5fdf672436f13f3:function(e,i){M(e).storeOp=Nw[i]},__wbg_set_strip_index_format_9f787be6c5fc9e87:function(e,i){M(e).stripIndexFormat=Uw[i]},__wbg_set_targets_c38bd200c836d66f:function(e,i,n){M(e).targets=Zs(i,n)},__wbg_set_texture_016561d5911339e5:function(e,i){M(e).texture=M(i)},__wbg_set_texture_1f64653a5d2d7b4d:function(e,i){M(e).texture=M(i)},__wbg_set_texture_9dcedde1bb31eda6:function(e,i){M(e).texture=M(i)},__wbg_set_timestamp_writes_59c2d19ed8aecd97:function(e,i){M(e).timestampWrites=M(i)},__wbg_set_timestamp_writes_98bed1a8bbc6682d:function(e,i){M(e).timestampWrites=M(i)},__wbg_set_tone_mapping_b3464f1baa4cff92:function(e,i){M(e).toneMapping=M(i)},__wbg_set_topology_da25f2cc5af203d2:function(e,i){M(e).topology=Xq[i]},__wbg_set_type_7f0457c6084dde9b:function(e,i){M(e).type=$q[i]},__wbg_set_type_ccf8472d40abcddf:function(e,i){M(e).type=Yq[i]},__wbg_set_type_d09829f59932a0fc:function(e,i){M(e).type=Fq[i]},__wbg_set_unclipped_depth_04524a2b44e1e3c1:function(e,i){M(e).unclippedDepth=i!==0},__wbg_set_usage_a137f82ca163b0a9:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_b2a2935f37bf3d08:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_ba5b0f8b333ab325:function(e,i){M(e).usage=i>>>0},__wbg_set_usage_ddd42599bbba7779:function(e,i){M(e).usage=i>>>0},__wbg_set_vertex_0be5d146f9ff6f36:function(e,i){M(e).vertex=M(i)},__wbg_set_view_dimension_0df554032f1f3a85:function(e,i){M(e).viewDimension=Vw[i]},__wbg_set_view_dimension_4818d4c18ce5815e:function(e,i){M(e).viewDimension=Vw[i]},__wbg_set_view_formats_4347dc8363331086:function(e,i,n){M(e).viewFormats=Zs(i,n)},__wbg_set_view_formats_5797d2fff3c11808:function(e,i,n){M(e).viewFormats=Zs(i,n)},__wbg_set_view_gpu_texture_view_9b2d86b6b99d9fd9:function(e,i){M(e).view=M(i)},__wbg_set_view_gpu_texture_view_c0f35f8857c25206:function(e,i){M(e).view=M(i)},__wbg_set_visibility_9570b037224c4cc2:function(e,i){M(e).visibility=i>>>0},__wbg_set_volume_520cdc6b7ada8f76:function(e,i){M(e).volume=i},__wbg_set_width_7ca43f32db1cfe8e:function(e,i){M(e).width=i>>>0},__wbg_set_width_87301412247f3343:function(e,i){M(e).width=i>>>0},__wbg_set_width_9f685402c2cbee70:function(e,i){M(e).width=i>>>0},__wbg_set_write_mask_d45279e56abbfcb5:function(e,i){M(e).writeMask=i>>>0},__wbg_set_x_232d24fdc32d8351:function(e,i){M(e).x=i>>>0},__wbg_set_x_876d592971db129a:function(e,i){M(e).x=i>>>0},__wbg_set_y_18fe375093e59dfb:function(e,i){M(e).y=i>>>0},__wbg_set_y_2b1f5ac0dd5586a5:function(e,i){M(e).y=i>>>0},__wbg_set_z_ef005d82bc9d24e3:function(e,i){M(e).z=i>>>0},__wbg_shaderSource_7d18b5a43a504f5c:function(e,i,n,r){M(e).shaderSource(M(i),Te(n,r))},__wbg_shaderSource_df5bb6320451f3cd:function(e,i,n,r){M(e).shaderSource(M(i),Te(n,r))},__wbg_size_211f88d386430781:function(e){return M(e).size},__wbg_src_f0e9281991fbd919:function(e,i){let n=M(i).src,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_stack_3b0d974bbf31e44f:function(e,i){let n=M(i).stack,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){let e=typeof global>"u"?null:global;return ne(e)?0:G(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){let e=typeof globalThis>"u"?null:globalThis;return ne(e)?0:G(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){let e=typeof self>"u"?null:self;return ne(e)?0:G(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){let e=typeof window>"u"?null:window;return ne(e)?0:G(e)},__wbg_stencilFunc_8f53a5508560354d:function(e,i,n,r){M(e).stencilFunc(i>>>0,n,r>>>0)},__wbg_stencilFunc_c7553215f237ee38:function(e,i,n,r){M(e).stencilFunc(i>>>0,n,r>>>0)},__wbg_stencilOp_a844a4e9824eee70:function(e,i,n,r){M(e).stencilOp(i>>>0,n>>>0,r>>>0)},__wbg_stencilOp_e82bd7ea13f18adf:function(e,i,n,r){M(e).stencilOp(i>>>0,n>>>0,r>>>0)},__wbg_subgroupMaxSize_1527c5f7a8fe91bb:function(e){return M(e).subgroupMaxSize},__wbg_subgroupMinSize_d6c5ad4bddc828e9:function(e){return M(e).subgroupMinSize},__wbg_submit_ce44115121cd166c:function(e,i,n){M(e).submit(Zs(i,n))},__wbg_texImage2D_01c22558517ee8db:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_152e9dcd4bc3a464:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texImage2D_3704db20a16b6c35:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texImage2D_63d0b87d5ebe4a7f:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_90633e994ded3d2b:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texImage2D_ea94e8a2df5f97e2:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,h)},arguments)},__wbg_texImage2D_facfa039fb461b66:function(){return Zt(function(e,i,n,r,s,a,o){M(e).texImage2D(i>>>0,n,r,s>>>0,a>>>0,M(o))},arguments)},__wbg_texParameteri_87ebfcefb0af2c50:function(e,i,n,r){M(e).texParameteri(i>>>0,n>>>0,r)},__wbg_texParameteri_e5ad2054e239066e:function(e,i,n,r){M(e).texParameteri(i>>>0,n>>>0,r)},__wbg_texStorage2D_bb2a1bd1ab0b9184:function(e,i,n,r,s,a){M(e).texStorage2D(i>>>0,n,r>>>0,s,a)},__wbg_texSubImage2D_3483ba5f10ee42c2:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).texSubImage2D(i>>>0,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_texSubImage2D_4ca4c3faa4392438:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texSubImage2D_54d18572b1ba74ab:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,h)},arguments)},__wbg_texSubImage2D_5bebe93724e6ed61:function(){return Zt(function(e,i,n,r,s,a,o,l,c,h){M(e).texSubImage2D(i>>>0,n,r,s,a,o,l>>>0,c>>>0,M(h))},arguments)},__wbg_texSubImage2D_5e1594de0416e9f6:function(){return Zt(function(e,i,n,r,s,a,o,l){M(e).texSubImage2D(i>>>0,n,r,s,a>>>0,o>>>0,M(l))},arguments)},__wbg_then_18f476d590e58992:function(e,i,n){let r=M(e).then(M(i),M(n));return G(r)},__wbg_then_47213a40b6aeb86c:function(e,i){let n=M(e).then(M(i));return G(n)},__wbg_then_ac7b025999b52837:function(e,i){let n=M(e).then(M(i));return G(n)},__wbg_type_71742b859467fa3c:function(e){return M(e).type},__wbg_unconfigure_0a07a0a40de8988d:function(e){M(e).unconfigure()},__wbg_uniform1f_8c3b3e6e3723fe14:function(e,i,n){M(e).uniform1f(M(i),n)},__wbg_uniform1f_d6619faa73c2a45f:function(e,i,n){M(e).uniform1f(M(i),n)},__wbg_uniform1fv_11d5842aff79c8a3:function(e,i,n,r){M(e).uniform1fv(M(i),ds(n,r))},__wbg_uniform1fv_b4b087b4d6e2bb25:function(e,i,n,r){M(e).uniform1fv(M(i),ds(n,r))},__wbg_uniform1i_14982bb8438243b4:function(e,i,n){M(e).uniform1i(M(i),n)},__wbg_uniform1i_cf11d5b364eed1c8:function(e,i,n){M(e).uniform1i(M(i),n)},__wbg_uniform1ui_d177882f473d2afc:function(e,i,n){M(e).uniform1ui(M(i),n>>>0)},__wbg_uniform2f_19fb96222ae72e1a:function(e,i,n,r){M(e).uniform2f(M(i),n,r)},__wbg_uniform2f_44cee47e30b82f96:function(e,i,n,r){M(e).uniform2f(M(i),n,r)},__wbg_uniform2fv_2f06d989ec4b5d8f:function(e,i,n,r){M(e).uniform2fv(M(i),ds(n,r))},__wbg_uniform2fv_f022309b362a80c3:function(e,i,n,r){M(e).uniform2fv(M(i),ds(n,r))},__wbg_uniform2i_16e8a2c966614be6:function(e,i,n,r){M(e).uniform2i(M(i),n,r)},__wbg_uniform2i_d353da02172ea38d:function(e,i,n,r){M(e).uniform2i(M(i),n,r)},__wbg_uniform3f_360c1ea4c73cacef:function(e,i,n,r,s){M(e).uniform3f(M(i),n,r,s)},__wbg_uniform3f_b616f9e06266a25f:function(e,i,n,r,s){M(e).uniform3f(M(i),n,r,s)},__wbg_uniform4f_f1a670d511b34878:function(e,i,n,r,s,a){M(e).uniform4f(M(i),n,r,s,a)},__wbg_uniform4f_f97f3f59af09856f:function(e,i,n,r,s,a){M(e).uniform4f(M(i),n,r,s,a)},__wbg_uniformMatrix3fv_f45b91f173d7fbed:function(e,i,n,r,s){M(e).uniformMatrix3fv(M(i),n!==0,ds(r,s))},__wbg_uniformMatrix3fv_feab3f952d705f51:function(e,i,n,r,s){M(e).uniformMatrix3fv(M(i),n!==0,ds(r,s))},__wbg_uniformMatrix3x2fv_ab13f9742e5fcb2f:function(e,i,n,r,s){M(e).uniformMatrix3x2fv(M(i),n!==0,ds(r,s))},__wbg_uniformMatrix4fv_540dc6bf792eba8f:function(e,i,n,r,s){M(e).uniformMatrix4fv(M(i),n!==0,ds(r,s))},__wbg_uniformMatrix4fv_e3dac9dd429d6adc:function(e,i,n,r,s){M(e).uniformMatrix4fv(M(i),n!==0,ds(r,s))},__wbg_uniformMatrix4x3fv_115d029ad3124cef:function(e,i,n,r,s){M(e).uniformMatrix4x3fv(M(i),n!==0,ds(r,s))},__wbg_unmap_adaf93276fdf9aaf:function(e){M(e).unmap()},__wbg_useProgram_55a3e940abb19137:function(e,i){M(e).useProgram(M(i))},__wbg_useProgram_e24dadf4c06636f5:function(e,i){M(e).useProgram(M(i))},__wbg_userAgent_8def8135d886414b:function(){return Zt(function(e,i){let n=M(i).userAgent,r=tn(n,X.__wbindgen_export,X.__wbindgen_export2),s=Ai;ie().setInt32(e+4,s,!0),ie().setInt32(e+0,r,!0)},arguments)},__wbg_valueOf_41ae57308c1f031c:function(e){return M(e).valueOf()},__wbg_value_f3625092ee4b37f4:function(e){let i=M(e).value;return G(i)},__wbg_vertexAttrib4f_6444504b25f4d43e:function(e,i,n,r,s,a){M(e).vertexAttrib4f(i>>>0,n,r,s,a)},__wbg_vertexAttrib4f_aad41fe000407191:function(e,i,n,r,s,a){M(e).vertexAttrib4f(i>>>0,n,r,s,a)},__wbg_vertexAttribIPointer_ed1c3507e84527e2:function(e,i,n,r,s,a){M(e).vertexAttribIPointer(i>>>0,n,r>>>0,s,a)},__wbg_vertexAttribPointer_39eddea7c20e350c:function(e,i,n,r,s,a,o){M(e).vertexAttribPointer(i>>>0,n,r>>>0,s!==0,a,o)},__wbg_vertexAttribPointer_3bc50c0431082f73:function(e,i,n,r,s,a,o){M(e).vertexAttribPointer(i>>>0,n,r>>>0,s!==0,a,o)},__wbg_videoFrameToken_6f05524e85fa2b75:function(e){return nR(M(e))},__wbg_videoHeight_e267fd1e74bb1b06:function(e){return M(e).videoHeight},__wbg_videoWidth_670b8e775ea04b5d:function(e){return M(e).videoWidth},__wbg_viewport_14d947f2faf58e85:function(e,i,n,r,s){M(e).viewport(i,n,r,s)},__wbg_viewport_24055b0754803788:function(e,i,n,r,s){M(e).viewport(i,n,r,s)},__wbg_warn_410c3261e3c6d686:function(e){console.warn(M(e))},__wbg_width_f1791280fae1517a:function(e){return M(e).width},__wbg_writeTexture_53ba204c494b042c:function(){return Zt(function(e,i,n,r,s,a){M(e).writeTexture(M(i),El(n,r),M(s),M(a))},arguments)},__wbindgen_cast_0000000000000001:function(e,i){let n=xo(e,i,Rq);return G(n)},__wbindgen_cast_0000000000000002:function(e,i){let n=xo(e,i,Pq);return G(n)},__wbindgen_cast_0000000000000003:function(e,i){let n=xo(e,i,Oq);return G(n)},__wbindgen_cast_0000000000000004:function(e,i){let n=xo(e,i,Iq);return G(n)},__wbindgen_cast_0000000000000005:function(e,i){let n=xo(e,i,Dq);return G(n)},__wbindgen_cast_0000000000000006:function(e,i){let n=xo(e,i,Lq);return G(n)},__wbindgen_cast_0000000000000007:function(e,i){let n=xo(e,i,Bq);return G(n)},__wbindgen_cast_0000000000000008:function(e,i){let n=xo(e,i,Uq);return G(n)},__wbindgen_cast_0000000000000009:function(e,i){let n=xo(e,i,Cq);return G(n)},__wbindgen_cast_000000000000000a:function(e){return G(e)},__wbindgen_cast_000000000000000b:function(e,i){let n=ds(e,i);return G(n)},__wbindgen_cast_000000000000000c:function(e,i){let n=aX(e,i);return G(n)},__wbindgen_cast_000000000000000d:function(e,i){let n=vR(e,i);return G(n)},__wbindgen_cast_000000000000000e:function(e,i){let n=oX(e,i);return G(n)},__wbindgen_cast_000000000000000f:function(e,i){let n=lX(e,i);return G(n)},__wbindgen_cast_0000000000000010:function(e,i){let n=af(e,i);return G(n)},__wbindgen_cast_0000000000000011:function(e,i){let n=El(e,i);return G(n)},__wbindgen_cast_0000000000000012:function(e,i){let n=Te(e,i);return G(n)},__wbindgen_cast_0000000000000013:function(e){let i=BigInt.asUintN(64,e);return G(i)},__wbindgen_cast_0000000000000014:function(e,i){var n=El(e,i).slice();return X.__wbindgen_export4(e,i*1,1),G(n)},__wbindgen_object_clone_ref:function(e){let i=M(e);return G(i)},__wbindgen_object_drop_ref:function(e){Kt(e)}}}}function Cq(t,e){X.__wasm_bindgen_func_elem_12535(t,e)}function Pq(t,e,i){X.__wasm_bindgen_func_elem_5131(t,e,G(i))}function Dq(t,e,i){X.__wasm_bindgen_func_elem_11171(t,e,G(i))}function Rq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_14170(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function Oq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_11170(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function Iq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_11170_3(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function Lq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_11170_5(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function Bq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_11170_6(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function Uq(t,e,i){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.__wasm_bindgen_func_elem_11170_7(s,t,e,G(i));var n=ie().getInt32(s+4*0,!0),r=ie().getInt32(s+4*1,!0);if(r)throw Kt(n)}finally{X.__wbindgen_add_to_stack_pointer(16)}}function lR(t,e,i,n){X.__wasm_bindgen_func_elem_14172(t,e,G(i),G(n))}function G(t){gf===Ks.length&&Ks.push(Ks.length+1);let e=gf;return gf=Ks[e],Ks[e]=t,e}function nX(t){if(W0==1)throw new Error("out of js stack");return Ks[--W0]=t,W0}function Gw(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){let r=t.description;return r==null?"Symbol":`Symbol(${r})`}if(e=="function"){let r=t.name;return typeof r=="string"&&r.length>0?`Function(${r})`:"Function"}if(Array.isArray(t)){let r=t.length,s="[";r>0&&(s+=Gw(t[0]));for(let a=1;a<r;a++)s+=", "+Gw(t[a]);return s+="]",s}let i=/\[object ([^\]]+)\]/.exec(toString.call(t)),n;if(i&&i.length>1)n=i[1];else return toString.call(t);if(n=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
|
|
36
36
|
${t.stack}`:n}function rX(t){t<1028||(Ks[t]=gf,gf=t)}function ds(t,e){return t=t>>>0,hX().subarray(t/4,t/4+e)}function sX(t,e){return t=t>>>0,cX().subarray(t/8,t/8+e)}function aX(t,e){return t=t>>>0,dX().subarray(t/2,t/2+e)}function vR(t,e){return t=t>>>0,uX().subarray(t/4,t/4+e)}function oX(t,e){return t=t>>>0,pX().subarray(t/1,t/1+e)}function sf(t,e){t=t>>>0;let i=ie(),n=[];for(let r=t;r<t+4*e;r+=4)n.push(Kt(i.getUint32(r,!0)));return n}function Zs(t,e){t=t>>>0;let i=ie(),n=[];for(let r=t;r<t+4*e;r+=4)n.push(M(i.getUint32(r,!0)));return n}function lX(t,e){return t=t>>>0,fX().subarray(t/2,t/2+e)}function af(t,e){return t=t>>>0,mX().subarray(t/4,t/4+e)}function El(t,e){return t=t>>>0,mf().subarray(t/1,t/1+e)}function ie(){return(Gh===null||Gh.buffer.detached===!0||Gh.buffer.detached===void 0&&Gh.buffer!==X.memory.buffer)&&(Gh=new DataView(X.memory.buffer)),Gh}function hX(){return(of===null||of.byteLength===0)&&(of=new Float32Array(X.memory.buffer)),of}function cX(){return(lf===null||lf.byteLength===0)&&(lf=new Float64Array(X.memory.buffer)),lf}function dX(){return(hf===null||hf.byteLength===0)&&(hf=new Int16Array(X.memory.buffer)),hf}function uX(){return(cf===null||cf.byteLength===0)&&(cf=new Int32Array(X.memory.buffer)),cf}function pX(){return(df===null||df.byteLength===0)&&(df=new Int8Array(X.memory.buffer)),df}function Te(t,e){return vX(t>>>0,e)}function fX(){return(uf===null||uf.byteLength===0)&&(uf=new Uint16Array(X.memory.buffer)),uf}function mX(){return(pf===null||pf.byteLength===0)&&(pf=new Uint32Array(X.memory.buffer)),pf}function mf(){return(ff===null||ff.byteLength===0)&&(ff=new Uint8Array(X.memory.buffer)),ff}function M(t){return Ks[t]}function Zt(t,e){try{return t.apply(this,e)}catch(i){X.__wbindgen_export3(G(i))}}function ne(t){return t==null}function xo(t,e,i){let n={a:t,b:e,cnt:1},r=(...s)=>{n.cnt++;let a=n.a;n.a=0;try{return i(a,n.b,...s)}finally{n.a=a,r._wbg_cb_unref()}};return r._wbg_cb_unref=()=>{--n.cnt===0&&(X.__wbindgen_export5(n.a,n.b),n.a=0,gR.unregister(n))},gR.register(r,n,n),r}function yR(t,e){let i=e(t.length*4,4)>>>0,n=ie();for(let r=0;r<t.length;r++)n.setUint32(i+4*r,G(t[r]),!0);return Ai=t.length,i}function tn(t,e,i){if(i===void 0){let o=vf.encode(t),l=e(o.length,1)>>>0;return mf().subarray(l,l+o.length).set(o),Ai=o.length,l}let n=t.length,r=e(n,1)>>>0,s=mf(),a=0;for(;a<n;a++){let o=t.charCodeAt(a);if(o>127)break;s[r+a]=o}if(a!==n){a!==0&&(t=t.slice(a)),r=i(r,n,n=a+t.length*3,1)>>>0;let o=mf().subarray(r+a,r+n),l=vf.encodeInto(t,o);a+=l.written,r=i(r,n,a,1)>>>0}return Ai=a,r}function Kt(t){let e=M(t);return rX(t),e}function vX(t,e){return jw+=e,jw>=gX&&(q0=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),q0.decode(),jw=e),q0.decode(mf().subarray(t,t+e))}function bR(t,e){return _X=t,X=t.exports,yX=e,Gh=null,of=null,lf=null,hf=null,cf=null,df=null,uf=null,pf=null,ff=null,X.__wbindgen_start(),X}async function bX(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.ok&&i(t.type)&&t.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",r);else throw r}let n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{let n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}function i(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}function xX(t){if(X!==void 0)return X;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=_R();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let i=new WebAssembly.Instance(t,e);return bR(i,t)}async function wX(t){if(X!==void 0)return X;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),t===void 0&&(t=new URL("hana-ui.wasm",import.meta.url));let e=_R();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:i,module:n}=await bX(await t,e);return bR(i,n)}var Al,Tl,Cl,wo,yf,Lw,hR,cR,zq,Fq,Nq,kq,Bw,Vq,jq,Gq,dR,Hq,Uw,zw,Wq,qq,Xq,$q,Yq,Fw,Zq,Nw,kw,Kq,jh,Qq,Vw,Jq,tX,eX,uR,pR,fR,mR,iX,gR,Gh,of,lf,hf,cf,df,uf,pf,ff,Ks,gf,W0,q0,gX,jw,vf,Ai,yX,_X,X,wR=Kp(()=>{"use strict";oR();Al=class{static __wrap(e){let i=Object.create(Al.prototype);return i.__wbg_ptr=e,uR.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,uR.unregister(this),e}free(){let e=this.__destroy_into_raw();X.__wbg_devicelostpromise_free(e,0)}wait(){let e=this.__destroy_into_raw(),i=X.devicelostpromise_wait(e);return Kt(i)}};Symbol.dispose&&(Al.prototype[Symbol.dispose]=Al.prototype.free);Tl=class{static __wrap(e){let i=Object.create(Tl.prototype);return i.__wbg_ptr=e,pR.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,pR.unregister(this),e}free(){let e=this.__destroy_into_raw();X.__wbg_engine_free(e,0)}static create(e,i,n){let r=X.engine_create(G(e),G(i),n);return Kt(r)}getDeviceLostPromise(){let e=X.engine_getDeviceLostPromise(this.__wbg_ptr);return e===0?void 0:Al.__wrap(e)}getGpuFrameTimeMs(){try{let n=X.__wbindgen_add_to_stack_pointer(-16);X.engine_getGpuFrameTimeMs(n,this.__wbg_ptr);var e=ie().getInt32(n+4*0,!0),i=ie().getFloat64(n+8*1,!0);return e===0?void 0:i}finally{X.__wbindgen_add_to_stack_pointer(16)}}isWebgpu(){return X.engine_isWebgpu(this.__wbg_ptr)!==0}onFrame(e){X.engine_onFrame(this.__wbg_ptr,!ne(e),ne(e)?0:e)}removeTexture(e){X.engine_removeTexture(this.__wbg_ptr,G(e))}renderRegion(e,i,n){let r=X.engine_renderRegion(this.__wbg_ptr,G(e),G(i),n);return wo.__wrap(r)}reset(e){X.engine_reset(this.__wbg_ptr,G(e))}resize(e,i){X.engine_resize(this.__wbg_ptr,G(e),i)}samplePixels(e,i){let n=X.engine_samplePixels(this.__wbg_ptr,G(e),G(i));return wo.__wrap(n)}};Symbol.dispose&&(Tl.prototype[Symbol.dispose]=Tl.prototype.free);Cl=class{static __wrap(e){let i=Object.create(Cl.prototype);return i.__wbg_ptr=e,fR.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,fR.unregister(this),e}free(){let e=this.__destroy_into_raw();X.__wbg_headlessengine_free(e,0)}static create(e,i){let n=X.headlessengine_create(G(e),G(i));return Cl.__wrap(n)}reset(e){X.headlessengine_reset(this.__wbg_ptr,G(e))}resize(e,i){X.headlessengine_resize(this.__wbg_ptr,G(e),i)}};Symbol.dispose&&(Cl.prototype[Symbol.dispose]=Cl.prototype.free);wo=class{static __wrap(e){let i=Object.create(wo.prototype);return i.__wbg_ptr=e,mR.register(i,i.__wbg_ptr,i),i}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,mR.unregister(this),e}free(){let e=this.__destroy_into_raw();X.__wbg_pixelreadpromise_free(e,0)}wait(){let e=this.__destroy_into_raw(),i=X.pixelreadpromise_wait(e);return Kt(i)}};Symbol.dispose&&(wo.prototype[Symbol.dispose]=wo.prototype.free);yf=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,iX.unregister(this),e}free(){let e=this.__destroy_into_raw();X.__wbg_scenecontroller_free(e,0)}get is_play_mode(){return X.__wbg_get_scenecontroller_is_play_mode(this.__wbg_ptr)!==0}get needs_video_update(){return X.__wbg_get_scenecontroller_needs_video_update(this.__wbg_ptr)!==0}get show_pixel_grid(){return X.__wbg_get_scenecontroller_show_pixel_grid(this.__wbg_ptr)!==0}addEmojiArt(e,i){let n=tn(e,X.__wbindgen_export,X.__wbindgen_export2),r=Ai;X.scenecontroller_addEmojiArt(this.__wbg_ptr,n,r,G(i))}addImage(e,i){X.scenecontroller_addImage(this.__wbg_ptr,G(e),G(i))}addLocalFont(e,i,n,r,s){var a=ne(n)?0:tn(n,X.__wbindgen_export,X.__wbindgen_export2),o=Ai,l=ne(r)?0:tn(r,X.__wbindgen_export,X.__wbindgen_export2),c=Ai,h=ne(s)?0:tn(s,X.__wbindgen_export,X.__wbindgen_export2),d=Ai;return X.scenecontroller_addLocalFont(this.__wbg_ptr,G(e),G(i),a,o,l,c,h,d)!==0}addModel3DGeometry(e,i){X.scenecontroller_addModel3DGeometry(this.__wbg_ptr,G(e),G(i))}addVideo(e,i){X.scenecontroller_addVideo(this.__wbg_ptr,G(e),G(i))}addWebFont(e,i){let n=tn(i,X.__wbindgen_export,X.__wbindgen_export2),r=Ai,s=X.scenecontroller_addWebFont(this.__wbg_ptr,G(e),n,r);return Kt(s)}applyDeltaToVectorVertexPositionSelection(e,i,n){let r=X.scenecontroller_applyDeltaToVectorVertexPositionSelection(this.__wbg_ptr,G(e),G(i),G(n));return Kt(r)}axisAlignedBoundingBox(e){let i=X.scenecontroller_axisAlignedBoundingBox(this.__wbg_ptr,G(e));return Kt(i)}boundingBox(){let e=X.scenecontroller_boundingBox(this.__wbg_ptr);return Kt(e)}boxIntersectsObjects(e,i,n,r,s){try{let c=X.__wbindgen_add_to_stack_pointer(-16);X.scenecontroller_boxIntersectsObjects(c,this.__wbg_ptr,G(e),G(i),n,r,ne(s)?0:G(s));var a=ie().getInt32(c+4*0,!0),o=ie().getInt32(c+4*1,!0),l=sf(a,o).slice();return X.__wbindgen_export4(a,o*4,4),l}finally{X.__wbindgen_add_to_stack_pointer(16)}}calcTextAutoSize(e,i){let n=X.scenecontroller_calcTextAutoSize(this.__wbg_ptr,G(e),ne(i)?Number.MAX_SAFE_INTEGER:Math.fround(i));return Kt(n)}centerPencilData(e){let i=X.scenecontroller_centerPencilData(this.__wbg_ptr,G(e));return Kt(i)}centerVectorData(){let e=X.scenecontroller_centerVectorData(this.__wbg_ptr);return Kt(e)}clearVideoExportFrame(e){X.scenecontroller_clearVideoExportFrame(this.__wbg_ptr,G(e))}clearVideoExportFrames(){X.scenecontroller_clearVideoExportFrames(this.__wbg_ptr)}figmaVectorToVecNet(e,i){let n=X.scenecontroller_figmaVectorToVecNet(this.__wbg_ptr,G(e),G(i));return Kt(n)}flattenShape(e){let i=X.scenecontroller_flattenShape(this.__wbg_ptr,G(e));return Kt(i)}flushLayout(e){try{let s=X.__wbindgen_add_to_stack_pointer(-16);X.scenecontroller_flushLayout(s,this.__wbg_ptr,G(e));var i=ie().getInt32(s+4*0,!0),n=ie().getInt32(s+4*1,!0),r=sf(i,n).slice();return X.__wbindgen_export4(i,n*4,4),r}finally{X.__wbindgen_add_to_stack_pointer(16)}}getCurrentFrameIndex(){let e=X.scenecontroller_getCurrentFrameIndex(this.__wbg_ptr);return e===Number.MAX_SAFE_INTEGER?void 0:e}getTotalFramesAmount(){return X.scenecontroller_getTotalFramesAmount(this.__wbg_ptr)>>>0}getUpdatedPencilData(){let e=X.scenecontroller_getUpdatedPencilData(this.__wbg_ptr);return Kt(e)}getUpdatedVecNetData(){let e=X.scenecontroller_getUpdatedVecNetData(this.__wbg_ptr);return Kt(e)}getVectorBoxSelectionBoundsAndLocalMatrix(e){let i=X.scenecontroller_getVectorBoxSelectionBoundsAndLocalMatrix(this.__wbg_ptr,e);return Kt(i)}getVectorCursor(){let e=X.scenecontroller_getVectorCursor(this.__wbg_ptr);return Kt(e)}getVectorEditMode(){let e=X.scenecontroller_getVectorEditMode(this.__wbg_ptr);return Kt(e)}getVectorEditingState(){let e=X.scenecontroller_getVectorEditingState(this.__wbg_ptr);return Kt(e)}getVectorSelectedVerts(){let e=X.scenecontroller_getVectorSelectedVerts(this.__wbg_ptr);return Kt(e)}getVectorSelectionCount(){return X.scenecontroller_getVectorSelectionCount(this.__wbg_ptr)>>>0}hasFontAssetsChanges(){return X.scenecontroller_hasFontAssetsChanges(this.__wbg_ptr)!==0}hasSingleVectorSelectedSegment(){return X.scenecontroller_hasSingleVectorSelectedSegment(this.__wbg_ptr)!==0}instanceRootOf(e){let i=X.scenecontroller_instanceRootOf(this.__wbg_ptr,G(e));return Kt(i)}intersectsObject(e,i,n,r){return X.scenecontroller_intersectsObject(this.__wbg_ptr,G(e),G(i),ne(n)?Number.MAX_SAFE_INTEGER:Math.fround(n),ne(r)?16777215:r?1:0)!==0}intersectsObjects(e,i,n){try{let o=X.__wbindgen_add_to_stack_pointer(-16);X.scenecontroller_intersectsObjects(o,this.__wbg_ptr,G(e),ne(i)?16777215:i?1:0,ne(n)?Number.MAX_SAFE_INTEGER:Math.fround(n));var r=ie().getInt32(o+4*0,!0),s=ie().getInt32(o+4*1,!0),a=sf(r,s).slice();return X.__wbindgen_export4(r,s*4,4),a}finally{X.__wbindgen_add_to_stack_pointer(16)}}isEditedVectorEmpty(){return X.scenecontroller_isEditedVectorEmpty(this.__wbg_ptr)!==0}isObjectInViewport(e){return X.scenecontroller_isObjectInViewport(this.__wbg_ptr,G(e))!==0}isUiFontLoaded(){return X.scenecontroller_isUiFontLoaded(this.__wbg_ptr)!==0}isVectorBoxSelectAllowed(){return X.scenecontroller_isVectorBoxSelectAllowed(this.__wbg_ptr)!==0}isVectorPointUnderCursor(e){return X.scenecontroller_isVectorPointUnderCursor(this.__wbg_ptr,G(e))!==0}layout(){X.scenecontroller_layout(this.__wbg_ptr)}layoutFromResize(){try{let r=X.__wbindgen_add_to_stack_pointer(-16);X.scenecontroller_layoutFromResize(r,this.__wbg_ptr);var e=ie().getInt32(r+4*0,!0),i=ie().getInt32(r+4*1,!0),n=sf(e,i).slice();return X.__wbindgen_export4(e,i*4,4),n}finally{X.__wbindgen_add_to_stack_pointer(16)}}markNeedsLayoutResolve(e){X.scenecontroller_markNeedsLayoutResolve(this.__wbg_ptr,G(e))}measureTextNaturalSize(e){let i=X.scenecontroller_measureTextNaturalSize(this.__wbg_ptr,G(e));return Kt(i)}model3DAnimationClipIndex(e){let i=X.scenecontroller_model3DAnimationClipIndex(this.__wbg_ptr,G(e));return i===Number.MAX_SAFE_INTEGER?void 0:i}model3DAnimationIsPlaying(e){return X.scenecontroller_model3DAnimationIsPlaying(this.__wbg_ptr,G(e))!==0}model3DAnimationLocalTime(e){let i=X.scenecontroller_model3DAnimationLocalTime(this.__wbg_ptr,G(e));return i===Number.MAX_SAFE_INTEGER?void 0:i}moveVectorSelectionByDelta(e){X.scenecontroller_moveVectorSelectionByDelta(this.__wbg_ptr,G(e))}objectAlignedBoundingBox(e){let i=X.scenecontroller_objectAlignedBoundingBox(this.__wbg_ptr,G(e));return Kt(i)}objectData(e){let i=X.scenecontroller_objectData(this.__wbg_ptr,G(e));return Kt(i)}objectLocalMatrix(e){let i=X.scenecontroller_objectLocalMatrix(this.__wbg_ptr,G(e));return Kt(i)}objectWorldMatrix(e){let i=X.scenecontroller_objectWorldMatrix(this.__wbg_ptr,G(e));return Kt(i)}objectWorldMatrixWithChildrenOffset(e){let i=X.scenecontroller_objectWorldMatrixWithChildrenOffset(this.__wbg_ptr,G(e));return Kt(i)}onKeyDown(e){let i=tn(e,X.__wbindgen_export,X.__wbindgen_export2),n=Ai;X.scenecontroller_onKeyDown(this.__wbg_ptr,i,n)}onKeyUp(e){let i=tn(e,X.__wbindgen_export,X.__wbindgen_export2),n=Ai;X.scenecontroller_onKeyUp(this.__wbg_ptr,i,n)}onPointerDown(e,i,n){X.scenecontroller_onPointerDown(this.__wbg_ptr,G(e),i,n)}onPointerEnter(){X.scenecontroller_onPointerEnter(this.__wbg_ptr)}onPointerLeave(){X.scenecontroller_onPointerLeave(this.__wbg_ptr)}onPointerMove(e,i,n){X.scenecontroller_onPointerMove(this.__wbg_ptr,G(e),i,n)}onPointerUp(e,i,n){X.scenecontroller_onPointerUp(this.__wbg_ptr,G(e),i,n)}outermostInstanceRootOf(e){let i=X.scenecontroller_outermostInstanceRootOf(this.__wbg_ptr,G(e));return Kt(i)}parentAlignedBoundingBox(e,i){let n=X.scenecontroller_parentAlignedBoundingBox(this.__wbg_ptr,G(e),G(i));return Kt(n)}parseSvgPath(e,i){let n=tn(e,X.__wbindgen_export,X.__wbindgen_export2),r=Ai,s=X.scenecontroller_parseSvgPath(this.__wbg_ptr,n,r,i);return Kt(s)}pencilShiftDown(){X.scenecontroller_pencilShiftDown(this.__wbg_ptr)}pencilShiftUp(){X.scenecontroller_pencilShiftUp(this.__wbg_ptr)}pendingAssetLoads(){return X.scenecontroller_pendingAssetLoads(this.__wbg_ptr)>>>0}playInEditorFrame(e){X.scenecontroller_playInEditorFrame(this.__wbg_ptr,G(e))}present(e,i){X.scenecontroller_present(this.__wbg_ptr,ne(e)?0:G(e),ne(i)?16777215:i?1:0)}previewTransition(e,i,n){X.scenecontroller_previewTransition(this.__wbg_ptr,G(e),ne(i)?0:G(i),G(n))}projectionEffectBoundingBox(e){let i=X.scenecontroller_projectionEffectBoundingBox(this.__wbg_ptr,G(e));return Kt(i)}readVectorCornerRadiiForSelection(e,i){let n=X.scenecontroller_readVectorCornerRadiiForSelection(this.__wbg_ptr,G(e),G(i));return Kt(n)}readVectorCornerSmoothing(e){return X.scenecontroller_readVectorCornerSmoothing(this.__wbg_ptr,G(e))}readVectorVertexPositionsForSelection(e,i){let n=X.scenecontroller_readVectorVertexPositionsForSelection(this.__wbg_ptr,G(e),G(i));return Kt(n)}reanchorObject(e){X.scenecontroller_reanchorObject(this.__wbg_ptr,G(e))}resetAllStates(e,i){let n=yR(i,X.__wbindgen_export),r=Ai;X.scenecontroller_resetAllStates(this.__wbg_ptr,ne(e)?0:G(e),n,r)}resizeGroup(e,i,n){try{let o=X.__wbindgen_add_to_stack_pointer(-16);X.scenecontroller_resizeGroup(o,this.__wbg_ptr,G(e),i,n);var r=ie().getInt32(o+4*0,!0),s=ie().getInt32(o+4*1,!0),a=sf(r,s).slice();return X.__wbindgen_export4(r,s*4,4),a}finally{X.__wbindgen_add_to_stack_pointer(16)}}saveVectorSelectionInitialPositions(){X.scenecontroller_saveVectorSelectionInitialPositions(this.__wbg_ptr)}screenToWorld(e){let i=X.scenecontroller_screenToWorld(this.__wbg_ptr,G(e));return Kt(i)}seekVideos(e){let i=X.scenecontroller_seekVideos(this.__wbg_ptr,e);return Kt(i)}setBytesForVectorCornerRadiusSelection(e,i,n){let r=X.scenecontroller_setBytesForVectorCornerRadiusSelection(this.__wbg_ptr,G(e),G(i),n);return Kt(r)}setBytesForVectorCornerSmoothing(e,i){let n=X.scenecontroller_setBytesForVectorCornerSmoothing(this.__wbg_ptr,G(e),i);return Kt(n)}setBytesForVectorVertexPositionSelection(e,i,n,r){let s=X.scenecontroller_setBytesForVectorVertexPositionSelection(this.__wbg_ptr,G(e),G(i),n,r);return Kt(s)}setModel3DAnimation(e,i,n){X.scenecontroller_setModel3DAnimation(this.__wbg_ptr,G(e),ne(i)?Number.MAX_SAFE_INTEGER:i>>>0,n)}setModel3DAnimationLocalTime(e,i){X.scenecontroller_setModel3DAnimationLocalTime(this.__wbg_ptr,G(e),i)}setPresentationPadding(e){X.scenecontroller_setPresentationPadding(this.__wbg_ptr,G(e))}setShowPixelGrid(e){X.scenecontroller_setShowPixelGrid(this.__wbg_ptr,e)}setVectorEditingState(e){try{X.scenecontroller_setVectorEditingState(this.__wbg_ptr,nX(e))}finally{Ks[W0++]=void 0}}setVectorTool(e){X.scenecontroller_setVectorTool(this.__wbg_ptr,G(e))}setVideoExportFrame(e,i){X.scenecontroller_setVideoExportFrame(this.__wbg_ptr,G(e),G(i))}snapVectorResizeHandle(e,i,n){let r=X.scenecontroller_snapVectorResizeHandle(this.__wbg_ptr,G(e),i,n);return Kt(r)}start(){X.scenecontroller_start(this.__wbg_ptr)}startPencil(e,i,n){X.scenecontroller_startPencil(this.__wbg_ptr,G(e),i,G(n))}startVectorEditing(e,i){X.scenecontroller_startVectorEditing(this.__wbg_ptr,G(e),i)}stopInEditorFrame(){X.scenecontroller_stopInEditorFrame(this.__wbg_ptr)}stopPencil(){X.scenecontroller_stopPencil(this.__wbg_ptr)}stopPresenting(){X.scenecontroller_stopPresenting(this.__wbg_ptr)}stopPreviewTransition(){X.scenecontroller_stopPreviewTransition(this.__wbg_ptr)}stopVectorEditing(){X.scenecontroller_stopVectorEditing(this.__wbg_ptr)}strokeShape(e){let i=X.scenecontroller_strokeShape(this.__wbg_ptr,G(e));return Kt(i)}switchScene(e){X.scenecontroller_switchScene(this.__wbg_ptr,G(e))}transformBoundingBoxByAlignObject(e,i,n,r){let s=X.scenecontroller_transformBoundingBoxByAlignObject(this.__wbg_ptr,G(e),G(i),G(n),G(r));return Kt(s)}transformVectorSelection(e,i,n,r){return X.scenecontroller_transformVectorSelection(this.__wbg_ptr,G(e),G(i),n,r)!==0}triggerEventForObjectIds(e){let i=yR(e,X.__wbindgen_export),n=Ai;X.scenecontroller_triggerEventForObjectIds(this.__wbg_ptr,i,n)}updateByOp(e){X.scenecontroller_updateByOp(this.__wbg_ptr,G(e))}updateCached(){X.scenecontroller_updateCached(this.__wbg_ptr)}updateCamera(e){X.scenecontroller_updateCamera(this.__wbg_ptr,G(e))}updateComponents(e){X.scenecontroller_updateComponents(this.__wbg_ptr,G(e))}updatePublish(e){X.scenecontroller_updatePublish(this.__wbg_ptr,G(e))}updateSceneOp(e){X.scenecontroller_updateSceneOp(this.__wbg_ptr,G(e))}updateUiShapes(e){X.scenecontroller_updateUiShapes(this.__wbg_ptr,G(e))}vectorAllowMultiSelect(e){X.scenecontroller_vectorAllowMultiSelect(this.__wbg_ptr,e)}vectorBoxSelect(e,i){X.scenecontroller_vectorBoxSelect(this.__wbg_ptr,G(e),G(i))}vectorClearSnapping(){X.scenecontroller_vectorClearSnapping(this.__wbg_ptr)}vectorDeleteSelection(e){X.scenecontroller_vectorDeleteSelection(this.__wbg_ptr,e)}vectorResize(e,i){let n=X.scenecontroller_vectorResize(this.__wbg_ptr,G(e),G(i));return Kt(n)}vectorResizeWithCornerRadii(e,i,n){let r=X.scenecontroller_vectorResizeWithCornerRadii(this.__wbg_ptr,G(e),G(i),n);return Kt(r)}vectorSetIsAltPressed(e){X.scenecontroller_vectorSetIsAltPressed(this.__wbg_ptr,e)}vectorSetIsSnapping(e){X.scenecontroller_vectorSetIsSnapping(this.__wbg_ptr,e)}vectorSetIsSnappingControlAngles(e){X.scenecontroller_vectorSetIsSnappingControlAngles(this.__wbg_ptr,e)}vectorStopContinueSubpath(){X.scenecontroller_vectorStopContinueSubpath(this.__wbg_ptr)}videoFillSources(e){let i=X.scenecontroller_videoFillSources(this.__wbg_ptr,G(e));return Kt(i)}worldToScreen(e){let i=X.scenecontroller_worldToScreen(this.__wbg_ptr,G(e));return Kt(i)}set is_play_mode(e){X.__wbg_set_scenecontroller_is_play_mode(this.__wbg_ptr,e)}set needs_video_update(e){X.__wbg_set_scenecontroller_needs_video_update(this.__wbg_ptr,e)}set show_pixel_grid(e){X.__wbg_set_scenecontroller_show_pixel_grid(this.__wbg_ptr,e)}};Symbol.dispose&&(yf.prototype[Symbol.dispose]=yf.prototype.free);Lw=["clamp-to-edge","repeat","mirror-repeat"],hR=["auto"],cR=["zero","one","src","one-minus-src","src-alpha","one-minus-src-alpha","dst","one-minus-dst","dst-alpha","one-minus-dst-alpha","src-alpha-saturated","constant","one-minus-constant","src1","one-minus-src1","src1-alpha","one-minus-src1-alpha"],zq=["add","subtract","reverse-subtract","min","max"],Fq=["uniform","storage","read-only-storage"],Nq=["opaque","premultiplied"],kq=["standard","extended"],Bw=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],Vq=["none","front","back"],jq=["unknown","destroyed"],Gq=["validation","out-of-memory","internal"],dR=["nearest","linear"],Hq=["ccw","cw"],Uw=["uint16","uint32"],zw=["load","clear"],Wq=["nearest","linear"],qq=["low-power","high-performance"],Xq=["point-list","line-list","line-strip","triangle-list","triangle-strip"],$q=["occlusion","timestamp"],Yq=["filtering","non-filtering","comparison"],Fw=["keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],Zq=["write-only","read-only","read-write"],Nw=["store","discard"],kw=["all","stencil-only","depth-only"],Kq=["1d","2d","3d"],jh=["r8unorm","r8snorm","r8uint","r8sint","r16unorm","r16snorm","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32uint","r32sint","r32float","rg16unorm","rg16snorm","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb9e5ufloat","rgb10a2uint","rgb10a2unorm","rg11b10ufloat","rg32uint","rg32sint","rg32float","rgba16unorm","rgba16snorm","rgba16uint","rgba16sint","rgba16float","rgba32uint","rgba32sint","rgba32float","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb","etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm","astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"],Qq=["float","unfilterable-float","depth","sint","uint"],Vw=["1d","2d","2d-array","cube","cube-array","3d"],Jq=["uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],tX=["vertex","instance"],eX=["same-origin","no-cors","cors","navigate"],uR=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>X.__wbg_devicelostpromise_free(t,1)),pR=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>X.__wbg_engine_free(t,1)),fR=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>X.__wbg_headlessengine_free(t,1)),mR=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>X.__wbg_pixelreadpromise_free(t,1)),iX=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>X.__wbg_scenecontroller_free(t,1));gR=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>X.__wbindgen_export5(t.a,t.b));Gh=null;of=null;lf=null;hf=null;cf=null;df=null;uf=null;pf=null;ff=null;Ks=new Array(1024).fill(void 0);Ks.push(void 0,null,!0,!1);gf=Ks.length;W0=1024;q0=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});q0.decode();gX=2146435072,jw=0;vf=new TextEncoder;"encodeInto"in vf||(vf.encodeInto=function(t,e){let i=vf.encode(t);return e.set(i),{read:t.length,written:i.length}});Ai=0});var SX=Object.create,p_=Object.defineProperty,MX=Object.getOwnPropertyDescriptor,EX=Object.getOwnPropertyNames,AX=Object.getPrototypeOf,TX=Object.prototype.hasOwnProperty,z=(t,e)=>()=>(t&&(e=t(t=0)),e),Ep=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),d0=(t,e)=>{for(var i in e)p_(t,i,{get:e[i],enumerable:!0})},Ap=(t,e,i)=>(i=t!=null?SX(AX(t)):{},((n,r,s,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of EX(r))!TX.call(n,o)&&o!==void 0&&p_(n,o,{get:()=>r[o],enumerable:!(a=MX(r,o))||a.enumerable});return n})(!e&&t&&t.__esModule?i:p_(i,"default",{value:t,enumerable:!0}),t)),to=(t,e,i)=>(((n,r,s)=>{r in n?p_(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s})(t,typeof e!="symbol"?e+"":e,i),i);function X0(t,e){return new BF[t](e)}function og(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function CX(){let t=og("canvas");return t.style.display="block",t}function f_(...t){let e="THREE."+t.shift();Kc?Kc("log",e,...t):console.log(e,...t)}function Kz(t){let e=t[0];if(typeof e=="string"&&e.startsWith("TSL:")){let i=t[1];i&&i.isStackTrace?t[0]+=" "+i.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function ce(...t){let e="THREE."+(t=Kz(t)).shift();if(Kc)Kc("warn",e,...t);else{let i=t[0];i&&i.isStackTrace?console.warn(i.getError(e)):console.warn(e,...t)}}function fe(...t){let e="THREE."+(t=Kz(t)).shift();if(Kc)Kc("error",e,...t);else{let i=t[0];i&&i.isStackTrace?console.error(i.getError(e)):console.error(e,...t)}}function Su(...t){let e=t.join(" ");e in $E||($E[e]=!0,ce(...t))}function Ts(){let t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(cr[255&t]+cr[t>>8&255]+cr[t>>16&255]+cr[t>>24&255]+"-"+cr[255&e]+cr[e>>8&255]+"-"+cr[e>>16&15|64]+cr[e>>24&255]+"-"+cr[63&i|128]+cr[i>>8&255]+"-"+cr[i>>16&255]+cr[i>>24&255]+cr[255&n]+cr[n>>8&255]+cr[n>>16&255]+cr[n>>24&255]).toLowerCase()}function ge(t,e,i){return Math.max(e,Math.min(i,t))}function DE(t,e){return(t%e+e)%e}function PX(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)}function DX(t,e,i){return t!==e?(i-t)/(e-t):0}function Cm(t,e,i){return(1-i)*t+i*e}function RX(t,e,i,n){return Cm(t,e,1-Math.exp(-i*n))}function OX(t,e=1){return e-Math.abs(DE(t,2*e)-e)}function IX(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}function LX(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)}function BX(t,e){return t+Math.floor(Math.random()*(e-t+1))}function UX(t,e){return t+Math.random()*(e-t)}function zX(t){return t*(.5-Math.random())}function FX(t){t!==void 0&&(YE=t);let e=YE+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function NX(t){return t*Mu}function kX(t){return t*Eu}function VX(t){return!(t&t-1)&&t!==0}function jX(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function GX(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function HX(t,e,i,n,r){let s=Math.cos,a=Math.sin,o=s(i/2),l=a(i/2),c=s((e+n)/2),h=a((e+n)/2),d=s((e-n)/2),u=a((e-n)/2),p=s((n-e)/2),f=a((n-e)/2);switch(r){case"XYX":t.set(o*h,l*d,l*u,o*c);break;case"YZY":t.set(l*u,o*h,l*d,o*c);break;case"ZXZ":t.set(l*d,l*u,o*h,o*c);break;case"XZX":t.set(o*h,l*f,l*p,o*c);break;case"YXY":t.set(l*p,o*h,l*f,o*c);break;case"ZYZ":t.set(l*f,l*p,o*h,o*c);break;default:ce("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Qs(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function fi(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function So(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Cd(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}function Hw(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?zF.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(ce("Texture: Unable to serialize Texture."),{})}function Ww(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function qw(t,e,i,n,r){for(let s=0,a=t.length-3;s<=a;s+=3){Gl.fromArray(t,s);let o=r.x*Math.abs(Gl.x)+r.y*Math.abs(Gl.y)+r.z*Math.abs(Gl.z),l=e.dot(Gl),c=i.dot(Gl),h=n.dot(Gl);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}function $0(t,e,i,n,r,s,a,o,l,c){t.getVertexPosition(o,Om),t.getVertexPosition(l,Im),t.getVertexPosition(c,Lm);let h=function(d,u,p,f,g,m,v,y){let _;if(_=u.side===Wn?f.intersectTriangle(v,m,g,!0,y):f.intersectTriangle(g,m,v,u.side===Hs,y),_===null)return null;Bm.copy(y),Bm.applyMatrix4(d.matrixWorld);let b=p.ray.origin.distanceTo(Bm);return b<p.near||b>p.far?null:{distance:b,point:Bm.clone(),object:d}}(t,e,i,n,Om,Im,Lm,JE);if(h){let d=new T;vn.getBarycoord(JE,Om,Im,Lm,d),r&&(h.uv=vn.getInterpolatedAttribute(r,o,l,c,d,new et)),s&&(h.uv1=vn.getInterpolatedAttribute(s,o,l,c,d,new et)),a&&(h.normal=vn.getInterpolatedAttribute(a,o,l,c,d,new T),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let u={a:o,b:l,c,normal:new T,materialIndex:0};vn.getNormal(Om,Im,Lm,u.normal),h.face=u,h.barycoord=d}return h}function Y0(t,e,i,n,r,s,a){let o=t.geometry.attributes.position;if(pg.fromBufferAttribute(o,r),fg.fromBufferAttribute(o,s),i.distanceSqToSegment(pg,fg,R1,eA)>n)return;R1.applyMatrix4(t.matrixWorld);let l=e.ray.origin.distanceTo(R1);return l<e.near||l>e.far?void 0:{distance:l,point:eA.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}function Xw(){let t=0,e=0,i=0,n=0;function r(s,a,o,l){t=s,e=o,i=-3*s+3*a-2*o-l,n=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){r(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,h,d){let u=(a-s)/c-(o-s)/(c+h)+(o-a)/h,p=(o-a)/h-(l-a)/(h+d)+(l-o)/d;u*=h,p*=h,r(a,o,u,p)},calc:function(s){let a=s*s;return t+e*s+i*a+n*(a*s)}}}function SR(t,e,i,n,r){let s=.5*(n-e),a=.5*(r-i),o=t*t;return(2*i-2*n+s+a)*(t*o)+(-3*i+3*n-2*s-a)*o+s*t+i}function _f(t,e,i,n){return function(r,s){let a=1-r;return a*a*s}(t,e)+function(r,s){return 2*(1-r)*r*s}(t,i)+function(r,s){return r*r*s}(t,n)}function bf(t,e,i,n,r){return function(s,a){let o=1-s;return o*o*o*a}(t,e)+function(s,a){let o=1-s;return 3*o*o*s*a}(t,i)+function(s,a){return 3*(1-s)*s*s*a}(t,n)+function(s,a){return s*s*s*a}(t,r)}function MR(t,e,i,n,r){let s;if(r===function(a,o,l,c){let h=0;for(let d=o,u=l-c;d<l;d+=c)h+=(a[u]-a[d])*(a[d+1]+a[u+1]),u=d;return h}(t,e,i,n)>0)for(let a=e;a<i;a+=n)s=ER(a/n|0,t[a],t[a+1],s);else for(let a=i-n;a>=e;a-=n)s=ER(a/n|0,t[a],t[a+1],s);return s&&pp(s,s.next)&&(Gg(s),s=s.next),s}function Zc(t,e){if(!t)return t;e||(e=t);let i,n=t;do if(i=!1,n.steiner||!pp(n,n.next)&&$i(n.prev,n,n.next)!==0)n=n.next;else{if(Gg(n),n=e=n.prev,n===n.next)break;i=!0}while(i||n!==e);return e}function Vg(t,e,i,n,r,s,a){if(!t)return;!a&&s&&function(l,c,h,d){let u=l;do u.z===0&&(u.z=RE(u.x,u.y,c,h,d)),u.prevZ=u.prev,u.nextZ=u.next,u=u.next;while(u!==l);u.prevZ.nextZ=null,u.prevZ=null,function(p){let f,g=1;do{let m,v=p;p=null;let y=null;for(f=0;v;){f++;let _=v,b=0;for(let w=0;w<g&&(b++,_=_.nextZ,_);w++);let x=g;for(;b>0||x>0&&_;)b!==0&&(x===0||!_||v.z<=_.z)?(m=v,v=v.nextZ,b--):(m=_,_=_.nextZ,x--),y?y.nextZ=m:p=m,m.prevZ=y,y=m;v=_}y.nextZ=null,g*=2}while(f>1)}(u)}(t,n,r,s);let o=t;for(;t.prev!==t.next;){let l=t.prev,c=t.next;if(s?qX(t,n,r,s):WX(t))e.push(l.i,t.i,c.i),Gg(t),t=c.next,o=c.next;else if((t=c)===o){a?a===1?Vg(t=XX(Zc(t),e),e,i,n,r,s,2):a===2&&$X(t,e,i,n,r,s):Vg(Zc(t),e,i,n,r,s,1);break}}}function WX(t){let e=t.prev,i=t,n=t.next;if($i(e,i,n)>=0)return!1;let r=e.x,s=i.x,a=n.x,o=e.y,l=i.y,c=n.y,h=Math.min(r,s,a),d=Math.min(o,l,c),u=Math.max(r,s,a),p=Math.max(o,l,c),f=n.next;for(;f!==e;){if(f.x>=h&&f.x<=u&&f.y>=d&&f.y<=p&&Pm(r,o,s,l,a,c,f.x,f.y)&&$i(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function qX(t,e,i,n){let r=t.prev,s=t,a=t.next;if($i(r,s,a)>=0)return!1;let o=r.x,l=s.x,c=a.x,h=r.y,d=s.y,u=a.y,p=Math.min(o,l,c),f=Math.min(h,d,u),g=Math.max(o,l,c),m=Math.max(h,d,u),v=RE(p,f,e,i,n),y=RE(g,m,e,i,n),_=t.prevZ,b=t.nextZ;for(;_&&_.z>=v&&b&&b.z<=y;){if(_.x>=p&&_.x<=g&&_.y>=f&&_.y<=m&&_!==r&&_!==a&&Pm(o,h,l,d,c,u,_.x,_.y)&&$i(_.prev,_,_.next)>=0||(_=_.prevZ,b.x>=p&&b.x<=g&&b.y>=f&&b.y<=m&&b!==r&&b!==a&&Pm(o,h,l,d,c,u,b.x,b.y)&&$i(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;_&&_.z>=v;){if(_.x>=p&&_.x<=g&&_.y>=f&&_.y<=m&&_!==r&&_!==a&&Pm(o,h,l,d,c,u,_.x,_.y)&&$i(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=g&&b.y>=f&&b.y<=m&&b!==r&&b!==a&&Pm(o,h,l,d,c,u,b.x,b.y)&&$i(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function XX(t,e){let i=t;do{let n=i.prev,r=i.next.next;!pp(n,r)&&Jz(n,i,i.next,r)&&jg(n,r)&&jg(r,n)&&(e.push(n.i,i.i,r.i),Gg(i),Gg(i.next),i=t=r),i=i.next}while(i!==t);return Zc(i)}function $X(t,e,i,n,r,s){let a=t;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&JX(a,o)){let l=tF(a,o);return a=Zc(a,a.next),l=Zc(l,l.next),Vg(a,e,i,n,r,s,0),void Vg(l,e,i,n,r,s,0)}o=o.next}a=a.next}while(a!==t)}function YX(t,e){let i=t.x-e.x;return i===0&&(i=t.y-e.y,i===0)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function ZX(t,e){let i=function(r,s){let a,o=s,l=r.x,c=r.y,h=-1/0;if(pp(r,o))return o;do{if(pp(r,o.next))return o.next;if(c<=o.y&&c>=o.next.y&&o.next.y!==o.y){let g=o.x+(c-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(g<=l&&g>h&&(h=g,a=o.x<o.next.x?o:o.next,g===l))return a}o=o.next}while(o!==s);if(!a)return null;let d=a,u=a.x,p=a.y,f=1/0;o=a;do{if(l>=o.x&&o.x>=u&&l!==o.x&&Qz(c<p?l:h,c,u,p,c<p?h:l,c,o.x,o.y)){let g=Math.abs(c-o.y)/(l-o.x);jg(o,r)&&(g<f||g===f&&(o.x>a.x||o.x===a.x&&KX(a,o)))&&(a=o,f=g)}o=o.next}while(o!==d);return a}(t,e);if(!i)return e;let n=tF(i,t);return Zc(n,n.next),Zc(i,i.next)}function KX(t,e){return $i(t.prev,t,e.prev)<0&&$i(e.next,t,t.next)<0}function RE(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function QX(t){let e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}function Qz(t,e,i,n,r,s,a,o){return(r-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(n-o)>=(i-a)*(e-o)&&(i-a)*(s-o)>=(r-a)*(n-o)}function Pm(t,e,i,n,r,s,a,o){return!(t===a&&e===o)&&Qz(t,e,i,n,r,s,a,o)}function JX(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(i,n){let r=i;do{if(r.i!==i.i&&r.next.i!==i.i&&r.i!==n.i&&r.next.i!==n.i&&Jz(r,r.next,i,n))return!0;r=r.next}while(r!==i);return!1}(t,e)&&(jg(t,e)&&jg(e,t)&&function(i,n){let r=i,s=!1,a=(i.x+n.x)/2,o=(i.y+n.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&a<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(s=!s),r=r.next;while(r!==i);return s}(t,e)&&($i(t.prev,t,e.prev)||$i(t,e.prev,e))||pp(t,e)&&$i(t.prev,t,t.next)>0&&$i(e.prev,e,e.next)>0)}function $i(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function pp(t,e){return t.x===e.x&&t.y===e.y}function Jz(t,e,i,n){let r=K0($i(t,e,i)),s=K0($i(t,e,n)),a=K0($i(i,n,t)),o=K0($i(i,n,e));return!!(r!==s&&a!==o||r===0&&Z0(t,i,e)||s===0&&Z0(t,n,e)||a===0&&Z0(i,t,n)||o===0&&Z0(i,e,n))}function Z0(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function K0(t){return t>0?1:t<0?-1:0}function jg(t,e){return $i(t.prev,t,t.next)<0?$i(t,e,t.next)>=0&&$i(t,t.prev,e)>=0:$i(t,e,t.prev)<0||$i(t,t.next,e)<0}function tF(t,e){let i=OE(t.i,t.x,t.y),n=OE(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function ER(t,e,i,n){let r=OE(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Gg(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function OE(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function AR(t){let e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function TR(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}function fp(t){let e={};for(let i in t){e[i]={};for(let n in t[i]){let r=t[i][n];if(CR(r))r.isRenderTargetTexture?(ce("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[i][n]=null):e[i][n]=r.clone();else if(Array.isArray(r))if(CR(r[0])){let s=[];for(let a=0,o=r.length;a<o;a++)s[a]=r[a].clone();e[i][n]=s}else e[i][n]=r.slice();else e[i][n]=r}}return e}function kr(t){let e={};for(let i=0;i<t.length;i++){let n=fp(t[i]);for(let r in n)e[r]=n[r]}return e}function CR(t){return t&&(t.isColor||t.isMatrix3||t.isMatrix4||t.isVector2||t.isVector3||t.isVector4||t.isTexture||t.isQuaternion)}function eF(t){let e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Ve.workingColorSpace}function Q0(t,e){return t&&t.constructor!==e?typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t):t}function t$(t){let e=t.length,i=new Array(e);for(let n=0;n!==e;++n)i[n]=n;return i.sort(function(n,r){return t[n]-t[r]}),i}function PR(t,e,i){let n=t.length,r=new t.constructor(n);for(let s=0,a=0;a!==n;++s){let o=i[s]*e;for(let l=0;l!==e;++l)r[a++]=t[o+l]}return r}function e$(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=function(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return hA;case"vector":case"vector2":case"vector3":case"vector4":return WF;case"color":return HF;case"quaternion":return cA;case"bool":case"boolean":return Tu;case"string":return Cu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}(t.type);if(t.times===void 0){let i=[],n=[];(function(r,s,a,o){let l=1,c=r[0];for(;c!==void 0&&c[o]===void 0;)c=r[l++];if(c===void 0)return;let h=c[o];if(h!==void 0)if(Array.isArray(h))do h=c[o],h!==void 0&&(s.push(c.time),a.push(...h)),c=r[l++];while(c!==void 0);else if(h.toArray!==void 0)do h=c[o],h!==void 0&&(s.push(c.time),h.toArray(a,a.length)),c=r[l++];while(c!==void 0);else do h=c[o],h!==void 0&&(s.push(c.time),a.push(h)),c=r[l++];while(c!==void 0)})(t.keys,i,n,"value"),t.times=i,t.values=n}return e.parse!==void 0?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}function DR(t){try{let e=t.slice(t.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}function i$(){this._document.hidden===!1&&this.reset()}function RR(t,e){return t.distance-e.distance}function IE(t,e,i,n){let r=!0;if(t.layers.test(e.layers)&&t.raycast(e,i)===!1&&(r=!1),r===!0&&n===!0){let s=t.children;for(let a=0,o=s.length;a<o;a++)IE(s[a],e,i,!0)}}function cn(t,e,i,n,r,s,a){Fm.set(r,s,a).unproject(n);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Fm.x,Fm.y,Fm.z)}}function OR(t,e,i,n){let r=function(s){switch(s){case gn:case KC:return{byteLength:1,components:1};case gp:case QC:case Xn:return{byteLength:2,components:1};case fx:case mx:return{byteLength:2,components:4};case Ws:case px:case $e:return{byteLength:4,components:1};case JC:case t3:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${s}.`)}(n);switch(i){case e3:return t*e;case Hc:case gx:return t*e/r.components*r.byteLength;case co:case vx:return t*e*2/r.components*r.byteLength;case i3:return t*e*3/r.components*r.byteLength;case Yi:case p0:return t*e*4/r.components*r.byteLength;case lg:case hg:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case cg:case dg:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case v_:case __:return Math.max(t,16)*Math.max(e,8)/4;case g_:case y_:return Math.max(t,8)*Math.max(e,8)/2;case b_:case x_:case S_:case M_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case w_:case Hg:case E_:case A_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case T_:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case C_:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case P_:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case D_:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case R_:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case O_:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case I_:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case L_:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case B_:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case U_:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case z_:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case F_:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case N_:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case k_:case V_:case j_:return Math.ceil(t/4)*Math.ceil(e/4)*16;case G_:case H_:return Math.ceil(t/4)*Math.ceil(e/4)*8;case Wg:case W_:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${i} format.`)}var cl,ms,iF,LE,nF,m_,Zu,rF,ku,Hs,Wn,Gn,Jn,fh,BE,UE,zE,sF,Yl,aF,oF,lF,hF,cF,dF,uF,pF,v1,y1,fF,mF,gF,vF,yF,_F,bF,xF,wF,_1,b1,x1,Ic,w1,S1,M1,E1,FE,SF,MF,oo,NE,kE,VE,jE,GE,HE,WE,Gc,mp,A1,T1,u0,Ql,Ri,C1,De,EF,Dm,de,P1,eo,gn,KC,QC,gp,px,Ws,$e,Xn,fx,mx,vp,JC,t3,e3,i3,Yi,el,Jl,Hc,gx,co,vx,p0,lg,hg,cg,dg,g_,v_,y_,__,b_,x_,w_,S_,M_,Hg,E_,A_,T_,C_,P_,D_,R_,O_,I_,L_,B_,U_,z_,F_,N_,k_,V_,j_,G_,H_,Wg,W_,qE,q_,X_,xf,J0,tv,Hh,Wh,wf,Wa,AF,XE,TF,Zo,Ue,Ku,ug,pi,qh,CF,PF,DF,yx,RF,OF,_x,IF,ev,LF,$_,oa,Pd,BF,$E,Kc,UF,kn,cr,YE,Mu,Eu,Pt,$w,et,qt,Yw,T,iv,Zw,IR,ue,nv,Kw,Qw,Ve,Dd,zF,LR,rv,BR,sv,ki,Jw,ye,UR,Ne,n3,FF,tS,Et,Xh,Cs,zR,FR,Mo,Sf,es,eS,iS,ci,D1,NR,nS,$h,Ta,Mf,Rd,kR,VR,rS,sS,aS,oS,jR,Yh,av,xi,Tp,lS,Eo,Ef,Jt,hr,ZE,as,Ps,Ca,ov,Pa,Zh,Kh,hS,lv,hv,cv,dv,uv,pv,vn,hi,Da,Ds,Af,Qh,Jh,tc,Ao,To,Pl,Od,Tf,Cf,Gl,Ra,th,dn,Pf,GR,Ht,KE,mh,kt,HR,Id,fv,vr,WR,us,mv,ec,is,Ld,Un,jt,QE,xr,Rm,qR,ic,Oa,gv,Df,Co,vv,Rf,yv,il,qs,cS,Dl,Of,dS,Om,Im,Lm,_v,If,JE,Bm,gi,tA,Cn,uS,XR,qg,Vu,nc,pS,Lf,fS,$R,Bd,Ud,bx,bv,YR,ZR,jr,Rl,KR,Bf,Y_,Wo,pg,fg,mS,zd,Uf,R1,eA,Um,gS,vS,Au,NF,Z_,kF,va,VF,ya,mg,K_,xv,iA,Js,zm,QR,yS,_S,wv,Sv,Mv,JR,ks,gg,gs,nA,Ko,tO,O1,bS,rA,vg,Xg,eO,sA,aA,oA,uo,gh,Q_,lA,jF,nd,Xe,r3,s3,GF,Fd,iO,xS,nO,rO,ta,Tu,HF,hA,sO,cA,Cu,WF,I1,Nd,qF,aO,Ac,Ia,oO,yg,rc,lO,XF,$F,Pu,YF,Ev,wS,SS,Av,zf,Ff,ea,eh,Po,MS,ES,Qu,hO,ZF,kd,cO,KF,yp,dO,QF,L1,J_,a3,JF,uO,Tv,pO,Cv,fO,mO,gO,vO,yO,_O,bO,xO,_i,wO,SO,dA,Ct,AS,xx,uA,MO,TS,o3,CS,Nf,sc,ac,Pv,EO,AO,bs,PS,tN,eN,DS,kf,RS,iN,Fm,Wi,$g,Yg,nN,TO=z(()=>{cl="185",ms={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},iF=0,LE=1,nF=2,m_=0,Zu=1,rF=2,ku=3,Hs=0,Wn=1,Gn=2,Jn=0,fh=1,BE=2,UE=3,zE=4,sF=5,Yl=100,aF=101,oF=102,lF=103,hF=104,cF=200,dF=201,uF=202,pF=203,v1=204,y1=205,fF=206,mF=207,gF=208,vF=209,yF=210,_F=211,bF=212,xF=213,wF=214,_1=0,b1=1,x1=2,Ic=3,w1=4,S1=5,M1=6,E1=7,FE=0,SF=1,MF=2,oo=0,NE=1,kE=2,VE=3,jE=4,GE=5,HE=6,WE=7,Gc=301,mp=302,A1=303,T1=304,u0=306,Ql=1e3,Ri=1001,C1=1002,De=1003,EF=1004,Dm=1005,de=1006,P1=1007,eo=1008,gn=1009,KC=1010,QC=1011,gp=1012,px=1013,Ws=1014,$e=1015,Xn=1016,fx=1017,mx=1018,vp=1020,JC=35902,t3=35899,e3=1021,i3=1022,Yi=1023,el=1026,Jl=1027,Hc=1028,gx=1029,co=1030,vx=1031,p0=1033,lg=33776,hg=33777,cg=33778,dg=33779,g_=35840,v_=35841,y_=35842,__=35843,b_=36196,x_=37492,w_=37496,S_=37488,M_=37489,Hg=37490,E_=37491,A_=37808,T_=37809,C_=37810,P_=37811,D_=37812,R_=37813,O_=37814,I_=37815,L_=37816,B_=37817,U_=37818,z_=37819,F_=37820,N_=37821,k_=36492,V_=36494,j_=36495,G_=36283,H_=36284,Wg=36285,W_=36286,qE=2200,q_=2201,X_=2202,xf=2300,J0=2301,tv=2302,Hh=2400,Wh=2401,wf=2402,Wa=3200,AF=3201,XE=0,TF=1,Zo="",Ue="srgb",Ku="srgb-linear",ug="linear",pi="srgb",qh=7680,CF=512,PF=513,DF=514,yx=515,RF=516,OF=517,_x=518,IF=519,ev=35044,LF=35048,$_="300 es",oa=2e3,Pd=2001,BF={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array},$E={},Kc=null,UF={[_1]:b1,[x1]:M1,[w1]:E1,[Ic]:S1,[b1]:_1,[M1]:x1,[E1]:w1,[S1]:Ic},kn=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){let i=this._listeners;return i!==void 0&&i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){let i=this._listeners;if(i===void 0)return;let n=i[t];if(n!==void 0){let r=n.indexOf(e);r!==-1&&n.splice(r,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let i=e[t.type];if(i!==void 0){t.target=this;let n=i.slice(0);for(let r=0,s=n.length;r<s;r++)n[r].call(this,t);t.target=null}}},cr=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],YE=1234567,Mu=Math.PI/180,Eu=180/Math.PI,Pt={DEG2RAD:Mu,RAD2DEG:Eu,generateUUID:Ts,clamp:ge,euclideanModulo:DE,mapLinear:PX,inverseLerp:DX,lerp:Cm,damp:RX,pingpong:OX,smoothstep:IX,smootherstep:LX,randInt:BX,randFloat:UX,randFloatSpread:zX,seededRandom:FX,degToRad:NX,radToDeg:kX,isPowerOfTwo:VX,ceilPowerOfTwo:jX,floorPowerOfTwo:GX,setQuaternionFromProperEuler:HX,normalize:fi,denormalize:Qs},$w=class{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=ge(this.x,t.x,e.x),this.y=ge(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=ge(this.x,t,e),this.y=ge(this.y,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ge(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(ge(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*i-s*n+t.x,this.y=r*n+s*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},et=$w,$w.prototype.isVector2=!0,qt=class{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,r,s,a){let o=i[n+0],l=i[n+1],c=i[n+2],h=i[n+3],d=r[s+0],u=r[s+1],p=r[s+2],f=r[s+3];if(h!==f||o!==d||l!==u||c!==p){let g=o*d+l*u+c*p+h*f;g<0&&(d=-d,u=-u,p=-p,f=-f,g=-g);let m=1-a;if(g<.9995){let v=Math.acos(g),y=Math.sin(v);m=Math.sin(m*v)/y,o=o*m+d*(a=Math.sin(a*v)/y),l=l*m+u*a,c=c*m+p*a,h=h*m+f*a}else{o=o*m+d*a,l=l*m+u*a,c=c*m+p*a,h=h*m+f*a;let v=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=v,l*=v,c*=v,h*=v}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,n,r,s){let a=i[n],o=i[n+1],l=i[n+2],c=i[n+3],h=r[s],d=r[s+1],u=r[s+2],p=r[s+3];return t[e]=a*p+c*h+o*u-l*d,t[e+1]=o*p+c*d+l*h-a*u,t[e+2]=l*p+c*u+a*d-o*h,t[e+3]=c*p-a*h-o*d-l*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let i=t._x,n=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(i/2),c=a(n/2),h=a(r/2),d=o(i/2),u=o(n/2),p=o(r/2);switch(s){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:ce("Quaternion: .setFromEuler() encountered an unknown order: "+s)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],d=i+a+h;if(d>0){let u=.5/Math.sqrt(d+1);this._w=.25/u,this._x=(c-o)*u,this._y=(r-l)*u,this._z=(s-n)*u}else if(i>a&&i>h){let u=2*Math.sqrt(1+i-a-h);this._w=(c-o)/u,this._x=.25*u,this._y=(n+s)/u,this._z=(r+l)/u}else if(a>h){let u=2*Math.sqrt(1+a-i-h);this._w=(r-l)/u,this._x=(n+s)/u,this._y=.25*u,this._z=(o+c)/u}else{let u=2*Math.sqrt(1+h-i-a);this._w=(s-n)/u,this._x=(r+l)/u,this._y=(o+c)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ge(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);if(i===0)return this;let n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let i=t._x,n=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=i*c+s*a+n*l-r*o,this._y=n*c+s*o+r*a-i*l,this._z=r*c+s*l+i*o-n*a,this._w=s*c-i*a-n*o-r*l,this._onChangeCallback(),this}slerp(t,e){let i=t._x,n=t._y,r=t._z,s=t._w,a=this.dot(t);a<0&&(i=-i,n=-n,r=-r,s=-s,a=-a);let o=1-e;if(a<.9995){let l=Math.acos(a),c=Math.sin(l);o=Math.sin(o*l)/c,e=Math.sin(e*l)/c,this._x=this._x*o+i*e,this._y=this._y*o+n*e,this._z=this._z*o+r*e,this._w=this._w*o+s*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+n*e,this._z=this._z*o+r*e,this._w=this._w*o+s*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(n*Math.sin(t),n*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Yw=class{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Zw.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Zw.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,n=this.z,r=t.elements,s=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*s,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*s,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*s,this}applyQuaternion(t){let e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=2*(s*n-a*i),c=2*(a*e-r*n),h=2*(r*i-s*e);return this.x=e+o*l+s*h-a*c,this.y=i+o*c+a*l-r*h,this.z=n+o*h+r*c-s*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=ge(this.x,t.x,e.x),this.y=ge(this.y,t.y,e.y),this.z=ge(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=ge(this.x,t,e),this.y=ge(this.y,t,e),this.z=ge(this.z,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ge(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,n=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=n*o-r*a,this.y=r*s-i*o,this.z=i*a-n*s,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return iv.copy(this).projectOnVector(t),this.sub(iv)}reflect(t){return this.sub(iv.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(ge(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){let n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},T=Yw,Yw.prototype.isVector3=!0,iv=new T,Zw=new qt,ue=IR=class{constructor(t,e,i,n,r,s,a,o,l){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,i,n,r,s,a,o,l)}set(t,e,i,n,r,s,a,o,l){let c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=r,c[5]=o,c[6]=i,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[3],o=i[6],l=i[1],c=i[4],h=i[7],d=i[2],u=i[5],p=i[8],f=n[0],g=n[3],m=n[6],v=n[1],y=n[4],_=n[7],b=n[2],x=n[5],w=n[8];return r[0]=s*f+a*v+o*b,r[3]=s*g+a*y+o*x,r[6]=s*m+a*_+o*w,r[1]=l*f+c*v+h*b,r[4]=l*g+c*y+h*x,r[7]=l*m+c*_+h*w,r[2]=d*f+u*v+p*b,r[5]=d*g+u*y+p*x,r[8]=d*m+u*_+p*w,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*s*c-e*a*l-i*r*c+i*a*o+n*r*l-n*s*o}invert(){let t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,d=a*o-c*r,u=l*r-s*o,p=e*h+i*d+n*u;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return t[0]=h*f,t[1]=(n*l-c*i)*f,t[2]=(a*i-n*s)*f,t[3]=d*f,t[4]=(c*e-n*o)*f,t[5]=(n*r-a*e)*f,t[6]=u*f,t[7]=(i*o-l*e)*f,t[8]=(s*e-i*r)*f,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,s,a){let o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*s+l*a)+s+t,-n*l,n*o,-n*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){return Su("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(nv.makeScale(t,e)),this}rotate(t){return Su("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(nv.makeRotation(-t)),this}translate(t,e){return Su("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(nv.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let n=0;n<9;n++)if(e[n]!==i[n])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}},IR.prototype.isMatrix3=!0,nv=new ue,Kw=new ue().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Qw=new ue().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),Ve=function(){let t={enabled:!1,workingColorSpace:Ku,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===pi&&(r.r=So(r.r),r.g=So(r.g),r.b=So(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===pi&&(r.r=Cd(r.r),r.g=Cd(r.g),r.b=Cd(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Zo?ug:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Su("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Su("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],n=[.3127,.329];return t.define({[Ku]:{primaries:e,whitePoint:n,transfer:ug,toXYZ:Kw,fromXYZ:Qw,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:Ue},outputColorSpaceConfig:{drawingBufferColorSpace:Ue}},[Ue]:{primaries:e,whitePoint:n,transfer:pi,toXYZ:Kw,fromXYZ:Qw,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:Ue}}}),t}(),zF=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{Dd===void 0&&(Dd=og("canvas")),Dd.width=t.width,Dd.height=t.height;let n=Dd.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),i=Dd}return i.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=og("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let n=i.getImageData(0,0,t.width,t.height),r=n.data;for(let s=0;s<r.length;s++)r[s]=255*So(r[s]/255);return i.putImageData(n,0,0),e}if(t.data){let e=t.data.slice(0);for(let i=0;i<e.length;i++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[i]=Math.floor(255*So(e[i]/255)):e[i]=So(e[i]);return{data:e,width:t.width,height:t.height}}return ce("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},LR=0,rv=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:LR++}),this.uuid=Ts(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(n!==null){let r;if(Array.isArray(n)){r=[];for(let s=0,a=n.length;s<a;s++)n[s].isDataTexture?r.push(Hw(n[s].image)):r.push(Hw(n[s]))}else r=Hw(n);i.url=r}return e||(t.images[this.uuid]=i),i}},BR=0,sv=new T,(ki=class extends kn{constructor(t=ki.DEFAULT_IMAGE,e=ki.DEFAULT_MAPPING,i=Ri,n=Ri,r=de,s=eo,a=Yi,o=gn,l=ki.DEFAULT_ANISOTROPY,c=Zo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:BR++}),this.uuid=Ts(),this.name="",this.source=new rv(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new et(0,0),this.repeat=new et(1,1),this.center=new et(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ue,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(sv).x}get height(){return this.source.getSize(sv).y}get depth(){return this.source.getSize(sv).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let i=t[e];if(i===void 0){ce(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}let n=this[e];n!==void 0?n&&i&&n.isVector2&&i.isVector2||n&&i&&n.isVector3&&i.isVector3||n&&i&&n.isMatrix3&&i.isMatrix3?n.copy(i):this[e]=i:ce(`Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==300)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Ql:t.x=t.x-Math.floor(t.x);break;case Ri:t.x=t.x<0?0:1;break;case C1:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case Ql:t.y=t.y-Math.floor(t.y);break;case Ri:t.y=t.y<0?0:1;break;case C1:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}).DEFAULT_IMAGE=null,ki.DEFAULT_MAPPING=300,ki.DEFAULT_ANISOTROPY=1,Jw=class{constructor(t=0,e=0,i=0,n=1){this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,i=this.y,n=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12]*r,this.y=s[1]*e+s[5]*i+s[9]*n+s[13]*r,this.z=s[2]*e+s[6]*i+s[10]*n+s[14]*r,this.w=s[3]*e+s[7]*i+s[11]*n+s[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r,s=t.elements,a=s[0],o=s[4],l=s[8],c=s[1],h=s[5],d=s[9],u=s[2],p=s[6],f=s[10];if(Math.abs(o-c)<.01&&Math.abs(l-u)<.01&&Math.abs(d-p)<.01){if(Math.abs(o+c)<.1&&Math.abs(l+u)<.1&&Math.abs(d+p)<.1&&Math.abs(a+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let m=(a+1)/2,v=(h+1)/2,y=(f+1)/2,_=(o+c)/4,b=(l+u)/4,x=(d+p)/4;return m>v&&m>y?m<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(m),n=_/i,r=b/i):v>y?v<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(v),i=_/n,r=x/n):y<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(y),i=b/r,n=x/r),this.set(i,n,r,e),this}let g=Math.sqrt((p-d)*(p-d)+(l-u)*(l-u)+(c-o)*(c-o));return Math.abs(g)<.001&&(g=1),this.x=(p-d)/g,this.y=(l-u)/g,this.z=(c-o)/g,this.w=Math.acos((a+h+f-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=ge(this.x,t.x,e.x),this.y=ge(this.y,t.y,e.y),this.z=ge(this.z,t.z,e.z),this.w=ge(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=ge(this.x,t,e),this.y=ge(this.y,t,e),this.z=ge(this.z,t,e),this.w=ge(this.w,t,e),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(ge(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},ye=Jw,Jw.prototype.isVector4=!0,UR=class extends kn{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:de,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new ye(0,0,t,e),this.scissorTest=!1,this.viewport=new ye(0,0,t,e),this.textures=[];let n={width:t,height:e,depth:i.depth},r=new ki(n),s=i.count;for(let a=0;a<s;a++)this.textures[a]=r.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview,this.useArrayDepthTexture=i.useArrayDepthTexture}_setTextureOptions(t={}){let e={minFilter:de,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(e.mapping=t.mapping),t.wrapS!==void 0&&(e.wrapS=t.wrapS),t.wrapT!==void 0&&(e.wrapT=t.wrapT),t.wrapR!==void 0&&(e.wrapR=t.wrapR),t.magFilter!==void 0&&(e.magFilter=t.magFilter),t.minFilter!==void 0&&(e.minFilter=t.minFilter),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),t.internalFormat!==void 0&&(e.internalFormat=t.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),t!==null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let n=0,r=this.textures.length;n<r;n++)this.textures[n].image.width=t,this.textures[n].image.height=e,this.textures[n].image.depth=i,this.textures[n].isData3DTexture!==!0&&(this.textures[n].isArrayTexture=this.textures[n].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;let n=Object.assign({},t.textures[e].image);this.textures[e].source=new rv(n)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this.multiview=t.multiview,this.useArrayDepthTexture=t.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},Ne=class extends UR{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}},n3=class extends ki{constructor(t=null,e=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=De,this.minFilter=De,this.wrapR=Ri,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},FF=class extends ki{constructor(t=null,e=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=De,this.minFilter=De,this.wrapR=Ri,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Et=tS=class{constructor(t,e,i,n,r,s,a,o,l,c,h,d,u,p,f,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,i,n,r,s,a,o,l,c,h,d,u,p,f,g)}set(t,e,i,n,r,s,a,o,l,c,h,d,u,p,f,g){let m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=n,m[1]=r,m[5]=s,m[9]=a,m[13]=o,m[2]=l,m[6]=c,m[10]=h,m[14]=d,m[3]=u,m[7]=p,m[11]=f,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new tS().fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return this.determinantAffine()===0?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(t.determinantAffine()===0)return this.identity();let e=this.elements,i=t.elements,n=1/Xh.setFromMatrixColumn(t,0).length(),r=1/Xh.setFromMatrixColumn(t,1).length(),s=1/Xh.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*s,e[9]=i[9]*s,e[10]=i[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,n=t.y,r=t.z,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r);if(t.order==="XYZ"){let d=s*c,u=s*h,p=a*c,f=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=u+p*l,e[5]=d-f*l,e[9]=-a*o,e[2]=f-d*l,e[6]=p+u*l,e[10]=s*o}else if(t.order==="YXZ"){let d=o*c,u=o*h,p=l*c,f=l*h;e[0]=d+f*a,e[4]=p*a-u,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=u*a-p,e[6]=f+d*a,e[10]=s*o}else if(t.order==="ZXY"){let d=o*c,u=o*h,p=l*c,f=l*h;e[0]=d-f*a,e[4]=-s*h,e[8]=p+u*a,e[1]=u+p*a,e[5]=s*c,e[9]=f-d*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if(t.order==="ZYX"){let d=s*c,u=s*h,p=a*c,f=a*h;e[0]=o*c,e[4]=p*l-u,e[8]=d*l+f,e[1]=o*h,e[5]=f*l+d,e[9]=u*l-p,e[2]=-l,e[6]=a*o,e[10]=s*o}else if(t.order==="YZX"){let d=s*o,u=s*l,p=a*o,f=a*l;e[0]=o*c,e[4]=f-d*h,e[8]=p*h+u,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=u*h+p,e[10]=d-f*h}else if(t.order==="XZY"){let d=s*o,u=s*l,p=a*o,f=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=d*h+f,e[5]=s*c,e[9]=u*h-p,e[2]=p*h-u,e[6]=a*c,e[10]=f*h+d}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(zR,t,FR)}lookAt(t,e,i){let n=this.elements;return es.subVectors(t,e),es.lengthSq()===0&&(es.z=1),es.normalize(),Mo.crossVectors(i,es),Mo.lengthSq()===0&&(Math.abs(i.z)===1?es.x+=1e-4:es.z+=1e-4,es.normalize(),Mo.crossVectors(i,es)),Mo.normalize(),Sf.crossVectors(es,Mo),n[0]=Mo.x,n[4]=Sf.x,n[8]=es.x,n[1]=Mo.y,n[5]=Sf.y,n[9]=es.y,n[2]=Mo.z,n[6]=Sf.z,n[10]=es.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[4],o=i[8],l=i[12],c=i[1],h=i[5],d=i[9],u=i[13],p=i[2],f=i[6],g=i[10],m=i[14],v=i[3],y=i[7],_=i[11],b=i[15],x=n[0],w=n[4],S=n[8],E=n[12],A=n[1],P=n[5],C=n[9],R=n[13],O=n[2],D=n[6],F=n[10],V=n[14],U=n[3],j=n[7],q=n[11],rt=n[15];return r[0]=s*x+a*A+o*O+l*U,r[4]=s*w+a*P+o*D+l*j,r[8]=s*S+a*C+o*F+l*q,r[12]=s*E+a*R+o*V+l*rt,r[1]=c*x+h*A+d*O+u*U,r[5]=c*w+h*P+d*D+u*j,r[9]=c*S+h*C+d*F+u*q,r[13]=c*E+h*R+d*V+u*rt,r[2]=p*x+f*A+g*O+m*U,r[6]=p*w+f*P+g*D+m*j,r[10]=p*S+f*C+g*F+m*q,r[14]=p*E+f*R+g*V+m*rt,r[3]=v*x+y*A+_*O+b*U,r[7]=v*w+y*P+_*D+b*j,r[11]=v*S+y*C+_*F+b*q,r[15]=v*E+y*R+_*V+b*rt,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],d=t[10],u=t[14],p=t[3],f=t[7],g=t[11],m=t[15],v=o*u-l*d,y=a*u-l*h,_=a*d-o*h,b=s*u-l*c,x=s*d-o*c,w=s*h-a*c;return e*(f*v-g*y+m*_)-i*(p*v-g*b+m*x)+n*(p*y-f*b+m*w)-r*(p*_-f*x+g*w)}determinantAffine(){let t=this.elements,e=t[0],i=t[4],n=t[8],r=t[1],s=t[5],a=t[9],o=t[2],l=t[6],c=t[10];return e*(s*c-a*l)-i*(r*c-a*o)+n*(r*l-s*o)}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(t,e,i){let n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],d=t[10],u=t[11],p=t[12],f=t[13],g=t[14],m=t[15],v=e*a-i*s,y=e*o-n*s,_=e*l-r*s,b=i*o-n*a,x=i*l-r*a,w=n*l-r*o,S=c*f-h*p,E=c*g-d*p,A=c*m-u*p,P=h*g-d*f,C=h*m-u*f,R=d*m-u*g,O=v*R-y*C+_*P+b*A-x*E+w*S;if(O===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let D=1/O;return t[0]=(a*R-o*C+l*P)*D,t[1]=(n*C-i*R-r*P)*D,t[2]=(f*w-g*x+m*b)*D,t[3]=(d*x-h*w-u*b)*D,t[4]=(o*A-s*R-l*E)*D,t[5]=(e*R-n*A+r*E)*D,t[6]=(g*_-p*w-m*y)*D,t[7]=(c*w-d*_+u*y)*D,t[8]=(s*C-a*A+l*S)*D,t[9]=(i*A-e*C-r*S)*D,t[10]=(p*x-f*_+m*v)*D,t[11]=(h*_-c*x-u*v)*D,t[12]=(a*E-s*P-o*S)*D,t[13]=(e*P-i*E+n*S)*D,t[14]=(f*y-p*b-g*v)*D,t[15]=(c*b-h*y+d*v)*D,this}scale(t){let e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),n=Math.sin(e),r=1-i,s=t.x,a=t.y,o=t.z,l=r*s,c=r*a;return this.set(l*s+i,l*a-n*o,l*o+n*a,0,l*a+n*o,c*a+i,c*o-n*s,0,l*o-n*a,c*o+n*s,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,s){return this.set(1,i,r,0,t,1,s,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){let n=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,d=r*l,u=r*c,p=r*h,f=s*c,g=s*h,m=a*h,v=o*l,y=o*c,_=o*h,b=i.x,x=i.y,w=i.z;return n[0]=(1-(f+m))*b,n[1]=(u+_)*b,n[2]=(p-y)*b,n[3]=0,n[4]=(u-_)*x,n[5]=(1-(d+m))*x,n[6]=(g+v)*x,n[7]=0,n[8]=(p+y)*w,n[9]=(g-v)*w,n[10]=(1-(d+f))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){let n=this.elements;t.x=n[12],t.y=n[13],t.z=n[14];let r=this.determinantAffine();if(r===0)return i.set(1,1,1),e.identity(),this;let s=Xh.set(n[0],n[1],n[2]).length(),a=Xh.set(n[4],n[5],n[6]).length(),o=Xh.set(n[8],n[9],n[10]).length();r<0&&(s=-s),Cs.copy(this);let l=1/s,c=1/a,h=1/o;return Cs.elements[0]*=l,Cs.elements[1]*=l,Cs.elements[2]*=l,Cs.elements[4]*=c,Cs.elements[5]*=c,Cs.elements[6]*=c,Cs.elements[8]*=h,Cs.elements[9]*=h,Cs.elements[10]*=h,e.setFromRotationMatrix(Cs),i.x=s,i.y=a,i.z=o,this}makePerspective(t,e,i,n,r,s,a=oa,o=!1){let l,c,h=this.elements,d=2*r/(e-t),u=2*r/(i-n),p=(e+t)/(e-t),f=(i+n)/(i-n);if(o)l=r/(s-r),c=s*r/(s-r);else if(a===oa)l=-(s+r)/(s-r),c=-2*s*r/(s-r);else{if(a!==Pd)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);l=-s/(s-r),c=-s*r/(s-r)}return h[0]=d,h[4]=0,h[8]=p,h[12]=0,h[1]=0,h[5]=u,h[9]=f,h[13]=0,h[2]=0,h[6]=0,h[10]=l,h[14]=c,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(t,e,i,n,r,s,a=oa,o=!1){let l,c,h=this.elements,d=2/(e-t),u=2/(i-n),p=-(e+t)/(e-t),f=-(i+n)/(i-n);if(o)l=1/(s-r),c=s/(s-r);else if(a===oa)l=-2/(s-r),c=-(s+r)/(s-r);else{if(a!==Pd)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);l=-1/(s-r),c=-r/(s-r)}return h[0]=d,h[4]=0,h[8]=0,h[12]=p,h[1]=0,h[5]=u,h[9]=0,h[13]=f,h[2]=0,h[6]=0,h[10]=l,h[14]=c,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(t){let e=this.elements,i=t.elements;for(let n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}},tS.prototype.isMatrix4=!0,Xh=new T,Cs=new Et,zR=new T(0,0,0),FR=new T(1,1,1),Mo=new T,Sf=new T,es=new T,eS=new Et,iS=new qt,(ci=class{constructor(t=0,e=0,i=0,n=ci.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){let n=t.elements,r=n[0],s=n[4],a=n[8],o=n[1],l=n[5],c=n[9],h=n[2],d=n[6],u=n[10];switch(e){case"XYZ":this._y=Math.asin(ge(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ge(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,u),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(ge(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-ge(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(ge(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,u));break;case"XZY":this._z=Math.asin(-ge(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,u),this._y=0);break;default:ce("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return eS.makeRotationFromQuaternion(t),this.setFromRotationMatrix(eS,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return iS.setFromEuler(this),this.setFromQuaternion(iS,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}).DEFAULT_ORDER="XYZ",D1=class{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return!!(this.mask&1<<t)}},NR=0,nS=new T,$h=new qt,Ta=new Et,Mf=new T,Rd=new T,kR=new T,VR=new qt,rS=new T(1,0,0),sS=new T(0,1,0),aS=new T(0,0,1),oS={type:"added"},jR={type:"removed"},Yh={type:"childadded",child:null},av={type:"childremoved",child:null},(xi=class extends kn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:NR++}),this.uuid=Ts(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=xi.DEFAULT_UP.clone();let t=new T,e=new ci,i=new qt,n=new T(1,1,1);e._onChange(function(){i.setFromEuler(e,!1)}),i._onChange(function(){e.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Et},normalMatrix:{value:new ue}}),this.matrix=new Et,this.matrixWorld=new Et,this.matrixAutoUpdate=xi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=xi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new D1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return $h.setFromAxisAngle(t,e),this.quaternion.multiply($h),this}rotateOnWorldAxis(t,e){return $h.setFromAxisAngle(t,e),this.quaternion.premultiply($h),this}rotateX(t){return this.rotateOnAxis(rS,t)}rotateY(t){return this.rotateOnAxis(sS,t)}rotateZ(t){return this.rotateOnAxis(aS,t)}translateOnAxis(t,e){return nS.copy(t).applyQuaternion(this.quaternion),this.position.add(nS.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(rS,t)}translateY(t){return this.translateOnAxis(sS,t)}translateZ(t){return this.translateOnAxis(aS,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ta.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Mf.copy(t):Mf.set(t,e,i);let n=this.parent;this.updateWorldMatrix(!0,!1),Rd.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ta.lookAt(Rd,Mf,this.up):Ta.lookAt(Mf,Rd,this.up),this.quaternion.setFromRotationMatrix(Ta),n&&(Ta.extractRotation(n.matrixWorld),$h.setFromRotationMatrix(Ta),this.quaternion.premultiply($h.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(fe("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(oS),Yh.child=t,this.dispatchEvent(Yh),Yh.child=null):fe("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(jR),av.child=t,this.dispatchEvent(av),av.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ta.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Ta.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ta),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(oS),Yh.child=t,this.dispatchEvent(Yh),Yh.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){let r=this.children[i].getObjectByProperty(t,e);if(r!==void 0)return r}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);let n=this.children;for(let r=0,s=n.length;r<s;r++)n[r].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Rd,t,kR),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Rd,VR,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let e=t.x,i=t.y,n=t.z,r=this.matrix.elements;r[12]+=e-r[0]*e-r[4]*i-r[8]*n,r[13]+=i-r[1]*e-r[5]*i-r[9]*n,r[14]+=n-r[2]*e-r[6]*i-r[10]*n}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e,i=!1){let n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),e===!0){let r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0,i)}}toJSON(t){let e=t===void 0||typeof t=="string",i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let n={};function r(a,o){return a[o.uuid]===void 0&&(a[o.uuid]=o.toJSON(t)),o.uuid}if(n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),this.frustumCulled===!1&&(n.frustumCulled=!1),this.renderOrder!==0&&(n.renderOrder=this.renderOrder),this.static!==!1&&(n.static=this.static),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),this.pivot!==null&&(n.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(n.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(n.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(n.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),n.instanceInfo=this._instanceInfo.map(a=>({...a})),n.availableInstanceIds=this._availableInstanceIds.slice(),n.availableGeometryIds=this._availableGeometryIds.slice(),n.nextIndexStart=this._nextIndexStart,n.nextVertexStart=this._nextVertexStart,n.geometryCount=this._geometryCount,n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.matricesTexture=this._matricesTexture.toJSON(t),n.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(n.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(n.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(n.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let o=a.shapes;if(Array.isArray(o))for(let l=0,c=o.length;l<c;l++){let h=o[l];r(t.shapes,h)}else r(t.shapes,o)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let o=0,l=this.material.length;o<l;o++)a.push(r(t.materials,this.material[o]));n.material=a}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let a=0;a<this.children.length;a++)n.children.push(this.children[a].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let a=0;a<this.animations.length;a++){let o=this.animations[a];n.animations.push(r(t.animations,o))}}if(e){let a=s(t.geometries),o=s(t.materials),l=s(t.textures),c=s(t.images),h=s(t.shapes),d=s(t.skeletons),u=s(t.animations),p=s(t.nodes);a.length>0&&(i.geometries=a),o.length>0&&(i.materials=o),l.length>0&&(i.textures=l),c.length>0&&(i.images=c),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),u.length>0&&(i.animations=u),p.length>0&&(i.nodes=p)}return i.object=n,i;function s(a){let o=[];for(let l in a){let c=a[l];delete c.metadata,o.push(c)}return o}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let i=0;i<t.children.length;i++){let n=t.children[i];this.add(n.clone())}return this}}).DEFAULT_UP=new T(0,1,0),xi.DEFAULT_MATRIX_AUTO_UPDATE=!0,xi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,Tp=class extends xi{constructor(){super(),this.isGroup=!0,this.type="Group"}},lS={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Eo={h:0,s:0,l:0},Ef={h:0,s:0,l:0},Jt=class{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(e===void 0&&i===void 0){let n=t;n&&n.isColor?this.copy(n):typeof n=="number"?this.setHex(n):typeof n=="string"&&this.setStyle(n)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Ue){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Ve.colorSpaceToWorking(this,e),this}setRGB(t,e,i,n=Ve.workingColorSpace){return this.r=t,this.g=e,this.b=i,Ve.colorSpaceToWorking(this,n),this}setHSL(t,e,i,n=Ve.workingColorSpace){if(t=DE(t,1),e=ge(e,0,1),i=ge(i,0,1),e===0)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+e):i+e-i*e,s=2*i-r;this.r=Ww(s,r,t+1/3),this.g=Ww(s,r,t),this.b=Ww(s,r,t-1/3)}return Ve.colorSpaceToWorking(this,n),this}setStyle(t,e=Ue){function i(r){r!==void 0&&parseFloat(r)<1&&ce("Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let r,s=n[1],a=n[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:ce("Color: Unknown color model "+t)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){let r=n[1],s=r.length;if(s===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,e);if(s===6)return this.setHex(parseInt(r,16),e);ce("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Ue){let i=lS[t.toLowerCase()];return i!==void 0?this.setHex(i,e):ce("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=So(t.r),this.g=So(t.g),this.b=So(t.b),this}copyLinearToSRGB(t){return this.r=Cd(t.r),this.g=Cd(t.g),this.b=Cd(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ue){return Ve.workingToColorSpace(hr.copy(this),t),65536*Math.round(ge(255*hr.r,0,255))+256*Math.round(ge(255*hr.g,0,255))+Math.round(ge(255*hr.b,0,255))}getHexString(t=Ue){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Ve.workingColorSpace){Ve.workingToColorSpace(hr.copy(this),e);let i,n,r=hr.r,s=hr.g,a=hr.b,o=Math.max(r,s,a),l=Math.min(r,s,a),c=(l+o)/2;if(l===o)i=0,n=0;else{let h=o-l;switch(n=c<=.5?h/(o+l):h/(2-o-l),o){case r:i=(s-a)/h+(s<a?6:0);break;case s:i=(a-r)/h+2;break;case a:i=(r-s)/h+4}i/=6}return t.h=i,t.s=n,t.l=c,t}getRGB(t,e=Ve.workingColorSpace){return Ve.workingToColorSpace(hr.copy(this),e),t.r=hr.r,t.g=hr.g,t.b=hr.b,t}getStyle(t=Ue){Ve.workingToColorSpace(hr.copy(this),t);let e=hr.r,i=hr.g,n=hr.b;return t!==Ue?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(Eo),this.setHSL(Eo.h+t,Eo.s+e,Eo.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Eo),t.getHSL(Ef);let i=Cm(Eo.h,Ef.h,e),n=Cm(Eo.s,Ef.s,e),r=Cm(Eo.l,Ef.l,e);return this.setHSL(i,n,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,i=this.g,n=this.b,r=t.elements;return this.r=r[0]*e+r[3]*i+r[6]*n,this.g=r[1]*e+r[4]*i+r[7]*n,this.b=r[2]*e+r[5]*i+r[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},hr=new Jt,Jt.NAMES=lS,ZE=class{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new Jt(t),this.near=e,this.far=i}clone(){return new ZE(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},as=class extends xi{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ci,this.environmentIntensity=1,this.environmentRotation=new ci,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}},Ps=new T,Ca=new T,ov=new T,Pa=new T,Zh=new T,Kh=new T,hS=new T,lv=new T,hv=new T,cv=new T,dv=new ye,uv=new ye,pv=new ye,vn=class{constructor(t=new T,e=new T,i=new T){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),Ps.subVectors(t,e),n.cross(Ps);let r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){Ps.subVectors(n,e),Ca.subVectors(i,e),ov.subVectors(t,e);let s=Ps.dot(Ps),a=Ps.dot(Ca),o=Ps.dot(ov),l=Ca.dot(Ca),c=Ca.dot(ov),h=s*l-a*a;if(h===0)return r.set(0,0,0),null;let d=1/h,u=(l*o-a*c)*d,p=(s*c-a*o)*d;return r.set(1-u-p,p,u)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Pa)!==null&&Pa.x>=0&&Pa.y>=0&&Pa.x+Pa.y<=1}static getInterpolation(t,e,i,n,r,s,a,o){return this.getBarycoord(t,e,i,n,Pa)===null?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Pa.x),o.addScaledVector(s,Pa.y),o.addScaledVector(a,Pa.z),o)}static getInterpolatedAttribute(t,e,i,n,r,s){return dv.setScalar(0),uv.setScalar(0),pv.setScalar(0),dv.fromBufferAttribute(t,e),uv.fromBufferAttribute(t,i),pv.fromBufferAttribute(t,n),s.setScalar(0),s.addScaledVector(dv,r.x),s.addScaledVector(uv,r.y),s.addScaledVector(pv,r.z),s}static isFrontFacing(t,e,i,n){return Ps.subVectors(i,e),Ca.subVectors(t,e),Ps.cross(Ca).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Ps.subVectors(this.c,this.b),Ca.subVectors(this.a,this.b),.5*Ps.cross(Ca).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return vn.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return vn.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,n,r){return vn.getInterpolation(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return vn.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return vn.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i,n,r=this.a,s=this.b,a=this.c;Zh.subVectors(s,r),Kh.subVectors(a,r),lv.subVectors(t,r);let o=Zh.dot(lv),l=Kh.dot(lv);if(o<=0&&l<=0)return e.copy(r);hv.subVectors(t,s);let c=Zh.dot(hv),h=Kh.dot(hv);if(c>=0&&h<=c)return e.copy(s);let d=o*h-c*l;if(d<=0&&o>=0&&c<=0)return i=o/(o-c),e.copy(r).addScaledVector(Zh,i);cv.subVectors(t,a);let u=Zh.dot(cv),p=Kh.dot(cv);if(p>=0&&u<=p)return e.copy(a);let f=u*l-o*p;if(f<=0&&l>=0&&p<=0)return n=l/(l-p),e.copy(r).addScaledVector(Kh,n);let g=c*p-u*h;if(g<=0&&h-c>=0&&u-p>=0)return hS.subVectors(a,s),n=(h-c)/(h-c+(u-p)),e.copy(s).addScaledVector(hS,n);let m=1/(g+f+d);return i=f*m,n=d*m,e.copy(r).addScaledVector(Zh,i).addScaledVector(Kh,n)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},hi=class{constructor(t=new T(1/0,1/0,1/0),e=new T(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Ds.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Ds.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let i=Ds.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let i=t.geometry;if(i!==void 0){let r=i.getAttribute("position");if(e===!0&&r!==void 0&&t.isInstancedMesh!==!0)for(let s=0,a=r.count;s<a;s++)t.isMesh===!0?t.getVertexPosition(s,Ds):Ds.fromBufferAttribute(r,s),Ds.applyMatrix4(t.matrixWorld),this.expandByPoint(Ds);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Af.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Af.copy(i.boundingBox)),Af.applyMatrix4(t.matrixWorld),this.union(Af)}let n=t.children;for(let r=0,s=n.length;r<s;r++)this.expandByObject(n[r],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Ds),Ds.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Od),Tf.subVectors(this.max,Od),Qh.subVectors(t.a,Od),Jh.subVectors(t.b,Od),tc.subVectors(t.c,Od),Ao.subVectors(Jh,Qh),To.subVectors(tc,Jh),Pl.subVectors(Qh,tc);let e=[0,-Ao.z,Ao.y,0,-To.z,To.y,0,-Pl.z,Pl.y,Ao.z,0,-Ao.x,To.z,0,-To.x,Pl.z,0,-Pl.x,-Ao.y,Ao.x,0,-To.y,To.x,0,-Pl.y,Pl.x,0];return!(!qw(e,Qh,Jh,tc,Tf)||(e=[1,0,0,0,1,0,0,0,1],!qw(e,Qh,Jh,tc,Tf)))&&(Cf.crossVectors(Ao,To),e=[Cf.x,Cf.y,Cf.z],qw(e,Qh,Jh,tc,Tf))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Ds).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Ds).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Da[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Da[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Da[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Da[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Da[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Da[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Da[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Da[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Da)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},Da=[new T,new T,new T,new T,new T,new T,new T,new T],Ds=new T,Af=new hi,Qh=new T,Jh=new T,tc=new T,Ao=new T,To=new T,Pl=new T,Od=new T,Tf=new T,Cf=new T,Gl=new T,Ra=function(){let t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[256|l]=32768,r[l]=24,r[256|l]=24):c<-14?(n[l]=1024>>-c-14,n[256|l]=1024>>-c-14|32768,r[l]=-c-1,r[256|l]=-c-1):c<=15?(n[l]=c+15<<10,n[256|l]=c+15<<10|32768,r[l]=13,r[256|l]=13):c<128?(n[l]=31744,n[256|l]=64512,r[l]=24,r[256|l]=24):(n[l]=31744,n[256|l]=64512,r[l]=13,r[256|l]=13)}let s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,h=0;for(;!(8388608&c);)c<<=1,h-=8388608;c&=-8388609,h+=947912704,s[l]=c|h}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:i,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}(),th=class{static toHalfFloat(t){return function(e){Math.abs(e)>65504&&ce("DataUtils.toHalfFloat(): Value out of range."),e=ge(e,-65504,65504),Ra.floatView[0]=e;let i=Ra.uint32View[0],n=i>>23&511;return Ra.baseTable[n]+((8388607&i)>>Ra.shiftTable[n])}(t)}static fromHalfFloat(t){return function(e){let i=e>>10;return Ra.uint32View[0]=Ra.mantissaTable[Ra.offsetTable[i]+(1023&e)]+Ra.exponentTable[i],Ra.floatView[0]}(t)}},dn=new T,Pf=new et,GR=0,Ht=class extends kn{constructor(t,e,i=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:GR++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=i,this.usage=ev,this.updateRanges=[],this.gpuType=$e,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,i=this.count;e<i;e++)Pf.fromBufferAttribute(this,e),Pf.applyMatrix3(t),this.setXY(e,Pf.x,Pf.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)dn.fromBufferAttribute(this,e),dn.applyMatrix3(t),this.setXYZ(e,dn.x,dn.y,dn.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)dn.fromBufferAttribute(this,e),dn.applyMatrix4(t),this.setXYZ(e,dn.x,dn.y,dn.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)dn.fromBufferAttribute(this,e),dn.applyNormalMatrix(t),this.setXYZ(e,dn.x,dn.y,dn.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)dn.fromBufferAttribute(this,e),dn.transformDirection(t),this.setXYZ(e,dn.x,dn.y,dn.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=Qs(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=fi(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Qs(e,this.array)),e}setX(t,e){return this.normalized&&(e=fi(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Qs(e,this.array)),e}setY(t,e){return this.normalized&&(e=fi(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Qs(e,this.array)),e}setZ(t,e){return this.normalized&&(e=fi(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Qs(e,this.array)),e}setW(t,e){return this.normalized&&(e=fi(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=fi(e,this.array),i=fi(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=fi(e,this.array),i=fi(i,this.array),n=fi(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t*=this.itemSize,this.normalized&&(e=fi(e,this.array),i=fi(i,this.array),n=fi(n,this.array),r=fi(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==ev&&(t.usage=this.usage),t}dispose(){this.dispatchEvent({type:"dispose"})}},KE=class extends Ht{constructor(t,e,i){super(new Uint16Array(t),e,i)}},mh=class extends Ht{constructor(t,e,i){super(new Uint32Array(t),e,i)}},kt=class extends Ht{constructor(t,e,i){super(new Float32Array(t),e,i)}},HR=new hi,Id=new T,fv=new T,vr=class{constructor(t=new T,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let i=this.center;e!==void 0?i.copy(e):HR.setFromPoints(t).getCenter(i);let n=0;for(let r=0,s=t.length;r<s;r++)n=Math.max(n,i.distanceToSquared(t[r]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Id.subVectors(t,this.center);let e=Id.lengthSq();if(e>this.radius*this.radius){let i=Math.sqrt(e),n=.5*(i-this.radius);this.center.addScaledVector(Id,n/i),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(fv.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Id.copy(t.center).add(fv)),this.expandByPoint(Id.copy(t.center).sub(fv))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},WR=0,us=new Et,mv=new xi,ec=new T,is=new hi,Ld=new hi,Un=new T,jt=class extends kn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:WR++}),this.uuid=Ts(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(function(e){for(let i=e.length-1;i>=0;--i)if(e[i]>=65535)return!0;return!1}(t)?mh:KE)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let r=new ue().getNormalMatrix(t);i.applyNormalMatrix(r),i.needsUpdate=!0}let n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(t),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return us.makeRotationFromQuaternion(t),this.applyMatrix4(us),this}rotateX(t){return us.makeRotationX(t),this.applyMatrix4(us),this}rotateY(t){return us.makeRotationY(t),this.applyMatrix4(us),this}rotateZ(t){return us.makeRotationZ(t),this.applyMatrix4(us),this}translate(t,e,i){return us.makeTranslation(t,e,i),this.applyMatrix4(us),this}scale(t,e,i){return us.makeScale(t,e,i),this.applyMatrix4(us),this}lookAt(t){return mv.lookAt(t),mv.updateMatrix(),this.applyMatrix4(mv.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ec).negate(),this.translate(ec.x,ec.y,ec.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let i=[];for(let n=0,r=t.length;n<r;n++){let s=t[n];i.push(s.x,s.y,s.z||0)}this.setAttribute("position",new kt(i,3))}else{let i=Math.min(t.length,e.count);for(let n=0;n<i;n++){let r=t[n];e.setXYZ(n,r.x,r.y,r.z||0)}t.length>e.count&&ce("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new hi);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return fe("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new T(-1/0,-1/0,-1/0),new T(1/0,1/0,1/0));if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,n=e.length;i<n;i++){let r=e[i];is.setFromBufferAttribute(r),this.morphTargetsRelative?(Un.addVectors(this.boundingBox.min,is.min),this.boundingBox.expandByPoint(Un),Un.addVectors(this.boundingBox.max,is.max),this.boundingBox.expandByPoint(Un)):(this.boundingBox.expandByPoint(is.min),this.boundingBox.expandByPoint(is.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&fe('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vr);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return fe("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new T,1/0);if(t){let i=this.boundingSphere.center;if(is.setFromBufferAttribute(t),e)for(let r=0,s=e.length;r<s;r++){let a=e[r];Ld.setFromBufferAttribute(a),this.morphTargetsRelative?(Un.addVectors(is.min,Ld.min),is.expandByPoint(Un),Un.addVectors(is.max,Ld.max),is.expandByPoint(Un)):(is.expandByPoint(Ld.min),is.expandByPoint(Ld.max))}is.getCenter(i);let n=0;for(let r=0,s=t.count;r<s;r++)Un.fromBufferAttribute(t,r),n=Math.max(n,i.distanceToSquared(Un));if(e)for(let r=0,s=e.length;r<s;r++){let a=e[r],o=this.morphTargetsRelative;for(let l=0,c=a.count;l<c;l++)Un.fromBufferAttribute(a,l),o&&(ec.fromBufferAttribute(t,l),Un.add(ec)),n=Math.max(n,i.distanceToSquared(Un))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&fe('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0)return void fe("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=e.position,n=e.normal,r=e.uv,s=this.getAttribute("tangent");(s===void 0||s.count!==i.count)&&(s=new Ht(new Float32Array(4*i.count),4),this.setAttribute("tangent",s));let a=[],o=[];for(let S=0;S<i.count;S++)a[S]=new T,o[S]=new T;let l=new T,c=new T,h=new T,d=new et,u=new et,p=new et,f=new T,g=new T;function m(S,E,A){l.fromBufferAttribute(i,S),c.fromBufferAttribute(i,E),h.fromBufferAttribute(i,A),d.fromBufferAttribute(r,S),u.fromBufferAttribute(r,E),p.fromBufferAttribute(r,A),c.sub(l),h.sub(l),u.sub(d),p.sub(d);let P=1/(u.x*p.y-p.x*u.y);!isFinite(P)||(f.copy(c).multiplyScalar(p.y).addScaledVector(h,-u.y).multiplyScalar(P),g.copy(h).multiplyScalar(u.x).addScaledVector(c,-p.x).multiplyScalar(P),a[S].add(f),a[E].add(f),a[A].add(f),o[S].add(g),o[E].add(g),o[A].add(g))}let v=this.groups;v.length===0&&(v=[{start:0,count:t.count}]);for(let S=0,E=v.length;S<E;++S){let A=v[S],P=A.start;for(let C=P,R=P+A.count;C<R;C+=3)m(t.getX(C+0),t.getX(C+1),t.getX(C+2))}let y=new T,_=new T,b=new T,x=new T;function w(S){b.fromBufferAttribute(n,S),x.copy(b);let E=a[S];y.copy(E),y.sub(b.multiplyScalar(b.dot(E))).normalize(),_.crossVectors(x,E);let A=_.dot(o[S])<0?-1:1;s.setXYZW(S,y.x,y.y,y.z,A)}for(let S=0,E=v.length;S<E;++S){let A=v[S],P=A.start;for(let C=P,R=P+A.count;C<R;C+=3)w(t.getX(C+0)),w(t.getX(C+1)),w(t.getX(C+2))}this._transformed=!0}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let i=this.getAttribute("normal");if(i===void 0||i.count!==e.count)i=new Ht(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let d=0,u=i.count;d<u;d++)i.setXYZ(d,0,0,0);let n=new T,r=new T,s=new T,a=new T,o=new T,l=new T,c=new T,h=new T;if(t)for(let d=0,u=t.count;d<u;d+=3){let p=t.getX(d+0),f=t.getX(d+1),g=t.getX(d+2);n.fromBufferAttribute(e,p),r.fromBufferAttribute(e,f),s.fromBufferAttribute(e,g),c.subVectors(s,r),h.subVectors(n,r),c.cross(h),a.fromBufferAttribute(i,p),o.fromBufferAttribute(i,f),l.fromBufferAttribute(i,g),a.add(c),o.add(c),l.add(c),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(f,o.x,o.y,o.z),i.setXYZ(g,l.x,l.y,l.z)}else for(let d=0,u=e.count;d<u;d+=3)n.fromBufferAttribute(e,d+0),r.fromBufferAttribute(e,d+1),s.fromBufferAttribute(e,d+2),c.subVectors(s,r),h.subVectors(n,r),c.cross(h),i.setXYZ(d+0,c.x,c.y,c.z),i.setXYZ(d+1,c.x,c.y,c.z),i.setXYZ(d+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Un.fromBufferAttribute(t,e),Un.normalize(),t.setXYZ(e,Un.x,Un.y,Un.z)}toNonIndexed(){function t(a,o){let l=a.array,c=a.itemSize,h=a.normalized,d=new l.constructor(o.length*c),u=0,p=0;for(let f=0,g=o.length;f<g;f++){u=a.isInterleavedBufferAttribute?o[f]*a.data.stride+a.offset:o[f]*c;for(let m=0;m<c;m++)d[p++]=l[u++]}return new Ht(d,c,h)}if(this.index===null)return ce("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new jt,i=this.index.array,n=this.attributes;for(let a in n){let o=t(n[a],i);e.setAttribute(a,o)}let r=this.morphAttributes;for(let a in r){let o=[],l=r[a];for(let c=0,h=l.length;c<h;c++){let d=t(l[c],i);o.push(d)}e.morphAttributes[a]=o}e.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let a=0,o=s.length;a<o;a++){let l=s[a];e.addGroup(l.start,l.count,l.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let o=this.parameters;for(let l in o)o[l]!==void 0&&(t[l]=o[l]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let i=this.attributes;for(let o in i){let l=i[o];t.data.attributes[o]=l.toJSON(t.data)}let n={},r=!1;for(let o in this.morphAttributes){let l=this.morphAttributes[o],c=[];for(let h=0,d=l.length;h<d;h++){let u=l[h];c.push(u.toJSON(t.data))}c.length>0&&(n[o]=c,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));let a=this.boundingSphere;return a!==null&&(t.data.boundingSphere=a.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let i=t.index;i!==null&&this.setIndex(i.clone());let n=t.attributes;for(let l in n){let c=n[l];this.setAttribute(l,c.clone(e))}let r=t.morphAttributes;for(let l in r){let c=[],h=r[l];for(let d=0,u=h.length;d<u;d++)c.push(h[d].clone(e));this.morphAttributes[l]=c}this.morphTargetsRelative=t.morphTargetsRelative;let s=t.groups;for(let l=0,c=s.length;l<c;l++){let h=s[l];this.addGroup(h.start,h.count,h.materialIndex)}let a=t.boundingBox;a!==null&&(this.boundingBox=a.clone());let o=t.boundingSphere;return o!==null&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this._transformed=t._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},QE=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=ev,this.updateRanges=[],this.version=0,this.uuid=Ts()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ts()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ts()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},xr=new T,Rm=class{constructor(t,e,i,n=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=n}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)xr.fromBufferAttribute(this,e),xr.applyMatrix4(t),this.setXYZ(e,xr.x,xr.y,xr.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)xr.fromBufferAttribute(this,e),xr.applyNormalMatrix(t),this.setXYZ(e,xr.x,xr.y,xr.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)xr.fromBufferAttribute(this,e),xr.transformDirection(t),this.setXYZ(e,xr.x,xr.y,xr.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=Qs(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=fi(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=fi(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=fi(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=fi(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=fi(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Qs(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Qs(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Qs(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Qs(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=fi(e,this.array),i=fi(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=fi(e,this.array),i=fi(i,this.array),n=fi(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=fi(e,this.array),i=fi(i,this.array),n=fi(n,this.array),r=fi(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}clone(t){if(t===void 0){f_("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let i=0;i<this.count;i++){let n=i*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[n+r])}return new Ht(new this.array.constructor(e),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Rm(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){f_("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let i=0;i<this.count;i++){let n=i*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)e.push(this.data.array[n+r])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},qR=0,ic=class extends kn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:qR++}),this.uuid=Ts(),this.name="",this.type="Material",this.blending=fh,this.side=Hs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=v1,this.blendDst=y1,this.blendEquation=Yl,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Jt(0,0,0),this.blendAlpha=0,this.depthFunc=Ic,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=qh,this.stencilZFail=qh,this.stencilZPass=qh,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let i=t[e];if(i===void 0){ce(`Material: parameter '${e}' has value of undefined.`);continue}let n=this[e];n!==void 0?n&&n.isColor?n.set(i):n&&n.isVector2&&i&&i.isVector2||n&&n.isEuler&&i&&i.isEuler||n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:ce(`Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function n(r){let s=[];for(let a in r){let o=r[a];delete o.metadata,s.push(o)}return s}if(i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==fh&&(i.blending=this.blending),this.side!==Hs&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==v1&&(i.blendSrc=this.blendSrc),this.blendDst!==y1&&(i.blendDst=this.blendDst),this.blendEquation!==Yl&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Ic&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==qh&&(i.stencilFail=this.stencilFail),this.stencilZFail!==qh&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==qh&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){let r=n(t.textures),s=n(t.images);r.length>0&&(i.textures=r),s.length>0&&(i.images=s)}return i}fromJSON(t,e){if(t.uuid!==void 0&&(this.uuid=t.uuid),t.name!==void 0&&(this.name=t.name),t.color!==void 0&&this.color!==void 0&&this.color.setHex(t.color),t.roughness!==void 0&&(this.roughness=t.roughness),t.metalness!==void 0&&(this.metalness=t.metalness),t.sheen!==void 0&&(this.sheen=t.sheen),t.sheenColor!==void 0&&(this.sheenColor=new Jt().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(this.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(t.emissive),t.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(t.specular),t.specularIntensity!==void 0&&(this.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(this.shininess=t.shininess),t.clearcoat!==void 0&&(this.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(this.dispersion=t.dispersion),t.iridescence!==void 0&&(this.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(this.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(this.transmission=t.transmission),t.thickness!==void 0&&(this.thickness=t.thickness),t.attenuationDistance!==void 0&&(this.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(this.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(this.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(this.fog=t.fog),t.flatShading!==void 0&&(this.flatShading=t.flatShading),t.blending!==void 0&&(this.blending=t.blending),t.combine!==void 0&&(this.combine=t.combine),t.side!==void 0&&(this.side=t.side),t.shadowSide!==void 0&&(this.shadowSide=t.shadowSide),t.opacity!==void 0&&(this.opacity=t.opacity),t.transparent!==void 0&&(this.transparent=t.transparent),t.alphaTest!==void 0&&(this.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(this.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(this.depthFunc=t.depthFunc),t.depthTest!==void 0&&(this.depthTest=t.depthTest),t.depthWrite!==void 0&&(this.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(this.colorWrite=t.colorWrite),t.blendSrc!==void 0&&(this.blendSrc=t.blendSrc),t.blendDst!==void 0&&(this.blendDst=t.blendDst),t.blendEquation!==void 0&&(this.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(this.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(this.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(this.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(this.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(this.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(this.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(this.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(this.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(this.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(this.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(this.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(this.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(this.rotation=t.rotation),t.linewidth!==void 0&&(this.linewidth=t.linewidth),t.dashSize!==void 0&&(this.dashSize=t.dashSize),t.gapSize!==void 0&&(this.gapSize=t.gapSize),t.scale!==void 0&&(this.scale=t.scale),t.polygonOffset!==void 0&&(this.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(this.dithering=t.dithering),t.alphaToCoverage!==void 0&&(this.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(this.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(this.allowOverride=t.allowOverride),t.visible!==void 0&&(this.visible=t.visible),t.toneMapped!==void 0&&(this.toneMapped=t.toneMapped),t.userData!==void 0&&(this.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?this.vertexColors=t.vertexColors>0:this.vertexColors=t.vertexColors),t.size!==void 0&&(this.size=t.size),t.sizeAttenuation!==void 0&&(this.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(this.map=e[t.map]||null),t.matcap!==void 0&&(this.matcap=e[t.matcap]||null),t.alphaMap!==void 0&&(this.alphaMap=e[t.alphaMap]||null),t.bumpMap!==void 0&&(this.bumpMap=e[t.bumpMap]||null),t.bumpScale!==void 0&&(this.bumpScale=t.bumpScale),t.normalMap!==void 0&&(this.normalMap=e[t.normalMap]||null),t.normalMapType!==void 0&&(this.normalMapType=t.normalMapType),t.normalScale!==void 0){let i=t.normalScale;Array.isArray(i)===!1&&(i=[i,i]),this.normalScale=new et().fromArray(i)}return t.displacementMap!==void 0&&(this.displacementMap=e[t.displacementMap]||null),t.displacementScale!==void 0&&(this.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(this.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(this.roughnessMap=e[t.roughnessMap]||null),t.metalnessMap!==void 0&&(this.metalnessMap=e[t.metalnessMap]||null),t.emissiveMap!==void 0&&(this.emissiveMap=e[t.emissiveMap]||null),t.emissiveIntensity!==void 0&&(this.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(this.specularMap=e[t.specularMap]||null),t.specularIntensityMap!==void 0&&(this.specularIntensityMap=e[t.specularIntensityMap]||null),t.specularColorMap!==void 0&&(this.specularColorMap=e[t.specularColorMap]||null),t.envMap!==void 0&&(this.envMap=e[t.envMap]||null),t.envMapRotation!==void 0&&this.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(this.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(this.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(this.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(this.lightMap=e[t.lightMap]||null),t.lightMapIntensity!==void 0&&(this.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(this.aoMap=e[t.aoMap]||null),t.aoMapIntensity!==void 0&&(this.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(this.gradientMap=e[t.gradientMap]||null),t.clearcoatMap!==void 0&&(this.clearcoatMap=e[t.clearcoatMap]||null),t.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=e[t.clearcoatRoughnessMap]||null),t.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=e[t.clearcoatNormalMap]||null),t.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new et().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(this.iridescenceMap=e[t.iridescenceMap]||null),t.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=e[t.iridescenceThicknessMap]||null),t.transmissionMap!==void 0&&(this.transmissionMap=e[t.transmissionMap]||null),t.thicknessMap!==void 0&&(this.thicknessMap=e[t.thicknessMap]||null),t.anisotropyMap!==void 0&&(this.anisotropyMap=e[t.anisotropyMap]||null),t.sheenColorMap!==void 0&&(this.sheenColorMap=e[t.sheenColorMap]||null),t.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=e[t.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,i=null;if(e!==null){let n=e.length;i=new Array(n);for(let r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},Oa=new T,gv=new T,Df=new T,Co=new T,vv=new T,Rf=new T,yv=new T,il=class{constructor(t=new T,e=new T(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Oa)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=Oa.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Oa.copy(this.origin).addScaledVector(this.direction,e),Oa.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){gv.copy(t).add(e).multiplyScalar(.5),Df.copy(e).sub(t).normalize(),Co.copy(this.origin).sub(gv);let r,s,a,o,l=.5*t.distanceTo(e),c=-this.direction.dot(Df),h=Co.dot(this.direction),d=-Co.dot(Df),u=Co.lengthSq(),p=Math.abs(1-c*c);if(p>0)if(r=c*d-h,s=c*h-d,o=l*p,r>=0)if(s>=-o)if(s<=o){let f=1/p;r*=f,s*=f,a=r*(r+c*s+2*h)+s*(c*r+s+2*d)+u}else s=l,r=Math.max(0,-(c*s+h)),a=-r*r+s*(s+2*d)+u;else s=-l,r=Math.max(0,-(c*s+h)),a=-r*r+s*(s+2*d)+u;else s<=-o?(r=Math.max(0,-(-c*l+h)),s=r>0?-l:Math.min(Math.max(-l,-d),l),a=-r*r+s*(s+2*d)+u):s<=o?(r=0,s=Math.min(Math.max(-l,-d),l),a=s*(s+2*d)+u):(r=Math.max(0,-(c*l+h)),s=r>0?l:Math.min(Math.max(-l,-d),l),a=-r*r+s*(s+2*d)+u);else s=c>0?-l:l,r=Math.max(0,-(c*s+h)),a=-r*r+s*(s+2*d)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,r),n&&n.copy(gv).addScaledVector(Df,s),a}intersectSphere(t,e){Oa.subVectors(t.center,this.origin);let i=Oa.dot(this.direction),n=Oa.dot(Oa)-i*i,r=t.radius*t.radius;if(n>r)return null;let s=Math.sqrt(r-n),a=i-s,o=i+s;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return i===null?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,s,a,o,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(t.min.x-d.x)*l,n=(t.max.x-d.x)*l):(i=(t.max.x-d.x)*l,n=(t.min.x-d.x)*l),c>=0?(r=(t.min.y-d.y)*c,s=(t.max.y-d.y)*c):(r=(t.max.y-d.y)*c,s=(t.min.y-d.y)*c),i>s||r>n||((r>i||isNaN(i))&&(i=r),(s<n||isNaN(n))&&(n=s),h>=0?(a=(t.min.z-d.z)*h,o=(t.max.z-d.z)*h):(a=(t.max.z-d.z)*h,o=(t.min.z-d.z)*h),i>o||a>n)||((a>i||i!=i)&&(i=a),(o<n||n!=n)&&(n=o),n<0)?null:this.at(i>=0?i:n,e)}intersectsBox(t){return this.intersectBox(t,Oa)!==null}intersectTriangle(t,e,i,n,r){vv.subVectors(e,t),Rf.subVectors(i,t),yv.crossVectors(vv,Rf);let s,a=this.direction.dot(yv);if(a>0){if(n)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}Co.subVectors(this.origin,t);let o=s*this.direction.dot(Rf.crossVectors(Co,Rf));if(o<0)return null;let l=s*this.direction.dot(vv.cross(Co));if(l<0||o+l>a)return null;let c=-s*Co.dot(yv);return c<0?null:this.at(c/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},qs=class extends ic{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Jt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ci,this.combine=FE,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},cS=new Et,Dl=new il,Of=new vr,dS=new T,Om=new T,Im=new T,Lm=new T,_v=new T,If=new T,JE=new T,Bm=new T,gi=class extends xi{constructor(t=new jt,e=new qs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){let i=t[e[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=i.length;n<r;n++){let s=i[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=n}}}}getVertexPosition(t,e){let i=this.geometry,n=i.attributes.position,r=i.morphAttributes.position,s=i.morphTargetsRelative;e.fromBufferAttribute(n,t);let a=this.morphTargetInfluences;if(r&&a){If.set(0,0,0);for(let o=0,l=r.length;o<l;o++){let c=a[o],h=r[o];c!==0&&(_v.fromBufferAttribute(h,t),s?If.addScaledVector(_v,c):If.addScaledVector(_v.sub(e),c))}e.add(If)}return e}raycast(t,e){let i=this.geometry,n=this.material,r=this.matrixWorld;n!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Of.copy(i.boundingSphere),Of.applyMatrix4(r),Dl.copy(t.ray).recast(t.near),(Of.containsPoint(Dl.origin)!==!1||!(Dl.intersectSphere(Of,dS)===null||Dl.origin.distanceToSquared(dS)>(t.far-t.near)**2))&&(cS.copy(r).invert(),Dl.copy(t.ray).applyMatrix4(cS),(i.boundingBox===null||Dl.intersectsBox(i.boundingBox)!==!1)&&this._computeIntersections(t,e,Dl)))}_computeIntersections(t,e,i){let n,r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,d=r.groups,u=r.drawRange;if(a!==null)if(Array.isArray(s))for(let p=0,f=d.length;p<f;p++){let g=d[p],m=s[g.materialIndex];for(let v=Math.max(g.start,u.start),y=Math.min(a.count,Math.min(g.start+g.count,u.start+u.count));v<y;v+=3)n=$0(this,m,t,i,l,c,h,a.getX(v),a.getX(v+1),a.getX(v+2)),n&&(n.faceIndex=Math.floor(v/3),n.face.materialIndex=g.materialIndex,e.push(n))}else for(let p=Math.max(0,u.start),f=Math.min(a.count,u.start+u.count);p<f;p+=3)n=$0(this,s,t,i,l,c,h,a.getX(p),a.getX(p+1),a.getX(p+2)),n&&(n.faceIndex=Math.floor(p/3),e.push(n));else if(o!==void 0)if(Array.isArray(s))for(let p=0,f=d.length;p<f;p++){let g=d[p],m=s[g.materialIndex];for(let v=Math.max(g.start,u.start),y=Math.min(o.count,Math.min(g.start+g.count,u.start+u.count));v<y;v+=3)n=$0(this,m,t,i,l,c,h,v,v+1,v+2),n&&(n.faceIndex=Math.floor(v/3),n.face.materialIndex=g.materialIndex,e.push(n))}else for(let p=Math.max(0,u.start),f=Math.min(o.count,u.start+u.count);p<f;p+=3)n=$0(this,s,t,i,l,c,h,p,p+1,p+2),n&&(n.faceIndex=Math.floor(p/3),e.push(n))}},tA=class extends xi{constructor(){super(),this.isBone=!0,this.type="Bone"}},Cn=class extends ki{constructor(t=null,e=1,i=1,n,r,s,a,o,l=De,c=De,h,d){super(null,s,a,o,l,c,n,r,h,d),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},uS=new Et,XR=new Et,qg=class{constructor(t=[],e=[]){this.uuid=Ts(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){let t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),e.length===0)this.calculateInverses();else if(t.length!==e.length){ce("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new Et)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){let i=new Et;this.bones[t]&&i.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){let i=this.bones[t];i&&i.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){let i=this.bones[t];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){let t=this.bones,e=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let r=0,s=t.length;r<s;r++){let a=t[r]?t[r].matrixWorld:XR;uS.multiplyMatrices(a,e[r]),uS.toArray(i,16*r)}n!==null&&(n.needsUpdate=!0)}clone(){return new qg(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);let e=new Float32Array(t*t*4);e.set(this.boneMatrices);let i=new Cn(e,t,t,Yi,$e);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,this}getBoneByName(t){for(let e=0,i=this.bones.length;e<i;e++){let n=this.bones[e];if(n.name===t)return n}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let i=0,n=t.bones.length;i<n;i++){let r=t.bones[i],s=e[r];s===void 0&&(ce("Skeleton: No bone found with UUID:",r),s=new tA),this.bones.push(s),this.boneInverses.push(new Et().fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){let t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;let e=this.bones,i=this.boneInverses;for(let n=0,r=e.length;n<r;n++){let s=e[n];t.bones.push(s.uuid);let a=i[n];t.boneInverses.push(a.toArray())}return t}},Vu=class extends Ht{constructor(t,e,i,n=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}},nc=new Et,pS=new Et,Lf=[],fS=new hi,$R=new Et,Bd=new gi,Ud=new vr,bx=class extends gi{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Vu(new Float32Array(16*i),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let n=0;n<i;n++)this.setMatrixAt(n,$R)}computeBoundingBox(){let t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new hi),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,nc),fS.copy(t.boundingBox).applyMatrix4(nc),this.boundingBox.union(fS)}computeBoundingSphere(){let t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new vr),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,nc),Ud.copy(t.boundingSphere).applyMatrix4(nc),this.boundingSphere.union(Ud)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){return this.instanceColor===null?e.setRGB(1,1,1):e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){return e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){let i=e.morphTargetInfluences,n=this.morphTexture.source.data.data,r=t*(i.length+1)+1;for(let s=0;s<i.length;s++)i[s]=n[r+s]}raycast(t,e){let i=this.matrixWorld,n=this.count;if(Bd.geometry=this.geometry,Bd.material=this.material,Bd.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ud.copy(this.boundingSphere),Ud.applyMatrix4(i),t.ray.intersectsSphere(Ud)!==!1))for(let r=0;r<n;r++){this.getMatrixAt(r,nc),pS.multiplyMatrices(i,nc),Bd.matrixWorld=pS,Bd.raycast(t,Lf);for(let s=0,a=Lf.length;s<a;s++){let o=Lf[s];o.instanceId=r,o.object=this,e.push(o)}Lf.length=0}}setColorAt(t,e){return this.instanceColor===null&&(this.instanceColor=new Vu(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t),this}setMatrixAt(t,e){return e.toArray(this.instanceMatrix.array,16*t),this}setMorphAt(t,e){let i=e.morphTargetInfluences,n=i.length+1;this.morphTexture===null&&(this.morphTexture=new Cn(new Float32Array(n*this.count),n,this.count,Hc,$e));let r=this.morphTexture.source.data.data,s=0;for(let l=0;l<i.length;l++)s+=i[l];let a=this.geometry.morphTargetsRelative?1:1-s,o=n*t;return r[o]=a,r.set(i,o+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},bv=new T,YR=new T,ZR=new ue,jr=class{constructor(t=new T(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){let n=bv.subVectors(i,e).cross(YR.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e,i=!0){let n=t.delta(bv),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let s=-(t.start.dot(this.normal)+this.constant)/r;return i===!0&&(s<0||s>1)?null:e.copy(t.start).addScaledVector(n,s)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||ZR.getNormalMatrix(t),n=this.coplanarPoint(bv).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},Rl=new vr,KR=new et(.5,.5),Bf=new T,Y_=class{constructor(t=new jr,e=new jr,i=new jr,n=new jr,r=new jr,s=new jr){this.planes=[t,e,i,n,r,s]}set(t,e,i,n,r,s){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(s),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=oa,i=!1){let n=this.planes,r=t.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],d=r[6],u=r[7],p=r[8],f=r[9],g=r[10],m=r[11],v=r[12],y=r[13],_=r[14],b=r[15];if(n[0].setComponents(l-s,u-c,m-p,b-v).normalize(),n[1].setComponents(l+s,u+c,m+p,b+v).normalize(),n[2].setComponents(l+a,u+h,m+f,b+y).normalize(),n[3].setComponents(l-a,u-h,m-f,b-y).normalize(),i)n[4].setComponents(o,d,g,_).normalize(),n[5].setComponents(l-o,u-d,m-g,b-_).normalize();else if(n[4].setComponents(l-o,u-d,m-g,b-_).normalize(),e===oa)n[5].setComponents(l+o,u+d,m+g,b+_).normalize();else{if(e!==Pd)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(o,d,g,_).normalize()}return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),Rl.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Rl.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Rl)}intersectsSprite(t){Rl.center.set(0,0,0);let e=KR.distanceTo(t.center);return Rl.radius=.7071067811865476+e,Rl.applyMatrix4(t.matrixWorld),this.intersectsSphere(Rl)}intersectsSphere(t){let e=this.planes,i=t.center,n=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(i)<n)return!1;return!0}intersectsBox(t){let e=this.planes;for(let i=0;i<6;i++){let n=e[i];if(Bf.x=n.normal.x>0?t.max.x:t.min.x,Bf.y=n.normal.y>0?t.max.y:t.min.y,Bf.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Bf)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},Wo=class extends ic{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Jt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}},pg=new T,fg=new T,mS=new Et,zd=new il,Uf=new vr,R1=new T,eA=new T,Um=class extends xi{constructor(t=new jt,e=new Wo){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,i=[0];for(let n=1,r=e.count;n<r;n++)pg.fromBufferAttribute(e,n-1),fg.fromBufferAttribute(e,n),i[n]=i[n-1],i[n]+=pg.distanceTo(fg);t.setAttribute("lineDistance",new kt(i,1))}else ce("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){let i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold,s=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Uf.copy(i.boundingSphere),Uf.applyMatrix4(n),Uf.radius+=r,t.ray.intersectsSphere(Uf)===!1)return;mS.copy(n).invert(),zd.copy(t.ray).applyMatrix4(mS);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,c=i.index,h=i.attributes.position;if(c!==null){let d=Math.max(0,s.start),u=Math.min(c.count,s.start+s.count);for(let p=d,f=u-1;p<f;p+=l){let g=c.getX(p),m=c.getX(p+1),v=Y0(this,t,zd,o,g,m,p);v&&e.push(v)}if(this.isLineLoop){let p=c.getX(u-1),f=c.getX(d),g=Y0(this,t,zd,o,p,f,u-1);g&&e.push(g)}}else{let d=Math.max(0,s.start),u=Math.min(h.count,s.start+s.count);for(let p=d,f=u-1;p<f;p+=l){let g=Y0(this,t,zd,o,p,p+1,p);g&&e.push(g)}if(this.isLineLoop){let p=Y0(this,t,zd,o,u-1,d,u-1);p&&e.push(p)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){let i=t[e[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=i.length;n<r;n++){let s=i[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=n}}}}},gS=new T,vS=new T,Au=class extends Um{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(t.index===null){let e=t.attributes.position,i=[];for(let n=0,r=e.count;n<r;n+=2)gS.fromBufferAttribute(e,n),vS.fromBufferAttribute(e,n+1),i[n]=n===0?0:i[n-1],i[n+1]=i[n]+gS.distanceTo(vS);t.setAttribute("lineDistance",new kt(i,1))}else ce("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},NF=class extends ki{constructor(t,e,i,n,r=de,s=de,a,o,l){super(t,e,i,n,r,s,a,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let c=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function h(){c.needsUpdate=!0,c._requestVideoFrameCallbackId=t.requestVideoFrameCallback(h)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;"requestVideoFrameCallback"in t==0&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},Z_=class extends ki{constructor(t=[],e=Gc,i,n,r,s,a,o,l,c){super(t,e,i,n,r,s,a,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},kF=class extends ki{constructor(t,e,i,n,r,s,a,o,l){super(t,e,i,n,r,s,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},va=class extends ki{constructor(t,e,i=Ws,n,r,s,a=De,o=De,l,c=el,h=1){if(c!==el&&c!==Jl)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:h},n,r,s,a,o,c,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new rv(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},VF=class extends va{constructor(t,e=Ws,i=Gc,n,r,s=De,a=De,o,l=el){let c={width:t,height:t,depth:1},h=[c,c,c,c,c,c];super(t,t,e,i,n,r,s,a,o,l),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}},ya=class extends jt{constructor(t=1,e=1,i=1,n=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:s};let a=this;n=Math.floor(n),r=Math.floor(r),s=Math.floor(s);let o=[],l=[],c=[],h=[],d=0,u=0;function p(f,g,m,v,y,_,b,x,w,S,E){let A=_/w,P=b/S,C=_/2,R=b/2,O=x/2,D=w+1,F=S+1,V=0,U=0,j=new T;for(let q=0;q<F;q++){let rt=q*P-R;for(let it=0;it<D;it++){let Y=it*A-C;j[f]=Y*v,j[g]=rt*y,j[m]=O,l.push(j.x,j.y,j.z),j[f]=0,j[g]=0,j[m]=x>0?1:-1,c.push(j.x,j.y,j.z),h.push(it/w),h.push(1-q/S),V+=1}}for(let q=0;q<S;q++)for(let rt=0;rt<w;rt++){let it=d+rt+D*q,Y=d+rt+D*(q+1),ht=d+(rt+1)+D*(q+1),ot=d+(rt+1)+D*q;o.push(it,Y,ot),o.push(Y,ht,ot),U+=6}a.addGroup(u,U,E),u+=U,d+=V}p("z","y","x",-1,-1,i,e,t,s,r,0),p("z","y","x",1,-1,i,e,-t,s,r,1),p("x","z","y",1,1,t,i,e,n,s,2),p("x","z","y",1,-1,t,i,-e,n,s,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new kt(l,3)),this.setAttribute("normal",new kt(c,3)),this.setAttribute("uv",new kt(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ya(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},mg=class extends jt{constructor(t=1,e=1,i=1,n=32,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};let l=this;n=Math.floor(n),r=Math.floor(r);let c=[],h=[],d=[],u=[],p=0,f=[],g=i/2,m=0;function v(y){let _=p,b=new et,x=new T,w=0,S=y===!0?t:e,E=y===!0?1:-1;for(let P=1;P<=n;P++)h.push(0,g*E,0),d.push(0,E,0),u.push(.5,.5),p++;let A=p;for(let P=0;P<=n;P++){let C=P/n*o+a,R=Math.cos(C),O=Math.sin(C);x.x=S*O,x.y=g*E,x.z=S*R,h.push(x.x,x.y,x.z),d.push(0,E,0),b.x=.5*R+.5,b.y=.5*O*E+.5,u.push(b.x,b.y),p++}for(let P=0;P<n;P++){let C=_+P,R=A+P;y===!0?c.push(R,R+1,C):c.push(R+1,R,C),w+=3}l.addGroup(m,w,y===!0?1:2),m+=w}(function(){let y=new T,_=new T,b=0,x=(e-t)/i;for(let w=0;w<=r;w++){let S=[],E=w/r,A=E*(e-t)+t;for(let P=0;P<=n;P++){let C=P/n,R=C*o+a,O=Math.sin(R),D=Math.cos(R);_.x=A*O,_.y=-E*i+g,_.z=A*D,h.push(_.x,_.y,_.z),y.set(O,x,D).normalize(),d.push(y.x,y.y,y.z),u.push(C,1-E),S.push(p++)}f.push(S)}for(let w=0;w<n;w++)for(let S=0;S<r;S++){let E=f[S][w],A=f[S+1][w],P=f[S+1][w+1],C=f[S][w+1];(t>0||S!==0)&&(c.push(E,A,C),b+=3),(e>0||S!==r-1)&&(c.push(A,P,C),b+=3)}l.addGroup(m,b,0),m+=b})(),s===!1&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new kt(h,3)),this.setAttribute("normal",new kt(d,3)),this.setAttribute("uv",new kt(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new mg(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},K_=class extends mg{constructor(t=1,e=1,i=32,n=1,r=!1,s=0,a=2*Math.PI){super(0,t,e,i,n,r,s,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(t){return new K_(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},xv=class extends jt{constructor(t=[],e=[],i=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n};let r=[],s=[];function a(u,p,f,g){let m=g+1,v=[];for(let y=0;y<=m;y++){v[y]=[];let _=u.clone().lerp(f,y/m),b=p.clone().lerp(f,y/m),x=m-y;for(let w=0;w<=x;w++)v[y][w]=w===0&&y===m?_:_.clone().lerp(b,w/x)}for(let y=0;y<m;y++)for(let _=0;_<2*(m-y)-1;_++){let b=Math.floor(_/2);_%2==0?(o(v[y][b+1]),o(v[y+1][b]),o(v[y][b])):(o(v[y][b+1]),o(v[y+1][b+1]),o(v[y+1][b]))}}function o(u){r.push(u.x,u.y,u.z)}function l(u,p){let f=3*u;p.x=t[f+0],p.y=t[f+1],p.z=t[f+2]}function c(u,p,f,g){g<0&&u.x===1&&(s[p]=u.x-1),f.x===0&&f.z===0&&(s[p]=g/2/Math.PI+.5)}function h(u){return Math.atan2(u.z,-u.x)}function d(u){return Math.atan2(-u.y,Math.sqrt(u.x*u.x+u.z*u.z))}(function(u){let p=new T,f=new T,g=new T;for(let m=0;m<e.length;m+=3)l(e[m+0],p),l(e[m+1],f),l(e[m+2],g),a(p,f,g,u)})(n),function(u){let p=new T;for(let f=0;f<r.length;f+=3)p.x=r[f+0],p.y=r[f+1],p.z=r[f+2],p.normalize().multiplyScalar(u),r[f+0]=p.x,r[f+1]=p.y,r[f+2]=p.z}(i),function(){let u=new T;for(let p=0;p<r.length;p+=3){u.x=r[p+0],u.y=r[p+1],u.z=r[p+2];let f=h(u)/2/Math.PI+.5,g=d(u)/Math.PI+.5;s.push(f,1-g)}(function(){let p=new T,f=new T,g=new T,m=new T,v=new et,y=new et,_=new et;for(let b=0,x=0;b<r.length;b+=9,x+=6){p.set(r[b+0],r[b+1],r[b+2]),f.set(r[b+3],r[b+4],r[b+5]),g.set(r[b+6],r[b+7],r[b+8]),v.set(s[x+0],s[x+1]),y.set(s[x+2],s[x+3]),_.set(s[x+4],s[x+5]),m.copy(p).add(f).add(g).divideScalar(3);let w=h(m);c(v,x+0,p,w),c(y,x+2,f,w),c(_,x+4,g,w)}})(),function(){for(let p=0;p<s.length;p+=6){let f=s[p+0],g=s[p+2],m=s[p+4],v=Math.max(f,g,m),y=Math.min(f,g,m);v>.9&&y<.1&&(f<.2&&(s[p+0]+=1),g<.2&&(s[p+2]+=1),m<.2&&(s[p+4]+=1))}}()}(),this.setAttribute("position",new kt(r,3)),this.setAttribute("normal",new kt(r.slice(),3)),this.setAttribute("uv",new kt(s,2)),n===0?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new xv(t.vertices,t.indices,t.radius,t.detail)}},iA=class extends xv{constructor(t=1,e=0){let i=(1+Math.sqrt(5))/2,n=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new iA(t.radius,t.detail)}},Js=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ce("Curve: .getPoint() not implemented.")}getPointAt(t,e){let i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e,i=[],n=this.getPoint(0),r=0;i.push(0);for(let s=1;s<=t;s++)e=this.getPoint(s/t),r+=e.distanceTo(n),i.push(r),n=e;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){let i,n=this.getLengths(),r=0,s=n.length;i=e||t*n[s-1];let a,o=0,l=s-1;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),a=n[r]-i,a<0)o=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(r=l,n[r]===i)return r/(s-1);let c=n[r];return(r+(i-c)/(n[r+1]-c))/(s-1)}getTangent(t,e){let i=t-1e-4,n=t+1e-4;i<0&&(i=0),n>1&&(n=1);let r=this.getPoint(i),s=this.getPoint(n),a=e||(r.isVector2?new et:new T);return a.copy(s).sub(r).normalize(),a}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){let i=new T,n=[],r=[],s=[],a=new T,o=new Et;for(let u=0;u<=t;u++){let p=u/t;n[u]=this.getTangentAt(p,new T)}r[0]=new T,s[0]=new T;let l=Number.MAX_VALUE,c=Math.abs(n[0].x),h=Math.abs(n[0].y),d=Math.abs(n[0].z);c<=l&&(l=c,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),d<=l&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],a),s[0].crossVectors(n[0],r[0]);for(let u=1;u<=t;u++){if(r[u]=r[u-1].clone(),s[u]=s[u-1].clone(),a.crossVectors(n[u-1],n[u]),a.length()>Number.EPSILON){a.normalize();let p=Math.acos(ge(n[u-1].dot(n[u]),-1,1));r[u].applyMatrix4(o.makeRotationAxis(a,p))}s[u].crossVectors(n[u],r[u])}if(e===!0){let u=Math.acos(ge(r[0].dot(r[t]),-1,1));u/=t,n[0].dot(a.crossVectors(r[0],r[t]))>0&&(u=-u);for(let p=1;p<=t;p++)r[p].applyMatrix4(o.makeRotationAxis(n[p],u*p)),s[p].crossVectors(n[p],r[p])}return{tangents:n,normals:r,binormals:s}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},zm=class extends Js{constructor(t=0,e=0,i=1,n=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new et){let i=e,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=s?0:n),this.aClockwise===!0&&!s&&(r===n?r=-n:r-=n);let a=this.aStartAngle+t*r,o=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=o-this.aX,u=l-this.aY;o=d*c-u*h+this.aX,l=d*h+u*c+this.aY}return i.set(o,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}},QR=class extends zm{constructor(t,e,i,n,r,s){super(t,e,i,i,n,r,s),this.isArcCurve=!0,this.type="ArcCurve"}},yS=new T,_S=new T,wv=new Xw,Sv=new Xw,Mv=new Xw,JR=class extends Js{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new T){let i,n,r=e,s=this.points,a=s.length,o=(a-(this.closed?0:1))*t,l=Math.floor(o),c=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/a)+1)*a:c===0&&l===a-1&&(l=a-2,c=1),this.closed||l>0?i=s[(l-1)%a]:(_S.subVectors(s[0],s[1]).add(s[0]),i=_S);let h=s[l%a],d=s[(l+1)%a];if(this.closed||l+2<a?n=s[(l+2)%a]:(yS.subVectors(s[a-1],s[a-2]).add(s[a-1]),n=yS),this.curveType==="centripetal"||this.curveType==="chordal"){let u=this.curveType==="chordal"?.5:.25,p=Math.pow(i.distanceToSquared(h),u),f=Math.pow(h.distanceToSquared(d),u),g=Math.pow(d.distanceToSquared(n),u);f<1e-4&&(f=1),p<1e-4&&(p=f),g<1e-4&&(g=f),wv.initNonuniformCatmullRom(i.x,h.x,d.x,n.x,p,f,g),Sv.initNonuniformCatmullRom(i.y,h.y,d.y,n.y,p,f,g),Mv.initNonuniformCatmullRom(i.z,h.z,d.z,n.z,p,f,g)}else this.curveType==="catmullrom"&&(wv.initCatmullRom(i.x,h.x,d.x,n.x,this.tension),Sv.initCatmullRom(i.y,h.y,d.y,n.y,this.tension),Mv.initCatmullRom(i.z,h.z,d.z,n.z,this.tension));return r.set(wv.calc(c),Sv.calc(c),Mv.calc(c)),r}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let n=t.points[e];this.points.push(new T().fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},ks=class extends Js{constructor(t=new et,e=new et,i=new et,n=new et){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new et){let i=e,n=this.v0,r=this.v1,s=this.v2,a=this.v3;return i.set(bf(t,n.x,r.x,s.x,a.x),bf(t,n.y,r.y,s.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},gg=class extends Js{constructor(t=new T,e=new T,i=new T,n=new T){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new T){let i=e,n=this.v0,r=this.v1,s=this.v2,a=this.v3;return i.set(bf(t,n.x,r.x,s.x,a.x),bf(t,n.y,r.y,s.y,a.y),bf(t,n.z,r.z,s.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},gs=class extends Js{constructor(t=new et,e=new et){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new et){let i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new et){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},nA=class extends Js{constructor(t=new T,e=new T){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new T){let i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new T){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Ko=class extends Js{constructor(t=new et,e=new et,i=new et){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new et){let i=e,n=this.v0,r=this.v1,s=this.v2;return i.set(_f(t,n.x,r.x,s.x),_f(t,n.y,r.y,s.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},tO=class extends Js{constructor(t=new T,e=new T,i=new T){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new T){let i=e,n=this.v0,r=this.v1,s=this.v2;return i.set(_f(t,n.x,r.x,s.x),_f(t,n.y,r.y,s.y),_f(t,n.z,r.z,s.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},O1=class extends Js{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new et){let i=e,n=this.points,r=(n.length-1)*t,s=Math.floor(r),a=r-s,o=n[s===0?s:s-1],l=n[s],c=n[s>n.length-2?n.length-1:s+1],h=n[s>n.length-3?n.length-1:s+2];return i.set(SR(a,o.x,l.x,c.x,h.x),SR(a,o.y,l.y,c.y,h.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let n=t.points[e];this.points.push(n.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let n=t.points[e];this.points.push(new et().fromArray(n))}return this}},bS=Object.freeze({__proto__:null,ArcCurve:QR,CatmullRomCurve3:JR,CubicBezierCurve:ks,CubicBezierCurve3:gg,EllipseCurve:zm,LineCurve:gs,LineCurve3:nA,QuadraticBezierCurve:Ko,QuadraticBezierCurve3:tO,SplineCurve:O1}),rA=class extends Js{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){let i=t.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new bS[i](e,t))}return this}getPoint(t,e){let i=t*this.getLength(),n=this.getCurveLengths(),r=0;for(;r<n.length;){if(n[r]>=i){let s=n[r]-i,a=this.curves[r],o=a.getLength(),l=o===0?0:1-s/o;return a.getPointAt(l,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let t=[],e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e,i=[];for(let n=0,r=this.curves;n<r.length;n++){let s=r[n],a=s.isEllipseCurve?2*t:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?t*s.points.length:t,o=s.getPoints(a);for(let l=0;l<o.length;l++){let c=o[l];e&&e.equals(c)||(i.push(c),e=c)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){let n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let n=t.curves[e];this.curves.push(new bS[n.type]().fromJSON(n))}return this}},vg=class extends rA{constructor(t){super(),this.type="Path",this.currentPoint=new et,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let i=new gs(this.currentPoint.clone(),new et(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){let r=new Ko(this.currentPoint.clone(),new et(t,e),new et(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,r,s){let a=new ks(this.currentPoint.clone(),new et(t,e),new et(i,n),new et(r,s));return this.curves.push(a),this.currentPoint.set(r,s),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),i=new O1(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,r,s){let a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,i,n,r,s),this}absarc(t,e,i,n,r,s){return this.absellipse(t,e,i,i,n,r,s),this}ellipse(t,e,i,n,r,s,a,o){let l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,i,n,r,s,a,o),this}absellipse(t,e,i,n,r,s,a,o){let l=new zm(t,e,i,n,r,s,a,o);if(this.curves.length>0){let h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);let c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}},Xg=class extends vg{constructor(t){super(t),this.uuid=Ts(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){let n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let n=t.holes[e];this.holes.push(new vg().fromJSON(n))}return this}},eO=class{static triangulate(t,e,i=2){return function(n,r,s=2){let a,o,l,c=r&&r.length,h=c?r[0]*s:n.length,d=MR(n,0,h,s,!0),u=[];if(!d||d.next===d.prev)return u;if(c&&(d=function(p,f,g,m){let v=[];for(let y=0,_=f.length;y<_;y++){let b=MR(p,f[y]*m,y<_-1?f[y+1]*m:p.length,m,!1);b===b.next&&(b.steiner=!0),v.push(QX(b))}v.sort(YX);for(let y=0;y<v.length;y++)g=ZX(v[y],g);return g}(n,r,d,s)),n.length>80*s){a=n[0],o=n[1];let p=a,f=o;for(let g=s;g<h;g+=s){let m=n[g],v=n[g+1];m<a&&(a=m),v<o&&(o=v),m>p&&(p=m),v>f&&(f=v)}l=Math.max(p-a,f-o),l=l!==0?32767/l:0}return Vg(d,u,s,a,o,l,0),u}(t,e,i)}},sA=class{static area(t){let e=t.length,i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return .5*i}static isClockWise(t){return sA.area(t)<0}static triangulateShape(t,e){let i=[],n=[],r=[];AR(t),TR(i,t);let s=t.length;e.forEach(AR);for(let o=0;o<e.length;o++)n.push(s),s+=e[o].length,TR(i,e[o]);let a=eO.triangulate(i,n);for(let o=0;o<a.length;o+=3)r.push(a.slice(o,o+3));return r}},aA=class extends xv{constructor(t=1,e=0){let i=(1+Math.sqrt(5))/2;super([-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new aA(t.radius,t.detail)}},oA=class extends jt{constructor(t=[new et(0,-.5),new et(.5,0),new et(0,.5)],e=12,i=0,n=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},e=Math.floor(e),n=ge(n,0,2*Math.PI);let r=[],s=[],a=[],o=[],l=[],c=1/e,h=new T,d=new et,u=new T,p=new T,f=new T,g=0,m=0;for(let v=0;v<=t.length-1;v++)switch(v){case 0:g=t[v+1].x-t[v].x,m=t[v+1].y-t[v].y,u.x=1*m,u.y=-g,u.z=0*m,f.copy(u),u.normalize(),o.push(u.x,u.y,u.z);break;case t.length-1:o.push(f.x,f.y,f.z);break;default:g=t[v+1].x-t[v].x,m=t[v+1].y-t[v].y,u.x=1*m,u.y=-g,u.z=0*m,p.copy(u),u.x+=f.x,u.y+=f.y,u.z+=f.z,u.normalize(),o.push(u.x,u.y,u.z),f.copy(p)}for(let v=0;v<=e;v++){let y=i+v*c*n,_=Math.sin(y),b=Math.cos(y);for(let x=0;x<=t.length-1;x++){h.x=t[x].x*_,h.y=t[x].y,h.z=t[x].x*b,s.push(h.x,h.y,h.z),d.x=v/e,d.y=x/(t.length-1),a.push(d.x,d.y);let w=o[3*x+0]*_,S=o[3*x+1],E=o[3*x+0]*b;l.push(w,S,E)}}for(let v=0;v<e;v++)for(let y=0;y<t.length-1;y++){let _=y+v*t.length,b=_,x=_+t.length,w=_+t.length+1,S=_+1;r.push(b,x,S),r.push(w,S,x)}this.setIndex(r),this.setAttribute("position",new kt(s,3)),this.setAttribute("uv",new kt(a,2)),this.setAttribute("normal",new kt(l,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new oA(t.points,t.segments,t.phiStart,t.phiLength)}},uo=class extends jt{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};let r=t/2,s=e/2,a=Math.floor(i),o=Math.floor(n),l=a+1,c=o+1,h=t/a,d=e/o,u=[],p=[],f=[],g=[];for(let m=0;m<c;m++){let v=m*d-s;for(let y=0;y<l;y++){let _=y*h-r;p.push(_,-v,0),f.push(0,0,1),g.push(y/a),g.push(1-m/o)}}for(let m=0;m<o;m++)for(let v=0;v<a;v++){let y=v+l*m,_=v+l*(m+1),b=v+1+l*(m+1),x=v+1+l*m;u.push(y,_,x),u.push(_,b,x)}this.setIndex(u),this.setAttribute("position",new kt(p,3)),this.setAttribute("normal",new kt(f,3)),this.setAttribute("uv",new kt(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new uo(t.width,t.height,t.widthSegments,t.heightSegments)}},gh=class extends jt{constructor(t=1,e=32,i=16,n=0,r=2*Math.PI,s=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:s,thetaLength:a},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));let o=Math.min(s+a,Math.PI),l=0,c=[],h=new T,d=new T,u=[],p=[],f=[],g=[];for(let m=0;m<=i;m++){let v=[],y=m/i,_=s+y*a,b=t*Math.cos(_),x=Math.sqrt(t*t-b*b),w=0;m===0&&s===0?w=.5/e:m===i&&o===Math.PI&&(w=-.5/e);for(let S=0;S<=e;S++){let E=S/e,A=n+E*r;h.x=-x*Math.cos(A),h.y=b,h.z=x*Math.sin(A),p.push(h.x,h.y,h.z),d.copy(h).normalize(),f.push(d.x,d.y,d.z),g.push(E+w,1-y),v.push(l++)}c.push(v)}for(let m=0;m<i;m++)for(let v=0;v<e;v++){let y=c[m][v+1],_=c[m][v],b=c[m+1][v],x=c[m+1][v+1];(m!==0||s>0)&&u.push(y,_,x),(m!==i-1||o<Math.PI)&&u.push(_,b,x)}this.setIndex(u),this.setAttribute("position",new kt(p,3)),this.setAttribute("normal",new kt(f,3)),this.setAttribute("uv",new kt(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new gh(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},Q_=class extends jt{constructor(t=1,e=.4,i=12,n=48,r=2*Math.PI,s=0,a=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:r,thetaStart:s,thetaLength:a},i=Math.floor(i),n=Math.floor(n);let o=[],l=[],c=[],h=[],d=new T,u=new T,p=new T;for(let f=0;f<=i;f++){let g=s+f/i*a;for(let m=0;m<=n;m++){let v=m/n*r;u.x=(t+e*Math.cos(g))*Math.cos(v),u.y=(t+e*Math.cos(g))*Math.sin(v),u.z=e*Math.sin(g),l.push(u.x,u.y,u.z),d.x=t*Math.cos(v),d.y=t*Math.sin(v),p.subVectors(u,d).normalize(),c.push(p.x,p.y,p.z),h.push(m/n),h.push(f/i)}}for(let f=1;f<=i;f++)for(let g=1;g<=n;g++){let m=(n+1)*f+g-1,v=(n+1)*(f-1)+g-1,y=(n+1)*(f-1)+g,_=(n+1)*f+g;o.push(m,v,_),o.push(v,y,_)}this.setIndex(o),this.setAttribute("position",new kt(l,3)),this.setAttribute("normal",new kt(c,3)),this.setAttribute("uv",new kt(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Q_(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},lA=class extends jt{constructor(t=1,e=.4,i=64,n=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:s},i=Math.floor(i),n=Math.floor(n);let a=[],o=[],l=[],c=[],h=new T,d=new T,u=new T,p=new T,f=new T,g=new T,m=new T;for(let y=0;y<=i;++y){let _=y/i*r*Math.PI*2;v(_,r,s,t,u),v(_+.01,r,s,t,p),g.subVectors(p,u),m.addVectors(p,u),f.crossVectors(g,m),m.crossVectors(f,g),f.normalize(),m.normalize();for(let b=0;b<=n;++b){let x=b/n*Math.PI*2,w=-e*Math.cos(x),S=e*Math.sin(x);h.x=u.x+(w*m.x+S*f.x),h.y=u.y+(w*m.y+S*f.y),h.z=u.z+(w*m.z+S*f.z),o.push(h.x,h.y,h.z),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(y/i),c.push(b/n)}}for(let y=1;y<=i;y++)for(let _=1;_<=n;_++){let b=(n+1)*(y-1)+(_-1),x=(n+1)*y+(_-1),w=(n+1)*y+_,S=(n+1)*(y-1)+_;a.push(b,x,S),a.push(x,w,S)}function v(y,_,b,x,w){let S=Math.cos(y),E=Math.sin(y),A=b/_*y,P=Math.cos(A);w.x=x*(2+P)*.5*S,w.y=x*(2+P)*E*.5,w.z=x*Math.sin(A)*.5}this.setIndex(a),this.setAttribute("position",new kt(o,3)),this.setAttribute("normal",new kt(l,3)),this.setAttribute("uv",new kt(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new lA(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},jF=class extends ic{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Jt(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}},nd={clone:fp,merge:kr},Xe=class extends ic{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=`void main() {
|
|
37
37
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
38
38
|
}`,this.fragmentShader=`void main() {
|
|
@@ -4075,6 +4075,26 @@ void main() {
|
|
|
4075
4075
|
// until it is released; one that goes down on generated UI never forwards.
|
|
4076
4076
|
var forwardedPointers = {};
|
|
4077
4077
|
|
|
4078
|
+
// Touch: this frame covers the whole canvas, so on a phone every finger
|
|
4079
|
+
// lands in this document \u2014 where the host's \`touch-action: none\` on the
|
|
4080
|
+
// canvas can't reach. Left at the default, the browser claims the gesture
|
|
4081
|
+
// for itself: a one-finger drag scrolls the host page (and cancels the
|
|
4082
|
+
// forwarded pointer, so the orbit never starts) and a pinch zooms the
|
|
4083
|
+
// whole page instead of the camera. The scene owns gestures on the
|
|
4084
|
+
// background; a scrolling panel in the generated UI still scrolls (a
|
|
4085
|
+
// scroll container starts its own touch-action chain), and taps still
|
|
4086
|
+
// click. Not !important, so a document that wants page panning can say so.
|
|
4087
|
+
var touchStyle = document.createElement('style');
|
|
4088
|
+
touchStyle.textContent = 'html,body{touch-action:none}';
|
|
4089
|
+
(document.head || document.documentElement).appendChild(touchStyle);
|
|
4090
|
+
// Older iOS Safari pinch-zooms past touch-action; its gesture events are
|
|
4091
|
+
// the only way to stop that.
|
|
4092
|
+
['gesturestart', 'gesturechange'].forEach(function (type) {
|
|
4093
|
+
document.addEventListener(type, function (e) {
|
|
4094
|
+
e.preventDefault();
|
|
4095
|
+
});
|
|
4096
|
+
});
|
|
4097
|
+
|
|
4078
4098
|
function isBackground(target) {
|
|
4079
4099
|
if (!target || target === document || target === document.documentElement || target === document.body) {
|
|
4080
4100
|
return true;
|
|
@@ -4183,13 +4203,13 @@ void main() {
|
|
|
4183
4203
|
}
|
|
4184
4204
|
post({ kind: 'ready' });
|
|
4185
4205
|
}, 250);
|
|
4186
|
-
})();`});function Rv(t){return t==null||t===""?void 0:String(t)}var m3,IN=z(()=>{m3=class{constructor(t,e,i){this.deps=t,this.onConsole=e,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let i=this.deps;switch(t){case"setVariable":{let n=i.setVariable(String(e[0]),e[1]);return n.warning&&this.onConsole("warn",n.warning),n.ok}case"setVariables":{let n=e[0]??{},r=!0;for(let[s,a]of Object.entries(n)){let o=i.setVariable(s,a);o.warning&&this.onConsole("warn",o.warning),r=r&&o.ok}return r}case"getVariable":return i.getVariable(String(e[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(e[0]));case"getGeometry":{let n=i.getGeometry(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.data}case"updateObject":return i.updateObject(String(e[0]),e[1]??{});case"createObject":return i.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":if(i.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.createCustomMaterial(e[0]);case"getTexture":if(i.getTexture===void 0)throw new Error("getTexture: not available on this surface \u2014 a three.js texture instance needs the inline HTML-content mode (editor Preview/Play and web exports).");return i.getTexture(String(e[0]),e[1]??{});case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(e[0]),e[1]);case"cloneObject":return i.cloneObject(String(e[0]),e[1]??{});case"removeObject":return i.removeObject(String(e[0]));case"spawnObject":{let n=i.spawnObject(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.object}case"destroyObject":return i.destroyObject(String(e[0]));case"setInstanceTransforms":{let n=e[1]===null||e[1]===void 0?null:e[1],r=i.setInstanceTransforms(String(e[0]),n);return r<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),r}case"getAnimations":{let n=i.getAnimations(Rv(e[0]));return n.warning&&this.onConsole("warn",`spline.${t}: ${n.warning}`),n.clips}case"playAnimation":{let n=typeof e[1]=="object"&&e[1]!==null,r=i.playAnimation(String(e[0]),n?void 0:Rv(e[1]),(n?e[1]:e[2])??{});return r.warning&&this.onConsole("warn",`spline.${t}: ${r.warning}`),r.clip}case"pauseAnimation":case"stopAnimation":{let n=Rv(e[0]),r=Rv(e[1]),s=t==="pauseAnimation"?i.pauseAnimation(n,r):i.stopAnimation(n,r);return s.warning&&this.onConsole("warn",`spline.${t}: ${s.warning}`),s.ok}case"emitEvent":case"emitEventReverse":{let n=i.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return n.warning&&this.onConsole("warn",n.warning),n.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let n=String(e[0]);return n==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(n)||this.eventUnsubs.set(n,i.addSplineEventListener(n,r=>{this.onEvent(n,r)})),!0}case"unlistenEvent":{let n=String(e[0]);return n==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(n)?.(),this.eventUnsubs.delete(n)),!0}default:throw new Error(`Unknown spline bridge method: ${t}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=function(i,n){let r=[];for(let s of Object.keys(n))i[s]!==n[s]&&r.push({name:s,value:n[s]});return r}(this.lastVariables??{},t);this.lastVariables=t;for(let i of e)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function zY(t,e,i,n){return[t[0]*e+t[4]*i+t[8]*n+t[12],t[1]*e+t[5]*i+t[9]*n+t[13],t[2]*e+t[6]*i+t[10]*n+t[14]]}var FY=z(()=>{}),LN,NY=z(()=>{}),kY=z(()=>{f3(),IN(),LN=class{constructor(t,e,i){this.iframe=t,this.deps=e,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=n=>{if(this.disposed||n.source!==this.iframe.contentWindow)return;let r=n.data;var s;typeof(s=r)!="object"||s===null||s[ql]!==!0||typeof s.kind!="string"||this.handleMessage(r)},this.host=new m3(e,i,(n,r)=>{this.sendEvent(n,r)})}attach(){window.addEventListener("message",this.onMessage),this.send({[ql]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[ql]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(i){e=Promise.reject(i)}e.then(i=>{this.send({[ql]:!0,kind:"result",id:t.id,ok:!0,value:i,error:void 0})},i=>{let n=i instanceof Error?i.message:String(i);this.send({[ql]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(t.event)}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[ql]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let i=this.iframe.getBoundingClientRect(),n={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":e.dispatchEvent(new PointerEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break;case"click":case"dblclick":e.dispatchEvent(new MouseEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons}));break;case"wheel":{let r=new WheelEvent("wheel",{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(r,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(r,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(r);break}case"keydown":case"keyup":e.dispatchEvent(new KeyboardEvent(t.type,{...n,key:t.key,code:t.code,repeat:t.repeat}))}}}}),ti=z(()=>{p3(),wY(),SY(),MY(),AY(),TY(),CY(),PY(),DY(),RY(),OY(),BY(),f3(),UY(),IN(),FY(),NY(),kY()}),VY=z(()=>{});function BN(t){return Array.isArray(t)?t:[t]}function eb(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}var jY=z(()=>{});function Ar(t,e){return Object.setPrototypeOf(t,e),t}function IS(t){let e={...t};return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}function ih(t,e,i){if(t===void 0?e===void 0?(t=0,e=10):t=e-10:e===void 0&&(e=t+10),t>e){let s=t;t=e,e=s}let n=[],r=1/(i+1);for(let s=0;s<i;s++){let a=t+(e-t)*(s+.75+.5*Math.random())*r;n.push(a)}return n}function Qc(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}var GY=z(()=>{});function g3(t){if(t.deepFreeze!==void 0)return void t.deepFreeze(t);let e=Object.getOwnPropertyNames(t);for(let i of e){let n=t[i];n&&typeof n=="object"&&g3(n)}return Object.freeze(t)}function UN(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var LS,ib,EA,te,v3,HY=z(()=>{}),Dn=z(()=>{VY(),jY(),GY(),HY()}),y3=z(()=>{LS=class{},ib=class extends LS{constructor(t){super(),this.id=t}},EA=class extends LS{constructor(t){super(),this.data=t}}}),WY=z(()=>{}),Mx=z(()=>{te=class{modifyById(t,e){let i=this;if(i[t]===void 0)throw new Error("not expected");{let n={...i,[t]:e};return Object.setPrototypeOf(n,te.prototype),n}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let i,n=e[t.id];i=n===void 0?{type:2,id:t.id}:{type:1,id:t.id,data:n};let{id:r,data:s}=t,a={...e,[r]:s};return Object.setPrototypeOf(a,te.prototype),{data:a,actual:t,reverse:i}}if(t.type===2){let{id:i}=t,n=e[i];if(n===void 0)return null;{let r={...e};return Object.setPrototypeOf(r,te.prototype),delete r[i],{data:r,actual:t,reverse:{type:1,id:i,data:n}}}}return null}}}),_3=z(()=>{v3=class extends Error{}});function zN(t,e){for(let i of t)e(i.id,i.data)!==!0&&zN(i.children,e)}function FN(t,e){if(e(t.id,t.data)!==!0)for(let i of t.children)FN(i,e)}var qn,Ov,_p,Nt,sd=z(()=>{Dn(),_3(),Dn(),qn=class extends Array{constructor(...t){super(...t),to(this,"partialObjectCaches"),to(this,"objCaches"),to(this,"parentCaches"),Object.setPrototypeOf(this,qn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)g3(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}nonExistOrDescendantOf(t,e){if(!this.has(t))return!0;for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}rootAcestor(t){for(;t;){let e=this.parent(t);if(!e)return t;t=e}return t}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){return this.get(t)?.data}has(t){return this.childrenOf(t)!==void 0}partialCache(t){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let e=this.get(t);e!==void 0&&this.partialObjectCaches.set(t,e)}get(t){if(this.partialObjectCaches!==void 0){let e=this.partialObjectCaches.get(t);if(e!==void 0)return e}return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){return t===null?this:this.get(t)?.children}traverseFrom(t,e){if(t===null)this.traverse(e);else{let i=this.get(t);i&&FN(i,e)}}traverse(t){zN(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this.parent(t),n=this.childrenArray(i),r=n.findIndex(o=>o.id===t);if(r<0)throw new Error("not expected");let s=n[r];n=[...n],n[r]={...s,data:e};let a=new Map;return a.set(t,n[r]),this.modifyArrayBy(i,n,a)}}modifyArrayBy(t,e,i=void 0){let n=t,r=e;for(;n!==null;){let a=r,o=n;if(n=this.parent(n),n===void 0)throw new Error;r=this.childrenArray(n);let l=r.findIndex(c=>c.id===o);if(l<0)throw new Error;r=[...r],r[l]={...r[l],children:a},i&&i.set(o,r[l])}Object.setPrototypeOf(r,qn.prototype);let s=r;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){s.objCaches=this.objCaches;for(let[a,o]of i)s.objCaches.set(a,o);s.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else s.fillCaches();return s}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}return null}checkDuplicatedIdRec({id:t,children:e}){if(this.get(t)!==void 0)return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(t){let{parent:e,fi:i,id:n,data:r,children:s}=t;if(e!==null&&this.get(e)===void 0||this.checkDuplicatedIdRec(t))return null;{let a=e,o=this.childrenArray(a),l={fi:i,id:n,data:r,children:s};return o=[...o,l],o.sort((c,h)=>c.fi-h.fi),t.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:t,reverse:{type:8,id:n}}}}deleteOp(t){let{id:e}=t;if(this.get(e)===null)return null;{let i=this.parent(e);if(i===void 0)return null;let n=this.childrenArray(i),r=n.findIndex(a=>a.id===e);t.localIndex=r,n=[...n];let s=n.splice(r,1)[0];return{data:this.modifyArrayBy(i,n),actual:t,reverse:{type:7,...s,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:n}=t;if(e!==null&&this.get(e)===void 0)return this.deleteOp({type:8,id:n});if(e!==null){let d=e;for(;d!==null;){if(d===void 0)throw new Error;if(d===n)throw new v3("cyclic tree");d=this.parent(d)}}let r=this.parent(n);if(r===void 0)return null;let s=r,a=this.childrenArray(r),o=a.findIndex(d=>d.id===n);a=[...a];let l=a.splice(o,1)[0],c=this.modifyArrayBy(r,a);r=e,a=c.childrenArray(r);let h=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,u)=>d.fi-u.fi),t.localIndex=a.indexOf(l),c=c.modifyArrayBy(r,a),{data:c,actual:t,reverse:{type:9,parent:s,fi:h,id:n}}}previous(t,e){if(e===null){let n=this.childrenArray(t);return n.length===0?null:n[n.length-1].id}let i=null;for(let n of this.childrenArray(t)){if(n.id===e)return i;i=n.id}return null}traverseSortNext(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)+1;if(n<i.length)return i[n].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)-1;return n>=0?this.traverseSortPrevious(i[n].id):e}}getAllSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i.id);n!==void 0&&e.push({...i,...n})}e.sort((i,n)=>eb(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e}getAllIdSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i);n!==void 0&&e.push(n)}e.sort((i,n)=>eb(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e.map(i=>i.id)}getWithSortKey(t){let e=t,i=[],n=this.get(e),r=n;if(n!==void 0){for(;e;)i.splice(0,0,n.fi),e=this.parent(e),e!==null&&(n=this.get(e));return{...r,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let n=this.childrenArray(t);if(e===null){if(n.length===0)return ih(0,i,i);{let r=n[0].fi;return ih(r-i,r,i)}}{let r=this.get(e);if(r===void 0||this.parent(e)!==t)throw new Error("illegal args");let s=n.find(a=>a.fi>r.fi);if(s===void 0){let a=n[n.length-1].fi;return ih(a,a+i,i)}return ih(r.fi,s.fi,i)}}}}),b3=z(()=>{var t;Dn(),Ov=null,(t=_p||(_p={})).setPreservePrototype=function(e){Ov=e},t.tryPreservePrototype=function(e,i){return Object.getPrototypeOf(e)===Ov&&Object.setPrototypeOf(i,Ov),i},t.runOp=function(e,i){if(i.type!==0)return null;if(Array.isArray(e)||Qc(e)){let n=i.props,r={},s=Qc(e)?e.slice():[...e],a=!1;if(n)for(let o of Object.keys(n)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");r[o]=s[l],s[l]=n[o],a=!0}return a?{data:s,actual:i,reverse:{type:0,props:r}}:null}{let n=i.props,r={},s={...e},a=!1;if(n)for(let o of Object.keys(n)){r[o]=s[o];let l=n[o];l===void 0?delete s[o]:s[o]=l,a=!0}return a?{data:t.tryPreservePrototype(e,s),actual:i,reverse:{type:0,props:r}}:null}}}),ad=z(()=>{Dn(),Dn(),Nt=class extends Array{constructor(...t){super(...t),to(this,"objCaches"),Object.setPrototypeOf(this,Nt.prototype)}deepFreeze(){let t=0;for(;t<this.length;)g3(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){return this.get(t)?.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this,n=i.findIndex(s=>s.id===t);if(n<0)throw new Error("not expected");let r=i[n];return i=[...i],i[n]={...r,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,Nt.prototype);let e=t;return typeof process<"u"||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}return null}addOp(t){let{fi:e,id:i,data:n}=t,r=this,s={fi:e,id:i,data:n};return r=[...r,s],r.sort((a,o)=>a.fi-o.fi),t.localIndex=r.indexOf(s),{data:this.modifyArrayBy(r),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,n=i.findIndex(s=>s.id===e);if(n===-1)return null;t.localIndex=n,i=[...i];let r=i.splice(n,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...r}}}moveOp(t){let{fi:e,id:i}=t,n=this;n=[...n];let r=n.findIndex(o=>o.id===i);if(r===-1)return null;let s=n[r].fi,a={...n[r],fi:e};return n[r]=a,n.sort((o,l)=>o.fi-l.fi),t.localIndex=n.indexOf(a),{data:this.modifyArrayBy(n),actual:t,reverse:{type:6,fi:s,id:i}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(t===null){if(i.length===0)return ih(0,e,e);{let n=i[0].fi;return ih(n-e,n,e)}}{let n=this.get(t);if(n===void 0)throw new Error("illegal args");let r=i.find(s=>s.fi>n.fi);if(r===void 0){let s=i[i.length-1].fi;return ih(s,s+e,e)}return ih(n.fi,r.fi,e)}}}});function qY(t,e){let i={cur:[],result:[],len:0};return[t=Ju(t,e,i)??t,i.result]}function z1(t,e){return t===null?null:(t.cur[t.len]=e,t.len+=1,t)}function F1(t){t&&(t.len-=1)}function NN(t,e,i){let n=!1,r=t.map(s=>{let a=s.id,o=e[a];if(o!==void 0&&typeof o=="string"&&(n=!0,a=o,i!==null))throw new Error("not supported");let l=Ju(s.data,e,z1(i,a));F1(i),n=n||l!==void 0,l===void 0&&(l=s.data);let c=NN(s.children,e,i);return c!==void 0?n=!0:c=s.children,{...s,id:a,data:l,children:c}});if(n)return r}function Ju(t,e,i){if(t instanceof qn){let n=NN(t,e,i);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}if(t instanceof Nt)return function(n,r,s){let a=!1,o=n.map(l=>{let c=l.id,h=r[c];if(h!==void 0&&typeof h=="string"&&(a=!0,c=h,s!==null))throw new Error("not supported");let d=Ju(l.data,r,z1(s,c));return F1(s),a=a||d!==void 0,d===void 0&&(d=l.data),{...l,id:c,data:d}});if(a)return Object.setPrototypeOf(o,Object.getPrototypeOf(n)),o}(t,e,i);if(Array.isArray(t)){let n=!1,r=t.map((s,a)=>{let o=Ju(s,e,z1(i,a));return F1(i),n=n||o!==void 0,o===void 0&&(o=s),o});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(t&&typeof t=="object"&&!Qc(t)){let n={},r=!1;for(let[s,a]of Object.entries(t))if(s!=="name"&&s!=="variableId"){let o=e[s];if(typeof o=="string"){if(i!==null)throw new Error("not supported");r=!0,s=o}let l=Ju(a,e,z1(i,s));F1(i),r=r||l!==void 0,l===void 0&&(l=a),n[s]=l}else n[s]=a;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(typeof t=="string"){let n=e[t];return n!==void 0&&function(r){if(r===null)return null;r.result.push(r.cur.slice(0,r.len))}(i),n}}var kN=z(()=>{sd(),ad(),Dn()});function tp(t){return t&&typeof t=="object"&&t instanceof Zi}function x3(t,e){if(e===void 0)return;let i=!1,n=t.map(r=>{let s=r.id,a=bg(r.data,e[s]);if(i=i||a!==void 0,a===void 0&&(a=r.data),r.children){let o=x3(r.children,e);return o!==void 0?i=!0:o=r.children,{...r,id:s,data:a,children:o}}return{...r,id:s,data:a}});return i?n:void 0}function bg(t,e){if(!tp(e))return e;if(t instanceof qn){let i=x3(t,e);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}if(t instanceof Nt)return function(i,n){if(n===void 0)return;let r=!1,s=i.map(a=>{let o=a.id,l=bg(a.data,n[o]);return r=r||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return r?(Object.setPrototypeOf(s,Object.getPrototypeOf(i)),s):void 0}(t,e);if(Array.isArray(t)){let i=!1,n=t.map((r,s)=>{let a=bg(r,e[s]);return i=i||a!==void 0,a===void 0&&(a=r),a});return i?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(t instanceof Zi)return w3(t,e);if(t&&typeof t=="object"){let i={},n=!1;for(let[r,s]of Object.entries(t)){let a=bg(s,e[r]);n=n||a!==void 0,a===void 0&&(a=s),i[r]=a}return n?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}}function w3(t,e){if(t===void 0)return e;if(e===void 0)return t;if(!tp(e))return e;if(!tp(t))return vh.apply(t,e);let i=new Set;for(let r of Object.keys(t))i.add(r);for(let r of Object.keys(e))i.add(r);let n=new Zi;for(let r of i){let s=w3(t===void 0?void 0:t[r],e===void 0?void 0:e[r]);n[r]=s}return n}var Zi,vh,nb,tr,QO,Ex=z(()=>{var t;sd(),ad(),Ax(),Dn(),Zi=class{unusedFunOverridesTable(e){}runOp(e){let i=[],n=this,r=0,s={};for(;r<e.path.length;){if(i.push(n),n=n===void 0?void 0:n[e.path[r]],n!==void 0&&!tp(n))return null;r+=1}n=n?IS(n):new Zi;for(let[a,o]of Object.entries(e.props)){let l=n[a];s[a]=l,o===void 0?delete n[a]:n[a]=o}for(;r>0;){if(Object.keys(n).length===0){let a=i[r-1];a&&(n=IS(a),delete n[e.path[r-1]])}else{let a=i[r-1];if(a){let o=IS(a);o[e.path[r-1]]=n,n=o}else{let o=new Zi;o[e.path[r-1]]=n,n=o}}r-=1}return{data:Object.setPrototypeOf(n,Zi.prototype),actual:e,reverse:{...e,props:s}}}},(t=vh||(vh={})).apply=function(e,i){return bg(e,i)??e},t.merge=function(e,i){return w3(e,i)},t.filterOp=function(e,i){let n=0,r=i.path,s=e;for(;n<r.length&&s!==void 0;){if(s=Vn.zoomOnce(s,r[n]),s===void 0)return i;if(!tp(s))return;n+=1}if(s===void 0)return i;if(tp(s)){if(i.type===0){let a={...i.props};for(let o of Object.keys(s))delete a[o];return{...i,props:a}}if(i.type===1||i.type===4||i.type===7){let a=x3([i],s);return a?a[0]:i}return i}}}),XY=z(()=>{Dn(),Ax(),Mx(),sd(),_3(),b3(),ad(),kN(),Ex(),(nb||(nb={})).replaceProps=function(t,e){let i=Vn.zoom(e,t.path);if(typeof i=="object"){let n={};for(let r of Object.keys(t.props))n[r]=i[r];return{...t,props:n}}return{...t,props:{}}},(t=>{function e(r,s){let a=s.path,o=[];for(;;){let l;if(r instanceof Zi&&s.type===0&&(l=r.runOp({...s,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=r instanceof qn||r instanceof Nt||r instanceof te?r.runOp(s):_p.runOp(r,s)),l!==void 0){if(l!==null){let d=l.data;for(let u=o.length-1;u>=0;u--){let p=a[u],f=o[u];if(f instanceof qn){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Nt){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof te){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Zi){let g={...f,[p]:d};d=Object.setPrototypeOf(g,Zi.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)||Qc(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let g=d;d=Qc(f)?f.slice():[...f],d[p]=g}else d=_p.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let c,h=a[o.length];if(r instanceof qn){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else if(r instanceof Nt){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else r!==null&&(c=r[h]);if(c===void 0)return null;o.push(r),r=c}}function i(r,s){for(let a=0;a<r.length&&a<s.length;a++)if(r[a]!==s[a])return!0;return!1}function n(r,s){if(r.length!==s.length)return!1;for(let a=0;a<r.length;a++)if(r[a]!==s[a])return!1;return!0}t.drop=function(r,s){return{...r,path:r.path.slice(s)}},t.applySimple=function(r,s){return e(r,s)?.data??r},t.apply=e,t.pathDisjoint=i,t.pathEq=n,t.commutative=function(r,s){return i(r.path,s.path)},t.subsumed=function(r,s){return!(r.type!==0||s.type!==0||!n(r.path,s.path))&&Object.keys(r.props).every(a=>s.props[a]!==void 0)}})(tr||(tr={})),(t=>{function e(i,n){let r=i,s=[],a=[];for(let o of n)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,c;if(o.type===3?(l=Vn.zoom(r,[...o.path,o.id]),c=tr.apply(r,{...o,type:2})):(l=Vn.zoom(r,[...o.path,o.id,"value"]),c=tr.apply(r,o)),c!==null){r=c.data;let[h,d]=qY(r,{[o.id]:l});r=h;for(let u=0;u<d.length;u++){let p,f,g=d[u],m=g.pop();if(typeof m=="number"){let v=[m];for(let _=u+1;_<d.length;_++){let b=d[_],x=b[b.length-1];if(typeof x!="number"||!Vn.equal(g,b.slice(0,b.length-1)))break;v.push(x),d.splice(_,1)}let y=Vn.zoom(r,g);f=y.map((_,b)=>v.includes(b)?o.id:_),p=y,m=g.pop()}else p=l,(m==="alphaOverride"||m==="alpha")&&(p=l/100,Vn.zoom(r,g)[m]=p),f=o.id;s.push({type:0,path:g,props:{[m]:p}}),a.push({type:0,path:g,props:{[m]:f}})}a.push(c.reverse),s.push(c.actual)}}else{let l=tr.apply(r,o);l!==null&&(s.push(l.actual),r=l.data,a.push(l.reverse))}}catch(l){if(l instanceof v3)return null;throw l}return{data:r,actual:s,reverse:a.reverse()}}t.empty=function(){return[]},t.removePrefix=function(i,n){let r=[];for(let s of i){let[a,...o]=s.path;a===n&&r.push({...s,path:o})}return r},t.addPrefix=function(i,n){return i.map(r=>({...r,path:[n,...r.path]}))},t.concat=function(i,n){return[...i,...n]},t.compress=function(i,n){return[...i.filter(r=>!n.some(s=>tr.subsumed(r,s))),...n]},t.commutative=function(i,n){return i.every(r=>n.every(s=>tr.commutative(r,s)))},t.applyAll=function(i,n){for(let r of n){let s=e(i,r);s!==null&&(i=s.data)}return i},t.apply=e})(QO||(QO={}))});function JO(t,e){return t instanceof Zi?Object.setPrototypeOf(e,Zi.prototype):_p.tryPreservePrototype(t,e)}function BS(t,e,i){if(t.length>0){let n=t[t.length-1];if(n.type===0&&e.type===0&&Vn.equal(n.path,i))return void Object.assign(n.props,e.props)}t.push({...e,path:i})}function N1(t,e,i){return i instanceof qn?new f0(t,e,i):i instanceof Nt?new m0(t,e,i):i instanceof te?new Proxy(new jN(t,e,i),HN):i!==null&&typeof i=="object"?Qc(i)?i:new Proxy(new VN(t,e,i),GN):i}function jm(t){let e=new AA(t);return[N1(e,"",t),e]}function rb(t,e){let[i,n]=jm(t);return e(i),n.result()}function en(t){return t instanceof f0||t instanceof m0?t._current:t!==null&&typeof t=="object"?t[sb]:t}function Gm(t){if(t instanceof f0||t instanceof m0)return t._current;if(t!==null&&typeof t=="object"){let e=t[sb];return e!==void 0?e:t}return t}var sb,tI,Gf,jd,VN,jN,US,GN,HN,f0,m0,AA,Vn,WN=z(()=>{Mx(),sd(),b3(),ad(),Dn(),Ax(),Ex(),sb=Symbol(),tI=Symbol(),Gf=Symbol(),jd=class{reportOp(t,e,i=[]){let n=this;if(e===null)return;n._current=e.data;let r=i;for(;!(n instanceof AA);){let s=n._path,a=n._current;if(s!==""&&r.splice(0,0,s),n=n._parent,n===null)return;n.update(s,a)}n.push(r,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[Gf];i&&i(),delete this._children[t]}}}},VN=class extends jd{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=JO(this._current,{...this._current,[t]:e})}runOp(t){let e=_p.runOp(this._current,t);e!==null&&(e.data=JO(this._current,e.data)),this.reportOp(t,e,t.path)}},jN=class extends jd{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,te.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},US={get(t,e){if(e===Gf)return()=>{t._parent=null};if(e===sb)return t._current;if(e===tI)return t;let{_current:i,_children:n}=t;if(e==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[e];if(r!==void 0)return r;let s=i[e],a=N1(t,e,s);return a!==s?(n===void 0&&(n={},t._children=n),n[e]=a,a):s},has:(t,e)=>e in t._current,ownKeys:t=>Reflect.ownKeys(t._current),defineProperty(){throw Error("not supported")},getPrototypeOf:t=>Object.getPrototypeOf(t._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,n=Reflect.getOwnPropertyDescriptor(i,e);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:i[e]}}},GN={...US,set(t,e,i){let n={type:0,props:{[e]:en(i)??i}};return t.deleteChildren(e),t.runOp(n),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},HN={...US,set(t,e,i){return i===void 0?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty:(t,e)=>(t.runOp({type:2,id:e}),!0)},f0=class extends jd{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Gf]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=N1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}add(t,e,i,n,r){this.runOp({type:7,parent:t,fi:e,id:i,data:n,children:r})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}insertBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}moveAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}moveBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},m0=class extends jd{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Gf]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id,r=this._current[i].fi;t(this.data(this._current[i].id),n,r,i)}}find(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id;if(t(this.data(n),n))return this.get(n)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:i}=this._current.at(t);return{id:e,fi:i,data:this.data(e)}}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=N1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}},AA=class extends jd{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,i,n){BS(this.ts,e,t),BS(this.actual,i,t),BS(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),Ax=z(()=>{y3(),WN(),ad(),sd(),Dn(),(t=>{function e(n,r){return(n instanceof qn||n instanceof f0)&&typeof r=="string"||(n instanceof Nt||n instanceof m0)&&typeof r=="string"?n.data(r):typeof r=="number"&&Array.isArray(n)||typeof r=="string"&&typeof n=="object"&&n!==null?n[r]:void 0}function i(n,r,s=0){for(;s<r.length&&n!==void 0;)n=e(n,r[s]),s+=1;return n}t.equal=function(n,r){if(r.length!==n.length)return!1;{let s=0;for(;s<n.length;){if(n[s]!==r[s])return!1;s+=1}}return!0},t.removeOverridden=function(n,r,s){let a=i(s,n);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...r};return Object.keys(a).forEach(l=>{delete o[l]}),o}return r},t.zoomOnce=e,t.zoom=i,t.findPathes=function(n,r){let s=[];return function a(o,l){if(o instanceof ib&&o.id===r.id)s.push(l);else if(o instanceof Nt)for(let c=0;c<o.length;c++)a(o[c].data,[...l,o[c].id]);else if(o instanceof qn)o.traverse((c,h)=>{a(h,[...l,c])});else if(Array.isArray(o)){if(typeof o[0]=="number")return;for(let c=0;c<o.length;c++)a(o[c],[...l,c])}else{if(Qc(o))return;if(typeof o=="object"&&o!==null)for(let c in o)a(o[c],[...l,c])}}(n,[]),s}})(Vn||(Vn={}))}),$Y=z(()=>{});function ri(t,e){let i=[];if(!(e.length<=t.length))return null;{let n=0;for(;n<e.length;){if(e[n]==="*")i.push(t[n]);else if(t[n]!==e[n])return null;n+=1}}return i}var YY=z(()=>{});function Iv(t){try{if(!wi.trusted&&!rl){let i=Qe.sharedLength||0;i<Qe.length&&(Qe.length=i)}let e;if(wi.randomAccessStructure&&Vt[ut]<64&&Vt[ut]>=32&&aI?(e=aI(Vt,ut,js,wi),Vt=null,!(t&&t.lazy)&&e&&(e=e.toJSON()),ut=js):e=yn(),yr&&(ut=yr.postBundlePosition,yr=null),rl&&(Qe.restoreStructures=null),ut==js)Qe&&Qe.restoreStructures&&eI(),Qe=null,Vt=null,nl&&(nl=null);else{if(ut>js)throw new Error("Unexpected end of MessagePack data");if(!rl){let i;try{i=JSON.stringify(e,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){i="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return e}catch(e){throw Qe&&Qe.restoreStructures&&eI(),CA(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||ut>js)&&(e.incomplete=!0),e}}function eI(){for(let t in Qe.restoreStructures)Qe[t]=Qe.restoreStructures[t];Qe.restoreStructures=null}function yn(){let t=Vt[ut++];if(t<160){if(t<128){if(t<64)return t;{let e=Qe[63&t]||wi.getStructures&&qN()[63&t];return e?(e.read||(e.read=TA(e,63&t)),e.read()):t}}if(t<144){if(t-=128,wi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=$N();n==="__proto__"&&(n="__proto_"),e[n]=yn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(yn(),yn());return e}}{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=yn();return wi.freezeData?Object.freeze(e):e}}if(t<192){let e=t-160;if(fa>=ut)return nh.slice(ut-vs,(ut+=e)-vs);if(fa==0&&js<140){let i=e<16?S3(e):XN(e);if(i!=null)return i}return lb(e)}{let e;switch(t){case 192:return null;case 193:return yr?(e=yn(),e>0?yr[1].slice(yr.position1,yr.position1+=e):yr[0].slice(yr.position0,yr.position0-=e)):KN;case 194:return!1;case 195:return!0;case 196:if(e=Vt[ut++],e===void 0)throw new Error("Unexpected end of buffer");return zS(e);case 197:return e=He.getUint16(ut),ut+=2,zS(e);case 198:return e=He.getUint32(ut),ut+=4,zS(e);case 199:return oc(Vt[ut++]);case 200:return e=He.getUint16(ut),ut+=2,oc(e);case 201:return e=He.getUint32(ut),ut+=4,oc(e);case 202:if(e=He.getFloat32(ut),wi.useFloat32>2){let i=LA[(127&Vt[ut])<<1|Vt[ut+1]>>7];return ut+=4,(i*e+(e>0?.5:-.5)|0)/i}return ut+=4,e;case 203:return e=He.getFloat64(ut),ut+=8,e;case 204:return Vt[ut++];case 205:return e=He.getUint16(ut),ut+=2,e;case 206:return e=He.getUint32(ut),ut+=4,e;case 207:return wi.int64AsType==="number"?(e=4294967296*He.getUint32(ut),e+=He.getUint32(ut+4)):wi.int64AsType==="string"?e=He.getBigUint64(ut).toString():wi.int64AsType==="auto"?(e=He.getBigUint64(ut),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigUint64(ut),ut+=8,e;case 208:return He.getInt8(ut++);case 209:return e=He.getInt16(ut),ut+=2,e;case 210:return e=He.getInt32(ut),ut+=4,e;case 211:return wi.int64AsType==="number"?(e=4294967296*He.getInt32(ut),e+=He.getUint32(ut+4)):wi.int64AsType==="string"?e=He.getBigInt64(ut).toString():wi.int64AsType==="auto"?(e=He.getBigInt64(ut),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigInt64(ut),ut+=8,e;case 212:if(e=Vt[ut++],e==114)return IA(63&Vt[ut++]);{let i=mr[e];if(i)return i.read?(ut++,i.read(yn())):i.noBuffer?(ut++,i()):i(Vt.subarray(ut,++ut));throw new Error("Unknown extension "+e)}case 213:return e=Vt[ut],e==114?(ut++,IA(63&Vt[ut++],Vt[ut++])):oc(2);case 214:return oc(4);case 215:return oc(8);case 216:return oc(16);case 217:return e=Vt[ut++],fa>=ut?nh.slice(ut-vs,(ut+=e)-vs):JN(e);case 218:return e=He.getUint16(ut),fa>=(ut+=2)?nh.slice(ut-vs,(ut+=e)-vs):tk(e);case 219:return e=He.getUint32(ut),fa>=(ut+=4)?nh.slice(ut-vs,(ut+=e)-vs):ek(e);case 220:return e=He.getUint16(ut),ut+=2,iI(e);case 221:return e=He.getUint32(ut),ut+=4,iI(e);case 222:return e=He.getUint16(ut),ut+=2,nI(e);case 223:return e=He.getUint32(ut),ut+=4,nI(e);default:if(t>=224)return t-256;if(t===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+t)}}}function TA(t,e){function i(){if(i.count++>DA){let r;try{r=t.read=new Function("r","return function(){return "+(wi.freezeData?"Object.freeze":"")+"({"+t.map(s=>s==="__proto__"?"__proto_:r()":QN.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(yn)}catch{return DA=1/0,i()}return t.read0=r,t.highByte===0&&(t.read=RA(e,t.read)),r()}let n={};for(let r=0,s=t.length;r<s;r++){let a=t[r];a==="__proto__"&&(a="__proto_"),n[a]=yn()}return wi.freezeData?Object.freeze(n):n}return i.count=0,t.read0=i,t.highByte===0?RA(e,i):i}function qN(){let t=ZN(()=>(Vt=null,wi.getStructures()));return Qe=wi._mergeStructures(t,Qe)}function Hm(t){let e;if(t<16&&(e=S3(t)))return e;if(t>64&&PA)return PA.decode(Vt.subarray(ut,ut+=t));let i=ut+t,n=[];for(e="";ut<i;){let r=Vt[ut++];if(128&r)if((224&r)==192){let s=(31&r)<<6|63&Vt[ut++];s<128?n.push(65533):n.push(s)}else if((240&r)==224){let s=(31&r)<<12|(63&Vt[ut++])<<6|63&Vt[ut++];s<2048||s>=55296&&s<=57343?n.push(65533):n.push(s)}else if((248&r)==240){let s=(7&r)<<18|(63&Vt[ut++])<<12|(63&Vt[ut++])<<6|63&Vt[ut++];s<65536||s>1114111?n.push(65533):(s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s))}else n.push(65533);else n.push(r);n.length>=4096&&(e+=Nn.apply(String,n),n.length=0)}return n.length>0&&(e+=Nn.apply(String,n)),e}function iI(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=yn();return wi.freezeData?Object.freeze(e):e}function nI(t){if(wi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=$N();n==="__proto__"&&(n="__proto_"),e[n]=yn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(yn(),yn());return e}}function XN(t){let e=ut,i=new Array(t);for(let n=0;n<t;n++){let r=Vt[ut++];if((128&r)>0)return void(ut=e);i[n]=r}return Nn.apply(String,i)}function S3(t){if(t<4){if(t<2){if(t===0)return"";{let e=Vt[ut++];return(128&e)>1?void(ut-=1):Nn(e)}}{let e=Vt[ut++],i=Vt[ut++];if((128&e)>0||(128&i)>0)return void(ut-=2);if(t<3)return Nn(e,i);let n=Vt[ut++];return(128&n)>0?void(ut-=3):Nn(e,i,n)}}{let e=Vt[ut++],i=Vt[ut++],n=Vt[ut++],r=Vt[ut++];if((128&e)>0||(128&i)>0||(128&n)>0||(128&r)>0)return void(ut-=4);if(t<6){if(t===4)return Nn(e,i,n,r);{let s=Vt[ut++];return(128&s)>0?void(ut-=5):Nn(e,i,n,r,s)}}if(t<8){let s=Vt[ut++],a=Vt[ut++];if((128&s)>0||(128&a)>0)return void(ut-=6);if(t<7)return Nn(e,i,n,r,s,a);let o=Vt[ut++];return(128&o)>0?void(ut-=7):Nn(e,i,n,r,s,a,o)}{let s=Vt[ut++],a=Vt[ut++],o=Vt[ut++],l=Vt[ut++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(ut-=8);if(t<10){if(t===8)return Nn(e,i,n,r,s,a,o,l);{let c=Vt[ut++];return(128&c)>0?void(ut-=9):Nn(e,i,n,r,s,a,o,l,c)}}if(t<12){let c=Vt[ut++],h=Vt[ut++];if((128&c)>0||(128&h)>0)return void(ut-=10);if(t<11)return Nn(e,i,n,r,s,a,o,l,c,h);let d=Vt[ut++];return(128&d)>0?void(ut-=11):Nn(e,i,n,r,s,a,o,l,c,h,d)}{let c=Vt[ut++],h=Vt[ut++],d=Vt[ut++],u=Vt[ut++];if((128&c)>0||(128&h)>0||(128&d)>0||(128&u)>0)return void(ut-=12);if(t<14){if(t===12)return Nn(e,i,n,r,s,a,o,l,c,h,d,u);{let p=Vt[ut++];return(128&p)>0?void(ut-=13):Nn(e,i,n,r,s,a,o,l,c,h,d,u,p)}}{let p=Vt[ut++],f=Vt[ut++];if((128&p)>0||(128&f)>0)return void(ut-=14);if(t<15)return Nn(e,i,n,r,s,a,o,l,c,h,d,u,p,f);let g=Vt[ut++];return(128&g)>0?void(ut-=15):Nn(e,i,n,r,s,a,o,l,c,h,d,u,p,f,g)}}}}}function rI(){let t,e=Vt[ut++];if(e<192)t=e-160;else switch(e){case 217:t=Vt[ut++];break;case 218:t=He.getUint16(ut),ut+=2;break;case 219:t=He.getUint32(ut),ut+=4;break;default:throw new Error("Expected string")}return Hm(t)}function zS(t){return wi.copyBuffers?Uint8Array.prototype.slice.call(Vt,ut,ut+=t):Vt.subarray(ut,ut+=t)}function oc(t){let e=Vt[ut++];if(mr[e]){let i;return mr[e](Vt.subarray(ut,i=ut+=t),n=>{ut=n;try{return yn()}finally{ut=i}})}throw new Error("Unknown extension type "+e)}function $N(){let t=Vt[ut++];if(!(t>=160&&t<192))return ut--,YN(yn());if(t-=160,fa>=ut)return nh.slice(ut-vs,(ut+=t)-vs);if(!(fa==0&&js<180))return lb(t);let e,i=4095&(t<<5^(t>1?He.getUint16(ut):t>0?Vt[ut]:0)),n=OA[i],r=ut,s=ut+t-3,a=0;if(n&&n.bytes==t){for(;r<s;){if(e=He.getUint32(r),e!=n[a++]){r=1879048192;break}r+=4}for(s+=3;r<s;)if(e=Vt[r++],e!=n[a++]){r=1879048192;break}if(r===s)return ut=r,n.string;s-=3,r=ut}for(n=[],OA[i]=n,n.bytes=t;r<s;)e=He.getUint32(r),n.push(e),r+=4;for(s+=3;r<s;)e=Vt[r++],n.push(e);let o=t<16?S3(t):XN(t);return n.string=o??lb(t)}function YN(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return t.toString();if(t==null)return t+"";if(wi.allowArraysInMapKeys&&Array.isArray(t)&&t.flat().every(e=>["string","number","boolean","bigint"].includes(typeof e)))return t.flat().toString();throw new Error("Invalid property type for record: "+typeof t)}function ZN(t){oI&&oI();let e=js,i=ut,n=ob,r=vs,s=fa,a=nh,o=ab,l=nl,c=yr,h=new Uint8Array(Vt.slice(0,js)),d=Qe,u=Qe.slice(0,Qe.length),p=wi,f=rl,g=t();return js=e,ut=i,ob=n,vs=r,fa=s,nh=a,ab=o,nl=l,yr=c,Vt=h,rl=f,(Qe=d).splice(0,Qe.length,...u),wi=p,He=new DataView(Vt.buffer,Vt.byteOffset,Vt.byteLength),g}function CA(){Vt=null,nl=null,Qe=null}function ZY(t){t.unpack?mr[t.type]=t.unpack:mr[t.type]=t}var PA,Vt,js,ut,sI,ab,ob,wi,Qe,nh,vs,fa,yr,nl,mr,He,FS,KN,rl,DA,aI,oI,Wm,QN,RA,lb,JN,tk,ek,Nn,OA,IA,NS,lI,hI,cI,LA,Lv,dI,uI,pI,BA,kS,Jg,KY=z(()=>{try{PA=new TextDecoder}catch{}ut=0,ab=sI=[],ob=0,wi={},vs=0,fa=0,mr=[],FS={useRecords:!1,mapsAsObjects:!0},(KN=new class{}).name="MessagePack 0xC1",rl=!1,DA=2,Wm=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=0&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(Vt)return ZN(()=>(CA(),this?this.unpack(t,e):Wm.prototype.unpack.call(FS,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(js=e.end||t.length,ut=e.start||0):(ut=0,js=e>-1?e:t.length),ob=0,fa=0,nh=null,ab=sI,yr=null,Vt=t;try{He=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw Vt=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof Wm){if(wi=this,this.structures)return Qe=this.structures,Iv(e);(!Qe||Qe.length>0)&&(Qe=[])}else wi=FS,(!Qe||Qe.length>0)&&(Qe=[]);return Iv(e)}unpackMultiple(t,e){let i,n=0;try{rl=!0;let r=t.length,s=this?this.unpack(t,r):Lv.unpack(t,r);if(!e){for(i=[s];ut<r;)n=ut,i.push(Iv());return i}if(e(s,n,ut)===!1)return;for(;ut<r;)if(n=ut,e(Iv(),n,ut)===!1)return}catch(r){throw r.lastPosition=n,r.values=i,r}finally{rl=!1,CA()}}_mergeStructures(t,e){t=t||[],Object.isFrozen(t)&&(t=t.map(i=>i.slice(0)));for(let i=0,n=t.length;i<n;i++){let r=t[i];r&&(r.isShared=!0,i>=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let n=t[i],r=e[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,e){return this.unpack(t,e)}},QN=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,RA=(t,e)=>function(){let i=Vt[ut++];if(i===0)return e();let n=t<32?-(t+(i<<5)):t+(i<<5),r=Qe[n]||qN()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=TA(r,t)),r.read()},lb=Hm,JN=Hm,tk=Hm,ek=Hm,Nn=String.fromCharCode,OA=new Array(4096),IA=(t,e)=>{let i=yn().map(YN),n=t;e!==void 0&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let r=Qe[t];return r&&(r.isShared||rl)&&((Qe.restoreStructures||(Qe.restoreStructures=[]))[t]=r),Qe[t]=i,i.read=TA(i,n),(i.read0||i.read)()},mr[0]=()=>{},mr[0].noBuffer=!0,mr[66]=t=>{let e=t.byteLength%8||8,i=BigInt(128&t[0]?t[0]-256:t[0]);for(let n=1;n<e;n++)i<<=BigInt(8),i+=BigInt(t[n]);if(t.byteLength!==e){let n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=(s,a)=>{let o=a-s;if(o<=40){let d=n.getBigUint64(s);for(let u=s+8;u<a;u+=8)d<<=BigInt(64),d|=n.getBigUint64(u);return d}let l=s+(o>>4<<3),c=r(s,l),h=r(l,a);return c<<BigInt(8*(a-l))|h};i=i<<BigInt(8*(n.byteLength-e))|r(e,n.byteLength)}return i},NS={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},mr[101]=()=>{let t=yn();if(!NS[t[0]]){let e=Error(t[1],{cause:t[2]});return e.name=t[0],e}return NS[t[0]](t[1],{cause:t[2]})},mr[105]=t=>{if(wi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(ut-4);nl||(nl=new Map);let i,n=Vt[ut];i=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&Vt[ut+1]===115?new Set:{};let r={target:i};nl.set(e,r);let s=yn();if(!r.used)return r.target=s;if(Object.assign(i,s),i instanceof Map)for(let[a,o]of s.entries())i.set(a,o);if(i instanceof Set)for(let a of Array.from(s))i.add(a);return i},mr[112]=t=>{if(wi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(ut-4),i=nl.get(e);return i.used=!0,i.target},mr[115]=()=>new Set(yn()),lI=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array"),hI=typeof globalThis=="object"?globalThis:window,mr[116]=t=>{let e=t[0],i=Uint8Array.prototype.slice.call(t,1).buffer,n=lI[e];if(!n){if(e===16)return i;if(e===17)return new DataView(i);throw new Error("Could not find typed array for code "+e)}return new hI[n](i)},mr[120]=()=>{let t=yn();return new RegExp(t[0],t[1])},cI=[],mr[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=ut;return ut+=e-t.length,yr=cI,(yr=[rI(),rI()]).position0=0,yr.position1=0,yr.postBundlePosition=ut,ut=i,yn()},mr[255]=t=>t.length==4?new Date(1e3*(16777216*t[0]+(t[1]<<16)+(t[2]<<8)+t[3])):t.length==8?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+1e3*(4294967296*(3&t[3])+16777216*t[4]+(t[5]<<16)+(t[6]<<8)+t[7])):t.length==12?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+1e3*((128&t[4]?-281474976710656:0)+1099511627776*t[6]+4294967296*t[7]+16777216*t[8]+(t[9]<<16)+(t[10]<<8)+t[11])):new Date("invalid"),LA=new Array(147);for(let t=0;t<256;t++)LA[t]=+("1e"+Math.floor(45.15-.30103*t));(Lv=new Wm({useRecords:!1})).unpack,Lv.unpackMultiple,Lv.unpack,dI=new Float32Array(1),new Uint8Array(dI.buffer,0,4)}),QY=z(()=>{KY(),y3(),Ex(),ad(),Mx(),sd(),uI=[{Class:te.prototype.constructor,type:1,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,te.prototype),t)},{Class:Nt.prototype.constructor,type:2,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Nt.prototype),t)},{Class:qn.prototype.constructor,type:3,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,qn.prototype),t)},{Class:ib.prototype.constructor,type:4,write:t=>t.id,read:t=>new ib(t)},{Class:EA.prototype.constructor,type:5,write:t=>t.data,read:t=>new EA(t)},{Class:Zi.prototype.constructor,type:6,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,Zi.prototype),t)}];for(let t of uI)ZY(t);pI=new Wm({structuredClone:!0}),(BA||(BA={})).deserialize=function(t){return pI.unpack(t)}}),JY=z(()=>{QY(),kS=t=>()=>{throw new Error(t+" is not available in the runtime build (decode-only CollabSerialize)")},Jg={deserialize:BA.deserialize,serialize:kS("CollabSerialize.serialize"),checksum:kS("CollabSerialize.checksum")}}),Ye=z(()=>{Ax(),WY(),_3(),sd(),Mx(),b3(),ad(),XY(),$Y(),WN(),YY(),y3(),JY(),kN(),Ex()});function UA(t){return t==="MouseDown"||t==="MouseUp"||t==="KeyDown"||t==="KeyUp"||t==="Collision"||t==="Trigger"}var fI,zA,xg,Bv,VS,mI,gI,vI,FA,NA,yI,_I,bI,xI,wI,kA,VA,SI,MI,EI,AI,ik=z(()=>{var t,e,i;Ye(),J(),(t=fI||(fI={})).toEventUIType=function(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type},t.fromEventUIType=function(n){return n==="Distance"||n==="StateChange"?"Conditional":n},zA={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyPress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],GameControl:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Trigger:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Resize:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],VariableChange:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],API:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],WEBHOOK:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],AIAssistantListener:["SetVariable"],AIAssistantTrigger:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]},(n=>{n.is=function(r){return r.type==="MouseDown"||r.type==="MouseUp"||r.type==="MousePress"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="KeyPress"},n.defaultData=function(r){return r==="MouseDown"||r==="MouseUp"||r==="MousePress"?{type:r,mode:"Object",disabled:!1,name:"",actions:new Nt}:{type:r,disabled:!1,name:"",key:void 0,actions:new Nt}}})(xg||(xg={})),(n=>{n.propertyDefaultData=function(r){return{type:"Property",value:[r??null,"position","x"]}},n.valueDefaultData={type:"Literal",value:0}})(Bv||(Bv={})),(e=VS||(VS={})).comparisonDefaultData=function(n){return{type:"Comparison",operator:"==",lOperand:Bv.propertyDefaultData(n),rOperand:{...Bv.valueDefaultData}}},e.distanceDefaultData=function(n){return{type:"Distance",toObject:n??null,fromObject:n??null,distance:200}},e.stateDefaultData=function(n,r){return{type:"State",object:n??null,state:r??null}},(mI||(mI={})).isConditionalSubActions=function(n){return n.find(r=>r==="ifActions"||r==="elseActions")!==void 0},(n=>{n.is=function(r){return r.type==="Conditional"},n.defaultData=function(r){return{type:"Conditional",disabled:!1,name:"",inActions:new Nt,outActions:new Nt,condition:VS.distanceDefaultData(r)}}})(gI||(gI={})),(vI||(vI={})).defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new Nt,drop:new Nt}},(FA||(FA={})).defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new Nt},(NA||(NA={})).defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5},(n=>{n.is=function(r){return r.type==="MouseHover"},n.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Nt}}})(yI||(yI={})),(n=>{n.is=function(r){return r.type==="Scroll"},n.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Nt}}})(_I||(_I={})),(n=>{n.is=function(r){return r.type==="Start"},n.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Nt}}})(bI||(bI={})),(n=>{n.is=function(r){return r.type==="Collision"},n.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Nt}}})(xI||(xI={})),(n=>{n.is=function(r){return r.type==="Trigger"},n.defaultData=function(r,s){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Nt,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}})(wI||(wI={})),(i=kA||(kA={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(n){return n.type==="Resize"},i.sizeToDevice=function(n){return typeof n=="string"?n:"custom"},i.deviceToSize=function(n){return typeof n=="string"?[...i.defaultSizes[n]]:[...n]},i.defaultData=function(){let n={size:"mobile",operator:"<",actions:new Nt},r={size:"tablet",operator:"<",actions:new Nt},s={size:[...i.defaultSizes.custom],operator:"<>",actions:new Nt},a=new Nt;return a.push({id:Pt.generateUUID(),fi:0,data:n},{id:Pt.generateUUID(),fi:1,data:r},{id:Pt.generateUUID(),fi:2,data:s}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:a}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Nt}},(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]},n.is=function(r){return r.type==="VariableChange"},n.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Nt,variableId:"",objectId:null,property:"Position X"}}})(VA||(VA={})),(n=>{n.is=function(r){return r.type==="API"},n.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Nt,errorActions:new Nt,userAPIId:""}}})(SI||(SI={})),(n=>{n.is=function(r){return r.type==="WEBHOOK"},n.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Nt,userWebhookId:""}}})(MI||(MI={})),(n=>{n.is=function(r){return r.type==="AIAssistantListener"},n.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Nt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(EI||(EI={})),(n=>{n.is=function(r){return r.type==="AIAssistantTrigger"},n.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Nt}}})(AI||(AI={}))});function TI(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function jA(t){return typeof t=="string"&&t.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)}var od,ep,nk,Ir,CI,io,yh,t0,PI,jS,xs,fn,Je,GA,DI,rh,bp,RI,OI,II,LI,BI,UI,zI,FI,GS,NI,kI,HS,VI,jI,GI,WS,HI,qS,WI,qI,XS,XI,HA,$I,YI,ZI,KI,QI,JI,Jc,sl,sh,WA,qA,hb,cb,db,ub,pb,XA,$A,fb,YA,ip,t4,$S,YS,ZA,e4,mb,gb,ZS,i4,vb,KS,n4,r4,s4,a4,o4,l4,h4,c4,Tx,M3,Xi,zi,Ou,rk,xp,yb,Lc,KA,E3,_b,bb,xb,Qo,k1,er,QS,Zl,wb,wg,JS,t2,e2,np,i2,QA,JA,d4,Gd,sk,Tn,Sb,u4,p4,f4,m4,Xa,Sg,Mb,Eb,al,qc,g4,ah,Ab,ol,n2,r2,Bc,td,Uc,Mg,tT,v4,_r,s2,y4,_4,Jo,Vs,rp,hs=z(()=>{var t,e,i,n,r,s,a,o;od="personal camera",ep="a218fcc3-276b-49b9-b485-49037fd14f5f",nk=2500134,Ir=5526619,(t=CI||{}).x="x",t.y="y",t.z="z",CI=t,(l=>{function c(u,p){return Math.pow(p[0]-u[0],2)+Math.pow(p[1]-u[1],2)}function h(u,p){return Math.sqrt(c(u,p))}function d(u,p,f){let g=l.sub(p,u),m=l.sub(f,u),v=l.dot(g,m)/l.dot(g,g),y=l.scalarMultiply(g,v);return l.add(u,y)}l.isEqual=function(u,p){return u[0]===p[0]&&u[1]===p[1]},l.lerp=function(u,p,f){return[u[0]+(p[0]-u[0])*f,u[1]+(p[1]-u[1])*f]},l.add=function(u,p){return[u[0]+p[0],u[1]+p[1]]},l.sub=function(u,p){return[u[0]-p[0],u[1]-p[1]]},l.multiply=function(u,p){return[u[0]*p[0],u[1]*p[1]]},l.divide=function(u,p){return[u[0]/p[0],u[1]/p[1]]},l.distanceSquared=c,l.distance=h,l.dot=function(u,p){return u[0]*p[0]+u[1]*p[1]},l.scalarMultiply=function(u,p){return[u[0]*p,u[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(u,p,f){return h(u,d(u,p,f))},l.center=function(u,p){return[.5*(u[0]+p[0]),.5*(u[1]+p[1])]}})(io||(io={})),(e=yh||(yh={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]},e.add=function(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]},e.sub=function(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]},e.div=function(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]},e.mul=function(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]},e.dist=function(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])},e.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h]},(i=t0||(t0={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]&&l[3]===c[3]},i.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h,l[3]+(c[3]-l[3])*h]},(l=>{let c=180/Math.PI,h=Math.PI/180;function d(p){return typeof p=="number"?p*c:p}function u(p){return typeof p=="number"?p*h:p}l.radToDeg=function(p){return[d(p[0]),d(p[1]),d(p[2])]},l.degToRad=function(p){return[u(p[0]),u(p[1]),u(p[2])]}})(PI||(PI={})),(n=jS||(jS={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],n.isEqual=function(l,c){for(let h=0;h<16;h++)if(l[h]!==c[h])return!1;return!0},n.simplify=function(l){return l??n.identity},n.applyMatrix4=function(l,c){let h=c.slice(0);for(let d=0,u=c.length;d<u;d+=3){let p=l[3]*c[d]+l[7]*c[d+1]+l[11]*c[d+2]+l[15];h[d]=(l[0]*c[d]+l[4]*c[d+1]+l[8]*c[d+2]+l[12])/p,h[d+1]=(l[1]*c[d]+l[5]*c[d+1]+l[9]*c[d+2]+l[13])/p,h[d+2]=(l[2]*c[d]+l[6]*c[d+1]+l[10]*c[d+2]+l[14])/p}return h},(l=>{l.zero=[0,0,0,0,0,0],l.INDEX_MAP=[4,8,1,9,2,6],l.toMatrix=function(c){let h=[...jS.identity];for(let d=0;d<6;d++)h[l.INDEX_MAP[d]]=c[d];return h},l.fromMatrix=function(c){return[c[l.INDEX_MAP[0]],c[l.INDEX_MAP[1]],c[l.INDEX_MAP[2]],c[l.INDEX_MAP[3]],c[l.INDEX_MAP[4]],c[l.INDEX_MAP[5]]]}})(xs||(xs={})),(r=fn||(fn={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},r.white={r:1,g:1,b:1},r.red={r:1,g:0,b:0},r.black={r:0,g:0,b:0},r.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},r.clone=function(l){return{r:l.r,g:l.g,b:l.b}},r.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},r.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},r.equals=function(l,c){return l.r===c.r&&l.g===c.g&&l.b===c.b},r.equalsFixed=function(l,c){return l.r.toFixed(2)===c.r.toFixed(2)&&l.g.toFixed(2)===c.g.toFixed(2)&&l.b.toFixed(2)===c.b.toFixed(2)},r.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h}},r.is=function(l){return!!TI(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(s=Je||(Je={})).white={...fn.white,a:1},s.is=function(l){return!!TI(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},s.transparent={...fn.white,a:0},s.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},s.fromHexAndA=function(l,c){return{...fn.fromHex(l),a:c}},s.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:l.a}},s.equals=function(l,c){return fn.equals(l,c)&&l.a===c.a},s.equalsFixed=function(l,c){return fn.equalsFixed(l,c)&&l.a.toFixed(2)===c.a.toFixed(2)},s.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h,a:l.a+(c.a-l.a)*h}},s.toStyle=function({r:l,g:c,b:h,a:d}=s.white){return`rgba(${255*l}, ${255*c}, ${255*h}, ${d})`},(GA||(GA={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=DI||{})[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING",a[a.ARC=7]="ARC",a[a.NONE=8]="NONE",DI=a,(rh||(rh={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(bp||(bp={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=RI||(RI={})).linear=[0,0,1,1],o.ease=[.25,.1,.25,1],o.easeIn=[.42,0,1,1],o.easeOut=[0,0,.58,1],o.easeInOut=[.42,0,.58,1]}),tZ=z(()=>{var t,e;Ye(),ik(),(OI||(OI={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(II||(II={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(LI||(LI={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(BI||(BI={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(UI||(UI={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(zI||(zI={})).defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"},(FI||(FI={})).defaultData={type:"Reset",name:"",delay:0},(GS||(GS={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(t=NI||(NI={})).pauseDefaultData={interaction:"pause",delay:0},t.stopDefaultData={interaction:"stop",delay:0},(e=kI||(kI={})).defaultData={type:"Audio",name:"",...GS.defaultData},e.hasAudioByActions=i=>i.some(({data:n})=>n.type==="Audio"&&n.interaction==="play"&&n.audio),e.hasAudioByEvents=i=>e.getAudiosByEvents(i).length>0,e.getAudiosByActions=i=>{let n=[];return i.forEach(r=>{let s=r.data;s.type==="Audio"&&s.interaction==="play"&&s.audio&&n.push(r),s.type==="Conditional"&&(n.push(...e.getAudiosByActions(s.ifActions)),n.push(...e.getAudiosByActions(s.elseActions)))}),n},e.getAudiosByEvents=i=>{let n=[];return i.forEach(({data:r})=>{xg.is(r)||r.type==="Collision"||r.type==="Start"||r.type==="Trigger"||r.type==="VariableChange"||r.type==="WEBHOOK"||r.type==="AIAssistantTrigger"?n.push(...e.getAudiosByActions(r.actions)):r.type==="Conditional"?(n.push(...e.getAudiosByActions(r.inActions)),n.push(...e.getAudiosByActions(r.outActions))):r.type==="GameControl"?Object.values(r.gameActions).forEach(s=>{n.push(...e.getAudiosByActions(s))}):r.type==="DragDrop"?(n.push(...e.getAudiosByActions(r.dragDropActions.drag)),n.push(...e.getAudiosByActions(r.dragDropActions.drop))):r.type==="Resize"?r.breakpoints.forEach(({data:s})=>{n.push(...e.getAudiosByActions(s.actions))}):r.type==="API"&&(n.push(...e.getAudiosByActions(r.successActions)),n.push(...e.getAudiosByActions(r.errorActions)))}),n},(HS||(HS={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(VI||(VI={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...HS.defaultData},i.hasVideoByActions=n=>n.some(({data:r})=>r.type==="Video"&&r.interaction==="play"&&r.layerId),i.hasVideoByObject=n=>{if(n.events){for(let{data:r}of n.events)if((xg.is(r)||r.type==="Start")&&i.hasVideoByActions(r.actions))return!0}},i.getVideosByActions=n=>{let r=[];return n.forEach(s=>{let a=s.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&r.push(s)}),r},i.getVideosByEvents=n=>{let r=[];return n.forEach(({data:s})=>{(xg.is(s)||s.type==="Start")&&r.push(...i.getVideosByActions(s.actions))}),r}})(jI||(jI={})),(GI||(GI={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(WS||(WS={})).defaultData=function(){return{tweens:new Nt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(HI||(HI={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...WS.defaultData()}},(qS||(qS={})).defaultData=function(i){return{interaction:"play",timeline:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(WI||(WI={})),(qI||(qI={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...qS.defaultData(i)}},(XS||(XS={})).defaultData=function(i,n,r){return{interaction:"play",object:i,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(XI||(XI={})),(i=>{i.defaultData=function(n,r,s){return{type:"Animation",name:"",...XS.defaultData(n,r,s)}},i.isPause=function(n){return n.interaction==="pause"||n.interaction==="stop"}})(HA||(HA={})),($I||($I={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(YI||(YI={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Nt,elseActions:new Nt,condition:[]}),(ZI||(ZI={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(KI||(KI={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(QI||(QI={})).defaultData={name:"",type:"UserAPI"}}),eZ=z(()=>{var t;(t=JI||(JI={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),e=>e.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},t.maxSize=2e6}),ak=z(()=>{var t;(t=Jc||(Jc={})).all=["PerspectiveCamera","OrthographicCamera"],t.is=function(e){return t.all.includes(e)},(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.MinTargetOffset=.001,e.sanitizeTargetOffset=function(s){return s===void 0||!Number.isFinite(s)||s<e.MinTargetOffset?e.DefaultTargetOffset:s},e.DefaultAzimuth=-24,e.DefaultElevation=15;let i=e.DefaultAzimuth*Math.PI/180,n=e.DefaultElevation*Math.PI/180,r=180/Math.PI;e.DefaultPosition=[e.DefaultTargetOffset*Math.sin(i)*Math.cos(n),e.DefaultTargetOffset*Math.sin(n),e.DefaultTargetOffset*Math.cos(i)*Math.cos(n)],e.DefaultRotation=[Math.atan2(-Math.sin(n),Math.cos(i)*Math.cos(n))*r,Math.asin(Math.sin(i)*Math.cos(n))*r,Math.atan2(Math.sin(i)*Math.sin(n),Math.cos(i))*r],e.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(s){return s.type==="PerspectiveCamera"?s.perspective?.zoom??1:s.orthographic?.zoom??1}})(sl||(sl={}))}),ok=z(()=>{var t;(t=sh||(sh={})).defaultData=function(e,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof e[0]=="number"?e[0]:1,typeof e[1]=="number"?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof e[0]=="number"?e[0]+e[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map(n=>(typeof n=="number"?n:1)*(1+i)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}},t.merge=function(e,i){let n={...e};if(qA.forEach(r=>{Object.assign(n,{[r]:i[r]??e[r]})}),n.radial={...e.radial},i.radial){let r=e.radial,s=i.radial;hb.forEach(a=>{Object.assign(n.radial,{[a]:s[a]??r[a]})})}if(n.linear={...e.linear},i.linear){let r=e.linear,s=i.linear;cb.forEach(a=>{Object.assign(n.linear,{[a]:s[a]??r[a]})})}if(n.grid={...e.grid},i.grid){let r=e.grid,s=i.grid;db.forEach(a=>{Object.assign(n.grid,{[a]:s[a]??r[a]})})}if(n.toObject={...e.toObject},i.toObject){let r=e.toObject,s=i.toObject;ub.forEach(a=>{Object.assign(n.toObject,{[a]:s[a]??r[a]})})}if(n.randomnessObject={...e.randomnessObject},i.randomnessObject){let r=e.randomnessObject,s=i.randomnessObject;pb.forEach(a=>{Object.assign(n.randomnessObject,{[a]:s[a]??r[a]})})}return n},t.isPartial=function(e){return!(!e.randomnessObject&&!e.toObject)},(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(n,r){let s=[];n.count!==void 0&&s.push({type:0,path:r,props:{count:n.count}});for(let a of i){let o=n[a];o&&Object.keys(o).length>0&&s.push({type:0,path:[...r,a],props:o})}return s}})(WA||(WA={})),qA=["count"],hb=["radius","start","end","position","scale","rotation"],cb=["position","scale","rotation"],db=["count","size"],ub=["count","position","scale","rotation"],pb=["strength","scale","rotation","position","movement","seed","freqScale"]}),lk=z(()=>{var t;hs(),(t=XA||(XA={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],t.is=function(e){return t.all.includes(e)},($A||($A={})).defaultData=function(e){return function(i){if(i==="PointLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(i==="DirectionalLight")return{type:i,color:Je.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}}),hk=z(()=>{var t;(t=fb||(fb={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},t.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},t.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:t.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...t.defaultCollisionData}}),ck=z(()=>{var t;(t=YA||(YA={})).defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},t.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),A3=z(()=>{(ip||(ip={})).defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]}}),dk=z(()=>{var t,e;(t=t4||{})[t.Front=0]="Front",t[t.Back=1]="Back",t[t.Double=2]="Double",t4=t,(e=$S||($S={})).defaultData={castShadow:!0,receiveShadow:!0},e.equals=function(i,n){return i.castShadow===n.castShadow&&i.receiveShadow===n.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}})(YS||(YS={})),(ZA||(ZA={})).defaultData={...YS.defaultData,...$S.defaultData},(e4||(e4={})).getMaterialData=function(i,n){let r=[];if("material"in i){let s=typeof i.material=="string"?n.materials[i.material]??n.lib.materials[i.material]?.asset:i.material;s&&r.push(s)}else if("materials"in i)for(let s of i.materials){let a=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;a&&r.push(a)}return r}}),uk=z(()=>{var t;(t=mb||(mb={})).bytesFromFlattened=function(e){if(typeof e!="object"||e===null||Array.isArray(e)||ArrayBuffer.isView(e)||typeof e[0]!="number")return null;let i=Object.getPrototypeOf(e);if(i!==Object.prototype&&i!==null)return null;let n=Object.keys(e),r=new Uint8Array(n.length),s=e;for(let a=0;a<n.length;a++){let o=s[a];if(n[a]!==String(a)||typeof o!="number"||!Number.isInteger(o)||o<0||o>255)return null;r[a]=o}return r},t.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}}),pk=z(()=>{var t;(t=gb||(gb={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},t.maxSize=3e7}),g0=z(()=>{var t,e,i,n;Ye(),hs(),uk(),pk(),hs(),(ZS||(ZS={})).is=function(r){return r==="texture"||r==="video"||r==="color"||r==="depth"||r==="normal"||r==="gradient"||r==="noise"||r==="fresnel"||r==="cavity"||r==="dust"||r==="rainbow"||r==="toon"||r==="outline"||r==="particle"||r==="transmission"||r==="reflection"||r==="matcap"||r==="displace"||r==="pattern"||r==="vertexColor"||r==="light"},(i4||(i4={})).is=function(r){return r==="luminance"||r==="r"||r==="g"||r==="b"||r==="a"},(vb||(vb={})).is=function(r){return typeof r=="object"&&r!==null&&r.image!=null},(KS||(KS={})).is=function(r){return r==="phong"||r==="toon"||r==="lambert"||r==="physical"},(n=n4||{})[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",n4=n,r4=(r=>(r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",r))(r4||{}),s4=(r=>(r[r.NearestFilter=1003]="NearestFilter",r[r.LinearFilter=1006]="LinearFilter",r[r.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",r))(s4||{}),(i=a4||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",a4=i,(e=o4||{})[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",o4=e,(t=l4||{})[t.F1=0]="F1",t[t.F2=1]="F2",t[t.F2MinusF1=2]="F2MinusF1",t[t.SmoothBlend=3]="SmoothBlend",t[t.Edge=4]="Edge",t[t.Power=5]="Power",t[t.Lines=6]="Lines",t[t.Cells=7]="Cells",l4=t,h4=(r=>(r[r.Lights=0]="Lights",r[r.Static=1]="Static",r[r.Camera=2]="Camera",r))(h4||{}),c4=(r=>(r[r.Circle=0]="Circle",r[r.Ring=1]="Ring",r[r.Polygon=2]="Polygon",r[r.Cross=3]="Cross",r[r.Diamond=4]="Diamond",r[r.Checkerboard=5]="Checkerboard",r[r.Line=6]="Line",r[r.Wave=7]="Wave",r))(c4||{}),Tx=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],M3=["wrapping","image","video","name","minFilter","magFilter"],(r=>{function s(a,o){return a==="light"&&o?function(l){let c={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(l){case"phong":return{...c,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...c,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...c,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...c,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}(o):function(l){let c={alpha:1,mode:0,isMask:!1,visible:!0};switch(l){case"texture":return{...c,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...c,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:gb.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...c,type:"color",color:fn.fromHex(Ir)};case"vertexColor":return{...c,type:"vertexColor"};case"depth":return{...c,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...c,type:"normal",cnormal:[1,1,1]};case"gradient":return{...c,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...c,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...fn.fromHex(6710886),a:1},colorB:{...fn.fromHex(6710886),a:1},colorC:{...fn.fromHex(16777215),a:1},colorD:{...fn.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...c,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...c,type:"fresnel",color:Je.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...c,type:"dust",color:Je.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...c,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...c,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Je.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...c,type:"outline",outlineColor:Je.fromHexAndA(0,1),contourColor:Je.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...c,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...c,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...c,type:"reflection",blur:0,thickness:.001,steps:60,stepSize:.005,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...c,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...fn.fromHex(0),a:1},colorB:{...fn.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}(a)}r.patch=function(a,o){let{texture:l,...c}=o;if(Object.assign(a,c),l){let h=a.texture;h&&Object.assign(h,l)}},r.defaultColorLayer=function(a){return{...r.defaultData("color"),color:a}},r.defaultData=s,r.defaultDataFor=function(a,o){return a!=="light"?s(a):s("light",typeof o=="string"&&KS.is(o)?o:"physical")}})(Xi||(Xi={})),(r=>{function s(l,c){if(typeof l!="string"||!/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(l))return l;let{r:h,g:d,b:u}=fn.fromHex(parseInt(l.slice(1,7),16)),p=l.length===9?parseInt(l.slice(7),16)/255:void 0;if(Array.isArray(c))return c.length>3?[h,d,u,p??c[3]]:[h,d,u];let f=c;return typeof f?.r!="number"?l:typeof f.a=="number"?{r:h,g:d,b:u,a:p??f.a}:{r:h,g:d,b:u}}function a(l){let c=l?.data;return typeof c=="object"&&c!==null}function o(l,c="layer1",h="layer2",d=fn.fromHex(16777215)){let u=new Nt;return u.push({fi:0,data:Xi.defaultData("light",l),id:c}),u.push({fi:1,data:Xi.defaultData("color"),id:h}),{layers:u}}r.restoreImageBytes=function(l){let c=[],h=new Map,d=(p,f)=>{let g=Gm(p);if(typeof g!="object"||g===null||ArrayBuffer.isView(g))return p;if(h.has(g))return h.get(g)??p;h.set(g,void 0);let m=u(g,f)??p;return h.set(g,m),m},u=(p,f)=>{let g=p;if(!Array.isArray(p)){if(typeof g[0]=="number")return;if(typeof g.name=="string"){let v=mb.bytesFromFlattened(Gm(g.data));if(v!==null)return c.push({path:`${f}/data`,bytes:v.byteLength}),Object.setPrototypeOf({...g,data:v},Object.getPrototypeOf(p))}}let m=null;for(let v of Object.keys(p)){let y=g[v],_=d(y,`${f}/${v}`);_!==y&&(m===null&&(m=Array.isArray(p)?[...p]:{...g},Object.setPrototypeOf(m,Object.getPrototypeOf(p))),m[v]=_)}return m??void 0};return{material:d(l,""),restored:c}},r.restoreLayersSeq=function(l){let c=Gm(l.layers);if(!Array.isArray(c)||c instanceof Nt||!c.every(u=>typeof u=="object"&&u!==null&&typeof u.id=="string"&&typeof u.data=="object"))return{material:l,restored:!1};let h=Object.setPrototypeOf([...c],Nt.prototype),d=Gm(l);return{material:Object.setPrototypeOf({...d,layers:h},Object.getPrototypeOf(d)),restored:!0}},r.isMergable=function(l){return!l.layers.some(c=>c.data.type==="texture"&&c.data.projection!==0||c.data.type==="depth"&&!c.data.isWorldSpace||c.data.type==="noise"||c.data.type==="dust"&&c.data.noiseStrength!==0||c.data.type==="displace")},r.getHash=function(l){let c="";return l.layers.forEach(h=>{Object.entries(h.data).forEach(([d,u])=>{c+=`${d}${u}`,Array.isArray(u)?u.forEach(p=>c+=`${p}`):typeof u=="object"?Object.values(u).forEach(p=>{c+=typeof p=="number"?`${p.toFixed(4)}`:`${p}`}):c+=`${u}`})}),c},r.defaultEmptyData=function(){return{layers:new Nt}},r.defaultData=function(l="layer1",c="layer2"){return o("physical",l,c)},r.withName=function(l,c){return{...l,name:c}},r.isLayerEntry=a,r.withRepairedLayers=function(l){if(l.layers===void 0)return{...l,layers:o("phong").layers};let c=Array.from(l.layers);if(c.every(a))return l;let h=new Nt;return c.forEach((d,u)=>{if(a(d))return void h.push(d);let{id:p,fi:f,...g}=d??{};if(typeof g.type!="string"||!ZS.is(g.type))return;let m=Xi.defaultDataFor(g.type,g.category),v={...m,...g};for(let[y,_]of Object.entries(g)){let b=m[y];v[y]=Array.isArray(_)&&Array.isArray(b)&&Array.isArray(b[0])?_.map(x=>s(x,b[0])):s(_,b)}h.push({id:typeof p=="string"&&p?p:`layer${u+1}`,fi:typeof f=="number"?f:u,data:v})}),{...l,layers:h}},r.defaultTwoLayerData=o,r.defaultColorMaterial=function(l,c,h="layer1",d="layer2"){let u=new Nt;return u.push({fi:0,data:Xi.defaultData("light",c),id:h}),u.push({fi:1,data:Xi.defaultColorLayer(l),id:d}),{layers:u}},r.defaultUIObjectMaterial=function(l){let c=Xi.defaultData("texture");l&&Object.assign(c.texture,{image:l});let h=new Nt;return h.push({fi:0,data:c,id:"layer1"}),h.push({fi:1,data:{...Xi.defaultData("transmission"),alpha:1},id:"layer2"}),h.push({fi:2,data:{...Xi.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:h}},r.defaultTwoLayerTextureData=function(l,c="physical",h="layer1",d="layer2"){let u=Xi.defaultData("texture");Object.assign(u.texture,{image:l});let p=new Nt;return p.push({fi:0,data:u,id:h}),p.push({fi:1,data:Xi.defaultData("light",c),id:d}),{layers:p}},r.defaultTwoLayerVideoTextureData=function(l,c="physical",h="layer1",d="layer2"){let u=Xi.defaultData("video");Object.assign(u.texture,{video:l});let p=new Nt;return p.push({fi:0,data:u,id:h}),p.push({fi:1,data:Xi.defaultData("light",c),id:d}),{layers:p}}})(zi||(zi={}))}),iZ=z(()=>{Ou="Roboto_regular",rk="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),nZ=z(()=>{iZ()}),fk=z(()=>{var t;Ye(),(t=xp||(xp={})).defaultData=function(){return{points:new Nt,roundness:0,shapeHoles:[],isClosed:!1}},t.scaled=function e(i,n,r){let s=a=>[a[0]*n,a[1]*r];return{...i,points:new Nt(...i.points.map(({id:a,fi:o,data:l})=>({id:a,fi:o,data:{...l,position:s(l.position),controlPrevious:{position:s(l.controlPrevious.position)},controlNext:{position:s(l.controlNext.position)}}}))),shapeHoles:i.shapeHoles.map(a=>e(a,n,r))}}}),mk=z(()=>{Ye(),(yb||(yb={})).defaultData=function(){return{points:new Nt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},Lc={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(KA||(KA={})).merge=function(t,e){let i={...t};return _b.forEach(n=>{Object.assign(i,{[n]:e[n]??t[n]})}),i},E3={shape:Lc,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},_b=["depth","offset","angle","twist","startScale","endScale"]}),T3=z(()=>{var t,e;fk(),mk(),(t=bb||(bb={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},t.isParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="BooleanGeometry"||i==="TextGeometry"||i==="InputGeometry"||i==="DecalGeometry"},t.isSwappableGeometry=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="TextGeometry"||i==="SubdivGeometry"||i==="NonParametricGeometry"},(xb||(xb={})).merge=function(i,n){let r={...i};if(Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...i.extrusion},Object.assign(r.extrusion,KA.merge(r.extrusion,n.extrusion))),i.type==="VectorGeometry"&&r.type==="VectorGeometry"){let s=(l,c)=>typeof l=="number"&&typeof c=="number"&&c!==0?l/c:1,a=s(r.width,i.width),o=s(r.height,i.height);(a!==1||o!==1)&&(r.shape=xp.scaled(i.shape,a,o))}return r},(e=Qo||(Qo={})).defaultData=function(i){if(i==="RectangleGeometry")return{width:320,height:320,type:i,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="UIGeometry")return{type:i,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(i==="PathGeometry")return{type:i,width:1,height:1,depth:1,path:yb.defaultData(),extrusion:E3};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:xp.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1,projection:"all",projectionTargets:[]};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...e.defaultData("TextGeometry"),type:i,editable:!0};if(i==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")},k1=["width","height","depth"]}),gk=z(()=>{hs(),(t=>{function e(i){return i.mode??"linear"}t.defaultData={enabled:!1,useBackgroundColor:!1,color:fn.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},t.getMode=e,t.getModeIndex=function(i){let n=e(i);return n==="height"?1:n==="both"?2:0},t.getDensity=function(i){return i.density??t.defaultData.density},t.getHeightFalloff=function(i){return i.heightFalloff??t.defaultData.heightFalloff},t.getHeightBase=function(i){return i.heightBase??t.defaultData.heightBase}})(er||(er={}))}),C3=z(()=>{(QS||(QS={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(Zl||(Zl={})).defaultData={enabled:!1,mode:"hdri",hdri:QS.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}}),vk=z(()=>{(()=>{let t={opacity:1,blendFunction:13,enabled:!1};(wb||(wb={})).defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})()}),P3=z(()=>{var t;gk(),C3(),vk(),hs(),(t=wg||(wg={})).defaultData={type:"normal",softShadowQuality:"low"},t.isSoft=function(e){return e!=null&&(e.type===void 0||e.type==="soft")},(JS||(JS={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(t2||(t2={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},e.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(e2||(e2={})),(np||(np={})).defaultData={usePhysics:!1,gravity:-10},(i2||(i2={})).defaultData={playCamera:od,gameControlObject:null},(QA||(QA={})).defaultData={backgroundColor:Je.fromHexAndA(nk,1),postprocessing:wb.defaultData,fog:er.defaultData,sky:Zl.defaultData,globalPhysics:np.defaultData,ambient:JS.defaultData,ao:t2.defaultData,shadow:wg.defaultData,publish:i2.defaultData,grading:e2.defaultData}}),rZ=z(()=>{(JA||(JA={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),Cx=z(()=>{var t,e,i;Ye(),ak(),lk(),hk(),ck(),A3(),dk(),hs(),g0(),T3(),ok(),Dn(),P3(),rZ(),(t=d4||(d4={})).isComponentRelated=function(n){return n==="Component"||n==="Instance"},t.isEmptyOrComponent=function(n){return n==="Empty"||n==="Instance"},(e=Gd||(Gd={})).identity={...GA.identity,shear:xs.zero},e.fromObject=function(n){return{position:n.position,rotation:n.rotation,scale:n.scale,pivot:n.pivot,pivotRotation:n.pivotRotation,shear:n.shear}},e.merge=function(n,r){return{position:r?.position||n.position,rotation:r?.rotation||n.rotation,pivot:r?.pivot||n.pivot,pivotRotation:r?.pivotRotation||n.pivotRotation,scale:r?.scale||n.scale,shear:r?.shear||n.shear}},e.diff=function(n,r){return UN({position:yh.isEqual(n.position,r.position)?void 0:r.position,rotation:yh.isEqual(n.rotation,r.rotation)?void 0:r.rotation,scale:yh.isEqual(n.scale,r.scale)?null:r.scale,shear:r.shear?.every((s,a)=>s===n.shear?.[a])?void 0:r.shear})},sk=["slide","offset"],(Tn||(Tn={})).defaultData={states:new Nt,events:new Nt,visible:!0,raycastLock:!1,physics:ip.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...Gd.identity,cloner:null},(Sb||(Sb={})).defaultData={type:"Empty",...Tn.defaultData},(u4||(u4={})).defaultData={type:"ParticleCollider",...JA.defaultData,...Tn.defaultData},(p4||(p4={})).defaultData={type:"Component",...Tn.defaultData},(f4||(f4={})).defaultData={type:"Particle",...Tn.defaultData,...fb.defaultData},(m4||(m4={})).defaultData={type:"Hair",...Tn.defaultData,...YA.defaultData},(Xa||(Xa={})).defaultData={type:"Mesh",...Tn.defaultData,...ZA.defaultData},(Sg||(Sg={})).defaultData={...Tn.defaultData,...Gd.identity,position:sl.DefaultPosition,rotation:sl.DefaultRotation,...sl.defaultData},(n=>{n.defaultData=function(r){return{...Tn.defaultData,...$A.defaultData(r)}},n.defaultDirectionalLightData={...n.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(Mb||(Mb={})),(n=>{function r(s,a,o=0){for(;o<a.length;){let l=s?s[a[o]]:void 0;if(a.length===o+1)return l;if(!l)return;s=l.descendants,o+=1}}n.resolveWithDes=r,n.resolve=function(s,a,o=0){let l=r(s,a,o);if(l){let c=Object.keys(l);if(c.length===1&&c[0]==="descendants")return}return l}})(Eb||(Eb={})),(n=>{function r(s,a){return{...Tn.defaultData,...a,component:s,overrides:new Zi,physics:void 0,events:void 0,type:"Instance"}}n.rootOverrideProps=["physics","events"],n.compositeNonOptionalOverrideProps=["geometry"],n.compositeEntireOverrideOverrideProps=["material"],n.ofComponent=r,n.fromComponentData=function(s){let a=Gd.fromObject(s.data);return r(s.id,a)}})(al||(al={})),(n=>{n.defaultData={type:"Page",...Tn.defaultData,physics:{...ip.defaultData,fusedBody:!1},...QA.defaultData,camera:Sg.defaultData,timelines:new te},n.isUIPage=function(r){return r.uiScene!==void 0}})(qc||(qc={})),(i=g4||(g4={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],shear:xs.zero,name:"Play Camera",visible:!0,raycastLock:!1,physics:ip.defaultData,states:new Nt,events:new Nt,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...sl.defaultData},i.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","shear"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},i.defaultMeshObject={name:"Rectangle",...Tn.defaultData,...Xa.defaultData,geometry:Qo.defaultData("RectangleGeometry"),material:zi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...Tn.defaultData,...Xa.defaultData,geometry:Qo.defaultData("BooleanGeometry"),material:zi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...Tn.defaultData,...Xa.defaultData,geometry:Qo.defaultData("ShapeBlendGeometry"),material:zi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...Tn.defaultData,...Xa.defaultData,geometry:Qo.defaultData("TextGeometry"),material:zi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...Tn.defaultData,...Xa.defaultData,geometry:Qo.defaultData("InputGeometry"),material:zi.defaultTwoLayerData("physical","layer1","layer2")},(n=>{n.newEmpty=function(r,s){let a={name:s};return r.type==="Mesh"?(a.geometry={},"material"in r&&(a.material={layers:new Zi}),"materials"in r&&(a.materials=r.materials.map(o=>({layers:new Zi})))):Jc.is(r.type)&&(a.perspective={},a.orthographic={}),a},n.toOps=function(r,s){let a,o=[],l={orthographic:0,perspective:0,geometry:0};function c(h,d){for(let[u,p]of Object.entries(d.layers)){let{texture:f,...g}=p;if(f!==void 0&&Object.keys(f).length>0){let m={path:[...h,"layers",u,"texture"],props:f,type:0};o.push(m)}if(Object.keys(g).length>0){let m={path:[...h,"layers",u],props:g,type:0};o.push(m)}}}for(let[h,d]of Object.entries(s)){let u=d;if(h!=="name")if(h==="cloner")o.push(...WA.toOps(u,["cloner"]));else if(h==="pathSnapping")o.push({path:[h],props:{slide:u.slide,offset:u.offset},type:0});else if(h==="material")c(["material"],u);else if(h==="materials")for(let[p,f]of Object.entries(u))c(["materials",p],f);else if(l[h]===0){if(h==="geometry"&&u.extrusion!==void 0){let p={path:[h,"extrusion"],props:u.extrusion,type:0};o.push(p),u={...u},delete u.extrusion}if(Object.keys(u).length>0){let p={path:[h],props:u,type:0};o.push(p)}}else a===void 0&&(a={path:[],props:{},type:0},o.push(a)),a.props[h]=u}return o},n.patch=function(r,s){if(s===void 0)return r;let a={...r};if(Object.assign(a,Gd.merge(a,s)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:s.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:s.pathSnapping?.offset??a.pathSnapping?.offset??0})}),Jc.is(r.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let o=s;o.orthographic?.zoom!==void 0&&(a.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(a.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(a.targetOffset=o.targetOffset)}else if(r.type==="Mesh")"geometry"in s&&Object.assign(a,{geometry:xb.merge(a.geometry,s.geometry)}),(s.material||s.materials)&&(a=function(o,l){if(l===void 0)return o;let c={...o};return"material"in c&&"material"in l&&l.material&&(c.material=rb(c.material,h=>{if(typeof h!="string")for(let[d,u]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&Xi.patch(p,u)}}).data),c.materials&&l.materials&&(c.materials=rb(c.materials,h=>{for(let d=0;d<c.materials.length;d++){let u=l.materials[d];if(typeof u!="string")for(let[p,f]of Object.entries(u.layers)){let g=h[d]?.layers?.data(p);g&&Xi.patch(g,f)}}}).data),c}(a,s)),a.cloner&&"cloner"in s&&Object.assign(a,{cloner:sh.merge(a.cloner,s.cloner)});else if(r.type==="Empty")a.cloner&&"cloner"in s&&Object.assign(a,{cloner:sh.merge(a.cloner,s.cloner)});else if(XA.is(r.type)){let o=s;o.intensity!==void 0&&(a.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?a.color=o.color:a.color=fn.clone(o.color))}return a}})(ah||(ah={}))}),D3=z(()=>{(Ab||(Ab={})).defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0}}),Px=z(()=>{D3(),hs(),(ol||(ol={})).defaultData={orbitControls:Ab.defaultData,playPage:ep,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,e)=>{let i=0,n=0;return e<5?n=-30:e<10&&(n=30),e===0||e===10||e===5?i=30:(e===4||e===11||e===9)&&(i=-30),[120,[i,n],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0}}),yk=z(()=>{var t;(n2||(n2={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(r2||(r2={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(t=Bc||(Bc={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...n2.defaultData},isRandomSeed:!0,seed:t.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:r2.defaultData}),t.generateSeed=()=>Math.round(1e5*Math.random())}),R3=z(()=>{Cx(),Ye(),Px(),hs(),Dn(),yk(),(t=>{function e(i,n){let r=i.scene.objects.get(n);if(r&&r.data.type==="Component")return r;{let s=i.shared.lib.components[n];if(s)return{...s.asset,id:n}}}t.physicsEnabled=function(i){return i.find(n=>n.data.type==="Page"&&n.data.globalPhysics.usePhysics)!==void 0},t.findTimeline=function(i,n){let r=i.find(s=>s.data.type==="Page"&&s.data.timelines?.[n]!==void 0);return r&&r.data.timelines?.[n]},t.getComponentData=e,t.traverseModuleInstances=function(i,n,r){i.scene.objects.traverseFrom(n,(s,a)=>{if(a.type==="Instance"){let o=e(i,a.component)?.data;o&&r(s,a,o.events)}else r(s,a,a.events)})}})(td||(td={})),(t=>{function e(n=!0,r=[]){let s=[];n&&s.push({...t.defaultLight}),s.push(...r);let a=new qn;return a.push({fi:1,id:ep,data:{...qc.defaultData,name:"Scene 1"},children:s}),a}function i(n){return{...t.defaultData,objects:Ar(n,qn.prototype)}}t.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",t.defaultLight={fi:-1,data:Mb.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},t.createDefaultObjectTreeWithPage=e,t.defaultData={objects:e(),publish:ol.defaultData,styles:Bc.defaultData()},t.emptyDataWithoutPage=function(){return{objects:new qn,publish:ol.defaultData,styles:Bc.defaultData()}},t.emptyDataWithPage=function(n=!0){return{objects:e(n),publish:ol.defaultData,styles:Bc.defaultData()}},t.emptyData=function(){return{objects:new qn,publish:{...ol.defaultData},styles:Bc.defaultData()}},t.withObjs=i,t.withObj=function(n,r){return i([{id:n,data:r,children:[],fi:0}])}})(Uc||(Uc={}))}),_k=z(()=>{(Mg||(Mg={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),O3=z(()=>{var t,e;Ye(),Dn(),(t=tT||(tT={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Nt}),t.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(v4||(v4={})).defaultData=(i,n="GET")=>({url:i,method:n,name:"New API",headers:new Nt,queries:new Nt,autoStart:!0}),(i=>{function n(s){return s.textValue!==void 0}function r(s){return typeof s=="boolean"}i.isTextValue=n,i.isNumber=function(s){return typeof s=="number"},i.isBoolean=r,i.typeOfVariable=function(s){return n(s)?"string":r(s)?"boolean":"number"},i.getDisplayedValue=function(s){return i.isTextValue(s)?Array.isArray(s.textValue)?s.textValue.map(a=>a.toString().padStart(s.padding??2,"0")).join(s.deliminator??":")+(s.suffix!==void 0?" "+s.suffix:""):s.textValue.toString():i.isBoolean(s)?s?"True":"False":i.isNumber(s)?parseFloat(s.toFixed(3)).toString():s.toString()}})(_r||(_r={})),(s2||(s2={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(y4||(y4={})).all=[...s2.all,"components"],(_4||(_4={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(Jo||(Jo={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(e=Vs||(Vs={})).defaultColors=function(){return Ar({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},te.prototype)},e.defaultImages=function(){return Ar({},te.prototype)},e.emptyData=function(){return{catelogs:new te,materials:new te,images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,variables:new Nt,userAPIs:new te,userWebhooks:new te,lib:Jo.defaultData()}},e.defaultVariables=function(i){switch(i){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let n=[0,0,0];return{name:"Time",value:{textValue:n,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:n,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",i)}},e.getFormattedTimerTime=function(i,n){if(n.format==="HH:mm:ss"){let r=Math.floor(i/3600),s=Math.floor((i-3600*r)/60);return{textValue:[r,s,Math.round(i-3600*r-60*s)]}}if(n.format==="mm:ss"){let r=Math.floor(i/60);return{textValue:[r,Math.round(i-60*r)]}}return n.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),sZ=z(()=>{}),bk=z(()=>{var t;Ye(),R3(),_k(),O3(),(t=rp||(rp={})).defaultData={schema:135,scene:Uc.defaultData,frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Mg.defaultData),shared:{...Vs.emptyData(),colors:Vs.defaultColors()}},t.createDefaultData=function(){return Jg.deserialize(Jg.serialize(t.defaultData))},t.emptyDataForImports=function(){return{schema:135,scene:Uc.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Mg.defaultData),shared:{...Vs.emptyData(),colors:Vs.defaultColors(),images:Vs.defaultImages()}}},t.emptyData=function(){return{schema:135,scene:Uc.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Mg.defaultData),shared:Vs.emptyData()}},t.clipboard2dData=function(){return{schema:135,scene:Uc.emptyData(),frames:new te,shared:Vs.emptyData()}},t.withoutLib=function(e){return{...e,shared:{...e.shared,lib:Jo.defaultData()}}},t.getComponentData=function(e,i){return td.getComponentData(e,i)},t.hasSensitiveData=function(e){let i=Object.values(e.shared.userAPIs);for(let n of i){let r=n.headers;for(let s of r)if(s.data.key.toLowerCase()==="authorization"&&s.data.value!=="")return!0}return!1}});function dl(t,e=[0,0]){return[t&&!isNaN(t[0])?t[0]:e[0],t&&!isNaN(t[1])?t[1]:e[1]]}function Hf(t,e,i){switch(t){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=e??{...bp.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:a}=i??{...rh.defaultData},o=new xk(n,r,s,a),l=o.solve(1);return()=>c=>o.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}function aZ(t){let e=function(n){return n.layers?.find(({data:r})=>r.type==="light")}(t);if(!e)return;let i=e.data.alphaOverride;return typeof i=="number"?i:1}function oZ(t,e,i){return i>0?t*e/i:t}var b4,x4,_h,e0,xk,Tb,Cb,I3=z(()=>{Ye(),hs(),(b4||(b4={})).defaultData=function(t,e){return{id:t,name:e,duration:5,objectTimelines:new te}},(x4||(x4={})).is=function(t){return t&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.z=="number"},(t=>{function e(h,d){let u=[0,0],p=[1,1];if(h?.cubicControls)u=dl(h.cubicControls.control1,u);else switch(h?.type){case 2:case 4:u=[.42,0];break;case 3:case 0:u=[0,0];break;case 1:u=[.25,.1];break;case 7:u=[.25,1]}if(d?.cubicControls)p=dl(d.cubicControls.control2,p);else switch(d?.type){case 2:case 0:p=[1,1];break;case 3:case 4:p=[.58,1];break;case 1:p=[.25,1];break;case 7:p=[.5,1]}return{control1:u,control2:p}}function i(h){if(!t.BEZIER_PRESETS.includes(h))return;let d={type:h};return{control1:e(d).control1,control2:e(void 0,d).control2}}function n(h,d){return Math.abs(h[0]-d[0])<.001&&Math.abs(h[1]-d[1])<.001}function r(h){let d=t.ROOT_PROPERTY_ORDER.indexOf(h[0]);return d===-1?t.ROOT_PROPERTY_ORDER.length:d}function s(h){return h.layerId??h.path.join(".")}function a(h){let d=h[h.length-1];return e0.includes(d)?d:void 0}function o(h){return h.layerId?h.layerId:(a(h.path)?h.path.slice(0,-1):h.path).join(".")}function l(h){return["material",h.type==="light"?`${h.category} lighting`:h.type]}function c(h,d,u){return{id:h,data:{id:h,time:u?.time??0,path:d,value:{},layerId:u?.layerId,index:u?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}t.getControlsWithDefault=e,t.BEZIER_PRESETS=[0,1,2,3,4,7],t.presetHandles=i,t.presetForHandles=function(h){return t.BEZIER_PRESETS.find(d=>{let u=i(d);return u!==void 0&&n(u.control1,h.control1)&&n(u.control2,h.control2)})},t.defaultData=function(h){return{id:h,keyframes:new Nt}},t.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],t.rowOrder=r,t.propertyKey=s,t.groupKeyframes=function(h,d){let u=new Map;for(let p of h){let f=p.data;if(d?.(f))continue;let g=s(f),m=u.get(g);m||(m={id:g,path:f.path,keyframes:[],layerId:f.layerId,index:f.index},u.set(g,m)),f.isPlaceholder?m.placeholder=p.id:m.keyframes.push(p)}return[...u.values()].sort((p,f)=>{let g=r(p.path)-r(f.path);return g!==0?g:(p.index??0)-(f.index??0)})},t.rowAxis=a,t.drawnRowKey=o,t.drawnRows=function(h){let d=new Map;for(let u of h){let p=a(u.path),f=p?u.path.slice(0,-1):u.path,g=o(u),m=d.get(g);m||(m={id:g,path:f,layerId:u.layerId,index:u.index,tracks:[]},d.set(g,m)),m.tracks.push({axis:p,property:u})}return[...d.values()]},t.sortedKeyframes=function(h){return[...h].sort((d,u)=>d.data.time-u.data.time)},t.materialLayerPath=l,t.createMaterialGroup=function(h,d){return h.map(({data:u,id:p},f)=>c(d(),l(u),{layerId:p,index:f}))},t.placeholderKeyframe=c,t.createName=function(h){return Object.entries(h).reduce((d,[u,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},t.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Hf(3),duration:1e3},opacity:{value:[0,1],easing:Hf(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Hf(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Hf(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:Hf(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(_h||(_h={})),e0=["x","y","z"],xk=class{constructor(t=1,e=100,i=10,n=0){this.mass=t,this.stiffness=e,this.damping=i,this.initialVelocity=n,this.m_w0=Math.sqrt(e/t),this.m_zeta=i/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0-n)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-n+this.m_w0)}solve(t){return 1-(this.m_zeta<1?Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0))}getDuration(){let t=.16666666666666666,e=0,i=0;for(;;)if(e+=t,this.solve(e)===1){if(i++,i>=16)break}else i=0;return e*t*1e3}}}),L3=z(()=>{var t;hs(),Ye(),(Tb||(Tb={})).list=["idle","move","jump","run"],(t=Cb||(Cb={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},t.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:t.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new Nt,move:new Nt,jump:new Nt,run:new Nt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Je.fromHexAndA(3728051,1)}}});function Tc(t,...e){let i={};for(let n of e.flat())t!=null&&n in t&&(i[n]=t[n]);return i}function w4(t){t.layers.forEach(e=>{if(e.type==="depth"&&e.colorA!==void 0){let i=e.colorA,n=e.colorB,r=[[i.r,i.g,i.b,i.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let o=2;o<10;o++)r.push(r[1]),s.push(1);let a={...Tc(en(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,a)}else if(e.type==="depth"&&e.gradientType===1&&(e.near<0||e.far<0)){let i={...en(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,i)}})}function qo(t,e){Object.values(t.shared.materials).forEach(i=>e(i))}function Xo(t,e){t.scene.objects.traverse((i,n)=>{"materials"in n?n.materials.forEach((r,s)=>{r===void 0&&(n.materials[s]=zi.defaultTwoLayerData("phong"),r=n.materials[s]),typeof r!="string"&&e(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=zi.defaultTwoLayerData("phong")),e(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=zi.defaultTwoLayerData("phong")),e(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==Zi.prototype&&e(r.material)})})}function S4(t){t.layers===void 0&&Object.assign(t,zi.defaultTwoLayerData("lambert"))}function a2(t){!t.layers||t.layers.forEach(e=>{if(e.type==="depth"&&e.colors.length===10){let i=[...e.colors];i.push(e.colors[9]);let n=[...e.steps];n.push(e.steps[9]);let r={...en(e),colors:i,steps:n};Object.assign(e,r)}})}function M4(t){t.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach(n=>{typeof n!="string"&&a2(n)}):"material"in i&&typeof i.material!="string"&&a2(i.material)}),Object.values(t.shared.materials).forEach(e=>a2(e))}function E4(t){t.layers&&t.layers.forEach(e=>{e.type==="depth"&&e.num!==void 0&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function A4(t){t.layers&&t.layers.forEach(e=>{(function(i){return i.type!=="displace"})(e)&&e.isMask===void 0&&(e.isMask=!1),(e.type==="texture"||e.type==="video")&&e.blending===void 0&&(e.blending=0),(e.type==="noise"||e.type==="displace"&&e.displacementType==="noise")&&(e.voronoiStyle===void 0&&(e.voronoiStyle=0),e.highCut===void 0&&(e.highCut=1),e.lowCut===void 0&&(e.lowCut=0),e.smoothness===void 0&&(e.smoothness=.3),e.seed===void 0&&(e.seed=0),e.quality===void 0&&(e.quality=1))})}function T4(t){let e=t.layers.find(i=>i.type==="light")?.data;if(e?.category==="basic"){let i=Xi.defaultData("light","phong"),n=e;Object.assign(n,i),n.visible=!1}}function C4(t){qo(t,T4),Xo(t,T4)}function P4(t){t.layers.forEach(e=>{e.type==="light"&&e.category!=="toon"&&e.occlusion===void 0&&(e.occlusion=!0)})}function D4(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.bumpMapIntensity===void 0&&(e.bumpMapIntensity=5)})}var lZ=z(()=>{g0(),hs(),D3(),Cx(),Ye(),Px(),Dn(),J(),T3(),L3(),yk(),R3(),A3(),P3()});function wk(t){let e=t.elements;da.set(e[0],e[1],e[2]),ua.set(e[4],e[5],e[6]),Za.set(e[8],e[9],e[10])}function Sk(){let t=Math.max(da.lengthSq(),ua.lengthSq(),Za.lengthSq());da.lengthSq()>qm*t?ys.copy(da).normalize():ys.set(1,0,0),_s.crossVectors(Za,ys),_s.lengthSq()<=qm*t&&(_s.copy(ua).addScaledVector(ys,-ua.dot(ys)),_s.lengthSq()<=qm*t&&function(e,i){e.set(1,0,0).cross(i),e.lengthSq()<=qm&&e.set(0,1,0).cross(i),e.normalize()}(_s,ys)),_s.normalize(),zc.crossVectors(ys,_s)}function Mk(t,e,i){return wk(t),Sk(),e.makeBasis(ys,_s,zc),i.set(ys.dot(da),ys.dot(ua),ys.dot(Za),0,_s.dot(da),_s.dot(ua),_s.dot(Za),0,zc.dot(da),zc.dot(ua),zc.dot(Za),0,0,0,0,1),function(){let n=da.length(),r=ua.length(),s=Za.length(),a=Math.max(n,r,s);if(a-n>Xm||a-r>Xm||a-s>Xm)return!0;let o=Xm*a*a;return Math.abs(da.dot(ua))>o||Math.abs(da.dot(Za))>o||Math.abs(ua.dot(Za))>o}()}function Ek(t){return wk(t),Sk(),Ak.makeBasis(ys,_s,zc)}var da,ua,Za,ys,_s,zc,Ak,qm,Xm,Dx=z(()=>{J(),da=new T,ua=new T,Za=new T,ys=new T,_s=new T,zc=new T,Ak=new Et,qm=1e-12,Xm=.01});function Hd(t,e){return e===0?0:t/e}function B3(t){Mk(t,iT,eT),Gu.setFromRotationMatrix(iT);let e=function(n,r,s){let a=2*Math.PI,o=d=>d-a*Math.round(d/a),l=o(n+Math.PI),c=o(Math.PI-r),h=o(s+Math.PI);return Math.abs(l)+Math.abs(h)<Math.abs(n)+Math.abs(s)-1e-9?[l,c,h]:[n,r,s]}(Gu.x,Gu.y,Gu.z),i=eT.elements;return{position:[t.elements[12],t.elements[13],t.elements[14]],rotation:[e[0]*Pt.RAD2DEG,e[1]*Pt.RAD2DEG,e[2]*Pt.RAD2DEG],scale:[i[0],i[5],i[10]],shear:[Hd(i[4],i[5]),Hd(i[8],i[10]),Hd(i[1],i[0]),Hd(i[9],i[10]),Hd(i[2],i[0]),Hd(i[6],i[5])]}}function ll(t,{translation:e,quaternion:i,scale:n,shearMatrix:r}={}){let s=B3(t);if(e!==void 0&&e.fromArray(s.position),i!==void 0){let a=s.rotation;i.setFromEuler(Gu.set(a[0]*Pt.DEG2RAD,a[1]*Pt.DEG2RAD,a[2]*Pt.DEG2RAD))}n!==void 0&&n.fromArray(s.scale),r!==void 0&&r.fromArray(xs.toMatrix(s.shear))}var eT,iT,Gu,v0=z(()=>{J(),Dx(),s6(),eT=new Et,iT=new Et,Gu=new ci});function Tk(t){return t.length>=4&&function(e){return typeof e=="object"&&e!==null&&e.v===1&&e.data instanceof Float32Array&&Array.isArray(e.tracks)}(t[3])}function Ck(t,e,i){let n={name:e,duration:i.duration,tracks:[],uuid:t};return i.blendMode!==void 0&&(n.blendMode=i.blendMode),JSON.stringify(n)}function hZ(t,e,i){for(let n=0;n<i.length;n++)if(!Object.is(t[e+n],i[n]))return!1;return!0}function cZ(t){if(!Array.isArray(t)||t.length>3)return t;let e,[i,n,r]=t;if(typeof i!="string"||typeof r!="string")return t;try{e=JSON.parse(r)}catch{return t}return e&&Array.isArray(e.tracks)&&!e.tracks.some(s=>!s?.type||!s.times||!s.values)?function(s,a,o){let l=[],c=0,h=m=>{let v=[c,m.length];return l.push(m),c+=m.length,v},d=new Map,u=o.tracks.map(m=>{let v=(b=>{let x=Float32Array.from(b),w=x.length+":"+x[0]+":"+x[x.length-1],S=d.get(w)??[];for(let A of S)if(hZ(A.run,0,x))return A.span;let E=h(x);return S.push({span:E,run:x}),d.set(w,S),E})(m.times),y=!Pk.has(m.type),_={name:m.name,type:m.type,times:v,values:y?h(Float32Array.from(m.values)):[0,0]};return y||(_.list=Array.from(m.values)),m.interpolation!==void 0&&(_.interpolation=m.interpolation),_}),p=new Float32Array(c),f=0;for(let m of l)p.set(m,f),f+=m.length;let g={v:1,duration:o.duration,data:p,tracks:u};return o.blendMode!==void 0&&(g.blendMode=o.blendMode),o.userData!==void 0&&o.userData!=="{}"&&(g.userData=o.userData),[s,a,Ck(s,a,g),g]}(i,typeof e.name=="string"?e.name:n,e):t}function dZ(t,e,i){return t.map(n=>{let r=e();return i[n[0]]=r,function(s,a){let[o,l,c]=s;if(Tk(s))return[a,l,Ck(a,l,s[3]),s[3]];let h=c.indexOf(o);return[a,l,h!==-1?c.slice(0,h)+a+c.slice(h+o.length):c,...s.slice(3)]}(n,r)})}var Pk,Dk=z(()=>{Pk=new Set(["bool","string"])});function Uv(t,[e,i]){return Math.min(Math.max(t,e),i)}function Rk(t,e,i,n,r){t=Uv(t,Uk),e=Uv(e,zk),i=Uv(i,Fk),n=Uv(n,Nk);let s=Math.sqrt(e/t),a=i/(2*Math.sqrt(e*t)),o=a<1?s*Math.sqrt(1-a*a):0,l=a<1?(a*s-n)/o:-n+s;return c=>{let h=r!==void 0?r*c:c;return h=a<1?Math.exp(-h*a*s)*(1*Math.cos(o*h)+l*Math.sin(o*h)):(1+l*h)*Math.exp(-h*s),c===0||c===1?c:1-h}}function Ok(t,e){return ve(ve(1-ve(3*e))+ve(3*t))}function Ik(t,e){return ve(ve(3*e)-ve(6*t))}function Lk(t){return ve(3*t)}function zv(t,e,i){return ve(ve(ve(ve(ve(Ok(e,i)*t)+Ik(e,i))*t)+Lk(e))*t)}function R4(t,e,i){let n=ve(ve(ve(3*Ok(e,i))*t)*t),r=ve(ve(2*Ik(e,i))*t);return ve(ve(n+r)+Lk(e))}function Wd(t,e,i,n){if(t=ve(t),e=ve(e),i=ve(i),n=ve(n),t<0||t>1||i<0||i>1||t===e&&i===n)return Hk;let r=new Float32Array(V1);for(let s=0;s<V1;s++)r[s]=zv(ve(s*$m),t,i);return s=>(s=ve(s))===0||s===1?s:zv((a=>{let o=0,l=1,c=V1-1;for(;l!==c&&r[l]<=a;)o=ve(o+$m),l+=1;l-=1;let h=ve(ve(a-r[l])/ve(r[l+1]-r[l])),d=ve(o+ve(h*$m)),u=R4(d,t,i);return u>=Vk?function(p,f,g,m){for(let v=0;v<kk;v++){let y=R4(f,g,m);if(y===0)return f;let _=ve(zv(f,g,m)-p);f=ve(f-ve(_/y))}return f}(a,d,t,i):u===0?d:function(p,f,g,m,v){let y,_=0,b=0;do _=ve(f+ve(ve(g-f)/2)),y=ve(zv(_,m,v)-p),y>0?g=_:f=_,b+=1;while(Math.abs(y)>jk&&b<Gk);return _}(a,o,ve(o+$m),t,i)})(s),e,n)}function Bk(t,e,i){switch(t.easing){case 0:default:return i;case 1:return Wd(.25,.1,.25,1)(i);case 2:return Wd(.42,0,1,1)(i);case 3:return Wd(0,0,.58,1)(i);case 4:return Wd(.42,0,.58,1)(i);case 7:return Wd(.25,1,.5,1)(i);case 8:return Math.floor(i);case 5:{let{control1:n,control2:r}=t;return n&&r?Wd(n[0],n[1],r[0],r[1])(i):i}case 6:{let{mass:n,stiffness:r,damping:s,velocity:a}=t;return n===void 0||r===void 0||s===void 0||a===void 0?i:ve(Rk(n,r,s,a,e)(i))}}}var ve,Uk,zk,Fk,Nk,kk,Vk,jk,Gk,V1,$m,Hk,O4,uZ=z(()=>{ve=Math.fround,Uk=[.01,100],zk=[.01,1e4],Fk=[.01,1e3],Nk=[.01,1e3],kk=4,Vk=ve(.001),jk=ve(1e-7),Gk=10,$m=ve(1/((V1=11)-1)),Hk=t=>t,O4=ve(1.70158),ve(O4+1)});function Wk(t,e){if(t.length===0)throw new Error("sampleKeyframes requires at least one keyframe");if(e<=t[0].time)return{index0:0,index1:0,t:1};let{found:i,index:n}=function(c,h){let d=c.length,u=0,p=d;for(;u<p;){let f=u+Math.floor(d/2),g=c[f].time;if(g<h)u=f+1;else{if(!(g>h))return{found:!0,index:f};p=f}d=p-u}return{found:!1,index:u}}(t,e);if(i)return{index0:n,index1:n,t:1};if(n>=t.length){let c=t.length-1;return{index0:c,index1:c,t:1}}let r=n-1,s=n,a=t[r].time,o=t[s].time;if(o===a)return{index0:r,index1:s,t:.5};let l=j1(o-a);return{index0:r,index1:s,t:Bk({...t[r].ease,control2:t[s].ease.control2},l,j1(j1(e-a)/l))}}function qk(t){return[...t].sort((e,i)=>e.time-i.time)}var j1,pZ=z(()=>{uZ(),j1=Math.fround});function fZ(t){if(t?.length!==2)return;let e=`${t[0]}.${t[1]}`;return U3.includes(e)?e:void 0}function Xk(t){return t.slice(0,t.indexOf("."))}function $k(t){return bh.indexOf(t.slice(-1))}function mZ(t){return{easing:t?.type,control1:dl(t?.cubicControls?.control1,[0,0]),control2:dl(t?.cubicControls?.control2,[1,1]),...t?.springParameters}}function gZ(t){let e=t?.cubicControls;return{...t,cubicControls:{control1:[...e?.control1??[0,0]],control2:[...e?.control2??[1,1]]},...t?.springParameters?{springParameters:{...t.springParameters}}:{}}}function I4(t,e,i){let n=Xk(t);if(n==="position"){let r=$k(t);return bh.flatMap((s,a)=>Math.abs(e.elements[4*a+r])>1e-9?[`position.${s}`]:[])}return(i?[n]:["rotation","scale"]).flatMap(r=>bh.map(s=>`${r}.${s}`))}function vZ(t,e){let[i,n,r]=t,s=[[i,n,r],[i+180,180-n,r+180]],a=[i,n,r],o=1/0;for(let l of s){let c=l.map((d,u)=>d+360*Math.round((e[u]-d)/360)),h=c.reduce((d,u,p)=>d+Math.abs(u-e[p]),0);h<o-1e-9&&(a=c,o=h)}return a}function yZ(t,e,i){if(t==="rotation"){let n=((e-i)%360+540)%360-180;return Math.abs(n)<1e-6}return Math.abs(e-i)<1e-9*Math.max(1,Math.abs(e),Math.abs(i))}function _Z(t,e,i,n){let r=new Map;for(let{id:p,data:f}of t.unproxy()){if(f.isPlaceholder)continue;let g=fZ(f.path);if(!g){if(Ym.includes(f.path?.[0]))return;continue}if(typeof f.value!="number"||!Number.isFinite(f.value))return;let m=r.get(g)??{keys:[],sampled:[]};m.keys.push({id:p,time:f.time,value:f.value,keyframe:f}),r.set(g,m)}if(r.size===0)return;for(let p of r.values())p.keys.sort((f,g)=>f.time-g.time),p.sampled=qk(p.keys.map(f=>({time:f.time,ease:mZ(f.keyframe.easing),value:f.value})));let s=(p,f)=>{let g=r.get(p);return g?function(m,v){let{index0:y,index1:_,t:b}=Wk(m.sampled,v),x=m.sampled[y].value;return x+(m.sampled[_].value-x)*b}(g,f):i[Xk(p)][$k(p)]},a=new qt,o=new ci,l=new Et,c=new T,h=new T,d=p=>{let f=(g=>{let m={};for(let v of Ym)m[v]=bh.map((y,_)=>s(U3[3*Ym.indexOf(v)+_],g));return m})(p);return o.set(f.rotation[0]*Pt.DEG2RAD,f.rotation[1]*Pt.DEG2RAD,f.rotation[2]*Pt.DEG2RAD),l.compose(c.fromArray(f.position),a.setFromEuler(o),h.fromArray(f.scale)).premultiply(e),{pose:f,out:B3(l)}},u=function(p){let f=p.elements,g=[0,4,8].map(y=>new T(f[y],f[y+1],f[y+2])),m=g[0].lengthSq(),v=1e-9*Math.max(1,m);return Math.abs(g[1].lengthSq()-m)<v&&Math.abs(g[2].lengthSq()-m)<v&&Math.abs(g[0].dot(g[1]))<v&&Math.abs(g[0].dot(g[2]))<v&&Math.abs(g[1].dot(g[2]))<v}(e);for(let p of Ym){let f,g=bh.map(_=>`${p}.${_}`),m=_=>{let b=new Set;for(let x of I4(_,e,u))for(let w of r.get(x)?.keys??[])b.add(w.time);return[...b].sort((x,w)=>x-w)},v=[...new Set(g.flatMap(_=>m(_)))].sort((_,b)=>_-b),y=new Map;for(let _ of v){let{pose:b,out:x}=d(_),w=[...x[p]];p==="rotation"&&(w=vZ(w,f?f.out.map((S,E)=>S+b.rotation[E]-f.in[E]):b.rotation),f={in:b.rotation,out:w}),y.set(_,w)}g.forEach((_,b)=>{let x=r.get(_)?.keys??[],w=m(_),S=new Set(w);if(x.length!==0||!w.every(E=>yZ(p,y.get(E)[b],n[p][b]))){for(let E of x)S.has(E.time)||t.delete(E.id);for(let E of w){let A=y.get(E)[b],P=x.find(O=>O.time===E);if(P){let O=t.data(P.id);O&&(O.value=A);continue}let C=I4(_,e,u).sort((O,D)=>Number(D===_)-Number(O===_)).map(O=>r.get(O)?.keys.find(D=>D.time===E)).find(O=>O!==void 0),R=Pt.generateUUID();t.insertBefore(null,[{id:R,data:{id:R,time:E,path:[p,bh[b]],value:A,easing:gZ(C.keyframe.easing),index:_h.rowOrder([p])}}])}}})}}var Ym,bh,U3,bZ=z(()=>{J(),I3(),pZ(),v0(),bh=["x","y","z"],U3=(Ym=["position","rotation","scale"]).flatMap(t=>bh.map(e=>`${t}.${e}`))}),Yk={};function L4(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.alphaOverride===void 0&&(e.alphaOverride=1)})}function Zk(t){let e=t.geometry;e!==void 0&&i6.has(e.type)&&e.extrusionVersion===void 0&&(e.extrusionVersion=1)}function Kk(t){if(t.type!=="Empty")return;let e=en(t.animations);if(!Array.isArray(e))return;let i=e.map(cZ);i.some((n,r)=>n!==e[r])&&(t.animations=i)}function B4(t,e){let[i,n,r]=t,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r),d=[o*c,s*h+a*c*l,a*h-s*c*l],u=Math.hypot(e[0],e[1],e[2])||1;return Math.abs((d[0]*e[0]+d[1]*e[1]+d[2]*e[2])/u)}function Qk(t){(function(i){i.rotation=i.rotation.slice(0,3).map(n=>n*Hl)})(t),t.type==="Page"&&function(i){let n=i.rotation.slice(0,3);(function(r,s){let a=Array.isArray(s)&&s.length>=3&&s.every(c=>typeof c=="number"&&Number.isFinite(c))?s:[0,1,0],o=B4(r,a),l=B4(r.map(c=>c*n6),a);return Math.abs(o-l)<1e-6?r.some(c=>Math.abs(c)>Math.PI):l<o})(n,i.up)?i.rotation=n:i.rotation=n.map(r=>r*Hl)}(t.camera),t.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(n=>n*Hl))});let e=t.geometry;e&&e.type==="SphereGeometry"&&(e.thetaLength=(e.thetaLength??180)*Hl),e&&e.type==="TorusGeometry"&&(e.arc=e.arc*Hl),e&&e.type==="PathGeometry"&&(e.extrusion.angle*=Hl,e.extrusion.twist*=Hl),t.type==="Mesh"&&t.geometry.type==="TextGeometry"&&(t.geometry.text={textValue:t.geometry.text}),Array.isArray(en(t.events))&&t.events?.forEach(i=>{(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress"||i.type==="KeyDown"||i.type==="KeyUp"||i.type==="KeyPress"||i.type==="Collision"||i.type==="Trigger")&&(i.runMode=i.toggle?"Toggle":"Repeat")})}function xZ(t){t.scene.objects.traverse((e,i)=>{})}function wZ(t){let e=t.schema??104;e!==135&&(e<130&&(z3(t.asset),t.schema=130),e<135&&(F3(t.asset),t.schema=135))}function qa(t,e){e(t.data);for(let i of t.children)qa(i,e)}function Jk(t){let e=t.schema??104;e!==135&&(e<105&&(qa(t.asset,Qk),t.schema=105),e<118&&(qa(t.asset,t6),t.schema=118),e<121&&(qa(t.asset,sT),t.schema=121),e<130&&(qa(t.asset,i=>U4(i,z3)),t.schema=130),e<132&&(qa(t.asset,Zk),t.schema=132),e<133&&(qa(t.asset,i=>e6(i,()=>{})),t.schema=133),e<134&&(qa(t.asset,Kk),t.schema=134),e<135&&(qa(t.asset,i=>U4(i,F3)),t.schema=135))}function nT(t,e){Xo(t,e),qo(t,e),Object.values(t.shared.lib.materials).forEach(i=>e(i.asset))}function z3(t){t.layers===void 0&&Object.assign(t,zi.defaultTwoLayerData("phong"))}function F3(t){let e=Gm(t),i=zi.withRepairedLayers(e);i!==e&&(t.layers=i.layers)}function U4(t,e){"materials"in t?t.materials.forEach(i=>{i!==void 0&&typeof i!="string"&&e(i)}):"material"in t&&t.material!==void 0&&typeof t.material!="string"&&e(t.material)}function t6(t){t.timelineAnimations=Ar({},te.prototype)}function SZ(t){let e=[];return t?(t.forEach((i,n)=>{let{path:r,keyframes:s}=i.data,a=r[0]==="material"?i.id:void 0;s?.length?s.forEach(({id:o,data:l})=>{e.push({id:o,data:{...l,path:r,layerId:a,index:n}})}):e.push(_h.placeholderKeyframe(i.id,r,{layerId:a,index:n}))}),e.sort((i,n)=>i.data.time-n.data.time),new Nt(...e.map((i,n)=>({...i,fi:n})))):new Nt}function MZ(t){for(let{id:e,data:i}of[...t.unproxy()]){let n=i.path?.[0];if(!n||!r6.includes(n))continue;let r=rT(i.value);if(!r.length)continue;let s=t.data(e);if(!s)continue;let a=i.value,[o,...l]=r;for(let c of l){let h=Pt.generateUUID();t.insertBefore(null,[{id:h,data:{...i,id:h,path:[n,c],value:a[c],easing:EZ(i.easing)}}])}s.path=[n,o],s.value=a[o]}}function rT(t){return t===null||typeof t!="object"?[]:e0.filter(e=>e in t)}function EZ(t){let e=t?.cubicControls;return{...t,cubicControls:{control1:[...e?.control1??[0,0]],control2:[...e?.control2??[1,1]]},...t?.springParameters?{springParameters:{...t.springParameters}}:{}}}function AZ(t,e){return Math.abs(t[0]-e[0])<1e-6&&Math.abs(t[1]-e[1])<1e-6}function TZ(t){let e=function(s){let a=[];for(let o of _h.groupKeyframes(s)){let l=new Set(o.keyframes.flatMap(h=>rT(h.data.value))),c=l.size?[...l].map(h=>o.keyframes.filter(d=>rT(d.data.value).includes(h))):[o.keyframes];for(let h of c){let d=[...h].sort((u,p)=>u.data.time-p.data.time);for(let u=0;u+1<d.length;u++)a.push({left:d[u],right:d[u+1]})}}return a}([...t.unproxy()]),i=new Map,n=new Set;for(let{left:s,right:a}of e){let o=s.data.easing?.type,l=(o===void 0?void 0:_h.presetHandles(o))?.control2??(o===5?dl(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let c=i.get(a.id);c?AZ(c,l)||n.add(a.id):i.set(a.id,l)}let r=new Map;for(let{id:s,data:a}of t.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:_h.presetHandles(o);l&&r.set(s,l.control1)}for(let{left:s,right:a}of e)n.has(a.id)&&r.delete(s.id);for(let[s,a]of r){let o=t.data(s);!o?.easing||(o.easing.cubicControls={control1:a,control2:dl(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:s,right:a}of e){if(!r.has(s.id))continue;let o=t.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:dl(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function z4(t,e){t.scene.objects.traverse((i,n)=>{let r=n;if(r.type==="Page"&&r.timelines)for(let s of Object.values(r.timelines))for(let a of Object.values(s.objectTimelines??{}))e(a.keyframes)})}function sT(t){t.pivot=[0,0,0],t.pivotRotation=[0,0,0]}function e6(t,e,i=[]){let n=["position","rotation","scale","shear"];function r(u,p,f){return u?.map(g=>typeof g=="string"?e(g)??f:g)??[...p]}function s(u,p){if(u&&!function(f){return f.every((g,m)=>Math.abs(g-(m%5==0?1:0))<1e-6)}(u))return B3(new Et().fromArray(u).multiply(new Et().compose(new T().fromArray(p.position),new qt().setFromEuler(new ci(p.rotation[0]*Pt.DEG2RAD,p.rotation[1]*Pt.DEG2RAD,p.rotation[2]*Pt.DEG2RAD)),new T().fromArray(p.scale))))}function a(u,p){return u.length===p.length&&u.every((f,g)=>f===p[g])}t.shear=xs.zero;let o=t,l=o.hiddenMatrix;l!==void 0&&delete o.hiddenMatrix;let c={position:r(o.position,[0,0,0],0),rotation:r(o.rotation,[0,0,0],0),scale:r(o.scale,[1,1,1],1)},h=s(l,c);if(h&&Object.assign(o,h),h){let u=new Et().fromArray(l);for(let p of i)_Z(p,u,c,h)}let d=h??{...c,shear:[...xs.zero]};o.states?.forEach(u=>{let p=u.hiddenMatrix;if(p!==void 0&&delete u.hiddenMatrix,p===void 0&&u.position==null&&u.rotation==null&&u.scale==null)return;let f={position:r(u.position,c.position,0),rotation:r(u.rotation,c.rotation,0),scale:r(u.scale,c.scale,1)},g=s(p??l,f);if(!h&&!g)return;let m=g??{...f,shear:[...xs.zero]};for(let v of n)(u[v]!=null||!a(m[v],d[v]))&&(u[v]=m[v])})}function CZ(t){}function PZ(t){let e=t.schema??0;if(e!==135){if(e>135)return void console.error(`This scene was created with a newer version of Spline (file format ${e}, this runtime reads 135). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",e,"to ",135),function(i,n){if(n<1&&(Xo(i,w4),qo(i,w4),i.schema=1),n<2&&(function(r){Object.assign(r.scene.publish,{orbitControls:{...Ab.defaultData,...en(r.scene.publish.orbitControls)}})}(i),i.schema=2),n<3&&(function(r){function s(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,c]of Object.entries(o))if((Tx.includes(l)||typeof c=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(c))(M3.includes(h)||typeof d=="boolean")&&delete c[h]}}}r.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let c=l;c.material?s(c.material):c.materials&&c.materials.forEach(h=>{s(h)})})})}(i),i.schema=3),n<4&&(function(r){r.scene.publish.withBackground=!0}(i),i.schema=4),n<5&&(function(r){r.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),n<6&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.cloner;o&&(o.radial.scale=o.radial.scale.map(l=>l+1),o.linear.scale=o.linear.scale.map(l=>l+1))})}(i),i.schema=6),n<7&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),n<8&&(i.schema=8),n<9&&(M4(i),i.schema=9),n<10&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.geometry.phongAngle=35)})}(i),i.schema=10),n<11&&(function(r){r.scene.environment.ambientLight.softShadows=!1,r.scene.environment.ambientLight.softShadowQuality="low",r.scene.objects.traverse((s,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),r.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),n<12&&(M4(i),i.schema=12),n<13&&(function(r){r.shared.audios=Ar({},te.prototype)}(i),i.schema=13),n<14&&(function(r){let s=r.shared.materials;Object.entries(s).forEach(([a,o])=>{if(!o.layers){let l={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(s,{[a]:l})}})}(i),i.schema=14),n<15&&(function(r){Object.entries(en(r.shared.images)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.images[s]}),Object.entries(en(r.shared.audios)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.audios[s]})}(i),i.schema=15),n<16&&(function(r){r.scene.publish.settings.web.preload=!1}(i),i.schema=16),n<17&&(Xo(i,E4),qo(i,E4),i.schema=17),n<18&&(Xo(i,S4),qo(i,S4),i.schema=18),n<19&&(function(r){Object.assign(r.scene.publish.settings,{video:{...ol.defaultData.settings.video,...en(r.scene.publish.settings.video)}})}(i),i.schema=19),n<20&&(function(r){r.shared.fonts=Ar({},te.prototype)}(i),function(r){let s=[];r.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let c=zi.defaultTwoLayerData("phong"),h=typeof l.color=="string"?r.shared.colors[l.color]:l.color;c.layers[1].data.color={r:h.r,g:h.g,b:h.b},c.layers[1].data.alpha=l.alpha;let d=function(f){return f.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join(" ")}(l.font);r.shared.fonts[d]===void 0&&(r.shared.fonts[d]={name:d});let u={name:l.name,...Tn.defaultData,...Xa.defaultData,flatShading:!1,wireframe:!1,geometry:{...Qo.defaultData("TextGeometry"),width:l.width,height:l.height,font:d,depth:0,horizontalAlign:l.horizontalAlign,verticalAlign:l.verticalAlign,fontSize:1.40625*l.fontSize,lineHeight:l.lineHeight/1.40625,letterSpacing:l.letterSpacing-1,text:l.text,textTransform:l.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:c,states:en(l.states),events:en(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=en(r.scene.objects).parent(a);r.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:u,children:[]}]),s.push(a)}}),s.forEach(a=>{r.scene.objects.delete(a)})}(i),i.schema=20),n<21&&(function(r){let s={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};r.scene.objects.traverse((a,o)=>{o.events.forEach(l=>{if(s[Number(l.type)])if(Object.assign(l,{type:s[Number(l.type)]}),l.type==="Audio"&&"audioEvent"in l&&(Object.assign(l,{playAudio:l.audioEvent}),delete l.audioEvent),l.type==="GameControl")Object.assign(l,{gameActions:{idle:new Nt,move:new Nt,jump:new Nt}});else{let c=new Nt;Object.assign(l,{actions:c}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&c.push({fi:0,id:Pt.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((h,d,u)=>{let p={easing:h.easing,duration:h.duration};h.easing===6?Object.assign(p,Tc(h,"mass","stiffness","damping","velocity")):h.easing===5&&Object.assign(p,{control1:{...h.control1},control2:{...h.control2}});let f={repeat:h.repeat?-1:0,delay:h.delay,delayDirection:h.delayDirection,direction:h.cycle&&h.rewind?"pingpong-rewind":h.cycle?"pingpong":"normal"},g={state:h.state,...f,...p},m={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Nt({fi:0,id:Pt.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:Pt.generateUUID(),data:g})};c.push({fi:u,id:d,data:m})}),delete l.targets)}})})}(i),function(r){r.scene.objects.traverse((s,a)=>{function o(l,c){let h=new Nt,d=[];if(a.events.forEach((u,p,f)=>{if(u.type==="Audio"&&u.trigger===c){let g;d.push(p),u.interaction==="play"?g={...Tc(u,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in u?u.after:void 0,toggle:"after"in u?u.toggle:void 0,type:"Audio"}:(u.interaction==="pause"||u.interaction==="stop")&&(g={...Tc(u,"interaction","delay","object","playAudio"),type:"Audio"}),g&&h.push({fi:f,id:p,data:g})}}),d.forEach(u=>a.events.delete(u)),h.length){let u=a.events.find(p=>p.type===l)?.data;u?"actions"in u&&u.actions.insertBefore(null,h):a.events.insertBefore(null,[{id:Pt.generateUUID(),data:{type:l,actions:h}}])}}o("Start","start"),o("MouseDown","mouseDown"),o("MouseUp","mouseUp"),o("KeyDown","keyDown"),o("KeyUp","keyUp")})}(i),i.schema=21),n<22&&(C4(i),i.schema=22),n<23&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="SubdivGeometry"&&(a.geometry.scaleBaked||(a.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),n<24&&(function(r){r.scene.objects.traverse((s,a)=>{(a.type==="Empty"||a.type==="Mesh")&&a.cloner&&!a.cloner.randomnessObject&&!a.cloner.toObject&&!a.cloner.randomness&&(a.cloner={...a.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}(i),i.schema=24),(n<25||i.shared.videos===void 0)&&(function(r){r.shared.videos=Ar({},te.prototype)}(i),n<25&&(i.schema=25)),n<26&&(function(r){r.scene.objects.traverse((s,a)=>{let o=r.scene.objects.unproxy().parent(s);if(o){let l=en(r.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=en(a).booleanExclude!==!0)}})}(i),i.schema=26),n<27&&(function(r){r.scene.objects.traverse((s,a)=>{if(a.type==="Mesh"){let o=a;a.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),n<28&&(C4(i),i.schema=28),n<29&&(function(r){function s(o){Object.setPrototypeOf(o,Zi.prototype),o.texture&&Object.setPrototypeOf(o.texture,Zi.prototype)}function a(o){Object.setPrototypeOf(o,Zi.prototype);for(let l in o)s(o[l])}r.scene.objects.traverse((o,l)=>{l.states.forEach(c=>{let h=c;if(h.material){let d=en(h.material).layers;a(d),h.material.layers=d}if(h.materials)for(let d=0;d<h.materials.length;d++){let u=h.materials[d],p=en(u).layers;a(p),u.layers=p}})})}(i),i.schema=29),n<30&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=zi.defaultTwoLayerData("phong"))})}(i),i.schema=30),n<31&&(function(r){r.scene.publish.orbitControls.autoZoom===void 0&&(r.scene.publish.orbitControls.autoZoom=!1),r.scene.objects.traverse((s,a)=>{(a.type==="OrthographicCamera"||a.type==="PerspectiveCamera")&&(a.orthographic.autoZoom===void 0&&(a.orthographic.autoZoom=!1),a.orthographic.autoZoomFrustumSize===void 0&&(a.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),n<33&&(function(r){r.scene.objects.traverse((s,a)=>{a.pathSnapping===void 0&&(a.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),a.pathSnapping.offset===void 0&&(a.pathSnapping.offset=0)})}(i),i.schema=33),n<34&&(function(r){r.scene.publish.mouseEventTarget===void 0&&(r.scene.publish.mouseEventTarget="canvas"),r.scene.publish.settings.web.hint===void 0&&(r.scene.publish.settings.web.hint=!1)}(i),i.schema=34),n<35&&(function(r){let{video:s}=r.scene.publish.settings;s.format==="gif"&&s.fps>48&&(s.fps=15)}(i),i.schema=35),n<36&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-a.position[1]))})})}(i),i.schema=36),n<37&&(function(r){let s=r.scene.environment.usePhysics;r.scene.objects.traverse((a,o)=>{s&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),n<38&&(Xo(i,A4),qo(i,A4),i.schema=38),n<39&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=Cb.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),n<40&&(function(r){r.scene.styles||(r.scene.styles=Bc.defaultData())}(i),i.schema=40),n<41&&(function(r){r.scene.environment.ambientLight.occlusion===void 0&&(r.scene.environment.ambientLight.occlusion=!1),r.scene.environment.ambientLight.aoFullRes===void 0&&(r.scene.environment.ambientLight.aoFullRes=!1),r.scene.environment.ambientLight.radius===void 0&&(r.scene.environment.ambientLight.radius=256),r.scene.environment.ambientLight.bias===void 0&&(r.scene.environment.ambientLight.bias=.5),r.scene.environment.ambientLight.aoColor===void 0&&(r.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Xo(r,P4),qo(r,P4)}(i),i.schema=41),n<42&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Nt})})})}(i),i.schema=42),n<43&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),n<99){Xo(i,D4),qo(i,D4),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=od);let r=en(i.scene.objects),s=i.scene.objects;i.scene.publish.playPage=ep,s.insertBefore(null,null,[{id:ep,data:{...qc.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Tc(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Tc(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...np.defaultData,...Tc(i.scene.environment,"usePhysics","gravity")},camera:en(i.scene.ownerCamera)??qc.defaultData.camera,name:"Scene"},children:[]}]);for(let l of r)l.id!==Uc.TRASH_CAN_ID&&s.move(ep,l.fi,l.id);let a=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,c)=>{c.type==="DirectionalLight"?(c.penumbraSize=i.shared.penumbraSize[Math.min(a,2)],a+=1):c.type==="SpotLight"&&(c.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(c.physics===void 0||c.physics===null)&&c.type!=="Instance"&&(c.physics={},Object.assign(c.physics,ip.defaultData)),c.physics!==void 0&&c.physics!==null&&(c.physics.enabled=c.collision??"visibility",delete c.collision)}),i.schema=99}}(t,e),e<100&&(t.scene.publish.joystickSizeAndXYOffset===void 0&&(t.scene.publish.joystickSizeAndXYOffset=ol.defaultData.joystickSizeAndXYOffset),t.schema=100),e<101&&(Xo(t,L4),qo(t,L4),t.schema=101),e<102&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.geometry;s&&s.type==="PathGeometry"&&(s.extrusion.capType="flat",s.extrusion.bevel=50,s.extrusion.bevelSides=6,s.extrusion.shape.type==="Custom"&&(s.extrusion.shape.shapeQuality="low"))})}(t),t.schema=102),e<104&&(t.shared.catelogs=new te,t.shared.lib=Jo.defaultData(),t.schema=104),e<105&&(function(i){i.shared.variables=Ar({},te.prototype)}(t),t.scene.objects.traverse((i,n)=>{Qk(n)}),t.schema=105);for(let i of Object.values(t.shared.lib.components))Jk(i);if(e<106&&(function(i){let n=en(i.shared.variables);i.shared.variables=Ar(Object.entries(n??{}).map(([r,s],a)=>({fi:a,id:r,data:s})),Nt.prototype)}(t),t.schema=106),e<107&&(t.shared.lib.variables=Jo.defaultData().variables,t.schema=107),e<109&&(function(i){i.shared.particles=Ar({},te.prototype),i.shared.lib&&(i.shared.lib.particles=Jo.defaultData().particles)}(t),t.schema=109),e<110&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Particle"&&typeof r.renderMaterial.size=="number"&&Object.assign(r.renderMaterial,{size:[r.renderMaterial.size,r.renderMaterial.size]})})}(t),t.schema=110),e<111&&(t.scene.objects.traverse((i,n)=>{(function(r){Array.isArray(en(r.events))&&r.events?.forEach(s=>{"disabled"in s||(s.disabled=!1),(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress")&&(s.mode=s.mode||"Object")})})(n)}),t.schema=111),e<112&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Page"&&(r.postprocessing.depthOfField.focusDistance=100,r.postprocessing.depthOfField.focalLength=20,r.postprocessing.depthOfField.bokehScale=5)})}(t),t.schema=112),e<113&&(function(i){i.scene.objects.traverse((n,r)=>{Array.isArray(en(r.events))!==!1&&r.events?.forEach(s=>{let a=s.runMode;s.type==="MouseDown"||s.type==="MouseUp"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="Collision"||s.type==="Trigger"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=a??"Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode=a==="Toggle"?"Toggle":"Normal")}):s.type==="MouseHover"||s.type==="MousePress"||s.type==="KeyPress"?s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):s.type==="GameControl"?(delete s.actions,Object.keys(s.gameActions).forEach(o=>{s.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&"runMode"in l&&(l.runMode="Normal")})})):s.type==="DragDrop"?(delete s.actions,s.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),s.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):s.type==="Resize"?(delete s.actions,s.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"&&"runMode"in l||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):s.type==="Start"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="VariableChange"||s.type==="Scroll"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="Conditional"&&(delete s.actions,s.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}),s.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(t),t.schema=113),e<114&&(t.scene.publish.settings.web.imageQuality===void 0&&(t.scene.publish.settings.web.imageQuality=70),t.schema=114),e<115&&(function(i){i.shared.userAPIs=Ar({},te.prototype),i.shared.userWebhooks=Ar({},te.prototype),i.shared.lib&&(i.shared.lib.userAPIs=Jo.defaultData().userAPIs,i.shared.lib.userWebhooks=Jo.defaultData().userWebhooks)}(t),t.schema=115),e<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=ol.defaultData.settings.videoStatic)}(t),t.schema=116),e<117&&(t.scene.publish.settings.web.pixelRatioMobile===void 0&&(t.scene.publish.settings.web.pixelRatioMobile=0),t.scene.publish.settings.web.pixelRatioDesktop===void 0&&(t.scene.publish.settings.web.pixelRatioDesktop=0),t.schema=117),e<118&&(t.shared.timelineAnimations=Ar({},te.prototype),t.scene.objects.traverse((i,n)=>{t6(n)}),t.schema=118),e<119&&(t.scene.publish.settings.videoStatic.format=rp.defaultData.scene.publish.settings.videoStatic.format,t.scene.publish.settings.videoStatic.imageFormat=rp.defaultData.scene.publish.settings.videoStatic.imageFormat,t.schema=119),e<120&&(t.scene.publish.settings.image.colorSpace="display-p3",t.scene.publish.settings.videoStatic.colorSpace="display-p3",t.schema=120),e<121&&(t.scene.objects.traverse((i,n)=>{sT(n),n.type==="Page"&&n.camera!==void 0&&sT(n.camera)}),t.schema=121),e<122&&(delete t.scene.publish.settings.video,t.scene.publish.orbitControls.rotationSpeed=rp.defaultData.scene.publish.orbitControls.rotationSpeed,t.schema=122),e<123&&(t.scene.objects.traverse((i,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=Zl.defaultData)}),t.schema=123),e<124&&(e>=123&&t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=Zl.defaultData.lighting))}),t.schema=124),e<125&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=Zl.defaultData.lightingIntensity)}),t.schema=125),e<126&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...Zl.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=Zl.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),t.schema=126),e<127&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),t.schema=127),e<128&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),t.schema=128),e<129&&(t.scene.objects.traverse((i,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=qc.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),t.schema=129),e<130&&(nT(t,z3),t.schema=130),e<131&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.states;if(!s)return;let a=r.timelineAnimations,o=[];s.forEach((l,c)=>{(l.isAnimation||a?.[c])&&o.push(c)}),o.forEach(l=>s.delete(l))})}(t),function(i){let n=i.shared,r=n.timelineAnimations;if(!r)return;let s=i.scene.objects,a=s.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(r)){let c=Ar({},te.prototype),h=0,d=Boolean(l.loop);for(let[f,g]of Object.entries(l.mapping??{})){let m=s.data(f)?.timelineAnimations?.[g];!m||(h=Math.max(h,m.to??0),d=d||Boolean(m.loop),c[f]={id:f,keyframes:SZ(m.properties?.unproxy())})}let u=l.page??a,p=u?s.data(u):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=Ar({},te.prototype)))[o]={id:o,name:l.name,duration:h||5,...d?{loop:d}:{},objectTimelines:c})}delete n.timelineAnimations,s.traverse((o,l)=>{delete l.timelineAnimations})}(t),z4(t,MZ),z4(t,TZ),t.schema=131),e<132&&(t.scene.objects.traverse((i,n)=>Zk(n)),t.schema=132),e<133){let i=function(r){return s=>r.get(s)?.data?.value}(t.shared.variables),n=new Map;t.scene.objects.traverse((r,s)=>{let a=s;if(a.type==="Page"&&a.timelines)for(let o of Object.values(a.timelines))for(let[l,c]of Object.entries(o.objectTimelines??{})){let h=n.get(l)??[];h.push(c.keyframes),n.set(l,h)}}),t.scene.objects.traverse((r,s)=>e6(s,i,n.get(r))),t.schema=133}e<134&&(t.scene.objects.traverse((i,n)=>Kk(n)),t.schema=134),e<135&&(nT(t,F3),t.schema=135)}}d0(Yk,{updateAllMaterials:()=>nT,updateDocumentSchema:()=>PZ,updateLibSchema:()=>CZ,updateMaterialSchema:()=>wZ,updateObjectStateRec:()=>qa,updateObjectsSchema:()=>Jk,updateTextValues:()=>xZ});var i6,Hl,n6,r6,F4,Fv,o2,N4,Nv,Fc,Wf,qd,kv,l2,G1,h2,c2,k4,H1,d2,Xc,aT,Rx=z(()=>{J(),bk(),Ye(),I3(),lZ(),Px(),g0(),hs(),Dn(),O3(),Cx(),C3(),v0(),Dk(),bZ(),i6=new Set(["RectangleGeometry","EllipseGeometry","StarGeometry","PolygonGeometry","TriangleGeometry","VectorGeometry","TextGeometry","InputGeometry","PathGeometry"]),Hl=180/Math.PI,n6=Math.PI/180,r6=["position","rotation","scale","shape size"]}),DZ=z(()=>{var t,e,i;hs(),Ye(),Dn(),(F4||(F4={})).is=function(n){return!0},(t=Fv||(Fv={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},t.merge=function(n,r){return{position:r?.position??n.position,rotation:r?.rotation??n.rotation,scale:r?.scale??n.scale,shear:r?.shear??n.shear}},t.diff=function(n,r){return UN({position:io.isEqual(n.position,r.position)?void 0:r.position,rotation:n.rotation===r.rotation?void 0:r.rotation,scale:io.isEqual(n.scale,r.scale)?void 0:r.scale,shear:n.shear&&r.shear&&io.isEqual(n.shear,r.shear)?void 0:r.shear})},(o2||(o2={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(N4||(N4={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(Nv||(Nv={})).defaultData={opacity:1,fill:{color:Je.fromHexAndA(Ir,1),enabled:!0},stroke:{color:Je.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0}},(e=Fc||(Fc={})).newEmpty=function(n,r){return{name:r}},e.patch=function(n,r){if(r===void 0)return n;let s={...n};return Object.assign(s,Fv.merge(s,r)),s=function(a,o){if(o===void 0)return a;let l={...a},c=["width","height","cornerRadius"];for(let h of c)h in l&&h in o&&o[h]!==void 0&&Object.assign(l,{[h]:o[h]});return l}(s,r),s=function(a,o){if(o===void 0)return a;let l={...a};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}(s,r),s},e.toOps=function(n,r){let s,a=[];for(let[o,l]of Object.entries(r))o!=="name"&&(s===void 0&&(s={path:[],props:{},type:0},a.push(s)),s.props[o]=l);return a},(Wf||(Wf={})).defaultData={...Fv.defaultData,...o2.defaultData,states:new Nt,events:new Nt,visible:!0,raycastLock:!1},(qd||(qd={})).defaultData={...Wf.defaultData,...Nv.defaultData},(kv||(kv={})).defaultData={cornerRadius:[0,0,0,0]},(l2||(l2={})).defaultData={...qd.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(G1||(G1={})).defaultData={...qd.defaultData,...kv.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(h2||(h2={})).defaultData={...qd.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"},(c2||(c2={})).defaultData={...qd.defaultData,type:"path2d",path:"",name:"Path"},(k4||(k4={})).is=function(n){return n.type==="ellipse2d"||n.type==="rectangle2d"||n.type==="text2d"||n.type==="vector2d"||n.type==="path2d"},(H1||(H1={})).defaultData={...Wf.defaultData,name:"Group",type:"group2d"},(d2||(d2={})).defaultData=()=>({...Wf.defaultData,...kv.defaultData,...Nv.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Je.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Je.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(n=>{n.defaultData=function(r){switch(r){case"rectangle2d":case"vector2d":return{...G1.defaultData};case"ellipse2d":return{...l2.defaultData};case"text2d":return{...h2.defaultData};case"path2d":return{...c2.defaultData};case"frame2d":return{...d2.defaultData()};case"group2d":return{...H1.defaultData}}},n.getPivot=function(r){return"width"in r&&"height"in r?[typeof r.width=="number"?.5*r.width:0,typeof r.height=="number"?.5*r.height:0]:[0,0]},n.isResizeable=function(r){return r.type==="rectangle2d"||r.type==="ellipse2d"||r.type==="text2d"||r.type==="frame2d"},n.isAutoLayoutable=function(r){return r.type==="frame2d"&&r.autoLayout!==void 0},n.hasCorners=function(r){return r.type==="rectangle2d"||r.type==="frame2d"}})(Xc||(Xc={})),(i=aT||(aT={})).defaultData={name:"UI",type:"scene2d",objects:new qn},i.emptyData=function(){return{type:"scene2d",objects:new qn}}}),s6=z(()=>{tZ(),eZ(),ak(),ok(),bk(),ik(),uk(),pk(),gk(),C3(),Rx(),_k(),T3(),A3(),lk(),g0(),dk(),vk(),hs(),Px(),Cx(),Dk(),D3(),mk(),O3(),R3(),nZ(),fk(),L3(),P3(),hk(),ck(),DZ()});function Nc(t,e=!1){let i=t[0].index!==null,n=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},a={},o=t[0].morphTargetsRelative,l=new jt,c=0;for(let h=0;h<t.length;++h){let d=t[h],u=0;if(i!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.morphAttributes[p])}if(e){let p;if(i)p=d.index.count;else{if(d.attributes.position===void 0)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(c,p,h),c+=p}}if(i){let h=0,d=[];for(let u=0;u<t.length;++u){let p=t[u].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+h);h+=t[u].attributes.position.count}l.setIndex(d)}for(let h in s){let d=V4(s[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,d)}for(let h in a){let d=a[h][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let u=0;u<d;++u){let p=[];for(let g=0;g<a[h].length;++g)p.push(a[h][g][u]);let f=V4(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(f)}}}return l}function V4(t){let e,i,n,r=-1,s=0;for(let c=0;c<t.length;++c){let h=t[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=h.itemSize),i!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=h.normalized),n!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=h.gpuType),r!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=h.count*i}let a=new e(s),o=new Ht(a,i,n),l=0;for(let c=0;c<t.length;++c){let h=t[c];if(h.isInterleavedBufferAttribute){let d=l/i;for(let u=0,p=h.count;u<p;u++)for(let f=0;f<i;f++){let g=h.getComponent(u,f);o.setComponent(u+d,f,g)}}else a.set(h.array,l);l+=h.count*i}return r!==void 0&&(o.gpuType=r),o}var y0=z(()=>{J()});function a6(t){let e=t.points.length/7,i=new Nt;for(let n=0;n<e;n++){let r=7*n,s=t.points[r+0],a=t.points[r+1],o=t.points[r+2],l=t.points[r+3],c=t.points[r+4],h=t.points[r+5],d=t.points[r+6];i.push({fi:n,id:Pt.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[c,h]}}})}return{points:i,isClosed:t.isClosed,roundness:t.roundness,shapeHoles:t.shapeHoles?.map(n=>a6(n))??[]}}function o6(t){let{userData:e,uuid:i,...n}=t;if(e===void 0||e.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:c}=a,h=c?.groups,d=c?.attributes??{},u=c?.morphAttributes??{},p=c?.interleavedBuffers,f=c?.arrayBuffers,g=c?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(v){let y=1/0,_=1/0,b=1/0,x=-1/0,w=-1/0,S=-1/0;for(let E=0;E<v.length;E+=3){let A=v[E],P=v[E+1],C=v[E+2];y=Math.min(y,A),_=Math.min(_,P),b=Math.min(b,C),x=Math.max(x,A),w=Math.max(w,P),S=Math.max(S,C)}return{width:x-y,height:w-_,depth:S-b}}(d.position.array));let m={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:u,interleavedBuffers:p,arrayBuffers:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return g!==void 0&&Object.assign(m.data,{index:g}),h!==void 0&&Object.assign(m.data,{groups:h.map(v=>({...v,materialIndex:v.materialIndex??0}))}),m}(t);if(e.type==="SubdivGeometry"){let a="SubdivGeometry",o=n.data?.attributes;if(o?.positionWASM===void 0){let c=new jt;if(o?.position===void 0||o?.faceMap===void 0)return null;let h=o.position.array,d=o.faceMap.array,u=n.data.index.array;c.setAttribute("position",new kt(h,3)),c.setIndex(new mh(u,1));let p=function(v,y=1e-4){y=Math.max(y,Number.EPSILON);let _={},b=v.getIndex(),x=v.getAttribute("position"),w=b?b.count:x.count,S=0,E=Object.keys(v.attributes),A={},P={},C=[],R=["getX","getY","getZ","getW"],O=["setX","setY","setZ","setW"];for(let q=0,rt=E.length;q<rt;q++){let it=E[q],Y=v.attributes[it];A[it]=new Y.constructor(new Y.array.constructor(Y.count*Y.itemSize),Y.itemSize,Y.normalized);let ht=v.morphAttributes[it];ht&&(P[it]||(P[it]=[]),ht.forEach((ot,ft)=>{let pt=new ot.array.constructor(ot.count*ot.itemSize);P[it][ft]=new ot.constructor(pt,ot.itemSize,ot.normalized)}))}let D=.5*y,F=Math.log10(1/y),V=Math.pow(10,F),U=D*V;for(let q=0;q<w;q++){let rt=b?b.getX(q):q,it="";for(let Y=0,ht=E.length;Y<ht;Y++){let ot=E[Y],ft=v.getAttribute(ot),pt=ft.itemSize;for(let tt=0;tt<pt;tt++)it+=~~(ft[R[tt]](rt)*V+U)+","}if(it in _)C.push(_[it]);else{for(let Y=0,ht=E.length;Y<ht;Y++){let ot=E[Y],ft=v.getAttribute(ot),pt=v.morphAttributes[ot],tt=ft.itemSize,mt=A[ot],N=P[ot];for(let L=0;L<tt;L++){let H=R[L],$=O[L];if(mt[$](S,ft[H](rt)),pt)for(let B=0,Z=pt.length;B<Z;B++)N[B][$](S,pt[B][H](rt))}}_[it]=S,C.push(S),S++}}let j=v.clone();for(let q in v.attributes){let rt=A[q];if(j.setAttribute(q,new rt.constructor(rt.array.slice(0,S*rt.itemSize),rt.itemSize,rt.normalized)),q in P)for(let it=0;it<P[q].length;it++){let Y=P[q][it];j.morphAttributes[q][it]=new Y.constructor(Y.array.slice(0,S*Y.itemSize),Y.itemSize,Y.normalized)}}return j.setIndex(C),j}(c),f=[],g=new Array(d[d.length-1]+1).fill(3),m=p.getIndex().array;for(let v=0,y=d.length;v<y;)d[v]===d[v+1]?(g[d[v]]++,f.push(...new Set(m.slice(3*v,3*v+6))),v+=2):(f.push(...m.slice(3*v,3*v+3)),v++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:g}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:a,...RZ(o.positionWASM.array)};l.subdivisions=e.parameters.subdivisions;for(let c in o)c==="positionWASM"?l[c]=new Float32Array(o[c].array):c==="indexWASM"?l[c]=new Int32Array(o[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(o[c].array));return l.scaleBaked=[1,1,1],l}let r=e.type,s=e.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:a6(e.shape),type:r}):r==="LatheGeometry"?{...e.parameters,type:r,points:(e?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function RZ(t){return oT.setFromArray(t),oT.getSize(Zm),{width:Zm.x,height:Zm.y,depth:Zm.z}}var oT,Zm,u2,OZ=z(()=>{Ye(),J(),y0(),new Et,new qt,new ci,new T,new T,oT=new hi,Zm=new T}),IZ=z(()=>{var t;(t=u2||{}).view="view",t.edit="edit",((u2=t)||(u2={})).canWrite=function(e){return e!=="view"},class extends Error{constructor(e,i){super(`This is a ${e.toUpperCase()} document, but it was opened as a ${i.toUpperCase()} one`),this.actual=e,this.expected=i,this.name="DocumentKindMismatchError"}}}),l6,ul,Eg,h6,c6,Pp,qf,Vv,p2,Dp,j4,f2,G4,m2,wp,Ol,Il,Do,g2,H4,W4,v2,lT,hl,d6=z(()=>{IZ()}),LZ=z(()=>{}),BZ=z(()=>{Ye(),Rx(),d6()}),UZ=z(()=>{g0(),[...Tx],new Set(M3)}),Xt=z(()=>{s6(),LZ(),sZ(),Rx(),BZ(),d6(),I3(),UZ(),L3(),Ye()}),po=z(()=>{l6=[3,4,8,9],ul=5,Eg=3,h6=32,c6=.98}),_0=z(()=>{J(),Pp=t=>{var e;return(e=class extends t{}).geometryHelper=new ya(30,30,30),e}}),b0=z(()=>{J(),qf=new il,Vv=new vr,p2=new Et,Dp=(t,e,i,n,r=!1,s=t)=>{let a=e,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),Vv.copy(a.boundingSphere),Vv.applyMatrix4(o),i.ray.intersectsSphere(Vv)===!1||(p2.copy(o).invert(),qf.copy(i.ray).applyMatrix4(p2),a.boundingBox!==null&&qf.intersectsBox(a.boundingBox)===!1))return;let l,c,h,d,u,p,f=a.index,g=a.attributes.position,m=a.drawRange;if(r===!1){for(u=Math.max(0,m.start),p=Math.min(f.count,m.start+m.count);u<p;u+=3)if(c=f.getX(u),h=f.getX(u+1),d=f.getX(u+2),l=v(t,i,qf,g,c,h,d),l)return l.faceIndex=Math.floor(u/3),void n.push(l)}else{let y=a.attributes.position,_=new T,b=new T,x=new T,w=new T,S=2,E=1/((s.scale.x+s.scale.y+s.scale.z)/3),A=E*E;for(let P=Math.max(0,m.start),C=Math.min(y.count,m.start+m.count)-1;P<C;P+=S){if(_.fromBufferAttribute(y,P),b.fromBufferAttribute(y,P+1),qf.distanceSqToSegment(_,b,w,x)>A)continue;w.applyMatrix4(s.matrixWorld);let R=i.ray.origin.distanceTo(w);R<i.near||R>i.far||n.push({distance:R,point:x.clone().applyMatrix4(s.matrixWorld),object:t})}}function v(y,_,b,x,w,S,E){let A=new T,P=new T,C=new T,R=new T,O=new T;if(A.fromBufferAttribute(x,w),P.fromBufferAttribute(x,S),C.fromBufferAttribute(x,E),b.intersectTriangle(A,P,C,!1,R)===null)return null;O.copy(R),O.applyMatrix4(y.matrixWorld);let D=_.ray.origin.distanceTo(O);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:O.clone(),object:y}}}}),Ox=z(()=>{J(),_0(),b0(),j4=new T(1,1,1),f2=new T,G4=new T,m2=new qt,wp=class extends Pp(nN){constructor(t,e=15){super(e),this.object=t,this.dummy=new Tp,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(t,e){Dp(this.object,wp.geometryHelper,t,e,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(t){this.object.matrixWorld.decompose(f2,m2,G4),this.matrix.compose(f2,m2,j4),super.updateMatrixWorld(t)}updateWorldMatrix(t,e){}}}),zZ=z(()=>{J(),Ol=new T,Il=new T,Do=new Et,g2=[new T(-1,1,1),new T(-1,-1,1),new T(1,-1,1),new T(1,1,1),new T(-1,1,-1),new T(-1,-1,-1),new T(1,-1,-1),new T(1,1,-1)],H4=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],W4=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],v2=(t,e,i)=>{t.updateEntityBoxSize(Ol,Il),Do.copy(e).multiply(t.matrixWorld),Il.x===0&&Il.y===0&&Il.z===0?i.push(new T(Ol.x,Ol.y,Ol.z).applyMatrix4(Do)):g2.forEach(n=>{i.push(n.clone().multiply(Il).add(Ol).applyMatrix4(Do))})},lT=class extends hi{constructor(){super(...arguments),this.matrix=new Et,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(e=>e.clone()),this.faces=t.faces.map(e=>e.clone()),this.edges=t.edges.map(e=>e.clone()),this.centerEdges=t.centerEdges.map(e=>e.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new Et().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let n=[];if(i===!0){let r=[];t.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s))return Do.copy(e).multiply(s.matrixWorld),void r.push(new T().applyMatrix4(Do));v2(s,e,n)}}),n.length===0&&n.push(...r)}else v2(t,e,n);return this.setFromPoints(n)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(Do.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Il).multiplyScalar(.5),this.getCenter(Ol),Do.copy(this.matrix).setPosition(Ol),this.vertices=g2.map(t=>t.clone().multiply(Il).applyMatrix4(Do))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=H4.map(([t,e])=>new bs(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new T))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=W4.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}}}),Pb=z(()=>{hl={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function Ag(t){return t?.isParticleSystem===!0}function ed(t){return t?.isHairSystem===!0}function pl(t){return t?.isShapeBlendEntity===!0}function Ix(t){return t?.isPathObject===!0}function ls(t){return t?.isObject2D===!0}function Pr(t){return t?.isUIObject===!0}function oh(t){return t?.isCloner===!0}function lh(t){return t?.isClone===!0}function W1(t){return t?.isComponentObject===!0}var Oi=z(()=>{});function Ei(t){N3.add(t)}function jn(t,e){let i=`${t}:${e}`;dT.has(i)||dT.add(i)}function Db(t,e){k3.set(t,e)}function y2(t){return k3.get(t)}function Rp(t,e){V3.set(t,e)}function _2(t){return V3.get(t)}function hT(t,e){j3.set(t,e)}function u6(t){return j3.get(t)}function cT(){return Lx}var N3,dT,k3,V3,j3,Lx,Rb,ke=z(()=>{N3=new Set,dT=new Set,k3=new Map,V3=new Map,j3=new Map,Lx=null,Rb=null});function p6(t,e,i,n,r=new Et){return r.compose(t,e,f6).multiply(i).scale(n)}var f6,b2,kc,Bx,Op=z(()=>{J(),Dx(),f6=new T(1,1,1),b2=new Et,(kc||(kc={})).is=function(t){return t&&t.__isSPEObject},Bx=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new Et,this.copyPreviousMatrix=!0,this.pivotMatrix=new Et,this.matrixWorldRigid=new Et,this.shearScale=new Et,this.shearScaleInv=new Et,this.shearMatrix=new Et}get __isSPEObject(){return!0}getPhysicsLocalMatrix(e){return!!this.rigidBody?.isDynamic()&&(e.copy(this.matrixWorld),this.hasNonUniformScale&&e.multiply(this.shearScaleInv),this.parent&&e.premultiply(b2.copy(this.parent.matrixWorld).invert()),e.multiply(b2.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(e){e instanceof xi&&(e=e.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===e)return!0;i=i.parent}return!1}updateMatrix(){!this.shearMatrix||(p6(this.position,this.quaternion,this.shearMatrix,this.scale,this.matrix),this.matrixWorldNeedsUpdate=!0)}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let i of this.children)i.updateMatrixWorld(e)}updateWorldMatrix(e,i){let n=this.parent;if(e&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),i)for(let r of this.children)r.updateWorldMatrix(!1,!0)}traverseChildren(e,i=0){for(let n of this.children)kc.is(n)&&n.traverseObject(e,i+1)}traverseObject(e,i=0){if(e(this,i)!==!0)for(let n of this.children)kc.is(n)&&n.traverseObject(e,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=Mk(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(e,i){this.updateWorldMatrix(!0,!1);let n=new Et().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),n.multiply(e.parent.matrixWorld)),e.applyMatrix4(n),e.updateWorldMatrix(!1,!1),this.add(e),i!==void 0&&(this.children.pop(),this.children.splice(i,0,e)),this}copy(e,i=!1){return super.copy(e,i),this}onAfterRender(e,i,n,r,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function q4(t,e,i){return Kl.subVectors(e,t),i0.subVectors(e,i),Kl.cross(i0).length()<=Tg}function m6(t){let e=fT.get(t.points);if(e!==void 0&&e.isClosed===t.isClosed)return e.curve;let i=function(n){let r=n.points,s=[r[0]],a=[new T(...r[0].data.position)];Cc.copy(a[0]);for(let v=0;v<r.length-1;v++)Kl.fromArray(r[v].data.position),i0.fromArray(r[v+1].data.position),Iu.subVectors(Kl,Cc),Lu.subVectors(Kl,i0),Iu.cross(Lu).length()>Tg&&(s.push(r[v]),a.push(new T().copy(Kl)),Cc.copy(Kl));let o=r[r.length-1];s.push(o),a.push(new T(...o.data.position));let l=n.isClosed,c=s.length-(l?0:1),h=s.length,d=[],u=[];for(let v=0;v<h;v++){let y=s[v].data;d.push(new T(...y.controlPrevious.position)),u.push(new T(...y.controlNext.position))}let p=[];for(let v=0;v<c;v++){let y=v===h-1?0:v+1;p.push(q4(a[v],u[v],a[y])&&q4(a[v],d[y],a[y]))}let f=[];for(let v=0;v<h;v++){let y=s[v].data,_=a[v],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[v],controlNext:u[v],tan:void 0,baseRoundness:y.roundness,removedLength:0};if(f.push(b),y.roundness===0||!l&&(v===0||v===h-1))continue;let x=l&&v==0?h-1:v-1,w=l&&v==h-1?0:v+1,S=new T().subVectors(a[x],_).normalize(),E=new T().subVectors(a[w],_).normalize();b.prevDir=S,b.nextDir=E;let A=p[l&&v===0?h-1:v-1],P=p[v];if(A&&P){Pc.addVectors(S,E).normalize();let C=Cc.crossVectors(Pc,S).length()/S.dot(Pc);b.tan=C,b.removedLength=y.roundness/C}}for(let v=0;v<c;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y];if(_.removedLength!==0||b.removedLength!==0){let x=_.position.distanceTo(b.position);_.removedLength=Math.min(_.removedLength,x/2),b.removedLength=Math.min(b.removedLength,x/2)}}let g=new Array(2*h).fill(null);for(let v=0;v<c;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y],x=null;if(p[v]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(Cc.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(Cc.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>Tg&&(x=new gg(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>Tg&&(x=new gg(_.position,_.controlNext,b.controlPrevious,b.position));g[2*v+1]=x}for(let v=0;v<h;v++){let y=f[v];if(y.removedLength===0)continue;let _=y.position,b=y.prevDir.clone().multiplyScalar(y.removedLength).add(_),x=y.nextDir.clone().multiplyScalar(y.removedLength).add(_),w=y.tan*y.removedLength;Pc.addVectors(y.prevDir,y.nextDir).normalize(),Iu.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;pT.copy(Pc).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Iu),q1.copy(Pc).multiplyScalar(-w).add(pT);let E=_.distanceTo(q1)/_.distanceTo(Iu);Lu.copy(y.prevDir).multiplyScalar(E*_.distanceTo(b)).add(_),uT.copy(Lu).lerp(q1,2);let A=b.clone().lerp(Lu,4/3),P=x.clone().lerp(uT,4/3);g[2*v]=new gg(b,A,P,x)}let m=new g6;for(let v=0;v<g.length;v++){let y=g[v];y&&m.add(y)}return m}(t);return fT.set(t.points,{isClosed:t.isClosed,curve:i}),i}var g6,Tg,Kl,i0,Cc,Pc,Iu,q1,Lu,uT,pT,fT,Bu,mT,X1,v6,y6,_6,Ie,$a,X4,$4,Xf,x2,jv,w2,S2,Ux,gT,ld,Ka,b6=z(()=>{J(),g6=class extends rA{constructor(){super()}getPoints(t=12){let e,i=[],n=this.getCurveLengths(),r=n[n.length-1]/n.length;for(let s=0,a=this.curves;s<a.length;s++){let o=a[s],l=s===0?n[s]:n[s]-n[s-1],c=Math.ceil(t*l/r),h=o.getPoints(c);for(let d=0;d<h.length;d++){let u=h[d];e&&e.equals(u)||(i.push(u),e=u)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},Tg=.001,Kl=new T,i0=new T,Cc=new T,Pc=new T,Iu=new T,q1=new T,Lu=new T,uT=new T,pT=new T,fT=new WeakMap}),FZ=z(()=>{J(),Bu=new Et,mT=new qt,X1=new qt,v6=new ci,y6=new T,_6=new T(0,1,0)}),Xr=z(()=>{J(),Xt(),zZ(),Ye(),Pb(),Oi(),ke(),Op(),b6(),FZ(),ti(),(Ie||(Ie={})).is=function(t){return t&&t.__isEntity},$a=t=>Ie.is(t),X4={type:"completeState",isfromEntity:!0},$4=["x","y","z"],Xf=new T,x2=new T(1,1,1),jv=new qt,w2=new ci,S2=new Et,Ux=t=>class extends Bx(t){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.transitionState={settled:!0,state:null},this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new lT,this._recursiveBBox=new lT,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let i=this.children[e];if(Ie.is(i))return i}entityChildrenCount(){let e=this.children.length;for(;e--;)if(Ie.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let e=this;for(;e.data.type!=="Instance";){let i=e.parent;if(!Ie.is(i))return;e=i}return e}forInstancesRec(e){this.instances.forEach(i=>{i.disposed||e(i),i.forInstancesRec(e)})}super_Entity(e,i){typeof e=="string"&&(this.uuid=e),this.identity=e,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,i,n=!1){if(this.data.states.length!==0||n){for(let r of this.data.states)ah.toOps(this.data,r.data).forEach(s=>{let a=nb.replaceProps(s,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(e!==null){let r=this.data.states.data(e);r&&(this.dataPatched=ah.patch(this.data,r),ah.toOps(this.data,r).forEach(s=>{this.updateByPatchedOp(s,this.dataPatched,i)}))}n&&this.updateTransformState(this.dataPatched,i),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(e,i){e.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{$a(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let i;return this.traverseEntity(n=>{n.uuid===e&&(i=n)}),i}traverseSortNextHelper(){let e=this.parent;if(e){let i=e.children,n=i.indexOf(this)+1;if(Ie.is(i[n]))return i[n];if(Ie.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&Ie.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let i=this;for(;e>0&&i!==null;)i=i.parent,e-=1;return i}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let i=this.parent;for(;i;){if(e===i)return!0;i=i.parent}return!1}countToAccestor(e){let i=0,n=this;for(;n!==e;){if(n===null)return-1;n=n.parent,i+=1}return i}forEachEntity(e){for(let i of this.children)$a(i)&&e(i)}traverseEntityAncestors(e){this.traverseAncestors(i=>{Ie.is(i)&&e(i)})}traverseConcreteEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)$a(n)&&n.isConcreteEntity&&n.traverseEntity(e,i+1)}traverseEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)$a(n)&&n.traverseEntity(e,i+1)}traverseVisibleEntity(e){e(this);for(let i of this.children)$a(i)&&i.visible&&i.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,i=!1){return super.copy(e,i),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this}hasEntityChild(){return this.children.some(e=>$a(e))}isAncestorOf(e){if(this.uuid===e)return!1;let i=!1;return this.traverseEntity(n=>{n.uuid===e&&(i=!0)}),i}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),MA({position:this.position.toArray(),rotation:[this.rotation.x*Pt.RAD2DEG,this.rotation.y*Pt.RAD2DEG,this.rotation.z*Pt.RAD2DEG],scale:this.scale.toArray(),shear:xs.fromMatrix(this.shearMatrix.toArray()),pivot:[0,0,0],pivotRotation:[0,0,0]},e)}getTransformValues(e,i,n){return i[e].map((r,s)=>n?.shared.getVariable(r,[this.uuid,e,$4[s]])??r)}updateTransformState(e,i){let n=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,i)),n=!0),e.rotation&&(Xf.fromArray(this.getTransformValues("rotation",e,i)).multiplyScalar(Pt.DEG2RAD),this.rotation.setFromVector3(Xf),n=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,i)),n=!0),e.shear&&(this.shearMatrix.fromArray(xs.toMatrix(e.shear)),n=!0),e.pivot!==void 0||e.pivotRotation!==void 0){if(n=!0,e.pivot!==void 0&&e.pivotRotation!==void 0)this.pivotMatrix.compose(Xf.fromArray(e.pivot).negate(),jv.setFromEuler(w2.fromArray(e.pivotRotation.map(r=>r*Pt.DEG2RAD))).invert(),x2);else if(e.pivot!==void 0)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(e.pivotRotation!==void 0){let r=Xf.setFromMatrixPosition(this.pivotMatrix);jv.setFromEuler(w2.fromArray(e.pivotRotation.map(s=>s*Pt.DEG2RAD))).invert(),this.pivotMatrix.compose(r,jv,x2)}}return n&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&this.updateWorldMatrix(!1,!0),n}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(i=>{i.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)Ie.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{Ie.is(e)&&e.disposeRecursively()})}toState(e=[]){return MA({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,i){e!==void 0&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},i,!1)}updateByOp(e,i,n,r){let s=this.data;this.data=i;let a=e,o=ri(e.path,["states","*"]);if(o!==null){if(e.type===0){let[l]=o;if(this?.stateSelection===l){let c={...e.props};if(delete c.name,Object.values(e.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=Vn.zoom(h,e.path.slice(2));if(d)for(let u in e.props)e.props[u]===void 0&&u in d&&(c[u]=d[u])}}a={...e,props:c,path:e.path.slice(2)}}}}else if(e.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(e.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(e.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let c=Vn.removeOverridden(e.path,e.props,l);a={...e,props:c}}}if(this.updateByPatchedOpBase(a,ah.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n),ri(e.path,["overrides"])){let l=[],c=[...e.path];for(l.push(c[1]),c.splice(0,2);c.length>0&&c[0]==="descendants";)l.push(c[1]),c.splice(0,2);if(l[l.length-1]===void 0){if(e.type===0)for(let h of Object.keys(e.props)){l[l.length-1]=h;let d=n.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=e.props[h],d.updateState(vh.apply(d.component.data,d.overrideData),n))}}else{let h=n.scene.findInstance([this.uuid,...l]);if(h){let d=Vn.zoom(h.component.data,c);if((e={...e,path:c}).type===0){let u=e.props;if(d)for(let[p,f]of Object.entries(e.props))f===void 0&&(u===e.props&&(u={...e.props}),u[p]=d[p]);e={...e,props:u}}h.overrideData=Eb.resolve(i.overrides,l),h.updateByOp(e,tr.applySimple(h.data,e),n,!1)}}}else if(this.instances.length>0){let l;if(e.path.length===0&&e.type===0){let c;for(let h of al.rootOverrideProps)h in e.props&&(c===void 0&&(c={}),c[h]=e.props[h]);c&&(l={...e,props:c})}else for(let c of al.rootOverrideProps)if(ri(e.path,[c])){l=e;break}l!==void 0&&this.instances.forEach(c=>{if(c.isInstanceRoot){let h=vh.filterOp(c.overrideData,l);h&&c.updateByOp(h,tr.applySimple(c.data,h),n,!0)}}),this.instances.forEach(c=>{if(!c.isInstanceRoot){let h=vh.filterOp(c.overrideData,e);if(h){let d;d=s===c.data&&e===h?i:tr.applySimple(c.data,h),c.updateByOp(h,d,n,!0)}}})}}updateByPatchedOpBase(e,i,n){if(this.dataPatched=i,e.path.length===0&&e.type===0)e.props.type!==void 0&&!Jc.is(e.props.type)&&hl.changeEntityProptotype(this,this.data,n);else if(e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&"type"in e.props){hl.changeEntityProptotype(this,this.data,n);for(let r of this.children)Ie.is(r)&&r.updateVisible(n.scene)}this.updateByPatchedOp(e,i,n)}updateByPatchedOp(e,i,n){if(e.path.length===0&&e.type===0?this.updateState(e.props,n):e.type===0&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(i,n),e.path[0]==="morphTargetInfluences"&&e.type===0){let r=i.morphTargetInfluences.get(e.path[1])?.data.name;r&&this.updateMorphInfluences(r,n.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",r]))}if(ri(e.path,["pathSnapping"])!==null&&(this.updatePathSnapping(i.pathSnapping),this.isVirtualEntity&&n.scene?.syncInstancePathConstraint(this)),ri(e.path,["cloner"])!==null){let r=tr.drop(e,1);r.path.length===0&&r.type===0&&r.props.disabled===!0?this.setFromClonerState(null,n):this.cloner?this.cloner.updateState(i.cloner,n):(this.setFromClonerState(i.cloner,n),this.expandCloner(n)),this.updateVisible(n.scene)}}updatePathSnapping(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,n=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=e.find(this.isVirtualEntity&&e.pathConstraints.getConstraint(this.uuid)||i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=m6(o.geometry.path),c=function(p){let f=p%1;return f<0?f+1:f===0&&p>0?1:f}(n+r),h=null;try{h=l.curves.length?l.getPointAt(c):null}catch{}if(h===null)return;a.updateMatrixWorld();let d=this.parent?S2.copy(this.parent.matrixWorld):S2.identity(),u=function(p,f,g,m){mT.setFromRotationMatrix(Bu.extractRotation(m));let v=p.clone().applyMatrix4(Bu.copy(m).invert().multiply(g));if(f===null)X1.setFromRotationMatrix(Bu.extractRotation(g));else{let y=f.clone().applyMatrix4(Bu.extractRotation(g));X1.setFromRotationMatrix(Bu.lookAt(y6.set(0,0,0),y,_6))}return{position:v,rotation:new T().setFromEuler(v6.setFromQuaternion(mT.invert().multiply(X1))).multiplyScalar(Pt.RAD2DEG)}}(h,s==="tangential"?l.getTangentAt(c):null,a.matrixWorld,d);this.updateTransformState({position:u.position.toArray(),rotation:u.rotation.toArray()}),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(X4)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let i=!1;this.traverseEntity(n=>{if(n.data.type==="Splat")return i=!0,!0}),i&&e.reloadSplats()}updateState_Entity(e,i){e.name!==void 0&&(this.name=e.name),e.raycastLock!==void 0&&(this.raycastLock=e.raycastLock),e.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in e&&e.cloner!==void 0&&(this.setFromClonerState(e.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(e,i)}get attachedSurfaceCloners(){return this.children.filter(e=>oh(e)&&e.parameters.type==="toObject")}setFromClonerState(e,i){if(!this.disposed)if(e===null||e.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(hl.Cloner===null)return void jn("cloners","a cloner");this.cloner=new hl.Cloner(this,e),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(e,i)}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),hd=z(()=>{J(),Xr(),(gT||(gT={})).is=t=>"objectHelper"in t,ld=(t,e)=>class extends Ux(t){constructor(){super(...arguments),this.objectHelper=new e(this),this.gizmos={}}get geometryHelper(){return e.geometryHelper}raycast(i,n){this.objectHelper.raycast(i,n)}showGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Yg&&(n.visible=!0)}}updateEntityBoxSize(i,n){this.objectHelper.visible&&this.geometryHelper instanceof ya?(i.setScalar(0),n.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,n)}hideGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Yg&&(n.visible=!1)}}}}),zx=z(()=>{J(),Ox(),hd(),Ka=class extends ld(Tp,wp){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function ia(t,e,i,n,r,s,a){Km.set(r,s,a).unproject(n);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Km.x,Km.y,Km.z)}}var Km,ps,Y4,x6,NZ=z(()=>{J(),_0(),b0(),Km=new T,ps=new eh,Y4=class extends Au{constructor(t){let e=new jt,i=new Wo({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],s={},a=new Jt(15711266),o=new Jt(15711266),l=new Jt(2857471);function c(d,u,p){h(d,p),h(u,p)}function h(d,u){n.push(0,0,0),r.push(u.r,u.g,u.b),s[d]===void 0&&(s[d]=[]),s[d].push(n.length/3-1)}c("n1","n2",a),c("n2","n4",a),c("n4","n3",a),c("n3","n1",a),c("f1","f2",a),c("f2","f4",a),c("f4","f3",a),c("f3","f1",a),c("n1","f1",a),c("n2","f2",a),c("n3","f3",a),c("n4","f4",a),c("p","n1",o),c("p","n2",o),c("p","n3",o),c("p","n4",o),c("u1","u2",l),c("u2","u3",l),c("u3","u1",l),e.setAttribute("position",new kt(n,3)),e.setAttribute("color",new kt(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let t=this.geometry,e=this.pointMap;ps.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;ia("n1",e,t,ps,-1,-1,i),ia("n2",e,t,ps,1,-1,i),ia("n3",e,t,ps,-1,1,i),ia("n4",e,t,ps,1,1,i);let n=i;ia("f1",e,t,ps,-1,-1,n),ia("f2",e,t,ps,1,-1,n),ia("f3",e,t,ps,-1,1,n),ia("f4",e,t,ps,1,1,n);let r=n;ia("u1",e,t,ps,.35,1.1,r),ia("u2",e,t,ps,-.35,1.1,r),ia("u3",e,t,ps,0,1.55,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},x6=class extends Pp(Y4){constructor(t){super(t),this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,e){Dp(this.object,this.geometry,t,e,!0)}}});function Z4(t){return 1-Math.pow(1-t,3)}var lc,Gv,Hv,Wv,Xd,qv,Ba,Ki,Xs=z(()=>{J(),NZ(),Xt(),hd(),ti(),lc=new T,Gv=new T,Hv=new qt,Wv=new T,Xd=new T,qv=new T,Ba=class extends ld(eh,x6){constructor(t="",e={...Sg.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=sl.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let r=this._projectionTransition;if(r===void 0)return;if(this.disposed)return void this._endProjectionTransition();r.raf=requestAnimationFrame(this._tickProjectionTransition);let s=Ba.projectionTransitionRequestRender??r.requestRender;this.updateProjectionMatrix(),s?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new Et,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,n=this.height;this.orthoCamera=new yp(-.5*i,.5*i,.5*n,-.5*n,-5e4,1e4),this.perspCamera=new Qu(45,i/n,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(t){let e=Ba.projectionTransitionsEnabled;Ba.projectionTransitionsEnabled=!1;try{return t()}finally{Ba.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){t==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t,e,i){typeof t=="number"&&(t=new T(t,e,i)),super.lookAt(t),this.getWorldPosition(lc),this.targetOffset=lc.distanceTo(t)}getTarget(t=new T){return this.getWorldDirection(Gv),this.getWorldPosition(lc),Gv.multiplyScalar(this.targetOffset),t.copy(lc).add(Gv),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(lc),lc.distanceTo(t)}updateUp(){this.getWorldQuaternion(Hv),Wv.set(0,0,1).applyQuaternion(Hv),Xd.copy(xi.DEFAULT_UP),this.isUpVectorFlipped&&Xd.negate(),Xd.applyQuaternion(Hv),qv.copy(xi.DEFAULT_UP).projectOnPlane(Wv),this.angleOffsetFromUp=qv.angleTo(Xd),this.angleOffsetFromUp*=qv.cross(Xd).dot(Wv)>=0?1:-1}updateTransformState(t,e){let i=super.updateTransformState(t,e);return t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(t){let e=t.getWorldPosition(new T),i=t.getWorldDirection(new T).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new T).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new T;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,i=!1){if(this.aspect=t/e,i){let n=t>e?this.aspect:1,r=t>e?1:this.aspect;this.left=-395*n,this.right=395*n,this.top=1/r*395,this.bottom=1/r*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let t=this._projectionTransition;if(t===void 0)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:Z4(e)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return Ba.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=Ba.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;e===void 0&&(e={from:new Et,blend:new Et,blendInverse:new Et,start:0,duration:Ba.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=Ba.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),e.raf!==0&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let i=Z4(e),n=t.from.elements,r=this._activeSubCamera.projectionMatrix.elements,s=t.blend.elements,a=t.referenceDepth,o=Math.max(1e-6,n[15]-n[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,r[15]-r[11]*a));for(let c=0;c<16;c++)s[c]=n[c]+(r[c]-n[c])*l;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;t.raf!==0&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(e===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new Et,blend:new Et,blendInverse:new Et,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=i):i.raf!==0&&(cancelAnimationFrame(i.raf),i.raf=0),i.requestRender=void 0,i.from.copy(e.from),i.start=e.start,i.duration=e.duration,i.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,i,n,r,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,e,i,n,r,s):this.orthoCamera.setViewOffset(t,e,i,n,r,s),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=sl.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){return MA({type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped},t)}updateCameraSubtype(t,e){let i=t==="perspective"?"PerspectiveCamera":"OrthographicCamera";e.zoom!==void 0&&this.setZoom(i,e.zoom),e.near!==void 0&&this.setNear(i,e.near),e.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),t.far!==void 0&&(this.far=t.far),t.orthographic!==void 0&&this.updateCameraSubtype("orthographic",t.orthographic),t.perspective!==void 0&&this.updateCameraSubtype("perspective",t.perspective),t.type!==void 0&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),t.up!==void 0&&this.up.fromArray(t.up.map(i=>typeof i=="number"?i:0)),t.targetOffset!==void 0&&(this.targetOffset=sl.sanitizeTargetOffset(t.targetOffset)),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.type===0&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},(Ki=Ba).projectionTransitionsEnabled=!1,Ki.projectionTransitionDuration=350,Ki.projectionTransitionMinAgeMs=1e3});function w6(t){return t.type==="TorusGeometry"&&t.arc===360}var S6,Xv,vT,n0=z(()=>{J(),S6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??n),s=Math.abs(i.depth??n),a=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(i,{width:n,height:r,depth:s,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:n,radius:r,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:c,cornerRadius:h,cornerSegments:d}=t.parameters,u=new vT(!1,e,i,n,r,s,a,o,l,c,h,d);return Object.assign(u,{userData:{...t,type:"HelixGeometry"}})}},Xv=new mh([0,0,0],1),vT=class extends jt{constructor(t=!0,e=1,i=1,n=1,r=1,s=1,a=1,o=1,l=1,c=1,h=1,d=1){if(super(),s===0)return;let u=t&&s===1;u&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,f,g,m,v,y,_,b,x=()=>new T,w=new T,S=x(),E=x(),A=x(),P=x(),C=x(),R=x(),O=x(),D=x(),F=x(),V=x(),U=x(),j=i-2*o+.001,q=j/s,rt=Math.ceil(a*s),it=rt+1,Y=j/rt,ht=-j/2,ot=c+1,ft=2*Math.PI/c,pt=Math.PI/2/d,tt=Math.min((1-h/100)*o,o-.01),mt=o-tt,N=0,L=2*d+2,H=ot*L/2,$=H+ot*it,B=Math.max(0,ot*(it+L)),[Z,K,k]=[3,3,2].map(Gt=>Array(B*Gt).fill(0)),st=[],dt=r-o;function bt(Gt,Ft){let _e=Math.PI/2;y=Ft*Y,b=2*Math.PI*(y%q)/q+_e,y+=ht,_=Math.sin(b)*dt,v=Math.cos(b)*dt,t?Gt.set(v,_,y):Gt.set(v,y,_)}bt(w,-1e-10),bt(S,0),P.copy(w),bt(w,1);let ct=w.distanceTo(S),It=u?0:mt+tt,St=ct*rt+2*It,Rt=tt,Mt=St-It;for(let Gt=0;Gt<=rt;Gt++){bt(E,Gt),U.subVectors(E,P).normalize(),P.copy(E),F.copy(E).setComponent(+t+1,0).normalize(),V.crossVectors(U,F).normalize();let Ft=Gt===0,_e=Gt===rt,be=Ft?3*Math.PI/2:pt,Gi=Ft?Rt:Mt,oe=Ft?ot:$,le=Ft?0:B-ot,Pe=U.clone().multiplyScalar(Ft?-mt:mt).add(E),si=U.clone().multiplyScalar(Ft?-1:1).normalize();for(let ze=0;ze<ot;ze++){let Pi=ze*ft;if(C.addVectors(w.copy(F).multiplyScalar(o*Math.cos(Pi)),S.copy(V).multiplyScalar(o*Math.sin(Pi))),R.copy(C).normalize(),Ft||_e){u||(N=le+ze,[0,1,2].forEach(ui=>{Z[3*N+ui]=Pe.getComponent(ui),K[3*N+ui]=si.getComponent(ui)}),k[2*N]=+_e,k[2*N+1]=ze/c),S.copy(R).multiplyScalar(tt),A.addVectors(E,S);for(let ui=0;ui<d;ui++){let on=ui*pt+be;O.addVectors(w.copy(U).multiplyScalar(mt*Math.sin(on)),S.copy(R).multiplyScalar(mt*Math.cos(on))),D.copy(O).normalize(),S.addVectors(A,O),O.normalize(),N=oe+ui*ot+ze,[0,1,2].forEach(bn=>{Z[3*N+bn]=S.getComponent(bn),K[3*N+bn]=D.getComponent(bn)});let Jr=+Ft+Math.sin(on);k[2*N]=(Gi+mt*Jr)/St,k[2*N+1]=ze/c}}S.addVectors(E,C),N=H+Gt*ot+ze,[0,1,2].forEach(ui=>{Z[3*N+ui]=S.getComponent(ui),K[3*N+ui]=R.getComponent(ui)}),k[2*N]=(It+Gt*ct)/St,k[2*N+1]=ze/c}}let W=it+2*d+2,[_t,Dt]=[+u,W-1];for(let Gt=_t;Gt<=Dt-1;Gt++){let Ft=u&&Gt===Dt-1;for(let _e=0;_e<ot-1;_e++)p=Gt*ot+_e,f=p+1,g=(Ft?_e:p)+ot,m=(Ft?_e+1:f)+ot,Gt===0?st.push(f,m,g):Gt===W-2?st.push(p,f,g):st.push(p,f,g,f,m,g)}this.setIndex(st),this.setAttribute("position",new kt(Z,3)),this.setAttribute("normal",new kt(K,3)),this.setAttribute("uv",new kt(k,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,n,r=this.userData.parameters,s=Math.ceil(r.tubularSegments),a=r.radialSegments,o=a+1,l=[];for(let c=1;c<s;c++)for(let h=0;h<a;h++)t=c*o+h,e=t+1,i=t+o,n=e+o,l.push(t,e,i,e,n,i);for(let c=0;c<a;c++)t=s*o+c,e=t+1,i=c+o,n=c+1+o,l.push(t,e,i,e,n,i);return Xv.array=new Uint32Array(l),Xv.count=l.length,Xv}}});function kZ(t){return Q4||(Q4=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.157/build",i=import("./boolean.js"),[n,r]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(s=>s.arrayBuffer())]);await n.default({module_or_path:r}),r0=n}())}function Ob(){if(r0===void 0)throw new Error("boolean-wasm is not loaded");return r0}function G3(t){let e=s0.get(t);if(e===void 0)throw new Error("Unknown csg mesh set handle "+t);return e}function H3(t){return s0.set(++yT,t),yT}function VZ(t,e,i){if(r0===void 0)return-1;let{positions:n,indices:r,normals:s}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,f=[];for(let g=0,m=0;g<p.verticesPerFace.length;g++){let v=p.verticesPerFace[g];for(let y=1;y<v-1;y++)f.push(p.indices[m],p.indices[m+y],p.indices[m+y+1]);m+=v}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(f)}}let l;l=w6(a.userData.parameters)?a.getClosedTorusIndicesForBooleanOrSubdiv():a.getIndex();let c,h=a.getAttribute("position");if(l===null){c=new Uint32Array(h.count);for(let p=0;p<c.length;p++)c[p]=p}else c=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=a.getAttribute("normal"),u=d!==void 0&&d.itemSize===3&&d.count===h.count&&d.array instanceof Float32Array&&d.isInterleavedBufferAttribute!==!0?d.array:void 0;return{positions:h.array,indices:c,normals:u}}(t,e);return H3(new r0.CsgMesh(n,r,s))}function K4(t,e){let i=Ob(),n=E6[e];if(n===void 0)throw new Error("Unknown boolean operation "+e);let r=t.map(G3);if(r.length===1)return i.clone_mesh(r[0]);let s,a=[];if(e===2&&r.length>2){let o=r[0];for(let l=1;l<r.length-1;l++)o=i.boolean_mesh(o,r[l],0),a.push(o);s=i.boolean_mesh(r[r.length-1],o,2)}else if(e===2)s=i.boolean_mesh(r[1],r[0],2);else{let o=r[r.length-1];for(let l=0;l<r.length-1&&(o=i.boolean_mesh(o,r[l],n),a.push(o),o.tri_count()!==0);l++);s=o,a.pop()}for(let o of a)o.free();return s}function M2(t,e){G3(t).transform(new Float32Array(e.elements))}function M6(t){let e=s0.get(t);e!==void 0&&(e.free(),s0.delete(t))}var r0,s0,yT,Q4,E6,Fx=z(()=>{J(),n0(),s0=new Map,yT=0,E6={0:0,1:1,2:2}});function hc(t){return t!==null&&"booleanOp"in t}var _T,A6,jZ=z(()=>{J(),Xr(),Fx(),_T=class extends Ux(gi){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new Et}updateVisible(t){super.updateVisible(t),this.visible=!hc(this.parent)&&this.visible,hc(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){hc(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(M6(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}dispose(){super.dispose(),this.freeBooleanPointer()}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),hc(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof _T&&(t.freeBooleanPointer(),hc(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&hc(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),hc(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),GZ=z(()=>{A6=null});function W3(t,e=0,i=t.count,n,r){let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=e;d<i;d++){let u=t.getX(d),p=t.getY(d),f=t.getZ(d);u<s&&(s=u),p<a&&(a=p),f<o&&(o=f),u>l&&(l=u),p>c&&(c=p),f>h&&(h=f)}Qm.min.set(s,a,o),Qm.max.set(l,c,h),Qm.getCenter(n),Qm.getSize(r).multiplyScalar(.5)}var Qm,J4,tL,sn,Zn=z(()=>{J(),jZ(),GZ(),Qm=new hi,J4=new jt,tL=new qs,sn=class extends _T{constructor(t,e){super(J4,tL),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){if(this.raycastDeformed(t,e))return;let i=A6;i===null?super.raycast(t,e):i(this,t,e)}raycastDeformed(t,e){return!1}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");i!==void 0?W3(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}}});function T6(t){return t?.isClassicNodeMaterial===!0}var _n,a0,C6,P6,Cg,D6,R6,O6,I6=z(()=>{}),ba=z(()=>{J(),_n=class extends Jt{constructor(t,e,i,n){super(t,e,i),this.isColorA=!0,this.a=n}setRGBA(t,e,i,n){super.setRGB(t,e,i),this.a=n}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(t){return super.equals(t)&&this.a===t.a}setStyle(t,e="srgb"){let i;if(t==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(t)){let n,r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="rgba"?parseFloat(n[4]):1,super.setStyle(t,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="hsla"?parseFloat(n[4]):1,super.setStyle(t,e)}}return super.setStyle(t,e)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}}}),L6=z(()=>{ba(),a0=class extends _n{}}),HZ=z(()=>{C6=class{constructor(t=1e4){this.timeout=t,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let i=e;e=e.next,e.prev=this.head,this.head.next=e,i.next=null,i.prev=null,i.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),i=this.cache.get(t);return i===void 0?(i={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,i)):(i.time=e,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),B6=z(()=>{HZ(),P6=class extends C6{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}}),U6=z(()=>{D6=class{constructor(t,e){this.data=t,this.cache=e,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},R6=class{constructor(){this.cache=new Map}remove(t){this.cache.delete(t.data)}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}}),WZ=z(()=>{J(),O6=class extends XF{constructor(t){super(t),this.type=Xn}parse(t){let e=function(p,f){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(f||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(f||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(f||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(f||""))}},i=function(p,f,g){f=f||1024;let m=p.pos,v=-1,y=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));for(;0>(v=b.indexOf(`
|
|
4206
|
+
})();`});function Rv(t){return t==null||t===""?void 0:String(t)}var m3,IN=z(()=>{m3=class{constructor(t,e,i){this.deps=t,this.onConsole=e,this.onEvent=i,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let t of this.eventUnsubs.values())t();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(t,e){let i=this.deps;switch(t){case"setVariable":{let n=i.setVariable(String(e[0]),e[1]);return n.warning&&this.onConsole("warn",n.warning),n.ok}case"setVariables":{let n=e[0]??{},r=!0;for(let[s,a]of Object.entries(n)){let o=i.setVariable(s,a);o.warning&&this.onConsole("warn",o.warning),r=r&&o.ok}return r}case"getVariable":return i.getVariable(String(e[0]));case"getVariables":return i.getVariables();case"getAllObjects":return i.getAllObjects();case"findObjectByName":case"findObjectById":return i.findObject(String(e[0]));case"getGeometry":{let n=i.getGeometry(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.data}case"updateObject":return i.updateObject(String(e[0]),e[1]??{});case"createObject":return i.createObject(String(e[0]),e[1]??{});case"createCustomMaterial":if(i.createCustomMaterial===void 0)throw new Error("createCustomMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.createCustomMaterial(e[0]);case"getTexture":if(i.getTexture===void 0)throw new Error("getTexture: not available on this surface \u2014 a three.js texture instance needs the inline HTML-content mode (editor Preview/Play and web exports).");return i.getTexture(String(e[0]),e[1]??{});case"setMaterial":if(i.setMaterial===void 0)throw new Error("setMaterial: not available on this surface \u2014 custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return i.setMaterial(String(e[0]),e[1]);case"cloneObject":return i.cloneObject(String(e[0]),e[1]??{});case"removeObject":return i.removeObject(String(e[0]));case"spawnObject":{let n=i.spawnObject(String(e[0]),e[1]??{});return n.warning&&this.onConsole("warn",n.warning),n.object}case"destroyObject":return i.destroyObject(String(e[0]));case"setInstanceTransforms":{let n=e[1]===null||e[1]===void 0?null:e[1],r=i.setInstanceTransforms(String(e[0]),n);return r<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(e[0])}" has no cloner \u2014 make the object a cloner first (its copies are what this drives).`),r}case"getAnimations":{let n=i.getAnimations(Rv(e[0]));return n.warning&&this.onConsole("warn",`spline.${t}: ${n.warning}`),n.clips}case"playAnimation":{let n=typeof e[1]=="object"&&e[1]!==null,r=i.playAnimation(String(e[0]),n?void 0:Rv(e[1]),(n?e[1]:e[2])??{});return r.warning&&this.onConsole("warn",`spline.${t}: ${r.warning}`),r.clip}case"pauseAnimation":case"stopAnimation":{let n=Rv(e[0]),r=Rv(e[1]),s=t==="pauseAnimation"?i.pauseAnimation(n,r):i.stopAnimation(n,r);return s.warning&&this.onConsole("warn",`spline.${t}: ${s.warning}`),s.ok}case"emitEvent":case"emitEventReverse":{let n=i.emitEvent(String(e[0]),String(e[1]),t==="emitEventReverse");return n.warning&&this.onConsole("warn",n.warning),n.ok}case"requestRender":return i.requestRender(),!0;case"listenEvent":{let n=String(e[0]);return n==="variableChange"?this.startVariablePolling():this.eventUnsubs.has(n)||this.eventUnsubs.set(n,i.addSplineEventListener(n,r=>{this.onEvent(n,r)})),!0}case"unlistenEvent":{let n=String(e[0]);return n==="variableChange"?this.stopVariablePolling():(this.eventUnsubs.get(n)?.(),this.eventUnsubs.delete(n)),!0}default:throw new Error(`Unknown spline bridge method: ${t}`)}}startVariablePolling(){this.variablePollHandle===null&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let t=this.deps.getVariables(),e=function(i,n){let r=[];for(let s of Object.keys(n))i[s]!==n[s]&&r.push({name:s,value:n[s]});return r}(this.lastVariables??{},t);this.lastVariables=t;for(let i of e)this.onEvent("variableChange",i)},100))}stopVariablePolling(){this.variablePollHandle!==null&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}}});function zY(t,e,i,n){return[t[0]*e+t[4]*i+t[8]*n+t[12],t[1]*e+t[5]*i+t[9]*n+t[13],t[2]*e+t[6]*i+t[10]*n+t[14]]}var FY=z(()=>{}),LN,NY=z(()=>{}),kY=z(()=>{f3(),IN(),LN=class{constructor(t,e,i){this.iframe=t,this.deps=e,this.onConsole=i,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=n=>{if(this.disposed||n.source!==this.iframe.contentWindow)return;let r=n.data;var s;typeof(s=r)!="object"||s===null||s[ql]!==!0||typeof s.kind!="string"||this.handleMessage(r)},this.host=new m3(e,i,(n,r)=>{this.sendEvent(n,r)})}attach(){window.addEventListener("message",this.onMessage),this.send({[ql]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) \u2014 if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),this.handshakeTimer!==null&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(t){switch(t.kind){case"ready":this.handshakeSeen=!0,this.send({[ql]:!0,kind:"ready-ack"});break;case"console":this.onConsole(t.level,t.text);break;case"call":{let e;try{e=Promise.resolve(this.host.execute(t.method,t.args))}catch(i){e=Promise.reject(i)}e.then(i=>{this.send({[ql]:!0,kind:"result",id:t.id,ok:!0,value:i,error:void 0})},i=>{let n=i instanceof Error?i.message:String(i);this.send({[ql]:!0,kind:"result",id:t.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(t.event)}}send(t){this.iframe.contentWindow?.postMessage(t,"*")}sendEvent(t,e){this.send({[ql]:!0,kind:"event",eventName:t,payload:e})}dispatchInput(t){let e=this.deps.getCanvas();if(!e)return;let i=this.iframe.getBoundingClientRect(),n={bubbles:!0,cancelable:!0,view:window,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey};switch(t.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":e.dispatchEvent(new PointerEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons,pointerId:t.pointerId,pointerType:t.pointerType,isPrimary:t.isPrimary,movementX:t.movementX,movementY:t.movementY}));break;case"click":case"dblclick":e.dispatchEvent(new MouseEvent(t.type,{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,button:t.button,buttons:t.buttons}));break;case"wheel":{let r=new WheelEvent("wheel",{...n,clientX:(t.x??0)+i.left,clientY:(t.y??0)+i.top,deltaX:t.deltaX,deltaY:t.deltaY,deltaMode:t.deltaMode});typeof t.wheelDeltaX=="number"&&Object.defineProperty(r,"wheelDeltaX",{value:t.wheelDeltaX}),typeof t.wheelDeltaY=="number"&&Object.defineProperty(r,"wheelDeltaY",{value:t.wheelDeltaY}),e.dispatchEvent(r);break}case"keydown":case"keyup":e.dispatchEvent(new KeyboardEvent(t.type,{...n,key:t.key,code:t.code,repeat:t.repeat}))}}}}),ti=z(()=>{p3(),wY(),SY(),MY(),AY(),TY(),CY(),PY(),DY(),RY(),OY(),BY(),f3(),UY(),IN(),FY(),NY(),kY()}),VY=z(()=>{});function BN(t){return Array.isArray(t)?t:[t]}function eb(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}var jY=z(()=>{});function Ar(t,e){return Object.setPrototypeOf(t,e),t}function IS(t){let e={...t};return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}function ih(t,e,i){if(t===void 0?e===void 0?(t=0,e=10):t=e-10:e===void 0&&(e=t+10),t>e){let s=t;t=e,e=s}let n=[],r=1/(i+1);for(let s=0;s<i;s++){let a=t+(e-t)*(s+.75+.5*Math.random())*r;n.push(a)}return n}function Qc(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}var GY=z(()=>{});function g3(t){if(t.deepFreeze!==void 0)return void t.deepFreeze(t);let e=Object.getOwnPropertyNames(t);for(let i of e){let n=t[i];n&&typeof n=="object"&&g3(n)}return Object.freeze(t)}function UN(t){for(let e of Object.keys(t))t[e]===void 0&&delete t[e];return t}var LS,ib,EA,te,v3,HY=z(()=>{}),Dn=z(()=>{VY(),jY(),GY(),HY()}),y3=z(()=>{LS=class{},ib=class extends LS{constructor(t){super(),this.id=t}},EA=class extends LS{constructor(t){super(),this.data=t}}}),WY=z(()=>{}),Mx=z(()=>{te=class{modifyById(t,e){let i=this;if(i[t]===void 0)throw new Error("not expected");{let n={...i,[t]:e};return Object.setPrototypeOf(n,te.prototype),n}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(t.type===1){let i,n=e[t.id];i=n===void 0?{type:2,id:t.id}:{type:1,id:t.id,data:n};let{id:r,data:s}=t,a={...e,[r]:s};return Object.setPrototypeOf(a,te.prototype),{data:a,actual:t,reverse:i}}if(t.type===2){let{id:i}=t,n=e[i];if(n===void 0)return null;{let r={...e};return Object.setPrototypeOf(r,te.prototype),delete r[i],{data:r,actual:t,reverse:{type:1,id:i,data:n}}}}return null}}}),_3=z(()=>{v3=class extends Error{}});function zN(t,e){for(let i of t)e(i.id,i.data)!==!0&&zN(i.children,e)}function FN(t,e){if(e(t.id,t.data)!==!0)for(let i of t.children)FN(i,e)}var qn,Ov,_p,Nt,sd=z(()=>{Dn(),_3(),Dn(),qn=class extends Array{constructor(...t){super(...t),to(this,"partialObjectCaches"),to(this,"objCaches"),to(this,"parentCaches"),Object.setPrototypeOf(this,qn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)g3(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}nonExistOrDescendantOf(t,e){if(!this.has(t))return!0;for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}rootAcestor(t){for(;t;){let e=this.parent(t);if(!e)return t;t=e}return t}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){return this.get(t)?.data}has(t){return this.childrenOf(t)!==void 0}partialCache(t){this.partialObjectCaches===void 0&&(this.partialObjectCaches=new Map);let e=this.get(t);e!==void 0&&this.partialObjectCaches.set(t,e)}get(t){if(this.partialObjectCaches!==void 0){let e=this.partialObjectCaches.get(t);if(e!==void 0)return e}return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){return t===null?this:this.get(t)?.children}traverseFrom(t,e){if(t===null)this.traverse(e);else{let i=this.get(t);i&&FN(i,e)}}traverse(t){zN(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this.parent(t),n=this.childrenArray(i),r=n.findIndex(o=>o.id===t);if(r<0)throw new Error("not expected");let s=n[r];n=[...n],n[r]={...s,data:e};let a=new Map;return a.set(t,n[r]),this.modifyArrayBy(i,n,a)}}modifyArrayBy(t,e,i=void 0){let n=t,r=e;for(;n!==null;){let a=r,o=n;if(n=this.parent(n),n===void 0)throw new Error;r=this.childrenArray(n);let l=r.findIndex(c=>c.id===o);if(l<0)throw new Error;r=[...r],r[l]={...r[l],children:a},i&&i.set(o,r[l])}Object.setPrototypeOf(r,qn.prototype);let s=r;if(i&&this.objCaches!==void 0&&this.parentCaches!==void 0){s.objCaches=this.objCaches;for(let[a,o]of i)s.objCaches.set(a,o);s.parentCaches=this.parentCaches,this.objCaches=void 0,this.parentCaches=void 0}else s.fillCaches();return s}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}return null}checkDuplicatedIdRec({id:t,children:e}){if(this.get(t)!==void 0)return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(t){let{parent:e,fi:i,id:n,data:r,children:s}=t;if(e!==null&&this.get(e)===void 0||this.checkDuplicatedIdRec(t))return null;{let a=e,o=this.childrenArray(a),l={fi:i,id:n,data:r,children:s};return o=[...o,l],o.sort((c,h)=>c.fi-h.fi),t.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:t,reverse:{type:8,id:n}}}}deleteOp(t){let{id:e}=t;if(this.get(e)===null)return null;{let i=this.parent(e);if(i===void 0)return null;let n=this.childrenArray(i),r=n.findIndex(a=>a.id===e);t.localIndex=r,n=[...n];let s=n.splice(r,1)[0];return{data:this.modifyArrayBy(i,n),actual:t,reverse:{type:7,...s,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:n}=t;if(e!==null&&this.get(e)===void 0)return this.deleteOp({type:8,id:n});if(e!==null){let d=e;for(;d!==null;){if(d===void 0)throw new Error;if(d===n)throw new v3("cyclic tree");d=this.parent(d)}}let r=this.parent(n);if(r===void 0)return null;let s=r,a=this.childrenArray(r),o=a.findIndex(d=>d.id===n);a=[...a];let l=a.splice(o,1)[0],c=this.modifyArrayBy(r,a);r=e,a=c.childrenArray(r);let h=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((d,u)=>d.fi-u.fi),t.localIndex=a.indexOf(l),c=c.modifyArrayBy(r,a),{data:c,actual:t,reverse:{type:9,parent:s,fi:h,id:n}}}previous(t,e){if(e===null){let n=this.childrenArray(t);return n.length===0?null:n[n.length-1].id}let i=null;for(let n of this.childrenArray(t)){if(n.id===e)return i;i=n.id}return null}traverseSortNext(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)+1;if(n<i.length)return i[n].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(e!==void 0){let i=this.childrenArray(e),n=i.findIndex(r=>r.id===t)-1;return n>=0?this.traverseSortPrevious(i[n].id):e}}getAllSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i.id);n!==void 0&&e.push({...i,...n})}e.sort((i,n)=>eb(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e}getAllIdSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i);n!==void 0&&e.push(n)}e.sort((i,n)=>eb(i.sortKey,n.sortKey));for(let i of e)delete i.sortKey;return e.map(i=>i.id)}getWithSortKey(t){let e=t,i=[],n=this.get(e),r=n;if(n!==void 0){for(;e;)i.splice(0,0,n.fi),e=this.parent(e),e!==null&&(n=this.get(e));return{...r,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let n=this.childrenArray(t);if(e===null){if(n.length===0)return ih(0,i,i);{let r=n[0].fi;return ih(r-i,r,i)}}{let r=this.get(e);if(r===void 0||this.parent(e)!==t)throw new Error("illegal args");let s=n.find(a=>a.fi>r.fi);if(s===void 0){let a=n[n.length-1].fi;return ih(a,a+i,i)}return ih(r.fi,s.fi,i)}}}}),b3=z(()=>{var t;Dn(),Ov=null,(t=_p||(_p={})).setPreservePrototype=function(e){Ov=e},t.tryPreservePrototype=function(e,i){return Object.getPrototypeOf(e)===Ov&&Object.setPrototypeOf(i,Ov),i},t.runOp=function(e,i){if(i.type!==0)return null;if(Array.isArray(e)||Qc(e)){let n=i.props,r={},s=Qc(e)?e.slice():[...e],a=!1;if(n)for(let o of Object.keys(n)){let l=parseInt(o);if(isNaN(l))throw new Error("wrong index");r[o]=s[l],s[l]=n[o],a=!0}return a?{data:s,actual:i,reverse:{type:0,props:r}}:null}{let n=i.props,r={},s={...e},a=!1;if(n)for(let o of Object.keys(n)){r[o]=s[o];let l=n[o];l===void 0?delete s[o]:s[o]=l,a=!0}return a?{data:t.tryPreservePrototype(e,s),actual:i,reverse:{type:0,props:r}}:null}}}),ad=z(()=>{Dn(),Dn(),Nt=class extends Array{constructor(...t){super(...t),to(this,"objCaches"),Object.setPrototypeOf(this,Nt.prototype)}deepFreeze(){let t=0;for(;t<this.length;)g3(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){return this.get(t)?.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(this.get(t)===void 0)throw new Error("not expected");{let i=this,n=i.findIndex(s=>s.id===t);if(n<0)throw new Error("not expected");let r=i[n];return i=[...i],i[n]={...r,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,Nt.prototype);let e=t;return typeof process<"u"||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}return null}addOp(t){let{fi:e,id:i,data:n}=t,r=this,s={fi:e,id:i,data:n};return r=[...r,s],r.sort((a,o)=>a.fi-o.fi),t.localIndex=r.indexOf(s),{data:this.modifyArrayBy(r),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,n=i.findIndex(s=>s.id===e);if(n===-1)return null;t.localIndex=n,i=[...i];let r=i.splice(n,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...r}}}moveOp(t){let{fi:e,id:i}=t,n=this;n=[...n];let r=n.findIndex(o=>o.id===i);if(r===-1)return null;let s=n[r].fi,a={...n[r],fi:e};return n[r]=a,n.sort((o,l)=>o.fi-l.fi),t.localIndex=n.indexOf(a),{data:this.modifyArrayBy(n),actual:t,reverse:{type:6,fi:s,id:i}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(t===null){if(i.length===0)return ih(0,e,e);{let n=i[0].fi;return ih(n-e,n,e)}}{let n=this.get(t);if(n===void 0)throw new Error("illegal args");let r=i.find(s=>s.fi>n.fi);if(r===void 0){let s=i[i.length-1].fi;return ih(s,s+e,e)}return ih(n.fi,r.fi,e)}}}});function qY(t,e){let i={cur:[],result:[],len:0};return[t=Ju(t,e,i)??t,i.result]}function z1(t,e){return t===null?null:(t.cur[t.len]=e,t.len+=1,t)}function F1(t){t&&(t.len-=1)}function NN(t,e,i){let n=!1,r=t.map(s=>{let a=s.id,o=e[a];if(o!==void 0&&typeof o=="string"&&(n=!0,a=o,i!==null))throw new Error("not supported");let l=Ju(s.data,e,z1(i,a));F1(i),n=n||l!==void 0,l===void 0&&(l=s.data);let c=NN(s.children,e,i);return c!==void 0?n=!0:c=s.children,{...s,id:a,data:l,children:c}});if(n)return r}function Ju(t,e,i){if(t instanceof qn){let n=NN(t,e,i);return n!==void 0&&Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}if(t instanceof Nt)return function(n,r,s){let a=!1,o=n.map(l=>{let c=l.id,h=r[c];if(h!==void 0&&typeof h=="string"&&(a=!0,c=h,s!==null))throw new Error("not supported");let d=Ju(l.data,r,z1(s,c));return F1(s),a=a||d!==void 0,d===void 0&&(d=l.data),{...l,id:c,data:d}});if(a)return Object.setPrototypeOf(o,Object.getPrototypeOf(n)),o}(t,e,i);if(Array.isArray(t)){let n=!1,r=t.map((s,a)=>{let o=Ju(s,e,z1(i,a));return F1(i),n=n||o!==void 0,o===void 0&&(o=s),o});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(t&&typeof t=="object"&&!Qc(t)){let n={},r=!1;for(let[s,a]of Object.entries(t))if(s!=="name"&&s!=="variableId"){let o=e[s];if(typeof o=="string"){if(i!==null)throw new Error("not supported");r=!0,s=o}let l=Ju(a,e,z1(i,s));F1(i),r=r||l!==void 0,l===void 0&&(l=a),n[s]=l}else n[s]=a;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(typeof t=="string"){let n=e[t];return n!==void 0&&function(r){if(r===null)return null;r.result.push(r.cur.slice(0,r.len))}(i),n}}var kN=z(()=>{sd(),ad(),Dn()});function tp(t){return t&&typeof t=="object"&&t instanceof Zi}function x3(t,e){if(e===void 0)return;let i=!1,n=t.map(r=>{let s=r.id,a=bg(r.data,e[s]);if(i=i||a!==void 0,a===void 0&&(a=r.data),r.children){let o=x3(r.children,e);return o!==void 0?i=!0:o=r.children,{...r,id:s,data:a,children:o}}return{...r,id:s,data:a}});return i?n:void 0}function bg(t,e){if(!tp(e))return e;if(t instanceof qn){let i=x3(t,e);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}if(t instanceof Nt)return function(i,n){if(n===void 0)return;let r=!1,s=i.map(a=>{let o=a.id,l=bg(a.data,n[o]);return r=r||l!==void 0,l===void 0&&(l=a.data),{...a,id:o,data:l}});return r?(Object.setPrototypeOf(s,Object.getPrototypeOf(i)),s):void 0}(t,e);if(Array.isArray(t)){let i=!1,n=t.map((r,s)=>{let a=bg(r,e[s]);return i=i||a!==void 0,a===void 0&&(a=r),a});return i?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(t instanceof Zi)return w3(t,e);if(t&&typeof t=="object"){let i={},n=!1;for(let[r,s]of Object.entries(t)){let a=bg(s,e[r]);n=n||a!==void 0,a===void 0&&(a=s),i[r]=a}return n?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}}function w3(t,e){if(t===void 0)return e;if(e===void 0)return t;if(!tp(e))return e;if(!tp(t))return vh.apply(t,e);let i=new Set;for(let r of Object.keys(t))i.add(r);for(let r of Object.keys(e))i.add(r);let n=new Zi;for(let r of i){let s=w3(t===void 0?void 0:t[r],e===void 0?void 0:e[r]);n[r]=s}return n}var Zi,vh,nb,tr,QO,Ex=z(()=>{var t;sd(),ad(),Ax(),Dn(),Zi=class{unusedFunOverridesTable(e){}runOp(e){let i=[],n=this,r=0,s={};for(;r<e.path.length;){if(i.push(n),n=n===void 0?void 0:n[e.path[r]],n!==void 0&&!tp(n))return null;r+=1}n=n?IS(n):new Zi;for(let[a,o]of Object.entries(e.props)){let l=n[a];s[a]=l,o===void 0?delete n[a]:n[a]=o}for(;r>0;){if(Object.keys(n).length===0){let a=i[r-1];a&&(n=IS(a),delete n[e.path[r-1]])}else{let a=i[r-1];if(a){let o=IS(a);o[e.path[r-1]]=n,n=o}else{let o=new Zi;o[e.path[r-1]]=n,n=o}}r-=1}return{data:Object.setPrototypeOf(n,Zi.prototype),actual:e,reverse:{...e,props:s}}}},(t=vh||(vh={})).apply=function(e,i){return bg(e,i)??e},t.merge=function(e,i){return w3(e,i)},t.filterOp=function(e,i){let n=0,r=i.path,s=e;for(;n<r.length&&s!==void 0;){if(s=Vn.zoomOnce(s,r[n]),s===void 0)return i;if(!tp(s))return;n+=1}if(s===void 0)return i;if(tp(s)){if(i.type===0){let a={...i.props};for(let o of Object.keys(s))delete a[o];return{...i,props:a}}if(i.type===1||i.type===4||i.type===7){let a=x3([i],s);return a?a[0]:i}return i}}}),XY=z(()=>{Dn(),Ax(),Mx(),sd(),_3(),b3(),ad(),kN(),Ex(),(nb||(nb={})).replaceProps=function(t,e){let i=Vn.zoom(e,t.path);if(typeof i=="object"){let n={};for(let r of Object.keys(t.props))n[r]=i[r];return{...t,props:n}}return{...t,props:{}}},(t=>{function e(r,s){let a=s.path,o=[];for(;;){let l;if(r instanceof Zi&&s.type===0&&(l=r.runOp({...s,path:a.slice(o.length)}),l===null&&(l=void 0)),l===void 0&&o.length===a.length&&(l=r instanceof qn||r instanceof Nt||r instanceof te?r.runOp(s):_p.runOp(r,s)),l!==void 0){if(l!==null){let d=l.data;for(let u=o.length-1;u>=0;u--){let p=a[u],f=o[u];if(f instanceof qn){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Nt){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof te){if(typeof p=="number")throw new Error("illegal arg");d=f.modifyById(p,d)}else if(f instanceof Zi){let g={...f,[p]:d};d=Object.setPrototypeOf(g,Zi.prototype)}else{if(typeof f!="object")return null;if(Array.isArray(f)||Qc(f)){if(typeof p=="string"&&(p=parseInt(p),isNaN(p)))throw new Error("Invalid path");let g=d;d=Qc(f)?f.slice():[...f],d[p]=g}else d=_p.tryPreservePrototype(f,{...f,[p]:d})}}return{data:d,actual:{...l.actual,path:a},reverse:{...l.reverse,path:a}}}return null}let c,h=a[o.length];if(r instanceof qn){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else if(r instanceof Nt){if(typeof h=="number")throw new Error("");c=r.get(h)?.data}else r!==null&&(c=r[h]);if(c===void 0)return null;o.push(r),r=c}}function i(r,s){for(let a=0;a<r.length&&a<s.length;a++)if(r[a]!==s[a])return!0;return!1}function n(r,s){if(r.length!==s.length)return!1;for(let a=0;a<r.length;a++)if(r[a]!==s[a])return!1;return!0}t.drop=function(r,s){return{...r,path:r.path.slice(s)}},t.applySimple=function(r,s){return e(r,s)?.data??r},t.apply=e,t.pathDisjoint=i,t.pathEq=n,t.commutative=function(r,s){return i(r.path,s.path)},t.subsumed=function(r,s){return!(r.type!==0||s.type!==0||!n(r.path,s.path))&&Object.keys(r.props).every(a=>s.props[a]!==void 0)}})(tr||(tr={})),(t=>{function e(i,n){let r=i,s=[],a=[];for(let o of n)try{if(o.type===3||o.type===5&&o.path[o.path.length-1]==="variables"){let l,c;if(o.type===3?(l=Vn.zoom(r,[...o.path,o.id]),c=tr.apply(r,{...o,type:2})):(l=Vn.zoom(r,[...o.path,o.id,"value"]),c=tr.apply(r,o)),c!==null){r=c.data;let[h,d]=qY(r,{[o.id]:l});r=h;for(let u=0;u<d.length;u++){let p,f,g=d[u],m=g.pop();if(typeof m=="number"){let v=[m];for(let _=u+1;_<d.length;_++){let b=d[_],x=b[b.length-1];if(typeof x!="number"||!Vn.equal(g,b.slice(0,b.length-1)))break;v.push(x),d.splice(_,1)}let y=Vn.zoom(r,g);f=y.map((_,b)=>v.includes(b)?o.id:_),p=y,m=g.pop()}else p=l,(m==="alphaOverride"||m==="alpha")&&(p=l/100,Vn.zoom(r,g)[m]=p),f=o.id;s.push({type:0,path:g,props:{[m]:p}}),a.push({type:0,path:g,props:{[m]:f}})}a.push(c.reverse),s.push(c.actual)}}else{let l=tr.apply(r,o);l!==null&&(s.push(l.actual),r=l.data,a.push(l.reverse))}}catch(l){if(l instanceof v3)return null;throw l}return{data:r,actual:s,reverse:a.reverse()}}t.empty=function(){return[]},t.removePrefix=function(i,n){let r=[];for(let s of i){let[a,...o]=s.path;a===n&&r.push({...s,path:o})}return r},t.addPrefix=function(i,n){return i.map(r=>({...r,path:[n,...r.path]}))},t.concat=function(i,n){return[...i,...n]},t.compress=function(i,n){return[...i.filter(r=>!n.some(s=>tr.subsumed(r,s))),...n]},t.commutative=function(i,n){return i.every(r=>n.every(s=>tr.commutative(r,s)))},t.applyAll=function(i,n){for(let r of n){let s=e(i,r);s!==null&&(i=s.data)}return i},t.apply=e})(QO||(QO={}))});function JO(t,e){return t instanceof Zi?Object.setPrototypeOf(e,Zi.prototype):_p.tryPreservePrototype(t,e)}function BS(t,e,i){if(t.length>0){let n=t[t.length-1];if(n.type===0&&e.type===0&&Vn.equal(n.path,i))return void Object.assign(n.props,e.props)}t.push({...e,path:i})}function N1(t,e,i){return i instanceof qn?new f0(t,e,i):i instanceof Nt?new m0(t,e,i):i instanceof te?new Proxy(new jN(t,e,i),HN):i!==null&&typeof i=="object"?Qc(i)?i:new Proxy(new VN(t,e,i),GN):i}function jm(t){let e=new AA(t);return[N1(e,"",t),e]}function rb(t,e){let[i,n]=jm(t);return e(i),n.result()}function en(t){return t instanceof f0||t instanceof m0?t._current:t!==null&&typeof t=="object"?t[sb]:t}function Gm(t){if(t instanceof f0||t instanceof m0)return t._current;if(t!==null&&typeof t=="object"){let e=t[sb];return e!==void 0?e:t}return t}var sb,tI,Gf,jd,VN,jN,US,GN,HN,f0,m0,AA,Vn,WN=z(()=>{Mx(),sd(),b3(),ad(),Dn(),Ax(),Ex(),sb=Symbol(),tI=Symbol(),Gf=Symbol(),jd=class{reportOp(t,e,i=[]){let n=this;if(e===null)return;n._current=e.data;let r=i;for(;!(n instanceof AA);){let s=n._path,a=n._current;if(s!==""&&r.splice(0,0,s),n=n._parent,n===null)return;n.update(s,a)}n.push(r,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[Gf];i&&i(),delete this._children[t]}}}},VN=class extends jd{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if(typeof t=="string"&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current=JO(this._current,{...this._current,[t]:e})}runOp(t){let e=_p.runOp(this._current,t);e!==null&&(e.data=JO(this._current,e.data)),this.reportOp(t,e,t.path)}},jN=class extends jd{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,te.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},US={get(t,e){if(e===Gf)return()=>{t._parent=null};if(e===sb)return t._current;if(e===tI)return t;let{_current:i,_children:n}=t;if(e==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let r=n===void 0?void 0:n[e];if(r!==void 0)return r;let s=i[e],a=N1(t,e,s);return a!==s?(n===void 0&&(n={},t._children=n),n[e]=a,a):s},has:(t,e)=>e in t._current,ownKeys:t=>Reflect.ownKeys(t._current),defineProperty(){throw Error("not supported")},getPrototypeOf:t=>Object.getPrototypeOf(t._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,n=Reflect.getOwnPropertyDescriptor(i,e);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:i[e]}}},GN={...US,set(t,e,i){let n={type:0,props:{[e]:en(i)??i}};return t.deleteChildren(e),t.runOp(n),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},HN={...US,set(t,e,i){return i===void 0?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty:(t,e)=>(t.runOp({type:2,id:e}),!0)},f0=class extends jd{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Gf]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=N1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}add(t,e,i,n,r){this.runOp({type:7,parent:t,fi:e,id:i,data:n,children:r})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}insertBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.add(t,n[r],s.id,s.data,s.children)}}moveAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}moveBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let s=i[r];this.move(t,n[r],s)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},m0=class extends jd{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Gf]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id,r=this._current[i].fi;t(this.data(this._current[i].id),n,r,i)}}find(t){let e=this.length;for(let i=0;i<e;i++){let n=this._current[i].id;if(t(this.data(n),n))return this.get(n)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}at(t){let{id:e,fi:i}=this._current.at(t);return{id:e,fi:i,data:this.data(e)}}data(t){let{_current:e,_children:i}=this,n=i===void 0?void 0:i[t];if(n!==void 0)return n;let r=e.get(t)?.data,s=N1(this,t,r);return s!==r?(i===void 0&&(i={},this._children=i),i[t]=s,s):r}runOp(t){this.reportOp(t,this._current.runOp(t))}add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.add(i[n],r.id,r.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let r=e[n];this.move(i[n],r)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}},AA=class extends jd{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(t!=="")throw new Error("");this._current=e}push(t,e,i,n){BS(this.ts,e,t),BS(this.actual,i,t),BS(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}}),Ax=z(()=>{y3(),WN(),ad(),sd(),Dn(),(t=>{function e(n,r){return(n instanceof qn||n instanceof f0)&&typeof r=="string"||(n instanceof Nt||n instanceof m0)&&typeof r=="string"?n.data(r):typeof r=="number"&&Array.isArray(n)||typeof r=="string"&&typeof n=="object"&&n!==null?n[r]:void 0}function i(n,r,s=0){for(;s<r.length&&n!==void 0;)n=e(n,r[s]),s+=1;return n}t.equal=function(n,r){if(r.length!==n.length)return!1;{let s=0;for(;s<n.length;){if(n[s]!==r[s])return!1;s+=1}}return!0},t.removeOverridden=function(n,r,s){let a=i(s,n);if(a!==void 0&&typeof a=="object"&&a!==null){let o={...r};return Object.keys(a).forEach(l=>{delete o[l]}),o}return r},t.zoomOnce=e,t.zoom=i,t.findPathes=function(n,r){let s=[];return function a(o,l){if(o instanceof ib&&o.id===r.id)s.push(l);else if(o instanceof Nt)for(let c=0;c<o.length;c++)a(o[c].data,[...l,o[c].id]);else if(o instanceof qn)o.traverse((c,h)=>{a(h,[...l,c])});else if(Array.isArray(o)){if(typeof o[0]=="number")return;for(let c=0;c<o.length;c++)a(o[c],[...l,c])}else{if(Qc(o))return;if(typeof o=="object"&&o!==null)for(let c in o)a(o[c],[...l,c])}}(n,[]),s}})(Vn||(Vn={}))}),$Y=z(()=>{});function ri(t,e){let i=[];if(!(e.length<=t.length))return null;{let n=0;for(;n<e.length;){if(e[n]==="*")i.push(t[n]);else if(t[n]!==e[n])return null;n+=1}}return i}var YY=z(()=>{});function Iv(t){try{if(!wi.trusted&&!rl){let i=Qe.sharedLength||0;i<Qe.length&&(Qe.length=i)}let e;if(wi.randomAccessStructure&&Vt[ut]<64&&Vt[ut]>=32&&aI?(e=aI(Vt,ut,js,wi),Vt=null,!(t&&t.lazy)&&e&&(e=e.toJSON()),ut=js):e=yn(),yr&&(ut=yr.postBundlePosition,yr=null),rl&&(Qe.restoreStructures=null),ut==js)Qe&&Qe.restoreStructures&&eI(),Qe=null,Vt=null,nl&&(nl=null);else{if(ut>js)throw new Error("Unexpected end of MessagePack data");if(!rl){let i;try{i=JSON.stringify(e,(n,r)=>typeof r=="bigint"?`${r}n`:r).slice(0,100)}catch(n){i="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+i)}}return e}catch(e){throw Qe&&Qe.restoreStructures&&eI(),CA(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||ut>js)&&(e.incomplete=!0),e}}function eI(){for(let t in Qe.restoreStructures)Qe[t]=Qe.restoreStructures[t];Qe.restoreStructures=null}function yn(){let t=Vt[ut++];if(t<160){if(t<128){if(t<64)return t;{let e=Qe[63&t]||wi.getStructures&&qN()[63&t];return e?(e.read||(e.read=TA(e,63&t)),e.read()):t}}if(t<144){if(t-=128,wi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=$N();n==="__proto__"&&(n="__proto_"),e[n]=yn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(yn(),yn());return e}}{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=yn();return wi.freezeData?Object.freeze(e):e}}if(t<192){let e=t-160;if(fa>=ut)return nh.slice(ut-vs,(ut+=e)-vs);if(fa==0&&js<140){let i=e<16?S3(e):XN(e);if(i!=null)return i}return lb(e)}{let e;switch(t){case 192:return null;case 193:return yr?(e=yn(),e>0?yr[1].slice(yr.position1,yr.position1+=e):yr[0].slice(yr.position0,yr.position0-=e)):KN;case 194:return!1;case 195:return!0;case 196:if(e=Vt[ut++],e===void 0)throw new Error("Unexpected end of buffer");return zS(e);case 197:return e=He.getUint16(ut),ut+=2,zS(e);case 198:return e=He.getUint32(ut),ut+=4,zS(e);case 199:return oc(Vt[ut++]);case 200:return e=He.getUint16(ut),ut+=2,oc(e);case 201:return e=He.getUint32(ut),ut+=4,oc(e);case 202:if(e=He.getFloat32(ut),wi.useFloat32>2){let i=LA[(127&Vt[ut])<<1|Vt[ut+1]>>7];return ut+=4,(i*e+(e>0?.5:-.5)|0)/i}return ut+=4,e;case 203:return e=He.getFloat64(ut),ut+=8,e;case 204:return Vt[ut++];case 205:return e=He.getUint16(ut),ut+=2,e;case 206:return e=He.getUint32(ut),ut+=4,e;case 207:return wi.int64AsType==="number"?(e=4294967296*He.getUint32(ut),e+=He.getUint32(ut+4)):wi.int64AsType==="string"?e=He.getBigUint64(ut).toString():wi.int64AsType==="auto"?(e=He.getBigUint64(ut),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigUint64(ut),ut+=8,e;case 208:return He.getInt8(ut++);case 209:return e=He.getInt16(ut),ut+=2,e;case 210:return e=He.getInt32(ut),ut+=4,e;case 211:return wi.int64AsType==="number"?(e=4294967296*He.getInt32(ut),e+=He.getUint32(ut+4)):wi.int64AsType==="string"?e=He.getBigInt64(ut).toString():wi.int64AsType==="auto"?(e=He.getBigInt64(ut),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=He.getBigInt64(ut),ut+=8,e;case 212:if(e=Vt[ut++],e==114)return IA(63&Vt[ut++]);{let i=mr[e];if(i)return i.read?(ut++,i.read(yn())):i.noBuffer?(ut++,i()):i(Vt.subarray(ut,++ut));throw new Error("Unknown extension "+e)}case 213:return e=Vt[ut],e==114?(ut++,IA(63&Vt[ut++],Vt[ut++])):oc(2);case 214:return oc(4);case 215:return oc(8);case 216:return oc(16);case 217:return e=Vt[ut++],fa>=ut?nh.slice(ut-vs,(ut+=e)-vs):JN(e);case 218:return e=He.getUint16(ut),fa>=(ut+=2)?nh.slice(ut-vs,(ut+=e)-vs):tk(e);case 219:return e=He.getUint32(ut),fa>=(ut+=4)?nh.slice(ut-vs,(ut+=e)-vs):ek(e);case 220:return e=He.getUint16(ut),ut+=2,iI(e);case 221:return e=He.getUint32(ut),ut+=4,iI(e);case 222:return e=He.getUint16(ut),ut+=2,nI(e);case 223:return e=He.getUint32(ut),ut+=4,nI(e);default:if(t>=224)return t-256;if(t===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+t)}}}function TA(t,e){function i(){if(i.count++>DA){let r;try{r=t.read=new Function("r","return function(){return "+(wi.freezeData?"Object.freeze":"")+"({"+t.map(s=>s==="__proto__"?"__proto_:r()":QN.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"})}")(yn)}catch{return DA=1/0,i()}return t.read0=r,t.highByte===0&&(t.read=RA(e,t.read)),r()}let n={};for(let r=0,s=t.length;r<s;r++){let a=t[r];a==="__proto__"&&(a="__proto_"),n[a]=yn()}return wi.freezeData?Object.freeze(n):n}return i.count=0,t.read0=i,t.highByte===0?RA(e,i):i}function qN(){let t=ZN(()=>(Vt=null,wi.getStructures()));return Qe=wi._mergeStructures(t,Qe)}function Hm(t){let e;if(t<16&&(e=S3(t)))return e;if(t>64&&PA)return PA.decode(Vt.subarray(ut,ut+=t));let i=ut+t,n=[];for(e="";ut<i;){let r=Vt[ut++];if(128&r)if((224&r)==192){let s=(31&r)<<6|63&Vt[ut++];s<128?n.push(65533):n.push(s)}else if((240&r)==224){let s=(31&r)<<12|(63&Vt[ut++])<<6|63&Vt[ut++];s<2048||s>=55296&&s<=57343?n.push(65533):n.push(s)}else if((248&r)==240){let s=(7&r)<<18|(63&Vt[ut++])<<12|(63&Vt[ut++])<<6|63&Vt[ut++];s<65536||s>1114111?n.push(65533):(s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s))}else n.push(65533);else n.push(r);n.length>=4096&&(e+=Nn.apply(String,n),n.length=0)}return n.length>0&&(e+=Nn.apply(String,n)),e}function iI(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=yn();return wi.freezeData?Object.freeze(e):e}function nI(t){if(wi.mapsAsObjects){let e={};for(let i=0;i<t;i++){let n=$N();n==="__proto__"&&(n="__proto_"),e[n]=yn()}return e}{let e=new Map;for(let i=0;i<t;i++)e.set(yn(),yn());return e}}function XN(t){let e=ut,i=new Array(t);for(let n=0;n<t;n++){let r=Vt[ut++];if((128&r)>0)return void(ut=e);i[n]=r}return Nn.apply(String,i)}function S3(t){if(t<4){if(t<2){if(t===0)return"";{let e=Vt[ut++];return(128&e)>1?void(ut-=1):Nn(e)}}{let e=Vt[ut++],i=Vt[ut++];if((128&e)>0||(128&i)>0)return void(ut-=2);if(t<3)return Nn(e,i);let n=Vt[ut++];return(128&n)>0?void(ut-=3):Nn(e,i,n)}}{let e=Vt[ut++],i=Vt[ut++],n=Vt[ut++],r=Vt[ut++];if((128&e)>0||(128&i)>0||(128&n)>0||(128&r)>0)return void(ut-=4);if(t<6){if(t===4)return Nn(e,i,n,r);{let s=Vt[ut++];return(128&s)>0?void(ut-=5):Nn(e,i,n,r,s)}}if(t<8){let s=Vt[ut++],a=Vt[ut++];if((128&s)>0||(128&a)>0)return void(ut-=6);if(t<7)return Nn(e,i,n,r,s,a);let o=Vt[ut++];return(128&o)>0?void(ut-=7):Nn(e,i,n,r,s,a,o)}{let s=Vt[ut++],a=Vt[ut++],o=Vt[ut++],l=Vt[ut++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(ut-=8);if(t<10){if(t===8)return Nn(e,i,n,r,s,a,o,l);{let c=Vt[ut++];return(128&c)>0?void(ut-=9):Nn(e,i,n,r,s,a,o,l,c)}}if(t<12){let c=Vt[ut++],h=Vt[ut++];if((128&c)>0||(128&h)>0)return void(ut-=10);if(t<11)return Nn(e,i,n,r,s,a,o,l,c,h);let d=Vt[ut++];return(128&d)>0?void(ut-=11):Nn(e,i,n,r,s,a,o,l,c,h,d)}{let c=Vt[ut++],h=Vt[ut++],d=Vt[ut++],u=Vt[ut++];if((128&c)>0||(128&h)>0||(128&d)>0||(128&u)>0)return void(ut-=12);if(t<14){if(t===12)return Nn(e,i,n,r,s,a,o,l,c,h,d,u);{let p=Vt[ut++];return(128&p)>0?void(ut-=13):Nn(e,i,n,r,s,a,o,l,c,h,d,u,p)}}{let p=Vt[ut++],f=Vt[ut++];if((128&p)>0||(128&f)>0)return void(ut-=14);if(t<15)return Nn(e,i,n,r,s,a,o,l,c,h,d,u,p,f);let g=Vt[ut++];return(128&g)>0?void(ut-=15):Nn(e,i,n,r,s,a,o,l,c,h,d,u,p,f,g)}}}}}function rI(){let t,e=Vt[ut++];if(e<192)t=e-160;else switch(e){case 217:t=Vt[ut++];break;case 218:t=He.getUint16(ut),ut+=2;break;case 219:t=He.getUint32(ut),ut+=4;break;default:throw new Error("Expected string")}return Hm(t)}function zS(t){return wi.copyBuffers?Uint8Array.prototype.slice.call(Vt,ut,ut+=t):Vt.subarray(ut,ut+=t)}function oc(t){let e=Vt[ut++];if(mr[e]){let i;return mr[e](Vt.subarray(ut,i=ut+=t),n=>{ut=n;try{return yn()}finally{ut=i}})}throw new Error("Unknown extension type "+e)}function $N(){let t=Vt[ut++];if(!(t>=160&&t<192))return ut--,YN(yn());if(t-=160,fa>=ut)return nh.slice(ut-vs,(ut+=t)-vs);if(!(fa==0&&js<180))return lb(t);let e,i=4095&(t<<5^(t>1?He.getUint16(ut):t>0?Vt[ut]:0)),n=OA[i],r=ut,s=ut+t-3,a=0;if(n&&n.bytes==t){for(;r<s;){if(e=He.getUint32(r),e!=n[a++]){r=1879048192;break}r+=4}for(s+=3;r<s;)if(e=Vt[r++],e!=n[a++]){r=1879048192;break}if(r===s)return ut=r,n.string;s-=3,r=ut}for(n=[],OA[i]=n,n.bytes=t;r<s;)e=He.getUint32(r),n.push(e),r+=4;for(s+=3;r<s;)e=Vt[r++],n.push(e);let o=t<16?S3(t):XN(t);return n.string=o??lb(t)}function YN(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return t.toString();if(t==null)return t+"";if(wi.allowArraysInMapKeys&&Array.isArray(t)&&t.flat().every(e=>["string","number","boolean","bigint"].includes(typeof e)))return t.flat().toString();throw new Error("Invalid property type for record: "+typeof t)}function ZN(t){oI&&oI();let e=js,i=ut,n=ob,r=vs,s=fa,a=nh,o=ab,l=nl,c=yr,h=new Uint8Array(Vt.slice(0,js)),d=Qe,u=Qe.slice(0,Qe.length),p=wi,f=rl,g=t();return js=e,ut=i,ob=n,vs=r,fa=s,nh=a,ab=o,nl=l,yr=c,Vt=h,rl=f,(Qe=d).splice(0,Qe.length,...u),wi=p,He=new DataView(Vt.buffer,Vt.byteOffset,Vt.byteLength),g}function CA(){Vt=null,nl=null,Qe=null}function ZY(t){t.unpack?mr[t.type]=t.unpack:mr[t.type]=t}var PA,Vt,js,ut,sI,ab,ob,wi,Qe,nh,vs,fa,yr,nl,mr,He,FS,KN,rl,DA,aI,oI,Wm,QN,RA,lb,JN,tk,ek,Nn,OA,IA,NS,lI,hI,cI,LA,Lv,dI,uI,pI,BA,kS,Jg,KY=z(()=>{try{PA=new TextDecoder}catch{}ut=0,ab=sI=[],ob=0,wi={},vs=0,fa=0,mr=[],FS={useRecords:!1,mapsAsObjects:!0},(KN=new class{}).name="MessagePack 0xC1",rl=!1,DA=2,Wm=class{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=0&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,e){if(Vt)return ZN(()=>(CA(),this?this.unpack(t,e):Wm.prototype.unpack.call(FS,t,e)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof e=="object"?(js=e.end||t.length,ut=e.start||0):(ut=0,js=e>-1?e:t.length),ob=0,fa=0,nh=null,ab=sI,yr=null,Vt=t;try{He=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(i){throw Vt=null,t instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof Wm){if(wi=this,this.structures)return Qe=this.structures,Iv(e);(!Qe||Qe.length>0)&&(Qe=[])}else wi=FS,(!Qe||Qe.length>0)&&(Qe=[]);return Iv(e)}unpackMultiple(t,e){let i,n=0;try{rl=!0;let r=t.length,s=this?this.unpack(t,r):Lv.unpack(t,r);if(!e){for(i=[s];ut<r;)n=ut,i.push(Iv());return i}if(e(s,n,ut)===!1)return;for(;ut<r;)if(n=ut,e(Iv(),n,ut)===!1)return}catch(r){throw r.lastPosition=n,r.values=i,r}finally{rl=!1,CA()}}_mergeStructures(t,e){t=t||[],Object.isFrozen(t)&&(t=t.map(i=>i.slice(0)));for(let i=0,n=t.length;i<n;i++){let r=t[i];r&&(r.isShared=!0,i>=32&&(r.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let n=t[i],r=e[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,e){return this.unpack(t,e)}},QN=/^[a-zA-Z_$][a-zA-Z\d_$]*$/,RA=(t,e)=>function(){let i=Vt[ut++];if(i===0)return e();let n=t<32?-(t+(i<<5)):t+(i<<5),r=Qe[n]||qN()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=TA(r,t)),r.read()},lb=Hm,JN=Hm,tk=Hm,ek=Hm,Nn=String.fromCharCode,OA=new Array(4096),IA=(t,e)=>{let i=yn().map(YN),n=t;e!==void 0&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let r=Qe[t];return r&&(r.isShared||rl)&&((Qe.restoreStructures||(Qe.restoreStructures=[]))[t]=r),Qe[t]=i,i.read=TA(i,n),(i.read0||i.read)()},mr[0]=()=>{},mr[0].noBuffer=!0,mr[66]=t=>{let e=t.byteLength%8||8,i=BigInt(128&t[0]?t[0]-256:t[0]);for(let n=1;n<e;n++)i<<=BigInt(8),i+=BigInt(t[n]);if(t.byteLength!==e){let n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=(s,a)=>{let o=a-s;if(o<=40){let d=n.getBigUint64(s);for(let u=s+8;u<a;u+=8)d<<=BigInt(64),d|=n.getBigUint64(u);return d}let l=s+(o>>4<<3),c=r(s,l),h=r(l,a);return c<<BigInt(8*(a-l))|h};i=i<<BigInt(8*(n.byteLength-e))|r(e,n.byteLength)}return i},NS={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null},mr[101]=()=>{let t=yn();if(!NS[t[0]]){let e=Error(t[1],{cause:t[2]});return e.name=t[0],e}return NS[t[0]](t[1],{cause:t[2]})},mr[105]=t=>{if(wi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(ut-4);nl||(nl=new Map);let i,n=Vt[ut];i=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&Vt[ut+1]===115?new Set:{};let r={target:i};nl.set(e,r);let s=yn();if(!r.used)return r.target=s;if(Object.assign(i,s),i instanceof Map)for(let[a,o]of s.entries())i.set(a,o);if(i instanceof Set)for(let a of Array.from(s))i.add(a);return i},mr[112]=t=>{if(wi.structuredClone===!1)throw new Error("Structured clone extension is disabled");let e=He.getUint32(ut-4),i=nl.get(e);return i.used=!0,i.target},mr[115]=()=>new Set(yn()),lI=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array"),hI=typeof globalThis=="object"?globalThis:window,mr[116]=t=>{let e=t[0],i=Uint8Array.prototype.slice.call(t,1).buffer,n=lI[e];if(!n){if(e===16)return i;if(e===17)return new DataView(i);throw new Error("Could not find typed array for code "+e)}return new hI[n](i)},mr[120]=()=>{let t=yn();return new RegExp(t[0],t[1])},cI=[],mr[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=ut;return ut+=e-t.length,yr=cI,(yr=[rI(),rI()]).position0=0,yr.position1=0,yr.postBundlePosition=ut,ut=i,yn()},mr[255]=t=>t.length==4?new Date(1e3*(16777216*t[0]+(t[1]<<16)+(t[2]<<8)+t[3])):t.length==8?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+1e3*(4294967296*(3&t[3])+16777216*t[4]+(t[5]<<16)+(t[6]<<8)+t[7])):t.length==12?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+1e3*((128&t[4]?-281474976710656:0)+1099511627776*t[6]+4294967296*t[7]+16777216*t[8]+(t[9]<<16)+(t[10]<<8)+t[11])):new Date("invalid"),LA=new Array(147);for(let t=0;t<256;t++)LA[t]=+("1e"+Math.floor(45.15-.30103*t));(Lv=new Wm({useRecords:!1})).unpack,Lv.unpackMultiple,Lv.unpack,dI=new Float32Array(1),new Uint8Array(dI.buffer,0,4)}),QY=z(()=>{KY(),y3(),Ex(),ad(),Mx(),sd(),uI=[{Class:te.prototype.constructor,type:1,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,te.prototype),t)},{Class:Nt.prototype.constructor,type:2,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,Nt.prototype),t)},{Class:qn.prototype.constructor,type:3,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,qn.prototype),t)},{Class:ib.prototype.constructor,type:4,write:t=>t.id,read:t=>new ib(t)},{Class:EA.prototype.constructor,type:5,write:t=>t.data,read:t=>new EA(t)},{Class:Zi.prototype.constructor,type:6,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,Zi.prototype),t)}];for(let t of uI)ZY(t);pI=new Wm({structuredClone:!0}),(BA||(BA={})).deserialize=function(t){return pI.unpack(t)}}),JY=z(()=>{QY(),kS=t=>()=>{throw new Error(t+" is not available in the runtime build (decode-only CollabSerialize)")},Jg={deserialize:BA.deserialize,serialize:kS("CollabSerialize.serialize"),checksum:kS("CollabSerialize.checksum")}}),Ye=z(()=>{Ax(),WY(),_3(),sd(),Mx(),b3(),ad(),XY(),$Y(),WN(),YY(),y3(),JY(),kN(),Ex()});function UA(t){return t==="MouseDown"||t==="MouseUp"||t==="KeyDown"||t==="KeyUp"||t==="Collision"||t==="Trigger"}var fI,zA,xg,Bv,VS,mI,gI,vI,FA,NA,yI,_I,bI,xI,wI,kA,VA,SI,MI,EI,AI,ik=z(()=>{var t,e,i;Ye(),J(),(t=fI||(fI={})).toEventUIType=function(n){return n.type==="Conditional"?n.condition.type==="Distance"?"Distance":"StateChange":n.type},t.fromEventUIType=function(n){return n==="Distance"||n==="StateChange"?"Conditional":n},zA={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyPress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],GameControl:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Trigger:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Resize:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],VariableChange:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],API:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],WEBHOOK:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],AIAssistantListener:["SetVariable"],AIAssistantTrigger:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]},(n=>{n.is=function(r){return r.type==="MouseDown"||r.type==="MouseUp"||r.type==="MousePress"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="KeyPress"},n.defaultData=function(r){return r==="MouseDown"||r==="MouseUp"||r==="MousePress"?{type:r,mode:"Object",disabled:!1,name:"",actions:new Nt}:{type:r,disabled:!1,name:"",key:void 0,actions:new Nt}}})(xg||(xg={})),(n=>{n.propertyDefaultData=function(r){return{type:"Property",value:[r??null,"position","x"]}},n.valueDefaultData={type:"Literal",value:0}})(Bv||(Bv={})),(e=VS||(VS={})).comparisonDefaultData=function(n){return{type:"Comparison",operator:"==",lOperand:Bv.propertyDefaultData(n),rOperand:{...Bv.valueDefaultData}}},e.distanceDefaultData=function(n){return{type:"Distance",toObject:n??null,fromObject:n??null,distance:200}},e.stateDefaultData=function(n,r){return{type:"State",object:n??null,state:r??null}},(mI||(mI={})).isConditionalSubActions=function(n){return n.find(r=>r==="ifActions"||r==="elseActions")!==void 0},(n=>{n.is=function(r){return r.type==="Conditional"},n.defaultData=function(r){return{type:"Conditional",disabled:!1,name:"",inActions:new Nt,outActions:new Nt,condition:VS.distanceDefaultData(r)}}})(gI||(gI={})),(vI||(vI={})).defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new Nt,drop:new Nt}},(FA||(FA={})).defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new Nt},(NA||(NA={})).defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5},(n=>{n.is=function(r){return r.type==="MouseHover"},n.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new Nt}}})(yI||(yI={})),(n=>{n.is=function(r){return r.type==="Scroll"},n.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Nt}}})(_I||(_I={})),(n=>{n.is=function(r){return r.type==="Start"},n.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new Nt}}})(bI||(bI={})),(n=>{n.is=function(r){return r.type==="Collision"},n.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Nt}}})(xI||(xI={})),(n=>{n.is=function(r){return r.type==="Trigger"},n.defaultData=function(r,s){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Nt,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}})(wI||(wI={})),(i=kA||(kA={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},i.is=function(n){return n.type==="Resize"},i.sizeToDevice=function(n){return typeof n=="string"?n:"custom"},i.deviceToSize=function(n){return typeof n=="string"?[...i.defaultSizes[n]]:[...n]},i.defaultData=function(){let n={size:"mobile",operator:"<",actions:new Nt},r={size:"tablet",operator:"<",actions:new Nt},s={size:[...i.defaultSizes.custom],operator:"<>",actions:new Nt},a=new Nt;return a.push({id:Pt.generateUUID(),fi:0,data:n},{id:Pt.generateUUID(),fi:1,data:r},{id:Pt.generateUUID(),fi:2,data:s}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:a}},i.defaultBreakpointData=function(){return{size:[...i.defaultSizes.custom],operator:"<>",actions:new Nt}},(n=>{n.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]},n.is=function(r){return r.type==="VariableChange"},n.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new Nt,variableId:"",objectId:null,property:"Position X"}}})(VA||(VA={})),(n=>{n.is=function(r){return r.type==="API"},n.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new Nt,errorActions:new Nt,userAPIId:""}}})(SI||(SI={})),(n=>{n.is=function(r){return r.type==="WEBHOOK"},n.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Nt,userWebhookId:""}}})(MI||(MI={})),(n=>{n.is=function(r){return r.type==="AIAssistantListener"},n.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Nt,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(EI||(EI={})),(n=>{n.is=function(r){return r.type==="AIAssistantTrigger"},n.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Nt}}})(AI||(AI={}))});function TI(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function jA(t){return typeof t=="string"&&t.length===36&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)}var od,ep,nk,Ir,CI,io,yh,t0,PI,jS,xs,fn,Je,GA,DI,rh,bp,RI,OI,II,LI,BI,UI,zI,FI,GS,NI,kI,HS,VI,jI,GI,WS,HI,qS,WI,qI,XS,XI,HA,$I,YI,ZI,KI,QI,JI,Jc,sl,sh,WA,qA,hb,cb,db,ub,pb,XA,$A,fb,YA,ip,t4,$S,YS,ZA,e4,mb,gb,ZS,i4,vb,KS,n4,r4,s4,a4,o4,l4,h4,c4,Tx,M3,Xi,zi,Ou,rk,xp,yb,Lc,KA,E3,_b,bb,xb,Qo,k1,er,QS,Zl,wb,wg,JS,t2,e2,np,i2,QA,JA,d4,Gd,sk,Tn,Sb,u4,p4,f4,m4,Xa,Sg,Mb,Eb,al,qc,g4,ah,Ab,ol,n2,r2,Bc,td,Uc,Mg,tT,v4,_r,s2,y4,_4,Jo,Vs,rp,hs=z(()=>{var t,e,i,n,r,s,a,o;od="personal camera",ep="a218fcc3-276b-49b9-b485-49037fd14f5f",nk=2500134,Ir=5526619,(t=CI||{}).x="x",t.y="y",t.z="z",CI=t,(l=>{function c(u,p){return Math.pow(p[0]-u[0],2)+Math.pow(p[1]-u[1],2)}function h(u,p){return Math.sqrt(c(u,p))}function d(u,p,f){let g=l.sub(p,u),m=l.sub(f,u),v=l.dot(g,m)/l.dot(g,g),y=l.scalarMultiply(g,v);return l.add(u,y)}l.isEqual=function(u,p){return u[0]===p[0]&&u[1]===p[1]},l.lerp=function(u,p,f){return[u[0]+(p[0]-u[0])*f,u[1]+(p[1]-u[1])*f]},l.add=function(u,p){return[u[0]+p[0],u[1]+p[1]]},l.sub=function(u,p){return[u[0]-p[0],u[1]-p[1]]},l.multiply=function(u,p){return[u[0]*p[0],u[1]*p[1]]},l.divide=function(u,p){return[u[0]/p[0],u[1]/p[1]]},l.distanceSquared=c,l.distance=h,l.dot=function(u,p){return u[0]*p[0]+u[1]*p[1]},l.scalarMultiply=function(u,p){return[u[0]*p,u[1]*p]},l.projectionOnto=d,l.projectionOntoDistance=function(u,p,f){return h(u,d(u,p,f))},l.center=function(u,p){return[.5*(u[0]+p[0]),.5*(u[1]+p[1])]}})(io||(io={})),(e=yh||(yh={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]},e.add=function(l,c){return[l[0]+c[0],l[1]+c[1],l[2]+c[2]]},e.sub=function(l,c){return[l[0]-c[0],l[1]-c[1],l[2]-c[2]]},e.div=function(l,c){return[l[0]/c[0],l[1]/c[1],l[2]/c[2]]},e.mul=function(l,c){return[l[0]*c[0],l[1]*c[1],l[2]*c[2]]},e.dist=function(l,c){return Math.hypot(l[0]-c[0],l[1]-c[1],l[2]-c[2])},e.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h]},(i=t0||(t0={})).isEqual=function(l,c){return l[0]===c[0]&&l[1]===c[1]&&l[2]===c[2]&&l[3]===c[3]},i.lerp=function(l,c,h){return[l[0]+(c[0]-l[0])*h,l[1]+(c[1]-l[1])*h,l[2]+(c[2]-l[2])*h,l[3]+(c[3]-l[3])*h]},(l=>{let c=180/Math.PI,h=Math.PI/180;function d(p){return typeof p=="number"?p*c:p}function u(p){return typeof p=="number"?p*h:p}l.radToDeg=function(p){return[d(p[0]),d(p[1]),d(p[2])]},l.degToRad=function(p){return[u(p[0]),u(p[1]),u(p[2])]}})(PI||(PI={})),(n=jS||(jS={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],n.isEqual=function(l,c){for(let h=0;h<16;h++)if(l[h]!==c[h])return!1;return!0},n.simplify=function(l){return l??n.identity},n.applyMatrix4=function(l,c){let h=c.slice(0);for(let d=0,u=c.length;d<u;d+=3){let p=l[3]*c[d]+l[7]*c[d+1]+l[11]*c[d+2]+l[15];h[d]=(l[0]*c[d]+l[4]*c[d+1]+l[8]*c[d+2]+l[12])/p,h[d+1]=(l[1]*c[d]+l[5]*c[d+1]+l[9]*c[d+2]+l[13])/p,h[d+2]=(l[2]*c[d]+l[6]*c[d+1]+l[10]*c[d+2]+l[14])/p}return h},(l=>{l.zero=[0,0,0,0,0,0],l.INDEX_MAP=[4,8,1,9,2,6],l.toMatrix=function(c){let h=[...jS.identity];for(let d=0;d<6;d++)h[l.INDEX_MAP[d]]=c[d];return h},l.fromMatrix=function(c){return[c[l.INDEX_MAP[0]],c[l.INDEX_MAP[1]],c[l.INDEX_MAP[2]],c[l.INDEX_MAP[3]],c[l.INDEX_MAP[4]],c[l.INDEX_MAP[5]]]}})(xs||(xs={})),(r=fn||(fn={})).isRGB=function(l){return typeof l=="object"&&typeof l.r=="number"&&typeof l.g=="number"&&typeof l.b=="number"},r.white={r:1,g:1,b:1},r.red={r:1,g:0,b:0},r.black={r:0,g:0,b:0},r.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:1}},r.clone=function(l){return{r:l.r,g:l.g,b:l.b}},r.fromHex=function(l){return{r:((l=Math.floor(l))>>16&255)/255,g:(l>>8&255)/255,b:(255&l)/255}},r.toHex=function(l){return 65536*Math.round(255*l.r)+256*Math.round(255*l.g)+Math.round(255*l.b)},r.equals=function(l,c){return l.r===c.r&&l.g===c.g&&l.b===c.b},r.equalsFixed=function(l,c){return l.r.toFixed(2)===c.r.toFixed(2)&&l.g.toFixed(2)===c.g.toFixed(2)&&l.b.toFixed(2)===c.b.toFixed(2)},r.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h}},r.is=function(l){return!!TI(l)&&"r"in l&&"g"in l&&"b"in l&&!("a"in l)},(s=Je||(Je={})).white={...fn.white,a:1},s.is=function(l){return!!TI(l)&&"r"in l&&"g"in l&&"b"in l&&"a"in l},s.transparent={...fn.white,a:0},s.from0to1=function(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}},s.fromHexAndA=function(l,c){return{...fn.fromHex(l),a:c}},s.toRgb255a1=function(l){return{r:Math.round(255*l.r),g:Math.round(255*l.g),b:Math.round(255*l.b),a:l.a}},s.equals=function(l,c){return fn.equals(l,c)&&l.a===c.a},s.equalsFixed=function(l,c){return fn.equalsFixed(l,c)&&l.a.toFixed(2)===c.a.toFixed(2)},s.lerp=function(l,c,h){return{r:l.r+(c.r-l.r)*h,g:l.g+(c.g-l.g)*h,b:l.b+(c.b-l.b)*h,a:l.a+(c.a-l.a)*h}},s.toStyle=function({r:l,g:c,b:h,a:d}=s.white){return`rgba(${255*l}, ${255*c}, ${255*h}, ${d})`},(GA||(GA={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]},(a=DI||{})[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING",a[a.ARC=7]="ARC",a[a.NONE=8]="NONE",DI=a,(rh||(rh={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(bp||(bp={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=RI||(RI={})).linear=[0,0,1,1],o.ease=[.25,.1,.25,1],o.easeIn=[.42,0,1,1],o.easeOut=[0,0,.58,1],o.easeInOut=[.42,0,.58,1]}),tZ=z(()=>{var t,e;Ye(),ik(),(OI||(OI={})).defaultData={type:"SwitchCamera",name:"",targetCamera:"",delay:0,animate:!0,duration:1e3,easing:4,runMode:"Normal"},(II||(II={})).defaultData={type:"SceneTransition",name:"",target:"",delay:0,duration:1,transition:"none"},(LI||(LI={})).defaultData={type:"Link",name:"",url:null,context:"tab"},(BI||(BI={})).defaultData={type:"Destroy",name:"",objects:[],delay:0},(UI||(UI={})).defaultData={type:"Particles",name:"",emitterObjectId:"",delay:0,emission:"start",triggerAfter:"any"},(zI||(zI={})).defaultData={type:"Create",name:"",object:"",delay:0,creationSpeed:10,coordinateSystem:"world",dynamic:!0,destroy:"No",destroyAfterQuantity:5,lifetime:2,position:[0,0,0],rotation:[0,0,0],velocity:[1e3,0,0],hideBase:"No"},(FI||(FI={})).defaultData={type:"Reset",name:"",delay:0},(GS||(GS={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1},(t=NI||(NI={})).pauseDefaultData={interaction:"pause",delay:0},t.stopDefaultData={interaction:"stop",delay:0},(e=kI||(kI={})).defaultData={type:"Audio",name:"",...GS.defaultData},e.hasAudioByActions=i=>i.some(({data:n})=>n.type==="Audio"&&n.interaction==="play"&&n.audio),e.hasAudioByEvents=i=>e.getAudiosByEvents(i).length>0,e.getAudiosByActions=i=>{let n=[];return i.forEach(r=>{let s=r.data;s.type==="Audio"&&s.interaction==="play"&&s.audio&&n.push(r),s.type==="Conditional"&&(n.push(...e.getAudiosByActions(s.ifActions)),n.push(...e.getAudiosByActions(s.elseActions)))}),n},e.getAudiosByEvents=i=>{let n=[];return i.forEach(({data:r})=>{xg.is(r)||r.type==="Collision"||r.type==="Start"||r.type==="Trigger"||r.type==="VariableChange"||r.type==="WEBHOOK"||r.type==="AIAssistantTrigger"?n.push(...e.getAudiosByActions(r.actions)):r.type==="Conditional"?(n.push(...e.getAudiosByActions(r.inActions)),n.push(...e.getAudiosByActions(r.outActions))):r.type==="GameControl"?Object.values(r.gameActions).forEach(s=>{n.push(...e.getAudiosByActions(s))}):r.type==="DragDrop"?(n.push(...e.getAudiosByActions(r.dragDropActions.drag)),n.push(...e.getAudiosByActions(r.dragDropActions.drop))):r.type==="Resize"?r.breakpoints.forEach(({data:s})=>{n.push(...e.getAudiosByActions(s.actions))}):r.type==="API"&&(n.push(...e.getAudiosByActions(r.successActions)),n.push(...e.getAudiosByActions(r.errorActions)))}),n},(HS||(HS={})).defaultData={interaction:"play",delay:0,volume:.5,loop:1/0},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(VI||(VI={})),(i=>{i.defaultData={type:"Video",name:"",triggerAfter:"autoplay",...HS.defaultData},i.hasVideoByActions=n=>n.some(({data:r})=>r.type==="Video"&&r.interaction==="play"&&r.layerId),i.hasVideoByObject=n=>{if(n.events){for(let{data:r}of n.events)if((xg.is(r)||r.type==="Start")&&i.hasVideoByActions(r.actions))return!0}},i.getVideosByActions=n=>{let r=[];return n.forEach(s=>{let a=s.data;a.type==="Video"&&a.interaction==="play"&&a.layerId&&r.push(s)}),r},i.getVideosByEvents=n=>{let r=[];return n.forEach(({data:s})=>{(xg.is(s)||s.type==="Start")&&r.push(...i.getVideosByActions(s.actions))}),r}})(jI||(jI={})),(GI||(GI={})).defaultData=function(i){return{state:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",duration:1e3,easing:4}},(WS||(WS={})).defaultData=function(){return{tweens:new Nt,repeat:0,delay:0,delayDirection:"start-once",direction:"normal"}},(HI||(HI={})).defaultData=function(i){return{type:"Transition",name:"",runMode:"Once",object:i??null,...WS.defaultData()}},(qS||(qS={})).defaultData=function(i){return{interaction:"play",timeline:i,repeat:0,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Once"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(WI||(WI={})),(qI||(qI={})).defaultData=function(i){return{type:"TimelineAnimation",name:"",...qS.defaultData(i)}},(XS||(XS={})).defaultData=function(i,n,r){return{interaction:"play",object:i,clipId:n,crop:r,crop2:r,repeat:-1,delay:0,delayDirection:"start-once",direction:"normal",runMode:"Normal"}},(i=>{i.pauseDefaultData={interaction:"pause",delay:0},i.stopDefaultData={interaction:"stop",delay:0}})(XI||(XI={})),(i=>{i.defaultData=function(n,r,s){return{type:"Animation",name:"",...XS.defaultData(n,r,s)}},i.isPause=function(n){return n.interaction==="pause"||n.interaction==="stop"}})(HA||(HA={})),($I||($I={})).defaultData={type:"SetVariable",name:"",variableId:"",expression:[]},(YI||(YI={})).defaultData=()=>({type:"Conditional",name:"",ifActions:new Nt,elseActions:new Nt,condition:[]}),(ZI||(ZI={})).defaultData={type:"DynamicVariablePlay",name:"",variableId:"",mode:"PlayPause",delay:0,pauseDelay:0},(KI||(KI={})).defaultData={type:"ClearLocalStorage",name:"",target:"all"},(QI||(QI={})).defaultData={name:"",type:"UserAPI"}}),eZ=z(()=>{var t;(t=JI||(JI={})).emptyAudio={data:Uint8Array.from(atob("UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA=="),e=>e.charCodeAt(0)),mimeType:"audio/wav",filename:"unknown"},t.maxSize=2e6}),ak=z(()=>{var t;(t=Jc||(Jc={})).all=["PerspectiveCamera","OrthographicCamera"],t.is=function(e){return t.all.includes(e)},(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.MinTargetOffset=.001,e.sanitizeTargetOffset=function(s){return s===void 0||!Number.isFinite(s)||s<e.MinTargetOffset?e.DefaultTargetOffset:s},e.DefaultAzimuth=-24,e.DefaultElevation=15;let i=e.DefaultAzimuth*Math.PI/180,n=e.DefaultElevation*Math.PI/180,r=180/Math.PI;e.DefaultPosition=[e.DefaultTargetOffset*Math.sin(i)*Math.cos(n),e.DefaultTargetOffset*Math.sin(n),e.DefaultTargetOffset*Math.cos(i)*Math.cos(n)],e.DefaultRotation=[Math.atan2(-Math.sin(n),Math.cos(i)*Math.cos(n))*r,Math.asin(Math.sin(i)*Math.cos(n))*r,Math.atan2(Math.sin(i)*Math.sin(n),Math.cos(i))*r],e.defaultData={far:1e5,type:"PerspectiveCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(s){return s.type==="PerspectiveCamera"?s.perspective?.zoom??1:s.orthographic?.zoom??1}})(sl||(sl={}))}),ok=z(()=>{var t;(t=sh||(sh={})).defaultData=function(e,i=.1){return{disabled:!1,type:"linear",hideBase:!1,instanced:!1,count:3,radial:{radius:2*Math.max(typeof e[0]=="number"?e[0]:1,typeof e[1]=="number"?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof e[0]=="number"?e[0]+e[0]:1)*i,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map(n=>(typeof n=="number"?n:1)*(1+i)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}},t.merge=function(e,i){let n={...e};if(qA.forEach(r=>{Object.assign(n,{[r]:i[r]??e[r]})}),n.radial={...e.radial},i.radial){let r=e.radial,s=i.radial;hb.forEach(a=>{Object.assign(n.radial,{[a]:s[a]??r[a]})})}if(n.linear={...e.linear},i.linear){let r=e.linear,s=i.linear;cb.forEach(a=>{Object.assign(n.linear,{[a]:s[a]??r[a]})})}if(n.grid={...e.grid},i.grid){let r=e.grid,s=i.grid;db.forEach(a=>{Object.assign(n.grid,{[a]:s[a]??r[a]})})}if(n.toObject={...e.toObject},i.toObject){let r=e.toObject,s=i.toObject;ub.forEach(a=>{Object.assign(n.toObject,{[a]:s[a]??r[a]})})}if(n.randomnessObject={...e.randomnessObject},i.randomnessObject){let r=e.randomnessObject,s=i.randomnessObject;pb.forEach(a=>{Object.assign(n.randomnessObject,{[a]:s[a]??r[a]})})}return n},t.isPartial=function(e){return!(!e.randomnessObject&&!e.toObject)},(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let i=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(n,r){let s=[];n.count!==void 0&&s.push({type:0,path:r,props:{count:n.count}});for(let a of i){let o=n[a];o&&Object.keys(o).length>0&&s.push({type:0,path:[...r,a],props:o})}return s}})(WA||(WA={})),qA=["count"],hb=["radius","start","end","position","scale","rotation"],cb=["position","scale","rotation"],db=["count","size"],ub=["count","position","scale","rotation"],pb=["strength","scale","rotation","position","movement","seed","freqScale"]}),lk=z(()=>{var t;hs(),(t=XA||(XA={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],t.is=function(e){return t.all.includes(e)},($A||($A={})).defaultData=function(e){return function(i){if(i==="PointLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(i==="SpotLight")return{type:i,color:Je.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(i==="DirectionalLight")return{type:i,color:Je.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}}),hk=z(()=>{var t;(t=fb||(fb={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},t.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},t.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:t.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...t.defaultCollisionData}}),ck=z(()=>{var t;(t=YA||(YA={})).defaultData={gravity:10,damping:.03,localStiffness:.67,globalStiffness:.5,globalRange:.15,stiffnessFalloff:.1,windStrength:0,vspCoefficient:.01,elasticity:.15,hairLength:.75,tipSeparation:.8,kink:0,kinkFrequency:0,clumpStrength:0,clumpSize:32,clumpTipScale:1.5,spreadRadius:.03,guideStrands:8192,headShape:"sphere",baseObjectId:null,hairColorSource:"custom",hairShadeRoot:.6,hairShadeTip:1.15,hairRootColor:{r:.29,g:.102,b:.039,a:1},hairMidColor:{r:.8,g:.267,b:.133,a:1},hairTipColor:{r:.545,g:.18,b:.18,a:1},headColor:{r:.325,g:.137,b:.114,a:1},noiseEnabled:!1,noiseColorA:{r:.545,g:.184,b:.788,a:1},noiseColorB:{r:.914,g:.188,b:.914,a:1},noiseColorC:{r:.2,g:.4,b:1,a:1},noiseColorD:{r:.2,g:1,b:.6,a:1},noiseScale:1.8,noiseMixHair:.75,noiseMixHead:.8,castShadow:!0,receiveShadow:!0,hairWidth:1.75,specularPower:40,specularIntensity:.4,diffuseIntensity:.6,ambientIntensity:.25,opacity:1,tipFade:.4,autoPlay:!0},t.regenProps=["hairLength","spreadRadius","guideStrands","headShape","baseObjectId"]}),A3=z(()=>{(ip||(ip={})).defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]}}),dk=z(()=>{var t,e;(t=t4||{})[t.Front=0]="Front",t[t.Back=1]="Back",t[t.Double=2]="Double",t4=t,(e=$S||($S={})).defaultData={castShadow:!0,receiveShadow:!0},e.equals=function(i,n){return i.castShadow===n.castShadow&&i.receiveShadow===n.receiveShadow},(i=>{i.defaultData={flatShading:!1,wireframe:!1,side:0},i.equals=function(n,r){return n.flatShading===r.flatShading&&n.side===r.side&&n.wireframe===r.wireframe&&(n.shadowCatcher??!1)===(r.shadowCatcher??!1)}})(YS||(YS={})),(ZA||(ZA={})).defaultData={...YS.defaultData,...$S.defaultData},(e4||(e4={})).getMaterialData=function(i,n){let r=[];if("material"in i){let s=typeof i.material=="string"?n.materials[i.material]??n.lib.materials[i.material]?.asset:i.material;s&&r.push(s)}else if("materials"in i)for(let s of i.materials){let a=typeof s=="string"?n.materials[s]??n.lib.materials[s]?.asset:s;a&&r.push(a)}return r}}),uk=z(()=>{var t;(t=mb||(mb={})).bytesFromFlattened=function(e){if(typeof e!="object"||e===null||Array.isArray(e)||ArrayBuffer.isView(e)||typeof e[0]!="number")return null;let i=Object.getPrototypeOf(e);if(i!==Object.prototype&&i!==null)return null;let n=Object.keys(e),r=new Uint8Array(n.length),s=e;for(let a=0;a<n.length;a++){let o=s[a];if(n[a]!==String(a)||typeof o!="number"||!Number.isInteger(o)||o<0||o>255)return null;r[a]=o}return r},t.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"}}),pk=z(()=>{var t;(t=gb||(gb={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},t.maxSize=3e7}),g0=z(()=>{var t,e,i,n;Ye(),hs(),uk(),pk(),hs(),(ZS||(ZS={})).is=function(r){return r==="texture"||r==="video"||r==="color"||r==="depth"||r==="normal"||r==="gradient"||r==="noise"||r==="fresnel"||r==="cavity"||r==="dust"||r==="rainbow"||r==="toon"||r==="outline"||r==="particle"||r==="transmission"||r==="reflection"||r==="matcap"||r==="displace"||r==="pattern"||r==="vertexColor"||r==="light"},(i4||(i4={})).is=function(r){return r==="luminance"||r==="r"||r==="g"||r==="b"||r==="a"},(vb||(vb={})).is=function(r){return typeof r=="object"&&r!==null&&r.image!=null},(KS||(KS={})).is=function(r){return r==="phong"||r==="toon"||r==="lambert"||r==="physical"},(n=n4||{})[n.Linear=0]="Linear",n[n.Radial=1]="Radial",n[n.Polar=2]="Polar",n4=n,r4=(r=>(r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",r))(r4||{}),s4=(r=>(r[r.NearestFilter=1003]="NearestFilter",r[r.LinearFilter=1006]="LinearFilter",r[r.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",r))(s4||{}),(i=a4||{})[i.UV=0]="UV",i[i.Planar=1]="Planar",i[i.Spherical=2]="Spherical",i[i.Cylindrical=3]="Cylindrical",i[i.Triplanar=4]="Triplanar",a4=i,(e=o4||{})[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",o4=e,(t=l4||{})[t.F1=0]="F1",t[t.F2=1]="F2",t[t.F2MinusF1=2]="F2MinusF1",t[t.SmoothBlend=3]="SmoothBlend",t[t.Edge=4]="Edge",t[t.Power=5]="Power",t[t.Lines=6]="Lines",t[t.Cells=7]="Cells",l4=t,h4=(r=>(r[r.Lights=0]="Lights",r[r.Static=1]="Static",r[r.Camera=2]="Camera",r))(h4||{}),c4=(r=>(r[r.Circle=0]="Circle",r[r.Ring=1]="Ring",r[r.Polygon=2]="Polygon",r[r.Cross=3]="Cross",r[r.Diamond=4]="Diamond",r[r.Checkerboard=5]="Checkerboard",r[r.Line=6]="Line",r[r.Wave=7]="Wave",r))(c4||{}),Tx=["mode","gradientType","noiseType","tracingMode","mirror","displacementType","projection","cnormal","crop","axis","side","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap","style"],M3=["wrapping","image","video","name","minFilter","magFilter"],(r=>{function s(a,o){return a==="light"&&o?function(l){let c={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(l){case"phong":return{...c,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...c,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...c,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...c,category:"physical",roughness:.6,metalness:.2,reflectivity:.2,type:"light",alpha:.6,visible:!0,mode:0,occlusion:!0}}}(o):function(l){let c={alpha:1,mode:0,isMask:!1,visible:!0};switch(l){case"texture":return{...c,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...c,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:gb.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...c,type:"color",color:fn.fromHex(Ir)};case"vertexColor":return{...c,type:"vertexColor"};case"depth":return{...c,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...c,type:"normal",cnormal:[1,1,1]};case"gradient":return{...c,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...c,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...fn.fromHex(6710886),a:1},colorB:{...fn.fromHex(6710886),a:1},colorC:{...fn.fromHex(16777215),a:1},colorD:{...fn.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"cavity":return{...c,type:"cavity",mode:3,ridge:1,valley:1};case"fresnel":return{...c,type:"fresnel",color:Je.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"dust":return{...c,type:"dust",color:Je.fromHexAndA(10323813,1),coverage:.2,softness:.2,noiseStrength:.2,noiseScale:1};case"rainbow":return{...c,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...c,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Je.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...c,type:"outline",outlineColor:Je.fromHexAndA(0,1),contourColor:Je.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...c,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...c,type:"transmission",thickness:10,ior:1.5,roughness:1};case"reflection":return{...c,type:"reflection",blur:0,thickness:.001,steps:60,stepSize:.005,tracingMode:1,mirror:0};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...c,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...fn.fromHex(0),a:1},colorB:{...fn.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}(a)}r.patch=function(a,o){let{texture:l,...c}=o;if(Object.assign(a,c),l){let h=a.texture;h&&Object.assign(h,l)}},r.defaultColorLayer=function(a){return{...r.defaultData("color"),color:a}},r.defaultData=s,r.defaultDataFor=function(a,o){return a!=="light"?s(a):s("light",typeof o=="string"&&KS.is(o)?o:"physical")}})(Xi||(Xi={})),(r=>{function s(l,c){if(typeof l!="string"||!/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(l))return l;let{r:h,g:d,b:u}=fn.fromHex(parseInt(l.slice(1,7),16)),p=l.length===9?parseInt(l.slice(7),16)/255:void 0;if(Array.isArray(c))return c.length>3?[h,d,u,p??c[3]]:[h,d,u];let f=c;return typeof f?.r!="number"?l:typeof f.a=="number"?{r:h,g:d,b:u,a:p??f.a}:{r:h,g:d,b:u}}function a(l){let c=l?.data;return typeof c=="object"&&c!==null}function o(l,c="layer1",h="layer2",d=fn.fromHex(16777215)){let u=new Nt;return u.push({fi:0,data:Xi.defaultData("light",l),id:c}),u.push({fi:1,data:Xi.defaultData("color"),id:h}),{layers:u}}r.restoreImageBytes=function(l){let c=[],h=new Map,d=(p,f)=>{let g=Gm(p);if(typeof g!="object"||g===null||ArrayBuffer.isView(g))return p;if(h.has(g))return h.get(g)??p;h.set(g,void 0);let m=u(g,f)??p;return h.set(g,m),m},u=(p,f)=>{let g=p;if(!Array.isArray(p)){if(typeof g[0]=="number")return;if(typeof g.name=="string"){let v=mb.bytesFromFlattened(Gm(g.data));if(v!==null)return c.push({path:`${f}/data`,bytes:v.byteLength}),Object.setPrototypeOf({...g,data:v},Object.getPrototypeOf(p))}}let m=null;for(let v of Object.keys(p)){let y=g[v],_=d(y,`${f}/${v}`);_!==y&&(m===null&&(m=Array.isArray(p)?[...p]:{...g},Object.setPrototypeOf(m,Object.getPrototypeOf(p))),m[v]=_)}return m??void 0};return{material:d(l,""),restored:c}},r.restoreLayersSeq=function(l){let c=Gm(l.layers);if(!Array.isArray(c)||c instanceof Nt||!c.every(u=>typeof u=="object"&&u!==null&&typeof u.id=="string"&&typeof u.data=="object"))return{material:l,restored:!1};let h=Object.setPrototypeOf([...c],Nt.prototype),d=Gm(l);return{material:Object.setPrototypeOf({...d,layers:h},Object.getPrototypeOf(d)),restored:!0}},r.isMergable=function(l){return!l.layers.some(c=>c.data.type==="texture"&&c.data.projection!==0||c.data.type==="depth"&&!c.data.isWorldSpace||c.data.type==="noise"||c.data.type==="dust"&&c.data.noiseStrength!==0||c.data.type==="displace")},r.getHash=function(l){let c="";return l.layers.forEach(h=>{Object.entries(h.data).forEach(([d,u])=>{c+=`${d}${u}`,Array.isArray(u)?u.forEach(p=>c+=`${p}`):typeof u=="object"?Object.values(u).forEach(p=>{c+=typeof p=="number"?`${p.toFixed(4)}`:`${p}`}):c+=`${u}`})}),c},r.defaultEmptyData=function(){return{layers:new Nt}},r.defaultData=function(l="layer1",c="layer2"){return o("physical",l,c)},r.withName=function(l,c){return{...l,name:c}},r.isLayerEntry=a,r.withRepairedLayers=function(l){if(l.layers===void 0)return{...l,layers:o("phong").layers};let c=Array.from(l.layers);if(c.every(a))return l;let h=new Nt;return c.forEach((d,u)=>{if(a(d))return void h.push(d);let{id:p,fi:f,...g}=d??{};if(typeof g.type!="string"||!ZS.is(g.type))return;let m=Xi.defaultDataFor(g.type,g.category),v={...m,...g};for(let[y,_]of Object.entries(g)){let b=m[y];v[y]=Array.isArray(_)&&Array.isArray(b)&&Array.isArray(b[0])?_.map(x=>s(x,b[0])):s(_,b)}h.push({id:typeof p=="string"&&p?p:`layer${u+1}`,fi:typeof f=="number"?f:u,data:v})}),{...l,layers:h}},r.defaultTwoLayerData=o,r.defaultColorMaterial=function(l,c,h="layer1",d="layer2"){let u=new Nt;return u.push({fi:0,data:Xi.defaultData("light",c),id:h}),u.push({fi:1,data:Xi.defaultColorLayer(l),id:d}),{layers:u}},r.defaultUIObjectMaterial=function(l){let c=Xi.defaultData("texture");l&&Object.assign(c.texture,{image:l});let h=new Nt;return h.push({fi:0,data:c,id:"layer1"}),h.push({fi:1,data:{...Xi.defaultData("transmission"),alpha:1},id:"layer2"}),h.push({fi:2,data:{...Xi.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:h}},r.defaultTwoLayerTextureData=function(l,c="physical",h="layer1",d="layer2"){let u=Xi.defaultData("texture");Object.assign(u.texture,{image:l});let p=new Nt;return p.push({fi:0,data:u,id:h}),p.push({fi:1,data:Xi.defaultData("light",c),id:d}),{layers:p}},r.defaultTwoLayerVideoTextureData=function(l,c="physical",h="layer1",d="layer2"){let u=Xi.defaultData("video");Object.assign(u.texture,{video:l});let p=new Nt;return p.push({fi:0,data:u,id:h}),p.push({fi:1,data:Xi.defaultData("light",c),id:d}),{layers:p}}})(zi||(zi={}))}),iZ=z(()=>{Ou="Roboto_regular",rk="https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf"}),nZ=z(()=>{iZ()}),fk=z(()=>{var t;Ye(),(t=xp||(xp={})).defaultData=function(){return{points:new Nt,roundness:0,shapeHoles:[],isClosed:!1}},t.scaled=function e(i,n,r){let s=a=>[a[0]*n,a[1]*r];return{...i,points:new Nt(...i.points.map(({id:a,fi:o,data:l})=>({id:a,fi:o,data:{...l,position:s(l.position),controlPrevious:{position:s(l.controlPrevious.position)},controlNext:{position:s(l.controlNext.position)}}}))),shapeHoles:i.shapeHoles.map(a=>e(a,n,r))}}}),mk=z(()=>{Ye(),(yb||(yb={})).defaultData=function(){return{points:new Nt,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}},Lc={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},(KA||(KA={})).merge=function(t,e){let i={...t};return _b.forEach(n=>{Object.assign(i,{[n]:e[n]??t[n]})}),i},E3={shape:Lc,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},_b=["depth","offset","angle","twist","startScale","endScale"]}),T3=z(()=>{var t,e;fk(),mk(),(t=bb||(bb={})).is2DParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="UIGeometry"},t.isParametricMesh=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="BooleanGeometry"||i==="TextGeometry"||i==="InputGeometry"||i==="DecalGeometry"},t.isSwappableGeometry=function(i){return i==="PolygonGeometry"||i==="RectangleGeometry"||i==="StarGeometry"||i==="TriangleGeometry"||i==="EllipseGeometry"||i==="PathGeometry"||i==="VectorGeometry"||i==="ConeGeometry"||i==="CubeGeometry"||i==="CylinderGeometry"||i==="DodecahedronGeometry"||i==="HelixGeometry"||i==="IcosahedronGeometry"||i==="LatheGeometry"||i==="PyramidGeometry"||i==="SphereGeometry"||i==="PlaneGeometry"||i==="BackdropGeometry"||i==="TorusGeometry"||i==="TorusKnotGeometry"||i==="TextGeometry"||i==="SubdivGeometry"||i==="NonParametricGeometry"},(xb||(xb={})).merge=function(i,n){let r={...i};if(Object.assign(r,n),r.type==="PathGeometry"&&"extrusion"in n&&n.extrusion&&(r.extrusion={...i.extrusion},Object.assign(r.extrusion,KA.merge(r.extrusion,n.extrusion))),i.type==="VectorGeometry"&&r.type==="VectorGeometry"){let s=(l,c)=>typeof l=="number"&&typeof c=="number"&&c!==0?l/c:1,a=s(r.width,i.width),o=s(r.height,i.height);(a!==1||o!==1)&&(r.shape=xp.scaled(i.shape,a,o))}return r},(e=Qo||(Qo={})).defaultData=function(i){if(i==="RectangleGeometry")return{width:320,height:320,type:i,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="UIGeometry")return{type:i,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(i==="PathGeometry")return{type:i,width:1,height:1,depth:1,path:yb.defaultData(),extrusion:E3};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:xp.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="DecalGeometry")return{type:i,width:200,height:200,depth:200,offset:1,projection:"all",projectionTargets:[]};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...e.defaultData("TextGeometry"),type:i,editable:!0};if(i==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")},k1=["width","height","depth"]}),gk=z(()=>{hs(),(t=>{function e(i){return i.mode??"linear"}t.defaultData={enabled:!1,useBackgroundColor:!1,color:fn.white,near:.1,far:2e3,mode:"linear",density:.005,heightFalloff:.01,heightBase:0},t.getMode=e,t.getModeIndex=function(i){let n=e(i);return n==="height"?1:n==="both"?2:0},t.getDensity=function(i){return i.density??t.defaultData.density},t.getHeightFalloff=function(i){return i.heightFalloff??t.defaultData.heightFalloff},t.getHeightBase=function(i){return i.heightBase??t.defaultData.heightBase}})(er||(er={}))}),C3=z(()=>{(QS||(QS={})).defaultData={image:null,rotation:0,blur:32,showBackground:!0},(Zl||(Zl={})).defaultData={enabled:!1,mode:"hdri",hdri:QS.defaultData,timeOfDay:10,weather:"partlyCloudy",lighting:!0,lightingIntensity:1,lightingQuality:"full",clouds:!0,windSpeed:2,animateWind:!0,exposure:1,seed:2}}),vk=z(()=>{(()=>{let t={opacity:1,blendFunction:13,enabled:!1};(wb||(wb={})).defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})()}),P3=z(()=>{var t;gk(),C3(),vk(),hs(),(t=wg||(wg={})).defaultData={type:"normal",softShadowQuality:"low"},t.isSoft=function(e){return e!=null&&(e.type===void 0||e.type==="soft")},(JS||(JS={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(t2||(t2={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(e=>{e.defaultData={pipeline:"classic",toneMapping:"aces",exposure:1},e.isUntouched=function(i){return i===void 0||i.pipeline==="classic"&&(i.toneMapping==="none"||i.toneMapping==="aces")&&i.exposure===1}})(e2||(e2={})),(np||(np={})).defaultData={usePhysics:!1,gravity:-10},(i2||(i2={})).defaultData={playCamera:od,gameControlObject:null},(QA||(QA={})).defaultData={backgroundColor:Je.fromHexAndA(nk,1),postprocessing:wb.defaultData,fog:er.defaultData,sky:Zl.defaultData,globalPhysics:np.defaultData,ambient:JS.defaultData,ao:t2.defaultData,shadow:wg.defaultData,publish:i2.defaultData,grading:e2.defaultData}}),rZ=z(()=>{(JA||(JA={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}),Cx=z(()=>{var t,e,i;Ye(),ak(),lk(),hk(),ck(),A3(),dk(),hs(),g0(),T3(),ok(),Dn(),P3(),rZ(),(t=d4||(d4={})).isComponentRelated=function(n){return n==="Component"||n==="Instance"},t.isEmptyOrComponent=function(n){return n==="Empty"||n==="Instance"},(e=Gd||(Gd={})).identity={...GA.identity,shear:xs.zero},e.fromObject=function(n){return{position:n.position,rotation:n.rotation,scale:n.scale,pivot:n.pivot,pivotRotation:n.pivotRotation,shear:n.shear}},e.merge=function(n,r){return{position:r?.position||n.position,rotation:r?.rotation||n.rotation,pivot:r?.pivot||n.pivot,pivotRotation:r?.pivotRotation||n.pivotRotation,scale:r?.scale||n.scale,shear:r?.shear||n.shear}},e.diff=function(n,r){return UN({position:yh.isEqual(n.position,r.position)?void 0:r.position,rotation:yh.isEqual(n.rotation,r.rotation)?void 0:r.rotation,scale:yh.isEqual(n.scale,r.scale)?null:r.scale,shear:r.shear?.every((s,a)=>s===n.shear?.[a])?void 0:r.shear})},sk=["slide","offset"],(Tn||(Tn={})).defaultData={states:new Nt,events:new Nt,visible:!0,raycastLock:!1,physics:ip.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...Gd.identity,cloner:null},(Sb||(Sb={})).defaultData={type:"Empty",...Tn.defaultData},(u4||(u4={})).defaultData={type:"ParticleCollider",...JA.defaultData,...Tn.defaultData},(p4||(p4={})).defaultData={type:"Component",...Tn.defaultData},(f4||(f4={})).defaultData={type:"Particle",...Tn.defaultData,...fb.defaultData},(m4||(m4={})).defaultData={type:"Hair",...Tn.defaultData,...YA.defaultData},(Xa||(Xa={})).defaultData={type:"Mesh",...Tn.defaultData,...ZA.defaultData},(Sg||(Sg={})).defaultData={...Tn.defaultData,...Gd.identity,position:sl.DefaultPosition,rotation:sl.DefaultRotation,...sl.defaultData},(n=>{n.defaultData=function(r){return{...Tn.defaultData,...$A.defaultData(r)}},n.defaultDirectionalLightData={...n.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(Mb||(Mb={})),(n=>{function r(s,a,o=0){for(;o<a.length;){let l=s?s[a[o]]:void 0;if(a.length===o+1)return l;if(!l)return;s=l.descendants,o+=1}}n.resolveWithDes=r,n.resolve=function(s,a,o=0){let l=r(s,a,o);if(l){let c=Object.keys(l);if(c.length===1&&c[0]==="descendants")return}return l}})(Eb||(Eb={})),(n=>{function r(s,a){return{...Tn.defaultData,...a,component:s,overrides:new Zi,physics:void 0,events:void 0,type:"Instance"}}n.rootOverrideProps=["physics","events"],n.compositeNonOptionalOverrideProps=["geometry"],n.compositeEntireOverrideOverrideProps=["material"],n.ofComponent=r,n.fromComponentData=function(s){let a=Gd.fromObject(s.data);return r(s.id,a)}})(al||(al={})),(n=>{n.defaultData={type:"Page",...Tn.defaultData,physics:{...ip.defaultData,fusedBody:!1},...QA.defaultData,camera:Sg.defaultData,timelines:new te},n.isUIPage=function(r){return r.uiScene!==void 0}})(qc||(qc={})),(i=g4||(g4={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],shear:xs.zero,name:"Play Camera",visible:!0,raycastLock:!1,physics:ip.defaultData,states:new Nt,events:new Nt,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...sl.defaultData},i.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","shear"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side","shadowCatcher"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},i.defaultMeshObject={name:"Rectangle",...Tn.defaultData,...Xa.defaultData,geometry:Qo.defaultData("RectangleGeometry"),material:zi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultBooleanObject={name:"Boolean",...Tn.defaultData,...Xa.defaultData,geometry:Qo.defaultData("BooleanGeometry"),material:zi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultShapeBlendObject={name:"Shape Blend",...Tn.defaultData,...Xa.defaultData,geometry:Qo.defaultData("ShapeBlendGeometry"),material:zi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultTextObject={name:"Text",...Tn.defaultData,...Xa.defaultData,geometry:Qo.defaultData("TextGeometry"),material:zi.defaultTwoLayerData("physical","layer1","layer2")},i.defaultInputObject={name:"Input",...Tn.defaultData,...Xa.defaultData,geometry:Qo.defaultData("InputGeometry"),material:zi.defaultTwoLayerData("physical","layer1","layer2")},(n=>{n.newEmpty=function(r,s){let a={name:s};return r.type==="Mesh"?(a.geometry={},"material"in r&&(a.material={layers:new Zi}),"materials"in r&&(a.materials=r.materials.map(o=>({layers:new Zi})))):Jc.is(r.type)&&(a.perspective={},a.orthographic={}),a},n.toOps=function(r,s){let a,o=[],l={orthographic:0,perspective:0,geometry:0};function c(h,d){for(let[u,p]of Object.entries(d.layers)){let{texture:f,...g}=p;if(f!==void 0&&Object.keys(f).length>0){let m={path:[...h,"layers",u,"texture"],props:f,type:0};o.push(m)}if(Object.keys(g).length>0){let m={path:[...h,"layers",u],props:g,type:0};o.push(m)}}}for(let[h,d]of Object.entries(s)){let u=d;if(h!=="name")if(h==="cloner")o.push(...WA.toOps(u,["cloner"]));else if(h==="pathSnapping")o.push({path:[h],props:{slide:u.slide,offset:u.offset},type:0});else if(h==="material")c(["material"],u);else if(h==="materials")for(let[p,f]of Object.entries(u))c(["materials",p],f);else if(l[h]===0){if(h==="geometry"&&u.extrusion!==void 0){let p={path:[h,"extrusion"],props:u.extrusion,type:0};o.push(p),u={...u},delete u.extrusion}if(Object.keys(u).length>0){let p={path:[h],props:u,type:0};o.push(p)}}else a===void 0&&(a={path:[],props:{},type:0},o.push(a)),a.props[h]=u}return o},n.patch=function(r,s){if(s===void 0)return r;let a={...r};if(Object.assign(a,Gd.merge(a,s)),Object.assign(a,{pathSnapping:Object.assign({},a.pathSnapping,{slide:s.pathSnapping?.slide??a.pathSnapping?.slide??0,offset:s.pathSnapping?.offset??a.pathSnapping?.offset??0})}),Jc.is(r.type)){a.orthographic={...a.orthographic},a.perspective={...a.perspective};let o=s;o.orthographic?.zoom!==void 0&&(a.orthographic.zoom=o.orthographic.zoom),o.perspective?.zoom!==void 0&&(a.perspective.zoom=o.perspective.zoom),o.isUpVectorFlipped!==void 0&&(a.isUpVectorFlipped=o.isUpVectorFlipped),o.targetOffset!==void 0&&(a.targetOffset=o.targetOffset)}else if(r.type==="Mesh")"geometry"in s&&Object.assign(a,{geometry:xb.merge(a.geometry,s.geometry)}),(s.material||s.materials)&&(a=function(o,l){if(l===void 0)return o;let c={...o};return"material"in c&&"material"in l&&l.material&&(c.material=rb(c.material,h=>{if(typeof h!="string")for(let[d,u]of Object.entries(l.material.layers)){let p=h.layers.data(d);p&&Xi.patch(p,u)}}).data),c.materials&&l.materials&&(c.materials=rb(c.materials,h=>{for(let d=0;d<c.materials.length;d++){let u=l.materials[d];if(typeof u!="string")for(let[p,f]of Object.entries(u.layers)){let g=h[d]?.layers?.data(p);g&&Xi.patch(g,f)}}}).data),c}(a,s)),a.cloner&&"cloner"in s&&Object.assign(a,{cloner:sh.merge(a.cloner,s.cloner)});else if(r.type==="Empty")a.cloner&&"cloner"in s&&Object.assign(a,{cloner:sh.merge(a.cloner,s.cloner)});else if(XA.is(r.type)){let o=s;o.intensity!==void 0&&(a.intensity=o.intensity),o.color!==void 0&&(typeof o.color=="string"?a.color=o.color:a.color=fn.clone(o.color))}return a}})(ah||(ah={}))}),D3=z(()=>{(Ab||(Ab={})).defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0}}),Px=z(()=>{D3(),hs(),(ol||(ol={})).defaultData={orbitControls:Ab.defaultData,playPage:ep,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,e)=>{let i=0,n=0;return e<5?n=-30:e<10&&(n=30),e===0||e===10||e===5?i=30:(e===4||e===11||e===9)&&(i=-30),[120,[i,n],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1,renderer:"webgpu",asyncShaderCompilation:!0}}),yk=z(()=>{var t;(n2||(n2={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(r2||(r2={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(t=Bc||(Bc={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...n2.defaultData},isRandomSeed:!0,seed:t.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:r2.defaultData}),t.generateSeed=()=>Math.round(1e5*Math.random())}),R3=z(()=>{Cx(),Ye(),Px(),hs(),Dn(),yk(),(t=>{function e(i,n){let r=i.scene.objects.get(n);if(r&&r.data.type==="Component")return r;{let s=i.shared.lib.components[n];if(s)return{...s.asset,id:n}}}t.physicsEnabled=function(i){return i.find(n=>n.data.type==="Page"&&n.data.globalPhysics.usePhysics)!==void 0},t.findTimeline=function(i,n){let r=i.find(s=>s.data.type==="Page"&&s.data.timelines?.[n]!==void 0);return r&&r.data.timelines?.[n]},t.getComponentData=e,t.traverseModuleInstances=function(i,n,r){i.scene.objects.traverseFrom(n,(s,a)=>{if(a.type==="Instance"){let o=e(i,a.component)?.data;o&&r(s,a,o.events)}else r(s,a,a.events)})}})(td||(td={})),(t=>{function e(n=!0,r=[]){let s=[];n&&s.push({...t.defaultLight}),s.push(...r);let a=new qn;return a.push({fi:1,id:ep,data:{...qc.defaultData,name:"Scene 1"},children:s}),a}function i(n){return{...t.defaultData,objects:Ar(n,qn.prototype)}}t.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",t.defaultLight={fi:-1,data:Mb.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},t.createDefaultObjectTreeWithPage=e,t.defaultData={objects:e(),publish:ol.defaultData,styles:Bc.defaultData()},t.emptyDataWithoutPage=function(){return{objects:new qn,publish:ol.defaultData,styles:Bc.defaultData()}},t.emptyDataWithPage=function(n=!0){return{objects:e(n),publish:ol.defaultData,styles:Bc.defaultData()}},t.emptyData=function(){return{objects:new qn,publish:{...ol.defaultData},styles:Bc.defaultData()}},t.withObjs=i,t.withObj=function(n,r){return i([{id:n,data:r,children:[],fi:0}])}})(Uc||(Uc={}))}),_k=z(()=>{(Mg||(Mg={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}),O3=z(()=>{var t,e;Ye(),Dn(),(t=tT||(tT={})).defaultData=i=>({url:i,name:"New Webhook",parametersSchemas:new Nt}),t.defaultParameterValueByType=i=>i==="number"?0:i!=="boolean"&&"",(v4||(v4={})).defaultData=(i,n="GET")=>({url:i,method:n,name:"New API",headers:new Nt,queries:new Nt,autoStart:!0}),(i=>{function n(s){return s.textValue!==void 0}function r(s){return typeof s=="boolean"}i.isTextValue=n,i.isNumber=function(s){return typeof s=="number"},i.isBoolean=r,i.typeOfVariable=function(s){return n(s)?"string":r(s)?"boolean":"number"},i.getDisplayedValue=function(s){return i.isTextValue(s)?Array.isArray(s.textValue)?s.textValue.map(a=>a.toString().padStart(s.padding??2,"0")).join(s.deliminator??":")+(s.suffix!==void 0?" "+s.suffix:""):s.textValue.toString():i.isBoolean(s)?s?"True":"False":i.isNumber(s)?parseFloat(s.toFixed(3)).toString():s.toString()}})(_r||(_r={})),(s2||(s2={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(y4||(y4={})).all=[...s2.all,"components"],(_4||(_4={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(Jo||(Jo={})).defaultData=function(){return{images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,materials:new te,components:new te,variables:new te,userAPIs:new te,userWebhooks:new te}},(e=Vs||(Vs={})).defaultColors=function(){return Ar({"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}},te.prototype)},e.defaultImages=function(){return Ar({},te.prototype)},e.emptyData=function(){return{catelogs:new te,materials:new te,images:new te,videos:new te,colors:new te,audios:new te,particles:new te,fonts:new te,variables:new Nt,userAPIs:new te,userWebhooks:new te,lib:Jo.defaultData()}},e.defaultVariables=function(i){switch(i){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":{let n=[0,0,0];return{name:"Time",value:{textValue:n,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:n,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1}}case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",i)}},e.getFormattedTimerTime=function(i,n){if(n.format==="HH:mm:ss"){let r=Math.floor(i/3600),s=Math.floor((i-3600*r)/60);return{textValue:[r,s,Math.round(i-3600*r-60*s)]}}if(n.format==="mm:ss"){let r=Math.floor(i/60);return{textValue:[r,Math.round(i-60*r)]}}return n.format==="number"?Math.round(i):Math.round(1e3*i)/1e3}}),sZ=z(()=>{}),bk=z(()=>{var t;Ye(),R3(),_k(),O3(),(t=rp||(rp={})).defaultData={schema:135,scene:Uc.defaultData,frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Mg.defaultData),shared:{...Vs.emptyData(),colors:Vs.defaultColors()}},t.createDefaultData=function(){return Jg.deserialize(Jg.serialize(t.defaultData))},t.emptyDataForImports=function(){return{schema:135,scene:Uc.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Mg.defaultData),shared:{...Vs.emptyData(),colors:Vs.defaultColors(),images:Vs.defaultImages()}}},t.emptyData=function(){return{schema:135,scene:Uc.emptyDataWithPage(),frames:new te().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Mg.defaultData),shared:Vs.emptyData()}},t.clipboard2dData=function(){return{schema:135,scene:Uc.emptyData(),frames:new te,shared:Vs.emptyData()}},t.withoutLib=function(e){return{...e,shared:{...e.shared,lib:Jo.defaultData()}}},t.getComponentData=function(e,i){return td.getComponentData(e,i)},t.hasSensitiveData=function(e){let i=Object.values(e.shared.userAPIs);for(let n of i){let r=n.headers;for(let s of r)if(s.data.key.toLowerCase()==="authorization"&&s.data.value!=="")return!0}return!1}});function dl(t,e=[0,0]){return[t&&!isNaN(t[0])?t[0]:e[0],t&&!isNaN(t[1])?t[1]:e[1]]}function Hf(t,e,i){switch(t){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:{let{control1:n,control2:r}=e??{...bp.defaultData};return`cubicBezier( ${n[0]}, ${n[1]}, ${r[0]}, ${r[1]} )`}case 6:{let{mass:n,stiffness:r,damping:s,velocity:a}=i??{...rh.defaultData},o=new xk(n,r,s,a),l=o.solve(1);return()=>c=>o.solve(c)/l}case 8:return()=>n=>Math.floor(n)}}function aZ(t){let e=function(n){return n.layers?.find(({data:r})=>r.type==="light")}(t);if(!e)return;let i=e.data.alphaOverride;return typeof i=="number"?i:1}function oZ(t,e,i){return i>0?t*e/i:t}var b4,x4,_h,e0,xk,Tb,Cb,I3=z(()=>{Ye(),hs(),(b4||(b4={})).defaultData=function(t,e){return{id:t,name:e,duration:5,objectTimelines:new te}},(x4||(x4={})).is=function(t){return t&&typeof t.x=="number"&&typeof t.y=="number"&&typeof t.z=="number"},(t=>{function e(h,d){let u=[0,0],p=[1,1];if(h?.cubicControls)u=dl(h.cubicControls.control1,u);else switch(h?.type){case 2:case 4:u=[.42,0];break;case 3:case 0:u=[0,0];break;case 1:u=[.25,.1];break;case 7:u=[.25,1]}if(d?.cubicControls)p=dl(d.cubicControls.control2,p);else switch(d?.type){case 2:case 0:p=[1,1];break;case 3:case 4:p=[.58,1];break;case 1:p=[.25,1];break;case 7:p=[.5,1]}return{control1:u,control2:p}}function i(h){if(!t.BEZIER_PRESETS.includes(h))return;let d={type:h};return{control1:e(d).control1,control2:e(void 0,d).control2}}function n(h,d){return Math.abs(h[0]-d[0])<.001&&Math.abs(h[1]-d[1])<.001}function r(h){let d=t.ROOT_PROPERTY_ORDER.indexOf(h[0]);return d===-1?t.ROOT_PROPERTY_ORDER.length:d}function s(h){return h.layerId??h.path.join(".")}function a(h){let d=h[h.length-1];return e0.includes(d)?d:void 0}function o(h){return h.layerId?h.layerId:(a(h.path)?h.path.slice(0,-1):h.path).join(".")}function l(h){return["material",h.type==="light"?`${h.category} lighting`:h.type]}function c(h,d,u){return{id:h,data:{id:h,time:u?.time??0,path:d,value:{},layerId:u?.layerId,index:u?.index,isPlaceholder:!0,easing:{type:5,cubicControls:{control1:[.42,0],control2:[.58,1]}}}}}t.getControlsWithDefault=e,t.BEZIER_PRESETS=[0,1,2,3,4,7],t.presetHandles=i,t.presetForHandles=function(h){return t.BEZIER_PRESETS.find(d=>{let u=i(d);return u!==void 0&&n(u.control1,h.control1)&&n(u.control2,h.control2)})},t.defaultData=function(h){return{id:h,keyframes:new Nt}},t.ROOT_PROPERTY_ORDER=["position","rotation","scale","shape size","material","opacity","camera","light","cloner","path extrusion","path snapping"],t.rowOrder=r,t.propertyKey=s,t.groupKeyframes=function(h,d){let u=new Map;for(let p of h){let f=p.data;if(d?.(f))continue;let g=s(f),m=u.get(g);m||(m={id:g,path:f.path,keyframes:[],layerId:f.layerId,index:f.index},u.set(g,m)),f.isPlaceholder?m.placeholder=p.id:m.keyframes.push(p)}return[...u.values()].sort((p,f)=>{let g=r(p.path)-r(f.path);return g!==0?g:(p.index??0)-(f.index??0)})},t.rowAxis=a,t.drawnRowKey=o,t.drawnRows=function(h){let d=new Map;for(let u of h){let p=a(u.path),f=p?u.path.slice(0,-1):u.path,g=o(u),m=d.get(g);m||(m={id:g,path:f,layerId:u.layerId,index:u.index,tracks:[]},d.set(g,m)),m.tracks.push({axis:p,property:u})}return[...d.values()]},t.sortedKeyframes=function(h){return[...h].sort((d,u)=>d.data.time-u.data.time)},t.materialLayerPath=l,t.createMaterialGroup=function(h,d){return h.map(({data:u,id:p},f)=>c(d(),l(u),{layerId:p,index:f}))},t.placeholderKeyframe=c,t.createName=function(h){return Object.entries(h).reduce((d,[u,p])=>(typeof p!="string"&&d.push({name:p.name}),d),[])},t.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Hf(3),duration:1e3},opacity:{value:[0,1],easing:Hf(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Hf(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Hf(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:Hf(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(_h||(_h={})),e0=["x","y","z"],xk=class{constructor(t=1,e=100,i=10,n=0){this.mass=t,this.stiffness=e,this.damping=i,this.initialVelocity=n,this.m_w0=Math.sqrt(e/t),this.m_zeta=i/(2*Math.sqrt(e*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0-n)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-n+this.m_w0)}solve(t){return 1-(this.m_zeta<1?Math.exp(-t*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*t)+this.m_B*Math.sin(this.m_wd*t)):(this.m_A+this.m_B*t)*Math.exp(-t*this.m_w0))}getDuration(){let t=.16666666666666666,e=0,i=0;for(;;)if(e+=t,this.solve(e)===1){if(i++,i>=16)break}else i=0;return e*t*1e3}}}),L3=z(()=>{var t;hs(),Ye(),(Tb||(Tb={})).list=["idle","move","jump","run"],(t=Cb||(Cb={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},t.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","\u25B2"],["rotPosY","\u25C0"],["rotNegX","\u25BC"],["rotNegY","\u25B6"],["jump","Space"],["run","\u21E7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:t.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new Nt,move:new Nt,jump:new Nt,run:new Nt},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Je.fromHexAndA(3728051,1)}}});function Tc(t,...e){let i={};for(let n of e.flat())t!=null&&n in t&&(i[n]=t[n]);return i}function w4(t){t.layers.forEach(e=>{if(e.type==="depth"&&e.colorA!==void 0){let i=e.colorA,n=e.colorB,r=[[i.r,i.g,i.b,i.a],[n.r,n.g,n.b,n.a]],s=[0,1];for(let o=2;o<10;o++)r.push(r[1]),s.push(1);let a={...Tc(en(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:s,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,a)}else if(e.type==="depth"&&e.gradientType===1&&(e.near<0||e.far<0)){let i={...en(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,i)}})}function qo(t,e){Object.values(t.shared.materials).forEach(i=>e(i))}function Xo(t,e){t.scene.objects.traverse((i,n)=>{"materials"in n?n.materials.forEach((r,s)=>{r===void 0&&(n.materials[s]=zi.defaultTwoLayerData("phong"),r=n.materials[s]),typeof r!="string"&&e(r)}):"material"in n?typeof n.material!="string"&&(n.material===void 0&&(n.material=zi.defaultTwoLayerData("phong")),e(n.material)):n.type==="Mesh"&&(n.material===void 0&&(n.material=zi.defaultTwoLayerData("phong")),e(n.material)),"overrides"in n&&Object.values(n.overrides).forEach(r=>{r.material&&typeof r.material!="string"&&Object.getPrototypeOf(r.material)!==Zi.prototype&&e(r.material)})})}function S4(t){t.layers===void 0&&Object.assign(t,zi.defaultTwoLayerData("lambert"))}function a2(t){!t.layers||t.layers.forEach(e=>{if(e.type==="depth"&&e.colors.length===10){let i=[...e.colors];i.push(e.colors[9]);let n=[...e.steps];n.push(e.steps[9]);let r={...en(e),colors:i,steps:n};Object.assign(e,r)}})}function M4(t){t.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach(n=>{typeof n!="string"&&a2(n)}):"material"in i&&typeof i.material!="string"&&a2(i.material)}),Object.values(t.shared.materials).forEach(e=>a2(e))}function E4(t){t.layers&&t.layers.forEach(e=>{e.type==="depth"&&e.num!==void 0&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function A4(t){t.layers&&t.layers.forEach(e=>{(function(i){return i.type!=="displace"})(e)&&e.isMask===void 0&&(e.isMask=!1),(e.type==="texture"||e.type==="video")&&e.blending===void 0&&(e.blending=0),(e.type==="noise"||e.type==="displace"&&e.displacementType==="noise")&&(e.voronoiStyle===void 0&&(e.voronoiStyle=0),e.highCut===void 0&&(e.highCut=1),e.lowCut===void 0&&(e.lowCut=0),e.smoothness===void 0&&(e.smoothness=.3),e.seed===void 0&&(e.seed=0),e.quality===void 0&&(e.quality=1))})}function T4(t){let e=t.layers.find(i=>i.type==="light")?.data;if(e?.category==="basic"){let i=Xi.defaultData("light","phong"),n=e;Object.assign(n,i),n.visible=!1}}function C4(t){qo(t,T4),Xo(t,T4)}function P4(t){t.layers.forEach(e=>{e.type==="light"&&e.category!=="toon"&&e.occlusion===void 0&&(e.occlusion=!0)})}function D4(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.bumpMapIntensity===void 0&&(e.bumpMapIntensity=5)})}var lZ=z(()=>{g0(),hs(),D3(),Cx(),Ye(),Px(),Dn(),J(),T3(),L3(),yk(),R3(),A3(),P3()});function wk(t){let e=t.elements;da.set(e[0],e[1],e[2]),ua.set(e[4],e[5],e[6]),Za.set(e[8],e[9],e[10])}function Sk(){let t=Math.max(da.lengthSq(),ua.lengthSq(),Za.lengthSq());da.lengthSq()>qm*t?ys.copy(da).normalize():ys.set(1,0,0),_s.crossVectors(Za,ys),_s.lengthSq()<=qm*t&&(_s.copy(ua).addScaledVector(ys,-ua.dot(ys)),_s.lengthSq()<=qm*t&&function(e,i){e.set(1,0,0).cross(i),e.lengthSq()<=qm&&e.set(0,1,0).cross(i),e.normalize()}(_s,ys)),_s.normalize(),zc.crossVectors(ys,_s)}function Mk(t,e,i){return wk(t),Sk(),e.makeBasis(ys,_s,zc),i.set(ys.dot(da),ys.dot(ua),ys.dot(Za),0,_s.dot(da),_s.dot(ua),_s.dot(Za),0,zc.dot(da),zc.dot(ua),zc.dot(Za),0,0,0,0,1),function(){let n=da.length(),r=ua.length(),s=Za.length(),a=Math.max(n,r,s);if(a-n>Xm||a-r>Xm||a-s>Xm)return!0;let o=Xm*a*a;return Math.abs(da.dot(ua))>o||Math.abs(da.dot(Za))>o||Math.abs(ua.dot(Za))>o}()}function Ek(t){return wk(t),Sk(),Ak.makeBasis(ys,_s,zc)}var da,ua,Za,ys,_s,zc,Ak,qm,Xm,Dx=z(()=>{J(),da=new T,ua=new T,Za=new T,ys=new T,_s=new T,zc=new T,Ak=new Et,qm=1e-12,Xm=.01});function Hd(t,e){return e===0?0:t/e}function B3(t){Mk(t,iT,eT),Gu.setFromRotationMatrix(iT);let e=function(n,r,s){let a=2*Math.PI,o=d=>d-a*Math.round(d/a),l=o(n+Math.PI),c=o(Math.PI-r),h=o(s+Math.PI);return Math.abs(l)+Math.abs(h)<Math.abs(n)+Math.abs(s)-1e-9?[l,c,h]:[n,r,s]}(Gu.x,Gu.y,Gu.z),i=eT.elements;return{position:[t.elements[12],t.elements[13],t.elements[14]],rotation:[e[0]*Pt.RAD2DEG,e[1]*Pt.RAD2DEG,e[2]*Pt.RAD2DEG],scale:[i[0],i[5],i[10]],shear:[Hd(i[4],i[5]),Hd(i[8],i[10]),Hd(i[1],i[0]),Hd(i[9],i[10]),Hd(i[2],i[0]),Hd(i[6],i[5])]}}function ll(t,{translation:e,quaternion:i,scale:n,shearMatrix:r}={}){let s=B3(t);if(e!==void 0&&e.fromArray(s.position),i!==void 0){let a=s.rotation;i.setFromEuler(Gu.set(a[0]*Pt.DEG2RAD,a[1]*Pt.DEG2RAD,a[2]*Pt.DEG2RAD))}n!==void 0&&n.fromArray(s.scale),r!==void 0&&r.fromArray(xs.toMatrix(s.shear))}var eT,iT,Gu,v0=z(()=>{J(),Dx(),s6(),eT=new Et,iT=new Et,Gu=new ci});function Tk(t){return t.length>=4&&function(e){return typeof e=="object"&&e!==null&&e.v===1&&e.data instanceof Float32Array&&Array.isArray(e.tracks)}(t[3])}function Ck(t,e,i){let n={name:e,duration:i.duration,tracks:[],uuid:t};return i.blendMode!==void 0&&(n.blendMode=i.blendMode),JSON.stringify(n)}function hZ(t,e,i){for(let n=0;n<i.length;n++)if(!Object.is(t[e+n],i[n]))return!1;return!0}function cZ(t){if(!Array.isArray(t)||t.length>3)return t;let e,[i,n,r]=t;if(typeof i!="string"||typeof r!="string")return t;try{e=JSON.parse(r)}catch{return t}return e&&Array.isArray(e.tracks)&&!e.tracks.some(s=>!s?.type||!s.times||!s.values)?function(s,a,o){let l=[],c=0,h=m=>{let v=[c,m.length];return l.push(m),c+=m.length,v},d=new Map,u=o.tracks.map(m=>{let v=(b=>{let x=Float32Array.from(b),w=x.length+":"+x[0]+":"+x[x.length-1],S=d.get(w)??[];for(let A of S)if(hZ(A.run,0,x))return A.span;let E=h(x);return S.push({span:E,run:x}),d.set(w,S),E})(m.times),y=!Pk.has(m.type),_={name:m.name,type:m.type,times:v,values:y?h(Float32Array.from(m.values)):[0,0]};return y||(_.list=Array.from(m.values)),m.interpolation!==void 0&&(_.interpolation=m.interpolation),_}),p=new Float32Array(c),f=0;for(let m of l)p.set(m,f),f+=m.length;let g={v:1,duration:o.duration,data:p,tracks:u};return o.blendMode!==void 0&&(g.blendMode=o.blendMode),o.userData!==void 0&&o.userData!=="{}"&&(g.userData=o.userData),[s,a,Ck(s,a,g),g]}(i,typeof e.name=="string"?e.name:n,e):t}function dZ(t,e,i){return t.map(n=>{let r=e();return i[n[0]]=r,function(s,a){let[o,l,c]=s;if(Tk(s))return[a,l,Ck(a,l,s[3]),s[3]];let h=c.indexOf(o);return[a,l,h!==-1?c.slice(0,h)+a+c.slice(h+o.length):c,...s.slice(3)]}(n,r)})}var Pk,Dk=z(()=>{Pk=new Set(["bool","string"])});function Uv(t,[e,i]){return Math.min(Math.max(t,e),i)}function Rk(t,e,i,n,r){t=Uv(t,Uk),e=Uv(e,zk),i=Uv(i,Fk),n=Uv(n,Nk);let s=Math.sqrt(e/t),a=i/(2*Math.sqrt(e*t)),o=a<1?s*Math.sqrt(1-a*a):0,l=a<1?(a*s-n)/o:-n+s;return c=>{let h=r!==void 0?r*c:c;return h=a<1?Math.exp(-h*a*s)*(1*Math.cos(o*h)+l*Math.sin(o*h)):(1+l*h)*Math.exp(-h*s),c===0||c===1?c:1-h}}function Ok(t,e){return ve(ve(1-ve(3*e))+ve(3*t))}function Ik(t,e){return ve(ve(3*e)-ve(6*t))}function Lk(t){return ve(3*t)}function zv(t,e,i){return ve(ve(ve(ve(ve(Ok(e,i)*t)+Ik(e,i))*t)+Lk(e))*t)}function R4(t,e,i){let n=ve(ve(ve(3*Ok(e,i))*t)*t),r=ve(ve(2*Ik(e,i))*t);return ve(ve(n+r)+Lk(e))}function Wd(t,e,i,n){if(t=ve(t),e=ve(e),i=ve(i),n=ve(n),t<0||t>1||i<0||i>1||t===e&&i===n)return Hk;let r=new Float32Array(V1);for(let s=0;s<V1;s++)r[s]=zv(ve(s*$m),t,i);return s=>(s=ve(s))===0||s===1?s:zv((a=>{let o=0,l=1,c=V1-1;for(;l!==c&&r[l]<=a;)o=ve(o+$m),l+=1;l-=1;let h=ve(ve(a-r[l])/ve(r[l+1]-r[l])),d=ve(o+ve(h*$m)),u=R4(d,t,i);return u>=Vk?function(p,f,g,m){for(let v=0;v<kk;v++){let y=R4(f,g,m);if(y===0)return f;let _=ve(zv(f,g,m)-p);f=ve(f-ve(_/y))}return f}(a,d,t,i):u===0?d:function(p,f,g,m,v){let y,_=0,b=0;do _=ve(f+ve(ve(g-f)/2)),y=ve(zv(_,m,v)-p),y>0?g=_:f=_,b+=1;while(Math.abs(y)>jk&&b<Gk);return _}(a,o,ve(o+$m),t,i)})(s),e,n)}function Bk(t,e,i){switch(t.easing){case 0:default:return i;case 1:return Wd(.25,.1,.25,1)(i);case 2:return Wd(.42,0,1,1)(i);case 3:return Wd(0,0,.58,1)(i);case 4:return Wd(.42,0,.58,1)(i);case 7:return Wd(.25,1,.5,1)(i);case 8:return Math.floor(i);case 5:{let{control1:n,control2:r}=t;return n&&r?Wd(n[0],n[1],r[0],r[1])(i):i}case 6:{let{mass:n,stiffness:r,damping:s,velocity:a}=t;return n===void 0||r===void 0||s===void 0||a===void 0?i:ve(Rk(n,r,s,a,e)(i))}}}var ve,Uk,zk,Fk,Nk,kk,Vk,jk,Gk,V1,$m,Hk,O4,uZ=z(()=>{ve=Math.fround,Uk=[.01,100],zk=[.01,1e4],Fk=[.01,1e3],Nk=[.01,1e3],kk=4,Vk=ve(.001),jk=ve(1e-7),Gk=10,$m=ve(1/((V1=11)-1)),Hk=t=>t,O4=ve(1.70158),ve(O4+1)});function Wk(t,e){if(t.length===0)throw new Error("sampleKeyframes requires at least one keyframe");if(e<=t[0].time)return{index0:0,index1:0,t:1};let{found:i,index:n}=function(c,h){let d=c.length,u=0,p=d;for(;u<p;){let f=u+Math.floor(d/2),g=c[f].time;if(g<h)u=f+1;else{if(!(g>h))return{found:!0,index:f};p=f}d=p-u}return{found:!1,index:u}}(t,e);if(i)return{index0:n,index1:n,t:1};if(n>=t.length){let c=t.length-1;return{index0:c,index1:c,t:1}}let r=n-1,s=n,a=t[r].time,o=t[s].time;if(o===a)return{index0:r,index1:s,t:.5};let l=j1(o-a);return{index0:r,index1:s,t:Bk({...t[r].ease,control2:t[s].ease.control2},l,j1(j1(e-a)/l))}}function qk(t){return[...t].sort((e,i)=>e.time-i.time)}var j1,pZ=z(()=>{uZ(),j1=Math.fround});function fZ(t){if(t?.length!==2)return;let e=`${t[0]}.${t[1]}`;return U3.includes(e)?e:void 0}function Xk(t){return t.slice(0,t.indexOf("."))}function $k(t){return bh.indexOf(t.slice(-1))}function mZ(t){return{easing:t?.type,control1:dl(t?.cubicControls?.control1,[0,0]),control2:dl(t?.cubicControls?.control2,[1,1]),...t?.springParameters}}function gZ(t){let e=t?.cubicControls;return{...t,cubicControls:{control1:[...e?.control1??[0,0]],control2:[...e?.control2??[1,1]]},...t?.springParameters?{springParameters:{...t.springParameters}}:{}}}function I4(t,e,i){let n=Xk(t);if(n==="position"){let r=$k(t);return bh.flatMap((s,a)=>Math.abs(e.elements[4*a+r])>1e-9?[`position.${s}`]:[])}return(i?[n]:["rotation","scale"]).flatMap(r=>bh.map(s=>`${r}.${s}`))}function vZ(t,e){let[i,n,r]=t,s=[[i,n,r],[i+180,180-n,r+180]],a=[i,n,r],o=1/0;for(let l of s){let c=l.map((d,u)=>d+360*Math.round((e[u]-d)/360)),h=c.reduce((d,u,p)=>d+Math.abs(u-e[p]),0);h<o-1e-9&&(a=c,o=h)}return a}function yZ(t,e,i){if(t==="rotation"){let n=((e-i)%360+540)%360-180;return Math.abs(n)<1e-6}return Math.abs(e-i)<1e-9*Math.max(1,Math.abs(e),Math.abs(i))}function _Z(t,e,i,n){let r=new Map;for(let{id:p,data:f}of t.unproxy()){if(f.isPlaceholder)continue;let g=fZ(f.path);if(!g){if(Ym.includes(f.path?.[0]))return;continue}if(typeof f.value!="number"||!Number.isFinite(f.value))return;let m=r.get(g)??{keys:[],sampled:[]};m.keys.push({id:p,time:f.time,value:f.value,keyframe:f}),r.set(g,m)}if(r.size===0)return;for(let p of r.values())p.keys.sort((f,g)=>f.time-g.time),p.sampled=qk(p.keys.map(f=>({time:f.time,ease:mZ(f.keyframe.easing),value:f.value})));let s=(p,f)=>{let g=r.get(p);return g?function(m,v){let{index0:y,index1:_,t:b}=Wk(m.sampled,v),x=m.sampled[y].value;return x+(m.sampled[_].value-x)*b}(g,f):i[Xk(p)][$k(p)]},a=new qt,o=new ci,l=new Et,c=new T,h=new T,d=p=>{let f=(g=>{let m={};for(let v of Ym)m[v]=bh.map((y,_)=>s(U3[3*Ym.indexOf(v)+_],g));return m})(p);return o.set(f.rotation[0]*Pt.DEG2RAD,f.rotation[1]*Pt.DEG2RAD,f.rotation[2]*Pt.DEG2RAD),l.compose(c.fromArray(f.position),a.setFromEuler(o),h.fromArray(f.scale)).premultiply(e),{pose:f,out:B3(l)}},u=function(p){let f=p.elements,g=[0,4,8].map(y=>new T(f[y],f[y+1],f[y+2])),m=g[0].lengthSq(),v=1e-9*Math.max(1,m);return Math.abs(g[1].lengthSq()-m)<v&&Math.abs(g[2].lengthSq()-m)<v&&Math.abs(g[0].dot(g[1]))<v&&Math.abs(g[0].dot(g[2]))<v&&Math.abs(g[1].dot(g[2]))<v}(e);for(let p of Ym){let f,g=bh.map(_=>`${p}.${_}`),m=_=>{let b=new Set;for(let x of I4(_,e,u))for(let w of r.get(x)?.keys??[])b.add(w.time);return[...b].sort((x,w)=>x-w)},v=[...new Set(g.flatMap(_=>m(_)))].sort((_,b)=>_-b),y=new Map;for(let _ of v){let{pose:b,out:x}=d(_),w=[...x[p]];p==="rotation"&&(w=vZ(w,f?f.out.map((S,E)=>S+b.rotation[E]-f.in[E]):b.rotation),f={in:b.rotation,out:w}),y.set(_,w)}g.forEach((_,b)=>{let x=r.get(_)?.keys??[],w=m(_),S=new Set(w);if(x.length!==0||!w.every(E=>yZ(p,y.get(E)[b],n[p][b]))){for(let E of x)S.has(E.time)||t.delete(E.id);for(let E of w){let A=y.get(E)[b],P=x.find(O=>O.time===E);if(P){let O=t.data(P.id);O&&(O.value=A);continue}let C=I4(_,e,u).sort((O,D)=>Number(D===_)-Number(O===_)).map(O=>r.get(O)?.keys.find(D=>D.time===E)).find(O=>O!==void 0),R=Pt.generateUUID();t.insertBefore(null,[{id:R,data:{id:R,time:E,path:[p,bh[b]],value:A,easing:gZ(C.keyframe.easing),index:_h.rowOrder([p])}}])}}})}}var Ym,bh,U3,bZ=z(()=>{J(),I3(),pZ(),v0(),bh=["x","y","z"],U3=(Ym=["position","rotation","scale"]).flatMap(t=>bh.map(e=>`${t}.${e}`))}),Yk={};function L4(t){t.layers&&t.layers.forEach(e=>{e.type==="light"&&e.alphaOverride===void 0&&(e.alphaOverride=1)})}function Zk(t){let e=t.geometry;e!==void 0&&i6.has(e.type)&&e.extrusionVersion===void 0&&(e.extrusionVersion=1)}function Kk(t){if(t.type!=="Empty")return;let e=en(t.animations);if(!Array.isArray(e))return;let i=e.map(cZ);i.some((n,r)=>n!==e[r])&&(t.animations=i)}function B4(t,e){let[i,n,r]=t,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r),d=[o*c,s*h+a*c*l,a*h-s*c*l],u=Math.hypot(e[0],e[1],e[2])||1;return Math.abs((d[0]*e[0]+d[1]*e[1]+d[2]*e[2])/u)}function Qk(t){(function(i){i.rotation=i.rotation.slice(0,3).map(n=>n*Hl)})(t),t.type==="Page"&&function(i){let n=i.rotation.slice(0,3);(function(r,s){let a=Array.isArray(s)&&s.length>=3&&s.every(c=>typeof c=="number"&&Number.isFinite(c))?s:[0,1,0],o=B4(r,a),l=B4(r.map(c=>c*n6),a);return Math.abs(o-l)<1e-6?r.some(c=>Math.abs(c)>Math.PI):l<o})(n,i.up)?i.rotation=n:i.rotation=n.map(r=>r*Hl)}(t.camera),t.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(n=>n*Hl))});let e=t.geometry;e&&e.type==="SphereGeometry"&&(e.thetaLength=(e.thetaLength??180)*Hl),e&&e.type==="TorusGeometry"&&(e.arc=e.arc*Hl),e&&e.type==="PathGeometry"&&(e.extrusion.angle*=Hl,e.extrusion.twist*=Hl),t.type==="Mesh"&&t.geometry.type==="TextGeometry"&&(t.geometry.text={textValue:t.geometry.text}),Array.isArray(en(t.events))&&t.events?.forEach(i=>{(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress"||i.type==="KeyDown"||i.type==="KeyUp"||i.type==="KeyPress"||i.type==="Collision"||i.type==="Trigger")&&(i.runMode=i.toggle?"Toggle":"Repeat")})}function xZ(t){t.scene.objects.traverse((e,i)=>{})}function wZ(t){let e=t.schema??104;e!==135&&(e<130&&(z3(t.asset),t.schema=130),e<135&&(F3(t.asset),t.schema=135))}function qa(t,e){e(t.data);for(let i of t.children)qa(i,e)}function Jk(t){let e=t.schema??104;e!==135&&(e<105&&(qa(t.asset,Qk),t.schema=105),e<118&&(qa(t.asset,t6),t.schema=118),e<121&&(qa(t.asset,sT),t.schema=121),e<130&&(qa(t.asset,i=>U4(i,z3)),t.schema=130),e<132&&(qa(t.asset,Zk),t.schema=132),e<133&&(qa(t.asset,i=>e6(i,()=>{})),t.schema=133),e<134&&(qa(t.asset,Kk),t.schema=134),e<135&&(qa(t.asset,i=>U4(i,F3)),t.schema=135))}function nT(t,e){Xo(t,e),qo(t,e),Object.values(t.shared.lib.materials).forEach(i=>e(i.asset))}function z3(t){t.layers===void 0&&Object.assign(t,zi.defaultTwoLayerData("phong"))}function F3(t){let e=Gm(t),i=zi.withRepairedLayers(e);i!==e&&(t.layers=i.layers)}function U4(t,e){"materials"in t?t.materials.forEach(i=>{i!==void 0&&typeof i!="string"&&e(i)}):"material"in t&&t.material!==void 0&&typeof t.material!="string"&&e(t.material)}function t6(t){t.timelineAnimations=Ar({},te.prototype)}function SZ(t){let e=[];return t?(t.forEach((i,n)=>{let{path:r,keyframes:s}=i.data,a=r[0]==="material"?i.id:void 0;s?.length?s.forEach(({id:o,data:l})=>{e.push({id:o,data:{...l,path:r,layerId:a,index:n}})}):e.push(_h.placeholderKeyframe(i.id,r,{layerId:a,index:n}))}),e.sort((i,n)=>i.data.time-n.data.time),new Nt(...e.map((i,n)=>({...i,fi:n})))):new Nt}function MZ(t){for(let{id:e,data:i}of[...t.unproxy()]){let n=i.path?.[0];if(!n||!r6.includes(n))continue;let r=rT(i.value);if(!r.length)continue;let s=t.data(e);if(!s)continue;let a=i.value,[o,...l]=r;for(let c of l){let h=Pt.generateUUID();t.insertBefore(null,[{id:h,data:{...i,id:h,path:[n,c],value:a[c],easing:EZ(i.easing)}}])}s.path=[n,o],s.value=a[o]}}function rT(t){return t===null||typeof t!="object"?[]:e0.filter(e=>e in t)}function EZ(t){let e=t?.cubicControls;return{...t,cubicControls:{control1:[...e?.control1??[0,0]],control2:[...e?.control2??[1,1]]},...t?.springParameters?{springParameters:{...t.springParameters}}:{}}}function AZ(t,e){return Math.abs(t[0]-e[0])<1e-6&&Math.abs(t[1]-e[1])<1e-6}function TZ(t){let e=function(s){let a=[];for(let o of _h.groupKeyframes(s)){let l=new Set(o.keyframes.flatMap(h=>rT(h.data.value))),c=l.size?[...l].map(h=>o.keyframes.filter(d=>rT(d.data.value).includes(h))):[o.keyframes];for(let h of c){let d=[...h].sort((u,p)=>u.data.time-p.data.time);for(let u=0;u+1<d.length;u++)a.push({left:d[u],right:d[u+1]})}}return a}([...t.unproxy()]),i=new Map,n=new Set;for(let{left:s,right:a}of e){let o=s.data.easing?.type,l=(o===void 0?void 0:_h.presetHandles(o))?.control2??(o===5?dl(a.data.easing?.cubicControls?.control2,[1,1]):void 0);if(!l)continue;let c=i.get(a.id);c?AZ(c,l)||n.add(a.id):i.set(a.id,l)}let r=new Map;for(let{id:s,data:a}of t.unproxy()){let o=a.easing?.type,l=o===void 0?void 0:_h.presetHandles(o);l&&r.set(s,l.control1)}for(let{left:s,right:a}of e)n.has(a.id)&&r.delete(s.id);for(let[s,a]of r){let o=t.data(s);!o?.easing||(o.easing.cubicControls={control1:a,control2:dl(o.easing.cubicControls?.control2,[1,1])},o.easing.type=5)}for(let{left:s,right:a}of e){if(!r.has(s.id))continue;let o=t.data(a.id),l=i.get(a.id);!o?.easing||!l||(o.easing.cubicControls={control1:dl(o.easing.cubicControls?.control1,[0,0]),control2:l})}}function z4(t,e){t.scene.objects.traverse((i,n)=>{let r=n;if(r.type==="Page"&&r.timelines)for(let s of Object.values(r.timelines))for(let a of Object.values(s.objectTimelines??{}))e(a.keyframes)})}function sT(t){t.pivot=[0,0,0],t.pivotRotation=[0,0,0]}function e6(t,e,i=[]){let n=["position","rotation","scale","shear"];function r(u,p,f){return u?.map(g=>typeof g=="string"?e(g)??f:g)??[...p]}function s(u,p){if(u&&!function(f){return f.every((g,m)=>Math.abs(g-(m%5==0?1:0))<1e-6)}(u))return B3(new Et().fromArray(u).multiply(new Et().compose(new T().fromArray(p.position),new qt().setFromEuler(new ci(p.rotation[0]*Pt.DEG2RAD,p.rotation[1]*Pt.DEG2RAD,p.rotation[2]*Pt.DEG2RAD)),new T().fromArray(p.scale))))}function a(u,p){return u.length===p.length&&u.every((f,g)=>f===p[g])}t.shear=xs.zero;let o=t,l=o.hiddenMatrix;l!==void 0&&delete o.hiddenMatrix;let c={position:r(o.position,[0,0,0],0),rotation:r(o.rotation,[0,0,0],0),scale:r(o.scale,[1,1,1],1)},h=s(l,c);if(h&&Object.assign(o,h),h){let u=new Et().fromArray(l);for(let p of i)_Z(p,u,c,h)}let d=h??{...c,shear:[...xs.zero]};o.states?.forEach(u=>{let p=u.hiddenMatrix;if(p!==void 0&&delete u.hiddenMatrix,p===void 0&&u.position==null&&u.rotation==null&&u.scale==null)return;let f={position:r(u.position,c.position,0),rotation:r(u.rotation,c.rotation,0),scale:r(u.scale,c.scale,1)},g=s(p??l,f);if(!h&&!g)return;let m=g??{...f,shear:[...xs.zero]};for(let v of n)(u[v]!=null||!a(m[v],d[v]))&&(u[v]=m[v])})}function CZ(t){}function PZ(t){let e=t.schema??0;if(e!==135){if(e>135)return void console.error(`This scene was created with a newer version of Spline (file format ${e}, this runtime reads 135). Update @splinetool/runtime to the latest version to load it correctly.`);console.warn("updating from ",e,"to ",135),function(i,n){if(n<1&&(Xo(i,w4),qo(i,w4),i.schema=1),n<2&&(function(r){Object.assign(r.scene.publish,{orbitControls:{...Ab.defaultData,...en(r.scene.publish.orbitControls)}})}(i),i.schema=2),n<3&&(function(r){function s(a){if(a.layers){for(let o of Object.values(a.layers))if(o){for(let[l,c]of Object.entries(o))if((Tx.includes(l)||typeof c=="boolean")&&delete o[l],l==="texture")for(let[h,d]of Object.entries(c))(M3.includes(h)||typeof d=="boolean")&&delete c[h]}}}r.scene.objects.traverse((a,o)=>{o.states.forEach(l=>{let c=l;c.material?s(c.material):c.materials&&c.materials.forEach(h=>{s(h)})})})}(i),i.schema=3),n<4&&(function(r){r.scene.publish.withBackground=!0}(i),i.schema=4),n<5&&(function(r){r.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(i),i.schema=5),n<6&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.cloner;o&&(o.radial.scale=o.radial.scale.map(l=>l+1),o.linear.scale=o.linear.scale.map(l=>l+1))})}(i),i.schema=6),n<7&&(function(r){r.scene.objects.traverse((s,a)=>{let o=a.geometry;o&&(o.type==="DodecahedronGeometry"||o.type==="IcosahedronGeometry")&&(o.detail=Math.round(o.detail))})}(i),i.schema=7),n<8&&(i.schema=8),n<9&&(M4(i),i.schema=9),n<10&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&(a.geometry.type==="BooleanGeometry"||a.geometry.type==="SubdivGeometry")&&(a.geometry.phongAngle=35)})}(i),i.schema=10),n<11&&(function(r){r.scene.environment.ambientLight.softShadows=!1,r.scene.environment.ambientLight.softShadowQuality="low",r.scene.objects.traverse((s,a)=>{(a.type==="DirectionalLight"||a.type==="SpotLight")&&(a.shadowResolution=1024,a.shadowRadius=1,a.depth=1e5)}),r.shared.penumbraSize=new Array(5).fill(.5)}(i),i.schema=11),n<12&&(M4(i),i.schema=12),n<13&&(function(r){r.shared.audios=Ar({},te.prototype)}(i),i.schema=13),n<14&&(function(r){let s=r.shared.materials;Object.entries(s).forEach(([a,o])=>{if(!o.layers){let l={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(s,{[a]:l})}})}(i),i.schema=14),n<15&&(function(r){Object.entries(en(r.shared.images)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.images[s]}),Object.entries(en(r.shared.audios)).filter(s=>s[1].asset===!1).map(s=>s[0]).forEach(s=>{delete r.shared.audios[s]})}(i),i.schema=15),n<16&&(function(r){r.scene.publish.settings.web.preload=!1}(i),i.schema=16),n<17&&(Xo(i,E4),qo(i,E4),i.schema=17),n<18&&(Xo(i,S4),qo(i,S4),i.schema=18),n<19&&(function(r){Object.assign(r.scene.publish.settings,{video:{...ol.defaultData.settings.video,...en(r.scene.publish.settings.video)}})}(i),i.schema=19),n<20&&(function(r){r.shared.fonts=Ar({},te.prototype)}(i),function(r){let s=[];r.scene.objects.traverse((a,o)=>{let l=o;if(l.type==="TextFrame"){let c=zi.defaultTwoLayerData("phong"),h=typeof l.color=="string"?r.shared.colors[l.color]:l.color;c.layers[1].data.color={r:h.r,g:h.g,b:h.b},c.layers[1].data.alpha=l.alpha;let d=function(f){return f.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(g=>g.charAt(0).toUpperCase()+g.slice(1)).join(" ")}(l.font);r.shared.fonts[d]===void 0&&(r.shared.fonts[d]={name:d});let u={name:l.name,...Tn.defaultData,...Xa.defaultData,flatShading:!1,wireframe:!1,geometry:{...Qo.defaultData("TextGeometry"),width:l.width,height:l.height,font:d,depth:0,horizontalAlign:l.horizontalAlign,verticalAlign:l.verticalAlign,fontSize:1.40625*l.fontSize,lineHeight:l.lineHeight/1.40625,letterSpacing:l.letterSpacing-1,text:l.text,textTransform:l.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:c,states:en(l.states),events:en(l.events),visible:l.visible,raycastLock:l.raycastLock,position:l.position,rotation:l.rotation,scale:l.scale,hiddenMatrix:l.hiddenMatrix},p=en(r.scene.objects).parent(a);r.scene.objects.insertAfter(p??null,a,[{id:a+"new",data:u,children:[]}]),s.push(a)}}),s.forEach(a=>{r.scene.objects.delete(a)})}(i),i.schema=20),n<21&&(function(r){let s={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};r.scene.objects.traverse((a,o)=>{o.events.forEach(l=>{if(s[Number(l.type)])if(Object.assign(l,{type:s[Number(l.type)]}),l.type==="Audio"&&"audioEvent"in l&&(Object.assign(l,{playAudio:l.audioEvent}),delete l.audioEvent),l.type==="GameControl")Object.assign(l,{gameActions:{idle:new Nt,move:new Nt,jump:new Nt}});else{let c=new Nt;Object.assign(l,{actions:c}),(l.type==="MouseDown"||l.type==="MouseUp"||l.type==="KeyDown"||l.type==="KeyUp")&&"url"in l&&c.push({fi:0,id:Pt.generateUUID(),data:{type:"Link",url:l.url,delay:0}}),"targets"in l&&(l.targets.forEach((h,d,u)=>{let p={easing:h.easing,duration:h.duration};h.easing===6?Object.assign(p,Tc(h,"mass","stiffness","damping","velocity")):h.easing===5&&Object.assign(p,{control1:{...h.control1},control2:{...h.control2}});let f={repeat:h.repeat?-1:0,delay:h.delay,delayDirection:h.delayDirection,direction:h.cycle&&h.rewind?"pingpong-rewind":h.cycle?"pingpong":"normal"},g={state:h.state,...f,...p},m={allowSlerp:!0,type:"Transition",object:h.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Nt({fi:0,id:Pt.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:Pt.generateUUID(),data:g})};c.push({fi:u,id:d,data:m})}),delete l.targets)}})})}(i),function(r){r.scene.objects.traverse((s,a)=>{function o(l,c){let h=new Nt,d=[];if(a.events.forEach((u,p,f)=>{if(u.type==="Audio"&&u.trigger===c){let g;d.push(p),u.interaction==="play"?g={...Tc(u,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in u?u.after:void 0,toggle:"after"in u?u.toggle:void 0,type:"Audio"}:(u.interaction==="pause"||u.interaction==="stop")&&(g={...Tc(u,"interaction","delay","object","playAudio"),type:"Audio"}),g&&h.push({fi:f,id:p,data:g})}}),d.forEach(u=>a.events.delete(u)),h.length){let u=a.events.find(p=>p.type===l)?.data;u?"actions"in u&&u.actions.insertBefore(null,h):a.events.insertBefore(null,[{id:Pt.generateUUID(),data:{type:l,actions:h}}])}}o("Start","start"),o("MouseDown","mouseDown"),o("MouseUp","mouseUp"),o("KeyDown","keyDown"),o("KeyUp","keyUp")})}(i),i.schema=21),n<22&&(C4(i),i.schema=22),n<23&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="SubdivGeometry"&&(a.geometry.scaleBaked||(a.geometry.scaleBaked=[1,1,1]))})}(i),i.schema=23),n<24&&(function(r){r.scene.objects.traverse((s,a)=>{(a.type==="Empty"||a.type==="Mesh")&&a.cloner&&!a.cloner.randomnessObject&&!a.cloner.toObject&&!a.cloner.randomness&&(a.cloner={...a.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}(i),i.schema=24),(n<25||i.shared.videos===void 0)&&(function(r){r.shared.videos=Ar({},te.prototype)}(i),n<25&&(i.schema=25)),n<26&&(function(r){r.scene.objects.traverse((s,a)=>{let o=r.scene.objects.unproxy().parent(s);if(o){let l=en(r.scene.objects.data(o));l&&l.type==="Mesh"&&l.geometry.type==="BooleanGeometry"&&a.type==="Mesh"&&(a.visible=en(a).booleanExclude!==!0)}})}(i),i.schema=26),n<27&&(function(r){r.scene.objects.traverse((s,a)=>{if(a.type==="Mesh"){let o=a;a.geometry.type==="NonParametricGeometry"?o.material!==void 0&&delete o.material:o.materials!==void 0&&delete o.materials}})}(i),i.schema=27),n<28&&(C4(i),i.schema=28),n<29&&(function(r){function s(o){Object.setPrototypeOf(o,Zi.prototype),o.texture&&Object.setPrototypeOf(o.texture,Zi.prototype)}function a(o){Object.setPrototypeOf(o,Zi.prototype);for(let l in o)s(o[l])}r.scene.objects.traverse((o,l)=>{l.states.forEach(c=>{let h=c;if(h.material){let d=en(h.material).layers;a(d),h.material.layers=d}if(h.materials)for(let d=0;d<h.materials.length;d++){let u=h.materials[d],p=en(u).layers;a(p),u.layers=p}})})}(i),i.schema=29),n<30&&(function(r){r.scene.objects.traverse((s,a)=>{a.type==="Mesh"&&a.geometry.type==="NonParametricGeometry"&&!("material"in a)&&!("materials"in a)&&(a.material=zi.defaultTwoLayerData("phong"))})}(i),i.schema=30),n<31&&(function(r){r.scene.publish.orbitControls.autoZoom===void 0&&(r.scene.publish.orbitControls.autoZoom=!1),r.scene.objects.traverse((s,a)=>{(a.type==="OrthographicCamera"||a.type==="PerspectiveCamera")&&(a.orthographic.autoZoom===void 0&&(a.orthographic.autoZoom=!1),a.orthographic.autoZoomFrustumSize===void 0&&(a.orthographic.autoZoomFrustumSize=790))})}(i),i.schema=31),n<33&&(function(r){r.scene.objects.traverse((s,a)=>{a.pathSnapping===void 0&&(a.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),a.pathSnapping.offset===void 0&&(a.pathSnapping.offset=0)})}(i),i.schema=33),n<34&&(function(r){r.scene.publish.mouseEventTarget===void 0&&(r.scene.publish.mouseEventTarget="canvas"),r.scene.publish.settings.web.hint===void 0&&(r.scene.publish.settings.web.hint=!1)}(i),i.schema=34),n<35&&(function(r){let{video:s}=r.scene.publish.settings;s.format==="gif"&&s.fps>48&&(s.fps=15)}(i),i.schema=35),n<36&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.resetYPosition=Math.abs(o.resetYPosition-a.position[1]))})})}(i),i.schema=36),n<37&&(function(r){let s=r.scene.environment.usePhysics;r.scene.objects.traverse((a,o)=>{s&&o.physics===null?o.collision=!1:o.collision="visibility"})}(i),i.schema=37),n<38&&(Xo(i,A4),qo(i,A4),i.schema=38),n<39&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.navmesh=Cb.defaultDataThirdPerson.navmesh)})})}(i),i.schema=39),n<40&&(function(r){r.scene.styles||(r.scene.styles=Bc.defaultData())}(i),i.schema=40),n<41&&(function(r){r.scene.environment.ambientLight.occlusion===void 0&&(r.scene.environment.ambientLight.occlusion=!1),r.scene.environment.ambientLight.aoFullRes===void 0&&(r.scene.environment.ambientLight.aoFullRes=!1),r.scene.environment.ambientLight.radius===void 0&&(r.scene.environment.ambientLight.radius=256),r.scene.environment.ambientLight.bias===void 0&&(r.scene.environment.ambientLight.bias=.5),r.scene.environment.ambientLight.aoColor===void 0&&(r.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Xo(r,P4),qo(r,P4)}(i),i.schema=41),n<42&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&Object.assign(o.gameActions,{run:new Nt})})})}(i),i.schema=42),n<43&&(function(r){r.scene.objects.traverse((s,a)=>{a.events.forEach(o=>{o.type==="GameControl"&&(o.keyAssignments=[...o.keyAssignments,["run","\u21E7"],["none","Ctrl"]])})})}(i),i.schema=43),n<99){Xo(i,D4),qo(i,D4),i.scene.publish.playCamera===null&&(i.scene.publish.playCamera=od);let r=en(i.scene.objects),s=i.scene.objects;i.scene.publish.playPage=ep,s.insertBefore(null,null,[{id:ep,data:{...qc.defaultData,backgroundColor:i.scene.backgroundColor,fog:i.scene.fog,postprocessing:i.scene.postprocessing,ao:Tc(i.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:i.scene.publish.playCamera,gameControlObject:i.scene.publish.gameControlObject},shadow:Tc(i.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...np.defaultData,...Tc(i.scene.environment,"usePhysics","gravity")},camera:en(i.scene.ownerCamera)??qc.defaultData.camera,name:"Scene"},children:[]}]);for(let l of r)l.id!==Uc.TRASH_CAN_ID&&s.move(ep,l.fi,l.id);let a=0,o=0;i.shared.penumbraSize&&i.scene.objects.traverse((l,c)=>{c.type==="DirectionalLight"?(c.penumbraSize=i.shared.penumbraSize[Math.min(a,2)],a+=1):c.type==="SpotLight"&&(c.penumbraSize=i.shared.penumbraSize[3+Math.min(o,1)],o+=1),(c.physics===void 0||c.physics===null)&&c.type!=="Instance"&&(c.physics={},Object.assign(c.physics,ip.defaultData)),c.physics!==void 0&&c.physics!==null&&(c.physics.enabled=c.collision??"visibility",delete c.collision)}),i.schema=99}}(t,e),e<100&&(t.scene.publish.joystickSizeAndXYOffset===void 0&&(t.scene.publish.joystickSizeAndXYOffset=ol.defaultData.joystickSizeAndXYOffset),t.schema=100),e<101&&(Xo(t,L4),qo(t,L4),t.schema=101),e<102&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.geometry;s&&s.type==="PathGeometry"&&(s.extrusion.capType="flat",s.extrusion.bevel=50,s.extrusion.bevelSides=6,s.extrusion.shape.type==="Custom"&&(s.extrusion.shape.shapeQuality="low"))})}(t),t.schema=102),e<104&&(t.shared.catelogs=new te,t.shared.lib=Jo.defaultData(),t.schema=104),e<105&&(function(i){i.shared.variables=Ar({},te.prototype)}(t),t.scene.objects.traverse((i,n)=>{Qk(n)}),t.schema=105);for(let i of Object.values(t.shared.lib.components))Jk(i);if(e<106&&(function(i){let n=en(i.shared.variables);i.shared.variables=Ar(Object.entries(n??{}).map(([r,s],a)=>({fi:a,id:r,data:s})),Nt.prototype)}(t),t.schema=106),e<107&&(t.shared.lib.variables=Jo.defaultData().variables,t.schema=107),e<109&&(function(i){i.shared.particles=Ar({},te.prototype),i.shared.lib&&(i.shared.lib.particles=Jo.defaultData().particles)}(t),t.schema=109),e<110&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Particle"&&typeof r.renderMaterial.size=="number"&&Object.assign(r.renderMaterial,{size:[r.renderMaterial.size,r.renderMaterial.size]})})}(t),t.schema=110),e<111&&(t.scene.objects.traverse((i,n)=>{(function(r){Array.isArray(en(r.events))&&r.events?.forEach(s=>{"disabled"in s||(s.disabled=!1),(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress")&&(s.mode=s.mode||"Object")})})(n)}),t.schema=111),e<112&&(function(i){i.scene.objects.traverse((n,r)=>{r.type==="Page"&&(r.postprocessing.depthOfField.focusDistance=100,r.postprocessing.depthOfField.focalLength=20,r.postprocessing.depthOfField.bokehScale=5)})}(t),t.schema=112),e<113&&(function(i){i.scene.objects.traverse((n,r)=>{Array.isArray(en(r.events))!==!1&&r.events?.forEach(s=>{let a=s.runMode;s.type==="MouseDown"||s.type==="MouseUp"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="Collision"||s.type==="Trigger"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode=a??"Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode=a==="Toggle"?"Toggle":"Normal")}):s.type==="MouseHover"||s.type==="MousePress"||s.type==="KeyPress"?s.actions?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}):s.type==="GameControl"?(delete s.actions,Object.keys(s.gameActions).forEach(o=>{s.gameActions[o]?.forEach(l=>{l.type==="Transition"&&(l.runMode="Repeat"),l.type==="Animation"&&"runMode"in l&&(l.runMode="Normal")})})):s.type==="DragDrop"?(delete s.actions,s.dragDropActions?.drag?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")}),s.dragDropActions?.drop?.forEach(o=>{(o.type==="Transition"||o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Toggle")})):s.type==="Resize"?(delete s.actions,s.breakpoints?.forEach(o=>{o.actions?.forEach(l=>{(l.type==="Transition"||l.type==="Animation"&&"runMode"in l||l.type==="SwitchCamera")&&(l.runMode="Toggle")})})):s.type==="Start"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Once"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="VariableChange"||s.type==="Scroll"?s.actions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}):s.type==="Conditional"&&(delete s.actions,s.inActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}),s.outActions?.forEach(o=>{o.type==="Transition"&&(o.runMode="Repeat"),(o.type==="Animation"&&"runMode"in o||o.type==="SwitchCamera")&&(o.runMode="Normal")}))})})}(t),t.schema=113),e<114&&(t.scene.publish.settings.web.imageQuality===void 0&&(t.scene.publish.settings.web.imageQuality=70),t.schema=114),e<115&&(function(i){i.shared.userAPIs=Ar({},te.prototype),i.shared.userWebhooks=Ar({},te.prototype),i.shared.lib&&(i.shared.lib.userAPIs=Jo.defaultData().userAPIs,i.shared.lib.userWebhooks=Jo.defaultData().userWebhooks)}(t),t.schema=115),e<116&&(function(i){i.scene.publish.settings.videoStatic===void 0&&(i.scene.publish.settings.videoStatic=ol.defaultData.settings.videoStatic)}(t),t.schema=116),e<117&&(t.scene.publish.settings.web.pixelRatioMobile===void 0&&(t.scene.publish.settings.web.pixelRatioMobile=0),t.scene.publish.settings.web.pixelRatioDesktop===void 0&&(t.scene.publish.settings.web.pixelRatioDesktop=0),t.schema=117),e<118&&(t.shared.timelineAnimations=Ar({},te.prototype),t.scene.objects.traverse((i,n)=>{t6(n)}),t.schema=118),e<119&&(t.scene.publish.settings.videoStatic.format=rp.defaultData.scene.publish.settings.videoStatic.format,t.scene.publish.settings.videoStatic.imageFormat=rp.defaultData.scene.publish.settings.videoStatic.imageFormat,t.schema=119),e<120&&(t.scene.publish.settings.image.colorSpace="display-p3",t.scene.publish.settings.videoStatic.colorSpace="display-p3",t.schema=120),e<121&&(t.scene.objects.traverse((i,n)=>{sT(n),n.type==="Page"&&n.camera!==void 0&&sT(n.camera)}),t.schema=121),e<122&&(delete t.scene.publish.settings.video,t.scene.publish.orbitControls.rotationSpeed=rp.defaultData.scene.publish.orbitControls.rotationSpeed,t.schema=122),e<123&&(t.scene.objects.traverse((i,n)=>{n.type==="Page"&&n.sky===void 0&&(n.sky=Zl.defaultData)}),t.schema=123),e<124&&(e>=123&&t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(typeof r.exposure=="number"&&(r.exposure=Math.round(r.exposure/5e-4*1e4)/1e4),r.lighting===void 0&&(r.lighting=Zl.defaultData.lighting))}),t.schema=124),e<125&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingIntensity===void 0&&(r.lightingIntensity=Zl.defaultData.lightingIntensity)}),t.schema=125),e<126&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&(r.mode===void 0&&(r.mode="physical"),r.hdri===void 0?r.hdri={...Zl.defaultData.hdri}:(r.hdri.blur===void 0&&(r.hdri.blur=Zl.defaultData.hdri.blur),Array.isArray(r.hdri.rotation)&&(r.hdri.rotation=r.hdri.rotation[1]??0)))}),t.schema=126),e<127&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r?.hdri!==void 0&&r.hdri.showBackground===void 0&&(r.hdri.showBackground=!0)}),t.schema=127),e<128&&(t.scene.objects.traverse((i,n)=>{let r=n.sky;n.type==="Page"&&r!==void 0&&r.lightingQuality===void 0&&(r.lightingQuality="full")}),t.schema=128),e<129&&(t.scene.objects.traverse((i,n)=>{if(n.type==="Page"){n.camera===void 0&&(n.camera=qc.defaultData.camera);let r=n.camera;r.far=1e5,r.perspective?r.perspective.near=70:r.perspective={near:70,fov:45,zoom:1}}}),t.schema=129),e<130&&(nT(t,z3),t.schema=130),e<131&&(function(i){i.scene.objects.traverse((n,r)=>{let s=r.states;if(!s)return;let a=r.timelineAnimations,o=[];s.forEach((l,c)=>{(l.isAnimation||a?.[c])&&o.push(c)}),o.forEach(l=>s.delete(l))})}(t),function(i){let n=i.shared,r=n.timelineAnimations;if(!r)return;let s=i.scene.objects,a=s.unproxy().find(o=>o.data.type==="Page")?.id;for(let[o,l]of Object.entries(r)){let c=Ar({},te.prototype),h=0,d=Boolean(l.loop);for(let[f,g]of Object.entries(l.mapping??{})){let m=s.data(f)?.timelineAnimations?.[g];!m||(h=Math.max(h,m.to??0),d=d||Boolean(m.loop),c[f]={id:f,keyframes:SZ(m.properties?.unproxy())})}let u=l.page??a,p=u?s.data(u):void 0;p&&p.type==="Page"&&((p.timelines??(p.timelines=Ar({},te.prototype)))[o]={id:o,name:l.name,duration:h||5,...d?{loop:d}:{},objectTimelines:c})}delete n.timelineAnimations,s.traverse((o,l)=>{delete l.timelineAnimations})}(t),z4(t,MZ),z4(t,TZ),t.schema=131),e<132&&(t.scene.objects.traverse((i,n)=>Zk(n)),t.schema=132),e<133){let i=function(r){return s=>r.get(s)?.data?.value}(t.shared.variables),n=new Map;t.scene.objects.traverse((r,s)=>{let a=s;if(a.type==="Page"&&a.timelines)for(let o of Object.values(a.timelines))for(let[l,c]of Object.entries(o.objectTimelines??{})){let h=n.get(l)??[];h.push(c.keyframes),n.set(l,h)}}),t.scene.objects.traverse((r,s)=>e6(s,i,n.get(r))),t.schema=133}e<134&&(t.scene.objects.traverse((i,n)=>Kk(n)),t.schema=134),e<135&&(nT(t,F3),t.schema=135)}}d0(Yk,{updateAllMaterials:()=>nT,updateDocumentSchema:()=>PZ,updateLibSchema:()=>CZ,updateMaterialSchema:()=>wZ,updateObjectStateRec:()=>qa,updateObjectsSchema:()=>Jk,updateTextValues:()=>xZ});var i6,Hl,n6,r6,F4,Fv,o2,N4,Nv,Fc,Wf,qd,kv,l2,G1,h2,c2,k4,H1,d2,Xc,aT,Rx=z(()=>{J(),bk(),Ye(),I3(),lZ(),Px(),g0(),hs(),Dn(),O3(),Cx(),C3(),v0(),Dk(),bZ(),i6=new Set(["RectangleGeometry","EllipseGeometry","StarGeometry","PolygonGeometry","TriangleGeometry","VectorGeometry","TextGeometry","InputGeometry","PathGeometry"]),Hl=180/Math.PI,n6=Math.PI/180,r6=["position","rotation","scale","shape size"]}),DZ=z(()=>{var t,e,i;hs(),Ye(),Dn(),(F4||(F4={})).is=function(n){return!0},(t=Fv||(Fv={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},t.merge=function(n,r){return{position:r?.position??n.position,rotation:r?.rotation??n.rotation,scale:r?.scale??n.scale,shear:r?.shear??n.shear}},t.diff=function(n,r){return UN({position:io.isEqual(n.position,r.position)?void 0:r.position,rotation:n.rotation===r.rotation?void 0:r.rotation,scale:io.isEqual(n.scale,r.scale)?void 0:r.scale,shear:n.shear&&r.shear&&io.isEqual(n.shear,r.shear)?void 0:r.shear})},(o2||(o2={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(N4||(N4={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(Nv||(Nv={})).defaultData={opacity:1,fill:{color:Je.fromHexAndA(Ir,1),enabled:!0},stroke:{color:Je.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Je.from0to1([0,0,0,1]),enabled:!1,spread:0}},(e=Fc||(Fc={})).newEmpty=function(n,r){return{name:r}},e.patch=function(n,r){if(r===void 0)return n;let s={...n};return Object.assign(s,Fv.merge(s,r)),s=function(a,o){if(o===void 0)return a;let l={...a},c=["width","height","cornerRadius"];for(let h of c)h in l&&h in o&&o[h]!==void 0&&Object.assign(l,{[h]:o[h]});return l}(s,r),s=function(a,o){if(o===void 0)return a;let l={...a};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}(s,r),s},e.toOps=function(n,r){let s,a=[];for(let[o,l]of Object.entries(r))o!=="name"&&(s===void 0&&(s={path:[],props:{},type:0},a.push(s)),s.props[o]=l);return a},(Wf||(Wf={})).defaultData={...Fv.defaultData,...o2.defaultData,states:new Nt,events:new Nt,visible:!0,raycastLock:!1},(qd||(qd={})).defaultData={...Wf.defaultData,...Nv.defaultData},(kv||(kv={})).defaultData={cornerRadius:[0,0,0,0]},(l2||(l2={})).defaultData={...qd.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(G1||(G1={})).defaultData={...qd.defaultData,...kv.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(h2||(h2={})).defaultData={...qd.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"},(c2||(c2={})).defaultData={...qd.defaultData,type:"path2d",path:"",name:"Path"},(k4||(k4={})).is=function(n){return n.type==="ellipse2d"||n.type==="rectangle2d"||n.type==="text2d"||n.type==="vector2d"||n.type==="path2d"},(H1||(H1={})).defaultData={...Wf.defaultData,name:"Group",type:"group2d"},(d2||(d2={})).defaultData=()=>({...Wf.defaultData,...kv.defaultData,...Nv.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Je.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Je.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(n=>{n.defaultData=function(r){switch(r){case"rectangle2d":case"vector2d":return{...G1.defaultData};case"ellipse2d":return{...l2.defaultData};case"text2d":return{...h2.defaultData};case"path2d":return{...c2.defaultData};case"frame2d":return{...d2.defaultData()};case"group2d":return{...H1.defaultData}}},n.getPivot=function(r){return"width"in r&&"height"in r?[typeof r.width=="number"?.5*r.width:0,typeof r.height=="number"?.5*r.height:0]:[0,0]},n.isResizeable=function(r){return r.type==="rectangle2d"||r.type==="ellipse2d"||r.type==="text2d"||r.type==="frame2d"},n.isAutoLayoutable=function(r){return r.type==="frame2d"&&r.autoLayout!==void 0},n.hasCorners=function(r){return r.type==="rectangle2d"||r.type==="frame2d"}})(Xc||(Xc={})),(i=aT||(aT={})).defaultData={name:"UI",type:"scene2d",objects:new qn},i.emptyData=function(){return{type:"scene2d",objects:new qn}}}),s6=z(()=>{tZ(),eZ(),ak(),ok(),bk(),ik(),uk(),pk(),gk(),C3(),Rx(),_k(),T3(),A3(),lk(),g0(),dk(),vk(),hs(),Px(),Cx(),Dk(),D3(),mk(),O3(),R3(),nZ(),fk(),L3(),P3(),hk(),ck(),DZ()});function Nc(t,e=!1){let i=t[0].index!==null,n=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},a={},o=t[0].morphTargetsRelative,l=new jt,c=0;for(let h=0;h<t.length;++h){let d=t[h],u=0;if(i!==(d.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in d.attributes){if(!n.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(d.attributes[p]),u++}if(u!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(o!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in d.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(d.morphAttributes[p])}if(e){let p;if(i)p=d.index.count;else{if(d.attributes.position===void 0)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;p=d.attributes.position.count}l.addGroup(c,p,h),c+=p}}if(i){let h=0,d=[];for(let u=0;u<t.length;++u){let p=t[u].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+h);h+=t[u].attributes.position.count}l.setIndex(d)}for(let h in s){let d=V4(s[h]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" attribute."),null;l.setAttribute(h,d)}for(let h in a){let d=a[h][0].length;if(d!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[h]=[];for(let u=0;u<d;++u){let p=[];for(let g=0;g<a[h].length;++g)p.push(a[h][g][u]);let f=V4(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+h+" morphAttribute."),null;l.morphAttributes[h].push(f)}}}return l}function V4(t){let e,i,n,r=-1,s=0;for(let c=0;c<t.length;++c){let h=t[c];if(e===void 0&&(e=h.array.constructor),e!==h.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=h.itemSize),i!==h.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=h.normalized),n!==h.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=h.gpuType),r!==h.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=h.count*i}let a=new e(s),o=new Ht(a,i,n),l=0;for(let c=0;c<t.length;++c){let h=t[c];if(h.isInterleavedBufferAttribute){let d=l/i;for(let u=0,p=h.count;u<p;u++)for(let f=0;f<i;f++){let g=h.getComponent(u,f);o.setComponent(u+d,f,g)}}else a.set(h.array,l);l+=h.count*i}return r!==void 0&&(o.gpuType=r),o}var y0=z(()=>{J()});function a6(t){let e=t.points.length/7,i=new Nt;for(let n=0;n<e;n++){let r=7*n,s=t.points[r+0],a=t.points[r+1],o=t.points[r+2],l=t.points[r+3],c=t.points[r+4],h=t.points[r+5],d=t.points[r+6];i.push({fi:n,id:Pt.generateUUID(),data:{roundness:d,position:[s,a],areControlsDirectionsMirrored:!0,controlPrevious:{position:[o,l]},controlNext:{position:[c,h]}}})}return{points:i,isClosed:t.isClosed,roundness:t.roundness,shapeHoles:t.shapeHoles?.map(n=>a6(n))??[]}}function o6(t){let{userData:e,uuid:i,...n}=t;if(e===void 0||e.type==="NonParametricGeometry")return function(a){let o,{userData:l,data:c}=a,h=c?.groups,d=c?.attributes??{},u=c?.morphAttributes??{},p=c?.interleavedBuffers,f=c?.arrayBuffers,g=c?.index;d.position!==void 0&&Array.isArray(d.position.array)&&(o=function(v){let y=1/0,_=1/0,b=1/0,x=-1/0,w=-1/0,S=-1/0;for(let E=0;E<v.length;E+=3){let A=v[E],P=v[E+1],C=v[E+2];y=Math.min(y,A),_=Math.min(_,P),b=Math.min(b,C),x=Math.max(x,A),w=Math.max(w,P),S=Math.max(S,C)}return{width:x-y,height:w-_,depth:S-b}}(d.position.array));let m={...l===void 0?{}:l.parameters,data:{attributes:d,morphAttributes:u,interleavedBuffers:p,arrayBuffers:f},...o===void 0?{}:o,type:"NonParametricGeometry"};return g!==void 0&&Object.assign(m.data,{index:g}),h!==void 0&&Object.assign(m.data,{groups:h.map(v=>({...v,materialIndex:v.materialIndex??0}))}),m}(t);if(e.type==="SubdivGeometry"){let a="SubdivGeometry",o=n.data?.attributes;if(o?.positionWASM===void 0){let c=new jt;if(o?.position===void 0||o?.faceMap===void 0)return null;let h=o.position.array,d=o.faceMap.array,u=n.data.index.array;c.setAttribute("position",new kt(h,3)),c.setIndex(new mh(u,1));let p=function(v,y=1e-4){y=Math.max(y,Number.EPSILON);let _={},b=v.getIndex(),x=v.getAttribute("position"),w=b?b.count:x.count,S=0,E=Object.keys(v.attributes),A={},P={},C=[],R=["getX","getY","getZ","getW"],O=["setX","setY","setZ","setW"];for(let q=0,rt=E.length;q<rt;q++){let it=E[q],Y=v.attributes[it];A[it]=new Y.constructor(new Y.array.constructor(Y.count*Y.itemSize),Y.itemSize,Y.normalized);let ht=v.morphAttributes[it];ht&&(P[it]||(P[it]=[]),ht.forEach((ot,ft)=>{let pt=new ot.array.constructor(ot.count*ot.itemSize);P[it][ft]=new ot.constructor(pt,ot.itemSize,ot.normalized)}))}let D=.5*y,F=Math.log10(1/y),V=Math.pow(10,F),U=D*V;for(let q=0;q<w;q++){let rt=b?b.getX(q):q,it="";for(let Y=0,ht=E.length;Y<ht;Y++){let ot=E[Y],ft=v.getAttribute(ot),pt=ft.itemSize;for(let tt=0;tt<pt;tt++)it+=~~(ft[R[tt]](rt)*V+U)+","}if(it in _)C.push(_[it]);else{for(let Y=0,ht=E.length;Y<ht;Y++){let ot=E[Y],ft=v.getAttribute(ot),pt=v.morphAttributes[ot],tt=ft.itemSize,mt=A[ot],N=P[ot];for(let L=0;L<tt;L++){let H=R[L],$=O[L];if(mt[$](S,ft[H](rt)),pt)for(let B=0,Z=pt.length;B<Z;B++)N[B][$](S,pt[B][H](rt))}}_[it]=S,C.push(S),S++}}let j=v.clone();for(let q in v.attributes){let rt=A[q];if(j.setAttribute(q,new rt.constructor(rt.array.slice(0,S*rt.itemSize),rt.itemSize,rt.normalized)),q in P)for(let it=0;it<P[q].length;it++){let Y=P[q][it];j.morphAttributes[q][it]=new Y.constructor(Y.array.slice(0,S*Y.itemSize),Y.itemSize,Y.normalized)}}return j.setIndex(C),j}(c),f=[],g=new Array(d[d.length-1]+1).fill(3),m=p.getIndex().array;for(let v=0,y=d.length;v<y;)d[v]===d[v+1]?(g[d[v]]++,f.push(...new Set(m.slice(3*v,3*v+6))),v+=2):(f.push(...m.slice(3*v,3*v+3)),v++);o.indexWASM={array:f},o.positionWASM=p.attributes.position,o.verticesPerFaceWASM={array:g}}if(o?.positionWASM===void 0||o?.positionWASM.length===0||o?.indexWASM===void 0||o?.indexWASM.length===0||o?.verticesPerFaceWASM===void 0||o?.verticesPerFaceWASM.length===0)return null;let l={type:a,...RZ(o.positionWASM.array)};l.subdivisions=e.parameters.subdivisions;for(let c in o)c==="positionWASM"?l[c]=new Float32Array(o[c].array):c==="indexWASM"?l[c]=new Int32Array(o[c].array):c==="verticesPerFaceWASM"&&(l[c]=new Int8Array(o[c].array));return l.scaleBaked=[1,1,1],l}let r=e.type,s=e.parameters;return r==="VectorGeometry"?(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,width:100,height:100,shape:a6(e.shape),type:r}):r==="LatheGeometry"?{...e.parameters,type:r,points:(e?.parameters.points??[]).map(a=>[a.x,a.y])}:(s.extrudeDepth&&(s.depth=s.extrudeDepth),{...s,type:r})}function RZ(t){return oT.setFromArray(t),oT.getSize(Zm),{width:Zm.x,height:Zm.y,depth:Zm.z}}var oT,Zm,u2,OZ=z(()=>{Ye(),J(),y0(),new Et,new qt,new ci,new T,new T,oT=new hi,Zm=new T}),IZ=z(()=>{var t;(t=u2||{}).view="view",t.edit="edit",((u2=t)||(u2={})).canWrite=function(e){return e!=="view"},class extends Error{constructor(e,i){super(`This is a ${e.toUpperCase()} document, but it was opened as a ${i.toUpperCase()} one`),this.actual=e,this.expected=i,this.name="DocumentKindMismatchError"}}}),l6,ul,Eg,h6,c6,Pp,qf,Vv,p2,Dp,j4,f2,G4,m2,wp,Ol,Il,Do,g2,H4,W4,v2,lT,hl,d6=z(()=>{IZ()}),LZ=z(()=>{}),BZ=z(()=>{Ye(),Rx(),d6()}),UZ=z(()=>{g0(),[...Tx],new Set(M3)}),Xt=z(()=>{s6(),LZ(),sZ(),Rx(),BZ(),d6(),I3(),UZ(),L3(),Ye()}),po=z(()=>{l6=[3,4,8,9],ul=5,Eg=3,h6=32,c6=.98}),_0=z(()=>{J(),Pp=t=>{var e;return(e=class extends t{}).geometryHelper=new ya(30,30,30),e}}),b0=z(()=>{J(),qf=new il,Vv=new vr,p2=new Et,Dp=(t,e,i,n,r=!1,s=t)=>{let a=e,o=s.matrixWorld;if(a.boundingSphere===null&&a.computeBoundingSphere(),Vv.copy(a.boundingSphere),Vv.applyMatrix4(o),i.ray.intersectsSphere(Vv)===!1||(p2.copy(o).invert(),qf.copy(i.ray).applyMatrix4(p2),a.boundingBox!==null&&qf.intersectsBox(a.boundingBox)===!1))return;let l,c,h,d,u,p,f=a.index,g=a.attributes.position,m=a.drawRange;if(r===!1){for(u=Math.max(0,m.start),p=Math.min(f.count,m.start+m.count);u<p;u+=3)if(c=f.getX(u),h=f.getX(u+1),d=f.getX(u+2),l=v(t,i,qf,g,c,h,d),l)return l.faceIndex=Math.floor(u/3),void n.push(l)}else{let y=a.attributes.position,_=new T,b=new T,x=new T,w=new T,S=2,E=1/((s.scale.x+s.scale.y+s.scale.z)/3),A=E*E;for(let P=Math.max(0,m.start),C=Math.min(y.count,m.start+m.count)-1;P<C;P+=S){if(_.fromBufferAttribute(y,P),b.fromBufferAttribute(y,P+1),qf.distanceSqToSegment(_,b,w,x)>A)continue;w.applyMatrix4(s.matrixWorld);let R=i.ray.origin.distanceTo(w);R<i.near||R>i.far||n.push({distance:R,point:x.clone().applyMatrix4(s.matrixWorld),object:t})}}function v(y,_,b,x,w,S,E){let A=new T,P=new T,C=new T,R=new T,O=new T;if(A.fromBufferAttribute(x,w),P.fromBufferAttribute(x,S),C.fromBufferAttribute(x,E),b.intersectTriangle(A,P,C,!1,R)===null)return null;O.copy(R),O.applyMatrix4(y.matrixWorld);let D=_.ray.origin.distanceTo(O);return D<_.near||D>_.far?null:{faceIndex:1,distance:D,point:O.clone(),object:y}}}}),Ox=z(()=>{J(),_0(),b0(),j4=new T(1,1,1),f2=new T,G4=new T,m2=new qt,wp=class extends Pp(nN){constructor(t,e=15){super(e),this.object=t,this.dummy=new Tp,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(t,e){Dp(this.object,wp.geometryHelper,t,e,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(t){this.object.matrixWorld.decompose(f2,m2,G4),this.matrix.compose(f2,m2,j4),super.updateMatrixWorld(t)}updateWorldMatrix(t,e){}}}),zZ=z(()=>{J(),Ol=new T,Il=new T,Do=new Et,g2=[new T(-1,1,1),new T(-1,-1,1),new T(1,-1,1),new T(1,1,1),new T(-1,1,-1),new T(-1,-1,-1),new T(1,-1,-1),new T(1,1,-1)],H4=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],W4=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],v2=(t,e,i)=>{t.updateEntityBoxSize(Ol,Il),Do.copy(e).multiply(t.matrixWorld),Il.x===0&&Il.y===0&&Il.z===0?i.push(new T(Ol.x,Ol.y,Ol.z).applyMatrix4(Do)):g2.forEach(n=>{i.push(n.clone().multiply(Il).add(Ol).applyMatrix4(Do))})},lT=class extends hi{constructor(){super(...arguments),this.matrix=new Et,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(e=>e.clone()),this.faces=t.faces.map(e=>e.clone()),this.edges=t.edges.map(e=>e.clone()),this.centerEdges=t.centerEdges.map(e=>e.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new Et().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let n=[];if(i===!0){let r=[];t.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s))return Do.copy(e).multiply(s.matrixWorld),void r.push(new T().applyMatrix4(Do));v2(s,e,n)}}),n.length===0&&n.push(...r)}else v2(t,e,n);return this.setFromPoints(n)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(Do.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Il).multiplyScalar(.5),this.getCenter(Ol),Do.copy(this.matrix).setPosition(Ol),this.vertices=g2.map(t=>t.clone().multiply(Il).applyMatrix4(Do))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=H4.map(([t,e])=>new bs(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new T))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=W4.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}}}),Pb=z(()=>{hl={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}}});function Ag(t){return t?.isParticleSystem===!0}function ed(t){return t?.isHairSystem===!0}function pl(t){return t?.isShapeBlendEntity===!0}function Ix(t){return t?.isPathObject===!0}function ls(t){return t?.isObject2D===!0}function Pr(t){return t?.isUIObject===!0}function oh(t){return t?.isCloner===!0}function lh(t){return t?.isClone===!0}function W1(t){return t?.isComponentObject===!0}var Oi=z(()=>{});function Ei(t){N3.add(t)}function jn(t,e){let i=`${t}:${e}`;dT.has(i)||dT.add(i)}function Db(t,e){k3.set(t,e)}function y2(t){return k3.get(t)}function Rp(t,e){V3.set(t,e)}function _2(t){return V3.get(t)}function hT(t,e){j3.set(t,e)}function u6(t){return j3.get(t)}function cT(){return Lx}var N3,dT,k3,V3,j3,Lx,Rb,ke=z(()=>{N3=new Set,dT=new Set,k3=new Map,V3=new Map,j3=new Map,Lx=null,Rb=null});function p6(t,e,i,n,r=new Et){return r.compose(t,e,f6).multiply(i).scale(n)}var f6,b2,kc,Bx,Op=z(()=>{J(),Dx(),f6=new T(1,1,1),b2=new Et,(kc||(kc={})).is=function(t){return t&&t.__isSPEObject},Bx=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new Et,this.copyPreviousMatrix=!0,this.pivotMatrix=new Et,this.matrixWorldRigid=new Et,this.shearScale=new Et,this.shearScaleInv=new Et,this.shearMatrix=new Et}get __isSPEObject(){return!0}getPhysicsLocalMatrix(e){return!!this.rigidBody?.isDynamic()&&(e.copy(this.matrixWorld),this.hasNonUniformScale&&e.multiply(this.shearScaleInv),this.parent&&e.premultiply(b2.copy(this.parent.matrixWorld).invert()),e.multiply(b2.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(e){e instanceof xi&&(e=e.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===e)return!0;i=i.parent}return!1}updateMatrix(){!this.shearMatrix||(p6(this.position,this.quaternion,this.shearMatrix,this.scale,this.matrix),this.matrixWorldNeedsUpdate=!0)}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(let i of this.children)i.updateMatrixWorld(e)}updateWorldMatrix(e,i){let n=this.parent;if(e&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),i)for(let r of this.children)r.updateWorldMatrix(!1,!0)}traverseChildren(e,i=0){for(let n of this.children)kc.is(n)&&n.traverseObject(e,i+1)}traverseObject(e,i=0){if(e(this,i)!==!0)for(let n of this.children)kc.is(n)&&n.traverseObject(e,i+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=Mk(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(e,i){this.updateWorldMatrix(!0,!1);let n=new Et().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),n.multiply(e.parent.matrixWorld)),e.applyMatrix4(n),e.updateWorldMatrix(!1,!1),this.add(e),i!==void 0&&(this.children.pop(),this.children.splice(i,0,e)),this}copy(e,i=!1){return super.copy(e,i),this}onAfterRender(e,i,n,r,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}}});function q4(t,e,i){return Kl.subVectors(e,t),i0.subVectors(e,i),Kl.cross(i0).length()<=Tg}function m6(t){let e=fT.get(t.points);if(e!==void 0&&e.isClosed===t.isClosed)return e.curve;let i=function(n){let r=n.points,s=[r[0]],a=[new T(...r[0].data.position)];Cc.copy(a[0]);for(let v=0;v<r.length-1;v++)Kl.fromArray(r[v].data.position),i0.fromArray(r[v+1].data.position),Iu.subVectors(Kl,Cc),Lu.subVectors(Kl,i0),Iu.cross(Lu).length()>Tg&&(s.push(r[v]),a.push(new T().copy(Kl)),Cc.copy(Kl));let o=r[r.length-1];s.push(o),a.push(new T(...o.data.position));let l=n.isClosed,c=s.length-(l?0:1),h=s.length,d=[],u=[];for(let v=0;v<h;v++){let y=s[v].data;d.push(new T(...y.controlPrevious.position)),u.push(new T(...y.controlNext.position))}let p=[];for(let v=0;v<c;v++){let y=v===h-1?0:v+1;p.push(q4(a[v],u[v],a[y])&&q4(a[v],d[y],a[y]))}let f=[];for(let v=0;v<h;v++){let y=s[v].data,_=a[v],b={position:_,prevDir:void 0,nextDir:void 0,controlPrevious:d[v],controlNext:u[v],tan:void 0,baseRoundness:y.roundness,removedLength:0};if(f.push(b),y.roundness===0||!l&&(v===0||v===h-1))continue;let x=l&&v==0?h-1:v-1,w=l&&v==h-1?0:v+1,S=new T().subVectors(a[x],_).normalize(),E=new T().subVectors(a[w],_).normalize();b.prevDir=S,b.nextDir=E;let A=p[l&&v===0?h-1:v-1],P=p[v];if(A&&P){Pc.addVectors(S,E).normalize();let C=Cc.crossVectors(Pc,S).length()/S.dot(Pc);b.tan=C,b.removedLength=y.roundness/C}}for(let v=0;v<c;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y];if(_.removedLength!==0||b.removedLength!==0){let x=_.position.distanceTo(b.position);_.removedLength=Math.min(_.removedLength,x/2),b.removedLength=Math.min(b.removedLength,x/2)}}let g=new Array(2*h).fill(null);for(let v=0;v<c;v++){let y=l&&v===h-1?0:v+1,_=f[v],b=f[y],x=null;if(p[v]){let w=_.position.clone(),S=b.position.clone();(_.removedLength!==0||b.removedLength!==0)&&(_.nextDir&&w.add(Cc.copy(_.nextDir).setLength(_.removedLength)),b.prevDir&&S.add(Cc.copy(b.prevDir).setLength(b.removedLength))),w.distanceTo(S)>Tg&&(x=new gg(w,w.clone().lerp(S,.3),S.clone().lerp(w,.3),S))}else _.position.distanceTo(b.position)>Tg&&(x=new gg(_.position,_.controlNext,b.controlPrevious,b.position));g[2*v+1]=x}for(let v=0;v<h;v++){let y=f[v];if(y.removedLength===0)continue;let _=y.position,b=y.prevDir.clone().multiplyScalar(y.removedLength).add(_),x=y.nextDir.clone().multiplyScalar(y.removedLength).add(_),w=y.tan*y.removedLength;Pc.addVectors(y.prevDir,y.nextDir).normalize(),Iu.copy(b).lerp(x,.5);let S=b.distanceTo(x)/2;pT.copy(Pc).multiplyScalar(Math.sqrt(Math.pow(w,2)-Math.pow(S,2))).add(Iu),q1.copy(Pc).multiplyScalar(-w).add(pT);let E=_.distanceTo(q1)/_.distanceTo(Iu);Lu.copy(y.prevDir).multiplyScalar(E*_.distanceTo(b)).add(_),uT.copy(Lu).lerp(q1,2);let A=b.clone().lerp(Lu,4/3),P=x.clone().lerp(uT,4/3);g[2*v]=new gg(b,A,P,x)}let m=new g6;for(let v=0;v<g.length;v++){let y=g[v];y&&m.add(y)}return m}(t);return fT.set(t.points,{isClosed:t.isClosed,curve:i}),i}var g6,Tg,Kl,i0,Cc,Pc,Iu,q1,Lu,uT,pT,fT,Bu,mT,X1,v6,y6,_6,Ie,$a,X4,$4,Xf,x2,jv,w2,S2,Ux,gT,ld,Ka,b6=z(()=>{J(),g6=class extends rA{constructor(){super()}getPoints(t=12){let e,i=[],n=this.getCurveLengths(),r=n[n.length-1]/n.length;for(let s=0,a=this.curves;s<a.length;s++){let o=a[s],l=s===0?n[s]:n[s]-n[s-1],c=Math.ceil(t*l/r),h=o.getPoints(c);for(let d=0;d<h.length;d++){let u=h[d];e&&e.equals(u)||(i.push(u),e=u)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},Tg=.001,Kl=new T,i0=new T,Cc=new T,Pc=new T,Iu=new T,q1=new T,Lu=new T,uT=new T,pT=new T,fT=new WeakMap}),FZ=z(()=>{J(),Bu=new Et,mT=new qt,X1=new qt,v6=new ci,y6=new T,_6=new T(0,1,0)}),Xr=z(()=>{J(),Xt(),zZ(),Ye(),Pb(),Oi(),ke(),Op(),b6(),FZ(),ti(),(Ie||(Ie={})).is=function(t){return t&&t.__isEntity},$a=t=>Ie.is(t),X4={type:"completeState",isfromEntity:!0},$4=["x","y","z"],Xf=new T,x2=new T(1,1,1),jv=new qt,w2=new ci,S2=new Et,Ux=t=>class extends Bx(t){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.transitionState={settled:!0,state:null},this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new lT,this._recursiveBBox=new lT,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let i=this.children[e];if(Ie.is(i))return i}entityChildrenCount(){let e=this.children.length;for(;e--;)if(Ie.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let e=this;for(;e.data.type!=="Instance";){let i=e.parent;if(!Ie.is(i))return;e=i}return e}forInstancesRec(e){this.instances.forEach(i=>{i.disposed||e(i),i.forInstancesRec(e)})}super_Entity(e,i){typeof e=="string"&&(this.uuid=e),this.identity=e,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,i,n=!1){if(this.data.states.length!==0||n){for(let r of this.data.states)ah.toOps(this.data,r.data).forEach(s=>{let a=nb.replaceProps(s,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,i)});if(e!==null){let r=this.data.states.data(e);r&&(this.dataPatched=ah.patch(this.data,r),ah.toOps(this.data,r).forEach(s=>{this.updateByPatchedOp(s,this.dataPatched,i)}))}n&&this.updateTransformState(this.dataPatched,i),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(e,i){e.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{$a(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let i;return this.traverseEntity(n=>{n.uuid===e&&(i=n)}),i}traverseSortNextHelper(){let e=this.parent;if(e){let i=e.children,n=i.indexOf(this)+1;if(Ie.is(i[n]))return i[n];if(Ie.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&Ie.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let i=this;for(;e>0&&i!==null;)i=i.parent,e-=1;return i}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let i=this.parent;for(;i;){if(e===i)return!0;i=i.parent}return!1}countToAccestor(e){let i=0,n=this;for(;n!==e;){if(n===null)return-1;n=n.parent,i+=1}return i}forEachEntity(e){for(let i of this.children)$a(i)&&e(i)}traverseEntityAncestors(e){this.traverseAncestors(i=>{Ie.is(i)&&e(i)})}traverseConcreteEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)$a(n)&&n.isConcreteEntity&&n.traverseEntity(e,i+1)}traverseEntity(e,i=0){if(e(this,i)!==!0)for(let n of this.children)$a(n)&&n.traverseEntity(e,i+1)}traverseVisibleEntity(e){e(this);for(let i of this.children)$a(i)&&i.visible&&i.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,i=!1){return super.copy(e,i),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this}hasEntityChild(){return this.children.some(e=>$a(e))}isAncestorOf(e){if(this.uuid===e)return!1;let i=!1;return this.traverseEntity(n=>{n.uuid===e&&(i=!0)}),i}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),MA({position:this.position.toArray(),rotation:[this.rotation.x*Pt.RAD2DEG,this.rotation.y*Pt.RAD2DEG,this.rotation.z*Pt.RAD2DEG],scale:this.scale.toArray(),shear:xs.fromMatrix(this.shearMatrix.toArray()),pivot:[0,0,0],pivotRotation:[0,0,0]},e)}getTransformValues(e,i,n){return i[e].map((r,s)=>n?.shared.getVariable(r,[this.uuid,e,$4[s]])??r)}updateTransformState(e,i){let n=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,i)),n=!0),e.rotation&&(Xf.fromArray(this.getTransformValues("rotation",e,i)).multiplyScalar(Pt.DEG2RAD),this.rotation.setFromVector3(Xf),n=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,i)),n=!0),e.shear&&(this.shearMatrix.fromArray(xs.toMatrix(e.shear)),n=!0),e.pivot!==void 0||e.pivotRotation!==void 0){if(n=!0,e.pivot!==void 0&&e.pivotRotation!==void 0)this.pivotMatrix.compose(Xf.fromArray(e.pivot).negate(),jv.setFromEuler(w2.fromArray(e.pivotRotation.map(r=>r*Pt.DEG2RAD))).invert(),x2);else if(e.pivot!==void 0)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(e.pivotRotation!==void 0){let r=Xf.setFromMatrixPosition(this.pivotMatrix);jv.setFromEuler(w2.fromArray(e.pivotRotation.map(s=>s*Pt.DEG2RAD))).invert(),this.pivotMatrix.compose(r,jv,x2)}}return n&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(r=>{r.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&this.updateWorldMatrix(!1,!0),n}onVariableUpdate(e=!1){e?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(i=>{i.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)Ie.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{Ie.is(e)&&e.disposeRecursively()})}toState(e=[]){return MA({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,i){e!==void 0&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},i,!1)}updateByOp(e,i,n,r){let s=this.data;this.data=i;let a=e,o=ri(e.path,["states","*"]);if(o!==null){if(e.type===0){let[l]=o;if(this?.stateSelection===l){let c={...e.props};if(delete c.name,Object.values(e.props).some(h=>h===void 0)){let h=this.data;if(h!==void 0){let d=Vn.zoom(h,e.path.slice(2));if(d)for(let u in e.props)e.props[u]===void 0&&u in d&&(c[u]=d[u])}}a={...e,props:c,path:e.path.slice(2)}}}}else if(e.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(e.props.name!==void 0&&l.name){let{name:h,...d}=l;l=d}if(e.props.material!==void 0&&"material"in l){let{material:h,...d}=l;l=d}let c=Vn.removeOverridden(e.path,e.props,l);a={...e,props:c}}}if(this.updateByPatchedOpBase(a,ah.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n),ri(e.path,["overrides"])){let l=[],c=[...e.path];for(l.push(c[1]),c.splice(0,2);c.length>0&&c[0]==="descendants";)l.push(c[1]),c.splice(0,2);if(l[l.length-1]===void 0){if(e.type===0)for(let h of Object.keys(e.props)){l[l.length-1]=h;let d=n.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=e.props[h],d.updateState(vh.apply(d.component.data,d.overrideData),n))}}else{let h=n.scene.findInstance([this.uuid,...l]);if(h){let d=Vn.zoom(h.component.data,c);if((e={...e,path:c}).type===0){let u=e.props;if(d)for(let[p,f]of Object.entries(e.props))f===void 0&&(u===e.props&&(u={...e.props}),u[p]=d[p]);e={...e,props:u}}h.overrideData=Eb.resolve(i.overrides,l),h.updateByOp(e,tr.applySimple(h.data,e),n,!1)}}}else if(this.instances.length>0){let l;if(e.path.length===0&&e.type===0){let c;for(let h of al.rootOverrideProps)h in e.props&&(c===void 0&&(c={}),c[h]=e.props[h]);c&&(l={...e,props:c})}else for(let c of al.rootOverrideProps)if(ri(e.path,[c])){l=e;break}l!==void 0&&this.instances.forEach(c=>{if(c.isInstanceRoot){let h=vh.filterOp(c.overrideData,l);h&&c.updateByOp(h,tr.applySimple(c.data,h),n,!0)}}),this.instances.forEach(c=>{if(!c.isInstanceRoot){let h=vh.filterOp(c.overrideData,e);if(h){let d;d=s===c.data&&e===h?i:tr.applySimple(c.data,h),c.updateByOp(h,d,n,!0)}}})}}updateByPatchedOpBase(e,i,n){if(this.dataPatched=i,e.path.length===0&&e.type===0)e.props.type!==void 0&&!Jc.is(e.props.type)&&hl.changeEntityProptotype(this,this.data,n);else if(e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&"type"in e.props){hl.changeEntityProptotype(this,this.data,n);for(let r of this.children)Ie.is(r)&&r.updateVisible(n.scene)}this.updateByPatchedOp(e,i,n)}updateByPatchedOp(e,i,n){if(e.path.length===0&&e.type===0?this.updateState(e.props,n):e.type===0&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(i,n),e.path[0]==="morphTargetInfluences"&&e.type===0){let r=i.morphTargetInfluences.get(e.path[1])?.data.name;r&&this.updateMorphInfluences(r,n.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",r]))}if(ri(e.path,["pathSnapping"])!==null&&(this.updatePathSnapping(i.pathSnapping),this.isVirtualEntity&&n.scene?.syncInstancePathConstraint(this)),ri(e.path,["cloner"])!==null){let r=tr.drop(e,1);r.path.length===0&&r.type===0&&r.props.disabled===!0?this.setFromClonerState(null,n):this.cloner?this.cloner.updateState(i.cloner,n):(this.setFromClonerState(i.cloner,n),this.expandCloner(n)),this.updateVisible(n.scene)}}updatePathSnapping(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){if(this._needApplyPathSnapping===!1)return;let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,n=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let a=e.find(this.isVirtualEntity&&e.pathConstraints.getConstraint(this.uuid)||i);if(!a)return;this._needApplyPathSnapping=!1;let o=a.data;if(o.geometry.path.points.length<=1)return;let l=m6(o.geometry.path),c=function(p){let f=p%1;return f<0?f+1:f===0&&p>0?1:f}(n+r),h=null;try{h=l.curves.length?l.getPointAt(c):null}catch{}if(h===null)return;a.updateMatrixWorld();let d=this.parent?S2.copy(this.parent.matrixWorld):S2.identity(),u=function(p,f,g,m){mT.setFromRotationMatrix(Bu.extractRotation(m));let v=p.clone().applyMatrix4(Bu.copy(m).invert().multiply(g));if(f===null)X1.setFromRotationMatrix(Bu.extractRotation(g));else{let y=f.clone().applyMatrix4(Bu.extractRotation(g));X1.setFromRotationMatrix(Bu.lookAt(y6.set(0,0,0),y,_6))}return{position:v,rotation:new T().setFromEuler(v6.setFromQuaternion(mT.invert().multiply(X1))).multiplyScalar(Pt.RAD2DEG)}}(h,s==="tangential"?l.getTangentAt(c):null,a.matrixWorld,d);this.updateTransformState({position:u.position.toArray(),rotation:u.rotation.toArray()}),this.traverseEntity(p=>{p._cameraType&&p.dispatchEvent(X4)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let i=!1;this.traverseEntity(n=>{if(n.data.type==="Splat")return i=!0,!0}),i&&e.reloadSplats()}updateState_Entity(e,i){e.name!==void 0&&(this.name=e.name),e.raycastLock!==void 0&&(this.raycastLock=e.raycastLock),e.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in e&&e.cloner!==void 0&&(this.setFromClonerState(e.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(e,i)}get attachedSurfaceCloners(){return this.children.filter(e=>oh(e)&&e.parameters.type==="toObject")}setFromClonerState(e,i){if(!this.disposed)if(e===null||e.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(this.cloner===void 0){if(hl.Cloner===null)return void jn("cloners","a cloner");this.cloner=new hl.Cloner(this,e),i.scene.addPendingExpandCloner(this)}else this.cloner.updateState(e,i)}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}}}),hd=z(()=>{J(),Xr(),(gT||(gT={})).is=t=>"objectHelper"in t,ld=(t,e)=>class extends Ux(t){constructor(){super(...arguments),this.objectHelper=new e(this),this.gizmos={}}get geometryHelper(){return e.geometryHelper}raycast(i,n){this.objectHelper.raycast(i,n)}showGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Yg&&(n.visible=!0)}}updateEntityBoxSize(i,n){this.objectHelper.visible&&this.geometryHelper instanceof ya?(i.setScalar(0),n.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,n)}hideGizmos(){for(let i in this.gizmos){let n=this.gizmos[i];n instanceof Yg&&(n.visible=!1)}}}}),zx=z(()=>{J(),Ox(),hd(),Ka=class extends ld(Tp,wp){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.data.type==="Empty"&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&Object.keys(t).length===1&&e.scene.reloadSplats()}}});function ia(t,e,i,n,r,s,a){Km.set(r,s,a).unproject(n);let o=e[t];if(o!==void 0){let l=i.getAttribute("position");for(let c=0,h=o.length;c<h;c++)l.setXYZ(o[c],Km.x,Km.y,Km.z)}}var Km,ps,Y4,x6,NZ=z(()=>{J(),_0(),b0(),Km=new T,ps=new eh,Y4=class extends Au{constructor(t){let e=new jt,i=new Wo({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],s={},a=new Jt(15711266),o=new Jt(15711266),l=new Jt(2857471);function c(d,u,p){h(d,p),h(u,p)}function h(d,u){n.push(0,0,0),r.push(u.r,u.g,u.b),s[d]===void 0&&(s[d]=[]),s[d].push(n.length/3-1)}c("n1","n2",a),c("n2","n4",a),c("n4","n3",a),c("n3","n1",a),c("f1","f2",a),c("f2","f4",a),c("f4","f3",a),c("f3","f1",a),c("n1","f1",a),c("n2","f2",a),c("n3","f3",a),c("n4","f4",a),c("p","n1",o),c("p","n2",o),c("p","n3",o),c("p","n4",o),c("u1","u2",l),c("u2","u3",l),c("u3","u1",l),e.setAttribute("position",new kt(n,3)),e.setAttribute("color",new kt(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let t=this.geometry,e=this.pointMap;ps.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;ia("n1",e,t,ps,-1,-1,i),ia("n2",e,t,ps,1,-1,i),ia("n3",e,t,ps,-1,1,i),ia("n4",e,t,ps,1,1,i);let n=i;ia("f1",e,t,ps,-1,-1,n),ia("f2",e,t,ps,1,-1,n),ia("f3",e,t,ps,-1,1,n),ia("f4",e,t,ps,1,1,n);let r=n;ia("u1",e,t,ps,.35,1.1,r),ia("u2",e,t,ps,-.35,1.1,r),ia("u3",e,t,ps,0,1.55,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},x6=class extends Pp(Y4){constructor(t){super(t),this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,e){Dp(this.object,this.geometry,t,e,!0)}}});function Z4(t){return 1-Math.pow(1-t,3)}var lc,Gv,Hv,Wv,Xd,qv,Ba,Ki,Xs=z(()=>{J(),NZ(),Xt(),hd(),ti(),lc=new T,Gv=new T,Hv=new qt,Wv=new T,Xd=new T,qv=new T,Ba=class extends ld(eh,x6){constructor(t="",e={...Sg.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=sl.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this._createdAt=typeof performance<"u"?performance.now():0,this._tickProjectionTransition=()=>{let r=this._projectionTransition;if(r===void 0)return;if(this.disposed)return void this._endProjectionTransition();r.raf=requestAnimationFrame(this._tickProjectionTransition);let s=Ba.projectionTransitionRequestRender??r.requestRender;this.updateProjectionMatrix(),s?.()},this.super_Entity(t,e),this.previousProjectionMatrix=new Et,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,n=this.height;this.orthoCamera=new yp(-.5*i,.5*i,.5*n,-.5*n,-5e4,1e4),this.perspCamera=new Qu(45,i/n,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}static withoutProjectionTransition(t){let e=Ba.projectionTransitionsEnabled;Ba.projectionTransitionsEnabled=!1;try{return t()}finally{Ba.projectionTransitionsEnabled=e}}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){t==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t,e,i){typeof t=="number"&&(t=new T(t,e,i)),super.lookAt(t),this.getWorldPosition(lc),this.targetOffset=lc.distanceTo(t)}getTarget(t=new T){return this.getWorldDirection(Gv),this.getWorldPosition(lc),Gv.multiplyScalar(this.targetOffset),t.copy(lc).add(Gv),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(lc),lc.distanceTo(t)}updateUp(){this.getWorldQuaternion(Hv),Wv.set(0,0,1).applyQuaternion(Hv),Xd.copy(xi.DEFAULT_UP),this.isUpVectorFlipped&&Xd.negate(),Xd.applyQuaternion(Hv),qv.copy(xi.DEFAULT_UP).projectOnPlane(Wv),this.angleOffsetFromUp=qv.angleTo(Xd),this.angleOffsetFromUp*=qv.cross(Xd).dot(Wv)>=0?1:-1}updateTransformState(t,e){let i=super.updateTransformState(t,e);return t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(t){let e=t.getWorldPosition(new T),i=t.getWorldDirection(new T).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new T).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new T;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,i=!1){if(this.aspect=t/e,i){let n=t>e?this.aspect:1,r=t>e?1:this.aspect;this.left=-395*n,this.right=395*n,this.top=1/r*395,this.bottom=1/r*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this._applyProjectionTransition(),this.objectHelper&&this.objectHelper.update()}get isProjectionTransitioning(){return this._projectionTransition!==void 0}get projectionTransitionProgress(){let t=this._projectionTransition;if(t===void 0)return 1;let e=(performance.now()-t.start)/t.duration;return e>=1?1:e<=0?0:Z4(e)}get _activeSubCamera(){return this._cameraType==="PerspectiveCamera"?this.perspCamera:this.orthoCamera}_canAnimateProjection(){return Ba.projectionTransitionsEnabled&&typeof requestAnimationFrame=="function"&&typeof performance<"u"&&performance.now()-this._createdAt>=Ba.projectionTransitionMinAgeMs}_beginProjectionTransition(t){let e=this._projectionTransition;e===void 0&&(e={from:new Et,blend:new Et,blendInverse:new Et,start:0,duration:Ba.projectionTransitionDuration,referenceDepth:1,raf:0,requestRender:t},this._projectionTransition=e),e.from.copy(this.projectionMatrix),e.start=performance.now(),e.duration=Ba.projectionTransitionDuration,e.referenceDepth=Number.isFinite(this.targetOffset)?Math.max(1,this.targetOffset):1,t&&(e.requestRender=t),e.raf!==0&&cancelAnimationFrame(e.raf),e.raf=requestAnimationFrame(this._tickProjectionTransition)}_applyProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;let e=(performance.now()-t.start)/t.duration;if(e>=1)return void this._endProjectionTransition();let i=Z4(e),n=t.from.elements,r=this._activeSubCamera.projectionMatrix.elements,s=t.blend.elements,a=t.referenceDepth,o=Math.max(1e-6,n[15]-n[11]*a),l=i*o/(i*o+(1-i)*Math.max(1e-6,r[15]-r[11]*a));for(let c=0;c<16;c++)s[c]=n[c]+(r[c]-n[c])*l;t.blendInverse.copy(t.blend).invert(),this.projectionMatrix=t.blend,this.projectionMatrixInverse=t.blendInverse}_endProjectionTransition(){let t=this._projectionTransition;if(t===void 0)return;t.raf!==0&&cancelAnimationFrame(t.raf),this._projectionTransition=void 0;let e=this._activeSubCamera;this.projectionMatrix=e.projectionMatrix,this.projectionMatrixInverse=e.projectionMatrixInverse}_syncProjectionTransition(t){let e=t._projectionTransition;if(e===void 0)return void(this._projectionTransition!==void 0&&this._endProjectionTransition());let i=this._projectionTransition;i===void 0?(i={from:new Et,blend:new Et,blendInverse:new Et,start:0,duration:1,referenceDepth:1,raf:0,requestRender:void 0},this._projectionTransition=i):i.raf!==0&&(cancelAnimationFrame(i.raf),i.raf=0),i.requestRender=void 0,i.from.copy(e.from),i.start=e.start,i.duration=e.duration,i.referenceDepth=e.referenceDepth,this._applyProjectionTransition()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,i,n,r,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,e,i,n,r,s):this.orthoCamera.setViewOffset(t,e,i,n,r,s),this._applyProjectionTransition()}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=sl.sanitizeTargetOffset(t.targetOffset),this.updateProjectionMatrix(),this._syncProjectionTransition(t),this}toCameraState(t=[]){return MA({type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped},t)}updateCameraSubtype(t,e){let i=t==="perspective"?"PerspectiveCamera":"OrthographicCamera";e.zoom!==void 0&&this.setZoom(i,e.zoom),e.near!==void 0&&this.setNear(i,e.near),e.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),t.far!==void 0&&(this.far=t.far),t.orthographic!==void 0&&this.updateCameraSubtype("orthographic",t.orthographic),t.perspective!==void 0&&this.updateCameraSubtype("perspective",t.perspective),t.type!==void 0&&(t.type!==this._cameraType&&this._canAnimateProjection()&&this._beginProjectionTransition(e?.shared.requestRender),this.cameraType=t.type),t.up!==void 0&&this.up.fromArray(t.up.map(i=>typeof i=="number"?i:0)),t.targetOffset!==void 0&&(this.targetOffset=sl.sanitizeTargetOffset(t.targetOffset)),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.type===0&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},(Ki=Ba).projectionTransitionsEnabled=!1,Ki.projectionTransitionDuration=350,Ki.projectionTransitionMinAgeMs=1e3});function w6(t){return t.type==="TorusGeometry"&&t.arc===360}var S6,Xv,vT,n0=z(()=>{J(),S6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??n),s=Math.abs(i.depth??n),a=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(i,{width:n,height:r,depth:s,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:n,radius:r,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:c,cornerRadius:h,cornerSegments:d}=t.parameters,u=new vT(!1,e,i,n,r,s,a,o,l,c,h,d);return Object.assign(u,{userData:{...t,type:"HelixGeometry"}})}},Xv=new mh([0,0,0],1),vT=class extends jt{constructor(t=!0,e=1,i=1,n=1,r=1,s=1,a=1,o=1,l=1,c=1,h=1,d=1){if(super(),s===0)return;let u=t&&s===1;u&&(d=0),h>100&&(h=100),h===0&&(d=0);let p,f,g,m,v,y,_,b,x=()=>new T,w=new T,S=x(),E=x(),A=x(),P=x(),C=x(),R=x(),O=x(),D=x(),F=x(),V=x(),U=x(),j=i-2*o+.001,q=j/s,rt=Math.ceil(a*s),it=rt+1,Y=j/rt,ht=-j/2,ot=c+1,ft=2*Math.PI/c,pt=Math.PI/2/d,tt=Math.min((1-h/100)*o,o-.01),mt=o-tt,N=0,L=2*d+2,H=ot*L/2,$=H+ot*it,B=Math.max(0,ot*(it+L)),[Z,K,k]=[3,3,2].map(Gt=>Array(B*Gt).fill(0)),st=[],dt=r-o;function bt(Gt,Ft){let _e=Math.PI/2;y=Ft*Y,b=2*Math.PI*(y%q)/q+_e,y+=ht,_=Math.sin(b)*dt,v=Math.cos(b)*dt,t?Gt.set(v,_,y):Gt.set(v,y,_)}bt(w,-1e-10),bt(S,0),P.copy(w),bt(w,1);let ct=w.distanceTo(S),It=u?0:mt+tt,St=ct*rt+2*It,Rt=tt,Mt=St-It;for(let Gt=0;Gt<=rt;Gt++){bt(E,Gt),U.subVectors(E,P).normalize(),P.copy(E),F.copy(E).setComponent(+t+1,0).normalize(),V.crossVectors(U,F).normalize();let Ft=Gt===0,_e=Gt===rt,be=Ft?3*Math.PI/2:pt,Gi=Ft?Rt:Mt,oe=Ft?ot:$,le=Ft?0:B-ot,Pe=U.clone().multiplyScalar(Ft?-mt:mt).add(E),si=U.clone().multiplyScalar(Ft?-1:1).normalize();for(let ze=0;ze<ot;ze++){let Pi=ze*ft;if(C.addVectors(w.copy(F).multiplyScalar(o*Math.cos(Pi)),S.copy(V).multiplyScalar(o*Math.sin(Pi))),R.copy(C).normalize(),Ft||_e){u||(N=le+ze,[0,1,2].forEach(ui=>{Z[3*N+ui]=Pe.getComponent(ui),K[3*N+ui]=si.getComponent(ui)}),k[2*N]=+_e,k[2*N+1]=ze/c),S.copy(R).multiplyScalar(tt),A.addVectors(E,S);for(let ui=0;ui<d;ui++){let on=ui*pt+be;O.addVectors(w.copy(U).multiplyScalar(mt*Math.sin(on)),S.copy(R).multiplyScalar(mt*Math.cos(on))),D.copy(O).normalize(),S.addVectors(A,O),O.normalize(),N=oe+ui*ot+ze,[0,1,2].forEach(bn=>{Z[3*N+bn]=S.getComponent(bn),K[3*N+bn]=D.getComponent(bn)});let Jr=+Ft+Math.sin(on);k[2*N]=(Gi+mt*Jr)/St,k[2*N+1]=ze/c}}S.addVectors(E,C),N=H+Gt*ot+ze,[0,1,2].forEach(ui=>{Z[3*N+ui]=S.getComponent(ui),K[3*N+ui]=R.getComponent(ui)}),k[2*N]=(It+Gt*ct)/St,k[2*N+1]=ze/c}}let W=it+2*d+2,[_t,Dt]=[+u,W-1];for(let Gt=_t;Gt<=Dt-1;Gt++){let Ft=u&&Gt===Dt-1;for(let _e=0;_e<ot-1;_e++)p=Gt*ot+_e,f=p+1,g=(Ft?_e:p)+ot,m=(Ft?_e+1:f)+ot,Gt===0?st.push(f,m,g):Gt===W-2?st.push(p,f,g):st.push(p,f,g,f,m,g)}this.setIndex(st),this.setAttribute("position",new kt(Z,3)),this.setAttribute("normal",new kt(K,3)),this.setAttribute("uv",new kt(k,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,n,r=this.userData.parameters,s=Math.ceil(r.tubularSegments),a=r.radialSegments,o=a+1,l=[];for(let c=1;c<s;c++)for(let h=0;h<a;h++)t=c*o+h,e=t+1,i=t+o,n=e+o,l.push(t,e,i,e,n,i);for(let c=0;c<a;c++)t=s*o+c,e=t+1,i=c+o,n=c+1+o,l.push(t,e,i,e,n,i);return Xv.array=new Uint32Array(l),Xv.count=l.length,Xv}}});function kZ(t){return Q4||(Q4=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.158/build",i=import("./boolean.js"),[n,r]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(s=>s.arrayBuffer())]);await n.default({module_or_path:r}),r0=n}())}function Ob(){if(r0===void 0)throw new Error("boolean-wasm is not loaded");return r0}function G3(t){let e=s0.get(t);if(e===void 0)throw new Error("Unknown csg mesh set handle "+t);return e}function H3(t){return s0.set(++yT,t),yT}function VZ(t,e,i){if(r0===void 0)return-1;let{positions:n,indices:r,normals:s}=function(a,o){if(o&&a.userData.positions!==void 0){let p=a.userData,f=[];for(let g=0,m=0;g<p.verticesPerFace.length;g++){let v=p.verticesPerFace[g];for(let y=1;y<v-1;y++)f.push(p.indices[m],p.indices[m+y],p.indices[m+y+1]);m+=v}return{positions:p.positions instanceof Float32Array?p.positions:new Float32Array(p.positions),indices:new Uint32Array(f)}}let l;l=w6(a.userData.parameters)?a.getClosedTorusIndicesForBooleanOrSubdiv():a.getIndex();let c,h=a.getAttribute("position");if(l===null){c=new Uint32Array(h.count);for(let p=0;p<c.length;p++)c[p]=p}else c=l.array instanceof Uint32Array?l.array:new Uint32Array(l.array);let d=a.getAttribute("normal"),u=d!==void 0&&d.itemSize===3&&d.count===h.count&&d.array instanceof Float32Array&&d.isInterleavedBufferAttribute!==!0?d.array:void 0;return{positions:h.array,indices:c,normals:u}}(t,e);return H3(new r0.CsgMesh(n,r,s))}function K4(t,e){let i=Ob(),n=E6[e];if(n===void 0)throw new Error("Unknown boolean operation "+e);let r=t.map(G3);if(r.length===1)return i.clone_mesh(r[0]);let s,a=[];if(e===2&&r.length>2){let o=r[0];for(let l=1;l<r.length-1;l++)o=i.boolean_mesh(o,r[l],0),a.push(o);s=i.boolean_mesh(r[r.length-1],o,2)}else if(e===2)s=i.boolean_mesh(r[1],r[0],2);else{let o=r[r.length-1];for(let l=0;l<r.length-1&&(o=i.boolean_mesh(o,r[l],n),a.push(o),o.tri_count()!==0);l++);s=o,a.pop()}for(let o of a)o.free();return s}function M2(t,e){G3(t).transform(new Float32Array(e.elements))}function M6(t){let e=s0.get(t);e!==void 0&&(e.free(),s0.delete(t))}var r0,s0,yT,Q4,E6,Fx=z(()=>{J(),n0(),s0=new Map,yT=0,E6={0:0,1:1,2:2}});function hc(t){return t!==null&&"booleanOp"in t}var _T,A6,jZ=z(()=>{J(),Xr(),Fx(),_T=class extends Ux(gi){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new Et}updateVisible(t){super.updateVisible(t),this.visible=!hc(this.parent)&&this.visible,hc(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){hc(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(M6(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}dispose(){super.dispose(),this.freeBooleanPointer()}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),hc(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof _T&&(t.freeBooleanPointer(),hc(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&hc(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),hc(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}}),GZ=z(()=>{A6=null});function W3(t,e=0,i=t.count,n,r){let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,h=-1/0;for(let d=e;d<i;d++){let u=t.getX(d),p=t.getY(d),f=t.getZ(d);u<s&&(s=u),p<a&&(a=p),f<o&&(o=f),u>l&&(l=u),p>c&&(c=p),f>h&&(h=f)}Qm.min.set(s,a,o),Qm.max.set(l,c,h),Qm.getCenter(n),Qm.getSize(r).multiplyScalar(.5)}var Qm,J4,tL,sn,Zn=z(()=>{J(),jZ(),GZ(),Qm=new hi,J4=new jt,tL=new qs,sn=class extends _T{constructor(t,e){super(J4,tL),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){if(this.raycastDeformed(t,e))return;let i=A6;i===null?super.raycast(t,e):i(this,t,e)}raycastDeformed(t,e){return!1}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");i!==void 0?W3(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}}});function T6(t){return t?.isClassicNodeMaterial===!0}var _n,a0,C6,P6,Cg,D6,R6,O6,I6=z(()=>{}),ba=z(()=>{J(),_n=class extends Jt{constructor(t,e,i,n){super(t,e,i),this.isColorA=!0,this.a=n}setRGBA(t,e,i,n){super.setRGB(t,e,i),this.a=n}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(t){return super.equals(t)&&this.a===t.a}setStyle(t,e="srgb"){let i;if(t==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(t)){let n,r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="rgba"?parseFloat(n[4]):1,super.setStyle(t,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a=r==="hsla"?parseFloat(n[4]):1,super.setStyle(t,e)}}return super.setStyle(t,e)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}}}),L6=z(()=>{ba(),a0=class extends _n{}}),HZ=z(()=>{C6=class{constructor(t=1e4){this.timeout=t,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev,e.next=null,e.prev=null,e.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;){this.dispose(e.src,e.data),this.cache.delete(e.src);let i=e;e=e.next,e.prev=this.head,this.head.next=e,i.next=null,i.prev=null,i.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),i=this.cache.get(t);return i===void 0?(i={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,i)):(i.time=e,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((t,e)=>{this.dispose(e,t.data),t.next=null,t.prev=null,t.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}}}),B6=z(()=>{HZ(),P6=class extends C6{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}}}),U6=z(()=>{D6=class{constructor(t,e){this.data=t,this.cache=e,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},R6=class{constructor(){this.cache=new Map}remove(t){this.cache.delete(t.data)}load(t){let e=this.cache.get(t);return e===void 0&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}}}),WZ=z(()=>{J(),O6=class extends XF{constructor(t){super(t),this.type=Xn}parse(t){let e=function(p,f){switch(p){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(f||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(f||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(f||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(f||""))}},i=function(p,f,g){f=f||1024;let m=p.pos,v=-1,y=0,_="",b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));for(;0>(v=b.indexOf(`
|
|
4187
4207
|
`))&&y<f&&m<p.byteLength;)_+=b,y+=b.length,m+=128,b=String.fromCharCode.apply(null,new Uint16Array(p.subarray(m,m+128)));return-1<v&&(g!==!1&&(p.pos+=y+v+1),_+b.slice(0,v))},n=function(p,f,g,m){let v=p[f+3],y=Math.pow(2,v-128)/255;g[m+0]=p[f+0]*y,g[m+1]=p[f+1]*y,g[m+2]=p[f+2]*y,g[m+3]=1},r=function(p,f,g,m){let v=p[f+3],y=Math.pow(2,v-128)/255;g[m+0]=th.toHalfFloat(Math.min(p[f+0]*y,65504)),g[m+1]=th.toHalfFloat(Math.min(p[f+1]*y,65504)),g[m+2]=th.toHalfFloat(Math.min(p[f+2]*y,65504)),g[m+3]=th.toHalfFloat(1)},s=new Uint8Array(t);s.pos=0;let a,o,l,c=function(p){let f,g,m=/^#\?(\S+)/,v=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,y=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,_=/^\s*FORMAT=(\S+)\s*$/,b=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,x={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for((p.pos>=p.byteLength||!(f=i(p)))&&e(1,"no header found"),(g=f.match(m))||e(3,"bad initial token"),x.valid|=1,x.programtype=g[1],x.string+=f+`
|
|
4188
4208
|
`;f=i(p),f!==!1;)if(x.string+=f+`
|
|
4189
4209
|
`,f.charAt(0)!=="#"){if((g=f.match(v))&&(x.gamma=parseFloat(g[1])),(g=f.match(y))&&(x.exposure=parseFloat(g[1])),(g=f.match(_))&&(x.valid|=2,x.format=g[1]),(g=f.match(b))&&(x.valid|=4,x.height=parseInt(g[1],10),x.width=parseInt(g[2],10)),2&x.valid&&4&x.valid)break}else x.comments+=f+`
|
|
4190
|
-
`;return 2&x.valid||e(3,"missing format specifier"),4&x.valid||e(3,"missing image size specifier"),x}(s),h=c.width,d=c.height,u=function(p,f,g){let m=f;if(m<8||m>32767||p[0]!==2||p[1]!==2||128&p[2])return new Uint8Array(p);m!==(p[2]<<8|p[3])&&e(3,"wrong scanline width");let v=new Uint8Array(4*f*g);v.length||e(4,"unable to allocate buffer space");let y=0,_=0,b=4*m,x=new Uint8Array(4),w=new Uint8Array(b),S=g;for(;S>0&&_<p.byteLength;){_+4>p.byteLength&&e(1),x[0]=p[_++],x[1]=p[_++],x[2]=p[_++],x[3]=p[_++],(x[0]!=2||x[1]!=2||(x[2]<<8|x[3])!=m)&&e(3,"bad rgbe scanline format");let E,A=0;for(;A<b&&_<p.byteLength;){E=p[_++];let C=E>128;if(C&&(E-=128),(E===0||A+E>b)&&e(3,"bad scanline data"),C){let R=p[_++];for(let O=0;O<E;O++)w[A++]=R}else w.set(p.subarray(_,_+E),A),A+=E,_+=E}let P=m;for(let C=0;C<P;C++){let R=0;v[y]=w[C+R],R+=m,v[y+1]=w[C+R],R+=m,v[y+2]=w[C+R],R+=m,v[y+3]=w[C+R],y+=4}S--}return v}(s.subarray(s.pos),h,d);switch(this.type){case $e:l=u.length/4;let p=new Float32Array(4*l);for(let g=0;g<l;g++)n(u,4*g,p,4*g);a=p,o=$e;break;case Xn:l=u.length/4;let f=new Uint16Array(4*l);for(let g=0;g<l;g++)r(u,4*g,f,4*g);a=f,o=Xn;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:h,height:d,data:a,header:c.string,gamma:c.gamma,exposure:c.exposure,type:o,colorSpace:Ku,minFilter:de,magFilter:de,generateMipmaps:!1,flipY:!0}}setDataType(t){return this.type=t,this}}});function eL(t){return t.length>2&&t[0]===35&&t[1]===63}var iL,q3,tl,qZ=z(()=>{J(),WZ()}),z6=z(()=>{J(),B6(),U6(),qZ(),iL=0,q3=class extends D6{constructor(t,e){super(t,e.imageHolderCache),this.data=t,this.shared=e,this.instanceId=++iL,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this.isHdr=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo=t.type==="video",this.isBuffer=t.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?t:t.data)}async updateSrc(t){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let e=()=>{this.loaded=!0;for(let n of Object.values(this._cache))for(let r of Object.values(n))for(let s of Object.values(r))s&&(s.image=this.img,s.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=t,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof t!="string"){let n,r=new FileReader;r.readAsDataURL(new Blob([t],{type:"video/mp4"})),await new Promise(s=>{r.onloadend=a=>{n=a.target?.result,s(null)}}),this.img.src=n}else this.img.src=t;this.img.onloadeddata=()=>{e()}}else if(t instanceof Uint8Array?eL(t):typeof t=="string"&&/\.hdr($|[?#])/i.test(t)){let n=t instanceof Uint8Array?t:null;if(n===null)try{n=new Uint8Array(await(await fetch(t)).arrayBuffer())}catch{n=null}let r=n!==null&&eL(n)?function(s){try{let a=new O6().parse(s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength));if(!a||!a.width||!a.height)return null;let{width:o,height:l}=a,c=a.data,h=new Uint16Array(c.length),d=4*o,u=g=>th.toHalfFloat(Math.pow(Math.max(th.fromHalfFloat(g),0),1/2.2)),p=new Map,f=g=>{let m=p.get(g);return m===void 0&&(m=u(g),p.set(g,m)),m};for(let g=0;g<l;g++){let m=g*d,v=(l-1-g)*d;for(let y=0;y<d;y+=4)h[v+y]=f(c[m+y]),h[v+y+1]=f(c[m+y+1]),h[v+y+2]=f(c[m+y+2]),h[v+y+3]=c[m+y+3]}return{isSplineHdr:!0,data:h,width:o,height:l}}catch{return null}}(n):null;r!==null&&(this.isHdr=!0,this.img=r,e())}else this.img=new Image,this.img.src=typeof(i=t)=="string"?i:(Cg||(Cg=new P6),Cg.load(i)),this.img.onload=e,await new Promise(n=>{this.img.onload=()=>{e(),n(null)}});var i}getTexture(t,e=1008,i=1006){let n=this._cache[t]?.[e]?.[i];if(n)return n;{let r;return this.isBuffer?r=this.img.texture:this.isVideo?r=new NF(this.img,void 0,t,t):this.isHdr?(r=function(s){let a=new Cn(s.data,s.width,s.height,Yi,Xn);return a.flipY=!1,a.image.isSplineHdr=!0,a.needsUpdate=!0,a}(this.img),r.wrapS=t,r.wrapT=t,r.magFilter=i,r.minFilter=e):r=new ki(this.img,void 0,t,t,i,e),this.isBuffer||(r.anisotropy=8,r.generateMipmaps=e===1008),this.loaded&&(r.needsUpdate=!0),this._cache[t]===void 0&&(this._cache[t]={}),this._cache[t][e]===void 0&&(this._cache[t][e]={}),this._cache[t][e][i]=r,r}}setNeedsUpdate(t){if(!this.isBuffer)for(let e of Object.values(this._cache))for(let i of Object.values(e))for(let n of Object.values(i))n&&(n.needsUpdate=t)}disposeTextures(){for(let[t,e]of Object.entries(this._cache))for(let[i,n]of Object.entries(e))for(let[r,s]of Object.entries(n))s?.dispose(),this._cache[t]!==void 0&&this._cache[t][i]!==void 0&&(this._cache[t][i][r]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}}),X3=z(()=>{z6(),tl=class extends q3{}});function XZ(t){if(typeof t=="string")return t;let e=bT.get(t);return e||(e={url:URL.createObjectURL(new Blob([t]))},bT.set(t,e)),e.url}var bT,$Z=z(()=>{bT=new Map});function YZ(){if(!xT)return nL||(nL=async function(){await Promise.resolve().then(()=>(_D(),wG)),F6(window!==void 0?window:global),xT=!0}())}var F6,N6,xT,nL,k6=z(()=>{N6=new Promise(t=>{F6=t}),xT=!1});function rL(t,e){t.forEach(i=>{"dragDropActions"in i.data?(e.push(...i.data.dragDropActions.drag),e.push(...i.data.dragDropActions.drop)):"inActions"in i.data?(e.push(...i.data.inActions),e.push(...i.data.outActions)):"gameActions"in i.data?(e.push(...i.data.gameActions.idle),e.push(...i.data.gameActions.move),e.push(...i.data.gameActions.jump),e.push(...i.data.gameActions.run)):"breakpoints"in i.data?i.data.breakpoints.forEach(n=>{e.push(...n.data.actions)}):"actions"in i.data&&(e.push(...i.data.actions),i.data.actions.forEach(n=>{n.data.type==="Conditional"&&n.data.ifActions&&(e.push(...n.data.ifActions),e.push(...n.data.elseActions))}))})}function ZZ(t){let e=!1,i=[];return t.scene.objects.traverse((n,r)=>{if(r.type==="Page"&&r.uiScene!==void 0&&r.uiScene.objects.traverse((s,a)=>{if(a.events===void 0||Array.isArray(a.events)===!1)return!0;rL(a.events,i),e=e||i.some(o=>o.data.type==="Audio")}),r.events===void 0||Array.isArray(r.events)===!1)return!0;rL(r.events,i),e=e||i.some(s=>s.data.type==="Audio")}),e}var sL,Hu,$3=z(()=>{$Z(),k6(),N6.then(t=>sL=t),Hu=class{constructor({src:t,volume:e,delay:i,loop:n}){let r;this._volume=1,this.delay=0,this._loop=1,this.loopsRemaining=0,this._status="stopped",this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)},r=typeof t=="string"?{src:t}:{src:XZ(t),format:"wav"},this.sound=new sL.Howl(r),this.sound.on("end",this.onEnd),this.src=t,e!==void 0&&(this.volume=e),i!==void 0&&(this.delay=i),n!==void 0&&(this.loop=n)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,i){this.sound.on(t,e,i)}off(t,e,i){this.sound.off(t,e,i)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}}});function aL(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&(n.geometry.type==="TextGeometry"||n.geometry.type==="InputGeometry")&&(e=!0)}),e}var Y3,Z3=z(()=>{Y3=null});function oL(t){return new et(t.y,-t.x)}var K3,wT,V6,j6,$v,lL,Ib,G6,E2,Lb=z(()=>{J(),K3=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=t.parameters?.radiusTop,n=t.parameters?.radiusBottom,r=Object.assign({},e?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},t.parameters);r.thetaLength=Pt.clamp(r.thetaLength,0,360),r.hollow=Pt.clamp(r.hollow??0,0,1);let s=r.width/2,a=r.radiusTop??s,o=r.radiusBottom??s;if(a===o?(a=s,o=s):a>o?(a=s,o=o*s/a):(a=a*s/o,o=s),r.shapeBlendNode){a=i??s,o=n??s;let l=2*Math.max(a,o);r.width=l,r.depth=l}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:a,radiusBottom:o})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:c,radiusTop:h,radiusBottom:d,cornerRadius:u,cornerSegments:p,hollow:f}=t.parameters;c===0?(e=new jt,e.setAttribute("position",new kt([],3))):e=u||f?new wT(h,d,r,s,a,o,l,c*Math.PI/180,u,u,p,f):new mg(h,d,r,s,a,o,l,c*Math.PI/180);let g=n/i;return g!==1&&e.scale(1,1,g),Object.assign(e,{userData:{...t,type:"CylinderGeometry"}})}},wT=class extends jt{constructor(t,e,i,n,r,s,a,o,l,c,h,d,u=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,i=i||1,n=Math.floor(n)||8,r=Math.floor(r)||1,s=s!==void 0&&s,a=a!==void 0?a:0,o=o!==void 0?o:2*Math.PI,s&&(l=0,c=0);let p=i/2;u&&t==0&&(t=l),u&&e==0&&(e=c);let f=new et(t,p),g=new et(e,-p),m=null,v=null,y=null,_=null,b=f.clone().sub(g),x=0,w=0,S=0;d>0&&(x=Math.min(t,e)*(1-d),w=t-x,S=e-x);let E=f.clone();E.x-=x;let A=Math.PI-b.angle(),P=b.angle(),C=Math.tan(P/2),R=Math.tan(A/2),O=C+R,D=d?O:R,F=d?O:C;if(l=Math.min(l,(t-w)/D,b.length()/O),c=Math.min(c,(e-S)/F,b.length()/O),l>0){let st=l/C;m=f.clone().sub(new et(st,l)),d&&(y=m.clone(),y.x-=x-O*l),f.sub(b.clone().setLength(st))}if(c>0){let st=c/R;v=g.clone().sub(new et(st,-c)),g.add(b.clone().setLength(st)),d&&(_=v.clone(),_.x-=x-O*c,E.sub(b.clone().setLength(st)))}b=f.clone().sub(g);let V=b.length()<.5,U=[],j=[],q=[],rt=[],it=[],Y=[],ht=(st,dt,bt,ct,It)=>{for(let St=0;St<h+1;St++){let Rt=St/h,Mt=ct<0?Rt:1-Rt;It&&(Mt-=1),Mt*=st;let W=Math.sin(Mt),_t=Math.cos(Mt)*ct,Dt=_t*dt+bt.y;U.push(W*dt+bt.x),j.push(Dt),q.push(W),rt.push(_t),it.push(.5+Dt/i),Y.push(!1)}},ot=(st,dt,bt)=>{let ct=[st,dt];bt<0&&ct.reverse();for(let It of ct)U.push(It),j.push(p*bt),q.push(0),rt.push(bt),it.push(.5),Y.push(!0)};if(_&&v?(ht(A,c,_,-1,!0),ht(P,c,v,-1,!1)):v?(ot(v.x,0,-1),ht(P,c,v,-1,!1)):s||ot(e,S,-1),!V){let st=oL(b).normalize();for(let dt=0;dt<=r;dt++){let bt=dt/r,ct=b.y*bt+g.y;U.push(b.x*bt+g.x),j.push(ct),q.push(st.x),rt.push(st.y),it.push(.5+ct/i),Y.push(!1)}}if(y&&m?(ht(A,l,m,1,!1),ht(P,l,y,1,!0)):m?(ht(A,l,m,1,!1),ot(m.x,0,1)):s||ot(t,w,1),d&&!V){let st=oL(b).multiplyScalar(-1).normalize();for(let dt=0;dt<=r;dt++){let bt=dt/r,ct=b.y*-bt+E.y;U.push(b.x*-bt+E.x),j.push(ct),q.push(st.x),rt.push(st.y),it.push(.5+ct/i),Y.push(!1)}}let ft=U.length,pt=ft+(d&&!s?1:0),tt=(st,dt)=>st*ft+(dt===ft?0:dt),mt=o<2*Math.PI,N=(n+1)*ft+(mt?2*(1+pt):0),L=new Float32Array(3*N),H=new Float32Array(3*N),$=new Float32Array(2*N),B=N-1>65535?new Uint32Array(n*Math.max(0,pt-1)*6+(mt?2*(pt+1)*3:0)):new Uint16Array(n*Math.max(0,pt-1)*6+(mt?2*(pt+1)*3:0)),Z=0,K=0;for(let st=0;st<=n;st++){let dt=st/n,bt=dt*o+a,ct=Math.sin(bt),It=Math.cos(bt);for(let St=0;St<ft;St++){let Rt=3*K,Mt=2*K,W=U[St],_t=q[St];L[Rt]=W*ct,L[Rt+1]=j[St],L[Rt+2]=W*It,H[Rt]=_t*ct,H[Rt+1]=rt[St],H[Rt+2]=_t*It,Y[St]?($[Mt]=.5,$[Mt+1]=.5):($[Mt]=dt,$[Mt+1]=it[St]),K++}}for(let st=0;st<n;st++)for(let dt=0;dt<pt-1;dt++){if(s&&d&&dt==r)continue;let bt=tt(st,dt),ct=tt(st+1,dt),It=tt(st+1,dt+1),St=tt(st,dt+1),Rt=L[3*It+0],Mt=L[3*It+2];B[Z++]=bt,B[Z++]=ct,B[Z++]=St,(Rt!=0||Mt!=0)&&(B[Z++]=ct,B[Z++]=It,B[Z++]=St)}function k(st,dt,bt){let ct=Math.sin(bt),It=Math.cos(bt),St=-It,Rt=ct,Mt=st<0?(Ft,_e,be)=>{B[Z++]=Ft,B[Z++]=_e,B[Z++]=be}:(Ft,_e,be)=>{B[Z++]=Ft,B[Z++]=be,B[Z++]=_e},W=(t+e+w+S)/4,_t=3*K,Dt=2*K;L[_t]=W*ct,L[_t+1]=0,L[_t+2]=W*It,H[_t]=St,H[_t+1]=0,H[_t+2]=Rt,$[Dt]=.5,$[Dt+1]=.5;let Gt=K++;for(let Ft=0;Ft<pt;Ft++){let _e=3*(dt+(Ft===ft?0:Ft));_t=3*K,Dt=2*K,L[_t]=L[_e],L[_t+1]=L[_e+1],L[_t+2]=L[_e+2],H[_t]=St,H[_t+1]=0,H[_t+2]=Rt;let be=_e/3*2|0;$[Dt]=$[be],$[Dt+1]=$[be+1],K++}for(let Ft=Gt+1;Ft<K-1;Ft++)Mt(Gt,Ft,Ft+1);Mt(Gt,K-1,Gt+1)}mt&&(k(-1,0,a),k(1,n*ft,a+o)),this.setIndex(new Ht(B.slice(0,Z),1)),this.setAttribute("position",new Ht(L,3)),this.setAttribute("normal",new Ht(H,3)),this.setAttribute("uv",new Ht($,2))}}}),hL=z(()=>{J(),Lb(),V6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},t.parameters);return i.thetaLength=Pt.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:c,cornerRadiusTop:h,cornerRadiusBottom:d,cornerSegments:u}=t.parameters;c===0?(e=new jt,e.setAttribute("position",new kt([],3))):e=h>0||d>0||c<360?new wT(0,i/2,r,s,a,o,l,c*Math.PI/180,h,d,u,0,!0):new K_(i/2,r,s,a,o);let p=n/i;return p!==1&&e.scale(1,1,p),Object.assign(e,{userData:{...t,type:"ConeGeometry"}})}}}),cL=z(()=>{J(),j6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,height:n,depth:r,widthSegments:s,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:c}=t.parameters;return e=l===0?new ya(i,n,r,s,a,o):new lL(i,n,r,s,a,o,l,c),Object.assign(e,{userData:{...t,type:"CubeGeometry"}})}},$v=Math.PI/2,lL=class extends jt{constructor(t=1,e=1,i=1,n=1,r=1,s=1,a=0,o=4){super(),this.type="BoxGeometry",n=Math.floor(n),r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=(a=Math.min(a,t/2,e/2,i/2))>0,c=o+1,h=2*((s+1)*(r+1)+(n+1)*(s+1)+(n+1)*(r+1))+(l?4*c*(s+1+(n+1)+(r+1))+c*(c+1)/2*8:0),d=2*(s*r+n*s+n*r)+(l?4*o*(s+n+r):0),u=l?8*o*o:0,p=new Float32Array(3*h),f=new Float32Array(3*h),g=new Float32Array(2*h),m=h-1>65535?new Uint32Array(6*d+3*u):new Uint16Array(6*d+3*u),v=0,y=0,_=new Float64Array(c),b=new Float64Array(c),x=new Float64Array(c),w=new Float64Array(c);for(let O=0;O<c;O++){let D=O/o*$v;_[O]=Math.sin(D)*a,b[O]=(1-Math.cos(D))*a,x[O]=Math.sin(D),w[O]=Math.cos(D)}let S=c*(c+1)/2,E=new Float64Array(3*S),A=new Float64Array(3*S);{let O=new T(t/2,e/2,i/2);O.subScalar(a);let D=0;for(let F=0;F<=o;F++){let V=$v*(1-F/o),U=Math.cos(V),j=Math.sin(V),q=0;for(let rt=0;rt<=F;rt++){let it=U*Math.cos(q),Y=j,ht=U*Math.sin(q);E[3*D]=it,E[3*D+1]=Y,E[3*D+2]=ht,A[3*D]=O.x+it*a,A[3*D+1]=O.y+Y*a,A[3*D+2]=O.z+ht*a,D++,q+=$v/F}}}function P(O,D,F,V,U,j,q,rt,it,Y){let ht=(j-2*a)/it,ot=(q-2*a)/Y,ft=j/2-a,pt=q/2-a,tt=rt/2,mt=it+1,N=Y+1,L=0,H=new T;for(let $=0;$<N;$++){let B=$*ot-pt;for(let Z=0;Z<mt;Z++){let K=Z*ht-ft,k=3*(v+L),st=2*(v+L);H[O]=K*V,H[D]=B*U,H[F]=tt,p[k]=H.x,p[k+1]=H.y,p[k+2]=H.z,H[O]=0,H[D]=0,H[F]=rt>0?1:-1,f[k]=H.x,f[k+1]=H.y,f[k+2]=H.z,g[st]=Z/it,g[st+1]=1-$/Y,L+=1}}for(let $=0;$<Y;$++)for(let B=0;B<it;B++){let Z=v+B+mt*$,K=v+B+mt*($+1),k=v+(B+1)+mt*($+1),st=v+(B+1)+mt*$;m[y++]=Z,m[y++]=K,m[y++]=st,m[y++]=K,m[y++]=k,m[y++]=st}v+=L}function C(O,D,F,V,U,j,q,rt,it,Y){let ht=(q-2*a)/Y,ot=q/2-a,ft=rt/2-a,pt=it/2,tt=Y+1,mt=0,N=new T,L=new T;for(let H=0;H<o+1;H++){N[D]=(ft+_[H])*U,N[F]=(pt-b[H])*j,L[O]=0,L[D]=x[H]*Math.sign(N[D]),L[F]=w[H]*Math.sign(N[F]);for(let $=0;$<tt;$++){let B=$*ht-ot;N[O]=B*V;let Z=3*(v+mt),K=2*(v+mt);p[Z]=N.x,p[Z+1]=N.y,p[Z+2]=N.z,f[Z]=L.x,f[Z+1]=L.y,f[Z+2]=L.z,g[K]=$/Y,g[K+1]=0,mt+=1}}for(let H=0;H<o;H++)for(let $=0;$<Y;$++){let B=v+$+tt*H,Z=v+$+tt*(H+1),K=v+($+1)+tt*(H+1),k=v+($+1)+tt*H;m[y++]=B,m[y++]=Z,m[y++]=k,m[y++]=Z,m[y++]=K,m[y++]=k}v+=mt}function R(O,D,F){let V=O*D*F>0?(j,q,rt)=>{m[y++]=j,m[y++]=q,m[y++]=rt}:(j,q,rt)=>{m[y++]=j,m[y++]=rt,m[y++]=q},U=v;for(let j=0;j<S;j++){let q=3*j,rt=3*v,it=2*v;p[rt]=O*A[q],p[rt+1]=D*A[q+1],p[rt+2]=F*A[q+2],f[rt]=O*E[q],f[rt+1]=D*E[q+1],f[rt+2]=F*E[q+2],g[it]=0,g[it+1]=0,v++}for(let j=0;j<o;j++){let q=U+j*(j+1)/2,rt=U+(j+1)*(j+2)/2;V(q,rt+1,rt);for(let it=1;it<=j;it++)V(q+it-1,q+it,rt+it),V(q+it,rt+it+1,rt+it)}}P("z","y","x",-1,-1,i,e,t,s,r),P("z","y","x",1,-1,i,e,-t,s,r),P("x","z","y",1,1,t,i,e,n,s),P("x","z","y",1,-1,t,i,-e,n,s),P("x","y","z",1,-1,t,e,i,n,r),P("x","y","z",-1,-1,t,e,-i,n,r),a>0&&(C("z","y","x",-1,-1,1,i,e,t,s),C("z","y","x",1,-1,-1,i,e,t,s),C("z","y","x",-1,1,-1,i,e,t,s),C("z","y","x",1,1,1,i,e,t,s),C("x","y","z",-1,-1,-1,t,e,i,n),C("x","y","z",1,-1,1,t,e,i,n),C("x","y","z",-1,1,1,t,e,i,n),C("x","y","z",1,1,-1,t,e,i,n),C("y","x","z",-1,-1,1,e,t,i,r),C("y","x","z",1,-1,-1,e,t,i,r),C("y","x","z",1,1,1,e,t,i,r),C("y","x","z",-1,1,-1,e,t,i,r),R(1,1,1),R(-1,1,1),R(1,-1,1),R(-1,-1,1),R(1,1,-1),R(-1,1,-1),R(1,-1,-1),R(-1,-1,-1)),this.setIndex(new Ht(m,1)),this.setAttribute("position",new Ht(p,3)),this.setAttribute("normal",new Ht(f,3)),this.setAttribute("uv",new Ht(g,2))}}}),H6=z(()=>{J(),Ib=class extends jt{constructor(t=[],e=[],i="",n=1,r=.2,s=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,c=0;return function(){(r=Math.min(.99999,r))==0&&(s=0);let h={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new T,u=d.clone(),p=new vn,f=r*n,g=n-f,m=s+1,v=new T,y=(tt,mt)=>v.subVectors(tt,mt).normalize(),_=(tt,mt)=>Array(tt).fill(void 0).map(mt),b=_(t.length/3,(tt,mt)=>new T().fromArray(t,3*mt).setLength(n)),x=[],w=1e6;for(let tt=0;tt<b.length;tt++){let mt,N,L,H=b[tt],$=[],B=1e10,Z=-1;for(;(Z=e.indexOf(tt,Z+1))!=-1;){let dt=Z-Z%3;mt=e[dt+(Z+1)%3],N=e[dt+(Z+2)%3],L=H.distanceToSquared(b[mt]),B=Math.min(B,L),$.push([mt,N,L])}B+=1e-6;let K=[],k=0,st=$.length;for(let dt=0;dt<st;dt++){[mt,N,L]=$[k];let bt=x[mt]?.includes(tt)==1;L<=B&&K.push(mt+ +bt*w),k=$.findIndex(ct=>ct[0]==N)}x.push(K)}let S=[];{let tt,mt,N=0,L=0,H=h==3;for(let $=0;$<=s;$++){tt=$*($+1)/2,mt=($+1)*($+2)/2;for(let B=0;B<s-$;B++)[N,L]=[tt+B+$+2,mt+B+$+3],S.push(tt,mt,...H?[L,tt]:[N,mt],L,N),[tt,mt]=[N,L];S.push(tt,mt,tt+s+2)}}let E=0;for(let tt=0;tt<x.length;tt++)for(let mt=0;mt<h;mt++)x[tt][mt]<w&&E++;let A=b.length*h*S.length*3+E*m*6*3+2*E*3*3;a=new Float64Array(A),o=new Float64Array(A),l=new Float64Array(A/3*2);let P=(tt,mt,N)=>{let L=c/3*2;l[L]=Math.atan2(N,-tt)/2/Math.PI+.5,l[L+1]=1-(Math.atan2(-mt,Math.sqrt(tt*tt+N*N))/Math.PI+.5)},C=tt=>{a[c]=tt.x,a[c+1]=tt.y,a[c+2]=tt.z,o[c]=v.x,o[c+1]=v.y,o[c+2]=v.z,P(tt.x,tt.y,tt.z),c+=3},R=tt=>{a[c]=tt[0].x,a[c+1]=tt[0].y,a[c+2]=tt[0].z,o[c]=tt[1].x,o[c+1]=tt[1].y,o[c+2]=tt[1].z,P(tt[0].x,tt[0].y,tt[0].z),c+=3},O=(s+2)*(s+3)/2,D=new Float64Array(3*O),F=new Float64Array(3*O),V=new Float64Array(2*O),U=_(2*h*m,()=>new T),j=_(s*Math.max(0,s-1)/2,()=>new T),q=d.clone(),rt=d.clone(),it=d.clone(),Y=d.clone(),ht=d.clone(),ot=[],ft=_(b.length,()=>_(h,()=>d.clone()));for(let tt=0;tt<b.length;tt++){d.copy(b[tt]).normalize(),q.copy(d).multiplyScalar(g);let mt=x[tt];for(let K=0;K<mt.length;K++){let k=mt[K],st=mt[(K+1)%h];p.setFromPointsAndIndices(b,tt,k%w,st%w),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint(q,ft[tt][K])}let N=0,L=[],H=[],$=new T;s==0&&[...ft[tt]].reduce((K,k)=>K.add(k),$).multiplyScalar(1/h);for(let K=0;K<h;K++){let k=[],st=(K-1+h)%h,dt=ft[tt][st],bt=ft[tt][K];d.copy(dt).sub(q),u.copy(bt).sub(q);let ct=q.angleTo(d),It=d.angleTo(u),St=Math.cos(ct)*f;s==0?rt.copy($):rt.copy(q).setLength(g+St),L.push(St);let Rt=[rt,dt,bt];for(let Mt=0;Mt<2;Mt++){let W=Rt[Mt],_t=Rt[Mt+1];Y.subVectors(W,q),ht.subVectors(_t,q),it.crossVectors(Y,ht).normalize();for(let Dt=0;Dt<m;Dt++){let Gt=[ct,It][Mt]*Dt/m;d.copy(Y).applyAxisAngle(it,Gt).add(q),U[N++].copy(d),Mt&&(y(d,q),k.push([Dt==0?W:d.clone(),v.clone()]))}Mt&&(y(_t,q),k.push([_t,v.clone()]))}H.push(k)}ot.push(H);let B=2*m,Z=2;for(let K=0;K<h;K++){let k=B*K,st=B*((K+1)%h),dt=0,bt=[U[k]];for(let ct=1;ct<m;ct++){let It=U[k+ct],St=U[st+ct];bt.push(It);for(let Rt=1,Mt=ct-Z+1;Rt<=Mt;Rt++)d.lerpVectors(It,St,Rt/(Mt+1)),d.sub(q).setLength(L[K]).add(q),bt.push(j[dt++].copy(d));bt.push(St)}for(let ct=0;ct<m;ct++)bt.push(U[ct+m+k]);bt.push(U[st+m]);for(let ct=0,It=bt.length;ct<It;ct++){let St=bt[ct],Rt=3*ct,Mt=2*ct;D[Rt]=St.x,D[Rt+1]=St.y,D[Rt+2]=St.z,y(St,q),F[Rt]=v.x,F[Rt+1]=v.y,F[Rt+2]=v.z,V[Mt]=Math.atan2(St.z,-St.x)/2/Math.PI+.5,V[Mt+1]=1-(Math.atan2(-St.y,Math.sqrt(St.x*St.x+St.z*St.z))/Math.PI+.5)}for(let ct=0,It=S.length;ct<It;ct++){let St=3*S[ct],Rt=2*S[ct],Mt=c/3*2;a[c]=D[St],a[c+1]=D[St+1],a[c+2]=D[St+2],o[c]=F[St],o[c+1]=F[St+1],o[c+2]=F[St+2],l[Mt]=V[Rt],l[Mt+1]=V[Rt+1],c+=3}}}let pt=[];for(let tt=0;tt<x.length;tt++)for(let mt=0;mt<h;mt++){let N=x[tt][mt];if(N<w){let L=x[N].findIndex(B=>B%w==tt),H=ot[tt][mt],$=ot[N][L];for(let B=0;B<m;B++){let Z=H[B],K=$[m-B],k=H[B+1],st=$[m-(B+1)];R(Z),R(K),R(k),R(k),R(K),R(st)}pt.push(H[0][0],$[m][0],H[m][0],$[0][0])}}for(;pt.length;){let tt,mt,N,[L,H]=pt.splice(0,2);tt=H;let $=[L];for(;L!=tt;)$.push(tt),mt=pt.indexOf(tt),N=mt%2,tt=pt.splice(mt-N,2)[1-N];v.subVectors($[0],$[1]).cross(d.subVectors($[0],$[2])).normalize();let B=v.dot($[0])<0;B&&v.negate();for(let Z=1;Z<=$.length-2;Z++)C($[Z+ +B]),C($[Z+1-+B]),C($[0])}}(),function(){let h=new T,d=new T,u=new T,p=new T,f=new et,g=new et,m=new et,v=(b,x,w,S)=>{S<0&&b.x===1&&(l[x]=b.x-1),w.x===0&&w.z===0&&(l[x]=S/2/Math.PI+.5)};for(let b=0,x=0;b<c;b+=9,x+=6){h.set(a[b+0],a[b+1],a[b+2]),d.set(a[b+3],a[b+4],a[b+5]),u.set(a[b+6],a[b+7],a[b+8]),f.set(l[x+0],l[x+1]),g.set(l[x+2],l[x+3]),m.set(l[x+4],l[x+5]),p.copy(h).add(d).add(u).divideScalar(3);let w=_(p);v(f,x+0,h,w),v(g,x+2,d,w),v(m,x+4,u,w)}let y=c/3*2;for(let b=0;b<y;b+=6){let x=l[b+0],w=l[b+2],S=l[b+4],E=Math.max(x,w,S),A=Math.min(x,w,S);E>.9&&A<.1&&(x<.2&&(l[b+0]+=1),w<.2&&(l[b+2]+=1),S<.2&&(l[b+4]+=1))}function _(b){return Math.atan2(b.z,-b.x)}}(),this.setAttribute("position",new Ht(new Float32Array(a.subarray(0,c)),3)),this.setAttribute("normal",new Ht(new Float32Array(o.subarray(0,c)),3)),void this.setAttribute("uv",new Ht(new Float32Array(l.subarray(0,c/3*2)),2))}static fromJSON(t){return new Ib(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}}}),dL=z(()=>{H6(),J(),G6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=r===0&&s!==0?new E2(.5*e,s,a):new iA(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"DodecahedronGeometry"}})}},E2=class extends Ib{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r=1/n,s="DodecahedronGeometry";super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],s,t,e,i),this.type=s}static fromJSON(t){return new E2(t.radius,t.corner,t.cornerSides)}}});function uL(t,e=new et){let i=t.length();return e.set(-t.y/i,t.x/i)}function KZ(t){let e=new et;e.addVectors(t.v0,jc.subVectors(t.v1,t.v0).multiplyScalar(2/3));let i=new et;return i.addVectors(t.v2,o0.subVectors(t.v1,t.v2).multiplyScalar(2/3)),new ks(t.v0,e,i,t.v2)}function Jm(t,e,i=Number.EPSILON){return Math.abs(t-e)<i}function QZ(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function JZ(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function W6(t,e,i){let n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),s=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2));return Math.acos((r*r+n*n-s*s)/(2*r*n))}function tK(t,e,i){return fL(t,e)&&fL(e,i)&&ST(t.position,e.position,i.position)}function ST(t,e,i){return jc.copy(e).sub(t).cross(o0.copy(i).sub(t))===0}function eK(t,e,i,n,r){let s=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),a=(t.y+e.y)/2,o=(t.x+e.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(t.y-e.y)/s,c=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(e.x-t.x)/s;return n.set(o+l,a+c),r.set(o-l,a-c),[n,r]}function iK(t,e,i){return t.distanceTo(i)<e.distanceTo(i)?e:t}function nK(t,e,i,n,r,s){let a,o=e.x-t.x,l=e.y-t.y,c=i.x-t.x,h=i.y-t.y,d=Math.sqrt((o+c)*(o+c)+(l+h)*(l+h));return W6(e,t,i)>Math.PI&&(d*=-1),a=Jm(h,l)?(l+h)*(n/d-.5)*8/3/(o-c):(o+c)*(n/d-.5)*8/3/(h-l),r.set(e.x-a*l,e.y+a*o),s.set(i.x+a*h,i.y-a*c),[r,s]}function pL(t,e){return t.position.equals(t.controls[1].position)&&e.position.equals(e.controls[0].position)}function fL(t,e){return ST(t.position,t.controls[1].position,e.position)&&ST(t.position,e.controls[0].position,e.position)}function mL(t,e=12,i=!1){let n=[];for(let r=0,s=t.length;r<s;r++){let a=t[r],o=0;if(i&&a.roundedCurveCorner!==void 0){let l=.5*Vc(a.roundedCurveCorner,e);r>0&&(n[r-1]+=l),o+=l}a.curveAfter!==void 0&&(o+=Vc(a.curveAfter,e)),n.push(o)}return t.length>0&&i&&t[0].roundedCurveCorner!==void 0&&(n[t.length-1]+=.5*Vc(t[0].roundedCurveCorner,e)),n}function Vc(t,e=12){return t&&t instanceof zm?2*e:t&&(t instanceof gs||t instanceof nA)?1:t&&t instanceof O1?e*t.points.length:e}var Uu,Yv,Zv,$c,$1,jc,o0,q6,X6,$6,Y6,MT,ET,Kv,gL,vL,yL,_L,bL,ji,Z6=z(()=>{J(),Uu=1e-12,Yv=class{constructor(t){this.position=new et,this.startPosition=new et,this.uuid=Pt.generateUUID(),this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new Yv(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Zv=class extends Yv{constructor(t){super(t.position),this.parent=t}copy(t){return super.copy(t),this}clone(){return new Zv(this.parent).copy(this)}},$c=class extends Yv{constructor(t,e){super(e),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=t,this.controls.push(new Zv(this),new Zv(this))}static create(t,e){let i=new $c(t,new et(...e.position));return i.controls[0].position.set(...e.controlPrevious.position),i.controls[1].position.set(...e.controlNext.position),i.roundness=e.roundness,i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored,i}getOppositeControl(t){let e=this.controls.indexOf(t);return e===0?this.controls[1]:e===1?this.controls[0]:null}applyOffsetToControls(t,e=1){for(let i=0,n=this.controls.length;i<n;i++){let r=this.controls[i];this.position.distanceTo(r.position)<=e?r.position.copy(this.position):r.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new $c(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let t=this.curveBefore?.getTangentAt(1),e=this.curveAfter?.getTangentAt(0);return[t,e]}computeNormals(t=new et,e=new et){let[i,n]=this.computeTangents();return i&&n&&(uL(i,t),uL(n,e)),[t,e]}computeTangent(t=new et){let[e,i]=this.computeTangents();return e&&i&&t.copy(e).add(i).normalize(),t}computeNormal(t=new et){let[e,i]=this.computeNormals();return t.copy(e).add(i).normalize(),t}},$1=t=>t,jc=new et,o0=new et,q6=new et,X6=new et,$6=new et,Y6=new et,MT=new T,ET=new T}),Oh=z(()=>{J(),Z6(),Kv=new et,gL=new et,vL=new et,yL=new et,_L=new et,bL=new et,ji=class extends Xg{constructor(t=100,e=100){super(),this.points=[],this.shapeHoles=[],this.plane=new jr(new T(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this.isText=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=Pt.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=t,this._height=e}static createFromState(t,e,i){let n=new ji;return n.isClosed=t.isClosed,n.points=t.points.map(r=>$c.create(r.id,r.data)),typeof t.roundness=="number"&&(n.roundness=t.roundness),n.shapeHoles=t.shapeHoles.map(r=>ji.createFromState(r)),e!==void 0&&i!==void 0&&n.applySize(e,i),n.update(),n}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let e=0,i=this.points.length;e<i;e++)this.points[e].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(t){let e=this.points.length,i=this.points.findIndex(n=>n.uuid===t);if(i<0){let n=e;for(let r=0,s=this.shapeHoles.length;r<s;r++){let a=this.shapeHoles[r],o=a.points.length,l=a.getPointIndexById(t);if(!(l<0))return l+n;n+=o}}return i}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0){let e=this.points.length;for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=t-e;if(s<=r.points.length-1)return r.points[s];e+=r.points.length}}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let e=this.points.indexOf(t);if(e>=0)return e;if(e=this.points.length,this.shapeHoles.length>0)for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=r.points.indexOf(t);if(s>=0)return e+s;e+=r.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...t]}applySize(t,e){t===0&&(t=.001),e===0&&(e=.001),this._width=t,this._height=e}applyScale(t,e){let i=Kv.set(t,e);for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];s.position.multiply(i),s.controls[0].position.multiply(i),s.controls[1].position.multiply(i)}for(let n=0,r=this.shapeHoles.length;n<r;n++)this.shapeHoles[n].applyScale(t,e);this._update()}createPoint(t,e=0,i=Pt.generateUUID()){let n;n=t instanceof et?t:new et(t,e);let r=new $c(i,n);return r.roundness=this.roundness,r}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,e){this.points.splice(e,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(n.uuid===t)return n}for(let e=0,i=this.shapeHoles.length;e<i;e++){let n=this.shapeHoles[e].getPointByUuid(t);if(n)return n}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let e=this.points.indexOf(t);e>=0&&this.points.splice(e,1),this.needsUpdate=!0}removePointById(t){let e=this.points.find(i=>i.uuid===t);e&&this.removePoint(e)}update(){for(let t=0,e=this.shapeHoles.length;t<e;t++)this.shapeHoles[t].update();this._update()}extractShapePointsToBuffer(t,e=12,i=!1){this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e);let n=i?this.roundedCurveDivisions:this.curveDivisions;return function(r,s,a=12,o=!0){let l,c=ET.set(0,0,0),h=0,d=[];for(let u=0;u<s.length;u++){let p=$1(s[u]),f=jc,g=Vc(p,a);d.push(g);for(let m=0;m<=g;m++)if(p instanceof ks||p instanceof Ko||p instanceof gs){if(p.getPoint(m/g,f),c.set(f.x,f.y,0),l!==void 0&&JZ(l,c))continue;l===void 0&&(l=MT),l.copy(c),r.setXYZ(h,c.x,c.y,c.z),h++}}o&&h>1&&(r.getX(h-1)!==r.getX(0)||r.getY(h-1)!==r.getY(0)||r.getZ(h-1)!==r.getZ(0))&&(r.setXYZ(h,r.getX(0),r.getY(0),r.getZ(0)),h++)}(t,i?this.roundedCurves:this.curves,e,this.autoClose),n.reduce((r,s)=>r+s,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=mL(this.points,t,!1),this.roundedCurveDivisions=mL(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,e,i=12){return 2*function(n,r,s,a=12,o=!0){let l=ET.set(0,0,0),c=0,h=[];for(let d=0;d<r.length;d++){if(s[d]===!1)continue;let u,p=$1(r[d]),f=jc,g=Vc(p,a);h.push(g);for(let m=0;m<=g;m++)if(p instanceof ks||p instanceof Ko||p instanceof gs){if(p.getPoint(m/g,f),l.set(f.x,f.y,0),u?.equals(l))continue;u===void 0?u=MT:(n.setXYZ(c,u.x,u.y,u.z),c++,n.setXYZ(c,l.x,l.y,l.z),c++),u.copy(l)}}return o&&c>1&&!(n.getX(c-1)===n.getX(0)&&n.getY(c-1)===n.getY(0)&&n.getZ(c-1)===n.getZ(0))&&(n.setXYZ(c,n.getX(0),n.getY(0),n.getZ(0)),c++),h}(t,this.curves,e,i,this.autoClose).reduce((n,r)=>n+r,0)}extractShapePointsToFlatArray(t,e=12){return this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e),function(i,n,r=12,s=!0){let a,o=0;for(let l=0;l<n.length;l++){let c=$1(n[l]),h=Vc(c,r),d=jc;for(let u=0;u<=h;u++)if(c instanceof ks||c instanceof Ko||c instanceof gs){if(c.getPoint(u/h,d),a!==void 0&&QZ(a,d,Uu))continue;a===void 0&&(a=o0),a.copy(d),i.push(d.x,d.y),o++}}return Jm(i[0],i[i.length-2],Uu)&&Jm(i[1],i[i.length-1],Uu)&&(i.pop(),i.pop()),s&&o>1&&!(Jm(i[o-1],i[1],Uu)&&Jm(i[o-2],i[0],Uu))&&(i.push(i[0],i[1]),o++),i}(t,this.roundedCurves,e,this.autoClose)}getCurveIndexFromVertexId(t,e=!1){let i=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let n=e?this.roundedCurveDivisions:this.curveDivisions,r=0;e&&this.points[0].roundedCurveCorner!==void 0&&(r=.5*Vc(this.points[0].roundedCurveCorner,this.subdivision));let s=t-r;s<0&&(s+=n.reduce((a,o)=>a+o,0));for(let a=0,o=n.length;a<o;a++){let l=n[a];if(s<i+l)return[a,(s-i+1)/l];i+=l}return[0,1]}getCurveT(t,e,i){let n=this.points[t],r=this.points[t>=this.points.length-1?0:t+1],s=this.curveDivisions,a=s[t];if(pL(n,r)){let l=n.position.distanceTo(r.position);return n.position.distanceTo(Kv.set(i.x,i.y))/l}let o=0;for(let l=0;l<t;l++)o+=s[l];return(e-o)/a}dispose(){}_applyCurveForPoint(t,e){pL(e,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(e.controls[1].position.x,e.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let i=this.curves[this.curves.length-1];t.curveBefore=i,e.curveAfter=i;let n=i.clone();t.roundedCurveBefore=n,e.roundedCurveAfter=n,t.roundedCurveCorner=void 0,this.roundedCurves.push(n)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(e===0)this.moveTo(n.position.x,n.position.y);else{let r=this.points[e-1];this._applyCurveForPoint(n,r)}}let t=this.getLastPoint();if(t?.curveAfter&&(t.curveAfter=void 0),this.isClosed){let e=this.points[0],i=this.points[this.points.length-1];this._applyCurveForPoint(e,i)}if(this.points.length>2){let e=0;for(let i=0,n=this.points.length;i<n;i++){let r=this.points[i],s=this.points[i-1]??this.points[this.points.length-1],a=this.points[i+1]??this.points[0],o=r.roundness,l=s&&a&&tK(s,r,a);if(!r.controlsMoved()&&o>0&&!l){let c=r.curveBefore,h=r.curveAfter;if(c===void 0||h===void 0)continue;let d,u=r.roundedCurveBefore,p=r.roundedCurveAfter,f=c instanceof gs?c.v1.distanceTo(c.v2):c.getLength(),g=h instanceof gs?h.v1.distanceTo(h.v2):h.getLength(),m=Math.min(o,.499*f),v=Math.min(o,.499*g),y=Math.min(m,v),_=1-y/f,b=y/g,x=c.getPointAt(_,Kv),w=h.getPointAt(b,gL);if(this._subSplitCurve(c,u,_,x,void 0),this._subSplitCurve(h,p,b,void 0,w),this.useCubicForRoundedCorners){let S=W6(x,r.position,w)/2,E=Math.tan(S)*x.distanceTo(r.position),[A,P]=eK(x,w,E,vL,yL),C=iK(A,P,r.position),[R,O]=nK(C,x,w,E,_L,bL);d=new ks(x.clone(),R.clone(),O.clone(),w.clone())}else d=new Ko(x.clone(),r.position.clone(),w.clone());r.roundedCurveCorner=d,this.roundedCurves.splice(i+e,0,d),e++}}}}_subSplitCurve(t,e,i,n,r){if(!(t instanceof gs)){let s=t,a=e,o=s.getUtoTmapping(i,0),l=function(c,h,d,u,p=.5){let f=jc.subVectors(h,c).multiplyScalar(p).add(c),g=o0.subVectors(d,h).multiplyScalar(p).add(h),m=q6.subVectors(u,d).multiplyScalar(p).add(d),v=f,y=X6.subVectors(g,f).multiplyScalar(p).add(f),_=$6.subVectors(m,g).multiplyScalar(p).add(g),b=m,x=Y6.subVectors(_,y).multiplyScalar(p).add(y);return[c.x,c.y,v.x,v.y,y.x,y.y,x.x,x.y,_.x,_.y,b.x,b.y,u.x,u.y]}(s.v0,s.v1,s.v2,s.v3,o);return n!==void 0&&(a.v0.set(l[0],l[1]),a.v1.set(l[2],l[3]),a.v2.set(l[4],l[5]),a.v3.set(l[6],l[7])),r!==void 0&&(a.v0.set(l[6],l[7]),a.v1.set(l[8],l[9]),a.v2.set(l[10],l[11]),a.v3.set(l[12],l[13])),a}return n!==void 0&&e.v2.copy(n),r!==void 0&&e.v1.copy(r),e}clone(){let t=new ji(this._width,this._height);return t.points=this.points.map(e=>e.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(e=>e.clone()),t}toJSON(){return{points:this.points.reduce((t,e)=>t.concat(e.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){this.points=[],this.pointIDs=0;let e=t.points.length/7;for(let i=0;i<e;i++){let n=7*i,r=t.points[n+0],s=t.points[n+1],a=t.points[n+2],o=t.points[n+3],l=t.points[n+4],c=t.points[n+5],h=t.points[n+6],d=new $c(Pt.generateUUID(),new et(r,s));d.controls[0].position.set(a,o),d.controls[1].position.set(l,c),d.roundness=h,this.points.push(d)}return this.shapeHoles=t.shapeHoles?.length?t.shapeHoles.map(i=>{let n=new ji;return n.fromJSON(i),n}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t,e=!1){this.isText=e;let i=(n,r)=>{r instanceof ks&&r.v3.equals(n.position)&&n.controls[0].position.copy(r.v2)};return this.points=(n=>{let r,s,a=[];for(r=0,s=n.length;r<s;r++)n[r]instanceof Ko&&(n[r]=KZ(n[r]));for(r=0,s=n.length;r<s;r++){let c,h=n[r],d=r>0?n[r-1]:null;h instanceof ks?(c=this.createPoint(h.v0),c.controls[1].position.copy(h.v1)):h instanceof gs&&(c=this.createPoint(h.v1)),c!==void 0&&(d!==null&&i(c,d),a.push(c))}let o=n[n.length-1],l=!1;return o instanceof ks?o.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(o.v2),l=!0):o instanceof gs&&o.v2.equals(a[0].position)&&(l=!0),this.isClosed=l,a})(t.curves),t instanceof Xg&&(this.shapeHoles=t.holes.map(n=>{let r=new ji;return r.fromShape(n),r})),this.update(),this}updatePoint(t,e){let i=this.getPointByUuid(t);i&&(e.position!==void 0&&i.position.fromArray(e.position),e.roundness!==void 0&&(i.roundness=e.roundness),e.areControlsDirectionsMirrored!==void 0&&(i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(t,e){let i=this.getPointByUuid(t)?.controls[0];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}updateNextControl(t,e){let i=this.getPointByUuid(t)?.controls[1];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}}});function A2({x:t,y:e},i,n,r,s){return{x:t*i+r,y:e*n+s}}function rK(t,e){let i=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),n=Math.cos(t),r=Math.sin(t),s=Math.cos(t+e),a=Math.sin(t+e);return[{x:n-r*i,y:r+n*i},{x:s+a*i,y:a-s*i},{x:s,y:a}]}function xL(t,e,i,n){let r=t*n-e*i<0?-1:1,s=Math.min(1,Math.max(-1,t*i+e*n));return r*Math.acos(s)}var Y1,sK=z(()=>{Y1=2*Math.PI});function he(t,e){if(!t)throw e||"Assertion Failed!"}function Pg(t){var e=t.windingRule,i=e===void 0?Bi.ODD:e,n=t.elementType,r=n===void 0?gr.POLYGONS:n,s=t.polySize,a=s===void 0?3:s,o=t.vertexSize,l=o===void 0?2:o,c=t.normal,h=c===void 0?[0,0,1]:c,d=t.contours,u=d===void 0?[]:d,p=t.strict,f=p===void 0||p,g=t.debug,m=g!==void 0&&g;if(!u&&f)throw new Error("Contours can't be empty");if(u){var v=new K6;t.edgeCreateCallback&&(v.edgeCreateCallback=t.edgeCreateCallback),t.vertexIdCallback&&(v.vertexIdCallback=t.vertexIdCallback);for(var y=0;y<u.length;y++)v.addContour(l||2,u[y]);return v.tesselate(i,r,a,l,h,f),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:m?v.mesh:void 0}}}var Bi,gr,re,$d,$f,cc,T2,C2,P2,wL,Qv,D2,SL,ML,K6,x0=z(()=>{var t;(t=Bi||(Bi={}))[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(gr||(gr={})),re=function(){function e(){}return e.vertEq=function(i,n){return i.s===n.s&&i.t===n.t},e.vertLeq=function(i,n){return i.s<n.s||i.s===n.s&&i.t<=n.t},e.transLeq=function(i,n){return i.t<n.t||i.t===n.t&&i.s<=n.s},e.edgeGoesLeft=function(i){return e.vertLeq(i.Dst,i.Org)},e.edgeGoesRight=function(i){return e.vertLeq(i.Org,i.Dst)},e.vertL1dist=function(i,n){return Math.abs(i.s-n.s)+Math.abs(i.t-n.t)},e.edgeEval=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var s=n.s-i.s,a=r.s-n.s;return s+a>0?s<a?n.t-i.t+(i.t-r.t)*(s/(s+a)):n.t-r.t+(r.t-i.t)*(a/(s+a)):0},e.edgeSign=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var s=n.s-i.s,a=r.s-n.s;return s+a>0?(n.t-r.t)*s+(n.t-i.t)*a:0},e.transEval=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var s=n.t-i.t,a=r.t-n.t;return s+a>0?s<a?n.s-i.s+(i.s-r.s)*(s/(s+a)):n.s-r.s+(r.s-i.s)*(a/(s+a)):0},e.transSign=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var s=n.t-i.t,a=r.t-n.t;return s+a>0?(n.s-r.s)*s+(n.s-i.s)*a:0},e.vertCCW=function(i,n,r){return i.s*(n.t-r.t)+n.s*(r.t-i.t)+r.s*(i.t-n.t)>=0},e.interpolate=function(i,n,r,s){return(i=i<0?0:i)<=(r=r<0?0:r)?r===0?(n+s)/2:n+i/(i+r)*(s-n):s+r/(i+r)*(n-s)},e.intersect=function(i,n,r,s,a){var o,l,c;e.vertLeq(i,n)||(c=i,i=n,n=c),e.vertLeq(r,s)||(c=r,r=s,s=c),e.vertLeq(i,r)||(c=i,i=r,r=c,c=n,n=s,s=c),e.vertLeq(r,n)?e.vertLeq(n,s)?((o=e.edgeEval(i,r,n))+(l=e.edgeEval(r,n,s))<0&&(o=-o,l=-l),a.s=e.interpolate(o,r.s,l,n.s)):((o=e.edgeSign(i,r,n))+(l=-e.edgeSign(i,s,n))<0&&(o=-o,l=-l),a.s=e.interpolate(o,r.s,l,s.s)):a.s=(r.s+n.s)/2,e.transLeq(i,n)||(c=i,i=n,n=c),e.transLeq(r,s)||(c=r,r=s,s=c),e.transLeq(i,r)||(c=i,i=r,r=c,c=n,n=s,s=c),e.transLeq(r,n)?e.transLeq(n,s)?((o=e.transEval(i,r,n))+(l=e.transEval(r,n,s))<0&&(o=-o,l=-l),a.t=e.interpolate(o,r.t,l,n.t)):((o=e.transSign(i,r,n))+(l=-e.transSign(i,s,n))<0&&(o=-o,l=-l),a.t=e.interpolate(o,r.t,l,s.t)):a.t=(r.t+n.t)/2},e}(),$d=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},$f=function(){function e(i){this.side=i,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(i){this.Sym.Lface=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(i){this.Sym.Org=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(i){this.Sym.Lnext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(i){this.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(i){this.Lnext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(i){this.Sym.Onext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(i){this.Sym.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(i){this.Sym.Lnext.Sym=i},enumerable:!0,configurable:!0}),e}(),cc=function(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0},T2=function(){function e(){var i=new cc,n=new $d,r=new $f(0),s=new $f(1);i.next=i.prev=i,i.anEdge=null,n.next=n.prev=n,r.next=r,r.Sym=s,s.next=s,s.Sym=r,this.vHead=i,this.fHead=n,this.eHead=r,this.eHeadSym=s}return e.prototype.makeEdge_=function(i){var n=new $f(0),r=new $f(1);i.Sym.side<i.side&&(i=i.Sym);var s=i.Sym.next;return r.next=s,s.Sym.next=n,n.next=i,i.Sym.next=r,n.Sym=r,n.Onext=n,n.Lnext=r,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,r.Sym=n,r.Onext=r,r.Lnext=n,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,n},e.prototype.splice_=function(i,n){var r=i.Onext,s=n.Onext;r.Sym.Lnext=n,s.Sym.Lnext=i,i.Onext=s,n.Onext=r},e.prototype.makeVertex_=function(i,n,r){var s=i;he(s,"Vertex can't be null!");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=n;var o=n;do o.Org=s,o=o.Onext;while(o!==n)},e.prototype.makeFace_=function(i,n,r){var s=i;he(s,"Face can't be null");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=n,s.trail=null,s.marked=!1,s.inside=r.inside;var o=n;do o.Lface=s,o=o.Lnext;while(o!==n)},e.prototype.killEdge_=function(i){i.Sym.side<i.side&&(i=i.Sym);var n=i.next,r=i.Sym.next;n.Sym.next=r,r.Sym.next=n},e.prototype.killVertex_=function(i,n){var r=i.anEdge,s=r;do s.Org=n,s=s.Onext;while(s!==r);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.killFace_=function(i,n){var r=i.anEdge,s=r;do s.Lface=n,s=s.Lnext;while(s!==r);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.makeEdge=function(){var i=new cc,n=new cc,r=new $d,s=this.makeEdge_(this.eHead);return this.makeVertex_(i,s,this.vHead),this.makeVertex_(n,s.Sym,this.vHead),this.makeFace_(r,s,this.fHead),s},e.prototype.splice=function(i,n){var r=!1,s=!1;if(i!==n){if(n.Org!==i.Org&&(s=!0,this.killVertex_(n.Org,i.Org)),n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(n,i),!s){var a=new cc;this.makeVertex_(a,n,i.Org),i.Org.anEdge=i}if(!r){var o=new $d;this.makeFace_(o,n,i.Lface),i.Lface.anEdge=i}}},e.prototype.delete=function(i){var n=i.Sym,r=!1;if(i.Lface!==i.Rface&&(r=!0,this.killFace_(i.Lface,i.Rface)),i.Onext===i)this.killVertex_(i.Org,null);else if(i.Rface.anEdge=i.Oprev,i.Org.anEdge=i.Onext,this.splice_(i,i.Oprev),!r){var s=new $d;this.makeFace_(s,i,i.Lface)}n.Onext===n?(this.killVertex_(n.Org,null),this.killFace_(n.Lface,null)):(i.Lface.anEdge=n.Oprev,n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),this.killEdge_(i)},e.prototype.addEdgeVertex=function(i){var n=this.makeEdge_(i),r=n.Sym;this.splice_(n,i.Lnext),n.Org=i.Dst;var s=new cc;return this.makeVertex_(s,r,n.Org),n.Lface=r.Lface=i.Lface,n},e.prototype.splitEdge=function(i){var n=this.addEdgeVertex(i).Sym;return this.splice_(i.Sym,i.Sym.Oprev),this.splice_(i.Sym,n),i.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=i.Rface,n.winding=i.winding,n.Sym.winding=i.Sym.winding,n.idx=i.idx,n.Sym.idx=i.Sym.idx,n},e.prototype.connect=function(i,n){var r=!1,s=this.makeEdge_(i),a=s.Sym;if(n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(s,i.Lnext),this.splice_(a,n),s.Org=i.Dst,a.Org=n.Org,s.Lface=a.Lface=i.Lface,i.Lface.anEdge=a,!r){var o=new $d;this.makeFace_(o,s,i.Lface)}return s},e.prototype.zapFace=function(i){var n,r,s,a,o,l=i.anEdge;r=l.Lnext;do r=(n=r).Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),(s=n.Sym).Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(n));while(n!=l);a=i.prev,(o=i.next).prev=a,a.next=o},e.prototype.countFaceVerts_=function(i){var n=i.anEdge,r=0;do r++,n=n.Lnext;while(n!==i.anEdge);return r},e.prototype.mergeConvexFaces=function(i){var n,r,s,a,o;for(n=this.fHead.next;n!==this.fHead;n=n.next)if(n.inside)for(o=(r=n.anEdge).Org;s=r.Lnext,(a=r.Sym)&&a.Lface&&a.Lface.inside&&this.countFaceVerts_(n)+this.countFaceVerts_(a.Lface)-2<=i&&re.vertCCW(r.Lprev.Org,r.Org,a.Lnext.Lnext.Org)&&re.vertCCW(a.Lprev.Org,a.Org,r.Lnext.Lnext.Org)&&(s=a.Lnext,this.delete(a),r=null,a=null),!r||r.Lnext.Org!==o;)r=s;return!0},e.prototype.check=function(){var i,n,r,s,a,o,l=this.fHead,c=this.vHead,h=this.eHead;for(n=l,n=l;(i=n.next)!==l;n=i){he(i.prev===n),a=i.anEdge;do he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a),he(a.Lface===i),a=a.Lnext;while(a!==i.anEdge)}for(he(i.prev===n&&i.anEdge===null),s=c,s=c;(r=s.next)!==c;s=r){he(r.prev===s),a=r.anEdge;do he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a),he(a.Org===r),a=a.Onext;while(a!==r.anEdge)}for(he(r.prev===s&&r.anEdge===null),o=h,o=h;(a=o.next)!==h;o=a)he(a.Sym.next===o.Sym),he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Org!==null),he(a.Dst!==null),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a);he(a.Sym.next===o.Sym&&a.Sym===this.eHeadSym&&a.Sym.Sym===a&&a.Org===null&&a.Dst===null&&a.Lface===null&&a.Rface===null)},e}(),C2=function(){this.handle=null},P2=function(){this.key=null,this.node=0},wL=function(){function e(i,n){this.leq=n,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=i,this.nodes=[],this.handles=[];for(var r=0;r<i+1;r++)this.nodes[r]=new C2,this.handles[r]=new P2;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(i){var n,r,s,a=this.nodes,o=this.handles;for(n=a[i].handle;;){if((s=i<<1)<this.size&&this.leq(o[a[s+1].handle].key,o[a[s].handle].key)&&++s,he(s<=this.max),r=a[s].handle,s>this.size||this.leq(o[n].key,o[r].key)){a[i].handle=n,o[n].node=i;break}a[i].handle=r,o[r].node=i,i=s}},e.prototype.floatUp_=function(i){var n,r,s,a=this.nodes,o=this.handles;for(n=a[i].handle;;){if(r=a[s=i>>1].handle,s===0||this.leq(o[r].key,o[n].key)){a[i].handle=n,o[n].node=i;break}a[i].handle=r,o[r].node=i,i=s}},e.prototype.init=function(){for(var i=this.size;i>=1;--i)this.floatDown_(i);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(i){var n,r;if(2*(n=++this.size)>this.max){var s,a;for(this.max*=2,a=this.nodes.length,this.nodes.length=this.max+1,s=a;s<this.nodes.length;s++)this.nodes[s]=new C2;for(a=this.handles.length,this.handles.length=this.max+1,s=a;s<this.handles.length;s++)this.handles[s]=new P2}return this.freeList===0?r=n:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[n].handle=r,this.handles[r].node=n,this.handles[r].key=i,this.initialized&&this.floatUp_(n),r},e.prototype.extractMin=function(){var i=this.nodes,n=this.handles,r=i[1].handle,s=n[r].key;return this.size>0&&(i[1].handle=i[this.size].handle,n[i[1].handle].node=1,n[r].key=null,n[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),s},e.prototype.delete=function(i){var n,r=this.nodes,s=this.handles;he(i>=1&&i<=this.max&&s[i].key!==null),r[n=s[i].node].handle=r[this.size].handle,s[r[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(s[r[n>>1].handle].key,s[r[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),s[i].key=null,s[i].node=this.freeList,this.freeList=i},e}(),Qv=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},D2=function(){this.key=null,this.next=null,this.prev=null},SL=function(){function e(i,n){this.frame=i,this.leq=n,this.head=new D2,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(i){return this.insertBefore(this.head,i)},e.prototype.search=function(i){var n=this.head;do n=n.next;while(n.key!==null&&!this.leq(this.frame,i,n.key));return n},e.prototype.insertBefore=function(i,n){do i=i.prev;while(i.key!==null&&!this.leq(this.frame,i.key,n));var r=new D2;return r.key=n,r.next=i.next,i.next.prev=r,r.prev=i,i.next=r,r},e.prototype.delete=function(i){i.next.prev=i.prev,i.prev.next=i.next},e}(),ML=function(){function e(){}return e.regionBelow=function(i){return i.nodeUp.prev.key},e.regionAbove=function(i){return i.nodeUp.next.key},e.debugEvent=function(i){},e.addWinding=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.edgeLeq=function(i,n,r){var s=i.event,a=n.eUp,o=r.eUp;return a.Dst===s?o.Dst===s?re.vertLeq(a.Org,o.Org)?re.edgeSign(o.Dst,a.Org,o.Org)<=0:re.edgeSign(a.Dst,o.Org,a.Org)>=0:re.edgeSign(o.Dst,s,o.Org)<=0:o.Dst===s?re.edgeSign(a.Dst,s,a.Org)>=0:re.edgeEval(a.Dst,s,a.Org)>=re.edgeEval(o.Dst,s,o.Org)},e.deleteRegion=function(i,n){n.fixUpperEdge&&he(n.eUp.winding===0),n.eUp.activeRegion=null,i.dict.delete(n.nodeUp)},e.fixUpperEdge=function(i,n,r){he(n.fixUpperEdge),i.mesh.delete(n.eUp),n.fixUpperEdge=!1,n.eUp=r,r.activeRegion=n},e.topLeftRegion=function(i,n){var r,s=n.eUp.Org;do n=e.regionAbove(n);while(n.eUp.Org===s);if(n.fixUpperEdge){if((r=i.mesh.connect(e.regionBelow(n).eUp.Sym,n.eUp.Lnext))===null)return null;e.fixUpperEdge(i,n,r),n=e.regionAbove(n)}return n},e.topRightRegion=function(i){var n=i.eUp.Dst;do i=e.regionAbove(i);while(i.eUp.Dst===n);return i},e.addRegionBelow=function(i,n,r){var s=new Qv;return s.eUp=r,s.nodeUp=i.dict.insertBefore(n.nodeUp,s),s.fixUpperEdge=!1,s.sentinel=!1,s.dirty=!1,r.activeRegion=s,s},e.isWindingInside=function(i,n){switch(i.windingRule){case Bi.ODD:return!!(1&n);case Bi.NONZERO:return n!==0;case Bi.POSITIVE:return n>0;case Bi.NEGATIVE:return n<0;case Bi.ABS_GEQ_TWO:return n>=2||n<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(i,n){n.windingNumber=e.regionAbove(n).windingNumber+n.eUp.winding,n.inside=e.isWindingInside(i,n.windingNumber)},e.finishRegion=function(i,n){var r=n.eUp,s=r.Lface;s.inside=n.inside,s.anEdge=r,e.deleteRegion(i,n)},e.finishLeftRegions=function(i,n,r){for(var s,a=null,o=n,l=n.eUp;o!==r;){if(o.fixUpperEdge=!1,(s=(a=e.regionBelow(o)).eUp).Org!=l.Org){if(!a.fixUpperEdge){e.finishRegion(i,o);break}s=i.mesh.connect(l.Lprev,s.Sym),e.fixUpperEdge(i,a,s)}l.Onext!==s&&(i.mesh.splice(s.Oprev,s),i.mesh.splice(l,s)),e.finishRegion(i,o),l=a.eUp,o=a}return l},e.addRightEdges=function(i,n,r,s,a,o){var l,c,h,d,u=!0;h=r;do he(re.vertLeq(h.Org,h.Dst)),e.addRegionBelow(i,n,h.Sym),h=h.Onext;while(h!==s);for(a===null&&(a=e.regionBelow(n).eUp.Rprev),c=n,d=a;(h=(l=e.regionBelow(c)).eUp.Sym).Org===d.Org;)h.Onext!==d&&(i.mesh.splice(h.Oprev,h),i.mesh.splice(d.Oprev,h)),l.windingNumber=c.windingNumber-h.winding,l.inside=e.isWindingInside(i,l.windingNumber),c.dirty=!0,!u&&e.checkForRightSplice(i,c)&&(e.addWinding(h,d),e.deleteRegion(i,c),i.mesh.delete(d)),u=!1,c=l,d=h;c.dirty=!0,he(c.windingNumber-h.winding===l.windingNumber),o&&e.walkDirtyRegions(i,c)},e.spliceMergeVertices=function(i,n,r){i.mesh.splice(n,r)},e.vertexWeights=function(i,n,r){var s=re.vertL1dist(n,i),a=re.vertL1dist(r,i),o=.5*a/(s+a),l=.5*s/(s+a);i.coords[0]+=o*n.coords[0]+l*r.coords[0],i.coords[1]+=o*n.coords[1]+l*r.coords[1],i.coords[2]+=o*n.coords[2]+l*r.coords[2]},e.getIntersectData=function(i,n,r,s,a,o){n.coords[0]=n.coords[1]=n.coords[2]=0,n.idx=-1,e.vertexWeights(n,r,s),e.vertexWeights(n,a,o)},e.checkForRightSplice=function(i,n){var r=e.regionBelow(n),s=n.eUp,a=r.eUp;if(re.vertLeq(s.Org,a.Org)){if(re.edgeSign(a.Dst,s.Org,a.Org)>0)return!1;re.vertEq(s.Org,a.Org)?s.Org!==a.Org&&(i.pq.delete(s.Org.pqHandle),e.spliceMergeVertices(i,a.Oprev,s)):(i.mesh.splitEdge(a.Sym),i.mesh.splice(s,a.Oprev),n.dirty=r.dirty=!0)}else{if(re.edgeSign(s.Dst,a.Org,s.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(s.Sym),i.mesh.splice(a.Oprev,s)}return!0},e.checkForLeftSplice=function(i,n){var r,s=e.regionBelow(n),a=n.eUp,o=s.eUp;if(he(!re.vertEq(a.Dst,o.Dst)),re.vertLeq(a.Dst,o.Dst)){if(re.edgeSign(a.Dst,o.Dst,a.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,r=i.mesh.splitEdge(a),i.mesh.splice(o.Sym,r),r.Lface.inside=n.inside}else{if(re.edgeSign(o.Dst,a.Dst,o.Org)>0)return!1;n.dirty=s.dirty=!0,r=i.mesh.splitEdge(o),i.mesh.splice(a.Lnext,o.Sym),r.Rface.inside=n.inside}return!0},e.checkForIntersect=function(i,n){var r,s,a=e.regionBelow(n),o=n.eUp,l=a.eUp,c=o.Org,h=l.Org,d=o.Dst,u=l.Dst,p=new cc;if(he(!re.vertEq(u,d)),he(re.edgeSign(d,i.event,c)<=0),he(re.edgeSign(u,i.event,h)>=0),he(c!==i.event&&h!==i.event),he(!n.fixUpperEdge&&!a.fixUpperEdge),c===h||Math.min(c.t,d.t)>Math.max(h.t,u.t))return!1;if(re.vertLeq(c,h)){if(re.edgeSign(u,c,h)>0)return!1}else if(re.edgeSign(d,h,c)<0)return!1;return e.debugEvent(i),re.intersect(d,c,u,h,p),he(Math.min(c.t,d.t)<=p.t),he(p.t<=Math.max(h.t,u.t)),he(Math.min(u.s,d.s)<=p.s),he(p.s<=Math.max(h.s,c.s)),re.vertLeq(p,i.event)&&(p.s=i.event.s,p.t=i.event.t),r=re.vertLeq(c,h)?c:h,re.vertLeq(r,p)&&(p.s=r.s,p.t=r.t),re.vertEq(p,c)||re.vertEq(p,h)?(e.checkForRightSplice(i,n),!1):!re.vertEq(d,i.event)&&re.edgeSign(d,i.event,p)>=0||!re.vertEq(u,i.event)&&re.edgeSign(u,i.event,p)<=0?u===i.event?(i.mesh.splitEdge(o.Sym),i.mesh.splice(l.Sym,o),n=e.topLeftRegion(i,n),o=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),a),e.addRightEdges(i,n,o.Oprev,o,o,!0),!0):d===i.event?(i.mesh.splitEdge(l.Sym),i.mesh.splice(o.Lnext,l.Oprev),a=n,n=e.topRightRegion(n),s=e.regionBelow(n).eUp.Rprev,a.eUp=l.Oprev,l=e.finishLeftRegions(i,a,null),e.addRightEdges(i,n,l.Onext,o.Rprev,s,!0),!0):(re.edgeSign(d,i.event,p)>=0&&(e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(o.Sym),o.Org.s=i.event.s,o.Org.t=i.event.t),re.edgeSign(u,i.event,p)<=0&&(n.dirty=a.dirty=!0,i.mesh.splitEdge(l.Sym),l.Org.s=i.event.s,l.Org.t=i.event.t),!1):(i.mesh.splitEdge(o.Sym),i.mesh.splitEdge(l.Sym),i.mesh.splice(l.Oprev,o),o.Org.s=p.s,o.Org.t=p.t,o.Org.pqHandle=i.pq.insert(o.Org),e.getIntersectData(i,o.Org,c,d,h,u),e.regionAbove(n).dirty=n.dirty=a.dirty=!0,!1)},e.walkDirtyRegions=function(i,n){for(var r,s,a=e.regionBelow(n);;){for(;a.dirty;)n=a,a=e.regionBelow(a);if(!n.dirty&&(a=n,(n=e.regionAbove(n))===null||!n.dirty))return;if(n.dirty=!1,r=n.eUp,s=a.eUp,r.Dst!==s.Dst&&e.checkForLeftSplice(i,n)&&(a.fixUpperEdge?(e.deleteRegion(i,a),i.mesh.delete(s),s=(a=e.regionBelow(n)).eUp):n.fixUpperEdge&&(e.deleteRegion(i,n),i.mesh.delete(r),r=(n=e.regionAbove(a)).eUp)),r.Org!==s.Org){if(r.Dst===s.Dst||n.fixUpperEdge||a.fixUpperEdge||r.Dst!==i.event&&s.Dst!==i.event)e.checkForRightSplice(i,n);else if(e.checkForIntersect(i,n))return}r.Org===s.Org&&r.Dst===s.Dst&&(e.addWinding(s,r),e.deleteRegion(i,n),i.mesh.delete(r),n=e.regionAbove(a))}},e.connectRightVertex=function(i,n,r){var s,a=r.Onext,o=e.regionBelow(n),l=n.eUp,c=o.eUp,h=!1;l.Dst!==c.Dst&&e.checkForIntersect(i,n),re.vertEq(l.Org,i.event)&&(i.mesh.splice(a.Oprev,l),n=e.topLeftRegion(i,n),a=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),o),h=!0),re.vertEq(c.Org,i.event)&&(i.mesh.splice(r,c.Oprev),r=e.finishLeftRegions(i,o,null),h=!0),h?e.addRightEdges(i,n,r.Onext,a,a,!0):(s=re.vertLeq(c.Org,l.Org)?c.Oprev:l,s=i.mesh.connect(r.Lprev,s),e.addRightEdges(i,n,s,s.Onext,s.Onext,!1),s.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(i,n))},e.connectLeftDegenerate=function(i,n,r){var s,a,o,l,c;return s=n.eUp,re.vertEq(s.Org,r)?(he(!1),void e.spliceMergeVertices(i,s,r.anEdge)):re.vertEq(s.Dst,r)?(he(!1),n=e.topRightRegion(n),a=l=(o=(c=e.regionBelow(n)).eUp.Sym).Onext,c.fixUpperEdge&&(he(a!==o),e.deleteRegion(i,c),i.mesh.delete(o),o=a.Oprev),i.mesh.splice(r.anEdge,o),re.edgeGoesLeft(a)||(a=null),void e.addRightEdges(i,n,o.Onext,l,a,!0)):(i.mesh.splitEdge(s.Sym),n.fixUpperEdge&&(i.mesh.delete(s.Onext),n.fixUpperEdge=!1),i.mesh.splice(r.anEdge,s),void e.sweepEvent(i,r))},e.connectLeftVertex=function(i,n){var r,s,a,o,l,c,h=new Qv;if(h.eUp=n.anEdge.Sym,r=i.dict.search(h).key,s=e.regionBelow(r)){if(o=r.eUp,l=s.eUp,re.edgeSign(o.Dst,n,o.Org)===0)return void e.connectLeftDegenerate(i,r,n);a=re.vertLeq(l.Dst,o.Dst)?r:s,r.inside||a.fixUpperEdge?(c=a===r?i.mesh.connect(n.anEdge.Sym,o.Lnext):i.mesh.connect(l.Dnext,n.anEdge).Sym,a.fixUpperEdge?e.fixUpperEdge(i,a,c):e.computeWinding(i,e.addRegionBelow(i,r,c)),e.sweepEvent(i,n)):e.addRightEdges(i,r,n.anEdge,n.anEdge,null,!0)}},e.sweepEvent=function(i,n){i.event=n,e.debugEvent(i);for(var r=n.anEdge;r.activeRegion===null;)if((r=r.Onext)===n.anEdge)return void e.connectLeftVertex(i,n);var s=e.topLeftRegion(i,r.activeRegion);he(s!==null);var a=e.regionBelow(s),o=a.eUp,l=e.finishLeftRegions(i,a,null);l.Onext===o?e.connectRightVertex(i,s,l):e.addRightEdges(i,s,l.Onext,o,o,!0)},e.addSentinel=function(i,n,r,s){var a=new Qv,o=i.mesh.makeEdge();o.Org.s=r,o.Org.t=s,o.Dst.s=n,o.Dst.t=s,i.event=o.Dst,a.eUp=o,a.windingNumber=0,a.inside=!1,a.fixUpperEdge=!1,a.sentinel=!0,a.dirty=!1,a.nodeUp=i.dict.insert(a)},e.initEdgeDict=function(i){i.dict=new SL(i,e.edgeLeq);var n=i.bmax[0]-i.bmin[0],r=i.bmax[1]-i.bmin[1],s=i.bmin[0]-n,a=i.bmax[0]+n,o=i.bmin[1]-r,l=i.bmax[1]+r;e.addSentinel(i,s,a,o),e.addSentinel(i,s,a,l)},e.doneEdgeDict=function(i){for(var n,r=0;(n=i.dict.min().key)!==null;)n.sentinel||(he(n.fixUpperEdge),he(++r===1)),he(n.windingNumber===0),e.deleteRegion(i,n)},e.removeDegenerateEdges=function(i){var n,r,s,a=i.mesh.eHead;for(n=a.next;n!==a;n=r)r=n.next,s=n.Lnext,re.vertEq(n.Org,n.Dst)&&n.Lnext.Lnext!==n&&(e.spliceMergeVertices(i,s,n),i.mesh.delete(n),s=(n=s).Lnext),s.Lnext===n&&(s!==n&&((s===r||s===r.Sym)&&(r=r.next),i.mesh.delete(s)),(n===r||n===r.Sym)&&(r=r.next),i.mesh.delete(n))},e.initPriorityQ=function(i){var n,r,s,a=0;for(r=(s=i.mesh.vHead).next;r!==s;r=r.next)a++;for(a+=8,n=i.pq=new wL(a,re.vertLeq),r=(s=i.mesh.vHead).next;r!==s;r=r.next)r.pqHandle=n.insert(r);return r===s&&(n.init(),!0)},e.donePriorityQ=function(i){i.pq=null},e.removeDegenerateFaces=function(i,n){var r,s,a;for(r=n.fHead.next;r!==n.fHead;r=s)s=r.next,he((a=r.anEdge).Lnext!==a),a.Lnext.Lnext===a&&(e.addWinding(a.Onext,a),i.mesh.delete(a));return!0},e.computeInterior=function(i,n){var r,s;if(n===void 0&&(n=!0),e.removeDegenerateEdges(i),!e.initPriorityQ(i))return!1;for(e.initEdgeDict(i);(r=i.pq.extractMin())!==null;){for(;(s=i.pq.min())!==null&&re.vertEq(s,r);)s=i.pq.extractMin(),e.spliceMergeVertices(i,r.anEdge,s.anEdge);e.sweepEvent(i,r)}return i.event=i.dict.min().key.eUp.Org,e.debugEvent(i),e.doneEdgeDict(i),e.donePriorityQ(i),!!e.removeDegenerateFaces(i,i.mesh)&&(n&&i.mesh.check(),!0)},e}(),K6=function(){function e(){this.mesh=new T2,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Bi.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(i,n){return i[0]*n[0]+i[1]*n[1]+i[2]*n[2]},e.prototype.normalize_=function(i){var n=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(!n)throw"Zero-size vector!";n=Math.sqrt(n),i[0]/=n,i[1]/=n,i[2]/=n},e.prototype.longAxis_=function(i){var n=0;return Math.abs(i[1])>Math.abs(i[0])&&(n=1),Math.abs(i[2])>Math.abs(i[n])&&(n=2),n},e.prototype.computeNormal_=function(i){var n,r,s,a,o,l,c=[0,0,0],h=[0,0,0],d=[0,0,0],u=[0,0,0],p=[0,0,0],f=[null,null,null],g=[null,null,null],m=this.mesh.vHead;n=m.next;for(var v=0;v<3;++v)a=n.coords[v],h[v]=a,g[v]=n,c[v]=a,f[v]=n;for(n=m.next;n!==m;n=n.next)for(var y=0;y<3;++y)(a=n.coords[y])<h[y]&&(h[y]=a,g[y]=n),a>c[y]&&(c[y]=a,f[y]=n);var _=0;if(c[1]-h[1]>c[0]-h[0]&&(_=1),c[2]-h[2]>c[_]-h[_]&&(_=2),h[_]>=c[_])return i[0]=0,i[1]=0,void(i[2]=1);for(l=0,r=g[_],s=f[_],d[0]=r.coords[0]-s.coords[0],d[1]=r.coords[1]-s.coords[1],d[2]=r.coords[2]-s.coords[2],n=m.next;n!==m;n=n.next)u[0]=n.coords[0]-s.coords[0],u[1]=n.coords[1]-s.coords[1],u[2]=n.coords[2]-s.coords[2],p[0]=d[1]*u[2]-d[2]*u[1],p[1]=d[2]*u[0]-d[0]*u[2],p[2]=d[0]*u[1]-d[1]*u[0],(o=p[0]*p[0]+p[1]*p[1]+p[2]*p[2])>l&&(l=o,i[0]=p[0],i[1]=p[1],i[2]=p[2]);l<=0&&(i[0]=i[1]=i[2]=0,i[this.longAxis_(d)]=1)},e.prototype.checkOrientation_=function(){for(var i,n,r=this.mesh.fHead,s=this.mesh.vHead,a=0,o=r.next;o!==r;o=o.next)if(!((n=o.anEdge).winding<=0))do a+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(a<0){for(i=s.next;i!==s;i=i.next)i.t=-i.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var i,n,r=this.mesh.vHead,s=[0,0,0],a=!1;s[0]=this.normal[0],s[1]=this.normal[1],s[2]=this.normal[2],!s[0]&&!s[1]&&!s[2]&&(this.computeNormal_(s),a=!0),i=this.sUnit,n=this.tUnit;var o=this.longAxis_(s);i[o]=0,i[(o+1)%3]=1,i[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=s[o]>0?1:-1;for(var l=r.next;l!==r;l=l.next)l.s=this.dot_(l.coords,i),l.t=this.dot_(l.coords,n);a&&this.checkOrientation_();for(var c=!0,h=r.next;h!==r;h=h.next)c?(this.bmin[0]=this.bmax[0]=h.s,this.bmin[1]=this.bmax[1]=h.t,c=!1):(h.s<this.bmin[0]&&(this.bmin[0]=h.s),h.s>this.bmax[0]&&(this.bmax[0]=h.s),h.t<this.bmin[1]&&(this.bmin[1]=h.t),h.t>this.bmax[1]&&(this.bmax[1]=h.t))},e.prototype.addWinding_=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.prototype.tessellateMonoRegion_=function(i,n){var r,s;if((r=n.anEdge).Lnext===r||r.Lnext.Lnext===r)throw"Mono region invalid";for(;re.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;re.vertLeq(r.Org,r.Dst);r=r.Lnext);for(s=r.Lprev;r.Lnext!==s;)if(re.vertLeq(r.Dst,s.Org)){for(;s.Lnext!==r&&(re.edgeGoesLeft(s.Lnext)||re.edgeSign(s.Org,s.Dst,s.Lnext.Dst)<=0);)s=i.connect(s.Lnext,s).Sym;s=s.Lprev}else{for(;s.Lnext!==r&&(re.edgeGoesRight(r.Lprev)||re.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)r=i.connect(r,r.Lprev).Sym;r=r.Lnext}if(s.Lnext===r)throw"Mono region invalid";for(;s.Lnext.Lnext!==r;)s=i.connect(s.Lnext,s).Sym;return!0},e.prototype.tessellateInterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)if(n=r.next,r.inside&&!this.tessellateMonoRegion_(i,r))return!1;return!0},e.prototype.discardExterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)n=r.next,r.inside||i.zapFace(r)},e.prototype.setWindingNumber_=function(i,n,r){for(var s,a=i.eHead.next;a!==i.eHead;a=s)s=a.next,a.Rface.inside!==a.Lface.inside?a.winding=a.Lface.inside?n:-n:r?i.delete(a):a.winding=0},e.prototype.getNeighbourFace_=function(i){return i.Rface&&i.Rface.inside?i.Rface.n:-1},e.prototype.outputPolymesh_=function(i,n,r,s){var a,o,l=0,c=0;r>3&&i.mergeConvexFaces(r);for(var h=i.vHead.next;h!==i.vHead;h=h.next)h.n=-1;for(var d=i.fHead.next;d!==i.fHead;d=d.next)if(d.n=-1,d.inside){a=d.anEdge,o=0;do(h=a.Org).n===-1&&(h.n=c,c++),o++,a=a.Lnext;while(a!==d.anEdge);if(o>r)throw"Face vertex greater that support polygon";d.n=l,++l}for(this.elementCount=l,n===gr.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*r,this.vertexCount=c,this.vertices=[],this.vertices.length=c*s,this.vertexIndices=[],this.vertexIndices.length=c,h=i.vHead.next;h!==i.vHead;h=h.next)if(h.n!==-1){var u=h.n*s;this.vertices[u+0]=h.coords[0],this.vertices[u+1]=h.coords[1],s>2&&(this.vertices[u+2]=h.coords[2]),this.vertexIndices[h.n]=h.idx}var p=0;for(d=i.fHead.next;d!==i.fHead;d=d.next)if(d.inside){a=d.anEdge,o=0;do h=a.Org,this.elements[p++]=h.n,o++,a=a.Lnext;while(a!==d.anEdge);for(var f=o;f<r;++f)this.elements[p++]=-1;if(n===gr.CONNECTED_POLYGONS){a=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==d.anEdge);for(var g=o;g<r;++g)this.elements[p++]=-1}}},e.prototype.outputContours_=function(i,n){var r,s,a=0,o=0;this.vertexCount=0,this.elementCount=0;for(var l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){s=r=l.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==s);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*n,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var c=0,h=0,d=0;for(a=0,l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){o=0,s=r=l.anEdge;do this.vertices[c++]=r.Org.coords[0],this.vertices[c++]=r.Org.coords[1],n>2&&(this.vertices[c++]=r.Org.coords[2]),this.vertexIndices[h++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==s);this.elements[d++]=a,this.elements[d++]=o,a+=o}},e.prototype.addContour=function(i,n){this.mesh===null&&(this.mesh=new T2),i<2&&(i=2),i>3&&(i=3);for(var r=null,s=0;s<n.length;s+=i)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=n[s+0],r.Org.coords[1]=n[s+1],r.Org.coords[2]=i>2?n[s+2]:0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},e.prototype.tesselate=function(i,n,r,s,a,o){if(i===void 0&&(i=Bi.ODD),n===void 0&&(n=gr.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,a&&(this.normal[0]=a[0],this.normal[1]=a[1],this.normal[2]=a[2]),this.windingRule=i,s<2&&(s=2),s>3&&(s=3),!this.mesh)return!1;this.projectPolygon_(),ML.computeInterior(this,o);var l=this.mesh;return n===gr.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),n===gr.BOUNDARY_CONTOURS?this.outputContours_(l,s):this.outputPolymesh_(l,n,r,s),!0},e}(),Bi.ODD,Bi.NONZERO,Bi.POSITIVE,Bi.NEGATIVE,Bi.ABS_GEQ_TWO,gr.POLYGONS,gr.CONNECTED_POLYGONS,gr.BOUNDARY_CONTOURS});function Q6(t,e){let i=t.length/2;if(i<2)return[];let n=0;for(let l=0;l<i;l++){let c=(l+1)%i;n+=t[2*l]*t[2*c+1]-t[2*c]*t[2*l+1]}let r=n>0!==e?1:-1,s=[];for(let l=0;l<i;l++){let c=(l+1)%i,h=t[2*c]-t[2*l],d=t[2*c+1]-t[2*l+1],u=Math.hypot(h,d);s.push(u>0?[r*d/u,-r*h/u]:[0,0])}let a=Math.cos(40*Math.PI/180),o=(l,c)=>{if(l[0]*c[0]+l[1]*c[1]<=a)return l;let[h,d]=[l[0]+c[0],l[1]+c[1]],u=Math.hypot(h,d);return u>0?[h/u,d/u]:l};return s.map((l,c)=>[o(l,s[(c+i-1)%i]),o(l,s[(c+1)%i])])}function J6(t,e,i){let n=t.length/2,r=new Float32Array(n+1);if(!(e>0)||!(i>0)||n<2)return{u:r,vScale:0};let s=0;for(let a=0;a<n;a++){let o=(a+1)%n;s+=Math.hypot((t[2*o]-t[2*a])/e,(t[2*o+1]-t[2*a+1])/i),r[a+1]=s}return{u:r,vScale:Math.sqrt(e*i)}}function t8(t,e,i){for(let n=0;n<i.length;n+=3){let r=3*i[n],s=3*i[n+1],a=3*i[n+2],o=t[s]-t[r],l=t[s+1]-t[r+1],c=t[s+2]-t[r+2],h=t[a]-t[r],d=t[a+1]-t[r+1],u=t[a+2]-t[r+2],p=c*h-o*u,f=o*d-l*h;if((l*u-c*d)*(e[r]+e[s]+e[a])+p*(e[r+1]+e[s+1]+e[a+1])+f*(e[r+2]+e[s+2]+e[a+2])<0){let g=i[n+1];i[n+1]=i[n+2],i[n+2]=g}}}var Q3,e8,J3,i8=z(()=>{}),tP=z(()=>{Q3={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},e8={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},J3={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0}});function n8(t,e){return t.normals[3*e+2]<.9999}function r8(t){let e=AT.get(t);if(e!==void 0)return e;if(!(t.rise>0))return t;let i=new Float32Array(t.normals),n=t.positions.length/3;for(let s=0;s<n;s++){if(!n8(t,s))continue;let a=i[3*s],o=i[3*s+1],l=Math.hypot(a,o);if(l===0)continue;let c=t.rise-t.positions[3*s+2],h=Math.min(1,Math.max(0,1-c/t.rise)),d=Math.sqrt(1-h*h);i[3*s]=a/l*d,i[3*s+1]=o/l*d,i[3*s+2]=h}let r={...t,normals:i};return AT.set(t,r),r}function s8(t,e,i,n){let r=(e-t.minX)/t.spanX,s=(i-t.minY)/t.spanY;return n?[s,r]:[r,s]}var AT,Bb,TT,eP=z(()=>{AT=new WeakMap}),aK=z(()=>{J(),x0(),ti(),i8(),tP(),eP(),Bb=class extends jt{constructor(t,e,i=12,n=Bi.ODD,r,s=!1){super(),this.type="FlatExtrusionGeometry",this._nearSide=new Uint8Array(0),this._vScale=0,this._shape=t,this._depth=e,this._curveSegments=i,this._windingRule=n,this._uvPitch=s?void 0:r,this._legacy=s;let a,o=[t.extractShapePointsToFlatArray([],i),...t.shapeHoles.map(U=>U.extractShapePointsToFlatArray([],i))];try{a=Pg({contours:o,windingRule:n,elementType:gr.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{a=J3}let l=a?.vertexCount??0,c=a?.elementCount??0,h=1/0,d=1/0,u=-1/0,p=-1/0;for(let U of o)for(let j=0;j<U.length;j+=2)U[j]<h&&(h=U[j]),U[j]>u&&(u=U[j]),U[j+1]<d&&(d=U[j+1]),U[j+1]>p&&(p=U[j+1]);let f=this._uvPitch,g=f??(u-h||1),m=f??(p-d||1),v=f===void 0?h:0,y=f===void 0?d:0,_=o.map((U,j)=>Q6(U,j>0)),b=0;for(let U of _)b+=U.length;let x=2*l+4*b,w=3*c*2+6*b,S=new Float32Array(3*x),E=new Float32Array(3*x),A=new Float32Array(2*x),P=new Uint32Array(w),C=new Uint8Array(x),R=0,O=0,D=0,F=!1,V=(U,j,q,rt,it,Y,ht=(U-v)/g,ot=(j-y)/m)=>{let ft=3*O;S[ft]=U,S[ft+1]=j,S[ft+2]=q,E[ft]=rt,E[ft+1]=it,E[ft+2]=Y,C[O]=q===e?F?2:1:0,A[2*O]=ht,A[2*O+1]=ot,O++};if(a!==void 0)for(let[U,j]of[[e,1],[0,-1]]){let q=O;for(let rt=0;rt<l;rt++)V(a.vertices[2*rt],a.vertices[2*rt+1],U,0,0,j);for(let rt=0;rt<c;rt++){let[it,Y,ht]=[a.elements[3*rt],a.elements[3*rt+1],a.elements[3*rt+2]];P[D++]=q+it,P[D++]=q+(j>0?Y:ht),P[D++]=q+(j>0?ht:Y)}}F=!0;for(let U=0;U<o.length;U++){let j=o[U],q=_[U],rt=j.length/2,{u:it,vScale:Y}=s?{u:new Float32Array(rt+1),vScale:0}:J6(j,g,m);R=Y;let ht=Y===0?0:e/Y,ot={minX:v,minY:y,spanX:g,spanY:m},ft=(pt,[tt,mt],N,L)=>{let H=j[2*pt],$=j[2*pt+1],[B,Z]=s?s8(ot,H,$,N):[L,N?0:ht];V(H,$,N?0:e,tt,mt,0,B,Z)};for(let pt=0;pt<q.length;pt++){let tt=(pt+1)%rt,[mt,N]=q[pt],[L,H]=[it[pt],it[pt+1]],$=O;ft(pt,mt,!1,L),ft(pt,mt,!0,L),ft(tt,N,!1,H),ft(tt,N,!0,H),P[D++]=$,P[D++]=$+1,P[D++]=$+2,P[D++]=$+3,P[D++]=$+2,P[D++]=$+1}}t8(S,E,P),this.setAttribute("position",new Ht(S,3)),this.setAttribute("normal",new Ht(E,3)),this.setAttribute("uv",new Ht(A,2)),this.setIndex(new Ht(P,1)),this._nearSide=C,this._vScale=R}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale)}canShiftDepthTo(t){return this._nearSide.length>0&&this._depth>0&&t>0}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}clone(){let t=new Bb(this._shape,this._depth,this._curveSegments,this._windingRule,this._uvPitch,this._legacy);return t.userData=Sx(this.userData),t}}}),a8=z(()=>{J(),x0(),ti(),tP(),TT=class extends jt{constructor(t,e=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=Bi.ODD,this.elementType=gr.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=t,this._curveSegments=e,this._triangulationOptions=Object.assign({windingRule:Bi.ODD,elementType:gr.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let n,r,s,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(u=>u.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,c=!0;for(let u=0,p=a.length/2;u<p;u++){let f=2*u,g=a[f+0],m=a[f+1];if(r!==void 0&&g!==r&&(l=!1),s!==void 0&&m!==s&&(c=!1),r=g,s=m,!l&&!c)break}if(!l&&!c)try{n=Pg({contours:[a,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{n=Q3}let h=n?.vertexCount??1,d=n?.elementCount??1;if(this._positionAttribute=new Ht(new Float32Array(3*h),3),this._normalAttribute=new Ht(new Float32Array(3*h),3),this._uvAttribute=new Ht(new Float32Array(2*h),2),this._indexAttribute=new Ht(new Uint32Array(3*d),1),n){let u=1/0,p=-1/0,f=1/0,g=-1/0;for(let y=0,_=h;y<_;y++){let b=2*y,x=n.vertices[b+0],w=n.vertices[b+1];x<u&&(u=x),x>p&&(p=x),w<f&&(f=w),w>g&&(g=w)}let m=p-u,v=g-f;for(let y=0,_=h;y<_;y++){let b=2*y,x=n.vertices[b+0],w=n.vertices[b+1],S=(x-u)/m,E=(w-f)/v;this._positionAttribute.setXYZ(y,x,w,0),this._normalAttribute.setXYZ(y,0,0,1),this._uvAttribute.setXY(y,S,E)}for(let y=0,_=d;y<_;y++){let b=3*y,x=n.elements[b+0],w=n.elements[b+1],S=n.elements[b+2];this._indexAttribute.setX(b+0,x),this._indexAttribute.setX(b+1,w),this._indexAttribute.setX(b+2,S)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,3*(n?.elementCount??1))}clone(){let t=new TT(this._shape,this._curveSegments);return t.userData=Sx(this.userData),t}}});function oK(t){return EL||(EL=async function(){let e=t??"https://unpkg.com/@splinetool/runtime@2.0.157/build",i=Promise.resolve().then(()=>(ED(),MD)),[n,r]=await Promise.all([i,fetch(`${e}/bevel.wasm`).then(s=>s.arrayBuffer())]);await n.default({module_or_path:r}),w0=n}())}function lK(t){let e=!1;return t.scene.objects.traverse((i,n)=>{let r=n.geometry;if(r!==void 0&&(c8.has(r.type)&&r.depth!==void 0&&r.depth>0&&(r.extrudeBevelSize??0)>0&&(e=!0),r.type==="PathGeometry")){let s=r.extrusion;s!==void 0&&s.capType==="round"&&(s.bevel??0)>0&&(e=!0)}}),e}function o8(t,e){let i=[t.extractShapePointsToFlatArray([],e)];for(let o of t.shapeHoles)i.push(o.extractShapePointsToFlatArray([],e));let n=0;for(let o of i)n+=o.length>>1;let r=new Float64Array(2*n),s=new Uint32Array(i.length),a=0;for(let o=0;o<i.length;o++)r.set(i[o],2*a),a+=i[o].length>>1,s[o]=a;return{points:r,ends:s}}function Ub(t,e,i,n,r,s){let a=t.positions.length/3,o=r.elements,l=d8.getNormalMatrix(r).elements;for(let h=0;h<a;h++){let d=3*h,u=3*(i+h),p=t.positions[d],f=t.positions[d+1],g=t.positions[d+2];e.positions[u]=o[0]*p+o[4]*f+o[8]*g+o[12],e.positions[u+1]=o[1]*p+o[5]*f+o[9]*g+o[13],e.positions[u+2]=o[2]*p+o[6]*f+o[10]*g+o[14];let m=t.normals[d],v=t.normals[d+1],y=t.normals[d+2];e.normals[u]=l[0]*m+l[3]*v+l[6]*y,e.normals[u+1]=l[1]*m+l[4]*v+l[7]*y,e.normals[u+2]=l[2]*m+l[5]*v+l[8]*y;let _=2*(i+h);if(s===void 0)e.uvs[_]=t.uvs[2*h],e.uvs[_+1]=t.uvs[2*h+1];else{let[b,x]=s(p,f,t.uvs[2*h],t.uvs[2*h+1],h);e.uvs[_]=b,e.uvs[_+1]=x}}let c=r.determinant()<0;for(let h=0;h<t.indices.length;h+=3)e.indices[n+h]=t.indices[h]+i,e.indices[n+h+1]=t.indices[h+(c?2:1)]+i,e.indices[n+h+2]=t.indices[h+(c?1:2)]+i}function l8(t){let{owner:e,shape:i,curveSegments:n,assembledAt:r,bevel:s,bevelSegments:a}=t,o=function(u,p){let f=[p],g=m=>{f.push(m.points.length,m.isClosed?1:0,m.roundness??0);for(let v of m.points){f.push(v.roundness??0,v.position.x,v.position.y);for(let y of v.controls)f.push(y.position.x,y.position.y)}f.push(m.shapeHoles.length);for(let v of m.shapeHoles)g(v)};return g(u),function(m){let v=2166136261;for(let y=0;y<m.length;y++)v^=m[y],v=Math.imul(v,16777619)>>>0;return v}(new Uint8Array(new Float64Array(f).buffer))}(i,n),l=e??`outline:${o}`,c=`${s}/${a}`,h=zb.get(l);if(h!==void 0&&h.outlineVersion===o&&h.capKey===c&&(t.stillServes?.(h)??1))return CT.placements++,h.cap;let d=function(u,p,f,g,m){let{points:v,ends:y}=o8(u,p);return w0.assemble_cap(v,y,f,g,0,Math.max(1,Math.floor(m)),h8,40)}(i,n,r,s,a);CT.assemblies++;try{let u=function(p,f){return function(g,m,v,y,_){let b=1/0;for(let x=2;x<g.length;x+=3)g[x]<b&&(b=g[x]);if(b===1/0&&(b=0),b!==0)for(let x=2;x<g.length;x+=3)g[x]-=b;return{positions:g,normals:m,uvs:v,indices:y,rise:_-b}}(p.positions(),p.normals(),p.uvs(),p.indices(),f)}(d,r);return zb.set(l,{outlineVersion:o,capKey:c,assembledAt:r,cap:u}),u}finally{d.free()}}function Wu(t,e){return .5*e>1.001*t}var w0,h8,EL,c8,d8,AL,TL,CL,zb,CT,PT,Ih,Ip=z(()=>{J(),ti(),i8(),eP(),h8=.4,c8=new Set(["VectorGeometry","TextGeometry","InputGeometry","PolygonGeometry","RectangleGeometry","StarGeometry","TriangleGeometry","EllipseGeometry"]),d8=new ue,AL=new Et,TL=new Et,CL=new Et().makeScale(1,1,-1),zb=new Map,CT={assemblies:0,placements:0},PT=class extends jt{constructor(t,e,i=0,n=12,r=3,s,a,o=!1){if(super(),this.type="ShapeGeometry",this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0,w0===void 0)throw new Error("bevel-wasm is not loaded");this._shape=t,this._uvPitch=a,this._legacy=o,this._depth=e,this._bevel=i,this._curveSegments=n,this._bevelSegments=r,this._ownerId=s,this.rebuild()}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale,this._effectiveBevel=e._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(t){return this._nearSide.length>0&&Wu(this._effectiveBevel,t)&&Wu(this._effectiveBevel,this._depth)}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}setDepth(t){t!==this._depth&&(this._depth=t,this.rebuild(),this.computeBoundingSphere(),this.computeBoundingBox())}rebuild(){let t=l8({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:a=>Wu(a.cap.rise,this._depth)&&Wu(a.cap.rise,a.assembledAt)}),e=function(a,o,l,c,h,d=!1){let u=c.positions.length/3,p=l-c.rise,f=c.rise,{points:g,ends:m}=o8(a,o),v=1/0,y=1/0,_=-1/0,b=-1/0;for(let ot=0;ot<g.length;ot+=2)g[ot]<v&&(v=g[ot]),g[ot]>_&&(_=g[ot]),g[ot+1]<y&&(y=g[ot+1]),g[ot+1]>b&&(b=g[ot+1]);d&&(h=void 0);let x=h??_-v,w=h??b-y,S={minX:v,minY:y,spanX:_-v||1,spanY:b-y||1},E=[],A=0;for(let ot of m)E.push({at:A,count:ot-A}),A=ot;let P=0;for(let ot of E)P+=ot.count;let C=2*u+4*P,R=new Float32Array(3*C),O=new Float32Array(3*C),D=new Float32Array(2*C),F=new Uint32Array(2*c.indices.length+6*P),V=new Uint8Array(C),U=0,j=h===void 0?void 0:(ot,ft)=>[ot/h,ft/h],q=d?(ot,ft,pt,tt,mt)=>n8(c,mt)?[tt,pt]:[pt,tt]:j,rt=d?r8(c):c,it={positions:R,normals:O,uvs:D,indices:F};Ub(rt,it,0,0,AL.makeTranslation(0,0,p),j),Ub(rt,it,u,c.indices.length,TL.makeTranslation(0,0,f).multiply(CL),q),V.fill(1,0,u);let Y=2*u,ht=2*c.indices.length;for(let ot=0;ot<E.length;ot++){let{at:ft,count:pt}=E[ot],tt=g.subarray(2*ft,2*(ft+pt)),mt=Q6(tt,ot>0),N=d?{u:new Float32Array(pt+1),vScale:0}:J6(tt,x,w),L=N.u;U=N.vScale;for(let H=0;H<pt;H++){let $=(H+1)%pt,[B,Z]=mt[H],K=Y;for(let[k,st,dt,bt,ct,It]of[[tt[2*H],tt[2*H+1],B,p,L[H],2],[tt[2*$],tt[2*$+1],Z,p,L[H+1],2],[tt[2*$],tt[2*$+1],Z,f,L[H+1],0],[tt[2*H],tt[2*H+1],B,f,L[H],0]]){let St=3*Y;if(R[St]=k,R[St+1]=st,R[St+2]=bt,O[St]=dt[0],O[St+1]=dt[1],O[St+2]=0,d){let[Rt,Mt]=s8(S,k,st,It===0);D[2*Y]=Rt,D[2*Y+1]=Mt}else D[2*Y]=ct,D[2*Y+1]=U===0?0:(bt-f)/U;V[Y]=It,Y++}F[ht++]=K,F[ht++]=K+1,F[ht++]=K+2,F[ht++]=K,F[ht++]=K+2,F[ht++]=K+3}}return t8(R,O,F),{positions:R,normals:O,uvs:D,indices:F,nearSide:V,vScale:U}}(this._shape,this._curveSegments,this._depth,t,this._uvPitch,this._legacy);this._nearSide=e.nearSide,this._vScale=e.vScale,this._effectiveBevel=t.rise;let i=this.getAttribute("position"),n=this.getAttribute("normal"),r=this.getAttribute("uv"),s=this.getIndex();if(i!==void 0&&n!==void 0&&r!==void 0&&s!==null&&i.array.length===e.positions.length&&n.array.length===e.normals.length&&r.array.length===e.uvs.length&&s.array.length===e.indices.length)return i.array.set(e.positions),n.array.set(e.normals),r.array.set(e.uvs),s.array.set(e.indices),i.needsUpdate=!0,n.needsUpdate=!0,r.needsUpdate=!0,void(s.needsUpdate=!0);this.setAttribute("position",new Ht(e.positions,3)),this.setAttribute("normal",new Ht(e.normals,3)),this.setAttribute("uv",new Ht(e.uvs,2)),this.setIndex(new Ht(e.indices,1))}clone(){let t=new PT(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId,this._uvPitch,this._legacy);return t.userData=Sx(this.userData),t}}}),Eh=z(()=>{Oh(),aK(),a8(),Ip(),x0(),Ih=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=Object.assign({},e?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Bi.ODD},t.parameters),r=Math.abs(n.width),s=Math.abs(n.height??n.width),a=Math.abs(n.depth??0),o=t.shape??e?.shape,l=o?.roundness??n.roundness;o!==void 0&&(o instanceof ji?(i=o,(i.width!==r||i.height!==s)&&i.applySize(r,s)):i=new ji(r,s).fromJSON(o),t.parameters?.roundness!==void 0&&t.parameters?.roundness>0&&i.update());let c=i??new ji(r,s);return{parameters:Object.assign(n,{width:r,height:s,depth:a,roundness:l}),shape:c,ownerId:t.ownerId??e?.ownerId}}static build(t){let e,{depth:i,extrudeBevelSize:n,extrudeBevelSegments:r,subdivisions:s,roundness:a,windingRule:o,uvPitch:l,extrusionVersion:c}=t.parameters,h=c===1;return t.shape.roundness=a,i<=0?e=new TT(t.shape,s,{windingRule:o}):n<=0?e=new Bb(t.shape,i,s,o,l,h):w0!==void 0?e=new PT(t.shape,i,n,s,r,t.ownerId,l,h):(console.error("[extrude] engine not loaded \u2014 extruding without a bevel"),e=new Bb(t.shape,i,s,o,l,h)),Object.assign(e,{userData:{...t,type:"VectorGeometry"}})}}});function hK(t,e,i,n,r,s){if(n>=iP)return r>30||r%4==0?(function(h,d,u,p=0,f=0,g=0){let m=.5522847498,v=d*m,y=u*m;h.addPoint(Jv(f-d,g,f-d,g-y,f-d,g+y)),h.addPoint(Jv(f,g+u,f-v,g+u,f+v,g+u)),h.addPoint(Jv(f+d,g,f+d,g+y,f+d,g-y)),h.addPoint(Jv(f,g-u,f+v,g-u,f-v,g-u)),p>0&&p8(h,d,u,p)}(t,e,i,s),Math.round(r/4)):PL(t,n,r,e,i,s);let a={x:0,y:i},o=(n=Math.max(n,.001))+.5*Math.PI,l={x:Math.cos(o)*e,y:Math.sin(o)*i},c=function({px:h,py:d,cx:u,cy:p,rx:f,ry:g,largeArcFlag:m,sweepFlag:v}){let y=[];if(f===0||g===0)return[];let _=(h-u)/2,b=(d-p)/2;if(_===0&&b===0)return[];f=Math.abs(f),g=Math.abs(g);let x=Math.pow(_,2)/Math.pow(f,2)+Math.pow(b,2)/Math.pow(g,2);x>1&&(f*=Math.sqrt(x),g*=Math.sqrt(x));let w=function(O,D,F,V,U,j,q,rt,it,Y){let ht=Math.pow(U,2),ot=Math.pow(j,2),ft=Math.pow(q,2),pt=Math.pow(rt,2),tt=ht*ot-ht*pt-ot*ft;tt<0&&(tt=0),tt/=ht*pt+ot*ft,tt=Math.sqrt(tt)*(it===Y?-1:1);let mt=tt*U/j*rt,N=tt*-j/U*q,L=mt+(O+F)/2,H=N+(D+V)/2,$=(q-mt)/U,B=(rt-N)/j,Z=(-q-mt)/U,K=(-rt-N)/j,k=xL(1,0,$,B),st=xL($,B,Z,K);return!Y&&st>0&&(st-=Y1),Y&&st<0&&(st+=Y1),{centerx:L,centery:H,ang1:k,ang2:st}}(h,d,u,p,f,g,_,b,m,v),{ang1:S,ang2:E}=w,{centerx:A,centery:P}=w,C=Math.abs(E)/(Y1/4);Math.abs(1-C)<1e-7&&(C=1);let R=Math.max(Math.ceil(C),1);E/=R;for(let O=0;O<R;O++)y.push(rK(S,E)),S+=E;return y.map(O=>{let{x:D,y:F}=A2(O[0],f,g,A,P),{x:V,y:U}=A2(O[1],f,g,A,P),{x:j,y:q}=A2(O[2],f,g,A,P);return{x1:D,y1:F,x2:V,y2:U,x:j,y:q}})}({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:e,ry:i,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%c.length===0?function(h,d,u,p,f,g,m,v){let y=Math.round(f/p.length);h.addPoint(sp(d,u));for(let _=0,b=p.length;_<b;_++){let x=p[_],w=h.points[_],S=sp(x.x,x.y);w.controls[1].position.set(x.x1,x.y1),S.controls[0].position.set(x.x2,x.y2),h.addPoint(S)}return v>0?u8(h,g,m,v):h.addPoint(sp(0,0)),y}(t,a.x,a.y,c,r,e,i,s):PL(t,n,r,e,i,s)}function PL(t,e,i,n,r,s){let a=-e/i;for(let o=0;o<=i;o++){let l=a*o,c=Math.sin(l)*n,h=Math.cos(l)*r;t.addPoint(sp(c,h))}return e<iP?s>0?u8(t,n,r,s):t.addPoint(sp(0,0)):(t.removePoint(t.points[t.points.length-1]),s>0&&p8(t,n,r,s)),1}function sp(t,e){return new $c(Pt.generateUUID(),new et(t,e))}function Jv(t,e,i,n,r,s){let a=sp(t,e);return a.controls[0].position.set(i,n),a.controls[1].position.set(r,s),a}function u8(t,e,i,n){f8(t,e,i,n).forEach(r=>t.addPoint(r))}function p8(t,e,i,n){let r=f8(t,e,i,n),s=new ji;r.forEach(a=>s.addPoint(a)),s.isClosed=!0,t.shapeHoles.push(s)}function f8(t,e,i,n){let r=n*e/100,s=r*(Math.abs(i)/Math.abs(e)),a=new et(r/e,s/i),o=t.points.map(l=>{let c=l.clone();return c.uuid=Pt.generateUUID(),c}).reverse();return o.forEach(l=>{l.position.multiply(a);let c=l.controls[0].position.clone().multiply(a),h=l.controls[1].position.clone().multiply(a);l.controls[0].position.copy(h),l.controls[1].position.copy(c)}),o}var iP,Nx,m8,R2,g8,Fb=z(()=>{Oh(),Z6(),sK(),Eh(),J(),iP=2*Math.PI,Nx=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return i.angle=Pt.clamp(i.angle,0,360),{shape:t.shape&&t.shape instanceof ji?t.shape:new ji,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let e,{width:i,height:n,spikes:r,angle:s,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}=t.parameters,d=t.shape,u=hK(d,.5*i,.5*n,s*Math.PI/180,r,a);return d.isClosed=!0,d.update(),s===0?(e=new jt,e.setAttribute("position",new kt([],3))):e=Ih.create({shape:d,parameters:{subdivisions:u,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}}),Object.assign(e,{userData:{...t,type:"EllipseGeometry"}})}}}),DL=z(()=>{J(),H6(),m8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=r===0&&s!==0?new R2(.5*e,s,a):new aA(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"IcosahedronGeometry"}})}},R2=class extends Ib{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r="IcosahedronGeometry";super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],r,t,e,i),this.type=r}static fromJSON(t){return new R2(t.radius,t.corner,t.cornerSides)}}}),RL=z(()=>{J(),g8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){(t.parameters?.points??[]).forEach(n=>{Array.isArray(n)&&(n.x=n[0],n.y=n[1])});let i=Object.assign({},e?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{points:e,segments:i,verticalSegments:n}=t.parameters,r=new Xg;r.moveTo(e[0].x,e[0].y),r.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new oA(r.extractPoints(n).shape,i);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...t,type:"LatheGeometry"}})}}});function Yd(t,e){return Math.abs(e-t)/2+Math.min(t,e)}function cK(t){let{positions:e,faces:i,materialIndices:n,uvs:r}=t,s=e.length/3,a=i.length/3,o=r!==null&&a>0,l=3*a,c=new Uint32Array(l),h=new Uint32Array(l),d=new Uint32Array(l),u=new Uint32Array(l),p=new Uint32Array(l),f=0,g=8;for(;g<2*l;)g*=2;let m=g-1,v=new Int32Array(g).fill(-1),y=(D,F)=>{let V=(Math.imul(D,2654435761)^F)&m;for(;;){let U=v[V];if(U===-1)return v[V]=f,c[f]=D,h[f]=F,f++;if(c[U]===D&&h[U]===F)return U;V=V+1&m}},_=(D,F)=>{let V=D<F?D:F,U=D<F?F:D,j=(Math.imul(V,2654435761)^U)&m;for(;;){let q=v[j];if(c[q]===V&&h[q]===U)return q;j=j+1&m}},b=new Uint32Array(s),x=new Float64Array(3*s),w=(D,F,V)=>{let U=D<F?y(D,F):y(F,D),j=++d[U];j===1?u[U]=V:j===2&&(p[U]=V),b[D]++,b[F]++,x[3*D]+=e[3*F],x[3*D+1]+=e[3*F+1],x[3*D+2]+=e[3*F+2],x[3*F]+=e[3*D],x[3*F+1]+=e[3*D+1],x[3*F+2]+=e[3*D+2]};for(let D=0;D<a;D++){let F=i[3*D],V=i[3*D+1],U=i[3*D+2];w(F,V,U),w(V,U,F),w(U,F,V)}let S=new Float64Array(3*f);for(let D=0;D<f;D++){let F=3*c[D],V=3*h[D];if(d[D]===2){let U=3*u[D],j=3*p[D];S[3*D]=.375*(e[F]+e[V])+.125*(e[U]+e[j]),S[3*D+1]=.375*(e[F+1]+e[V+1])+.125*(e[U+1]+e[j+1]),S[3*D+2]=.375*(e[F+2]+e[V+2])+.125*(e[U+2]+e[j+2])}else S[3*D]=.5*(e[F]+e[V]),S[3*D+1]=.5*(e[F+1]+e[V+1]),S[3*D+2]=.5*(e[F+2]+e[V+2])}let E,A=new Float64Array(3*s);for(let D=0;D<s;D++){let F=b[D];F===3?E=3/16:F>3&&(E=3/(8*F));let V=1-F*Number(E),U=Number(E);F===2&&(V=3/4,U=1/8),A[3*D]=e[3*D]*V+x[3*D]*U,A[3*D+1]=e[3*D+1]*V+x[3*D+1]*U,A[3*D+2]=e[3*D+2]*V+x[3*D+2]*U}let P=new Float64Array(3*(s+f));P.set(A),P.set(S,3*s);let C=new Uint32Array(12*a),R=new Array(4*a),O=o?new Float64Array(24*a):null;for(let D=0;D<a;D++){let F=i[3*D],V=i[3*D+1],U=i[3*D+2],j=_(F,V)+s,q=_(V,U)+s,rt=_(U,F)+s,it=12*D;C[it++]=j,C[it++]=q,C[it++]=rt,C[it++]=F,C[it++]=j,C[it++]=rt,C[it++]=V,C[it++]=q,C[it++]=j,C[it++]=U,C[it++]=rt,C[it++]=q;let Y=n[D];if(R[4*D]=Y,R[4*D+1]=Y,R[4*D+2]=Y,R[4*D+3]=Y,O!==null){let ht=6*D,ot=r[ht],ft=r[ht+1],pt=r[ht+2],tt=r[ht+3],mt=r[ht+4],N=r[ht+5],L=Yd(ot,pt),H=Yd(ft,tt),$=Yd(pt,mt),B=Yd(tt,N),Z=Yd(ot,mt),K=Yd(ft,N),k=24*D;O[k++]=L,O[k++]=H,O[k++]=$,O[k++]=B,O[k++]=Z,O[k++]=K,O[k++]=ot,O[k++]=ft,O[k++]=L,O[k++]=H,O[k++]=Z,O[k++]=K,O[k++]=pt,O[k++]=tt,O[k++]=$,O[k++]=B,O[k++]=L,O[k++]=H,O[k++]=mt,O[k++]=N,O[k++]=Z,O[k++]=K,O[k++]=$,O[k++]=B}}return{positions:P,faces:C,materialIndices:R,uvs:O}}var ty,v8,Mn,y8,nP,dK=z(()=>{J(),ty=1e4,v8=class{constructor(t=1){this.subdivisions=t}modify(t){let e=function(n){let r=n.getAttribute("position");if(r===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let s=n.getAttribute("uv"),a=n.getIndex(),o=r.count,l=new Map,c=new Uint32Array(o),h=[],d=0;for(let y=0;y<o;y++){let _=r.getX(y),b=r.getY(y),x=r.getZ(y),w=Math.round(_*ty),S=Math.round(b*ty),E=Math.round(x*ty),A=l.get(w);A===void 0&&(A=new Map,l.set(w,A));let P=A.get(S);P===void 0&&(P=new Map,A.set(S,P));let C=P.get(E);C===void 0&&(C=d++,P.set(E,C),h.push(_,b,x)),c[y]=C}let u=[],p=[],f=s===void 0?null:[],g=a!==null?a.count:o,m=(y,_)=>{let b=a!==null?a.getX(y):y,x=a!==null?a.getX(y+1):y+1,w=a!==null?a.getX(y+2):y+2;if(!(b<o&&x<o&&w<o))return;let S=c[b],E=c[x],A=c[w];S===E||E===A||A===S||(u.push(S,E,A),p.push(_),f!==null&&f.push(s.getX(b),s.getY(b),s.getX(x),s.getY(x),s.getX(w),s.getY(w)))},v=n.groups;if(v.length>0)for(let y=0;y<v.length;y++){let _=v[y],b=_.materialIndex===void 0?0:_.materialIndex,x=Math.max(_.start,0),w=Math.min(_.start+_.count,g);for(let S=x;S<w&&S+2<g;S+=3)m(S,b)}else for(let y=0;y+2<g;y+=3)m(y,0);return{positions:Float64Array.from(h),faces:Uint32Array.from(u),materialIndices:p,uvs:f===null?null:Float64Array.from(f)}}(t),i=this.subdivisions;for(;i-- >0;)e=cK(e);return function(n,r){let{positions:s,faces:a,materialIndices:o,uvs:l}=n,c=s.length/3,h=a.length/3,d=new Float64Array(3*c);for(let v=0;v<h;v++){let y=3*a[3*v],_=3*a[3*v+1],b=3*a[3*v+2],x=s[b]-s[_],w=s[b+1]-s[_+1],S=s[b+2]-s[_+2],E=s[y]-s[_],A=s[y+1]-s[_+1],P=s[y+2]-s[_+2],C=w*P-S*A,R=S*E-x*P,O=x*A-w*E;d[y]+=C,d[y+1]+=R,d[y+2]+=O,d[_]+=C,d[_+1]+=R,d[_+2]+=O,d[b]+=C,d[b+1]+=R,d[b+2]+=O}for(let v=0;v<c;v++){let y=d[3*v],_=d[3*v+1],b=d[3*v+2],x=Math.sqrt(y*y+_*_+b*b)||1;d[3*v]=y/x,d[3*v+1]=_/x,d[3*v+2]=b/x}let u=3*h,p=new Float32Array(3*u),f=new Float32Array(3*u),g=l!==null&&l.length>0?new Float32Array(2*u):null;for(let v=0;v<u;v++){let y=3*a[v];p[3*v]=s[y],p[3*v+1]=s[y+1],p[3*v+2]=s[y+2],f[3*v]=d[y],f[3*v+1]=d[y+1],f[3*v+2]=d[y+2]}g!==null&&g.set(l.subarray(0,2*u));let m=new jt;m.setAttribute("position",new Ht(p,3)),u>0&&(m.setAttribute("normal",new Ht(f,3)),m.setAttribute("color",new Ht(new Float32Array(3*u).fill(1),3))),g!==null&&m.setAttribute("uv",new Ht(g,2));for(let v=0;v<h;){let y=o[v],_=v;do v++;while(v<h&&o[v]===y);m.addGroup(3*_,3*(v-_),y)}return r.boundingBox!==null&&(m.boundingBox=r.boundingBox.clone()),r.boundingSphere!==null&&(m.boundingSphere=r.boundingSphere.clone()),m}(e,t)}}}),OL=z(()=>{J(),dK(),Mn=new T,y8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=t.geometry??e?.geometry??new jt().copy(new ya(100,100,100));e===void 0?(n.computeBoundingBox(),n.boundingBox.getSize(Mn),i={width:Mn.x,height:Mn.y,depth:Mn.z,subdivisions:0}):i=e.parameters;let r={...i,...t.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:n}}static build(t){let{width:e,height:i,depth:n,subdivisions:r}=t.parameters,s=t.geometry??new jt().copy(new ya(100,100,100)),a=s.userData.parameters;a===void 0?(s.boundingBox=function(l){let c=new hi,h=l.attributes.position;return h?(c.setFromBufferAttribute(h),c):(c.makeEmpty(),c)}(s),s.boundingBox.getSize(Mn)):Mn.set(a.width,a.height,a.depth),(e!==Mn.x||i!==Mn.y||n!==Mn.z)&&s.scale(Mn.x===0?1:e/Mn.x,Mn.y===0?1:i/Mn.y,Mn.z===0?1:n/Mn.z);let o=s.originalGeometry;try{r>0?(o===void 0||a?.subdivisions!==r)&&(o===void 0&&(o=s),s=new v8(r).modify(o)):(o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals())}catch{o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()}return o!==void 0&&Object.assign(s,{originalGeometry:o}),delete t.geometry,Object.assign(s,{userData:{...t,type:"NonParametricGeometry"}})}static loadFromUrl(t,e,i){new a3(i).load(t,n=>{let r=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Mn);let s=100/Mn.x;Object.assign(r.parameters,{width:100,height:Mn.y*s,depth:Mn.z*s}),e(this.build(r))})}}}),DT=z(()=>{Oh(),Eh(),nP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},t.parameters);return{shape:t.shape&&t.shape instanceof ji?t.shape:new ji,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,spikes:n,cornerRadius:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}=t.parameters,c=t.shape,h=.5*e,d=.5*i,u=2*Math.PI/n;for(let f=0;f<n;f++){let g=u*f,m=0+Math.sin(g)*h,v=0+Math.cos(g)*d;c.addPoint(c.createPoint(m,v))}c.isClosed=!0;for(let f=0,g=c.points.length;f<g;f++)c.points[f].roundness=r;c.roundness=r,c.update();let p=Ih.create({shape:c,parameters:{roundness:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}});return Object.assign(p,{userData:{...t,type:"PolygonGeometry"}})}}});function Yf(t,e,i){i.x=t.x*e.x,i.y=t.y,i.z=t.x*e.y}function O2(t,e,i,n,r,s){let a=b8.copy(e).sub(t),o=x8.copy(i).sub(t),l=a.angleTo(o);if(a.normalize(),o.normalize(),n===r){let c=a.add(o).normalize();s.copy(t).addScaledVector(c,n/Math.sin(l/2))}else{let c=a.angleTo(o);s.copy(t),s.addScaledVector(a,r/Math.sin(c)),s.addScaledVector(o,n/Math.sin(c))}}function uK(t,e,i){let n=t.clone().sub(e),r=i.clone().sub(e);return n.projectOnVector(r),n.add(e)}var _8,b8,x8,IL,kx,w8,S8,M8,LL,rP,E8,A8,T8,C8,BL=z(()=>{J(),_8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,heightSegments:s,openEnded:a,cornerRadius:o,cornerSegments:l}=t.parameters,c=new IL(.5*e,i,r,s,a,o,l),h=n/e;return h!==1&&c.scale(1,1,h),Object.assign(c,{userData:{...t,type:"PyramidGeometry"}})}},b8=new T,x8=new T,IL=class extends jt{constructor(t=.5,e=1,i=4,n=1,r=!1,s=0,a=4){super(),i=Math.floor(Math.max(3,i)),n=Math.floor(n),a=Math.floor(a);let o,l=[],c=[],h=[],d=[],u=0,p=e/2,f=Math.PI/i,g=t*Math.cos(Math.PI/i),m=2*Math.PI/i,v=(i-2)*Math.PI/i,y=Math.PI-v,_=new T(0,-p,0),b=new T(0,p,0),x=new et(t,-p),w=new et(g,-p),S=new et(0,b.y).sub(w),E=new et(0,b.y).sub(x),A=new et(S.y,-S.x).normalize(),P=new et(E.y,-E.x).normalize(),C=t*Math.cos(Math.PI/i)*Math.tan((Math.PI-S.angle())/2)-1e-8;s=Math.min(s,C);{let j=new T(A.x,A.y,0),q=new T(Math.cos(m)*j.x,j.y,Math.sin(m)*j.x);o=j.angleTo(q)}let R=s/Math.tan((Math.PI-S.angle())/2),O=s/Math.tan((Math.PI-o)/2),D=new T;if(!r){c.push(_.x,_.y,_.z),h.push(0,-1,0),d.push(0,0);let j=u++,q=[],rt=x.clone(),it=R/Math.cos(Math.PI/i);rt.x-=it;for(let Y=0;Y<i;Y++){let ht=Y/i*Math.PI*2+f;Yf(rt,new et(Math.sin(ht),Math.cos(ht)),D),c.push(D.x,D.y,D.z),h.push(0,-1,0),d.push(0,0),q.push(u++)}for(let Y=0;Y<q.length;Y++)l.push(q[Y],j,q[(Y+1)%q.length])}let F=[];{let j=new T,q=new T,rt=new T,it=new T,Y=new T,ht=new T;for(let ot=0;ot<i;ot++){let ft=ot/i*Math.PI*2+f,pt=(ot+.5)/i*Math.PI*2+f,tt=(ot+1)/i*Math.PI*2+f,mt=new et(Math.sin(ft),Math.cos(ft)),N=new et(Math.sin(pt),Math.cos(pt)),L=new et(Math.sin(tt),Math.cos(tt));Yf(x,mt,q),Yf(x,L,rt),Yf(A,N,j),O2(b,q,rt,O,O,it),c.push(it.x,it.y,it.z),O2(q,b,rt,O,R,Y),c.push(Y.x,Y.y,Y.z),O2(rt,q,b,R,O,ht),c.push(ht.x,ht.y,ht.z),h.push(j.x,j.y,j.z),h.push(j.x,j.y,j.z),h.push(j.x,j.y,j.z),d.push(0,0),d.push(0,0),d.push(0,0);let H=u++,$=u++,B=u++;if(l.push(H,$,B),s>0){{let k=q.clone().add(rt).multiplyScalar(.5),st=b.clone().sub(k).normalize(),dt=_.clone().sub(k).normalize().add(st).normalize().multiplyScalar(-1);V(k,ht.clone().sub(Y),dt,S.angle())}let Z,K;{let k=new T;Yf(P,L,k);let st=ht.clone().add(it).multiplyScalar(.5);st=uK(st,rt,b);let dt=ht.clone().sub(it);[Z,K]=V(st,dt,k,o,it.y)}{let k=Z,st=k.clone().setY(0).normalize(),dt=new T(0,-1,0),bt=st.clone().cross(dt);U(k,st,dt,bt)}F.concat(K);{let k=S.angle(),st=Math.PI-k,dt=b.clone();dt.y-=s/Math.sin(k-Math.PI/2);let bt=new T,ct=[];for(let St=0;St<a;St++){let Rt=[],Mt=Math.PI/2-st*St/a,W=Math.cos(Mt),_t=Math.sin(Mt),Dt=pt;for(let Gt=0;Gt<=St;Gt++){let Ft=Math.cos(Dt),_e=Math.sin(Dt);j.x=W*_e,j.y=_t,j.z=W*Ft,bt.copy(dt).addScaledVector(j,s),c.push(bt.x,bt.y,bt.z),h.push(j.x,j.y,j.z),d.push(0,0),Rt.push(u++),Dt+=2*Math.PI/St/i}ct.push(Rt)}K.reverse(),ct.push(K);let It=ct.length-1;for(let St=0;St<It;St++){let Rt=ct[St],Mt=ct[St+1],W=Rt.length-1;l.push(Mt[1],Rt[0],Mt[0]);for(let _t=1;_t<=W;_t++)l.push(Rt[_t],Rt[_t-1],Mt[_t]),l.push(Mt[_t+1],Rt[_t],Mt[_t])}}}}}function V(j,q,rt,it,Y){let ht=-it/2,ot=(Math.PI-it)/2,ft=q.clone().normalize().cross(rt);j.addScaledVector(rt,-s/Math.sin(ot));let pt=new T,tt=new T,mt=u,N=[];for(let L=0;L<=a;L++){let H=ht+L/a*it;tt.set(0,0,0),tt.addScaledVector(ft,Math.sin(H)),tt.addScaledVector(rt,Math.cos(H));for(let $=0;$<=1;$++){let B=$/1-.5;if(pt.copy(j),pt.addScaledVector(q,B),pt.addScaledVector(tt,s),Y!=null){let Z=Math.max(0,pt.y-Y);pt.addScaledVector(q,-Z/q.y)}c.push(pt.x,pt.y,pt.z),h.push(tt.x,tt.y,tt.z),d.push(0,0),$===0&&N.push(u),u++}}for(let L=0;L<a;L++)for(let H=0;H<1;H++){let $=mt+H+2*L,B=$+2,Z=B+1,K=$+1;l.push($,B,K),l.push(B,Z,K)}return[j.clone().addScaledVector(q,.5),N]}function U(j,q,rt,it){let Y=Math.PI/2,ht=E.angle()-Y,ot=[],ft=new T,pt=new T;for(let mt=0;mt<=a;mt++){let N=[],L=mt/a;for(let H=0;H<=mt;H++){let $=((mt?H/mt:0)-.5)*y,B=Math.cos($),Z=Math.sin($),K=(Y+Math.atan(Math.tan(ht)*B))*L,k=Math.cos(K),st=Math.sin(K);ft.set(0,0,0),ft.addScaledVector(q,st*B),ft.addScaledVector(rt,k),ft.addScaledVector(it,st*Z),pt.copy(j).addScaledVector(ft,s),c.push(pt.x,pt.y,pt.z),h.push(ft.x,ft.y,ft.z),d.push(0,0),N.push(u++)}ot.push(N)}let tt=ot.length-1;for(let mt=0;mt<tt;mt++){let N=ot[mt],L=ot[mt+1],H=N.length-1;l.push(N[0],L[1],L[0]);for(let $=1;$<=H;$++)l.push(N[$-1],N[$],L[$]),l.push(N[$],L[$+1],L[$])}}this.setIndex(l),this.setAttribute("position",new kt(c,3)),this.setAttribute("normal",new kt(h,3)),this.setAttribute("uv",new kt(d,2))}}}),Nb=z(()=>{Oh(),Eh(),kx=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters),n=Object.assign(e?.ui??{enabledIndieCorners:!1},t.ui);return{shape:t.shape&&t.shape instanceof ji?t.shape:new ji,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:n}}static build(t){let e=t.shape,{width:i,height:n,cornerRadius:r,cornerType:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:c}=t.parameters,h={x:.5*i,y:.5*n},d={x:-h.x,y:-h.y},u={x:h.x,y:h.y};function p(x,w,S){return w>i&&S>n?Math.min(x*i/w,x*n/S):w>i?x*i/w:S>n?x*n/S:x}let f=[];f[0]=r[0]===0?0:p(r[0],r[0]+r[3],r[0]+r[1]),f[1]=r[1]===0?0:p(r[1],r[1]+r[2],r[1]+r[0]),f[2]=r[2]===0?0:p(r[2],r[2]+r[1],r[2]+r[3]),f[3]=r[3]===0?0:p(r[3],r[3]+r[0],r[3]+r[2]);let g=d.x,m=u.x,v=u.y,y=d.y;e.addPoint(e.createPoint(g,v)),e.addPoint(e.createPoint(m,v)),e.addPoint(e.createPoint(m,y)),e.addPoint(e.createPoint(g,y)),e.isClosed=!0;let _=!0;for(let x=0,w=e.points.length;x<w;x++)e.points[x].roundness=f[x],x>0&&f[x]!==f[x-1]&&(_=!1);_&&(e.roundness=f[0]),e.useCubicForRoundedCorners=s!==1,e.update();let b=Ih.create({shape:e,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:c}});return Object.assign(b,{userData:{...t,type:"RectangleGeometry"}})}}}),UL=z(()=>{J(),w8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},t.parameters);return i.thetaLength=Pt.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i=100,height:n=i,depth:r=i,widthSegments:s=64,heightSegments:a=64,phiStart:o,phiLength:l,thetaStart:c,thetaLength:h}=t.parameters;return h===0?(e=new jt,e.setAttribute("position",new kt([],3))):e=new gh(.5*i,s,a,o,l,c,h*Pt.DEG2RAD),e.scale(1,n/i,r/i),Object.assign(e,{userData:{...t,type:"SphereGeometry"}})}}}),zL=z(()=>{J(),S8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(t){let{width:e=100,height:i=e,widthSegments:n=8,heightSegments:r=8}=t.parameters,s=new uo(e,i,n,r);return s.scale(1,1,1),Object.assign(s,{userData:{...t,type:"PlaneGeometry"}})}}}),FL=z(()=>{J(),M8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,angle:r,cornerRadius:s,cornerSegments:a}=t.parameters,o=new LL(e,i,n,r,s,a);return Object.assign(o,{userData:{...t,type:"BackdropGeometry"}})}},LL=class extends jt{constructor(t=1,e=1,i=1,n=90,r=10,s=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],c=.001;r==0&&(s=1),s=Math.max(1,Math.floor(s)),r=Math.min(r,100),n=Math.min(180-c,n),n*=Math.PI/180;let h=[],d=Math.PI/2,u=(pt=0,tt=0,mt=0)=>new T(pt,tt,mt),p=u(),f=u(),[g,m,v]=[e/2,t/2,i/2],y=-m,_=+m,[b,x,w]=[u(y,-g,+v),u(y,-g,-v),u(y,+g,-v)],S=(pt,tt=!1)=>Math.sin(pt-Math.PI/(+tt+1)),E=(pt,tt=!1)=>Math.cos(pt-Math.PI/(+tt+1));w.y=Math.sin(n)*e-g;let A=Math.cos(n)*e-v,P=b.z-c;n<=d?(w.z=Math.min(A,P),w.z==P&&(w.y-=(A-P)/Math.tan(d-n))):x.z=Math.min(x.z-A-v,b.z-c),p.subVectors(b,x),f.subVectors(w,x);let C=Math.min(p.length(),f.length())*r/100,R=C*Math.tan(n/2),O=C/Math.cos(n/2),D=p.clone().normalize().add(f.normalize()).setLength(O).add(x);p.set(0,S(n,!0),E(n,!0)),h.push([w,p.clone()]);let F=(Math.PI-n)/s;for(let pt=0;pt<=s;pt++){let tt=d+n+pt*F;p.set(0,Math.sin(tt)*R,Math.cos(tt)*R),p.add(D),f.set(0,S(tt),E(tt)),h.push([p.clone(),f.clone()])}h.push([b,u(0,1,0)]);let V=Math.sin(F/2)*R*2,U=h.length-1,j=h[0][0].distanceTo(h[1][0]),q=j+V*s+h[U-1][0].distanceTo(h[U][0]);h[0].push(1);for(let pt=0;pt<=s;pt++)h[pt+1].push(1-(j+pt*V)/q);h[U].push(0);let rt,it,Y,[ht,ot,ft]=h[0];for(let pt=1;pt<h.length;pt++)[rt,it,Y]=h[pt],a.push(y,ht.y,ht.z,y,rt.y,rt.z,_,ht.y,ht.z,_,ht.y,ht.z,y,rt.y,rt.z,_,rt.y,rt.z),o.push(0,ot.y,ot.z,0,it.y,it.z,0,ot.y,ot.z,0,ot.y,ot.z,0,it.y,it.z,0,it.y,it.z),l.push(0,ft,0,Y,1,ft,1,ft,0,Y,1,Y),[ht,ot,ft]=[rt,it,Y];this.setAttribute("position",new kt(a,3)),this.setAttribute("normal",new kt(o,3)),this.setAttribute("uv",new kt(l,2))}}}),RT=z(()=>{Oh(),Eh(),rP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return{shape:t.shape&&t.shape instanceof ji?t.shape:new ji,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,innerRadiusPercent:n,spikes:r,cornerRadius:s,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}=t.parameters,d=t.shape,u=.5*e,p=.5*i,f=a*Math.PI/360/r,g=Math.PI/2*3*-1,m=u*n/100,v=p*n/100;if(r===3&&n===50){f=2*Math.PI/r;for(let _=0;_<r;_++){let b=f*_,x=0+Math.sin(b)*u,w=0+Math.cos(b)*p;d.addPoint(d.createPoint(x,w))}}else for(let _=0;_<r;_++){let b=0+Math.cos(g)*u,x=0+Math.sin(g)*p;d.addPoint(d.createPoint(b,x)),g+=f,b=0+Math.cos(g)*m,x=0+Math.sin(g)*v,d.addPoint(d.createPoint(b,x)),g+=f}d.isClosed=!0;for(let _=0,b=d.points.length;_<b;_++)d.points[_].roundness=s;d.roundness=s,d.update();let y=Ih.create({shape:d,parameters:{roundness:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}});return Object.assign(y,{userData:{...t,type:"StarGeometry"}})}}}),NL=z(()=>{J(),E8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i}=t.parameters,n=new uo(e,i);return Object.assign(n,{userData:{...t,type:"TextFrameGeometry"}})}}}),kL=z(()=>{J(),n0(),A8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??i.width);i.shapeBlendNode&&(r=n);let s=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:n,height:r,depth:s})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,tubularSegments:s,arc:a,cornerRadius:o,cornerSegments:l}=t.parameters,c=function(h,d,u,p,f,g,m,v,y,_,b){[d,u]=[u,d],m=d/2;let x=Pt.clamp(f/360,0,1);if(x===0){let w=new jt;return w.setAttribute("position",new kt([],3)),w}return x===1&&(_=0),new vT(!0,h,d,u,p,x,g,m,0,y,_,b)}(e,i,n,.5*e,a,s,0,0,r,o,l);return c.scale(1,i/e,1),Object.assign(c,{userData:{...t,type:"TorusGeometry"}})}}}),VL=z(()=>{J(),T8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(t){let{width:e,tube:i,tubularSegments:n,radialSegments:r,p:s,q:a}=t.parameters,o=.5*e;o!==i&&(o-=i);let l=new lA(o,i,n,r,s,a);return Object.assign(l,{userData:{...t,type:"TorusKnotGeometry"}})}}}),jL=z(()=>{Oh(),Eh(),C8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},t.parameters);return{shape:t.shape&&t.shape instanceof ji?t.shape:new ji,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e=100,height:i,cornerRadius:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a,isRect:o,extrusionVersion:l}=t.parameters,c=t.shape,h=.5*e,d=.5*i;o?(c.addPoint(c.createPoint(-h,d)),c.addPoint(c.createPoint(h,-d)),c.addPoint(c.createPoint(-h,-d))):(c.addPoint(c.createPoint(0,d)),c.addPoint(c.createPoint(h,-d)),c.addPoint(c.createPoint(-h,-d))),c.isClosed=!0;for(let p=0,f=c.points.length;p<f;p++)c.points[p].roundness=n;c.roundness=n,c.update();let u=Ih.create({shape:c,parameters:{roundness:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a,extrusionVersion:l}});return Object.assign(u,{userData:{...t,type:"TriangleGeometry"}})}}}),pK=z(()=>{}),fK=z(()=>{J(),new vr,new Et,new il,new T,new T,new T,new T});function GL(){let t=new jt;return t.setAttribute("position",new Ht(new Float32Array([]),3)),t.setIndex(new Ht(new Uint16Array([]),1)),t}var HL,OT,P8=z(()=>{Dn(),Xt(),x0(),J(),y0(),Oh(),Eh(),Ip(),HL=GL().attributes,OT=class extends jt{constructor(t,e){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],this._nearSide=new Uint8Array(0),this._depth=0,this._effectiveBevel=0,this._vScale=0,Object.assign(this.attributes,HL),this.userData={parameters:t,type:"TextGeometry"};let i=e.getFont(t.font);i?.isLoaded?(this.font=i,this.update(t,e)):this.updateFont(t.font,e).then(()=>{this.update(t,e),e?.requestRender()})}async updateFont(t,e){let i=e.getFont(t);i&&(this.font=i,await i.loadingPromise)}update(t,e){let i=this.font;if(this.userData={parameters:t,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:n,height:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:c,fontSize:h,extrusionVersion:d}=t,u=_r.getDisplayedValue(l),p=function(w,S,E,A){let P=typeof w.width=="string"?Number(A.getVariable(w.width)):w.width,C=[""],R="";for(let O of E)R+=O,O===" "||O===`
|
|
4210
|
+
`;return 2&x.valid||e(3,"missing format specifier"),4&x.valid||e(3,"missing image size specifier"),x}(s),h=c.width,d=c.height,u=function(p,f,g){let m=f;if(m<8||m>32767||p[0]!==2||p[1]!==2||128&p[2])return new Uint8Array(p);m!==(p[2]<<8|p[3])&&e(3,"wrong scanline width");let v=new Uint8Array(4*f*g);v.length||e(4,"unable to allocate buffer space");let y=0,_=0,b=4*m,x=new Uint8Array(4),w=new Uint8Array(b),S=g;for(;S>0&&_<p.byteLength;){_+4>p.byteLength&&e(1),x[0]=p[_++],x[1]=p[_++],x[2]=p[_++],x[3]=p[_++],(x[0]!=2||x[1]!=2||(x[2]<<8|x[3])!=m)&&e(3,"bad rgbe scanline format");let E,A=0;for(;A<b&&_<p.byteLength;){E=p[_++];let C=E>128;if(C&&(E-=128),(E===0||A+E>b)&&e(3,"bad scanline data"),C){let R=p[_++];for(let O=0;O<E;O++)w[A++]=R}else w.set(p.subarray(_,_+E),A),A+=E,_+=E}let P=m;for(let C=0;C<P;C++){let R=0;v[y]=w[C+R],R+=m,v[y+1]=w[C+R],R+=m,v[y+2]=w[C+R],R+=m,v[y+3]=w[C+R],y+=4}S--}return v}(s.subarray(s.pos),h,d);switch(this.type){case $e:l=u.length/4;let p=new Float32Array(4*l);for(let g=0;g<l;g++)n(u,4*g,p,4*g);a=p,o=$e;break;case Xn:l=u.length/4;let f=new Uint16Array(4*l);for(let g=0;g<l;g++)r(u,4*g,f,4*g);a=f,o=Xn;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:h,height:d,data:a,header:c.string,gamma:c.gamma,exposure:c.exposure,type:o,colorSpace:Ku,minFilter:de,magFilter:de,generateMipmaps:!1,flipY:!0}}setDataType(t){return this.type=t,this}}});function eL(t){return t.length>2&&t[0]===35&&t[1]===63}var iL,q3,tl,qZ=z(()=>{J(),WZ()}),z6=z(()=>{J(),B6(),U6(),qZ(),iL=0,q3=class extends D6{constructor(t,e){super(t,e.imageHolderCache),this.data=t,this.shared=e,this.instanceId=++iL,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this.isHdr=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo=t.type==="video",this.isBuffer=t.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?t:t.data)}async updateSrc(t){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let e=()=>{this.loaded=!0;for(let n of Object.values(this._cache))for(let r of Object.values(n))for(let s of Object.values(r))s&&(s.image=this.img,s.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=t,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,typeof t!="string"){let n,r=new FileReader;r.readAsDataURL(new Blob([t],{type:"video/mp4"})),await new Promise(s=>{r.onloadend=a=>{n=a.target?.result,s(null)}}),this.img.src=n}else this.img.src=t;this.img.onloadeddata=()=>{e()}}else if(t instanceof Uint8Array?eL(t):typeof t=="string"&&/\.hdr($|[?#])/i.test(t)){let n=t instanceof Uint8Array?t:null;if(n===null)try{n=new Uint8Array(await(await fetch(t)).arrayBuffer())}catch{n=null}let r=n!==null&&eL(n)?function(s){try{let a=new O6().parse(s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength));if(!a||!a.width||!a.height)return null;let{width:o,height:l}=a,c=a.data,h=new Uint16Array(c.length),d=4*o,u=g=>th.toHalfFloat(Math.pow(Math.max(th.fromHalfFloat(g),0),1/2.2)),p=new Map,f=g=>{let m=p.get(g);return m===void 0&&(m=u(g),p.set(g,m)),m};for(let g=0;g<l;g++){let m=g*d,v=(l-1-g)*d;for(let y=0;y<d;y+=4)h[v+y]=f(c[m+y]),h[v+y+1]=f(c[m+y+1]),h[v+y+2]=f(c[m+y+2]),h[v+y+3]=c[m+y+3]}return{isSplineHdr:!0,data:h,width:o,height:l}}catch{return null}}(n):null;r!==null&&(this.isHdr=!0,this.img=r,e())}else this.img=new Image,this.img.src=typeof(i=t)=="string"?i:(Cg||(Cg=new P6),Cg.load(i)),this.img.onload=e,await new Promise(n=>{this.img.onload=()=>{e(),n(null)}});var i}getTexture(t,e=1008,i=1006){let n=this._cache[t]?.[e]?.[i];if(n)return n;{let r;return this.isBuffer?r=this.img.texture:this.isVideo?r=new NF(this.img,void 0,t,t):this.isHdr?(r=function(s){let a=new Cn(s.data,s.width,s.height,Yi,Xn);return a.flipY=!1,a.image.isSplineHdr=!0,a.needsUpdate=!0,a}(this.img),r.wrapS=t,r.wrapT=t,r.magFilter=i,r.minFilter=e):r=new ki(this.img,void 0,t,t,i,e),this.isBuffer||(r.anisotropy=8,r.generateMipmaps=e===1008),this.loaded&&(r.needsUpdate=!0),this._cache[t]===void 0&&(this._cache[t]={}),this._cache[t][e]===void 0&&(this._cache[t][e]={}),this._cache[t][e][i]=r,r}}setNeedsUpdate(t){if(!this.isBuffer)for(let e of Object.values(this._cache))for(let i of Object.values(e))for(let n of Object.values(i))n&&(n.needsUpdate=t)}disposeTextures(){for(let[t,e]of Object.entries(this._cache))for(let[i,n]of Object.entries(e))for(let[r,s]of Object.entries(n))s?.dispose(),this._cache[t]!==void 0&&this._cache[t][i]!==void 0&&(this._cache[t][i][r]=void 0)}dispose(){super.dispose(),this.disposeTextures()}}}),X3=z(()=>{z6(),tl=class extends q3{}});function XZ(t){if(typeof t=="string")return t;let e=bT.get(t);return e||(e={url:URL.createObjectURL(new Blob([t]))},bT.set(t,e)),e.url}var bT,$Z=z(()=>{bT=new Map});function YZ(){if(!xT)return nL||(nL=async function(){await Promise.resolve().then(()=>(_D(),wG)),F6(window!==void 0?window:global),xT=!0}())}var F6,N6,xT,nL,k6=z(()=>{N6=new Promise(t=>{F6=t}),xT=!1});function rL(t,e){t.forEach(i=>{"dragDropActions"in i.data?(e.push(...i.data.dragDropActions.drag),e.push(...i.data.dragDropActions.drop)):"inActions"in i.data?(e.push(...i.data.inActions),e.push(...i.data.outActions)):"gameActions"in i.data?(e.push(...i.data.gameActions.idle),e.push(...i.data.gameActions.move),e.push(...i.data.gameActions.jump),e.push(...i.data.gameActions.run)):"breakpoints"in i.data?i.data.breakpoints.forEach(n=>{e.push(...n.data.actions)}):"actions"in i.data&&(e.push(...i.data.actions),i.data.actions.forEach(n=>{n.data.type==="Conditional"&&n.data.ifActions&&(e.push(...n.data.ifActions),e.push(...n.data.elseActions))}))})}function ZZ(t){let e=!1,i=[];return t.scene.objects.traverse((n,r)=>{if(r.type==="Page"&&r.uiScene!==void 0&&r.uiScene.objects.traverse((s,a)=>{if(a.events===void 0||Array.isArray(a.events)===!1)return!0;rL(a.events,i),e=e||i.some(o=>o.data.type==="Audio")}),r.events===void 0||Array.isArray(r.events)===!1)return!0;rL(r.events,i),e=e||i.some(s=>s.data.type==="Audio")}),e}var sL,Hu,$3=z(()=>{$Z(),k6(),N6.then(t=>sL=t),Hu=class{constructor({src:t,volume:e,delay:i,loop:n}){let r;this._volume=1,this.delay=0,this._loop=1,this.loopsRemaining=0,this._status="stopped",this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)},r=typeof t=="string"?{src:t}:{src:XZ(t),format:"wav"},this.sound=new sL.Howl(r),this.sound.on("end",this.onEnd),this.src=t,e!==void 0&&(this.volume=e),i!==void 0&&(this.delay=i),n!==void 0&&(this.loop=n)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,i){this.sound.on(t,e,i)}off(t,e,i){this.sound.off(t,e,i)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}}});function aL(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&(n.geometry.type==="TextGeometry"||n.geometry.type==="InputGeometry")&&(e=!0)}),e}var Y3,Z3=z(()=>{Y3=null});function oL(t){return new et(t.y,-t.x)}var K3,wT,V6,j6,$v,lL,Ib,G6,E2,Lb=z(()=>{J(),K3=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=t.parameters?.radiusTop,n=t.parameters?.radiusBottom,r=Object.assign({},e?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},t.parameters);r.thetaLength=Pt.clamp(r.thetaLength,0,360),r.hollow=Pt.clamp(r.hollow??0,0,1);let s=r.width/2,a=r.radiusTop??s,o=r.radiusBottom??s;if(a===o?(a=s,o=s):a>o?(a=s,o=o*s/a):(a=a*s/o,o=s),r.shapeBlendNode){a=i??s,o=n??s;let l=2*Math.max(a,o);r.width=l,r.depth=l}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:a,radiusBottom:o})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:c,radiusTop:h,radiusBottom:d,cornerRadius:u,cornerSegments:p,hollow:f}=t.parameters;c===0?(e=new jt,e.setAttribute("position",new kt([],3))):e=u||f?new wT(h,d,r,s,a,o,l,c*Math.PI/180,u,u,p,f):new mg(h,d,r,s,a,o,l,c*Math.PI/180);let g=n/i;return g!==1&&e.scale(1,1,g),Object.assign(e,{userData:{...t,type:"CylinderGeometry"}})}},wT=class extends jt{constructor(t,e,i,n,r,s,a,o,l,c,h,d,u=!1){super(),this.type="RoundedCylinderBufferGeometry",t=t!==void 0?t:1,e=e!==void 0?e:1,i=i||1,n=Math.floor(n)||8,r=Math.floor(r)||1,s=s!==void 0&&s,a=a!==void 0?a:0,o=o!==void 0?o:2*Math.PI,s&&(l=0,c=0);let p=i/2;u&&t==0&&(t=l),u&&e==0&&(e=c);let f=new et(t,p),g=new et(e,-p),m=null,v=null,y=null,_=null,b=f.clone().sub(g),x=0,w=0,S=0;d>0&&(x=Math.min(t,e)*(1-d),w=t-x,S=e-x);let E=f.clone();E.x-=x;let A=Math.PI-b.angle(),P=b.angle(),C=Math.tan(P/2),R=Math.tan(A/2),O=C+R,D=d?O:R,F=d?O:C;if(l=Math.min(l,(t-w)/D,b.length()/O),c=Math.min(c,(e-S)/F,b.length()/O),l>0){let st=l/C;m=f.clone().sub(new et(st,l)),d&&(y=m.clone(),y.x-=x-O*l),f.sub(b.clone().setLength(st))}if(c>0){let st=c/R;v=g.clone().sub(new et(st,-c)),g.add(b.clone().setLength(st)),d&&(_=v.clone(),_.x-=x-O*c,E.sub(b.clone().setLength(st)))}b=f.clone().sub(g);let V=b.length()<.5,U=[],j=[],q=[],rt=[],it=[],Y=[],ht=(st,dt,bt,ct,It)=>{for(let St=0;St<h+1;St++){let Rt=St/h,Mt=ct<0?Rt:1-Rt;It&&(Mt-=1),Mt*=st;let W=Math.sin(Mt),_t=Math.cos(Mt)*ct,Dt=_t*dt+bt.y;U.push(W*dt+bt.x),j.push(Dt),q.push(W),rt.push(_t),it.push(.5+Dt/i),Y.push(!1)}},ot=(st,dt,bt)=>{let ct=[st,dt];bt<0&&ct.reverse();for(let It of ct)U.push(It),j.push(p*bt),q.push(0),rt.push(bt),it.push(.5),Y.push(!0)};if(_&&v?(ht(A,c,_,-1,!0),ht(P,c,v,-1,!1)):v?(ot(v.x,0,-1),ht(P,c,v,-1,!1)):s||ot(e,S,-1),!V){let st=oL(b).normalize();for(let dt=0;dt<=r;dt++){let bt=dt/r,ct=b.y*bt+g.y;U.push(b.x*bt+g.x),j.push(ct),q.push(st.x),rt.push(st.y),it.push(.5+ct/i),Y.push(!1)}}if(y&&m?(ht(A,l,m,1,!1),ht(P,l,y,1,!0)):m?(ht(A,l,m,1,!1),ot(m.x,0,1)):s||ot(t,w,1),d&&!V){let st=oL(b).multiplyScalar(-1).normalize();for(let dt=0;dt<=r;dt++){let bt=dt/r,ct=b.y*-bt+E.y;U.push(b.x*-bt+E.x),j.push(ct),q.push(st.x),rt.push(st.y),it.push(.5+ct/i),Y.push(!1)}}let ft=U.length,pt=ft+(d&&!s?1:0),tt=(st,dt)=>st*ft+(dt===ft?0:dt),mt=o<2*Math.PI,N=(n+1)*ft+(mt?2*(1+pt):0),L=new Float32Array(3*N),H=new Float32Array(3*N),$=new Float32Array(2*N),B=N-1>65535?new Uint32Array(n*Math.max(0,pt-1)*6+(mt?2*(pt+1)*3:0)):new Uint16Array(n*Math.max(0,pt-1)*6+(mt?2*(pt+1)*3:0)),Z=0,K=0;for(let st=0;st<=n;st++){let dt=st/n,bt=dt*o+a,ct=Math.sin(bt),It=Math.cos(bt);for(let St=0;St<ft;St++){let Rt=3*K,Mt=2*K,W=U[St],_t=q[St];L[Rt]=W*ct,L[Rt+1]=j[St],L[Rt+2]=W*It,H[Rt]=_t*ct,H[Rt+1]=rt[St],H[Rt+2]=_t*It,Y[St]?($[Mt]=.5,$[Mt+1]=.5):($[Mt]=dt,$[Mt+1]=it[St]),K++}}for(let st=0;st<n;st++)for(let dt=0;dt<pt-1;dt++){if(s&&d&&dt==r)continue;let bt=tt(st,dt),ct=tt(st+1,dt),It=tt(st+1,dt+1),St=tt(st,dt+1),Rt=L[3*It+0],Mt=L[3*It+2];B[Z++]=bt,B[Z++]=ct,B[Z++]=St,(Rt!=0||Mt!=0)&&(B[Z++]=ct,B[Z++]=It,B[Z++]=St)}function k(st,dt,bt){let ct=Math.sin(bt),It=Math.cos(bt),St=-It,Rt=ct,Mt=st<0?(Ft,_e,be)=>{B[Z++]=Ft,B[Z++]=_e,B[Z++]=be}:(Ft,_e,be)=>{B[Z++]=Ft,B[Z++]=be,B[Z++]=_e},W=(t+e+w+S)/4,_t=3*K,Dt=2*K;L[_t]=W*ct,L[_t+1]=0,L[_t+2]=W*It,H[_t]=St,H[_t+1]=0,H[_t+2]=Rt,$[Dt]=.5,$[Dt+1]=.5;let Gt=K++;for(let Ft=0;Ft<pt;Ft++){let _e=3*(dt+(Ft===ft?0:Ft));_t=3*K,Dt=2*K,L[_t]=L[_e],L[_t+1]=L[_e+1],L[_t+2]=L[_e+2],H[_t]=St,H[_t+1]=0,H[_t+2]=Rt;let be=_e/3*2|0;$[Dt]=$[be],$[Dt+1]=$[be+1],K++}for(let Ft=Gt+1;Ft<K-1;Ft++)Mt(Gt,Ft,Ft+1);Mt(Gt,K-1,Gt+1)}mt&&(k(-1,0,a),k(1,n*ft,a+o)),this.setIndex(new Ht(B.slice(0,Z),1)),this.setAttribute("position",new Ht(L,3)),this.setAttribute("normal",new Ht(H,3)),this.setAttribute("uv",new Ht($,2))}}}),hL=z(()=>{J(),Lb(),V6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},t.parameters);return i.thetaLength=Pt.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:c,cornerRadiusTop:h,cornerRadiusBottom:d,cornerSegments:u}=t.parameters;c===0?(e=new jt,e.setAttribute("position",new kt([],3))):e=h>0||d>0||c<360?new wT(0,i/2,r,s,a,o,l,c*Math.PI/180,h,d,u,0,!0):new K_(i/2,r,s,a,o);let p=n/i;return p!==1&&e.scale(1,1,p),Object.assign(e,{userData:{...t,type:"ConeGeometry"}})}}}),cL=z(()=>{J(),j6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i,height:n,depth:r,widthSegments:s,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:c}=t.parameters;return e=l===0?new ya(i,n,r,s,a,o):new lL(i,n,r,s,a,o,l,c),Object.assign(e,{userData:{...t,type:"CubeGeometry"}})}},$v=Math.PI/2,lL=class extends jt{constructor(t=1,e=1,i=1,n=1,r=1,s=1,a=0,o=4){super(),this.type="BoxGeometry",n=Math.floor(n),r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=(a=Math.min(a,t/2,e/2,i/2))>0,c=o+1,h=2*((s+1)*(r+1)+(n+1)*(s+1)+(n+1)*(r+1))+(l?4*c*(s+1+(n+1)+(r+1))+c*(c+1)/2*8:0),d=2*(s*r+n*s+n*r)+(l?4*o*(s+n+r):0),u=l?8*o*o:0,p=new Float32Array(3*h),f=new Float32Array(3*h),g=new Float32Array(2*h),m=h-1>65535?new Uint32Array(6*d+3*u):new Uint16Array(6*d+3*u),v=0,y=0,_=new Float64Array(c),b=new Float64Array(c),x=new Float64Array(c),w=new Float64Array(c);for(let O=0;O<c;O++){let D=O/o*$v;_[O]=Math.sin(D)*a,b[O]=(1-Math.cos(D))*a,x[O]=Math.sin(D),w[O]=Math.cos(D)}let S=c*(c+1)/2,E=new Float64Array(3*S),A=new Float64Array(3*S);{let O=new T(t/2,e/2,i/2);O.subScalar(a);let D=0;for(let F=0;F<=o;F++){let V=$v*(1-F/o),U=Math.cos(V),j=Math.sin(V),q=0;for(let rt=0;rt<=F;rt++){let it=U*Math.cos(q),Y=j,ht=U*Math.sin(q);E[3*D]=it,E[3*D+1]=Y,E[3*D+2]=ht,A[3*D]=O.x+it*a,A[3*D+1]=O.y+Y*a,A[3*D+2]=O.z+ht*a,D++,q+=$v/F}}}function P(O,D,F,V,U,j,q,rt,it,Y){let ht=(j-2*a)/it,ot=(q-2*a)/Y,ft=j/2-a,pt=q/2-a,tt=rt/2,mt=it+1,N=Y+1,L=0,H=new T;for(let $=0;$<N;$++){let B=$*ot-pt;for(let Z=0;Z<mt;Z++){let K=Z*ht-ft,k=3*(v+L),st=2*(v+L);H[O]=K*V,H[D]=B*U,H[F]=tt,p[k]=H.x,p[k+1]=H.y,p[k+2]=H.z,H[O]=0,H[D]=0,H[F]=rt>0?1:-1,f[k]=H.x,f[k+1]=H.y,f[k+2]=H.z,g[st]=Z/it,g[st+1]=1-$/Y,L+=1}}for(let $=0;$<Y;$++)for(let B=0;B<it;B++){let Z=v+B+mt*$,K=v+B+mt*($+1),k=v+(B+1)+mt*($+1),st=v+(B+1)+mt*$;m[y++]=Z,m[y++]=K,m[y++]=st,m[y++]=K,m[y++]=k,m[y++]=st}v+=L}function C(O,D,F,V,U,j,q,rt,it,Y){let ht=(q-2*a)/Y,ot=q/2-a,ft=rt/2-a,pt=it/2,tt=Y+1,mt=0,N=new T,L=new T;for(let H=0;H<o+1;H++){N[D]=(ft+_[H])*U,N[F]=(pt-b[H])*j,L[O]=0,L[D]=x[H]*Math.sign(N[D]),L[F]=w[H]*Math.sign(N[F]);for(let $=0;$<tt;$++){let B=$*ht-ot;N[O]=B*V;let Z=3*(v+mt),K=2*(v+mt);p[Z]=N.x,p[Z+1]=N.y,p[Z+2]=N.z,f[Z]=L.x,f[Z+1]=L.y,f[Z+2]=L.z,g[K]=$/Y,g[K+1]=0,mt+=1}}for(let H=0;H<o;H++)for(let $=0;$<Y;$++){let B=v+$+tt*H,Z=v+$+tt*(H+1),K=v+($+1)+tt*(H+1),k=v+($+1)+tt*H;m[y++]=B,m[y++]=Z,m[y++]=k,m[y++]=Z,m[y++]=K,m[y++]=k}v+=mt}function R(O,D,F){let V=O*D*F>0?(j,q,rt)=>{m[y++]=j,m[y++]=q,m[y++]=rt}:(j,q,rt)=>{m[y++]=j,m[y++]=rt,m[y++]=q},U=v;for(let j=0;j<S;j++){let q=3*j,rt=3*v,it=2*v;p[rt]=O*A[q],p[rt+1]=D*A[q+1],p[rt+2]=F*A[q+2],f[rt]=O*E[q],f[rt+1]=D*E[q+1],f[rt+2]=F*E[q+2],g[it]=0,g[it+1]=0,v++}for(let j=0;j<o;j++){let q=U+j*(j+1)/2,rt=U+(j+1)*(j+2)/2;V(q,rt+1,rt);for(let it=1;it<=j;it++)V(q+it-1,q+it,rt+it),V(q+it,rt+it+1,rt+it)}}P("z","y","x",-1,-1,i,e,t,s,r),P("z","y","x",1,-1,i,e,-t,s,r),P("x","z","y",1,1,t,i,e,n,s),P("x","z","y",1,-1,t,i,-e,n,s),P("x","y","z",1,-1,t,e,i,n,r),P("x","y","z",-1,-1,t,e,-i,n,r),a>0&&(C("z","y","x",-1,-1,1,i,e,t,s),C("z","y","x",1,-1,-1,i,e,t,s),C("z","y","x",-1,1,-1,i,e,t,s),C("z","y","x",1,1,1,i,e,t,s),C("x","y","z",-1,-1,-1,t,e,i,n),C("x","y","z",1,-1,1,t,e,i,n),C("x","y","z",-1,1,1,t,e,i,n),C("x","y","z",1,1,-1,t,e,i,n),C("y","x","z",-1,-1,1,e,t,i,r),C("y","x","z",1,-1,-1,e,t,i,r),C("y","x","z",1,1,1,e,t,i,r),C("y","x","z",-1,1,-1,e,t,i,r),R(1,1,1),R(-1,1,1),R(1,-1,1),R(-1,-1,1),R(1,1,-1),R(-1,1,-1),R(1,-1,-1),R(-1,-1,-1)),this.setIndex(new Ht(m,1)),this.setAttribute("position",new Ht(p,3)),this.setAttribute("normal",new Ht(f,3)),this.setAttribute("uv",new Ht(g,2))}}}),H6=z(()=>{J(),Ib=class extends jt{constructor(t=[],e=[],i="",n=1,r=.2,s=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,c=0;return function(){(r=Math.min(.99999,r))==0&&(s=0);let h={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new T,u=d.clone(),p=new vn,f=r*n,g=n-f,m=s+1,v=new T,y=(tt,mt)=>v.subVectors(tt,mt).normalize(),_=(tt,mt)=>Array(tt).fill(void 0).map(mt),b=_(t.length/3,(tt,mt)=>new T().fromArray(t,3*mt).setLength(n)),x=[],w=1e6;for(let tt=0;tt<b.length;tt++){let mt,N,L,H=b[tt],$=[],B=1e10,Z=-1;for(;(Z=e.indexOf(tt,Z+1))!=-1;){let dt=Z-Z%3;mt=e[dt+(Z+1)%3],N=e[dt+(Z+2)%3],L=H.distanceToSquared(b[mt]),B=Math.min(B,L),$.push([mt,N,L])}B+=1e-6;let K=[],k=0,st=$.length;for(let dt=0;dt<st;dt++){[mt,N,L]=$[k];let bt=x[mt]?.includes(tt)==1;L<=B&&K.push(mt+ +bt*w),k=$.findIndex(ct=>ct[0]==N)}x.push(K)}let S=[];{let tt,mt,N=0,L=0,H=h==3;for(let $=0;$<=s;$++){tt=$*($+1)/2,mt=($+1)*($+2)/2;for(let B=0;B<s-$;B++)[N,L]=[tt+B+$+2,mt+B+$+3],S.push(tt,mt,...H?[L,tt]:[N,mt],L,N),[tt,mt]=[N,L];S.push(tt,mt,tt+s+2)}}let E=0;for(let tt=0;tt<x.length;tt++)for(let mt=0;mt<h;mt++)x[tt][mt]<w&&E++;let A=b.length*h*S.length*3+E*m*6*3+2*E*3*3;a=new Float64Array(A),o=new Float64Array(A),l=new Float64Array(A/3*2);let P=(tt,mt,N)=>{let L=c/3*2;l[L]=Math.atan2(N,-tt)/2/Math.PI+.5,l[L+1]=1-(Math.atan2(-mt,Math.sqrt(tt*tt+N*N))/Math.PI+.5)},C=tt=>{a[c]=tt.x,a[c+1]=tt.y,a[c+2]=tt.z,o[c]=v.x,o[c+1]=v.y,o[c+2]=v.z,P(tt.x,tt.y,tt.z),c+=3},R=tt=>{a[c]=tt[0].x,a[c+1]=tt[0].y,a[c+2]=tt[0].z,o[c]=tt[1].x,o[c+1]=tt[1].y,o[c+2]=tt[1].z,P(tt[0].x,tt[0].y,tt[0].z),c+=3},O=(s+2)*(s+3)/2,D=new Float64Array(3*O),F=new Float64Array(3*O),V=new Float64Array(2*O),U=_(2*h*m,()=>new T),j=_(s*Math.max(0,s-1)/2,()=>new T),q=d.clone(),rt=d.clone(),it=d.clone(),Y=d.clone(),ht=d.clone(),ot=[],ft=_(b.length,()=>_(h,()=>d.clone()));for(let tt=0;tt<b.length;tt++){d.copy(b[tt]).normalize(),q.copy(d).multiplyScalar(g);let mt=x[tt];for(let K=0;K<mt.length;K++){let k=mt[K],st=mt[(K+1)%h];p.setFromPointsAndIndices(b,tt,k%w,st%w),p.b.sub(p.a).setLength(1e10).add(p.a),p.c.sub(p.a).setLength(1e10).add(p.a),p.closestPointToPoint(q,ft[tt][K])}let N=0,L=[],H=[],$=new T;s==0&&[...ft[tt]].reduce((K,k)=>K.add(k),$).multiplyScalar(1/h);for(let K=0;K<h;K++){let k=[],st=(K-1+h)%h,dt=ft[tt][st],bt=ft[tt][K];d.copy(dt).sub(q),u.copy(bt).sub(q);let ct=q.angleTo(d),It=d.angleTo(u),St=Math.cos(ct)*f;s==0?rt.copy($):rt.copy(q).setLength(g+St),L.push(St);let Rt=[rt,dt,bt];for(let Mt=0;Mt<2;Mt++){let W=Rt[Mt],_t=Rt[Mt+1];Y.subVectors(W,q),ht.subVectors(_t,q),it.crossVectors(Y,ht).normalize();for(let Dt=0;Dt<m;Dt++){let Gt=[ct,It][Mt]*Dt/m;d.copy(Y).applyAxisAngle(it,Gt).add(q),U[N++].copy(d),Mt&&(y(d,q),k.push([Dt==0?W:d.clone(),v.clone()]))}Mt&&(y(_t,q),k.push([_t,v.clone()]))}H.push(k)}ot.push(H);let B=2*m,Z=2;for(let K=0;K<h;K++){let k=B*K,st=B*((K+1)%h),dt=0,bt=[U[k]];for(let ct=1;ct<m;ct++){let It=U[k+ct],St=U[st+ct];bt.push(It);for(let Rt=1,Mt=ct-Z+1;Rt<=Mt;Rt++)d.lerpVectors(It,St,Rt/(Mt+1)),d.sub(q).setLength(L[K]).add(q),bt.push(j[dt++].copy(d));bt.push(St)}for(let ct=0;ct<m;ct++)bt.push(U[ct+m+k]);bt.push(U[st+m]);for(let ct=0,It=bt.length;ct<It;ct++){let St=bt[ct],Rt=3*ct,Mt=2*ct;D[Rt]=St.x,D[Rt+1]=St.y,D[Rt+2]=St.z,y(St,q),F[Rt]=v.x,F[Rt+1]=v.y,F[Rt+2]=v.z,V[Mt]=Math.atan2(St.z,-St.x)/2/Math.PI+.5,V[Mt+1]=1-(Math.atan2(-St.y,Math.sqrt(St.x*St.x+St.z*St.z))/Math.PI+.5)}for(let ct=0,It=S.length;ct<It;ct++){let St=3*S[ct],Rt=2*S[ct],Mt=c/3*2;a[c]=D[St],a[c+1]=D[St+1],a[c+2]=D[St+2],o[c]=F[St],o[c+1]=F[St+1],o[c+2]=F[St+2],l[Mt]=V[Rt],l[Mt+1]=V[Rt+1],c+=3}}}let pt=[];for(let tt=0;tt<x.length;tt++)for(let mt=0;mt<h;mt++){let N=x[tt][mt];if(N<w){let L=x[N].findIndex(B=>B%w==tt),H=ot[tt][mt],$=ot[N][L];for(let B=0;B<m;B++){let Z=H[B],K=$[m-B],k=H[B+1],st=$[m-(B+1)];R(Z),R(K),R(k),R(k),R(K),R(st)}pt.push(H[0][0],$[m][0],H[m][0],$[0][0])}}for(;pt.length;){let tt,mt,N,[L,H]=pt.splice(0,2);tt=H;let $=[L];for(;L!=tt;)$.push(tt),mt=pt.indexOf(tt),N=mt%2,tt=pt.splice(mt-N,2)[1-N];v.subVectors($[0],$[1]).cross(d.subVectors($[0],$[2])).normalize();let B=v.dot($[0])<0;B&&v.negate();for(let Z=1;Z<=$.length-2;Z++)C($[Z+ +B]),C($[Z+1-+B]),C($[0])}}(),function(){let h=new T,d=new T,u=new T,p=new T,f=new et,g=new et,m=new et,v=(b,x,w,S)=>{S<0&&b.x===1&&(l[x]=b.x-1),w.x===0&&w.z===0&&(l[x]=S/2/Math.PI+.5)};for(let b=0,x=0;b<c;b+=9,x+=6){h.set(a[b+0],a[b+1],a[b+2]),d.set(a[b+3],a[b+4],a[b+5]),u.set(a[b+6],a[b+7],a[b+8]),f.set(l[x+0],l[x+1]),g.set(l[x+2],l[x+3]),m.set(l[x+4],l[x+5]),p.copy(h).add(d).add(u).divideScalar(3);let w=_(p);v(f,x+0,h,w),v(g,x+2,d,w),v(m,x+4,u,w)}let y=c/3*2;for(let b=0;b<y;b+=6){let x=l[b+0],w=l[b+2],S=l[b+4],E=Math.max(x,w,S),A=Math.min(x,w,S);E>.9&&A<.1&&(x<.2&&(l[b+0]+=1),w<.2&&(l[b+2]+=1),S<.2&&(l[b+4]+=1))}function _(b){return Math.atan2(b.z,-b.x)}}(),this.setAttribute("position",new Ht(new Float32Array(a.subarray(0,c)),3)),this.setAttribute("normal",new Ht(new Float32Array(o.subarray(0,c)),3)),void this.setAttribute("uv",new Ht(new Float32Array(l.subarray(0,c/3*2)),2))}static fromJSON(t){return new Ib(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}}}),dL=z(()=>{H6(),J(),G6=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=r===0&&s!==0?new E2(.5*e,s,a):new iA(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"DodecahedronGeometry"}})}},E2=class extends Ib{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r=1/n,s="DodecahedronGeometry";super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],s,t,e,i),this.type=s}static fromJSON(t){return new E2(t.radius,t.corner,t.cornerSides)}}});function uL(t,e=new et){let i=t.length();return e.set(-t.y/i,t.x/i)}function KZ(t){let e=new et;e.addVectors(t.v0,jc.subVectors(t.v1,t.v0).multiplyScalar(2/3));let i=new et;return i.addVectors(t.v2,o0.subVectors(t.v1,t.v2).multiplyScalar(2/3)),new ks(t.v0,e,i,t.v2)}function Jm(t,e,i=Number.EPSILON){return Math.abs(t-e)<i}function QZ(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function JZ(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function W6(t,e,i){let n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),s=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2));return Math.acos((r*r+n*n-s*s)/(2*r*n))}function tK(t,e,i){return fL(t,e)&&fL(e,i)&&ST(t.position,e.position,i.position)}function ST(t,e,i){return jc.copy(e).sub(t).cross(o0.copy(i).sub(t))===0}function eK(t,e,i,n,r){let s=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),a=(t.y+e.y)/2,o=(t.x+e.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(t.y-e.y)/s,c=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(e.x-t.x)/s;return n.set(o+l,a+c),r.set(o-l,a-c),[n,r]}function iK(t,e,i){return t.distanceTo(i)<e.distanceTo(i)?e:t}function nK(t,e,i,n,r,s){let a,o=e.x-t.x,l=e.y-t.y,c=i.x-t.x,h=i.y-t.y,d=Math.sqrt((o+c)*(o+c)+(l+h)*(l+h));return W6(e,t,i)>Math.PI&&(d*=-1),a=Jm(h,l)?(l+h)*(n/d-.5)*8/3/(o-c):(o+c)*(n/d-.5)*8/3/(h-l),r.set(e.x-a*l,e.y+a*o),s.set(i.x+a*h,i.y-a*c),[r,s]}function pL(t,e){return t.position.equals(t.controls[1].position)&&e.position.equals(e.controls[0].position)}function fL(t,e){return ST(t.position,t.controls[1].position,e.position)&&ST(t.position,e.controls[0].position,e.position)}function mL(t,e=12,i=!1){let n=[];for(let r=0,s=t.length;r<s;r++){let a=t[r],o=0;if(i&&a.roundedCurveCorner!==void 0){let l=.5*Vc(a.roundedCurveCorner,e);r>0&&(n[r-1]+=l),o+=l}a.curveAfter!==void 0&&(o+=Vc(a.curveAfter,e)),n.push(o)}return t.length>0&&i&&t[0].roundedCurveCorner!==void 0&&(n[t.length-1]+=.5*Vc(t[0].roundedCurveCorner,e)),n}function Vc(t,e=12){return t&&t instanceof zm?2*e:t&&(t instanceof gs||t instanceof nA)?1:t&&t instanceof O1?e*t.points.length:e}var Uu,Yv,Zv,$c,$1,jc,o0,q6,X6,$6,Y6,MT,ET,Kv,gL,vL,yL,_L,bL,ji,Z6=z(()=>{J(),Uu=1e-12,Yv=class{constructor(t){this.position=new et,this.startPosition=new et,this.uuid=Pt.generateUUID(),this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new Yv(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Zv=class extends Yv{constructor(t){super(t.position),this.parent=t}copy(t){return super.copy(t),this}clone(){return new Zv(this.parent).copy(this)}},$c=class extends Yv{constructor(t,e){super(e),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=t,this.controls.push(new Zv(this),new Zv(this))}static create(t,e){let i=new $c(t,new et(...e.position));return i.controls[0].position.set(...e.controlPrevious.position),i.controls[1].position.set(...e.controlNext.position),i.roundness=e.roundness,i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored,i}getOppositeControl(t){let e=this.controls.indexOf(t);return e===0?this.controls[1]:e===1?this.controls[0]:null}applyOffsetToControls(t,e=1){for(let i=0,n=this.controls.length;i<n;i++){let r=this.controls[i];this.position.distanceTo(r.position)<=e?r.position.copy(this.position):r.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new $c(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let t=this.curveBefore?.getTangentAt(1),e=this.curveAfter?.getTangentAt(0);return[t,e]}computeNormals(t=new et,e=new et){let[i,n]=this.computeTangents();return i&&n&&(uL(i,t),uL(n,e)),[t,e]}computeTangent(t=new et){let[e,i]=this.computeTangents();return e&&i&&t.copy(e).add(i).normalize(),t}computeNormal(t=new et){let[e,i]=this.computeNormals();return t.copy(e).add(i).normalize(),t}},$1=t=>t,jc=new et,o0=new et,q6=new et,X6=new et,$6=new et,Y6=new et,MT=new T,ET=new T}),Oh=z(()=>{J(),Z6(),Kv=new et,gL=new et,vL=new et,yL=new et,_L=new et,bL=new et,ji=class extends Xg{constructor(t=100,e=100){super(),this.points=[],this.shapeHoles=[],this.plane=new jr(new T(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this.isText=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=Pt.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=t,this._height=e}static createFromState(t,e,i){let n=new ji;return n.isClosed=t.isClosed,n.points=t.points.map(r=>$c.create(r.id,r.data)),typeof t.roundness=="number"&&(n.roundness=t.roundness),n.shapeHoles=t.shapeHoles.map(r=>ji.createFromState(r)),e!==void 0&&i!==void 0&&n.applySize(e,i),n.update(),n}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let e=0,i=this.points.length;e<i;e++)this.points[e].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(t){let e=this.points.length,i=this.points.findIndex(n=>n.uuid===t);if(i<0){let n=e;for(let r=0,s=this.shapeHoles.length;r<s;r++){let a=this.shapeHoles[r],o=a.points.length,l=a.getPointIndexById(t);if(!(l<0))return l+n;n+=o}}return i}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0){let e=this.points.length;for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=t-e;if(s<=r.points.length-1)return r.points[s];e+=r.points.length}}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let e=this.points.indexOf(t);if(e>=0)return e;if(e=this.points.length,this.shapeHoles.length>0)for(let i=0,n=this.shapeHoles.length;i<n;i++){let r=this.shapeHoles[i],s=r.points.indexOf(t);if(s>=0)return e+s;e+=r.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...t]}applySize(t,e){t===0&&(t=.001),e===0&&(e=.001),this._width=t,this._height=e}applyScale(t,e){let i=Kv.set(t,e);for(let n=0,r=this.points.length;n<r;n++){let s=this.points[n];s.position.multiply(i),s.controls[0].position.multiply(i),s.controls[1].position.multiply(i)}for(let n=0,r=this.shapeHoles.length;n<r;n++)this.shapeHoles[n].applyScale(t,e);this._update()}createPoint(t,e=0,i=Pt.generateUUID()){let n;n=t instanceof et?t:new et(t,e);let r=new $c(i,n);return r.roundness=this.roundness,r}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,e){this.points.splice(e,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(n.uuid===t)return n}for(let e=0,i=this.shapeHoles.length;e<i;e++){let n=this.shapeHoles[e].getPointByUuid(t);if(n)return n}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let e=this.points.indexOf(t);e>=0&&this.points.splice(e,1),this.needsUpdate=!0}removePointById(t){let e=this.points.find(i=>i.uuid===t);e&&this.removePoint(e)}update(){for(let t=0,e=this.shapeHoles.length;t<e;t++)this.shapeHoles[t].update();this._update()}extractShapePointsToBuffer(t,e=12,i=!1){this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e);let n=i?this.roundedCurveDivisions:this.curveDivisions;return function(r,s,a=12,o=!0){let l,c=ET.set(0,0,0),h=0,d=[];for(let u=0;u<s.length;u++){let p=$1(s[u]),f=jc,g=Vc(p,a);d.push(g);for(let m=0;m<=g;m++)if(p instanceof ks||p instanceof Ko||p instanceof gs){if(p.getPoint(m/g,f),c.set(f.x,f.y,0),l!==void 0&&JZ(l,c))continue;l===void 0&&(l=MT),l.copy(c),r.setXYZ(h,c.x,c.y,c.z),h++}}o&&h>1&&(r.getX(h-1)!==r.getX(0)||r.getY(h-1)!==r.getY(0)||r.getZ(h-1)!==r.getZ(0))&&(r.setXYZ(h,r.getX(0),r.getY(0),r.getZ(0)),h++)}(t,i?this.roundedCurves:this.curves,e,this.autoClose),n.reduce((r,s)=>r+s,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=mL(this.points,t,!1),this.roundedCurveDivisions=mL(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,e,i=12){return 2*function(n,r,s,a=12,o=!0){let l=ET.set(0,0,0),c=0,h=[];for(let d=0;d<r.length;d++){if(s[d]===!1)continue;let u,p=$1(r[d]),f=jc,g=Vc(p,a);h.push(g);for(let m=0;m<=g;m++)if(p instanceof ks||p instanceof Ko||p instanceof gs){if(p.getPoint(m/g,f),l.set(f.x,f.y,0),u?.equals(l))continue;u===void 0?u=MT:(n.setXYZ(c,u.x,u.y,u.z),c++,n.setXYZ(c,l.x,l.y,l.z),c++),u.copy(l)}}return o&&c>1&&!(n.getX(c-1)===n.getX(0)&&n.getY(c-1)===n.getY(0)&&n.getZ(c-1)===n.getZ(0))&&(n.setXYZ(c,n.getX(0),n.getY(0),n.getZ(0)),c++),h}(t,this.curves,e,i,this.autoClose).reduce((n,r)=>n+r,0)}extractShapePointsToFlatArray(t,e=12){return this.subdivision=e,this.curveDivisions===void 0&&this.computeCurveDivisions(e),function(i,n,r=12,s=!0){let a,o=0;for(let l=0;l<n.length;l++){let c=$1(n[l]),h=Vc(c,r),d=jc;for(let u=0;u<=h;u++)if(c instanceof ks||c instanceof Ko||c instanceof gs){if(c.getPoint(u/h,d),a!==void 0&&QZ(a,d,Uu))continue;a===void 0&&(a=o0),a.copy(d),i.push(d.x,d.y),o++}}return Jm(i[0],i[i.length-2],Uu)&&Jm(i[1],i[i.length-1],Uu)&&(i.pop(),i.pop()),s&&o>1&&!(Jm(i[o-1],i[1],Uu)&&Jm(i[o-2],i[0],Uu))&&(i.push(i[0],i[1]),o++),i}(t,this.roundedCurves,e,this.autoClose)}getCurveIndexFromVertexId(t,e=!1){let i=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let n=e?this.roundedCurveDivisions:this.curveDivisions,r=0;e&&this.points[0].roundedCurveCorner!==void 0&&(r=.5*Vc(this.points[0].roundedCurveCorner,this.subdivision));let s=t-r;s<0&&(s+=n.reduce((a,o)=>a+o,0));for(let a=0,o=n.length;a<o;a++){let l=n[a];if(s<i+l)return[a,(s-i+1)/l];i+=l}return[0,1]}getCurveT(t,e,i){let n=this.points[t],r=this.points[t>=this.points.length-1?0:t+1],s=this.curveDivisions,a=s[t];if(pL(n,r)){let l=n.position.distanceTo(r.position);return n.position.distanceTo(Kv.set(i.x,i.y))/l}let o=0;for(let l=0;l<t;l++)o+=s[l];return(e-o)/a}dispose(){}_applyCurveForPoint(t,e){pL(e,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(e.controls[1].position.x,e.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let i=this.curves[this.curves.length-1];t.curveBefore=i,e.curveAfter=i;let n=i.clone();t.roundedCurveBefore=n,e.roundedCurveAfter=n,t.roundedCurveCorner=void 0,this.roundedCurves.push(n)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let e=0,i=this.points.length;e<i;e++){let n=this.points[e];if(e===0)this.moveTo(n.position.x,n.position.y);else{let r=this.points[e-1];this._applyCurveForPoint(n,r)}}let t=this.getLastPoint();if(t?.curveAfter&&(t.curveAfter=void 0),this.isClosed){let e=this.points[0],i=this.points[this.points.length-1];this._applyCurveForPoint(e,i)}if(this.points.length>2){let e=0;for(let i=0,n=this.points.length;i<n;i++){let r=this.points[i],s=this.points[i-1]??this.points[this.points.length-1],a=this.points[i+1]??this.points[0],o=r.roundness,l=s&&a&&tK(s,r,a);if(!r.controlsMoved()&&o>0&&!l){let c=r.curveBefore,h=r.curveAfter;if(c===void 0||h===void 0)continue;let d,u=r.roundedCurveBefore,p=r.roundedCurveAfter,f=c instanceof gs?c.v1.distanceTo(c.v2):c.getLength(),g=h instanceof gs?h.v1.distanceTo(h.v2):h.getLength(),m=Math.min(o,.499*f),v=Math.min(o,.499*g),y=Math.min(m,v),_=1-y/f,b=y/g,x=c.getPointAt(_,Kv),w=h.getPointAt(b,gL);if(this._subSplitCurve(c,u,_,x,void 0),this._subSplitCurve(h,p,b,void 0,w),this.useCubicForRoundedCorners){let S=W6(x,r.position,w)/2,E=Math.tan(S)*x.distanceTo(r.position),[A,P]=eK(x,w,E,vL,yL),C=iK(A,P,r.position),[R,O]=nK(C,x,w,E,_L,bL);d=new ks(x.clone(),R.clone(),O.clone(),w.clone())}else d=new Ko(x.clone(),r.position.clone(),w.clone());r.roundedCurveCorner=d,this.roundedCurves.splice(i+e,0,d),e++}}}}_subSplitCurve(t,e,i,n,r){if(!(t instanceof gs)){let s=t,a=e,o=s.getUtoTmapping(i,0),l=function(c,h,d,u,p=.5){let f=jc.subVectors(h,c).multiplyScalar(p).add(c),g=o0.subVectors(d,h).multiplyScalar(p).add(h),m=q6.subVectors(u,d).multiplyScalar(p).add(d),v=f,y=X6.subVectors(g,f).multiplyScalar(p).add(f),_=$6.subVectors(m,g).multiplyScalar(p).add(g),b=m,x=Y6.subVectors(_,y).multiplyScalar(p).add(y);return[c.x,c.y,v.x,v.y,y.x,y.y,x.x,x.y,_.x,_.y,b.x,b.y,u.x,u.y]}(s.v0,s.v1,s.v2,s.v3,o);return n!==void 0&&(a.v0.set(l[0],l[1]),a.v1.set(l[2],l[3]),a.v2.set(l[4],l[5]),a.v3.set(l[6],l[7])),r!==void 0&&(a.v0.set(l[6],l[7]),a.v1.set(l[8],l[9]),a.v2.set(l[10],l[11]),a.v3.set(l[12],l[13])),a}return n!==void 0&&e.v2.copy(n),r!==void 0&&e.v1.copy(r),e}clone(){let t=new ji(this._width,this._height);return t.points=this.points.map(e=>e.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(e=>e.clone()),t}toJSON(){return{points:this.points.reduce((t,e)=>t.concat(e.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){this.points=[],this.pointIDs=0;let e=t.points.length/7;for(let i=0;i<e;i++){let n=7*i,r=t.points[n+0],s=t.points[n+1],a=t.points[n+2],o=t.points[n+3],l=t.points[n+4],c=t.points[n+5],h=t.points[n+6],d=new $c(Pt.generateUUID(),new et(r,s));d.controls[0].position.set(a,o),d.controls[1].position.set(l,c),d.roundness=h,this.points.push(d)}return this.shapeHoles=t.shapeHoles?.length?t.shapeHoles.map(i=>{let n=new ji;return n.fromJSON(i),n}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t,e=!1){this.isText=e;let i=(n,r)=>{r instanceof ks&&r.v3.equals(n.position)&&n.controls[0].position.copy(r.v2)};return this.points=(n=>{let r,s,a=[];for(r=0,s=n.length;r<s;r++)n[r]instanceof Ko&&(n[r]=KZ(n[r]));for(r=0,s=n.length;r<s;r++){let c,h=n[r],d=r>0?n[r-1]:null;h instanceof ks?(c=this.createPoint(h.v0),c.controls[1].position.copy(h.v1)):h instanceof gs&&(c=this.createPoint(h.v1)),c!==void 0&&(d!==null&&i(c,d),a.push(c))}let o=n[n.length-1],l=!1;return o instanceof ks?o.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(o.v2),l=!0):o instanceof gs&&o.v2.equals(a[0].position)&&(l=!0),this.isClosed=l,a})(t.curves),t instanceof Xg&&(this.shapeHoles=t.holes.map(n=>{let r=new ji;return r.fromShape(n),r})),this.update(),this}updatePoint(t,e){let i=this.getPointByUuid(t);i&&(e.position!==void 0&&i.position.fromArray(e.position),e.roundness!==void 0&&(i.roundness=e.roundness),e.areControlsDirectionsMirrored!==void 0&&(i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(t,e){let i=this.getPointByUuid(t)?.controls[0];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}updateNextControl(t,e){let i=this.getPointByUuid(t)?.controls[1];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}}});function A2({x:t,y:e},i,n,r,s){return{x:t*i+r,y:e*n+s}}function rK(t,e){let i=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),n=Math.cos(t),r=Math.sin(t),s=Math.cos(t+e),a=Math.sin(t+e);return[{x:n-r*i,y:r+n*i},{x:s+a*i,y:a-s*i},{x:s,y:a}]}function xL(t,e,i,n){let r=t*n-e*i<0?-1:1,s=Math.min(1,Math.max(-1,t*i+e*n));return r*Math.acos(s)}var Y1,sK=z(()=>{Y1=2*Math.PI});function he(t,e){if(!t)throw e||"Assertion Failed!"}function Pg(t){var e=t.windingRule,i=e===void 0?Bi.ODD:e,n=t.elementType,r=n===void 0?gr.POLYGONS:n,s=t.polySize,a=s===void 0?3:s,o=t.vertexSize,l=o===void 0?2:o,c=t.normal,h=c===void 0?[0,0,1]:c,d=t.contours,u=d===void 0?[]:d,p=t.strict,f=p===void 0||p,g=t.debug,m=g!==void 0&&g;if(!u&&f)throw new Error("Contours can't be empty");if(u){var v=new K6;t.edgeCreateCallback&&(v.edgeCreateCallback=t.edgeCreateCallback),t.vertexIdCallback&&(v.vertexIdCallback=t.vertexIdCallback);for(var y=0;y<u.length;y++)v.addContour(l||2,u[y]);return v.tesselate(i,r,a,l,h,f),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:m?v.mesh:void 0}}}var Bi,gr,re,$d,$f,cc,T2,C2,P2,wL,Qv,D2,SL,ML,K6,x0=z(()=>{var t;(t=Bi||(Bi={}))[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(gr||(gr={})),re=function(){function e(){}return e.vertEq=function(i,n){return i.s===n.s&&i.t===n.t},e.vertLeq=function(i,n){return i.s<n.s||i.s===n.s&&i.t<=n.t},e.transLeq=function(i,n){return i.t<n.t||i.t===n.t&&i.s<=n.s},e.edgeGoesLeft=function(i){return e.vertLeq(i.Dst,i.Org)},e.edgeGoesRight=function(i){return e.vertLeq(i.Org,i.Dst)},e.vertL1dist=function(i,n){return Math.abs(i.s-n.s)+Math.abs(i.t-n.t)},e.edgeEval=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var s=n.s-i.s,a=r.s-n.s;return s+a>0?s<a?n.t-i.t+(i.t-r.t)*(s/(s+a)):n.t-r.t+(r.t-i.t)*(a/(s+a)):0},e.edgeSign=function(i,n,r){he(e.vertLeq(i,n)&&e.vertLeq(n,r));var s=n.s-i.s,a=r.s-n.s;return s+a>0?(n.t-r.t)*s+(n.t-i.t)*a:0},e.transEval=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var s=n.t-i.t,a=r.t-n.t;return s+a>0?s<a?n.s-i.s+(i.s-r.s)*(s/(s+a)):n.s-r.s+(r.s-i.s)*(a/(s+a)):0},e.transSign=function(i,n,r){he(e.transLeq(i,n)&&e.transLeq(n,r));var s=n.t-i.t,a=r.t-n.t;return s+a>0?(n.s-r.s)*s+(n.s-i.s)*a:0},e.vertCCW=function(i,n,r){return i.s*(n.t-r.t)+n.s*(r.t-i.t)+r.s*(i.t-n.t)>=0},e.interpolate=function(i,n,r,s){return(i=i<0?0:i)<=(r=r<0?0:r)?r===0?(n+s)/2:n+i/(i+r)*(s-n):s+r/(i+r)*(n-s)},e.intersect=function(i,n,r,s,a){var o,l,c;e.vertLeq(i,n)||(c=i,i=n,n=c),e.vertLeq(r,s)||(c=r,r=s,s=c),e.vertLeq(i,r)||(c=i,i=r,r=c,c=n,n=s,s=c),e.vertLeq(r,n)?e.vertLeq(n,s)?((o=e.edgeEval(i,r,n))+(l=e.edgeEval(r,n,s))<0&&(o=-o,l=-l),a.s=e.interpolate(o,r.s,l,n.s)):((o=e.edgeSign(i,r,n))+(l=-e.edgeSign(i,s,n))<0&&(o=-o,l=-l),a.s=e.interpolate(o,r.s,l,s.s)):a.s=(r.s+n.s)/2,e.transLeq(i,n)||(c=i,i=n,n=c),e.transLeq(r,s)||(c=r,r=s,s=c),e.transLeq(i,r)||(c=i,i=r,r=c,c=n,n=s,s=c),e.transLeq(r,n)?e.transLeq(n,s)?((o=e.transEval(i,r,n))+(l=e.transEval(r,n,s))<0&&(o=-o,l=-l),a.t=e.interpolate(o,r.t,l,n.t)):((o=e.transSign(i,r,n))+(l=-e.transSign(i,s,n))<0&&(o=-o,l=-l),a.t=e.interpolate(o,r.t,l,s.t)):a.t=(r.t+n.t)/2},e}(),$d=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},$f=function(){function e(i){this.side=i,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(i){this.Sym.Lface=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(i){this.Sym.Org=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(i){this.Sym.Lnext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(i){this.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(i){this.Lnext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(i){this.Sym.Onext=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(i){this.Sym.Onext.Sym=i},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(i){this.Sym.Lnext.Sym=i},enumerable:!0,configurable:!0}),e}(),cc=function(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0},T2=function(){function e(){var i=new cc,n=new $d,r=new $f(0),s=new $f(1);i.next=i.prev=i,i.anEdge=null,n.next=n.prev=n,r.next=r,r.Sym=s,s.next=s,s.Sym=r,this.vHead=i,this.fHead=n,this.eHead=r,this.eHeadSym=s}return e.prototype.makeEdge_=function(i){var n=new $f(0),r=new $f(1);i.Sym.side<i.side&&(i=i.Sym);var s=i.Sym.next;return r.next=s,s.Sym.next=n,n.next=i,i.Sym.next=r,n.Sym=r,n.Onext=n,n.Lnext=r,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,r.Sym=n,r.Onext=r,r.Lnext=n,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,n},e.prototype.splice_=function(i,n){var r=i.Onext,s=n.Onext;r.Sym.Lnext=n,s.Sym.Lnext=i,i.Onext=s,n.Onext=r},e.prototype.makeVertex_=function(i,n,r){var s=i;he(s,"Vertex can't be null!");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=n;var o=n;do o.Org=s,o=o.Onext;while(o!==n)},e.prototype.makeFace_=function(i,n,r){var s=i;he(s,"Face can't be null");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=n,s.trail=null,s.marked=!1,s.inside=r.inside;var o=n;do o.Lface=s,o=o.Lnext;while(o!==n)},e.prototype.killEdge_=function(i){i.Sym.side<i.side&&(i=i.Sym);var n=i.next,r=i.Sym.next;n.Sym.next=r,r.Sym.next=n},e.prototype.killVertex_=function(i,n){var r=i.anEdge,s=r;do s.Org=n,s=s.Onext;while(s!==r);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.killFace_=function(i,n){var r=i.anEdge,s=r;do s.Lface=n,s=s.Lnext;while(s!==r);var a=i.prev,o=i.next;o.prev=a,a.next=o},e.prototype.makeEdge=function(){var i=new cc,n=new cc,r=new $d,s=this.makeEdge_(this.eHead);return this.makeVertex_(i,s,this.vHead),this.makeVertex_(n,s.Sym,this.vHead),this.makeFace_(r,s,this.fHead),s},e.prototype.splice=function(i,n){var r=!1,s=!1;if(i!==n){if(n.Org!==i.Org&&(s=!0,this.killVertex_(n.Org,i.Org)),n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(n,i),!s){var a=new cc;this.makeVertex_(a,n,i.Org),i.Org.anEdge=i}if(!r){var o=new $d;this.makeFace_(o,n,i.Lface),i.Lface.anEdge=i}}},e.prototype.delete=function(i){var n=i.Sym,r=!1;if(i.Lface!==i.Rface&&(r=!0,this.killFace_(i.Lface,i.Rface)),i.Onext===i)this.killVertex_(i.Org,null);else if(i.Rface.anEdge=i.Oprev,i.Org.anEdge=i.Onext,this.splice_(i,i.Oprev),!r){var s=new $d;this.makeFace_(s,i,i.Lface)}n.Onext===n?(this.killVertex_(n.Org,null),this.killFace_(n.Lface,null)):(i.Lface.anEdge=n.Oprev,n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),this.killEdge_(i)},e.prototype.addEdgeVertex=function(i){var n=this.makeEdge_(i),r=n.Sym;this.splice_(n,i.Lnext),n.Org=i.Dst;var s=new cc;return this.makeVertex_(s,r,n.Org),n.Lface=r.Lface=i.Lface,n},e.prototype.splitEdge=function(i){var n=this.addEdgeVertex(i).Sym;return this.splice_(i.Sym,i.Sym.Oprev),this.splice_(i.Sym,n),i.Dst=n.Org,n.Dst.anEdge=n.Sym,n.Rface=i.Rface,n.winding=i.winding,n.Sym.winding=i.Sym.winding,n.idx=i.idx,n.Sym.idx=i.Sym.idx,n},e.prototype.connect=function(i,n){var r=!1,s=this.makeEdge_(i),a=s.Sym;if(n.Lface!==i.Lface&&(r=!0,this.killFace_(n.Lface,i.Lface)),this.splice_(s,i.Lnext),this.splice_(a,n),s.Org=i.Dst,a.Org=n.Org,s.Lface=a.Lface=i.Lface,i.Lface.anEdge=a,!r){var o=new $d;this.makeFace_(o,s,i.Lface)}return s},e.prototype.zapFace=function(i){var n,r,s,a,o,l=i.anEdge;r=l.Lnext;do r=(n=r).Lnext,n.Lface=null,n.Rface===null&&(n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),(s=n.Sym).Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(n));while(n!=l);a=i.prev,(o=i.next).prev=a,a.next=o},e.prototype.countFaceVerts_=function(i){var n=i.anEdge,r=0;do r++,n=n.Lnext;while(n!==i.anEdge);return r},e.prototype.mergeConvexFaces=function(i){var n,r,s,a,o;for(n=this.fHead.next;n!==this.fHead;n=n.next)if(n.inside)for(o=(r=n.anEdge).Org;s=r.Lnext,(a=r.Sym)&&a.Lface&&a.Lface.inside&&this.countFaceVerts_(n)+this.countFaceVerts_(a.Lface)-2<=i&&re.vertCCW(r.Lprev.Org,r.Org,a.Lnext.Lnext.Org)&&re.vertCCW(a.Lprev.Org,a.Org,r.Lnext.Lnext.Org)&&(s=a.Lnext,this.delete(a),r=null,a=null),!r||r.Lnext.Org!==o;)r=s;return!0},e.prototype.check=function(){var i,n,r,s,a,o,l=this.fHead,c=this.vHead,h=this.eHead;for(n=l,n=l;(i=n.next)!==l;n=i){he(i.prev===n),a=i.anEdge;do he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a),he(a.Lface===i),a=a.Lnext;while(a!==i.anEdge)}for(he(i.prev===n&&i.anEdge===null),s=c,s=c;(r=s.next)!==c;s=r){he(r.prev===s),a=r.anEdge;do he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a),he(a.Org===r),a=a.Onext;while(a!==r.anEdge)}for(he(r.prev===s&&r.anEdge===null),o=h,o=h;(a=o.next)!==h;o=a)he(a.Sym.next===o.Sym),he(a.Sym!==a),he(a.Sym.Sym===a),he(a.Org!==null),he(a.Dst!==null),he(a.Lnext.Onext.Sym===a),he(a.Onext.Sym.Lnext===a);he(a.Sym.next===o.Sym&&a.Sym===this.eHeadSym&&a.Sym.Sym===a&&a.Org===null&&a.Dst===null&&a.Lface===null&&a.Rface===null)},e}(),C2=function(){this.handle=null},P2=function(){this.key=null,this.node=0},wL=function(){function e(i,n){this.leq=n,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=i,this.nodes=[],this.handles=[];for(var r=0;r<i+1;r++)this.nodes[r]=new C2,this.handles[r]=new P2;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(i){var n,r,s,a=this.nodes,o=this.handles;for(n=a[i].handle;;){if((s=i<<1)<this.size&&this.leq(o[a[s+1].handle].key,o[a[s].handle].key)&&++s,he(s<=this.max),r=a[s].handle,s>this.size||this.leq(o[n].key,o[r].key)){a[i].handle=n,o[n].node=i;break}a[i].handle=r,o[r].node=i,i=s}},e.prototype.floatUp_=function(i){var n,r,s,a=this.nodes,o=this.handles;for(n=a[i].handle;;){if(r=a[s=i>>1].handle,s===0||this.leq(o[r].key,o[n].key)){a[i].handle=n,o[n].node=i;break}a[i].handle=r,o[r].node=i,i=s}},e.prototype.init=function(){for(var i=this.size;i>=1;--i)this.floatDown_(i);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(i){var n,r;if(2*(n=++this.size)>this.max){var s,a;for(this.max*=2,a=this.nodes.length,this.nodes.length=this.max+1,s=a;s<this.nodes.length;s++)this.nodes[s]=new C2;for(a=this.handles.length,this.handles.length=this.max+1,s=a;s<this.handles.length;s++)this.handles[s]=new P2}return this.freeList===0?r=n:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[n].handle=r,this.handles[r].node=n,this.handles[r].key=i,this.initialized&&this.floatUp_(n),r},e.prototype.extractMin=function(){var i=this.nodes,n=this.handles,r=i[1].handle,s=n[r].key;return this.size>0&&(i[1].handle=i[this.size].handle,n[i[1].handle].node=1,n[r].key=null,n[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),s},e.prototype.delete=function(i){var n,r=this.nodes,s=this.handles;he(i>=1&&i<=this.max&&s[i].key!==null),r[n=s[i].node].handle=r[this.size].handle,s[r[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(s[r[n>>1].handle].key,s[r[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),s[i].key=null,s[i].node=this.freeList,this.freeList=i},e}(),Qv=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},D2=function(){this.key=null,this.next=null,this.prev=null},SL=function(){function e(i,n){this.frame=i,this.leq=n,this.head=new D2,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(i){return this.insertBefore(this.head,i)},e.prototype.search=function(i){var n=this.head;do n=n.next;while(n.key!==null&&!this.leq(this.frame,i,n.key));return n},e.prototype.insertBefore=function(i,n){do i=i.prev;while(i.key!==null&&!this.leq(this.frame,i.key,n));var r=new D2;return r.key=n,r.next=i.next,i.next.prev=r,r.prev=i,i.next=r,r},e.prototype.delete=function(i){i.next.prev=i.prev,i.prev.next=i.next},e}(),ML=function(){function e(){}return e.regionBelow=function(i){return i.nodeUp.prev.key},e.regionAbove=function(i){return i.nodeUp.next.key},e.debugEvent=function(i){},e.addWinding=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.edgeLeq=function(i,n,r){var s=i.event,a=n.eUp,o=r.eUp;return a.Dst===s?o.Dst===s?re.vertLeq(a.Org,o.Org)?re.edgeSign(o.Dst,a.Org,o.Org)<=0:re.edgeSign(a.Dst,o.Org,a.Org)>=0:re.edgeSign(o.Dst,s,o.Org)<=0:o.Dst===s?re.edgeSign(a.Dst,s,a.Org)>=0:re.edgeEval(a.Dst,s,a.Org)>=re.edgeEval(o.Dst,s,o.Org)},e.deleteRegion=function(i,n){n.fixUpperEdge&&he(n.eUp.winding===0),n.eUp.activeRegion=null,i.dict.delete(n.nodeUp)},e.fixUpperEdge=function(i,n,r){he(n.fixUpperEdge),i.mesh.delete(n.eUp),n.fixUpperEdge=!1,n.eUp=r,r.activeRegion=n},e.topLeftRegion=function(i,n){var r,s=n.eUp.Org;do n=e.regionAbove(n);while(n.eUp.Org===s);if(n.fixUpperEdge){if((r=i.mesh.connect(e.regionBelow(n).eUp.Sym,n.eUp.Lnext))===null)return null;e.fixUpperEdge(i,n,r),n=e.regionAbove(n)}return n},e.topRightRegion=function(i){var n=i.eUp.Dst;do i=e.regionAbove(i);while(i.eUp.Dst===n);return i},e.addRegionBelow=function(i,n,r){var s=new Qv;return s.eUp=r,s.nodeUp=i.dict.insertBefore(n.nodeUp,s),s.fixUpperEdge=!1,s.sentinel=!1,s.dirty=!1,r.activeRegion=s,s},e.isWindingInside=function(i,n){switch(i.windingRule){case Bi.ODD:return!!(1&n);case Bi.NONZERO:return n!==0;case Bi.POSITIVE:return n>0;case Bi.NEGATIVE:return n<0;case Bi.ABS_GEQ_TWO:return n>=2||n<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(i,n){n.windingNumber=e.regionAbove(n).windingNumber+n.eUp.winding,n.inside=e.isWindingInside(i,n.windingNumber)},e.finishRegion=function(i,n){var r=n.eUp,s=r.Lface;s.inside=n.inside,s.anEdge=r,e.deleteRegion(i,n)},e.finishLeftRegions=function(i,n,r){for(var s,a=null,o=n,l=n.eUp;o!==r;){if(o.fixUpperEdge=!1,(s=(a=e.regionBelow(o)).eUp).Org!=l.Org){if(!a.fixUpperEdge){e.finishRegion(i,o);break}s=i.mesh.connect(l.Lprev,s.Sym),e.fixUpperEdge(i,a,s)}l.Onext!==s&&(i.mesh.splice(s.Oprev,s),i.mesh.splice(l,s)),e.finishRegion(i,o),l=a.eUp,o=a}return l},e.addRightEdges=function(i,n,r,s,a,o){var l,c,h,d,u=!0;h=r;do he(re.vertLeq(h.Org,h.Dst)),e.addRegionBelow(i,n,h.Sym),h=h.Onext;while(h!==s);for(a===null&&(a=e.regionBelow(n).eUp.Rprev),c=n,d=a;(h=(l=e.regionBelow(c)).eUp.Sym).Org===d.Org;)h.Onext!==d&&(i.mesh.splice(h.Oprev,h),i.mesh.splice(d.Oprev,h)),l.windingNumber=c.windingNumber-h.winding,l.inside=e.isWindingInside(i,l.windingNumber),c.dirty=!0,!u&&e.checkForRightSplice(i,c)&&(e.addWinding(h,d),e.deleteRegion(i,c),i.mesh.delete(d)),u=!1,c=l,d=h;c.dirty=!0,he(c.windingNumber-h.winding===l.windingNumber),o&&e.walkDirtyRegions(i,c)},e.spliceMergeVertices=function(i,n,r){i.mesh.splice(n,r)},e.vertexWeights=function(i,n,r){var s=re.vertL1dist(n,i),a=re.vertL1dist(r,i),o=.5*a/(s+a),l=.5*s/(s+a);i.coords[0]+=o*n.coords[0]+l*r.coords[0],i.coords[1]+=o*n.coords[1]+l*r.coords[1],i.coords[2]+=o*n.coords[2]+l*r.coords[2]},e.getIntersectData=function(i,n,r,s,a,o){n.coords[0]=n.coords[1]=n.coords[2]=0,n.idx=-1,e.vertexWeights(n,r,s),e.vertexWeights(n,a,o)},e.checkForRightSplice=function(i,n){var r=e.regionBelow(n),s=n.eUp,a=r.eUp;if(re.vertLeq(s.Org,a.Org)){if(re.edgeSign(a.Dst,s.Org,a.Org)>0)return!1;re.vertEq(s.Org,a.Org)?s.Org!==a.Org&&(i.pq.delete(s.Org.pqHandle),e.spliceMergeVertices(i,a.Oprev,s)):(i.mesh.splitEdge(a.Sym),i.mesh.splice(s,a.Oprev),n.dirty=r.dirty=!0)}else{if(re.edgeSign(s.Dst,a.Org,s.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(s.Sym),i.mesh.splice(a.Oprev,s)}return!0},e.checkForLeftSplice=function(i,n){var r,s=e.regionBelow(n),a=n.eUp,o=s.eUp;if(he(!re.vertEq(a.Dst,o.Dst)),re.vertLeq(a.Dst,o.Dst)){if(re.edgeSign(a.Dst,o.Dst,a.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,r=i.mesh.splitEdge(a),i.mesh.splice(o.Sym,r),r.Lface.inside=n.inside}else{if(re.edgeSign(o.Dst,a.Dst,o.Org)>0)return!1;n.dirty=s.dirty=!0,r=i.mesh.splitEdge(o),i.mesh.splice(a.Lnext,o.Sym),r.Rface.inside=n.inside}return!0},e.checkForIntersect=function(i,n){var r,s,a=e.regionBelow(n),o=n.eUp,l=a.eUp,c=o.Org,h=l.Org,d=o.Dst,u=l.Dst,p=new cc;if(he(!re.vertEq(u,d)),he(re.edgeSign(d,i.event,c)<=0),he(re.edgeSign(u,i.event,h)>=0),he(c!==i.event&&h!==i.event),he(!n.fixUpperEdge&&!a.fixUpperEdge),c===h||Math.min(c.t,d.t)>Math.max(h.t,u.t))return!1;if(re.vertLeq(c,h)){if(re.edgeSign(u,c,h)>0)return!1}else if(re.edgeSign(d,h,c)<0)return!1;return e.debugEvent(i),re.intersect(d,c,u,h,p),he(Math.min(c.t,d.t)<=p.t),he(p.t<=Math.max(h.t,u.t)),he(Math.min(u.s,d.s)<=p.s),he(p.s<=Math.max(h.s,c.s)),re.vertLeq(p,i.event)&&(p.s=i.event.s,p.t=i.event.t),r=re.vertLeq(c,h)?c:h,re.vertLeq(r,p)&&(p.s=r.s,p.t=r.t),re.vertEq(p,c)||re.vertEq(p,h)?(e.checkForRightSplice(i,n),!1):!re.vertEq(d,i.event)&&re.edgeSign(d,i.event,p)>=0||!re.vertEq(u,i.event)&&re.edgeSign(u,i.event,p)<=0?u===i.event?(i.mesh.splitEdge(o.Sym),i.mesh.splice(l.Sym,o),n=e.topLeftRegion(i,n),o=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),a),e.addRightEdges(i,n,o.Oprev,o,o,!0),!0):d===i.event?(i.mesh.splitEdge(l.Sym),i.mesh.splice(o.Lnext,l.Oprev),a=n,n=e.topRightRegion(n),s=e.regionBelow(n).eUp.Rprev,a.eUp=l.Oprev,l=e.finishLeftRegions(i,a,null),e.addRightEdges(i,n,l.Onext,o.Rprev,s,!0),!0):(re.edgeSign(d,i.event,p)>=0&&(e.regionAbove(n).dirty=n.dirty=!0,i.mesh.splitEdge(o.Sym),o.Org.s=i.event.s,o.Org.t=i.event.t),re.edgeSign(u,i.event,p)<=0&&(n.dirty=a.dirty=!0,i.mesh.splitEdge(l.Sym),l.Org.s=i.event.s,l.Org.t=i.event.t),!1):(i.mesh.splitEdge(o.Sym),i.mesh.splitEdge(l.Sym),i.mesh.splice(l.Oprev,o),o.Org.s=p.s,o.Org.t=p.t,o.Org.pqHandle=i.pq.insert(o.Org),e.getIntersectData(i,o.Org,c,d,h,u),e.regionAbove(n).dirty=n.dirty=a.dirty=!0,!1)},e.walkDirtyRegions=function(i,n){for(var r,s,a=e.regionBelow(n);;){for(;a.dirty;)n=a,a=e.regionBelow(a);if(!n.dirty&&(a=n,(n=e.regionAbove(n))===null||!n.dirty))return;if(n.dirty=!1,r=n.eUp,s=a.eUp,r.Dst!==s.Dst&&e.checkForLeftSplice(i,n)&&(a.fixUpperEdge?(e.deleteRegion(i,a),i.mesh.delete(s),s=(a=e.regionBelow(n)).eUp):n.fixUpperEdge&&(e.deleteRegion(i,n),i.mesh.delete(r),r=(n=e.regionAbove(a)).eUp)),r.Org!==s.Org){if(r.Dst===s.Dst||n.fixUpperEdge||a.fixUpperEdge||r.Dst!==i.event&&s.Dst!==i.event)e.checkForRightSplice(i,n);else if(e.checkForIntersect(i,n))return}r.Org===s.Org&&r.Dst===s.Dst&&(e.addWinding(s,r),e.deleteRegion(i,n),i.mesh.delete(r),n=e.regionAbove(a))}},e.connectRightVertex=function(i,n,r){var s,a=r.Onext,o=e.regionBelow(n),l=n.eUp,c=o.eUp,h=!1;l.Dst!==c.Dst&&e.checkForIntersect(i,n),re.vertEq(l.Org,i.event)&&(i.mesh.splice(a.Oprev,l),n=e.topLeftRegion(i,n),a=e.regionBelow(n).eUp,e.finishLeftRegions(i,e.regionBelow(n),o),h=!0),re.vertEq(c.Org,i.event)&&(i.mesh.splice(r,c.Oprev),r=e.finishLeftRegions(i,o,null),h=!0),h?e.addRightEdges(i,n,r.Onext,a,a,!0):(s=re.vertLeq(c.Org,l.Org)?c.Oprev:l,s=i.mesh.connect(r.Lprev,s),e.addRightEdges(i,n,s,s.Onext,s.Onext,!1),s.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(i,n))},e.connectLeftDegenerate=function(i,n,r){var s,a,o,l,c;return s=n.eUp,re.vertEq(s.Org,r)?(he(!1),void e.spliceMergeVertices(i,s,r.anEdge)):re.vertEq(s.Dst,r)?(he(!1),n=e.topRightRegion(n),a=l=(o=(c=e.regionBelow(n)).eUp.Sym).Onext,c.fixUpperEdge&&(he(a!==o),e.deleteRegion(i,c),i.mesh.delete(o),o=a.Oprev),i.mesh.splice(r.anEdge,o),re.edgeGoesLeft(a)||(a=null),void e.addRightEdges(i,n,o.Onext,l,a,!0)):(i.mesh.splitEdge(s.Sym),n.fixUpperEdge&&(i.mesh.delete(s.Onext),n.fixUpperEdge=!1),i.mesh.splice(r.anEdge,s),void e.sweepEvent(i,r))},e.connectLeftVertex=function(i,n){var r,s,a,o,l,c,h=new Qv;if(h.eUp=n.anEdge.Sym,r=i.dict.search(h).key,s=e.regionBelow(r)){if(o=r.eUp,l=s.eUp,re.edgeSign(o.Dst,n,o.Org)===0)return void e.connectLeftDegenerate(i,r,n);a=re.vertLeq(l.Dst,o.Dst)?r:s,r.inside||a.fixUpperEdge?(c=a===r?i.mesh.connect(n.anEdge.Sym,o.Lnext):i.mesh.connect(l.Dnext,n.anEdge).Sym,a.fixUpperEdge?e.fixUpperEdge(i,a,c):e.computeWinding(i,e.addRegionBelow(i,r,c)),e.sweepEvent(i,n)):e.addRightEdges(i,r,n.anEdge,n.anEdge,null,!0)}},e.sweepEvent=function(i,n){i.event=n,e.debugEvent(i);for(var r=n.anEdge;r.activeRegion===null;)if((r=r.Onext)===n.anEdge)return void e.connectLeftVertex(i,n);var s=e.topLeftRegion(i,r.activeRegion);he(s!==null);var a=e.regionBelow(s),o=a.eUp,l=e.finishLeftRegions(i,a,null);l.Onext===o?e.connectRightVertex(i,s,l):e.addRightEdges(i,s,l.Onext,o,o,!0)},e.addSentinel=function(i,n,r,s){var a=new Qv,o=i.mesh.makeEdge();o.Org.s=r,o.Org.t=s,o.Dst.s=n,o.Dst.t=s,i.event=o.Dst,a.eUp=o,a.windingNumber=0,a.inside=!1,a.fixUpperEdge=!1,a.sentinel=!0,a.dirty=!1,a.nodeUp=i.dict.insert(a)},e.initEdgeDict=function(i){i.dict=new SL(i,e.edgeLeq);var n=i.bmax[0]-i.bmin[0],r=i.bmax[1]-i.bmin[1],s=i.bmin[0]-n,a=i.bmax[0]+n,o=i.bmin[1]-r,l=i.bmax[1]+r;e.addSentinel(i,s,a,o),e.addSentinel(i,s,a,l)},e.doneEdgeDict=function(i){for(var n,r=0;(n=i.dict.min().key)!==null;)n.sentinel||(he(n.fixUpperEdge),he(++r===1)),he(n.windingNumber===0),e.deleteRegion(i,n)},e.removeDegenerateEdges=function(i){var n,r,s,a=i.mesh.eHead;for(n=a.next;n!==a;n=r)r=n.next,s=n.Lnext,re.vertEq(n.Org,n.Dst)&&n.Lnext.Lnext!==n&&(e.spliceMergeVertices(i,s,n),i.mesh.delete(n),s=(n=s).Lnext),s.Lnext===n&&(s!==n&&((s===r||s===r.Sym)&&(r=r.next),i.mesh.delete(s)),(n===r||n===r.Sym)&&(r=r.next),i.mesh.delete(n))},e.initPriorityQ=function(i){var n,r,s,a=0;for(r=(s=i.mesh.vHead).next;r!==s;r=r.next)a++;for(a+=8,n=i.pq=new wL(a,re.vertLeq),r=(s=i.mesh.vHead).next;r!==s;r=r.next)r.pqHandle=n.insert(r);return r===s&&(n.init(),!0)},e.donePriorityQ=function(i){i.pq=null},e.removeDegenerateFaces=function(i,n){var r,s,a;for(r=n.fHead.next;r!==n.fHead;r=s)s=r.next,he((a=r.anEdge).Lnext!==a),a.Lnext.Lnext===a&&(e.addWinding(a.Onext,a),i.mesh.delete(a));return!0},e.computeInterior=function(i,n){var r,s;if(n===void 0&&(n=!0),e.removeDegenerateEdges(i),!e.initPriorityQ(i))return!1;for(e.initEdgeDict(i);(r=i.pq.extractMin())!==null;){for(;(s=i.pq.min())!==null&&re.vertEq(s,r);)s=i.pq.extractMin(),e.spliceMergeVertices(i,r.anEdge,s.anEdge);e.sweepEvent(i,r)}return i.event=i.dict.min().key.eUp.Org,e.debugEvent(i),e.doneEdgeDict(i),e.donePriorityQ(i),!!e.removeDegenerateFaces(i,i.mesh)&&(n&&i.mesh.check(),!0)},e}(),K6=function(){function e(){this.mesh=new T2,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Bi.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(i,n){return i[0]*n[0]+i[1]*n[1]+i[2]*n[2]},e.prototype.normalize_=function(i){var n=i[0]*i[0]+i[1]*i[1]+i[2]*i[2];if(!n)throw"Zero-size vector!";n=Math.sqrt(n),i[0]/=n,i[1]/=n,i[2]/=n},e.prototype.longAxis_=function(i){var n=0;return Math.abs(i[1])>Math.abs(i[0])&&(n=1),Math.abs(i[2])>Math.abs(i[n])&&(n=2),n},e.prototype.computeNormal_=function(i){var n,r,s,a,o,l,c=[0,0,0],h=[0,0,0],d=[0,0,0],u=[0,0,0],p=[0,0,0],f=[null,null,null],g=[null,null,null],m=this.mesh.vHead;n=m.next;for(var v=0;v<3;++v)a=n.coords[v],h[v]=a,g[v]=n,c[v]=a,f[v]=n;for(n=m.next;n!==m;n=n.next)for(var y=0;y<3;++y)(a=n.coords[y])<h[y]&&(h[y]=a,g[y]=n),a>c[y]&&(c[y]=a,f[y]=n);var _=0;if(c[1]-h[1]>c[0]-h[0]&&(_=1),c[2]-h[2]>c[_]-h[_]&&(_=2),h[_]>=c[_])return i[0]=0,i[1]=0,void(i[2]=1);for(l=0,r=g[_],s=f[_],d[0]=r.coords[0]-s.coords[0],d[1]=r.coords[1]-s.coords[1],d[2]=r.coords[2]-s.coords[2],n=m.next;n!==m;n=n.next)u[0]=n.coords[0]-s.coords[0],u[1]=n.coords[1]-s.coords[1],u[2]=n.coords[2]-s.coords[2],p[0]=d[1]*u[2]-d[2]*u[1],p[1]=d[2]*u[0]-d[0]*u[2],p[2]=d[0]*u[1]-d[1]*u[0],(o=p[0]*p[0]+p[1]*p[1]+p[2]*p[2])>l&&(l=o,i[0]=p[0],i[1]=p[1],i[2]=p[2]);l<=0&&(i[0]=i[1]=i[2]=0,i[this.longAxis_(d)]=1)},e.prototype.checkOrientation_=function(){for(var i,n,r=this.mesh.fHead,s=this.mesh.vHead,a=0,o=r.next;o!==r;o=o.next)if(!((n=o.anEdge).winding<=0))do a+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(a<0){for(i=s.next;i!==s;i=i.next)i.t=-i.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var i,n,r=this.mesh.vHead,s=[0,0,0],a=!1;s[0]=this.normal[0],s[1]=this.normal[1],s[2]=this.normal[2],!s[0]&&!s[1]&&!s[2]&&(this.computeNormal_(s),a=!0),i=this.sUnit,n=this.tUnit;var o=this.longAxis_(s);i[o]=0,i[(o+1)%3]=1,i[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=s[o]>0?1:-1;for(var l=r.next;l!==r;l=l.next)l.s=this.dot_(l.coords,i),l.t=this.dot_(l.coords,n);a&&this.checkOrientation_();for(var c=!0,h=r.next;h!==r;h=h.next)c?(this.bmin[0]=this.bmax[0]=h.s,this.bmin[1]=this.bmax[1]=h.t,c=!1):(h.s<this.bmin[0]&&(this.bmin[0]=h.s),h.s>this.bmax[0]&&(this.bmax[0]=h.s),h.t<this.bmin[1]&&(this.bmin[1]=h.t),h.t>this.bmax[1]&&(this.bmax[1]=h.t))},e.prototype.addWinding_=function(i,n){i.winding+=n.winding,i.Sym.winding+=n.Sym.winding},e.prototype.tessellateMonoRegion_=function(i,n){var r,s;if((r=n.anEdge).Lnext===r||r.Lnext.Lnext===r)throw"Mono region invalid";for(;re.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;re.vertLeq(r.Org,r.Dst);r=r.Lnext);for(s=r.Lprev;r.Lnext!==s;)if(re.vertLeq(r.Dst,s.Org)){for(;s.Lnext!==r&&(re.edgeGoesLeft(s.Lnext)||re.edgeSign(s.Org,s.Dst,s.Lnext.Dst)<=0);)s=i.connect(s.Lnext,s).Sym;s=s.Lprev}else{for(;s.Lnext!==r&&(re.edgeGoesRight(r.Lprev)||re.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)r=i.connect(r,r.Lprev).Sym;r=r.Lnext}if(s.Lnext===r)throw"Mono region invalid";for(;s.Lnext.Lnext!==r;)s=i.connect(s.Lnext,s).Sym;return!0},e.prototype.tessellateInterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)if(n=r.next,r.inside&&!this.tessellateMonoRegion_(i,r))return!1;return!0},e.prototype.discardExterior_=function(i){for(var n,r=i.fHead.next;r!==i.fHead;r=n)n=r.next,r.inside||i.zapFace(r)},e.prototype.setWindingNumber_=function(i,n,r){for(var s,a=i.eHead.next;a!==i.eHead;a=s)s=a.next,a.Rface.inside!==a.Lface.inside?a.winding=a.Lface.inside?n:-n:r?i.delete(a):a.winding=0},e.prototype.getNeighbourFace_=function(i){return i.Rface&&i.Rface.inside?i.Rface.n:-1},e.prototype.outputPolymesh_=function(i,n,r,s){var a,o,l=0,c=0;r>3&&i.mergeConvexFaces(r);for(var h=i.vHead.next;h!==i.vHead;h=h.next)h.n=-1;for(var d=i.fHead.next;d!==i.fHead;d=d.next)if(d.n=-1,d.inside){a=d.anEdge,o=0;do(h=a.Org).n===-1&&(h.n=c,c++),o++,a=a.Lnext;while(a!==d.anEdge);if(o>r)throw"Face vertex greater that support polygon";d.n=l,++l}for(this.elementCount=l,n===gr.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*r,this.vertexCount=c,this.vertices=[],this.vertices.length=c*s,this.vertexIndices=[],this.vertexIndices.length=c,h=i.vHead.next;h!==i.vHead;h=h.next)if(h.n!==-1){var u=h.n*s;this.vertices[u+0]=h.coords[0],this.vertices[u+1]=h.coords[1],s>2&&(this.vertices[u+2]=h.coords[2]),this.vertexIndices[h.n]=h.idx}var p=0;for(d=i.fHead.next;d!==i.fHead;d=d.next)if(d.inside){a=d.anEdge,o=0;do h=a.Org,this.elements[p++]=h.n,o++,a=a.Lnext;while(a!==d.anEdge);for(var f=o;f<r;++f)this.elements[p++]=-1;if(n===gr.CONNECTED_POLYGONS){a=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==d.anEdge);for(var g=o;g<r;++g)this.elements[p++]=-1}}},e.prototype.outputContours_=function(i,n){var r,s,a=0,o=0;this.vertexCount=0,this.elementCount=0;for(var l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){s=r=l.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==s);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*n,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var c=0,h=0,d=0;for(a=0,l=i.fHead.next;l!==i.fHead;l=l.next)if(l.inside){o=0,s=r=l.anEdge;do this.vertices[c++]=r.Org.coords[0],this.vertices[c++]=r.Org.coords[1],n>2&&(this.vertices[c++]=r.Org.coords[2]),this.vertexIndices[h++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==s);this.elements[d++]=a,this.elements[d++]=o,a+=o}},e.prototype.addContour=function(i,n){this.mesh===null&&(this.mesh=new T2),i<2&&(i=2),i>3&&(i=3);for(var r=null,s=0;s<n.length;s+=i)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=n[s+0],r.Org.coords[1]=n[s+1],r.Org.coords[2]=i>2?n[s+2]:0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},e.prototype.tesselate=function(i,n,r,s,a,o){if(i===void 0&&(i=Bi.ODD),n===void 0&&(n=gr.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,a&&(this.normal[0]=a[0],this.normal[1]=a[1],this.normal[2]=a[2]),this.windingRule=i,s<2&&(s=2),s>3&&(s=3),!this.mesh)return!1;this.projectPolygon_(),ML.computeInterior(this,o);var l=this.mesh;return n===gr.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),n===gr.BOUNDARY_CONTOURS?this.outputContours_(l,s):this.outputPolymesh_(l,n,r,s),!0},e}(),Bi.ODD,Bi.NONZERO,Bi.POSITIVE,Bi.NEGATIVE,Bi.ABS_GEQ_TWO,gr.POLYGONS,gr.CONNECTED_POLYGONS,gr.BOUNDARY_CONTOURS});function Q6(t,e){let i=t.length/2;if(i<2)return[];let n=0;for(let l=0;l<i;l++){let c=(l+1)%i;n+=t[2*l]*t[2*c+1]-t[2*c]*t[2*l+1]}let r=n>0!==e?1:-1,s=[];for(let l=0;l<i;l++){let c=(l+1)%i,h=t[2*c]-t[2*l],d=t[2*c+1]-t[2*l+1],u=Math.hypot(h,d);s.push(u>0?[r*d/u,-r*h/u]:[0,0])}let a=Math.cos(40*Math.PI/180),o=(l,c)=>{if(l[0]*c[0]+l[1]*c[1]<=a)return l;let[h,d]=[l[0]+c[0],l[1]+c[1]],u=Math.hypot(h,d);return u>0?[h/u,d/u]:l};return s.map((l,c)=>[o(l,s[(c+i-1)%i]),o(l,s[(c+1)%i])])}function J6(t,e,i){let n=t.length/2,r=new Float32Array(n+1);if(!(e>0)||!(i>0)||n<2)return{u:r,vScale:0};let s=0;for(let a=0;a<n;a++){let o=(a+1)%n;s+=Math.hypot((t[2*o]-t[2*a])/e,(t[2*o+1]-t[2*a+1])/i),r[a+1]=s}return{u:r,vScale:Math.sqrt(e*i)}}function t8(t,e,i){for(let n=0;n<i.length;n+=3){let r=3*i[n],s=3*i[n+1],a=3*i[n+2],o=t[s]-t[r],l=t[s+1]-t[r+1],c=t[s+2]-t[r+2],h=t[a]-t[r],d=t[a+1]-t[r+1],u=t[a+2]-t[r+2],p=c*h-o*u,f=o*d-l*h;if((l*u-c*d)*(e[r]+e[s]+e[a])+p*(e[r+1]+e[s+1]+e[a+1])+f*(e[r+2]+e[s+2]+e[a+2])<0){let g=i[n+1];i[n+1]=i[n+2],i[n+2]=g}}}var Q3,e8,J3,i8=z(()=>{}),tP=z(()=>{Q3={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},e8={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},J3={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0}});function n8(t,e){return t.normals[3*e+2]<.9999}function r8(t){let e=AT.get(t);if(e!==void 0)return e;if(!(t.rise>0))return t;let i=new Float32Array(t.normals),n=t.positions.length/3;for(let s=0;s<n;s++){if(!n8(t,s))continue;let a=i[3*s],o=i[3*s+1],l=Math.hypot(a,o);if(l===0)continue;let c=t.rise-t.positions[3*s+2],h=Math.min(1,Math.max(0,1-c/t.rise)),d=Math.sqrt(1-h*h);i[3*s]=a/l*d,i[3*s+1]=o/l*d,i[3*s+2]=h}let r={...t,normals:i};return AT.set(t,r),r}function s8(t,e,i,n){let r=(e-t.minX)/t.spanX,s=(i-t.minY)/t.spanY;return n?[s,r]:[r,s]}var AT,Bb,TT,eP=z(()=>{AT=new WeakMap}),aK=z(()=>{J(),x0(),ti(),i8(),tP(),eP(),Bb=class extends jt{constructor(t,e,i=12,n=Bi.ODD,r,s=!1){super(),this.type="FlatExtrusionGeometry",this._nearSide=new Uint8Array(0),this._vScale=0,this._shape=t,this._depth=e,this._curveSegments=i,this._windingRule=n,this._uvPitch=s?void 0:r,this._legacy=s;let a,o=[t.extractShapePointsToFlatArray([],i),...t.shapeHoles.map(U=>U.extractShapePointsToFlatArray([],i))];try{a=Pg({contours:o,windingRule:n,elementType:gr.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{a=J3}let l=a?.vertexCount??0,c=a?.elementCount??0,h=1/0,d=1/0,u=-1/0,p=-1/0;for(let U of o)for(let j=0;j<U.length;j+=2)U[j]<h&&(h=U[j]),U[j]>u&&(u=U[j]),U[j+1]<d&&(d=U[j+1]),U[j+1]>p&&(p=U[j+1]);let f=this._uvPitch,g=f??(u-h||1),m=f??(p-d||1),v=f===void 0?h:0,y=f===void 0?d:0,_=o.map((U,j)=>Q6(U,j>0)),b=0;for(let U of _)b+=U.length;let x=2*l+4*b,w=3*c*2+6*b,S=new Float32Array(3*x),E=new Float32Array(3*x),A=new Float32Array(2*x),P=new Uint32Array(w),C=new Uint8Array(x),R=0,O=0,D=0,F=!1,V=(U,j,q,rt,it,Y,ht=(U-v)/g,ot=(j-y)/m)=>{let ft=3*O;S[ft]=U,S[ft+1]=j,S[ft+2]=q,E[ft]=rt,E[ft+1]=it,E[ft+2]=Y,C[O]=q===e?F?2:1:0,A[2*O]=ht,A[2*O+1]=ot,O++};if(a!==void 0)for(let[U,j]of[[e,1],[0,-1]]){let q=O;for(let rt=0;rt<l;rt++)V(a.vertices[2*rt],a.vertices[2*rt+1],U,0,0,j);for(let rt=0;rt<c;rt++){let[it,Y,ht]=[a.elements[3*rt],a.elements[3*rt+1],a.elements[3*rt+2]];P[D++]=q+it,P[D++]=q+(j>0?Y:ht),P[D++]=q+(j>0?ht:Y)}}F=!0;for(let U=0;U<o.length;U++){let j=o[U],q=_[U],rt=j.length/2,{u:it,vScale:Y}=s?{u:new Float32Array(rt+1),vScale:0}:J6(j,g,m);R=Y;let ht=Y===0?0:e/Y,ot={minX:v,minY:y,spanX:g,spanY:m},ft=(pt,[tt,mt],N,L)=>{let H=j[2*pt],$=j[2*pt+1],[B,Z]=s?s8(ot,H,$,N):[L,N?0:ht];V(H,$,N?0:e,tt,mt,0,B,Z)};for(let pt=0;pt<q.length;pt++){let tt=(pt+1)%rt,[mt,N]=q[pt],[L,H]=[it[pt],it[pt+1]],$=O;ft(pt,mt,!1,L),ft(pt,mt,!0,L),ft(tt,N,!1,H),ft(tt,N,!0,H),P[D++]=$,P[D++]=$+1,P[D++]=$+2,P[D++]=$+3,P[D++]=$+2,P[D++]=$+1}}t8(S,E,P),this.setAttribute("position",new Ht(S,3)),this.setAttribute("normal",new Ht(E,3)),this.setAttribute("uv",new Ht(A,2)),this.setIndex(new Ht(P,1)),this._nearSide=C,this._vScale=R}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale)}canShiftDepthTo(t){return this._nearSide.length>0&&this._depth>0&&t>0}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}clone(){let t=new Bb(this._shape,this._depth,this._curveSegments,this._windingRule,this._uvPitch,this._legacy);return t.userData=Sx(this.userData),t}}}),a8=z(()=>{J(),x0(),ti(),tP(),TT=class extends jt{constructor(t,e=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=Bi.ODD,this.elementType=gr.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=t,this._curveSegments=e,this._triangulationOptions=Object.assign({windingRule:Bi.ODD,elementType:gr.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let n,r,s,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(u=>u.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,c=!0;for(let u=0,p=a.length/2;u<p;u++){let f=2*u,g=a[f+0],m=a[f+1];if(r!==void 0&&g!==r&&(l=!1),s!==void 0&&m!==s&&(c=!1),r=g,s=m,!l&&!c)break}if(!l&&!c)try{n=Pg({contours:[a,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{n=Q3}let h=n?.vertexCount??1,d=n?.elementCount??1;if(this._positionAttribute=new Ht(new Float32Array(3*h),3),this._normalAttribute=new Ht(new Float32Array(3*h),3),this._uvAttribute=new Ht(new Float32Array(2*h),2),this._indexAttribute=new Ht(new Uint32Array(3*d),1),n){let u=1/0,p=-1/0,f=1/0,g=-1/0;for(let y=0,_=h;y<_;y++){let b=2*y,x=n.vertices[b+0],w=n.vertices[b+1];x<u&&(u=x),x>p&&(p=x),w<f&&(f=w),w>g&&(g=w)}let m=p-u,v=g-f;for(let y=0,_=h;y<_;y++){let b=2*y,x=n.vertices[b+0],w=n.vertices[b+1],S=(x-u)/m,E=(w-f)/v;this._positionAttribute.setXYZ(y,x,w,0),this._normalAttribute.setXYZ(y,0,0,1),this._uvAttribute.setXY(y,S,E)}for(let y=0,_=d;y<_;y++){let b=3*y,x=n.elements[b+0],w=n.elements[b+1],S=n.elements[b+2];this._indexAttribute.setX(b+0,x),this._indexAttribute.setX(b+1,w),this._indexAttribute.setX(b+2,S)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,3*(n?.elementCount??1))}clone(){let t=new TT(this._shape,this._curveSegments);return t.userData=Sx(this.userData),t}}});function oK(t){return EL||(EL=async function(){let e=t??"https://unpkg.com/@splinetool/runtime@2.0.158/build",i=Promise.resolve().then(()=>(ED(),MD)),[n,r]=await Promise.all([i,fetch(`${e}/bevel.wasm`).then(s=>s.arrayBuffer())]);await n.default({module_or_path:r}),w0=n}())}function lK(t){let e=!1;return t.scene.objects.traverse((i,n)=>{let r=n.geometry;if(r!==void 0&&(c8.has(r.type)&&r.depth!==void 0&&r.depth>0&&(r.extrudeBevelSize??0)>0&&(e=!0),r.type==="PathGeometry")){let s=r.extrusion;s!==void 0&&s.capType==="round"&&(s.bevel??0)>0&&(e=!0)}}),e}function o8(t,e){let i=[t.extractShapePointsToFlatArray([],e)];for(let o of t.shapeHoles)i.push(o.extractShapePointsToFlatArray([],e));let n=0;for(let o of i)n+=o.length>>1;let r=new Float64Array(2*n),s=new Uint32Array(i.length),a=0;for(let o=0;o<i.length;o++)r.set(i[o],2*a),a+=i[o].length>>1,s[o]=a;return{points:r,ends:s}}function Ub(t,e,i,n,r,s){let a=t.positions.length/3,o=r.elements,l=d8.getNormalMatrix(r).elements;for(let h=0;h<a;h++){let d=3*h,u=3*(i+h),p=t.positions[d],f=t.positions[d+1],g=t.positions[d+2];e.positions[u]=o[0]*p+o[4]*f+o[8]*g+o[12],e.positions[u+1]=o[1]*p+o[5]*f+o[9]*g+o[13],e.positions[u+2]=o[2]*p+o[6]*f+o[10]*g+o[14];let m=t.normals[d],v=t.normals[d+1],y=t.normals[d+2];e.normals[u]=l[0]*m+l[3]*v+l[6]*y,e.normals[u+1]=l[1]*m+l[4]*v+l[7]*y,e.normals[u+2]=l[2]*m+l[5]*v+l[8]*y;let _=2*(i+h);if(s===void 0)e.uvs[_]=t.uvs[2*h],e.uvs[_+1]=t.uvs[2*h+1];else{let[b,x]=s(p,f,t.uvs[2*h],t.uvs[2*h+1],h);e.uvs[_]=b,e.uvs[_+1]=x}}let c=r.determinant()<0;for(let h=0;h<t.indices.length;h+=3)e.indices[n+h]=t.indices[h]+i,e.indices[n+h+1]=t.indices[h+(c?2:1)]+i,e.indices[n+h+2]=t.indices[h+(c?1:2)]+i}function l8(t){let{owner:e,shape:i,curveSegments:n,assembledAt:r,bevel:s,bevelSegments:a}=t,o=function(u,p){let f=[p],g=m=>{f.push(m.points.length,m.isClosed?1:0,m.roundness??0);for(let v of m.points){f.push(v.roundness??0,v.position.x,v.position.y);for(let y of v.controls)f.push(y.position.x,y.position.y)}f.push(m.shapeHoles.length);for(let v of m.shapeHoles)g(v)};return g(u),function(m){let v=2166136261;for(let y=0;y<m.length;y++)v^=m[y],v=Math.imul(v,16777619)>>>0;return v}(new Uint8Array(new Float64Array(f).buffer))}(i,n),l=e??`outline:${o}`,c=`${s}/${a}`,h=zb.get(l);if(h!==void 0&&h.outlineVersion===o&&h.capKey===c&&(t.stillServes?.(h)??1))return CT.placements++,h.cap;let d=function(u,p,f,g,m){let{points:v,ends:y}=o8(u,p);return w0.assemble_cap(v,y,f,g,0,Math.max(1,Math.floor(m)),h8,40)}(i,n,r,s,a);CT.assemblies++;try{let u=function(p,f){return function(g,m,v,y,_){let b=1/0;for(let x=2;x<g.length;x+=3)g[x]<b&&(b=g[x]);if(b===1/0&&(b=0),b!==0)for(let x=2;x<g.length;x+=3)g[x]-=b;return{positions:g,normals:m,uvs:v,indices:y,rise:_-b}}(p.positions(),p.normals(),p.uvs(),p.indices(),f)}(d,r);return zb.set(l,{outlineVersion:o,capKey:c,assembledAt:r,cap:u}),u}finally{d.free()}}function Wu(t,e){return .5*e>1.001*t}var w0,h8,EL,c8,d8,AL,TL,CL,zb,CT,PT,Ih,Ip=z(()=>{J(),ti(),i8(),eP(),h8=.4,c8=new Set(["VectorGeometry","TextGeometry","InputGeometry","PolygonGeometry","RectangleGeometry","StarGeometry","TriangleGeometry","EllipseGeometry"]),d8=new ue,AL=new Et,TL=new Et,CL=new Et().makeScale(1,1,-1),zb=new Map,CT={assemblies:0,placements:0},PT=class extends jt{constructor(t,e,i=0,n=12,r=3,s,a,o=!1){if(super(),this.type="ShapeGeometry",this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0,w0===void 0)throw new Error("bevel-wasm is not loaded");this._shape=t,this._uvPitch=a,this._legacy=o,this._depth=e,this._bevel=i,this._curveSegments=n,this._bevelSegments=r,this._ownerId=s,this.rebuild()}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale,this._effectiveBevel=e._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(t){return this._nearSide.length>0&&Wu(this._effectiveBevel,t)&&Wu(this._effectiveBevel,this._depth)}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position");if(i===void 0)return!1;let n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}setDepth(t){t!==this._depth&&(this._depth=t,this.rebuild(),this.computeBoundingSphere(),this.computeBoundingBox())}rebuild(){let t=l8({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:a=>Wu(a.cap.rise,this._depth)&&Wu(a.cap.rise,a.assembledAt)}),e=function(a,o,l,c,h,d=!1){let u=c.positions.length/3,p=l-c.rise,f=c.rise,{points:g,ends:m}=o8(a,o),v=1/0,y=1/0,_=-1/0,b=-1/0;for(let ot=0;ot<g.length;ot+=2)g[ot]<v&&(v=g[ot]),g[ot]>_&&(_=g[ot]),g[ot+1]<y&&(y=g[ot+1]),g[ot+1]>b&&(b=g[ot+1]);d&&(h=void 0);let x=h??_-v,w=h??b-y,S={minX:v,minY:y,spanX:_-v||1,spanY:b-y||1},E=[],A=0;for(let ot of m)E.push({at:A,count:ot-A}),A=ot;let P=0;for(let ot of E)P+=ot.count;let C=2*u+4*P,R=new Float32Array(3*C),O=new Float32Array(3*C),D=new Float32Array(2*C),F=new Uint32Array(2*c.indices.length+6*P),V=new Uint8Array(C),U=0,j=h===void 0?void 0:(ot,ft)=>[ot/h,ft/h],q=d?(ot,ft,pt,tt,mt)=>n8(c,mt)?[tt,pt]:[pt,tt]:j,rt=d?r8(c):c,it={positions:R,normals:O,uvs:D,indices:F};Ub(rt,it,0,0,AL.makeTranslation(0,0,p),j),Ub(rt,it,u,c.indices.length,TL.makeTranslation(0,0,f).multiply(CL),q),V.fill(1,0,u);let Y=2*u,ht=2*c.indices.length;for(let ot=0;ot<E.length;ot++){let{at:ft,count:pt}=E[ot],tt=g.subarray(2*ft,2*(ft+pt)),mt=Q6(tt,ot>0),N=d?{u:new Float32Array(pt+1),vScale:0}:J6(tt,x,w),L=N.u;U=N.vScale;for(let H=0;H<pt;H++){let $=(H+1)%pt,[B,Z]=mt[H],K=Y;for(let[k,st,dt,bt,ct,It]of[[tt[2*H],tt[2*H+1],B,p,L[H],2],[tt[2*$],tt[2*$+1],Z,p,L[H+1],2],[tt[2*$],tt[2*$+1],Z,f,L[H+1],0],[tt[2*H],tt[2*H+1],B,f,L[H],0]]){let St=3*Y;if(R[St]=k,R[St+1]=st,R[St+2]=bt,O[St]=dt[0],O[St+1]=dt[1],O[St+2]=0,d){let[Rt,Mt]=s8(S,k,st,It===0);D[2*Y]=Rt,D[2*Y+1]=Mt}else D[2*Y]=ct,D[2*Y+1]=U===0?0:(bt-f)/U;V[Y]=It,Y++}F[ht++]=K,F[ht++]=K+1,F[ht++]=K+2,F[ht++]=K,F[ht++]=K+2,F[ht++]=K+3}}return t8(R,O,F),{positions:R,normals:O,uvs:D,indices:F,nearSide:V,vScale:U}}(this._shape,this._curveSegments,this._depth,t,this._uvPitch,this._legacy);this._nearSide=e.nearSide,this._vScale=e.vScale,this._effectiveBevel=t.rise;let i=this.getAttribute("position"),n=this.getAttribute("normal"),r=this.getAttribute("uv"),s=this.getIndex();if(i!==void 0&&n!==void 0&&r!==void 0&&s!==null&&i.array.length===e.positions.length&&n.array.length===e.normals.length&&r.array.length===e.uvs.length&&s.array.length===e.indices.length)return i.array.set(e.positions),n.array.set(e.normals),r.array.set(e.uvs),s.array.set(e.indices),i.needsUpdate=!0,n.needsUpdate=!0,r.needsUpdate=!0,void(s.needsUpdate=!0);this.setAttribute("position",new Ht(e.positions,3)),this.setAttribute("normal",new Ht(e.normals,3)),this.setAttribute("uv",new Ht(e.uvs,2)),this.setIndex(new Ht(e.indices,1))}clone(){let t=new PT(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId,this._uvPitch,this._legacy);return t.userData=Sx(this.userData),t}}}),Eh=z(()=>{Oh(),aK(),a8(),Ip(),x0(),Ih=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=Object.assign({},e?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Bi.ODD},t.parameters),r=Math.abs(n.width),s=Math.abs(n.height??n.width),a=Math.abs(n.depth??0),o=t.shape??e?.shape,l=o?.roundness??n.roundness;o!==void 0&&(o instanceof ji?(i=o,(i.width!==r||i.height!==s)&&i.applySize(r,s)):i=new ji(r,s).fromJSON(o),t.parameters?.roundness!==void 0&&t.parameters?.roundness>0&&i.update());let c=i??new ji(r,s);return{parameters:Object.assign(n,{width:r,height:s,depth:a,roundness:l}),shape:c,ownerId:t.ownerId??e?.ownerId}}static build(t){let e,{depth:i,extrudeBevelSize:n,extrudeBevelSegments:r,subdivisions:s,roundness:a,windingRule:o,uvPitch:l,extrusionVersion:c}=t.parameters,h=c===1;return t.shape.roundness=a,i<=0?e=new TT(t.shape,s,{windingRule:o}):n<=0?e=new Bb(t.shape,i,s,o,l,h):w0!==void 0?e=new PT(t.shape,i,n,s,r,t.ownerId,l,h):(console.error("[extrude] engine not loaded \u2014 extruding without a bevel"),e=new Bb(t.shape,i,s,o,l,h)),Object.assign(e,{userData:{...t,type:"VectorGeometry"}})}}});function hK(t,e,i,n,r,s){if(n>=iP)return r>30||r%4==0?(function(h,d,u,p=0,f=0,g=0){let m=.5522847498,v=d*m,y=u*m;h.addPoint(Jv(f-d,g,f-d,g-y,f-d,g+y)),h.addPoint(Jv(f,g+u,f-v,g+u,f+v,g+u)),h.addPoint(Jv(f+d,g,f+d,g+y,f+d,g-y)),h.addPoint(Jv(f,g-u,f+v,g-u,f-v,g-u)),p>0&&p8(h,d,u,p)}(t,e,i,s),Math.round(r/4)):PL(t,n,r,e,i,s);let a={x:0,y:i},o=(n=Math.max(n,.001))+.5*Math.PI,l={x:Math.cos(o)*e,y:Math.sin(o)*i},c=function({px:h,py:d,cx:u,cy:p,rx:f,ry:g,largeArcFlag:m,sweepFlag:v}){let y=[];if(f===0||g===0)return[];let _=(h-u)/2,b=(d-p)/2;if(_===0&&b===0)return[];f=Math.abs(f),g=Math.abs(g);let x=Math.pow(_,2)/Math.pow(f,2)+Math.pow(b,2)/Math.pow(g,2);x>1&&(f*=Math.sqrt(x),g*=Math.sqrt(x));let w=function(O,D,F,V,U,j,q,rt,it,Y){let ht=Math.pow(U,2),ot=Math.pow(j,2),ft=Math.pow(q,2),pt=Math.pow(rt,2),tt=ht*ot-ht*pt-ot*ft;tt<0&&(tt=0),tt/=ht*pt+ot*ft,tt=Math.sqrt(tt)*(it===Y?-1:1);let mt=tt*U/j*rt,N=tt*-j/U*q,L=mt+(O+F)/2,H=N+(D+V)/2,$=(q-mt)/U,B=(rt-N)/j,Z=(-q-mt)/U,K=(-rt-N)/j,k=xL(1,0,$,B),st=xL($,B,Z,K);return!Y&&st>0&&(st-=Y1),Y&&st<0&&(st+=Y1),{centerx:L,centery:H,ang1:k,ang2:st}}(h,d,u,p,f,g,_,b,m,v),{ang1:S,ang2:E}=w,{centerx:A,centery:P}=w,C=Math.abs(E)/(Y1/4);Math.abs(1-C)<1e-7&&(C=1);let R=Math.max(Math.ceil(C),1);E/=R;for(let O=0;O<R;O++)y.push(rK(S,E)),S+=E;return y.map(O=>{let{x:D,y:F}=A2(O[0],f,g,A,P),{x:V,y:U}=A2(O[1],f,g,A,P),{x:j,y:q}=A2(O[2],f,g,A,P);return{x1:D,y1:F,x2:V,y2:U,x:j,y:q}})}({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:e,ry:i,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%c.length===0?function(h,d,u,p,f,g,m,v){let y=Math.round(f/p.length);h.addPoint(sp(d,u));for(let _=0,b=p.length;_<b;_++){let x=p[_],w=h.points[_],S=sp(x.x,x.y);w.controls[1].position.set(x.x1,x.y1),S.controls[0].position.set(x.x2,x.y2),h.addPoint(S)}return v>0?u8(h,g,m,v):h.addPoint(sp(0,0)),y}(t,a.x,a.y,c,r,e,i,s):PL(t,n,r,e,i,s)}function PL(t,e,i,n,r,s){let a=-e/i;for(let o=0;o<=i;o++){let l=a*o,c=Math.sin(l)*n,h=Math.cos(l)*r;t.addPoint(sp(c,h))}return e<iP?s>0?u8(t,n,r,s):t.addPoint(sp(0,0)):(t.removePoint(t.points[t.points.length-1]),s>0&&p8(t,n,r,s)),1}function sp(t,e){return new $c(Pt.generateUUID(),new et(t,e))}function Jv(t,e,i,n,r,s){let a=sp(t,e);return a.controls[0].position.set(i,n),a.controls[1].position.set(r,s),a}function u8(t,e,i,n){f8(t,e,i,n).forEach(r=>t.addPoint(r))}function p8(t,e,i,n){let r=f8(t,e,i,n),s=new ji;r.forEach(a=>s.addPoint(a)),s.isClosed=!0,t.shapeHoles.push(s)}function f8(t,e,i,n){let r=n*e/100,s=r*(Math.abs(i)/Math.abs(e)),a=new et(r/e,s/i),o=t.points.map(l=>{let c=l.clone();return c.uuid=Pt.generateUUID(),c}).reverse();return o.forEach(l=>{l.position.multiply(a);let c=l.controls[0].position.clone().multiply(a),h=l.controls[1].position.clone().multiply(a);l.controls[0].position.copy(h),l.controls[1].position.copy(c)}),o}var iP,Nx,m8,R2,g8,Fb=z(()=>{Oh(),Z6(),sK(),Eh(),J(),iP=2*Math.PI,Nx=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return i.angle=Pt.clamp(i.angle,0,360),{shape:t.shape&&t.shape instanceof ji?t.shape:new ji,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let e,{width:i,height:n,spikes:r,angle:s,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}=t.parameters,d=t.shape,u=hK(d,.5*i,.5*n,s*Math.PI/180,r,a);return d.isClosed=!0,d.update(),s===0?(e=new jt,e.setAttribute("position",new kt([],3))):e=Ih.create({shape:d,parameters:{subdivisions:u,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}}),Object.assign(e,{userData:{...t,type:"EllipseGeometry"}})}}}),DL=z(()=>{J(),H6(),m8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=r===0&&s!==0?new R2(.5*e,s,a):new aA(.5*e,r),l=i/e,c=n/e;return(l!==1||c!==1)&&o.scale(1,l,c),Object.assign(o,{userData:{...t,type:"IcosahedronGeometry"}})}},R2=class extends Ib{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r="IcosahedronGeometry";super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],r,t,e,i),this.type=r}static fromJSON(t){return new R2(t.radius,t.corner,t.cornerSides)}}}),RL=z(()=>{J(),g8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){(t.parameters?.points??[]).forEach(n=>{Array.isArray(n)&&(n.x=n[0],n.y=n[1])});let i=Object.assign({},e?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{points:e,segments:i,verticalSegments:n}=t.parameters,r=new Xg;r.moveTo(e[0].x,e[0].y),r.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new oA(r.extractPoints(n).shape,i);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...t,type:"LatheGeometry"}})}}});function Yd(t,e){return Math.abs(e-t)/2+Math.min(t,e)}function cK(t){let{positions:e,faces:i,materialIndices:n,uvs:r}=t,s=e.length/3,a=i.length/3,o=r!==null&&a>0,l=3*a,c=new Uint32Array(l),h=new Uint32Array(l),d=new Uint32Array(l),u=new Uint32Array(l),p=new Uint32Array(l),f=0,g=8;for(;g<2*l;)g*=2;let m=g-1,v=new Int32Array(g).fill(-1),y=(D,F)=>{let V=(Math.imul(D,2654435761)^F)&m;for(;;){let U=v[V];if(U===-1)return v[V]=f,c[f]=D,h[f]=F,f++;if(c[U]===D&&h[U]===F)return U;V=V+1&m}},_=(D,F)=>{let V=D<F?D:F,U=D<F?F:D,j=(Math.imul(V,2654435761)^U)&m;for(;;){let q=v[j];if(c[q]===V&&h[q]===U)return q;j=j+1&m}},b=new Uint32Array(s),x=new Float64Array(3*s),w=(D,F,V)=>{let U=D<F?y(D,F):y(F,D),j=++d[U];j===1?u[U]=V:j===2&&(p[U]=V),b[D]++,b[F]++,x[3*D]+=e[3*F],x[3*D+1]+=e[3*F+1],x[3*D+2]+=e[3*F+2],x[3*F]+=e[3*D],x[3*F+1]+=e[3*D+1],x[3*F+2]+=e[3*D+2]};for(let D=0;D<a;D++){let F=i[3*D],V=i[3*D+1],U=i[3*D+2];w(F,V,U),w(V,U,F),w(U,F,V)}let S=new Float64Array(3*f);for(let D=0;D<f;D++){let F=3*c[D],V=3*h[D];if(d[D]===2){let U=3*u[D],j=3*p[D];S[3*D]=.375*(e[F]+e[V])+.125*(e[U]+e[j]),S[3*D+1]=.375*(e[F+1]+e[V+1])+.125*(e[U+1]+e[j+1]),S[3*D+2]=.375*(e[F+2]+e[V+2])+.125*(e[U+2]+e[j+2])}else S[3*D]=.5*(e[F]+e[V]),S[3*D+1]=.5*(e[F+1]+e[V+1]),S[3*D+2]=.5*(e[F+2]+e[V+2])}let E,A=new Float64Array(3*s);for(let D=0;D<s;D++){let F=b[D];F===3?E=3/16:F>3&&(E=3/(8*F));let V=1-F*Number(E),U=Number(E);F===2&&(V=3/4,U=1/8),A[3*D]=e[3*D]*V+x[3*D]*U,A[3*D+1]=e[3*D+1]*V+x[3*D+1]*U,A[3*D+2]=e[3*D+2]*V+x[3*D+2]*U}let P=new Float64Array(3*(s+f));P.set(A),P.set(S,3*s);let C=new Uint32Array(12*a),R=new Array(4*a),O=o?new Float64Array(24*a):null;for(let D=0;D<a;D++){let F=i[3*D],V=i[3*D+1],U=i[3*D+2],j=_(F,V)+s,q=_(V,U)+s,rt=_(U,F)+s,it=12*D;C[it++]=j,C[it++]=q,C[it++]=rt,C[it++]=F,C[it++]=j,C[it++]=rt,C[it++]=V,C[it++]=q,C[it++]=j,C[it++]=U,C[it++]=rt,C[it++]=q;let Y=n[D];if(R[4*D]=Y,R[4*D+1]=Y,R[4*D+2]=Y,R[4*D+3]=Y,O!==null){let ht=6*D,ot=r[ht],ft=r[ht+1],pt=r[ht+2],tt=r[ht+3],mt=r[ht+4],N=r[ht+5],L=Yd(ot,pt),H=Yd(ft,tt),$=Yd(pt,mt),B=Yd(tt,N),Z=Yd(ot,mt),K=Yd(ft,N),k=24*D;O[k++]=L,O[k++]=H,O[k++]=$,O[k++]=B,O[k++]=Z,O[k++]=K,O[k++]=ot,O[k++]=ft,O[k++]=L,O[k++]=H,O[k++]=Z,O[k++]=K,O[k++]=pt,O[k++]=tt,O[k++]=$,O[k++]=B,O[k++]=L,O[k++]=H,O[k++]=mt,O[k++]=N,O[k++]=Z,O[k++]=K,O[k++]=$,O[k++]=B}}return{positions:P,faces:C,materialIndices:R,uvs:O}}var ty,v8,Mn,y8,nP,dK=z(()=>{J(),ty=1e4,v8=class{constructor(t=1){this.subdivisions=t}modify(t){let e=function(n){let r=n.getAttribute("position");if(r===void 0)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let s=n.getAttribute("uv"),a=n.getIndex(),o=r.count,l=new Map,c=new Uint32Array(o),h=[],d=0;for(let y=0;y<o;y++){let _=r.getX(y),b=r.getY(y),x=r.getZ(y),w=Math.round(_*ty),S=Math.round(b*ty),E=Math.round(x*ty),A=l.get(w);A===void 0&&(A=new Map,l.set(w,A));let P=A.get(S);P===void 0&&(P=new Map,A.set(S,P));let C=P.get(E);C===void 0&&(C=d++,P.set(E,C),h.push(_,b,x)),c[y]=C}let u=[],p=[],f=s===void 0?null:[],g=a!==null?a.count:o,m=(y,_)=>{let b=a!==null?a.getX(y):y,x=a!==null?a.getX(y+1):y+1,w=a!==null?a.getX(y+2):y+2;if(!(b<o&&x<o&&w<o))return;let S=c[b],E=c[x],A=c[w];S===E||E===A||A===S||(u.push(S,E,A),p.push(_),f!==null&&f.push(s.getX(b),s.getY(b),s.getX(x),s.getY(x),s.getX(w),s.getY(w)))},v=n.groups;if(v.length>0)for(let y=0;y<v.length;y++){let _=v[y],b=_.materialIndex===void 0?0:_.materialIndex,x=Math.max(_.start,0),w=Math.min(_.start+_.count,g);for(let S=x;S<w&&S+2<g;S+=3)m(S,b)}else for(let y=0;y+2<g;y+=3)m(y,0);return{positions:Float64Array.from(h),faces:Uint32Array.from(u),materialIndices:p,uvs:f===null?null:Float64Array.from(f)}}(t),i=this.subdivisions;for(;i-- >0;)e=cK(e);return function(n,r){let{positions:s,faces:a,materialIndices:o,uvs:l}=n,c=s.length/3,h=a.length/3,d=new Float64Array(3*c);for(let v=0;v<h;v++){let y=3*a[3*v],_=3*a[3*v+1],b=3*a[3*v+2],x=s[b]-s[_],w=s[b+1]-s[_+1],S=s[b+2]-s[_+2],E=s[y]-s[_],A=s[y+1]-s[_+1],P=s[y+2]-s[_+2],C=w*P-S*A,R=S*E-x*P,O=x*A-w*E;d[y]+=C,d[y+1]+=R,d[y+2]+=O,d[_]+=C,d[_+1]+=R,d[_+2]+=O,d[b]+=C,d[b+1]+=R,d[b+2]+=O}for(let v=0;v<c;v++){let y=d[3*v],_=d[3*v+1],b=d[3*v+2],x=Math.sqrt(y*y+_*_+b*b)||1;d[3*v]=y/x,d[3*v+1]=_/x,d[3*v+2]=b/x}let u=3*h,p=new Float32Array(3*u),f=new Float32Array(3*u),g=l!==null&&l.length>0?new Float32Array(2*u):null;for(let v=0;v<u;v++){let y=3*a[v];p[3*v]=s[y],p[3*v+1]=s[y+1],p[3*v+2]=s[y+2],f[3*v]=d[y],f[3*v+1]=d[y+1],f[3*v+2]=d[y+2]}g!==null&&g.set(l.subarray(0,2*u));let m=new jt;m.setAttribute("position",new Ht(p,3)),u>0&&(m.setAttribute("normal",new Ht(f,3)),m.setAttribute("color",new Ht(new Float32Array(3*u).fill(1),3))),g!==null&&m.setAttribute("uv",new Ht(g,2));for(let v=0;v<h;){let y=o[v],_=v;do v++;while(v<h&&o[v]===y);m.addGroup(3*_,3*(v-_),y)}return r.boundingBox!==null&&(m.boundingBox=r.boundingBox.clone()),r.boundingSphere!==null&&(m.boundingSphere=r.boundingSphere.clone()),m}(e,t)}}}),OL=z(()=>{J(),dK(),Mn=new T,y8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=t.geometry??e?.geometry??new jt().copy(new ya(100,100,100));e===void 0?(n.computeBoundingBox(),n.boundingBox.getSize(Mn),i={width:Mn.x,height:Mn.y,depth:Mn.z,subdivisions:0}):i=e.parameters;let r={...i,...t.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:n}}static build(t){let{width:e,height:i,depth:n,subdivisions:r}=t.parameters,s=t.geometry??new jt().copy(new ya(100,100,100)),a=s.userData.parameters;a===void 0?(s.boundingBox=function(l){let c=new hi,h=l.attributes.position;return h?(c.setFromBufferAttribute(h),c):(c.makeEmpty(),c)}(s),s.boundingBox.getSize(Mn)):Mn.set(a.width,a.height,a.depth),(e!==Mn.x||i!==Mn.y||n!==Mn.z)&&s.scale(Mn.x===0?1:e/Mn.x,Mn.y===0?1:i/Mn.y,Mn.z===0?1:n/Mn.z);let o=s.originalGeometry;try{r>0?(o===void 0||a?.subdivisions!==r)&&(o===void 0&&(o=s),s=new v8(r).modify(o)):(o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals())}catch{o!==void 0&&(s=o),o=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()}return o!==void 0&&Object.assign(s,{originalGeometry:o}),delete t.geometry,Object.assign(s,{userData:{...t,type:"NonParametricGeometry"}})}static loadFromUrl(t,e,i){new a3(i).load(t,n=>{let r=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Mn);let s=100/Mn.x;Object.assign(r.parameters,{width:100,height:Mn.y*s,depth:Mn.z*s}),e(this.build(r))})}}}),DT=z(()=>{Oh(),Eh(),nP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},t.parameters);return{shape:t.shape&&t.shape instanceof ji?t.shape:new ji,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,spikes:n,cornerRadius:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}=t.parameters,c=t.shape,h=.5*e,d=.5*i,u=2*Math.PI/n;for(let f=0;f<n;f++){let g=u*f,m=0+Math.sin(g)*h,v=0+Math.cos(g)*d;c.addPoint(c.createPoint(m,v))}c.isClosed=!0;for(let f=0,g=c.points.length;f<g;f++)c.points[f].roundness=r;c.roundness=r,c.update();let p=Ih.create({shape:c,parameters:{roundness:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}});return Object.assign(p,{userData:{...t,type:"PolygonGeometry"}})}}});function Yf(t,e,i){i.x=t.x*e.x,i.y=t.y,i.z=t.x*e.y}function O2(t,e,i,n,r,s){let a=b8.copy(e).sub(t),o=x8.copy(i).sub(t),l=a.angleTo(o);if(a.normalize(),o.normalize(),n===r){let c=a.add(o).normalize();s.copy(t).addScaledVector(c,n/Math.sin(l/2))}else{let c=a.angleTo(o);s.copy(t),s.addScaledVector(a,r/Math.sin(c)),s.addScaledVector(o,n/Math.sin(c))}}function uK(t,e,i){let n=t.clone().sub(e),r=i.clone().sub(e);return n.projectOnVector(r),n.add(e)}var _8,b8,x8,IL,kx,w8,S8,M8,LL,rP,E8,A8,T8,C8,BL=z(()=>{J(),_8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,heightSegments:s,openEnded:a,cornerRadius:o,cornerSegments:l}=t.parameters,c=new IL(.5*e,i,r,s,a,o,l),h=n/e;return h!==1&&c.scale(1,1,h),Object.assign(c,{userData:{...t,type:"PyramidGeometry"}})}},b8=new T,x8=new T,IL=class extends jt{constructor(t=.5,e=1,i=4,n=1,r=!1,s=0,a=4){super(),i=Math.floor(Math.max(3,i)),n=Math.floor(n),a=Math.floor(a);let o,l=[],c=[],h=[],d=[],u=0,p=e/2,f=Math.PI/i,g=t*Math.cos(Math.PI/i),m=2*Math.PI/i,v=(i-2)*Math.PI/i,y=Math.PI-v,_=new T(0,-p,0),b=new T(0,p,0),x=new et(t,-p),w=new et(g,-p),S=new et(0,b.y).sub(w),E=new et(0,b.y).sub(x),A=new et(S.y,-S.x).normalize(),P=new et(E.y,-E.x).normalize(),C=t*Math.cos(Math.PI/i)*Math.tan((Math.PI-S.angle())/2)-1e-8;s=Math.min(s,C);{let j=new T(A.x,A.y,0),q=new T(Math.cos(m)*j.x,j.y,Math.sin(m)*j.x);o=j.angleTo(q)}let R=s/Math.tan((Math.PI-S.angle())/2),O=s/Math.tan((Math.PI-o)/2),D=new T;if(!r){c.push(_.x,_.y,_.z),h.push(0,-1,0),d.push(0,0);let j=u++,q=[],rt=x.clone(),it=R/Math.cos(Math.PI/i);rt.x-=it;for(let Y=0;Y<i;Y++){let ht=Y/i*Math.PI*2+f;Yf(rt,new et(Math.sin(ht),Math.cos(ht)),D),c.push(D.x,D.y,D.z),h.push(0,-1,0),d.push(0,0),q.push(u++)}for(let Y=0;Y<q.length;Y++)l.push(q[Y],j,q[(Y+1)%q.length])}let F=[];{let j=new T,q=new T,rt=new T,it=new T,Y=new T,ht=new T;for(let ot=0;ot<i;ot++){let ft=ot/i*Math.PI*2+f,pt=(ot+.5)/i*Math.PI*2+f,tt=(ot+1)/i*Math.PI*2+f,mt=new et(Math.sin(ft),Math.cos(ft)),N=new et(Math.sin(pt),Math.cos(pt)),L=new et(Math.sin(tt),Math.cos(tt));Yf(x,mt,q),Yf(x,L,rt),Yf(A,N,j),O2(b,q,rt,O,O,it),c.push(it.x,it.y,it.z),O2(q,b,rt,O,R,Y),c.push(Y.x,Y.y,Y.z),O2(rt,q,b,R,O,ht),c.push(ht.x,ht.y,ht.z),h.push(j.x,j.y,j.z),h.push(j.x,j.y,j.z),h.push(j.x,j.y,j.z),d.push(0,0),d.push(0,0),d.push(0,0);let H=u++,$=u++,B=u++;if(l.push(H,$,B),s>0){{let k=q.clone().add(rt).multiplyScalar(.5),st=b.clone().sub(k).normalize(),dt=_.clone().sub(k).normalize().add(st).normalize().multiplyScalar(-1);V(k,ht.clone().sub(Y),dt,S.angle())}let Z,K;{let k=new T;Yf(P,L,k);let st=ht.clone().add(it).multiplyScalar(.5);st=uK(st,rt,b);let dt=ht.clone().sub(it);[Z,K]=V(st,dt,k,o,it.y)}{let k=Z,st=k.clone().setY(0).normalize(),dt=new T(0,-1,0),bt=st.clone().cross(dt);U(k,st,dt,bt)}F.concat(K);{let k=S.angle(),st=Math.PI-k,dt=b.clone();dt.y-=s/Math.sin(k-Math.PI/2);let bt=new T,ct=[];for(let St=0;St<a;St++){let Rt=[],Mt=Math.PI/2-st*St/a,W=Math.cos(Mt),_t=Math.sin(Mt),Dt=pt;for(let Gt=0;Gt<=St;Gt++){let Ft=Math.cos(Dt),_e=Math.sin(Dt);j.x=W*_e,j.y=_t,j.z=W*Ft,bt.copy(dt).addScaledVector(j,s),c.push(bt.x,bt.y,bt.z),h.push(j.x,j.y,j.z),d.push(0,0),Rt.push(u++),Dt+=2*Math.PI/St/i}ct.push(Rt)}K.reverse(),ct.push(K);let It=ct.length-1;for(let St=0;St<It;St++){let Rt=ct[St],Mt=ct[St+1],W=Rt.length-1;l.push(Mt[1],Rt[0],Mt[0]);for(let _t=1;_t<=W;_t++)l.push(Rt[_t],Rt[_t-1],Mt[_t]),l.push(Mt[_t+1],Rt[_t],Mt[_t])}}}}}function V(j,q,rt,it,Y){let ht=-it/2,ot=(Math.PI-it)/2,ft=q.clone().normalize().cross(rt);j.addScaledVector(rt,-s/Math.sin(ot));let pt=new T,tt=new T,mt=u,N=[];for(let L=0;L<=a;L++){let H=ht+L/a*it;tt.set(0,0,0),tt.addScaledVector(ft,Math.sin(H)),tt.addScaledVector(rt,Math.cos(H));for(let $=0;$<=1;$++){let B=$/1-.5;if(pt.copy(j),pt.addScaledVector(q,B),pt.addScaledVector(tt,s),Y!=null){let Z=Math.max(0,pt.y-Y);pt.addScaledVector(q,-Z/q.y)}c.push(pt.x,pt.y,pt.z),h.push(tt.x,tt.y,tt.z),d.push(0,0),$===0&&N.push(u),u++}}for(let L=0;L<a;L++)for(let H=0;H<1;H++){let $=mt+H+2*L,B=$+2,Z=B+1,K=$+1;l.push($,B,K),l.push(B,Z,K)}return[j.clone().addScaledVector(q,.5),N]}function U(j,q,rt,it){let Y=Math.PI/2,ht=E.angle()-Y,ot=[],ft=new T,pt=new T;for(let mt=0;mt<=a;mt++){let N=[],L=mt/a;for(let H=0;H<=mt;H++){let $=((mt?H/mt:0)-.5)*y,B=Math.cos($),Z=Math.sin($),K=(Y+Math.atan(Math.tan(ht)*B))*L,k=Math.cos(K),st=Math.sin(K);ft.set(0,0,0),ft.addScaledVector(q,st*B),ft.addScaledVector(rt,k),ft.addScaledVector(it,st*Z),pt.copy(j).addScaledVector(ft,s),c.push(pt.x,pt.y,pt.z),h.push(ft.x,ft.y,ft.z),d.push(0,0),N.push(u++)}ot.push(N)}let tt=ot.length-1;for(let mt=0;mt<tt;mt++){let N=ot[mt],L=ot[mt+1],H=N.length-1;l.push(N[0],L[1],L[0]);for(let $=1;$<=H;$++)l.push(N[$-1],N[$],L[$]),l.push(N[$],L[$+1],L[$])}}this.setIndex(l),this.setAttribute("position",new kt(c,3)),this.setAttribute("normal",new kt(h,3)),this.setAttribute("uv",new kt(d,2))}}}),Nb=z(()=>{Oh(),Eh(),kx=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters),n=Object.assign(e?.ui??{enabledIndieCorners:!1},t.ui);return{shape:t.shape&&t.shape instanceof ji?t.shape:new ji,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:n}}static build(t){let e=t.shape,{width:i,height:n,cornerRadius:r,cornerType:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:c}=t.parameters,h={x:.5*i,y:.5*n},d={x:-h.x,y:-h.y},u={x:h.x,y:h.y};function p(x,w,S){return w>i&&S>n?Math.min(x*i/w,x*n/S):w>i?x*i/w:S>n?x*n/S:x}let f=[];f[0]=r[0]===0?0:p(r[0],r[0]+r[3],r[0]+r[1]),f[1]=r[1]===0?0:p(r[1],r[1]+r[2],r[1]+r[0]),f[2]=r[2]===0?0:p(r[2],r[2]+r[1],r[2]+r[3]),f[3]=r[3]===0?0:p(r[3],r[3]+r[0],r[3]+r[2]);let g=d.x,m=u.x,v=u.y,y=d.y;e.addPoint(e.createPoint(g,v)),e.addPoint(e.createPoint(m,v)),e.addPoint(e.createPoint(m,y)),e.addPoint(e.createPoint(g,y)),e.isClosed=!0;let _=!0;for(let x=0,w=e.points.length;x<w;x++)e.points[x].roundness=f[x],x>0&&f[x]!==f[x-1]&&(_=!1);_&&(e.roundness=f[0]),e.useCubicForRoundedCorners=s!==1,e.update();let b=Ih.create({shape:e,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:c}});return Object.assign(b,{userData:{...t,type:"RectangleGeometry"}})}}}),UL=z(()=>{J(),w8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},t.parameters);return i.thetaLength=Pt.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let e,{width:i=100,height:n=i,depth:r=i,widthSegments:s=64,heightSegments:a=64,phiStart:o,phiLength:l,thetaStart:c,thetaLength:h}=t.parameters;return h===0?(e=new jt,e.setAttribute("position",new kt([],3))):e=new gh(.5*i,s,a,o,l,c,h*Pt.DEG2RAD),e.scale(1,n/i,r/i),Object.assign(e,{userData:{...t,type:"SphereGeometry"}})}}}),zL=z(()=>{J(),S8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(t){let{width:e=100,height:i=e,widthSegments:n=8,heightSegments:r=8}=t.parameters,s=new uo(e,i,n,r);return s.scale(1,1,1),Object.assign(s,{userData:{...t,type:"PlaneGeometry"}})}}}),FL=z(()=>{J(),M8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(t){let{width:e,height:i,depth:n,angle:r,cornerRadius:s,cornerSegments:a}=t.parameters,o=new LL(e,i,n,r,s,a);return Object.assign(o,{userData:{...t,type:"BackdropGeometry"}})}},LL=class extends jt{constructor(t=1,e=1,i=1,n=90,r=10,s=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],c=.001;r==0&&(s=1),s=Math.max(1,Math.floor(s)),r=Math.min(r,100),n=Math.min(180-c,n),n*=Math.PI/180;let h=[],d=Math.PI/2,u=(pt=0,tt=0,mt=0)=>new T(pt,tt,mt),p=u(),f=u(),[g,m,v]=[e/2,t/2,i/2],y=-m,_=+m,[b,x,w]=[u(y,-g,+v),u(y,-g,-v),u(y,+g,-v)],S=(pt,tt=!1)=>Math.sin(pt-Math.PI/(+tt+1)),E=(pt,tt=!1)=>Math.cos(pt-Math.PI/(+tt+1));w.y=Math.sin(n)*e-g;let A=Math.cos(n)*e-v,P=b.z-c;n<=d?(w.z=Math.min(A,P),w.z==P&&(w.y-=(A-P)/Math.tan(d-n))):x.z=Math.min(x.z-A-v,b.z-c),p.subVectors(b,x),f.subVectors(w,x);let C=Math.min(p.length(),f.length())*r/100,R=C*Math.tan(n/2),O=C/Math.cos(n/2),D=p.clone().normalize().add(f.normalize()).setLength(O).add(x);p.set(0,S(n,!0),E(n,!0)),h.push([w,p.clone()]);let F=(Math.PI-n)/s;for(let pt=0;pt<=s;pt++){let tt=d+n+pt*F;p.set(0,Math.sin(tt)*R,Math.cos(tt)*R),p.add(D),f.set(0,S(tt),E(tt)),h.push([p.clone(),f.clone()])}h.push([b,u(0,1,0)]);let V=Math.sin(F/2)*R*2,U=h.length-1,j=h[0][0].distanceTo(h[1][0]),q=j+V*s+h[U-1][0].distanceTo(h[U][0]);h[0].push(1);for(let pt=0;pt<=s;pt++)h[pt+1].push(1-(j+pt*V)/q);h[U].push(0);let rt,it,Y,[ht,ot,ft]=h[0];for(let pt=1;pt<h.length;pt++)[rt,it,Y]=h[pt],a.push(y,ht.y,ht.z,y,rt.y,rt.z,_,ht.y,ht.z,_,ht.y,ht.z,y,rt.y,rt.z,_,rt.y,rt.z),o.push(0,ot.y,ot.z,0,it.y,it.z,0,ot.y,ot.z,0,ot.y,ot.z,0,it.y,it.z,0,it.y,it.z),l.push(0,ft,0,Y,1,ft,1,ft,0,Y,1,Y),[ht,ot,ft]=[rt,it,Y];this.setAttribute("position",new kt(a,3)),this.setAttribute("normal",new kt(o,3)),this.setAttribute("uv",new kt(l,2))}}}),RT=z(()=>{Oh(),Eh(),rP=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return{shape:t.shape&&t.shape instanceof ji?t.shape:new ji,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,innerRadiusPercent:n,spikes:r,cornerRadius:s,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}=t.parameters,d=t.shape,u=.5*e,p=.5*i,f=a*Math.PI/360/r,g=Math.PI/2*3*-1,m=u*n/100,v=p*n/100;if(r===3&&n===50){f=2*Math.PI/r;for(let _=0;_<r;_++){let b=f*_,x=0+Math.sin(b)*u,w=0+Math.cos(b)*p;d.addPoint(d.createPoint(x,w))}}else for(let _=0;_<r;_++){let b=0+Math.cos(g)*u,x=0+Math.sin(g)*p;d.addPoint(d.createPoint(b,x)),g+=f,b=0+Math.cos(g)*m,x=0+Math.sin(g)*v,d.addPoint(d.createPoint(b,x)),g+=f}d.isClosed=!0;for(let _=0,b=d.points.length;_<b;_++)d.points[_].roundness=s;d.roundness=s,d.update();let y=Ih.create({shape:d,parameters:{roundness:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:c,extrusionVersion:h}});return Object.assign(y,{userData:{...t,type:"StarGeometry"}})}}}),NL=z(()=>{J(),E8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i}=t.parameters,n=new uo(e,i);return Object.assign(n,{userData:{...t,type:"TextFrameGeometry"}})}}}),kL=z(()=>{J(),n0(),A8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??i.width);i.shapeBlendNode&&(r=n);let s=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:n,height:r,depth:s})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,tubularSegments:s,arc:a,cornerRadius:o,cornerSegments:l}=t.parameters,c=function(h,d,u,p,f,g,m,v,y,_,b){[d,u]=[u,d],m=d/2;let x=Pt.clamp(f/360,0,1);if(x===0){let w=new jt;return w.setAttribute("position",new kt([],3)),w}return x===1&&(_=0),new vT(!0,h,d,u,p,x,g,m,0,y,_,b)}(e,i,n,.5*e,a,s,0,0,r,o,l);return c.scale(1,i/e,1),Object.assign(c,{userData:{...t,type:"TorusGeometry"}})}}}),VL=z(()=>{J(),T8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(t){let{width:e,tube:i,tubularSegments:n,radialSegments:r,p:s,q:a}=t.parameters,o=.5*e;o!==i&&(o-=i);let l=new lA(o,i,n,r,s,a);return Object.assign(l,{userData:{...t,type:"TorusKnotGeometry"}})}}}),jL=z(()=>{Oh(),Eh(),C8=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},t.parameters);return{shape:t.shape&&t.shape instanceof ji?t.shape:new ji,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e=100,height:i,cornerRadius:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a,isRect:o,extrusionVersion:l}=t.parameters,c=t.shape,h=.5*e,d=.5*i;o?(c.addPoint(c.createPoint(-h,d)),c.addPoint(c.createPoint(h,-d)),c.addPoint(c.createPoint(-h,-d))):(c.addPoint(c.createPoint(0,d)),c.addPoint(c.createPoint(h,-d)),c.addPoint(c.createPoint(-h,-d))),c.isClosed=!0;for(let p=0,f=c.points.length;p<f;p++)c.points[p].roundness=n;c.roundness=n,c.update();let u=Ih.create({shape:c,parameters:{roundness:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a,extrusionVersion:l}});return Object.assign(u,{userData:{...t,type:"TriangleGeometry"}})}}}),pK=z(()=>{}),fK=z(()=>{J(),new vr,new Et,new il,new T,new T,new T,new T});function GL(){let t=new jt;return t.setAttribute("position",new Ht(new Float32Array([]),3)),t.setIndex(new Ht(new Uint16Array([]),1)),t}var HL,OT,P8=z(()=>{Dn(),Xt(),x0(),J(),y0(),Oh(),Eh(),Ip(),HL=GL().attributes,OT=class extends jt{constructor(t,e){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],this._nearSide=new Uint8Array(0),this._depth=0,this._effectiveBevel=0,this._vScale=0,Object.assign(this.attributes,HL),this.userData={parameters:t,type:"TextGeometry"};let i=e.getFont(t.font);i?.isLoaded?(this.font=i,this.update(t,e)):this.updateFont(t.font,e).then(()=>{this.update(t,e),e?.requestRender()})}async updateFont(t,e){let i=e.getFont(t);i&&(this.font=i,await i.loadingPromise)}update(t,e){let i=this.font;if(this.userData={parameters:t,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:n,height:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:c,fontSize:h,extrusionVersion:d}=t,u=_r.getDisplayedValue(l),p=function(w,S,E,A){let P=typeof w.width=="string"?Number(A.getVariable(w.width)):w.width,C=[""],R="";for(let O of E)R+=O,O===" "||O===`
|
|
4191
4211
|
`?(C[C.length-1]+=R,R="",O===`
|
|
4192
|
-
`&&C.push("")):S.getTextWidth(C[C.length-1]+R,w)>P&&(C[C.length-1].length&&C.push(""),S.getTextWidth(C[C.length-1]+R,w)>P&&(R.length===1?(C[C.length-1]+=R,R=""):(C[C.length-1]+=R.slice(0,-1),R=R[R.length-1],C.push(""))));return C[C.length-1]+=R,C}(t,i,c===2?u.toUpperCase():c===3?u.toLowerCase():u,e),{shapes:f,charWidths:g,charCoords:m}=i.generateShapes(p,t,e),v=.5*(typeof n=="number"?n:Number(e.getVariable(n))),y=.5*(typeof r=="number"?r:Number(e.getVariable(r))),_=f.map(w=>new ji().fromShape(w,!0));this.vectorShapes=_;let b=_.map(w=>Ih.create({shape:w,parameters:{depth:s,extrudeBevelSegments:o,extrudeBevelSize:a,uvPitch:d===1?void 0:h,extrusionVersion:d,windingRule:s<=0?Bi.NONZERO:Bi.ODD,subdivisions:this.isLowResolution&&s>0?1:12}})),x=b.length?Nc(b):GL();x.translate(-v,y,0),this.dispose(),this.wrappedText=p,this.charCoords=m,this.charWidths=g,this.deleteAttribute("extrudeNormal"),Object.entries(x.attributes).forEach(([w,S])=>{this.setAttribute(w,S)}),this.setIndex(x.index),this.adoptNearSide(b,s),this.computeBoundingSphere()}adoptNearSide(t,e){this._depth=e;let i=0,n=0,r=0;for(let o of t){let l=o,c=l._nearSide;if(c===void 0||c.length===0)return this._nearSide=new Uint8Array(0),this._effectiveBevel=0,void(this._vScale=0);i+=c.length,n=Math.max(n,l._effectiveBevel??0),r=l._vScale??r}this._effectiveBevel=n,this._vScale=r;let s=new Uint8Array(i),a=0;for(let o of t){let l=o._nearSide;s.set(l,a),a+=l.length}this._nearSide=s}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale,this._effectiveBevel=e._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(t){return this._nearSide.length===this.getAttribute("position")?.count&&Wu(this._effectiveBevel,t)&&Wu(this._effectiveBevel,this._depth)}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position"),n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}clone(){let t=Ar(new jt,OT.prototype);return t.copy(this),console.log("CloneGeometry",this,t),t}copy(t){return Object.entries(t.attributes).forEach(([e,i])=>{this.setAttribute(e,i)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t,e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:t}},e)}get text(){return this.userData.parameters.text??""}}});function mK(t){if(!IT)return WL||(WL=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.157/build",i=import("./process.js"),[n,r]=await Promise.all([i,fetch(`${e}/process.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});D8(a),IT=!0}())}var D8,sP,IT,WL,Vx=z(()=>{sP=new Promise(t=>{D8=t}),IT=!1});function I2(t,e){if(Object.keys(t.morphAttributes).length>0||Object.keys(e.morphAttributes).length>0)return!1;let i=Object.keys(t.attributes),n=Object.keys(e.attributes);if(i.length!==n.length)return!1;for(let l of n){let c=t.attributes[l],h=e.attributes[l];if(c===void 0||c.isInterleavedBufferAttribute===!0||h.isInterleavedBufferAttribute===!0||c.itemSize!==h.itemSize||c.normalized!==h.normalized||c.array.constructor!==h.array.constructor||c.array.length!==h.array.length)return!1}let r=t.index,s=e.index;if(r===null!=(s===null))return!1;let a=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let l=r.array.constructor,c=s.array.constructor;if(l!==c){if(l!==Uint32Array||c!==Uint16Array)return!1;a=!0}}if(t.groups.length!==e.groups.length)return!1;for(let l=0;l<e.groups.length;l++){let c=t.groups[l],h=e.groups[l];if(c.start!==h.start||c.count!==h.count||c.materialIndex!==h.materialIndex)return!1}for(let l of n){let c=t.attributes[l],h=e.attributes[l];c.array.set(h.array),c.needsUpdate=!0}let o=t.takeDepthStateFrom;if(typeof o=="function"&&o.call(t,e),r!==null&&s!==null){if(a){let l=r.array,c=s.array;for(let h=0,d=c.length;h<d;h++){let u=c[h];l[h]=u===65535?4294967295:u}}else r.array.set(s.array);r.needsUpdate=!0}return t.drawRange.start=e.drawRange.start,t.drawRange.count=e.drawRange.count,t.userData=e.userData,t.boundingBox=null,t.boundingSphere=null,!0}function LT(t,e,i,n){let r,s,a,o=t.position.array,l=t.normal.array,c=R8.makeScale(e,i,n).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=e,o[h+1]*=i,o[h+2]*=n,r=l[h],s=l[h+1],a=l[h+2],l[h]=c[0]*r+c[4]*s+c[8]*a,l[h+1]=c[1]*r+c[5]*s+c[9]*a,l[h+2]=c[2]*r+c[6]*s+c[10]*a;t.position.needsUpdate=!0,t.normal.needsUpdate=!0}var R8,O8=z(()=>{J(),R8=new Et});function BT(t){let e=Number(t);return Number.isInteger(e)&&e>=0&&String(e)===t?e:-1}function ey(t){if(t!=null){if(Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView))return t;if(typeof t=="object")return function(e){let i=Object.keys(e),n=0;for(let s of i){let a=BT(s);a>=n&&(n=a+1)}if(n===0||n>i.length)return;let r=new Array(n);for(let s=0;s<n;s++){let a=e[s];if(typeof a!="number")return;r[s]=a}return r}(t)}}function L2(t){if(t==null)return"missing";if(Array.isArray(t))return`Array(${t.length})`;if(ArrayBuffer.isView(t)){let l=t;return`${t.constructor.name}(${l.length})`}if(typeof t!="object")return typeof t;let e=Object.keys(t),i=e.filter(l=>BT(l)===-1),n=0;for(let l of e){let c=BT(l);c>=n&&(n=c+1)}let r=t,s=-1,a=-1;for(let l=0;l<n;l++)l in r?typeof r[l]!="number"&&a===-1&&(a=l):s===-1&&(s=l);let o=[`${e.length} keys`,"max index "+(n-1)];return s!==-1&&o.push(`first missing index ${s}`),a!==-1&&o.push(`non-number at ${a} (${typeof r[a]})`),i.length&&o.push(`stray keys ${i.slice(0,3).join(",")}`),`Object{${o.join(", ")}}`}function I8(t){let e=Object.keys(t);return e.length===1&&e[0]==="subdivisions"}function aP(t,e){let i=e?e.count:t.count,n=0,r=1e4,s=new Map,a=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=e?e.getX(h):h,u=t.getX(d),p=t.getY(d),f=t.getZ(d),g=Math.round(u*r),m=Math.round(p*r),v=Math.round(f*r),y=s.get(g);y===void 0&&(y=new Map,s.set(g,y));let _=y.get(m);_===void 0&&(_=new Map,y.set(m,_));let b=_.get(v);b===void 0&&(b=n++,_.set(v,b),o.push(u,p,f)),a[h]=b}let l=[],c=[];for(let h=0;h<a.length;h+=3)a[h]===a[h+1]||a[h]===a[h+2]||a[h+1]===a[h+2]||(l.push(a[h],a[h+1],a[h+2]),c.push(e?e.getX(h):h,e?e.getX(h+1):h+1,e?e.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:c}}var Zf,dc,Qt,B2,U2,z2,Vi,Kf,iy,ny,ry,UT,Z1,Lp=z(()=>{J(),Vx(),Xt(),jx(),O8(),n0(),Zf=new hi,dc=new T,sP.then(t=>{Qt=t}),B2=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),U2=new Uint32Array([0,1,2,3]),z2=new Uint8Array([4]),Vi=class extends jt{constructor(t,e){super(),this.data=t,this.flatShading=e,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(t,e){this.freeSubdivPointer();let i=this.data.scaleBaked.map(a=>typeof a=="number"?a:1),n=yh.div(e.map(a=>typeof a=="number"?a:0),i);if(n.every(a=>a===1))return;this.subdividedGeometry&<(this.subdividedGeometry.attributes,...n),this.originalGeometry&<(this.originalGeometry.attributes,...n),this.data=t;let r=this.userData.parameters;this.userData.parameters={width:r.width*n[0],height:r.height*n[1],depth:r.depth*n[2]},this.originalGeometry.boundingSphere.center.multiply(dc.fromArray(n));let s=dc.set(r.width,r.height,r.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(t){this.freeSubdivPointer(),this.data=t;let e=t.phongAngle??35;this.flatShading&&(e=-1);let i=null;if(t.subdivisions>0){let r=0;try{r=Vi.allocate(t),i=Vi.buildRefined(r,t.subdivisions,e)}catch(s){console.error(s,t)}finally{r&&Vi.freeSubdivPointer(r)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let n=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=n}rebuild(){let t,e,i;try{({originalGeometry:t,subdividedGeometry:e,subdivPointer:i}=Vi.build(this.data,void 0,!this.flatShading,void 0))}catch{t=new ya(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=t,this.subdividedGeometry=e??void 0;let n=this.subdividedGeometry??this.originalGeometry;Object.assign(this,n),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Vi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;Zf.setFromBufferAttribute(e),Zf.getCenter(i),t.boundingSphere.radius=i.distanceTo(Zf.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Zf.getSize(dc);let n={width:dc.x,height:dc.y,depth:dc.z};return this.userData.parameters=n,n}static build(t,e,i,n){let r,s,a=t?.phongAngle??35;i===!1&&(a=-1),e&&(Qt.free_bvh(e),Qt.free_subdivision_surface(e));try{r=Vi.allocate(t,n)}catch(l){console.error(l,t),r=Vi.allocate({positionWASM:B2,indexWASM:U2,verticesPerFaceWASM:z2},n)}Qt.set_destination_refinement_level(r,0);let o=Vi.buildLevel(r,!0,a);return s=t.subdivisions>0?Vi.buildRefined(r,t.subdivisions,a):null,{subdivPointer:r,originalGeometry:o,subdividedGeometry:s}}static buildRefined(t,e,i){try{return Qt.set_destination_refinement_level(t,e),Vi.buildLevel(t,!1,i)??null}catch{try{return Qt.set_destination_refinement_level(t,e-1),Vi.buildLevel(t,!1,i)??null}catch{return null}}}static primitiveToQuads(t,e,i){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),t.type==="DodecahedronGeometry"&&(t.detail=0);let n,r=t.shape!==void 0||t.path!==void 0?e.geometry:hh(t,i,!1,e);n=w6(t)?r.getClosedTorusIndicesForBooleanOrSubdiv():r.getIndex();let s,{positions:a,triIndices:o,triOriginals:l}=aP(r.getAttribute("position"),n);if(t.type==="CylinderGeometry"&&t.cornerRadius===0&&t.hollow===0&&t.openEnded===!1){let u=t.radialSegments*t.heightSegments*3*2;s=[u,u+3*t.radialSegments]}let{indices:c,verticesPerFace:h,uvs:d}=function(u,p,f,g,m){let v=[],y=[],_=m?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=E=>{if(b){let A=m[E];b.push(_.getX(A),_.getY(A))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let E=f.userData.shape.extractShapePointsToFlatArray([]),A=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&A<=24&&A%4==0&&f.userData.parameters.angle>=360){let R=E.length/2/A;E=E.filter((O,D)=>Math.floor(D/2)%R===0)}let P=0;for(let R=0;R<E.length;R+=2)P+=(E[R]-E[(R===0?E.length:R)-2])*(E[R+1]+E[(R===0?E.length:R)-1]);u.length=0;let C=0;if(P<0)for(let R=0;R<E.length;R+=2)u.push(E[R],E[R+1],0),v.push(C++);else for(let R=E.length-2;R>=0;R-=2)u.push(E[R],E[R+1],0),v.push(C++);return y.push(C),{indices:v,verticesPerFace:y}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let E=0;if((u[3*p[S]+2]===w||u[3*p[S]+2]===0)&&E++,(u[3*p[S+1]+2]===w||u[3*p[S+1]+2]===0)&&E++,(u[3*p[S+2]+2]===w||u[3*p[S+2]+2]===0)&&E++,E===3)break}if(p[S+1]===p[S+3]&&p[S+2]===p[S+5]||p[S+0]===p[S+3]&&p[S+2]===p[S+4]){Kf.set(u[3*p[S]],u[3*p[S]+1],u[3*p[S]+2]),iy.set(u[3*p[S+1]],u[3*p[S+1]+1],u[3*p[S+1]+2]),ny.set(u[3*p[S+4]],u[3*p[S+4]+1],u[3*p[S+4]+2]),ry.set(u[3*p[S+5]],u[3*p[S+5]+1],u[3*p[S+5]+2]),iy.sub(Kf).normalize(),ny.sub(Kf).normalize(),ry.sub(Kf).normalize();let E=iy.cross(ny).dot(ry),A=S;Math.abs(E)>.005||g&&g.some((P,C)=>C%2!=1&&A>=g[C]&&A<g[C+1])?(v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3):(v.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),y.push(4),S+=6)}else v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let E=[],A=[],P=0;for(let C=0,R=0;C<u.length;C+=3,R++)u[C+2]===0&&(E.push(R),P++),u[C+2]===w&&A.push(R);if(f.userData.parameters.extrudeBevelSize===0){let C=A[0];A[0]=A[1],A[1]=C}E.reverse(),v.push(...E,...A),y.push(P,P),b=void 0}return{indices:v,verticesPerFace:y,uvs:b}}(a,o,r,s,l);return{positions:a,indices:c,verticesPerFace:h,uvs:d}}static allocate(t,e){let i,n,r,s=[],a=[],o=ey(t.positionWASM),l=ey(t.indexWASM),c=ey(t.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!c?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${L2(t.positionWASM)}, indexWASM ${L2(t.indexWASM)}, verticesPerFaceWASM ${L2(t.verticesPerFaceWASM)}`);i=o,n=l,r=c;let S=ey(t.uvWASM);Qt.alloc_subdivision_surface_uvs&&S&&S.length===2*n.length&&(a=S)}else i=B2,n=U2,r=z2;let h=i.length,d=n.length,u=r.length,p=i.length+s.length+a.length,f=n.length+r.length,g=p*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,m=p*Float32Array.BYTES_PER_ELEMENT,v=Qt._malloc(g);if(!v)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${g}) failed`);let y,_=new Float32Array(Qt.HEAPF32.buffer,v,p),b=new Uint32Array(Qt.HEAPU32.buffer,v+m,f);_.set(i,0),_.set(s,i.length),_.set(a,i.length+s.length),b.set(n,0),b.set(r,n.length),t?.scaleBaked?.some(S=>S!==1)&&(y=new Et().makeScale(...t.scaleBaked.map(S=>typeof S=="number"?S:1))),e&&(y?y.premultiply(e):y=e);let x=v+(i.length+s.length)*Float32Array.BYTES_PER_ELEMENT,w=a.length?y?Qt.alloc_subdivision_surface_uvs2(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,x,a.length,y.elements):Qt.alloc_subdivision_surface_uvs(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,x,a.length):y?Qt.alloc_subdivision_surface2(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,y.elements):Qt.alloc_subdivision_surface(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u);return Qt._free(v),w}static buildLevel(t,e,i,n,r,s=!1){let a=r?Qt.get_mesh_data2(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i,r.elements):Qt.get_mesh_data(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i),o=Qt.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),c=0,h=Qt.HEAPU32[o[c]>>2],d=Qt.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let u=Qt.HEAPU32[o[c]>>2],p=Qt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Qt.HEAPU32[o[c]>>2],g=Qt.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let m,v=Qt.HEAPU32[o[c]>>2],y=Qt.HEAPU32.subarray(v>>2,(v>>2)+l[c]);if(c++,Qt.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=Qt.HEAPU32[o[8]>>2];m=Qt.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(n===void 0){let b=new jt;if(b.setIndex(new mh(y,1)),b.setAttribute("position",new kt(d,3)),b.setAttribute("normal",new kt(p,3)),m&&b.setAttribute("uv",new kt(m,2)),e){b.setAttribute("faceMap",new mh(g,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new Ht(x,4))}return Qt.free_mesh_data(a),b.userData.type="SubdivGeometry",b}if(n.getAttribute("position").copyArray(d),n.getAttribute("normal").copyArray(p),n.attributes.position.needsUpdate=!0,n.attributes.normal.needsUpdate=!0,s){let b=n.getIndex();b!==null&&b.array.length===y.length&&(b.copyArray(y),b.needsUpdate=!0)}let _=n.getAttribute("uv");m&&_&&_.array.length===m.length&&(_.copyArray(m),_.needsUpdate=!0),Qt.free_mesh_data(a)}static freeSubdivPointer(t){Qt.free_bvh(t),Qt.free_subdivision_surface(t)}static buildControlCageWireframe(t,e,i){let n=Qt.get_wireframe_data_for_base_level(t),r=Qt.HEAPU32.subarray(n>>2,4+(n>>2)),s=r.subarray(2,4),a=0,o=Qt.HEAPU32[r[a]>>2],l=Qt.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let c=Qt.HEAPU32[r[a]>>2],h=Qt.HEAPU32.subarray(c>>2,(c>>2)+s[a]);if(e===void 0){let d=new jt;d.setAttribute("position",new kt(l,3));let u=new Float32Array(l.length);for(let p=0,f=l.length;p<f;)u[p++]=i.r,u[p++]=i.g,u[p++]=i.b;return d.setAttribute("color",new Ht(u,3)),d.setIndex(new mh(h,1)),Qt.free_wireframe_data_for_base_level(n),d}e.getAttribute("position").copyArray(l),e.attributes.position.needsUpdate=!0,Qt.free_wireframe_data_for_base_level(n)}static updateCollabMesh(t,e,i){let n=e===0;n||Qt.set_destination_refinement_level(t,e);let r=i?Qt.get_topological_data2(t,n?Qt.Level.CONTROL:Qt.Level.REFINED,i.elements):Qt.get_topological_data(t,n?Qt.Level.CONTROL:Qt.Level.REFINED),s=Qt.HEAPU32.subarray(r>>2,8+(r>>2)),a=s.subarray(3,6),o=0,l=Qt.HEAPU32[s[o]>>2],c=new Float32Array(Qt.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let h=Qt.HEAPU32[s[o]>>2],d=new Uint32Array(Qt.HEAPU32.subarray(h>>2,(h>>2)+a[o]));o++;let u,p=Qt.HEAPU32[s[o]>>2],f=new Uint8Array(Qt.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(Qt.alloc_subdivision_surface_uvs){let g=s[7];if(g>0){let m=Qt.HEAPU32[s[6]>>2];u=new Float32Array(Qt.HEAPF32.subarray(m>>2,(m>>2)+g))}}return Qt.free_topological_data(r),{positions:c,indices:d,verticesPerFace:f,uvs:u}}},Kf=new T,iy=new T,ny=new T,ry=new T}),L8=z(()=>{hL(),cL(),Lb(),dL(),Fb(),n0(),DL(),RL(),OL(),DT(),BL(),Nb(),UL(),zL(),FL(),RT(),NL(),kL(),VL(),jL(),Eh(),ke(),hL(),cL(),Lb(),dL(),Fb(),pK(),n0(),DL(),RL(),OL(),DT(),BL(),Nb(),UL(),zL(),FL(),RT(),NL(),kL(),VL(),jL(),Eh(),fK(),a8(),P8(),Lp(),Vx(),Fx(),Ip(),UT={ConeGeometry:V6,CubeGeometry:j6,CylinderGeometry:K3,DodecahedronGeometry:G6,EllipseGeometry:Nx,HelixGeometry:S6,IcosahedronGeometry:m8,LatheGeometry:g8,NonParametricGeometry:y8,PolygonGeometry:nP,PyramidGeometry:_8,RectangleGeometry:kx,SphereGeometry:w8,PlaneGeometry:S8,BackdropGeometry:M8,StarGeometry:rP,TextFrameGeometry:E8,TorusGeometry:A8,TorusKnotGeometry:T8,TriangleGeometry:C8,VectorGeometry:Ih},Z1=t=>{let e=UT[t.type]??u6(t.type);if(e===void 0)throw new Error(`No geometry factory registered for "${t.type}" \u2014 was its feature compiled out of this runtime build?`);return e.create(t)}});function hh(t,e,i,n){let r,s,a;t.type==="PathGeometry"?(s={...t,extrusion:{...t.extrusion}},a=[[],["extrusion"]]):(s={...t},a=[[]]);for(let c of a){let h=s;for(let d of c)h=h[d];for(r in h){let d=h[r];jA(d)&&!B8.includes(r)&&(h[r]=e.getVariable(d,[n.uuid,"geometry",...c,r]),jA(h[r])&&(h[r]=1))}}let o,l={parameters:s,type:s.type};if(s.type==="PathGeometry"){l.path=s.path;let c=n.profileShape;c!==void 0&&(l.shapeData=c),l.ownerId=n.uuid}else if(s.type==="VectorGeometry"){let c=ji.createFromState(s.shape,s.width,s.height);l.shape=c,l.ownerId=n.uuid}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),l.geometry=new a3().parse(s),l.geometry.groups.length===0){let c=l.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else{if(s.type==="SubdivGeometry"){let c=new Vi(s,i);return c.data=t,c}if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=u6(s.type);if(c)return c.create(s,e);jn("text",`a ${s.type}`);let h=ji.createFromState(xp.defaultData(),100,100);return Z1({...s,shape:h,type:"VectorGeometry"})}if(s.type==="UIGeometry")return kx.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}})}try{o=Z1(l)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${l}`);let h=ji.createFromState(xp.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=Z1(l)}return o}var B8,jx=z(()=>{Xt(),J(),L8(),ke(),Nb(),Oh(),Lp(),B8=["font"]});function zT(t){switch(typeof t){case"number":return Number.isFinite(t)?JSON.stringify(t):void 0;case"boolean":return JSON.stringify(t);case"string":return jA(t)?void 0:JSON.stringify(t);case"object":{if(t===null)return"null";if(Array.isArray(t)){let r="[";for(let s=0;s<t.length;s++){let a=zT(t[s]);if(a===void 0)return;r+=(s>0?",":"")+a}return r+"]"}let e=t,i="{",n=!0;for(let r of Object.keys(e).sort()){if(e[r]===void 0)continue;let s=zT(e[r]);if(s===void 0)return;i+=`${n?"":","}${JSON.stringify(r)}:${s}`,n=!1}return i+"}"}default:return}}var U8,qL,FT,gK=z(()=>{Xt(),U8=new Set(["CubeGeometry","SphereGeometry","CylinderGeometry","ConeGeometry","TorusGeometry","TorusKnotGeometry","IcosahedronGeometry","DodecahedronGeometry","PyramidGeometry","PlaneGeometry","BackdropGeometry","HelixGeometry"])}),vK=z(()=>{jx(),gK(),qL=class{constructor(){this.objects=new Map,this.refs=new Map,this.sharedByKey=new WeakSet,this.unreachable=new Set}resolveObject(t,e,i){return this.createObject(t,e,i)}onObjectDisposed(t){}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,i){let n=this.objects.get(t);return n===void 0?(n=this.resolveObject(t,e,i),this.objects.set(t,n),this.retain(n)):(this.sharedByKey.add(n),n.isShared=!0),n}forceDelete(t){let e=this.objects.get(t);e&&(this.objects.delete(t),this.release(e))}adopt(t,e){this.replace(t,e),this.retain(e)}mutateIfUnique(t,e){let i=this.objects.get(t);if(i&&i.isShared!==!0)return this.objects.delete(t),this.replace(e,i),i}replace(t,e){let i=this.objects.get(t);this.objects.set(t,e),i!==void 0&&i!==e&&this.release(i)}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){e===this.objects.get(t)&&this.unreachable.delete(t)}endGc(){this.unreachable.forEach(t=>{let e=this.objects.get(t);this.objects.delete(t),this.release(e)}),this.unreachable.clear()}dispose(){new Set(this.objects.values()).forEach(t=>{this.disposeObject(t),this.onObjectDisposed(t)}),this.objects.clear(),this.refs.clear()}retain(t){let e=(this.refs.get(t)??0)+1;this.refs.set(t,e),e>1&&(t.isShared=!0)}release(t){let e=(this.refs.get(t)??1)-1;if(e>0)return this.refs.set(t,e),void(e===1&&!this.sharedByKey.has(t)&&(t.isShared=!1));this.refs.delete(t),this.disposeObject(t),this.onObjectDisposed(t)}},FT=class extends qL{constructor(t){super(),this.flatShading=t,this.dedupeByValue=!1,this.byValue=new Map,this.valueKeyOf=new Map}disposeObject(t){t.dispose()}createObject(t,e,i){let n=hh(t,e,this.flatShading,i);return n.computeBoundingSphere(),n}resolveObject(t,e,i){let n=this.dedupeByValue?function(s,a,o){if(!U8.has(s.type))return;let l=s;if(l.shapeBlendNode!=null||o.isTransientGeometryKey(s))return;let c=a.material;if(c===void 0||Array.isArray(c))return;let h=c;if(typeof h.getLayersOfType!="function"||h.getLayersOfType("outline").length>0||h.getLayersOfType("cavity").length>0)return;let d=s.type;for(let u of Object.keys(l).sort()){let p=l[u];if(p===void 0||u==="type")continue;let f=zT(p);if(f===void 0)return;d+=`|${u}=${f}`}return d}(t,i,e):void 0;if(n!==void 0){let s=this.byValue.get(n);if(s!==void 0)return s}let r=this.createObject(t,e,i);return n!==void 0&&(this.byValue.set(n,r),this.valueKeyOf.set(r,n)),r}mutateIfUnique(t,e){let i=super.mutateIfUnique(t,e);return i!==void 0&&this.forgetValue(i),i}onObjectDisposed(t){this.forgetValue(t)}forgetValue(t){let e=this.valueKeyOf.get(t);e!==void 0&&(this.valueKeyOf.delete(t),this.byValue.get(e)===t&&this.byValue.delete(e))}}});function kb(){return Gx}function z8(){if(Gx==="webgpu"){if(YL!==void 0)return YL;kT||(kT=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(NT===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return NT}function F8(t,e){return z8().createRootMaterial(t,e)}function XL(t,e,i){return z8().createSharedMaterial(t,e,i)}function $L(t){return t.getLayersOfType===void 0&&Object.assign(t,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),t}function N8(){return yK}var Gx,YL,NT,kT,VT,yK,jT,k8,Lh=z(()=>{Gx="webgl",kT=!1}),_K=z(()=>{k8={markNeedsUpdateRendererDirty:()=>{}}});function ZL(t){return t.data.type!=="displace"&&!!t.data.isMask}function ch(t,e){let i=0;if(!t.layers||t.layers.length===0)return!1;let n=t.layers?.find(s=>s.data.type==="light");if(n){let s=n.data,a=Number(e.getVariable(s.alphaOverride));if((typeof s.alphaOverride=="string"?a/100:s.alphaOverride)<1)return!0}let r=t.layers;for(let s=0;s<r.length;s++){let a=r[s];if(!ZL(a)){if(s>0&&ZL(r[s-1])){if(a.data.type==="light"&&!a.data.visible)return!0;continue}if(a.data.type!=="displace"&&"alpha"in a.data&&a.data.type!=="light"&&a.data.type!=="fresnel"&&a.data.type!=="cavity"&&a.data.type!=="dust"&&a.data.type!=="texture"&&a.data.type!=="matcap"&&a.data.type!=="rainbow"&&a.data.type!=="outline"&&a.data.type!=="pattern"){let o=a.data.visible?a.data.alpha:0;if(typeof o=="string"&&(o=Math.max(0,Math.min(1,Number(e.getVariable(o)??100)/100))),o===1&&a.data.type==="depth"||a.data.type==="gradient"){for(let l of a.data.colors)if(l[3]<1){o=l[3];break}}else if(o===1&&a.data.type==="noise"){let l=e.color(a.data.colorA).a,c=e.color(a.data.colorB).a,h=e.color(a.data.colorC).a,d=e.color(a.data.colorD).a,u=Math.min(l,Math.min(c,Math.min(h,d)));u<1&&(o=u)}i+=(1-i)*o}}}return i<1}var Hx=z(()=>{});function Sp(t){return typeof t=="string"||typeof t=="number"&&t!==0}var Ah,$t,fl,no,Wx,V8,KL,QL,Or,ml=z(()=>{J(),Ah=(t,e,i)=>Math.max(0,Math.min(1,Number(e.getVariable(typeof t=="number"?100*t:t,i)??100)/100))??1,$t=(t,e,i)=>typeof t=="number"?t:e.getVariable(t,i),fl=(t,e)=>(t||(t=new T),t.x=$t(t.x,e)??0,t.y=$t(t.y,e)??0,t.z=$t(t.z,e)??0,t),no=(t,e)=>(t||(t=new et),t.x=$t(t.x,e)??0,t.y=$t(t.y,e)??0,t),Wx={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},V8={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Bp=z(()=>{J(),Op(),Oi(),KL=class extends Bx(xi){},QL=t=>t.type==="Mesh",Or=class extends KL{constructor(t){super(),this.object=t,this.isClone=!0,this.matrixAutoUpdate=!1}raycast(t,e){}expand(){let t=0,e=this.object.entityChildren(t);for(;e;){let i=this.children[t];(!(i instanceof Or)||i.object!==e)&&(i=new Or(e),this._replaceChildAt(t,i),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=e.matrix,i.shearMatrix=e.shearMatrix,i.pivotMatrix=e.pivotMatrix),i.expand(),t+=1,e=this.object.entityChildren(t)}for(let i of this.object.children){if(!oh(i)||i.object.parent!==this.object)continue;let n=this.children[t];n?.source!==i&&(n=i.createCopy(),this._replaceChildAt(t,n)),n.expand(),t+=1}for(;this.children.length>t;)this.remove(this.children[t]);this.pivotMatrix=this.object.pivotMatrix}_replaceChildAt(t,e){let i=this.children[t];i&&this.remove(i),this.add(e),this.children.splice(t,0,this.children.pop())}get visible(){let t=this.parent,e=oh(t)&&t.object===this.object;return(!e||!t.instancingActive&&!t.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||e&&this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(t){}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return QL(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(t){}}});function JL(){return oP}var oP,lP,hP=z(()=>{oP=null,lP=null});function GT(t){return"variable_"+t}var F2,N2,k2,t5,V2,e5,j2,i5,Vb,cP=z(()=>{Xt(),L6(),z6(),X3(),ba(),$3(),Z3(),vK(),Lh(),U6(),_K(),Hx(),ml(),Xr(),Bp(),Ye(),J(),hP(),ke(),F2=new Et,N2=new T,k2=new qt,t5=new T,V2=new ci,e5=class extends R6{constructor(t){super(),this.shared=t}create(t){return new q3(t,this.shared)}},j2=new Set,(Vb=i5=class{constructor(t,e={},i=!0,n=!1){if(this.data=t,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=n,this.geometryCache=new FT(!0),this.geometryCache2=new FT(!1),this.imageHolderCache=new e5(this),this.thisContext={scene:k8,shared:this},this.deletedImage=new tl(mb.emptyImage,this),this.deletedVideo=new tl(gb.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,e.images)for(let[r,s]of Object.entries(e.images))this.addImage(r,s);if(e.videos)for(let[r,s]of Object.entries(e.videos))this.addVideo(r,s);if(e.audios)for(let[r,s]of Object.entries(e.audios))this.addAudio(r,s);if(e.particles)for(let[r,s]of Object.entries(e.particles))this.addParticle(r,s);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=XL(zi.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,i=!1){this.data=t,this.resetLib(t.lib);for(let{id:n,data:r}of t.variables)this.addVariableHolder(n,r),e&&this.updateVariableHolder(n,r);for(let[n,r]of Object.entries(t.userAPIs??{}))this.addUserAPI(n,r);for(let[n,r]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(n,r);if(!i){for(let[n,r]of Object.entries(t.images))this.addImage(n,r);for(let[n,r]of Object.entries(t.videos))this.addVideo(n,r)}for(let[n,r]of Object.entries(t.colors))this.addColor(n,r);for(let[n,r]of Object.entries(t.lib.materials))this.addMaterial(n,r.asset);for(let[n,r]of Object.entries(t.materials))this.addMaterial(n,r);for(let[n,r]of Object.entries(t.audios))this.addAudio(n,r);for(let[n,r]of Object.entries(t.particles))this.addParticle(n,r);for(let[n,r]of Object.entries(t.fonts))this.addFont(n,r)}addMaterial(t,e){if(e=zi.withRepairedLayers(e),this.materials[t]){let i=this.materials[t];i.reset(e,this.thisContext),i.dispose()}else{let i=XL(e,this.thisContext,t);this.materials[t]=i}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):F8(zi.withRepairedLayers(t),this.thisContext)}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new tl(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new tl(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}getEntityTexture(t,e={}){let i=t.material;if(!i)return null;for(let n of Array.isArray(i)?i:[i]){let r=n.root??n;for(let s of r?.data?.layers??[]){let a=s?.data;if(a?.type!=="texture"&&a?.type!=="matcap"||e.layer!==void 0&&s.id!==e.layer&&a.type!==e.layer)continue;let o=a.texture?.image;if(o==null)continue;let l=(typeof o=="string"?this.uiBuffer(o):void 0)??this.image(o);if(!l)continue;let c=l.getTexture(a.texture.wrapping??(a.type==="texture"?1e3:1001),a.texture.minFilter??1008,a.texture.magFilter??1006),h=l.img;return{texture:c,width:h?.width??0,height:h?.height??0,layerId:s.id,layerType:a.type}}}return null}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new tl(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):(this.colors[t]=new a0(e.r,e.g,e.b,"a"in e?e.a:1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[t];return this.colors[t].r=e.r??i.r,this.colors[t].g=e.g??i.g,this.colors[t].b=e.b??i.b,this.colors[t].a=e.a??i.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t!="string")return new _n(t.r,t.g,t.b,"a"in t?t.a:1);{let i=this.getColor(t);i?e=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new _n(0,0,0,0))}return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof Hu)return e;{let i=new Hu({src:e.data});return this.audios[t]=i,i}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof Hu&&e.dispose(),delete this.audios[t])}addFont(t,e){let i=Y3;i!==null?(this.fonts[t]=new i(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())):jn("text","a font asset")}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._requestRender=void 0,Object.values(this.audios).forEach(t=>{t instanceof Hu&&t.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let i=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let n=localStorage.getItem(GT(t));i=n!==null?JSON.parse(n):e.value}return this.variables[t]={value:i,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(GT(t),JSON.stringify(e));let i=e;for(;typeof i=="string";)i=this.variables[i].value;let n=this.entityOpContext.scene,r=!1;for(let s=this.variables[t].locations.length-1;s>=0;s--){let a=this.variables[t].locations[s];if(a[0]==="material"){let o=a[1],l=i,c={scene:n,shared:this},h=a.slice(2);n.traverseMaterial(u=>{let p=u.root??u;p.uuid===o&&p.onVariableUpdate(h,l,c)});let d=this.materials[o];d&&d.onVariableUpdate(h,l,c)}else{let o=n.find(a[0]);if(o===void 0){this.variables[t].locations.splice(s,1);continue}if(r=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let l=1;l<a.length-1;l++)o=o[a[l]];a[1]==="rotation"?o[a[a.length-1]]=i*Pt.DEG2RAD:o[a[a.length-1]]=i}if(o=n.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),Ie.is(o))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")o.onVariableUpdate();else if(a[1]==="geometry"){let l=o;o.component&&(l=o.component);let c=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(c.geometry),l.createGeometryDelayed(this.entityOpContext),l.onVariableUpdate(!0),l.invalidateDownstreamBooleanData(),l.instances.forEach(h=>{let d=h.dataPatched;h.chooseGeoemtryCache(this).forceDelete(d.geometry),h.createGeometryDelayed(this.entityOpContext),h.onVariableUpdate(!0),h.invalidateDownstreamBooleanData()})}else a[1]==="morphTargetInfluences"&&o.updateMorphInfluences(a[2],i)}}return r&&n.markShadowsDirty(),this.requestRender(),!0}isTransientGeometryKey(t){return this.transientGeometryKeys.has(t)}updateEntityGeometryParams(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||typeof r.type!="string"||r.type==="VectorGeometry"||r.type==="PathGeometry")return!1;let s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let c of Object.keys(r))a.set(s(c),c);let o={};for(let[c,h]of Object.entries(e??{})){let d=a.get(s(c));if(d===void 0||d==="type"||d==="font"||d==="shape"||d==="path"||d==="data")continue;if(d==="text"){(typeof h=="string"||typeof h=="number")&&(o[d]={textValue:String(h)});continue}let u=r[d];typeof h=="number"&&isFinite(h)&&(typeof u=="number"||typeof u=="string")&&(o[d]=h)}if(Object.keys(o).length===0)return!1;let l={...r,...o};return i.dataPatched={...n,geometry:l},this.transientGeometryKeys.has(r)&&i.chooseGeoemtryCache(this).forceDelete(n.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let i=e.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(i),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||r.type!=="NonParametricGeometry")return!1;let s=e?.vertices;if(s===void 0||typeof s.length!="number"||s.length<9||s.length%3!=0||s.length/3>i5.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,c=s instanceof Float32Array?s:Float32Array.from(s),h=c.length/3;if(e.normals!==void 0){if(e.normals.length!==c.length)return!1;a=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}if(e.uvs!==void 0){if(e.uvs.length!==2*h)return!1;o=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}if(e.indices!==void 0){let x=h>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(x.length===0||x.length%3!=0)return!1;for(let w=0;w<x.length;w++)if(x[w]>=h)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=r.data,w=x?.index;if(w?.array?.length){let S=(x?.attributes?.position?.array?.length??0)/3;if(h!==S)return function(E,A){let P=`${E}/${A}`;j2.has(P)||(j2.add(P),console.warn(`[spline] updateObject: ignoring a geometry update of ${E} vertices for a mesh that holds ${A}. Without \`indices\` the write is taken as a morph of the mesh's own vertices, which only means anything at the same count \u2014 send \`indices\` alongside \`vertices\` to replace the topology too.`))}(h,S),!1;l=w}}let d=1/0,u=1/0,p=1/0,f=-1/0,g=-1/0,m=-1/0;for(let x=0;x<c.length;x+=3){let w=c[x],S=c[x+1],E=c[x+2];w<d&&(d=w),w>f&&(f=w),S<u&&(u=S),S>g&&(g=S),E<p&&(p=E),E>m&&(m=E)}let v=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),y={position:v(c,3)};a&&(y.normal=v(a,3)),o&&(y.uv=v(o,2));let _={...r,width:f-d,height:g-u,depth:m-p,data:{attributes:y,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(r);return i.dataPatched={...n,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let i=t;i.component&&(i=i.component);let n=i.cloner;if(n===void 0)return-1;let r=n.children,s=Math.PI/180,a=!1;if(e===null)for(let o of r)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!0);else{if(!Array.isArray(e))return r.length;{let o=Math.min(e.length,r.length);for(let l=0;l<o;l++){let c=e[l],h=r[l];if(c==null){h.transformOverride!==void 0&&(h.transformOverride=void 0,a=!0);continue}let d=h.transformOverride??{position:[h.position.x,h.position.y,h.position.z],rotation:[h.rotation.x,h.rotation.y,h.rotation.z],scale:[h.scale.x,h.scale.y,h.scale.z]};c.position&&(typeof c.position.x=="number"&&(d.position[0]=c.position.x),typeof c.position.y=="number"&&(d.position[1]=c.position.y),typeof c.position.z=="number"&&(d.position[2]=c.position.z)),c.rotation&&(typeof c.rotation.x=="number"&&(d.rotation[0]=c.rotation.x*s),typeof c.rotation.y=="number"&&(d.rotation[1]=c.rotation.y*s),typeof c.rotation.z=="number"&&(d.rotation[2]=c.rotation.z*s)),c.scale&&(typeof c.scale.x=="number"&&(d.scale[0]=c.scale.x),typeof c.scale.y=="number"&&(d.scale[1]=c.scale.y),typeof c.scale.z=="number"&&(d.scale[2]=c.scale.z)),h.transformOverride=d,h.position.fromArray(d.position),h.rotation.fromArray(d.rotation),h.scale.fromArray(d.scale),h.updateMatrix(),h.hasNonUniformScale&&(h.updateMatrixWorld(),h.updateMatrixWorldRigid())}}}return a?n.update(this.entityOpContext):n.syncInstanceMatrices(),n.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let i=t.parent;if(i===null)return;let n=new Or(t);n.playModeVisible=e.visible!==!1,n.expand(),typeof e.name=="string"&&(n.name=e.name);let r=Math.PI/180;return n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.shearMatrix.copy(t.shearMatrix),e.position&&(typeof e.position.x=="number"&&(n.position.x=e.position.x),typeof e.position.y=="number"&&(n.position.y=e.position.y),typeof e.position.z=="number"&&(n.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(n.rotation.x=e.rotation.x*r),typeof e.rotation.y=="number"&&(n.rotation.y=e.rotation.y*r),typeof e.rotation.z=="number"&&(n.rotation.z=e.rotation.z*r)),e.scale&&(typeof e.scale.x=="number"&&(n.scale.x=e.scale.x),typeof e.scale.y=="number"&&(n.scale.y=e.scale.y),typeof e.scale.z=="number"&&(n.scale.z=e.scale.z)),n.updateMatrix(),i.add(n),n.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let i=t.material;if(!i)return!1;let n=[];for(let c of Array.isArray(i)?i:[i]){let h=c.root??c;h&&Array.isArray(h.layers)&&h.data&&!n.includes(h)&&n.push(h)}if(n.length===0)return!1;let r={scene:this.entityOpContext.scene,shared:this},s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=c=>{if(typeof c=="string"){let h=new _n(1,1,1,1);try{h.set(c)}catch{return null}return{r:h.r,g:h.g,b:h.b,a:void 0}}if(c&&typeof c=="object"&&"r"in c){let h=c;if([h.r,h.g,h.b].some(u=>typeof u!="number"||!isFinite(u)))return null;let d=Math.max(h.r,h.g,h.b)>1?1/255:1;return{r:h.r*d,g:h.g*d,b:h.b*d,a:typeof h.a=="number"?Math.max(0,Math.min(h.a,1)):void 0}}return null},o=(c,h,d)=>{if(!c.hasValue(h))return!1;let u=c.getValue(h);if(!u||typeof u!="object"||!u.isColor)return!1;let p=d.a??(typeof u.a=="number"?u.a:1);return u instanceof a0?c.setValue(h,new _n(d.r,d.g,d.b,p)):typeof u.setRGBA=="function"?u.setRGBA(d.r,d.g,d.b,p):u.setRGB(d.r,d.g,d.b),!0},l=!1;for(let c of n){let h=c.data.layers??[],d=u=>c.layers.find(p=>p.uuid===u);if(e.color!==void 0){let u=a(e.color),p=h.find(g=>g.data.type==="color"),f=p&&d(p.id);if(u&&f&&o(f,"color",u)&&(l=!0,u.a!==void 0)){let g=u.a<1||ch(c.data,this);c.setTransparent?c.setTransparent(g,r.scene):c.transparent=g}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(c.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),r),l=!0);for(let u of e.layers??[]){if(!u||typeof u!="object")continue;let p=typeof u.id=="string"?h.find(v=>v.id===u.id):typeof u.index=="number"?h[u.index]:typeof u.type=="string"?h.find(v=>v.data.type===u.type):void 0,f=p&&d(p.id);if(!p||!f)continue;let g=Wx[p.data.type]??[],m=Object.keys(p.data);for(let[v,y]of Object.entries(u)){if(v==="id"||v==="index"||v==="type")continue;let _=m.find(x=>x===v)??m.find(x=>s(x)===s(v))??v;if(g.includes(_))continue;let b=a(y);if(b&&o(f,_,b))l=!0;else if(typeof y=="number"&&isFinite(y))c.onVariableUpdate?.(["layer",p.id,_],y,r),l=!0;else if(Array.isArray(y)&&y.length<=3&&y.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];y.forEach((w,S)=>{c.onVariableUpdate?.(["layer",p.id,_,x[S]],w,r)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(t){this.variables[t]&&delete this.variables[t]}referencesMissingObject(t){return Array.isArray(t)&&t[0]!=="mouse"&&t[0]!=="raycast"&&this.entityOpContext.scene.find(t[0])===void 0}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let i=this.entityOpContext.scene.find(t[0]);if(i===void 0)return;if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return i.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&i?.getPhysicsLocalMatrix?.(F2))return F2.decompose(N2,k2,t5),t[1]==="position"?N2[t[2]]:(V2.setFromQuaternion(k2,i.rotation.order),V2[t[2]]*Pt.RAD2DEG);for(let n=1;n<t.length;n++)i=i[t[n]];return t[1]==="rotation"&&(i*=Pt.RAD2DEG),i}for(let i in this.variables){if(e===void 0)break;let n=this.variables[i],r=n.locations?.findIndex(s=>Vn.equal(s,e));r!==void 0&&r!==-1&&n.locations.splice(r,1)}if(typeof t=="string"){let i=t,n=t;do{if(n=i,this.variables[i]===void 0)break;let r=this.variables[i].value;e&&this.variables[n]!==void 0&&this.variables[n].locations.push(e),i=r}while(typeof i=="string");return i}return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i.asset);for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.asset);for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i.asset);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i.asset);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i.asset);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i.asset);for(let[e,i]of Object.entries(t.variables))this.addVariableHolder(e,i.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,i){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(tr.drop(t,2),e.materials[t.path[1]],{shared:this,scene:i});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,i):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let n=e.userAPIs[t.path[1]];if(n){let r=t.type===0&&t.props.debounce===void 0,s=this.getUserAPI(t.path[1]);s!==void 0&&s===this.openAIRealtime?s.update(n):s?.update(n,this,r)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let n=e.userWebhooks[t.path[1]];n&&this.getUserWebhook(t.path[1])?.update(n)}}else t.path[0]==="lib"&&this.updateLibByOp(tr.drop(t,1),i)}updateFont(t,e,i){if(e.props.url){let n=this.getFont(t),r={...this.data.fonts[t],url:e.props.url};n.update(r),n.loadingPromise.then(()=>this.requestRender()),i.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let i=lP;return i===null?(jn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(e,t,this),!1)}{let i=JL();return i===null?(jn("api-services","a user API integration"),!1):(this.userAPIs[t]=i.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let i=JL();return i===null?(jn("api-services","a user webhook"),!1):(this.userWebhooks[t]=i.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new Vb(Vs.emptyData())});function jb(t){return T6(t)||t?.isTSLNodeMaterial===!0}function n5(t){return function(e){return e?.isClassicSharedMaterial===!0}(t)||t?.isTSLSharedMaterial===!0}function j8(t){let e=t?.root;return n5(t)||e!==void 0&&n5(e)}var qr,G2,H2,W2,r5,q2,Ro,s5,a5,Qf,vi,dP=z(()=>{I6()}),cd=z(()=>{Xt(),Zn(),Lh(),dP(),Ye(),Dn(),qr=class extends sn{setMaterialOverride(t,e){this.materialOverride=$L(t),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),e.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(t,e,i){if(super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.syncShadowCatcher(i),function(n,r){let s=[];if(r.length!==n.length)return null;{let a=0;for(;a<n.length;){if(r[a]==="*")s.push(n[a]);else if(n[a]!==r[a])return null;a+=1}}return s}(t.path,["materials"])!==null&&t.type===0&&Array.isArray(this.material))for(let[n,r]of Object.entries(t.props)){let s=this.material[Number(n)],a=i.shared.material(r);a!==s&&qr.disposeOneMaterial(s),this.material[Number(n)]=a}else if(ri(t.path,["material"])){let n=this.material;!Array.isArray(n)&&typeof n?.updateByOp=="function"&&"material"in e&&typeof e.material!="string"&&n.updateByOp(tr.drop(t,1),e.material,i)}else if(ri(t.path,["materials","*"])&&Array.isArray(this.material)){let n=t.path[1];if("materials"in e&&n<this.material.length){let r=e.materials[n];typeof r!="string"&&this.material[n].updateByOp(tr.drop(t,2),r,i)}}}get needsAO(){return this.material!==void 0&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(t,e){super.updateState(t,e),t.castShadow!==void 0&&(this.castShadow=t.castShadow),t.receiveShadow!==void 0&&(this.receiveShadow=t.receiveShadow);let i,n=this.dataPatched;this.syncShapeBlendNodeLayer(),this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(i={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let r=this.materialOverride!==void 0;!r&&t.geometry?.type!=="NonParametricGeometry"&&"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe,i),e.scene.markNeedsUpdateRendererDirty()),!r&&(t.geometry?.type==="NonParametricGeometry"||"materials"in t)&&("materials"in t&&t.materials!==void 0?(this.disposeMaterial(),this.material=t.materials.map(a=>e.shared.material(a).getFlavor(n.flatShading,n.side,n.wireframe)),e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=[e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe)],e.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(!r&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(s.materials[0]).getFlavor(n.flatShading,n.side,n.wireframe)),!r&&(t.flatShading!==void 0||t.wireframe!==void 0||t.side!==void 0))if(Array.isArray(this.material))for(let a=0;a<this.material.length;a++)this.material[a]=this.material[a].getFlavor(n.flatShading,n.side,n.wireframe);else this.material=this.material.getFlavor(n.flatShading,n.side,n.wireframe,i);this.syncShadowCatcher(e)}shadowCatcherActive(){let t=this.dataPatched,e=t.geometry?.type;return t.shadowCatcher===!0&&(e==="RectangleGeometry"||e==="PlaneGeometry")}syncShadowCatcher(t){let e=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=VT===void 0?null:$L(VT());if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=e.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,t.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.material=t.shared.material(e.material).getFlavor(e.flatShading,e.side,e.wireframe),t.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow)}static disposeOneMaterial(t){jb(t)&&!j8(t)&&t.nodeMaterialDispose()}disposeMaterial(){this.material&&BN(this.material).forEach(t=>{qr.disposeOneMaterial(t)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),$r=z(()=>{Xt(),Ye(),cP(),cd(),J(),jx(),Ip(),Lp(),O8(),G2=new T,H2=new ye,W2=new ye,r5=new T,q2=new Et,Ro=new gi,s5=Ro.geometry,a5=Ro.material,Qf=new T,vi=class extends qr{constructor(t,e,i){super(t,e),this.data=e,this.isSkinnedMesh=!1,this.localGeometry=void 0,e.bindMode&&e.bindMatrix&&(this.bindMode=e.bindMode,this.bindMatrix=new Et().fromArray(e.bindMatrix),this.bindMatrixInverse=new Et)}chooseGeoemtryCache(t){return t.geometryCache}supportsInPlaceGeometryUpdate(t){return t.isTextGeometry!==!0}markGeometryAsReachable(t){this.geometryCreateDeleyed instanceof jt&&this.chooseGeoemtryCache(t).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof jt?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Vb){let t=this.geometryCreateDeleyed,e=this.chooseGeoemtryCache(t),i=this.dataPatched.geometry;this.geometryCreateDeleyed=e.get(i,t,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(t){this.localGeometry=t}get is2DAndNoDepth(){let t=this.dataPatched.geometry;return bb.is2DParametricMesh(t.type)&&t.depth===0}get is2DType(){return bb.is2DParametricMesh(this.geometry.userData.type)}get isTextType(){return this.geometry.isTextGeometry===!0}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.updateByPatchedOpGeometry(tr.drop(t,1),e.geometry,i)}removeInteractionGeometry(t){this.localGeometry?.dispose(),this.localGeometry=void 0}dispose(){var t;super.dispose(),t=this.uuid,zb.delete(t),this._posed=void 0}get appliedGeometrySize(){let t=this.localGeometry?.userData;if(t!==void 0&&t.sxPrev!==void 0)return[t.sxPrev,t.syPrev,t.szPrev]}updateGeometryInteractions(t,e){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let n,r,s,a=t;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=hh(d,e,this.data.flatShading,this)}a.scaleBaked?[n,r,s]=a.scaleBaked:{width:n,height:r,depth:s}=a;let o=this.localGeometry.userData,l=typeof n=="number"?n:1,c=typeof r=="number"?r:1,h=typeof s=="number"?s:1;o.sxPrev!==void 0&<(this.localGeometry.attributes,l/o.sxPrev,c/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=c,o.szPrev=h}else if(!this.absorbDepthInteraction(t)){let n=hh(i==="VectorGeometry"?xb.merge(this.data.geometry,t):{...this.data.geometry,...t},e,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&I2(this.localGeometry,n)?n.dispose():(this.localGeometry?.dispose(),this.localGeometry=n)}}absorbDepthInteraction(t){let e=this.localGeometry;if(e?.shiftDepthTo===void 0)return!1;let i=t;if(typeof i.depth!="number")return!1;let n=e.userData?.parameters;if(n===void 0)return!1;for(let r of Object.keys(i))if(r!=="depth"&&i[r]!==n[r])return!1;return!!e.shiftDepthTo(i.depth)&&(n.depth=i.depth,!0)}refreshAttachedClonersInteractions(t){for(let e of this.attachedSurfaceCloners)e.update(t)}refreshAttachedCloners(t){for(let e of this.attachedSurfaceCloners)t.scene.addPendingUpdateCloner(e.object)}refreshAttachedPaths(t){for(let e of this.attachedPaths)t.scene.addPendingCommand(()=>e.updateShape())}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.refreshAttachedCloners(t),this.refreshAttachedPaths(t)}updateByPatchedOpGeometry(t,e,i){let n=!1;if(t.type===0&&t.path.length===0&&Object.keys(t.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Vi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(e,t.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&I8(t.props)&&this.geometryCreateDeleyed instanceof Vi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(e),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&this.geometryCreateDeleyed instanceof jt&&!(this.geometryCreateDeleyed instanceof Vi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=i.shared,s=this.chooseGeoemtryCache(r),a=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=hh(o,r,this.data.flatShading,this);I2(a,l)?(l.dispose(),a.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,n=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}n||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(t,e){this.createGeometryDelayed(e)}applyTransientGeometryData(t,e){let i=t.shared,n=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof jt&&!(this.geometryCreateDeleyed instanceof Vi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(r.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let a=hh(n,i,this.data.flatShading,this);return I2(s,a)?(a.dispose(),s.computeBoundingSphere(),r.mutateIfUnique(this._geometryCacheKey,n)):(a.computeBoundingSphere(),r.forceDelete(this._geometryCacheKey),r.adopt(n,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=n,this.refreshAttachedCloners(t),void this.refreshAttachedPaths(t)}}e&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),t.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(t)}updateState(t,e){t.geometry!==void 0&&this.updateGeometryOnStateUpdate(t.geometry,e);let i=t.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:n,value:r}}of i)this.updateMorphInfluences(n,e.shared.getVariable(r,[this.uuid,"morphTargetInfluences",n]))}super.updateState(t,e)}updateMorphInfluences(t,e){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[t];i!==void 0&&(this.morphTargetInfluences[i]=e)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(t,e){let i=this.posedGeometry()?.boundingBox;if(i)return i.getCenter(t),void i.getSize(e).multiplyScalar(.5);let n=this.geometry.userData.parameters;this.is2DType||this.isTextType?t.set(0,0,.5*n.depth):this.isNonParametric?(t.setScalar(0),this.geometry.boundingSphere&&t.copy(this.geometry.boundingSphere.center),e.set(n.width,n.height,n.depth??0).multiplyScalar(.5)):n.centerOffset?t.fromArray(n.centerOffset):t.setScalar(0),e.set(n.width,n.height,n.depth??0).multiplyScalar(.5)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(t,e){this.skeleton=t,this.isSkinnedMesh=!0,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}rebindSkeleton(t){let e=this.dataPatched,i=e.bones?.map(t),n=this.isSkinnedMesh;if(!i?.length||i.some(r=>!r)||e.boneInverses?.length!==i.length?this.isSkinnedMesh=!1:(this.bindMatrix||(this.bindMatrix=new Et,this.bindMatrixInverse=new Et),this.bindMode=e.bindMode??"attached",e.bindMatrix&&this.bindMatrix.fromArray(e.bindMatrix),this.bind(new qg(i,e.boneInverses.map(r=>new Et().fromArray(r))),this.bindMatrix)),n!==this.isSkinnedMesh)for(let r of Array.isArray(this.material)?this.material:[this.material])r.needsUpdate=!0}normalizeSkinWeights(t){let e=new ye,i=this.geometry.attributes.skinWeight;for(let n=0,r=i.count;n<r;n++){e.fromBufferAttribute(i,n);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),i.setXYZW(n,e.x,e.y,e.z,e.w)}}boneTransform(t,e){let i=this.skeleton;if(i===void 0)return;let n=this.geometry;H2.fromBufferAttribute(n.attributes.skinIndex,t),W2.fromBufferAttribute(n.attributes.skinWeight,t),G2.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){let s=W2.getComponent(r);if(s!==0){let a=H2.getComponent(r);q2.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),e.addScaledVector(r5.copy(G2).applyMatrix4(q2),s)}}return e.applyMatrix4(this.bindMatrixInverse)}raycastDeformed(t,e){let i=this.posedGeometry();if(i===void 0)return!1;Ro.geometry=i,Ro.material=this.material,Ro.matrixWorld.copy(this.matrixWorld);let n=e.length;Ro.raycast(t,e);for(let r=n;r<e.length;r++)e[r].object=this;return Ro.geometry=s5,Ro.material=a5,!0}posedGeometry(){let t=this.skeleton;if(!this.isSkinnedMesh||t===void 0)return;let e=this.geometry,{position:i,skinIndex:n,skinWeight:r}=e.attributes;if(!i||!n||!r)return;let s=[...this.bindMatrix.elements,...this.bindMatrixInverse.elements,...this.morphTargetInfluences??[]];for(let d=0;d<t.bones.length;d++){let u=t.bones[d];if(!u||!t.boneInverses[d])return;s.push(...u.matrixWorld.elements)}let a=this._posed;if(a?.source===e&&a.version===i.version&&a.pose.length===s.length&&a.pose.every((d,u)=>d===s[u]))return a.geometry;let o=i.count,l=a?.geometry.attributes.position,c=l?.count===o?l:new Ht(new Float32Array(3*o),3);for(let d=0;d<o;d++)this.boneTransform(d,this.getVertexPosition(d,Qf)),c.setXYZ(d,Qf.x,Qf.y,Qf.z);let h=new jt;h.setAttribute("position",c);for(let d of["normal","uv","uv1"]){let u=e.attributes[d];u&&h.setAttribute(d,u)}return h.setIndex(e.index),h.groups=e.groups,h.drawRange=e.drawRange,h.computeBoundingSphere(),h.computeBoundingBox(),this._posed={source:e,version:i.version,pose:s,geometry:h},h}}});function ap(t){if(Array.isArray(t.material)){for(let e of t.material)if(e.getLayersOfType("outline").length===0)return}else if(!T6(t.material)||t.material.getLayersOfType("outline").length===0)return;t instanceof vi&&t.is2DAndNoDepth?function(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let i=e.geometry.attributes.position.array,n=new Float32Array(i.length),r=new T;for(let s=0;s<i.length;s+=3)r.set(i[s],i[s+1],i[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;e.geometry.setAttribute("extrudeNormal",new kt(n,3))}(t):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let i=new Map,n=e.geometry.attributes,r=n.position.array,s=n.normal.array,a=new Float32Array(r.length);for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=new T(s[o],s[o+1],s[o+2]);i.has(l)?i.get(l)?.normals.push(c):i.set(l,{normals:[c],result:new T})}i.forEach((o,l)=>{for(let c of o.normals)o.result.add(c);o.result.divideScalar(o.normals.length)});for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=i.get(l)?.result;c&&(a[o]=c.x,a[o+1]=c.y,a[o+2]=c.z)}e.geometry.setAttribute("extrudeNormal",new kt(a,3))}(t)}function X2(t){return Math.min(2047,Math.max(1,Math.round(2048*t)))/2048}function op(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes,i=e.position.array,n=e.randomColor;if(n!==void 0&&3*n.count===i.length)return;let r=new Float32Array(i.length),s=parseInt(t.uuid.replace(/\D/g,"")),a=[X2(Pt.seededRandom(s)),X2(Pt.seededRandom(s+1e4)),X2(Pt.seededRandom(s+2e4))];for(let o=0;o<i.length;o++)r[o]=a[o%3];t.geometry.setAttribute("randomColor",new Ht(r,3))}var qx=z(()=>{J(),I6(),$r()});function o5(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}function bK(t,e){let i=t.cloner;return i!==void 0&&i.parent===e?i:void 0}function l5(t,e,i,n){let r=16*(e.children.length+1);tg.length<r&&(tg=new Float32Array(r));let s=0,a=l=>{l.toArray(tg,16*s),s++},o=e.parameters.hideBase!==!0;o&&a(n),HT.copy(t.matrix);for(let l of e.children)!lh(l)||l.playModeVisible===!1||(WT.copy(l.matrix).multiply(l.pivotMatrix),K1.multiplyMatrices(HT,WT),(!o||!K1.equals(n))&&a(K1));try{return s===0?0:function(l,c){return H3(Ob().instanced_union(G3(l),c))}(i,tg.subarray(0,16*s))}finally{M6(i)}}var Oo,h5,HT,WT,K1,tg,xh,S0=z(()=>{Zn(),J(),Fx(),qx(),cd(),Oi(),Oo=new Et,h5=new Et,HT=new Et,WT=new Et,K1=new Et,tg=new Float32Array(0),xh=class extends qr{constructor(t,e,i){super(t,e),this.data=e,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new jt,this.onAfterRender=(n,r,s,a,o,l)=>{super.onAfterRender(n,r,s,a,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&t.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(t,e=!0){if(this.booleanMeshSetAddress!==-1&&!t)return;for(let n=0;n<this.children.length;n++){let r=this.children[n];r instanceof xh&&r.dataPatched.visible===!0&&r.recomputeBoolean(t===!0,e)}this.meshSetAddresses=[];for(let n=0;n<this.children.length;n++){let r=this.children[n];if(r instanceof sn&&r.dataPatched.visible===!0&&r.geometry.attributes.position?.count>0&&r.geometry.drawRange.count>0&&r.booleanMeshSetAddress!==0){Oo.copy(r.matrix).multiply(r.pivotMatrix);try{let s=bK(r,this);if(r.booleanMeshSetAddress===-1){if((r.geometry.index??r.geometry.getAttribute("position")).count/3<15e5){let a=VZ(r.geometry,t===!0);r.booleanMeshSetAddress=s===void 0||a===-1?a:l5(r,s,a,Oo)}if(r.booleanMeshSetAddress===-1)return;s===void 0&&M2(r.booleanMeshSetAddress,Oo),r.booleanMatrixInvOld.copy(Oo).invert(),r.booleanWasTransformed=!1}else r instanceof xh&&r.needsTransformForDownstream===!0?(s===void 0?M2(r.booleanMeshSetAddress,Oo):r.booleanMeshSetAddress=l5(r,s,r.booleanMeshSetAddress,Oo),r.needsTransformForDownstream=!1):r.booleanWasTransformed===!0&&(M2(r.booleanMeshSetAddress,h5.multiplyMatrices(Oo,r.booleanMatrixInvOld)),r.booleanMatrixInvOld.copy(Oo).invert(),r.booleanWasTransformed=!1)}catch(s){console.error(s),r.booleanMeshSetAddress=0,r.geometry.userData.booleanOperationDidFail=!0;continue}if(r.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(r.booleanMeshSetAddress),r.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let n=this.geometry;n.dispose(),this.geometry=new jt,this.geometry.userData=n.userData,this.geometry.boundingSphere=n.boundingSphere,this.geometry.setAttribute("position",new kt([],3))}return void this.geometry.setDrawRange(0,0)}if(t===!0)return function(n,r){let s=Ob(),a=K4(n,r),o=s.mesh_topological_data(a),l=o.positions(),c=o.indices();return o.free(),a.free(),{positions:l,indices:c,verticesPerFace:new Uint8Array(c.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new jt,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(n,r,s,a){let o=Ob(),l=K4(n,r),c=o.mesh_render_data(l,Math.max(a,0));if(s.setAttribute("position",new kt(c.positions(),3)),s.setAttribute("normal",new kt(c.normals(),3)),c.free(),s.boundingSphere===null&&(s.boundingSphere=new vr),l.tri_count()===0)s.boundingSphere.center.set(0,0,0),s.boundingSphere.radius=0,s.userData.parameters={width:0,height:0,depth:0};else{let h=l.bounds();s.boundingSphere.center.set(h[0],h[1],h[2]),s.boundingSphere.radius=(h[3]**2+h[4]**2+h[5]**2)**.5,s.userData.parameters={width:2*h[3],height:2*h[4],depth:2*h[5]}}return H3(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(n){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(n)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,ap(this),op(this)}dispose(){super.dispose(),this.geometry.dispose()}}});function xK(t){return t.isPointLight?Q1.PointLight:t.isSpotLight?Q1.SpotLight:Q1.DirectionalLight}function c5(t){return t.isDirectionalLight?0:t.isSpotLight?1:2}var Q1,Dg,Dc,Gb,Xx,ma,ro,Hb,G8=z(()=>{Q1={PointLight:1,SpotLight:3,DirectionalLight:3},Dg=new WeakSet,Dc=[]}),M0=z(()=>{J(),G8(),Xr(),hd(),(Gb||(Gb={})).is=function(t){return Ie.is(t)&&t instanceof Pu},Xx=(t,e)=>class extends ld(t,e){updateState_Light(i,n){if(this.updateState_Entity(i,n),i.color!==void 0&&(this.color=n.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let r=this.shadow;r.camera.far=i.depth,r.needsUpdate=!0}i.shadows!==void 0&&(function(r){Dg.delete(r)}(this),this.castShadow=i.shadows)}}}),Bh=z(()=>{S0(),Zn(),hd(),ma=t=>t instanceof sn,ro=t=>t!==null&&t instanceof xh,Hb=t=>gT.is(t)});function fr(t,e){return e.color(t)}function d5(t=new Date,e){let i=e.format,n=t.getSeconds(),r=t;e&&e.timeZone!==null&&(r=function(d,u){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:u,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),f=g=>Number(p.find(m=>m.type===g)?.value);return new Date(f("year"),f("month")-1,f("day"),f("hour"),f("minute"),f("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,e.timeZone));let s,a=r.getHours(),o=r.getMinutes();e.format12h24h==="12ampm"&&(s=a>=12?"PM":"AM");let l,c,h=a;switch(e.format12h24h!=="24"&&(h=a%12,h===0&&(h=12)),i){case"HH:mm:ss":l=[h,o,n];break;case"HH:mm":l=[h,o];break;case"HH":l=[h],s=void 0;break;case"mm":l=[o],s=void 0;break;case"ss":l=[n],s=void 0;break;case"year":c=r.getFullYear();break;case"month":c=r.getMonth()+1;break;case"dayOfYear":c=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":c=r.getDate();break;case"secondOfDay":c=60*a*60+60*o+n;break;default:console.error("Unknown time format",i),c=0}return l!==void 0?{textValue:l,suffix:s}:c}var qT,E0,uP=z(()=>{}),wK=z(()=>{J(),_0(),b0(),qT=class extends Pp(iN){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){Dp(this.object,qT.geometryHelper,t,e)}}}),pP=z(()=>{J(),wK(),M0(),E0=class extends Xx(QF,qT){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=-1e4,n.far=2500;let r=new $g(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof $g&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&function(n,r){n.shadow.camera.right=r/2,n.shadow.camera.left=-r/2,n.shadow.camera.top=r/2,n.shadow.camera.bottom=-r/2,n.shadow.needsUpdate=!0}(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),i&&this.update()}}});function fP(t){return t instanceof qr&&t.needsAO&&!pl(t)&&t.isDecalObject!==!0}function mP(t){let e=t.cloner;if(e&&Array.isArray(e.children))for(let i of e.children)i?.layers&&(i.layers.mask=t.layers.mask)}function gP(t){return t.getLayersOfType("reflection").filter(e=>e.data.visible).length}function u5(t,e){let i={outline:!1,cavity:!1},n=t.layers.mask&$x,r=e.getLayersOfType("transmission"),s=e.getLayersOfType("outline"),a=gP(e),o=e.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(t.layers.set(8),r.length>0&&t.layers.enable(3),a>0&&t.layers.enable(4),i.outline=s.length>0,i.cavity=o.length>0,op(t),ap(t)),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),n&&t.layers.set(9),!n&&fP(t)&&t.layers.enable(5),mP(t),i}function p5(t,e){if(!e.layers)return!1;let i=t.layers.mask&$x,n=!1,r=e.getLayersOfType("transmission").filter(l=>l.data.visible),s=e.getLayersOfType("outline").filter(l=>l.data.visible),a=gP(e),o=e.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(t.layers.set(3),(s.length>0||o.length>0)&&t.layers.enable(8),a>0&&t.layers.enable(4),n=!0),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),i&&t.layers.set(9),!i&&fP(t)&&t.layers.enable(5),mP(t),n}function f5(t,e){var i;if(!e.layers)return!1;let n=t.layers.mask&$x,r=!1,s=gP(e),a=e.getLayersOfType("transmission").filter(c=>c.data.visible),o=e.getLayersOfType("outline").filter(c=>c.data.visible),l=e.getLayersOfType("cavity").filter(c=>c.data.visible);return s>0&&((i=t.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),t.layers.set(4),a.length>0&&t.layers.enable(3),(o.length>0||l.length>0)&&t.layers.enable(8),r=!0),s===0&&a.length===0&&o.length===0&&l.length===0&&t.layers.set(0),n&&t.layers.set(9),!n&&fP(t)&&t.layers.enable(5),mP(t),r}function XT(t,e,i,n=!1){let r=t.cloner;if(r){let s=null;if((t.raycast===gi.prototype.raycast||t.raycast===sn.prototype.raycast)&&t.isSkinnedMesh!==!0){let a=t.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of r.children){if(s!==null&&($T.copy(s).applyMatrix4(a.matrixWorld),!e.ray.intersectsSphere($T)))continue;let o=W8.copy(a.matrixWorld).invert(),l=q8.copy(e.ray).applyMatrix4(o),c=t.matrixWorld;l.applyMatrix4(c);let h=H8;h.set(l.origin,l.direction),h.near=e.near,h.far=e.far,h.layers.mask=e.layers.mask;let d=h.intersectObject(t,!1);d.length>0&&i.push({...d[0],object:n?a:t})}}}var $x,H8,W8,q8,$T,sy,X8,$2,Y2,Z2,A0,Si,$8=z(()=>{Oi(),qx(),Zn(),cd(),J(),$x=512,H8=new xx,W8=new Et,q8=new il,$T=new vr}),SK=z(()=>{J(),_0(),b0(),sy=class extends Pp(tN){constructor(t,e=6710886){super(t,e),this.object=t,this.matrix=t.matrixWorld,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){Dp(this.object,sy.geometryHelper,t,e)}update(){if(this.object!==void 0){let t=sy._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let r=0,s=this.cone.material.length;r<s;r++)this.cone.material[r].color.set(n);else this.cone.material.color.set(n)}}},(X8=sy)._vector=new T}),vP=z(()=>{J(),SK(),M0(),$2=new T,Y2=new T,Z2=new qt,A0=class extends Xx(ZF,X8){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=2*Pt.RAD2DEG*this.angle,n.aspect=1,n.near=100,n.far=2500;let r=new $g(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof $g&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),Y2.setFromMatrixPosition(this.matrixWorld),Z2.setFromRotationMatrix(this.matrixWorld),$2.copy(this.up).applyQuaternion(Z2).negate().multiplyScalar(this.distance),this.target.position.copy(Y2).add($2),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),$s=z(()=>{Xt(),Xs(),J(),Xr(),ba(),uP(),po(),pP(),Ye(),Lh(),J(),cd(),Bh(),$8(),vP(),ke(),S0(),Si=class extends Ux(as){constructor(t,e,i){if(super(),this.data=e,this.bgColor=new _n(1,1,1,1),this.fog=null,this.backupFog=new ZE(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=er.getDensity({}),this.fogHeightFalloff=er.getHeightFalloff({}),this.fogHeightBase=er.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new Jt,this.penumbraSizeArrayCache=null,this.super_Entity(t,e),this.personalCamera=new Ki(od,{...Sg.defaultData,...e.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new YF(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),e.uiScene){let n=cT();n===null?jn("ui-2d","a page's 2D scene"):this.uiScene=new n.Scene2D((Array.isArray(t)?t[0]:t)+"-ui",e.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else e.uiFrame&&this.createUICanvas(e.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(t,e){let i=cT();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,e),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(t),this.uiCanvas?.applySize()})):jn("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(t,e){t.color!==void 0&&(this.ambientLight.color=fr(t.color,e)),t.intensity!==void 0&&(this.ambientLight.intensity=t.intensity*Math.PI),t.enabled!==void 0&&(t.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(t){this.isActive=!0,t.fog=this.fog,this.traverseEntity(e=>{e instanceof xh&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(t=>{if(t instanceof qr)if(Array.isArray(t.material))for(let e of t.material)e.needsUpdate=!0;else t.material.needsUpdate=!0,t.material.dispose()})}updateShadow(t){if(t.softShadowQuality===void 0&&t.type===void 0||!this.isActive)return;let e=this.data.shadow;var i,n;i=wg.isSoft(e),n=e?.softShadowQuality,jT!==void 0&&jT(i,n)&&this.forceMaterialsUpdate()}updateFog(t,e){t.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=fr(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far,this.fogMode=er.getMode(t),this.fogDensity=er.getDensity(t),this.fogHeightFalloff=er.getHeightFalloff(t),this.fogHeightBase=er.getHeightBase(t)}updateSky(t,e){this.skyState=t??null,this.skyStateVersion++;let i=t?.hdri?.image;this.skyHdriHolder=i!=null?e.image(i):null}updateAo(t,e){t.aoColor!==void 0&&(this.aoColor=fr(t.aoColor,e))}updateByOp(t,e,i,n){let r=this.data.uiFrame;super.updateByOp(t,e,i,n);let s=e;ri(t.path,["fog"])?this.updateFog(s.fog,i.shared):ri(t.path,["sky"])?this.updateSky(s.sky,i.shared):ri(t.path,["grading"])?this.gradingState=s.grading??null:ri(t.path,["ao"])?this.updateAo(s.ao,i.shared):ri(t.path,["ambient"])?this.updateAmbientLight(s.ambient,i.shared):ri(t.path,["shadow"])?this.updateShadow(s.shadow):t.type===0&&t.path.length===0&&(t.props.uiFrame!==void 0||r!==s.uiFrame)&&this.updateUIFrame(t.props.uiFrame,i)}updateUIFrame(t,e){t?(this.uiCanvas||this.createUICanvas(t,e),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(t)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(t,e){this.updateState_Entity(t,e),t.backgroundColor!==void 0&&this.setBackgroundColor(fr(t.backgroundColor,e.shared)),t.fog!==void 0&&this.updateFog(t.fog,e.shared),t.sky!==void 0&&this.updateSky(t.sky,e.shared),t.grading!==void 0&&(this.gradingState=t.grading),t.ambient!==void 0&&this.updateAmbientLight(t.ambient,e.shared),t.ao!==void 0&&this.updateAo(t.ao,e.shared),t.shadow!==void 0&&this.updateShadow(t.shadow)}createFrame(t,e){}raycast(t,e){super.raycast(t,e)}switchActiveCamera(t){t instanceof Ki&&t.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1)}get playCamera(){let t=this.scene?.find(this.data.publish.playCamera);return t instanceof Ki?t:this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(ul).fill(.5);let t=0,e=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof E0&&i.visible&&t<Eg&&(this.penumbraSizeArrayCache[t]=i.data.penumbraSize??.5,t+=1),i instanceof A0&&i.visible&&t<ul-Eg&&(this.penumbraSizeArrayCache[Eg+e]=i.data.penumbraSize??.5,e+=1)})}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let s=r.cloner;Ie.is(r)&&(r.visible||s?.object.data.visible)&&((ma(r)||Hb(r)&&this.scene.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),XT(r,t,e,!0)),i(r))}};return i(this),e}updateEntity2DByOp(t,e,i,n){this.uiCanvas?.updateEntity2DByOp(t,e,i,n)}}});function m5(){return Y8}function K2(){if(Wb===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return Wb}function Q2(t){return t?.isWebGPUSplineRenderer===!0}var Y8,Wb,lp,Z8=z(()=>{Y8=null,Wb=null}),yP=z(()=>{J(),Ox(),hd(),lp=class extends ld(Tp,wp){constructor(t,e,i){super(),this.super_Entity(t,e),this.context=i,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}}}),MK=Ep((t,e)=>{var i,n;i=t,n=function(){return r.importState=function(s){var a=new r;return a.importState(s),a},r;function r(){return function(s){var a=0,o=0,l=0,c=1;s.length==0&&(s=[+new Date]);var h=function(){var p=4022871197,f=function(g){g=g.toString();for(var m=0;m<g.length;m++){var v=.02519603282416938*(p+=g.charCodeAt(m));v-=p=v>>>0,p=(v*=p)>>>0,p+=4294967296*(v-=p)}return 23283064365386963e-26*(p>>>0)};return f.version="Mash 0.9",f}();a=h(" "),o=h(" "),l=h(" ");for(var d=0;d<s.length;d++)(a-=h(s[d]))<0&&(a+=1),(o-=h(s[d]))<0&&(o+=1),(l-=h(s[d]))<0&&(l+=1);h=null;var u=function(){var p=2091639*a+23283064365386963e-26*c;return a=o,o=l,l=p-(c=0|p)};return u.next=u,u.uint32=function(){return 4294967296*u()},u.fract53=function(){return u()+11102230246251565e-32*(2097152*u()|0)},u.version="Alea 0.9",u.args=s,u.exportState=function(){return[a,o,l,c]},u.importState=function(p){a=+p[0]||0,o=+p[1]||0,l=+p[2]||0,c=+p[3]||0},u}(Array.prototype.slice.call(arguments))}},typeof t=="object"?e.exports=n():typeof define=="function"&&define.amd?define(n):i.Alea=n()});function EK(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(e=!0)}),e}var na,Zd,Mp,T0=z(()=>{Zn(),J(),Lp(),qx(),$r(),na=new hi,Zd=new T,Mp=class extends vi{constructor(t,e,i){super(t,e,i),this.data=e,this.smoothShading=!0,this.skipReactionUpdate=!1,this.shearCompensationIsActive=!1}chooseGeoemtryCache(t){return this.dataPatched.flatShading?t.geometryCache:t.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;t.copy(this.originalGeometryNew.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:n,subdivPointer:r}=Vi.build(t,this.subdivPointer,this.smoothShading,this.shearScale);this.subdivPointer=r,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),n!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=n??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ap(this),op(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}updateState(t,e){if(super.updateState(t,e),t.flatShading!==void 0){let i=this.material;this.material=Array.isArray(i)?i.map(n=>n.getFlavor(!1,n.side,n.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!t.flatShading,this.createGeometryDelayed(e)}}updateMesh(t=!1,e=!1,i=!1){e&&this.subdividedGeometry||Vi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t?this.shearScaleInv:void 0,i),this.subdividedGeometry&&Vi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t?this.shearScaleInv:void 0)}updateTopology(){let t=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Vi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Vi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ap(this),op(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}raycast(t,e){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,sn.prototype.raycast.call(this,t,e),this.localGeometry=i}activateShearCompensation(){this.shearCompensationIsActive=!0,this.matrixWorld.copy(this.matrixWorldRigid)}deactivateShearCompensation(){this.shearCompensationIsActive=!1,this.updateMatrixWorld(!0)}updateMatrixWorld(t){this.shearCompensationIsActive!==!0&&super.updateMatrixWorld(t)}updateWorldMatrix(t,e){this.shearCompensationIsActive!==!0&&super.updateWorldMatrix(t,e)}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;na.setFromBufferAttribute(e),na.getCenter(i),t.boundingSphere.radius=i.distanceTo(na.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),na.getSize(Zd),Zd.divide(this.scale);let n={width:Zd.x,height:Zd.y,depth:Zd.z};return this.geometry.userData.parameters=n,n}updateBoundingSphere(t){let e=this.originalGeometry;na.min.set(t[0],t[2],t[4]),na.max.set(t[1],t[3],t[5]),na.min.applyMatrix4(this.shearScaleInv),na.max.applyMatrix4(this.shearScaleInv),e.boundingSphere===null&&(e.boundingSphere=new vr);let i=e.boundingSphere.center;na.getCenter(i),e.boundingSphere.radius=i.distanceTo(na.max)}freeSubdivPointer(){this.subdivPointer&&(Vi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry,i=e?.uuid,n=e?.userData.parameters,r=t.subdivisions>0?Vi.buildRefined(this.subdivPointer,t.subdivisions,this.smoothShading?t.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ap(this),op(this),n!==void 0&&(this.localGeometry.userData.parameters=n),i&&(this.localGeometry.uuid=i)}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),this.localGeometry&&(t.type===0&&t.path.length===0&&I8(t.props)&&this.subdivPointer?this.updateSubdivisionLevel(e):this.createGeometryByControls(e))}}});function _P(t){if(t.component){let e=t.component.instances.indexOf(t);e>=0&&t.component.instances.splice(e,1);for(let i of t.children)Ie.is(i)&&_P(i)}}var Rg,YT,Yx,K8=z(()=>{Xr()}),AK=Ep((t,e)=>{function i(n,r,s,a){this.message=n,this.expected=r,this.found=s,this.location=a,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i)}(function(n,r){function s(){this.constructor=n}s.prototype=r.prototype,n.prototype=new s})(i,Error),i.buildMessage=function(n,r){var s,a={literal:function(d){return'"'+l(d.text)+'"'},class:function(d){var u,p="";for(u=0;u<d.parts.length;u++)p+=d.parts[u]instanceof Array?c(d.parts[u][0])+"-"+c(d.parts[u][1]):c(d.parts[u]);return"["+(d.inverted?"^":"")+p+"]"},any:function(d){return"any character"},end:function(d){return"end of input"},other:function(d){return d.description}};function o(d){return d.charCodeAt(0).toString(16).toUpperCase()}function l(d){return d.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function c(d){return d.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function h(d){return a[d.type](d)}return"Expected "+function(d){var u,p,f=new Array(d.length);for(u=0;u<d.length;u++)f[u]=h(d[u]);if(f.sort(),f.length>0){for(u=1,p=1;u<f.length;u++)f[u-1]!==f[u]&&(f[p]=f[u],p++);f.length=p}switch(f.length){case 1:return f[0];case 2:return f[0]+" or "+f[1];default:return f.slice(0,-1).join(", ")+", or "+f[f.length-1]}}(n)+" but "+((s=r)?'"'+l(s)+'"':"end of input")+" found."},e.exports={SyntaxError:i,parse:function(n,r){r=r!==void 0?r:{};var s,a={},o={svg_path:Pe},l=Pe,c=function(Q){if(!Q)return[];for(var At=[],lt=0;lt<Q.length;lt++)At=At.concat.apply(At,Q[lt]);var xt=At[0];return xt&&xt.code=="m"&&(delete xt.relative,xt.code="M"),At},h=function(Q,At){return function(lt,xt){if(!xt)return[lt];for(var Ot=[lt],I=0,nt=xt.length;I<nt;I++)Ot[I+1]=xt[I][1];return Ot}(Q,At)},d=/^[Mm]/,u=be(["M","m"],!1,!1),p=function(Q,At,lt){var xt=vo(Q,[At]);return lt&&(xt=xt.concat(vo(Q=="M"?"L":"l",lt[1]))),xt},f=/^[Zz]/,g=be(["Z","z"],!1,!1),m=function(){return vo("Z")},v=/^[Ll]/,y=be(["L","l"],!1,!1),_=function(Q,At){return vo(Q,At)},b=/^[Hh]/,x=be(["H","h"],!1,!1),w=function(Q,At){return vo(Q,At.map(function(lt){return{x:lt}}))},S=/^[Vv]/,E=be(["V","v"],!1,!1),A=function(Q,At){return vo(Q,At.map(function(lt){return{y:lt}}))},P=/^[Cc]/,C=be(["C","c"],!1,!1),R=function(Q,At,lt){return{x1:Q.x,y1:Q.y,x2:At.x,y2:At.y,x:lt.x,y:lt.y}},O=/^[Ss]/,D=be(["S","s"],!1,!1),F=function(Q,At){return{x2:Q.x,y2:Q.y,x:At.x,y:At.y}},V=/^[Qq]/,U=be(["Q","q"],!1,!1),j=function(Q,At){return{x1:Q.x,y1:Q.y,x:At.x,y:At.y}},q=/^[Tt]/,rt=be(["T","t"],!1,!1),it=/^[Aa]/,Y=be(["A","a"],!1,!1),ht=function(Q,At,lt,xt,Ot,I){return{rx:Q,ry:At,xAxisRotation:lt,largeArc:xt,sweep:Ot,x:I.x,y:I.y}},ot=function(Q,At){return{x:Q,y:At}},ft=function(Q){return 1*Q},pt=function(Q){return 1*Q.join("")},tt=/^[01]/,mt=be(["0","1"],!1,!1),N=function(Q){return Q=="1"},L=function(){return""},H=",",$=_e(",",!1),B=function(Q){return Q.join("")},Z=".",K=_e(".",!1),k=/^[eE]/,st=be(["e","E"],!1,!1),dt=/^[+\-]/,bt=be(["+","-"],!1,!1),ct=/^[0-9]/,It=be([["0","9"]],!1,!1),St=function(Q){return Q.join("")},Rt=/^[ \t\n\r]/,Mt=be([" "," ",`
|
|
4212
|
+
`&&C.push("")):S.getTextWidth(C[C.length-1]+R,w)>P&&(C[C.length-1].length&&C.push(""),S.getTextWidth(C[C.length-1]+R,w)>P&&(R.length===1?(C[C.length-1]+=R,R=""):(C[C.length-1]+=R.slice(0,-1),R=R[R.length-1],C.push(""))));return C[C.length-1]+=R,C}(t,i,c===2?u.toUpperCase():c===3?u.toLowerCase():u,e),{shapes:f,charWidths:g,charCoords:m}=i.generateShapes(p,t,e),v=.5*(typeof n=="number"?n:Number(e.getVariable(n))),y=.5*(typeof r=="number"?r:Number(e.getVariable(r))),_=f.map(w=>new ji().fromShape(w,!0));this.vectorShapes=_;let b=_.map(w=>Ih.create({shape:w,parameters:{depth:s,extrudeBevelSegments:o,extrudeBevelSize:a,uvPitch:d===1?void 0:h,extrusionVersion:d,windingRule:s<=0?Bi.NONZERO:Bi.ODD,subdivisions:this.isLowResolution&&s>0?1:12}})),x=b.length?Nc(b):GL();x.translate(-v,y,0),this.dispose(),this.wrappedText=p,this.charCoords=m,this.charWidths=g,this.deleteAttribute("extrudeNormal"),Object.entries(x.attributes).forEach(([w,S])=>{this.setAttribute(w,S)}),this.setIndex(x.index),this.adoptNearSide(b,s),this.computeBoundingSphere()}adoptNearSide(t,e){this._depth=e;let i=0,n=0,r=0;for(let o of t){let l=o,c=l._nearSide;if(c===void 0||c.length===0)return this._nearSide=new Uint8Array(0),this._effectiveBevel=0,void(this._vScale=0);i+=c.length,n=Math.max(n,l._effectiveBevel??0),r=l._vScale??r}this._effectiveBevel=n,this._vScale=r;let s=new Uint8Array(i),a=0;for(let o of t){let l=o._nearSide;s.set(l,a),a+=l.length}this._nearSide=s}takeDepthStateFrom(t){let e=t;e._nearSide!==void 0&&(this._depth=e._depth??this._depth,this._nearSide=e._nearSide,this._vScale=e._vScale??this._vScale,this._effectiveBevel=e._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(t){return this._nearSide.length===this.getAttribute("position")?.count&&Wu(this._effectiveBevel,t)&&Wu(this._effectiveBevel,this._depth)}shiftDepthTo(t){if(!this.canShiftDepthTo(t))return!1;let e=t-this._depth;if(this._depth=t,e===0)return!0;let i=this.getAttribute("position"),n=i.array,r=this.getAttribute("uv"),s=r?.array,a=this._vScale>0?e/this._vScale:0,o=this._nearSide;for(let l=0;l<o.length;l++){let c=o[l];c!==0&&(n[3*l+2]+=e,c===2&&s!==void 0&&(s[2*l+1]+=a))}return i.needsUpdate=!0,r!==void 0&&a!==0&&(r.needsUpdate=!0),this.refreshDepthBounds(t),!0}refreshDepthBounds(t){if(this.boundingBox===null&&this.boundingSphere===null)return;this.boundingBox===null&&this.computeBoundingBox();let e=this.boundingBox;e.min.z=Math.min(0,t),e.max.z=Math.max(0,t),this.boundingSphere!==null&&e.getBoundingSphere(this.boundingSphere)}clone(){let t=Ar(new jt,OT.prototype);return t.copy(this),console.log("CloneGeometry",this,t),t}copy(t){return Object.entries(t.attributes).forEach(([e,i])=>{this.setAttribute(e,i)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t,e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:t}},e)}get text(){return this.userData.parameters.text??""}}});function mK(t){if(!IT)return WL||(WL=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.158/build",i=import("./process.js"),[n,r]=await Promise.all([i,fetch(`${e}/process.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});D8(a),IT=!0}())}var D8,sP,IT,WL,Vx=z(()=>{sP=new Promise(t=>{D8=t}),IT=!1});function I2(t,e){if(Object.keys(t.morphAttributes).length>0||Object.keys(e.morphAttributes).length>0)return!1;let i=Object.keys(t.attributes),n=Object.keys(e.attributes);if(i.length!==n.length)return!1;for(let l of n){let c=t.attributes[l],h=e.attributes[l];if(c===void 0||c.isInterleavedBufferAttribute===!0||h.isInterleavedBufferAttribute===!0||c.itemSize!==h.itemSize||c.normalized!==h.normalized||c.array.constructor!==h.array.constructor||c.array.length!==h.array.length)return!1}let r=t.index,s=e.index;if(r===null!=(s===null))return!1;let a=!1;if(r!==null&&s!==null){if(r.array.length!==s.array.length)return!1;let l=r.array.constructor,c=s.array.constructor;if(l!==c){if(l!==Uint32Array||c!==Uint16Array)return!1;a=!0}}if(t.groups.length!==e.groups.length)return!1;for(let l=0;l<e.groups.length;l++){let c=t.groups[l],h=e.groups[l];if(c.start!==h.start||c.count!==h.count||c.materialIndex!==h.materialIndex)return!1}for(let l of n){let c=t.attributes[l],h=e.attributes[l];c.array.set(h.array),c.needsUpdate=!0}let o=t.takeDepthStateFrom;if(typeof o=="function"&&o.call(t,e),r!==null&&s!==null){if(a){let l=r.array,c=s.array;for(let h=0,d=c.length;h<d;h++){let u=c[h];l[h]=u===65535?4294967295:u}}else r.array.set(s.array);r.needsUpdate=!0}return t.drawRange.start=e.drawRange.start,t.drawRange.count=e.drawRange.count,t.userData=e.userData,t.boundingBox=null,t.boundingSphere=null,!0}function LT(t,e,i,n){let r,s,a,o=t.position.array,l=t.normal.array,c=R8.makeScale(e,i,n).invert().elements;for(let h=0,d=o.length;h<d;h+=3)o[h]*=e,o[h+1]*=i,o[h+2]*=n,r=l[h],s=l[h+1],a=l[h+2],l[h]=c[0]*r+c[4]*s+c[8]*a,l[h+1]=c[1]*r+c[5]*s+c[9]*a,l[h+2]=c[2]*r+c[6]*s+c[10]*a;t.position.needsUpdate=!0,t.normal.needsUpdate=!0}var R8,O8=z(()=>{J(),R8=new Et});function BT(t){let e=Number(t);return Number.isInteger(e)&&e>=0&&String(e)===t?e:-1}function ey(t){if(t!=null){if(Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView))return t;if(typeof t=="object")return function(e){let i=Object.keys(e),n=0;for(let s of i){let a=BT(s);a>=n&&(n=a+1)}if(n===0||n>i.length)return;let r=new Array(n);for(let s=0;s<n;s++){let a=e[s];if(typeof a!="number")return;r[s]=a}return r}(t)}}function L2(t){if(t==null)return"missing";if(Array.isArray(t))return`Array(${t.length})`;if(ArrayBuffer.isView(t)){let l=t;return`${t.constructor.name}(${l.length})`}if(typeof t!="object")return typeof t;let e=Object.keys(t),i=e.filter(l=>BT(l)===-1),n=0;for(let l of e){let c=BT(l);c>=n&&(n=c+1)}let r=t,s=-1,a=-1;for(let l=0;l<n;l++)l in r?typeof r[l]!="number"&&a===-1&&(a=l):s===-1&&(s=l);let o=[`${e.length} keys`,"max index "+(n-1)];return s!==-1&&o.push(`first missing index ${s}`),a!==-1&&o.push(`non-number at ${a} (${typeof r[a]})`),i.length&&o.push(`stray keys ${i.slice(0,3).join(",")}`),`Object{${o.join(", ")}}`}function I8(t){let e=Object.keys(t);return e.length===1&&e[0]==="subdivisions"}function aP(t,e){let i=e?e.count:t.count,n=0,r=1e4,s=new Map,a=new Uint32Array(i),o=[];for(let h=0;h<i;h++){let d=e?e.getX(h):h,u=t.getX(d),p=t.getY(d),f=t.getZ(d),g=Math.round(u*r),m=Math.round(p*r),v=Math.round(f*r),y=s.get(g);y===void 0&&(y=new Map,s.set(g,y));let _=y.get(m);_===void 0&&(_=new Map,y.set(m,_));let b=_.get(v);b===void 0&&(b=n++,_.set(v,b),o.push(u,p,f)),a[h]=b}let l=[],c=[];for(let h=0;h<a.length;h+=3)a[h]===a[h+1]||a[h]===a[h+2]||a[h+1]===a[h+2]||(l.push(a[h],a[h+1],a[h+2]),c.push(e?e.getX(h):h,e?e.getX(h+1):h+1,e?e.getX(h+2):h+2));return{positions:o,triIndices:l,triOriginals:c}}var Zf,dc,Qt,B2,U2,z2,Vi,Kf,iy,ny,ry,UT,Z1,Lp=z(()=>{J(),Vx(),Xt(),jx(),O8(),n0(),Zf=new hi,dc=new T,sP.then(t=>{Qt=t}),B2=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),U2=new Uint32Array([0,1,2,3]),z2=new Uint8Array([4]),Vi=class extends jt{constructor(t,e){super(),this.data=t,this.flatShading=e,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(t,e){this.freeSubdivPointer();let i=this.data.scaleBaked.map(a=>typeof a=="number"?a:1),n=yh.div(e.map(a=>typeof a=="number"?a:0),i);if(n.every(a=>a===1))return;this.subdividedGeometry&<(this.subdividedGeometry.attributes,...n),this.originalGeometry&<(this.originalGeometry.attributes,...n),this.data=t;let r=this.userData.parameters;this.userData.parameters={width:r.width*n[0],height:r.height*n[1],depth:r.depth*n[2]},this.originalGeometry.boundingSphere.center.multiply(dc.fromArray(n));let s=dc.set(r.width,r.height,r.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(t){this.freeSubdivPointer(),this.data=t;let e=t.phongAngle??35;this.flatShading&&(e=-1);let i=null;if(t.subdivisions>0){let r=0;try{r=Vi.allocate(t),i=Vi.buildRefined(r,t.subdivisions,e)}catch(s){console.error(s,t)}finally{r&&Vi.freeSubdivPointer(r)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let n=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=n}rebuild(){let t,e,i;try{({originalGeometry:t,subdividedGeometry:e,subdivPointer:i}=Vi.build(this.data,void 0,!this.flatShading,void 0))}catch{t=new ya(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=t,this.subdividedGeometry=e??void 0;let n=this.subdividedGeometry??this.originalGeometry;Object.assign(this,n),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Vi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;Zf.setFromBufferAttribute(e),Zf.getCenter(i),t.boundingSphere.radius=i.distanceTo(Zf.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Zf.getSize(dc);let n={width:dc.x,height:dc.y,depth:dc.z};return this.userData.parameters=n,n}static build(t,e,i,n){let r,s,a=t?.phongAngle??35;i===!1&&(a=-1),e&&(Qt.free_bvh(e),Qt.free_subdivision_surface(e));try{r=Vi.allocate(t,n)}catch(l){console.error(l,t),r=Vi.allocate({positionWASM:B2,indexWASM:U2,verticesPerFaceWASM:z2},n)}Qt.set_destination_refinement_level(r,0);let o=Vi.buildLevel(r,!0,a);return s=t.subdivisions>0?Vi.buildRefined(r,t.subdivisions,a):null,{subdivPointer:r,originalGeometry:o,subdividedGeometry:s}}static buildRefined(t,e,i){try{return Qt.set_destination_refinement_level(t,e),Vi.buildLevel(t,!1,i)??null}catch{try{return Qt.set_destination_refinement_level(t,e-1),Vi.buildLevel(t,!1,i)??null}catch{return null}}}static primitiveToQuads(t,e,i){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),t.type==="DodecahedronGeometry"&&(t.detail=0);let n,r=t.shape!==void 0||t.path!==void 0?e.geometry:hh(t,i,!1,e);n=w6(t)?r.getClosedTorusIndicesForBooleanOrSubdiv():r.getIndex();let s,{positions:a,triIndices:o,triOriginals:l}=aP(r.getAttribute("position"),n);if(t.type==="CylinderGeometry"&&t.cornerRadius===0&&t.hollow===0&&t.openEnded===!1){let u=t.radialSegments*t.heightSegments*3*2;s=[u,u+3*t.radialSegments]}let{indices:c,verticesPerFace:h,uvs:d}=function(u,p,f,g,m){let v=[],y=[],_=m?f.getAttribute("uv"):void 0,b=_&&_.itemSize===2?[]:void 0,x=E=>{if(b){let A=m[E];b.push(_.getX(A),_.getY(A))}};if(f.userData.shape!==void 0&&f.userData.parameters.depth===0&&f.userData.shape.shapeHoles.length===0){let E=f.userData.shape.extractShapePointsToFlatArray([]),A=f.userData.parameters.spikes;if(f.userData.type==="EllipseGeometry"&&A<=24&&A%4==0&&f.userData.parameters.angle>=360){let R=E.length/2/A;E=E.filter((O,D)=>Math.floor(D/2)%R===0)}let P=0;for(let R=0;R<E.length;R+=2)P+=(E[R]-E[(R===0?E.length:R)-2])*(E[R+1]+E[(R===0?E.length:R)-1]);u.length=0;let C=0;if(P<0)for(let R=0;R<E.length;R+=2)u.push(E[R],E[R+1],0),v.push(C++);else for(let R=E.length-2;R>=0;R-=2)u.push(E[R],E[R+1],0),v.push(C++);return y.push(C),{indices:v,verticesPerFace:y}}let w=new Float32Array([f.userData.parameters.depth])[0],S=0;for(;S<p.length;){if(f.useNgonForTopBottomFaceDuringBake){let E=0;if((u[3*p[S]+2]===w||u[3*p[S]+2]===0)&&E++,(u[3*p[S+1]+2]===w||u[3*p[S+1]+2]===0)&&E++,(u[3*p[S+2]+2]===w||u[3*p[S+2]+2]===0)&&E++,E===3)break}if(p[S+1]===p[S+3]&&p[S+2]===p[S+5]||p[S+0]===p[S+3]&&p[S+2]===p[S+4]){Kf.set(u[3*p[S]],u[3*p[S]+1],u[3*p[S]+2]),iy.set(u[3*p[S+1]],u[3*p[S+1]+1],u[3*p[S+1]+2]),ny.set(u[3*p[S+4]],u[3*p[S+4]+1],u[3*p[S+4]+2]),ry.set(u[3*p[S+5]],u[3*p[S+5]+1],u[3*p[S+5]+2]),iy.sub(Kf).normalize(),ny.sub(Kf).normalize(),ry.sub(Kf).normalize();let E=iy.cross(ny).dot(ry),A=S;Math.abs(E)>.005||g&&g.some((P,C)=>C%2!=1&&A>=g[C]&&A<g[C+1])?(v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3):(v.push(p[S],p[S+1],p[S+4],p[S+5]),x(S),x(S+1),x(S+4),x(S+5),y.push(4),S+=6)}else v.push(p[S],p[S+1],p[S+2]),x(S),x(S+1),x(S+2),y.push(3),S+=3}if(f.useNgonForTopBottomFaceDuringBake){let E=[],A=[],P=0;for(let C=0,R=0;C<u.length;C+=3,R++)u[C+2]===0&&(E.push(R),P++),u[C+2]===w&&A.push(R);if(f.userData.parameters.extrudeBevelSize===0){let C=A[0];A[0]=A[1],A[1]=C}E.reverse(),v.push(...E,...A),y.push(P,P),b=void 0}return{indices:v,verticesPerFace:y,uvs:b}}(a,o,r,s,l);return{positions:a,indices:c,verticesPerFace:h,uvs:d}}static allocate(t,e){let i,n,r,s=[],a=[],o=ey(t.positionWASM),l=ey(t.indexWASM),c=ey(t.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!c?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology \u2014 positionWASM ${L2(t.positionWASM)}, indexWASM ${L2(t.indexWASM)}, verticesPerFaceWASM ${L2(t.verticesPerFaceWASM)}`);i=o,n=l,r=c;let S=ey(t.uvWASM);Qt.alloc_subdivision_surface_uvs&&S&&S.length===2*n.length&&(a=S)}else i=B2,n=U2,r=z2;let h=i.length,d=n.length,u=r.length,p=i.length+s.length+a.length,f=n.length+r.length,g=p*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,m=p*Float32Array.BYTES_PER_ELEMENT,v=Qt._malloc(g);if(!v)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${g}) failed`);let y,_=new Float32Array(Qt.HEAPF32.buffer,v,p),b=new Uint32Array(Qt.HEAPU32.buffer,v+m,f);_.set(i,0),_.set(s,i.length),_.set(a,i.length+s.length),b.set(n,0),b.set(r,n.length),t?.scaleBaked?.some(S=>S!==1)&&(y=new Et().makeScale(...t.scaleBaked.map(S=>typeof S=="number"?S:1))),e&&(y?y.premultiply(e):y=e);let x=v+(i.length+s.length)*Float32Array.BYTES_PER_ELEMENT,w=a.length?y?Qt.alloc_subdivision_surface_uvs2(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,x,a.length,y.elements):Qt.alloc_subdivision_surface_uvs(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,x,a.length):y?Qt.alloc_subdivision_surface2(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u,y.elements):Qt.alloc_subdivision_surface(v,h,v+m,d,v+m+n.length*Uint32Array.BYTES_PER_ELEMENT,u);return Qt._free(v),w}static buildLevel(t,e,i,n,r,s=!1){let a=r?Qt.get_mesh_data2(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i,r.elements):Qt.get_mesh_data(t,e?Qt.Level.CONTROL:Qt.Level.REFINED,i),o=Qt.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),c=0,h=Qt.HEAPU32[o[c]>>2],d=Qt.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let u=Qt.HEAPU32[o[c]>>2],p=Qt.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Qt.HEAPU32[o[c]>>2],g=Qt.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let m,v=Qt.HEAPU32[o[c]>>2],y=Qt.HEAPU32.subarray(v>>2,(v>>2)+l[c]);if(c++,Qt.alloc_subdivision_surface_uvs){let b=o[9];if(b>0){let x=Qt.HEAPU32[o[8]>>2];m=Qt.HEAPF32.subarray(x>>2,(x>>2)+b)}}if(n===void 0){let b=new jt;if(b.setIndex(new mh(y,1)),b.setAttribute("position",new kt(d,3)),b.setAttribute("normal",new kt(p,3)),m&&b.setAttribute("uv",new kt(m,2)),e){b.setAttribute("faceMap",new mh(g,1));let x=new Float32Array(p.length/3*4).fill(0);b.setAttribute("color",new Ht(x,4))}return Qt.free_mesh_data(a),b.userData.type="SubdivGeometry",b}if(n.getAttribute("position").copyArray(d),n.getAttribute("normal").copyArray(p),n.attributes.position.needsUpdate=!0,n.attributes.normal.needsUpdate=!0,s){let b=n.getIndex();b!==null&&b.array.length===y.length&&(b.copyArray(y),b.needsUpdate=!0)}let _=n.getAttribute("uv");m&&_&&_.array.length===m.length&&(_.copyArray(m),_.needsUpdate=!0),Qt.free_mesh_data(a)}static freeSubdivPointer(t){Qt.free_bvh(t),Qt.free_subdivision_surface(t)}static buildControlCageWireframe(t,e,i){let n=Qt.get_wireframe_data_for_base_level(t),r=Qt.HEAPU32.subarray(n>>2,4+(n>>2)),s=r.subarray(2,4),a=0,o=Qt.HEAPU32[r[a]>>2],l=Qt.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let c=Qt.HEAPU32[r[a]>>2],h=Qt.HEAPU32.subarray(c>>2,(c>>2)+s[a]);if(e===void 0){let d=new jt;d.setAttribute("position",new kt(l,3));let u=new Float32Array(l.length);for(let p=0,f=l.length;p<f;)u[p++]=i.r,u[p++]=i.g,u[p++]=i.b;return d.setAttribute("color",new Ht(u,3)),d.setIndex(new mh(h,1)),Qt.free_wireframe_data_for_base_level(n),d}e.getAttribute("position").copyArray(l),e.attributes.position.needsUpdate=!0,Qt.free_wireframe_data_for_base_level(n)}static updateCollabMesh(t,e,i){let n=e===0;n||Qt.set_destination_refinement_level(t,e);let r=i?Qt.get_topological_data2(t,n?Qt.Level.CONTROL:Qt.Level.REFINED,i.elements):Qt.get_topological_data(t,n?Qt.Level.CONTROL:Qt.Level.REFINED),s=Qt.HEAPU32.subarray(r>>2,8+(r>>2)),a=s.subarray(3,6),o=0,l=Qt.HEAPU32[s[o]>>2],c=new Float32Array(Qt.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let h=Qt.HEAPU32[s[o]>>2],d=new Uint32Array(Qt.HEAPU32.subarray(h>>2,(h>>2)+a[o]));o++;let u,p=Qt.HEAPU32[s[o]>>2],f=new Uint8Array(Qt.HEAPU32.subarray(p>>2,(p>>2)+a[o]));if(Qt.alloc_subdivision_surface_uvs){let g=s[7];if(g>0){let m=Qt.HEAPU32[s[6]>>2];u=new Float32Array(Qt.HEAPF32.subarray(m>>2,(m>>2)+g))}}return Qt.free_topological_data(r),{positions:c,indices:d,verticesPerFace:f,uvs:u}}},Kf=new T,iy=new T,ny=new T,ry=new T}),L8=z(()=>{hL(),cL(),Lb(),dL(),Fb(),n0(),DL(),RL(),OL(),DT(),BL(),Nb(),UL(),zL(),FL(),RT(),NL(),kL(),VL(),jL(),Eh(),ke(),hL(),cL(),Lb(),dL(),Fb(),pK(),n0(),DL(),RL(),OL(),DT(),BL(),Nb(),UL(),zL(),FL(),RT(),NL(),kL(),VL(),jL(),Eh(),fK(),a8(),P8(),Lp(),Vx(),Fx(),Ip(),UT={ConeGeometry:V6,CubeGeometry:j6,CylinderGeometry:K3,DodecahedronGeometry:G6,EllipseGeometry:Nx,HelixGeometry:S6,IcosahedronGeometry:m8,LatheGeometry:g8,NonParametricGeometry:y8,PolygonGeometry:nP,PyramidGeometry:_8,RectangleGeometry:kx,SphereGeometry:w8,PlaneGeometry:S8,BackdropGeometry:M8,StarGeometry:rP,TextFrameGeometry:E8,TorusGeometry:A8,TorusKnotGeometry:T8,TriangleGeometry:C8,VectorGeometry:Ih},Z1=t=>{let e=UT[t.type]??u6(t.type);if(e===void 0)throw new Error(`No geometry factory registered for "${t.type}" \u2014 was its feature compiled out of this runtime build?`);return e.create(t)}});function hh(t,e,i,n){let r,s,a;t.type==="PathGeometry"?(s={...t,extrusion:{...t.extrusion}},a=[[],["extrusion"]]):(s={...t},a=[[]]);for(let c of a){let h=s;for(let d of c)h=h[d];for(r in h){let d=h[r];jA(d)&&!B8.includes(r)&&(h[r]=e.getVariable(d,[n.uuid,"geometry",...c,r]),jA(h[r])&&(h[r]=1))}}let o,l={parameters:s,type:s.type};if(s.type==="PathGeometry"){l.path=s.path;let c=n.profileShape;c!==void 0&&(l.shapeData=c),l.ownerId=n.uuid}else if(s.type==="VectorGeometry"){let c=ji.createFromState(s.shape,s.width,s.height);l.shape=c,l.ownerId=n.uuid}else if(s.type==="NonParametricGeometry"){if(s.data.groups&&s.data.groups?.forEach(c=>c.materialIndex=Math.max(c.materialIndex??0,0)),l.geometry=new a3().parse(s),l.geometry.groups.length===0){let c=l.geometry;c.addGroup(0,Math.max(c.getIndex()?.count??0,c.getAttribute("position").count),0)}}else{if(s.type==="SubdivGeometry"){let c=new Vi(s,i);return c.data=t,c}if(s.type==="TextGeometry"||s.type==="InputGeometry"){let c=u6(s.type);if(c)return c.create(s,e);jn("text",`a ${s.type}`);let h=ji.createFromState(xp.defaultData(),100,100);return Z1({...s,shape:h,type:"VectorGeometry"})}if(s.type==="UIGeometry")return kx.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}})}try{o=Z1(l)}catch(c){console.error(c),console.error(`Error generating geometry with inputs: ${l}`);let h=ji.createFromState(xp.defaultData(),100,100);l.shape=h,l.type="VectorGeometry",o=Z1(l)}return o}var B8,jx=z(()=>{Xt(),J(),L8(),ke(),Nb(),Oh(),Lp(),B8=["font"]});function zT(t){switch(typeof t){case"number":return Number.isFinite(t)?JSON.stringify(t):void 0;case"boolean":return JSON.stringify(t);case"string":return jA(t)?void 0:JSON.stringify(t);case"object":{if(t===null)return"null";if(Array.isArray(t)){let r="[";for(let s=0;s<t.length;s++){let a=zT(t[s]);if(a===void 0)return;r+=(s>0?",":"")+a}return r+"]"}let e=t,i="{",n=!0;for(let r of Object.keys(e).sort()){if(e[r]===void 0)continue;let s=zT(e[r]);if(s===void 0)return;i+=`${n?"":","}${JSON.stringify(r)}:${s}`,n=!1}return i+"}"}default:return}}var U8,qL,FT,gK=z(()=>{Xt(),U8=new Set(["CubeGeometry","SphereGeometry","CylinderGeometry","ConeGeometry","TorusGeometry","TorusKnotGeometry","IcosahedronGeometry","DodecahedronGeometry","PyramidGeometry","PlaneGeometry","BackdropGeometry","HelixGeometry"])}),vK=z(()=>{jx(),gK(),qL=class{constructor(){this.objects=new Map,this.refs=new Map,this.sharedByKey=new WeakSet,this.unreachable=new Set}resolveObject(t,e,i){return this.createObject(t,e,i)}onObjectDisposed(t){}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,i){let n=this.objects.get(t);return n===void 0?(n=this.resolveObject(t,e,i),this.objects.set(t,n),this.retain(n)):(this.sharedByKey.add(n),n.isShared=!0),n}forceDelete(t){let e=this.objects.get(t);e&&(this.objects.delete(t),this.release(e))}adopt(t,e){this.replace(t,e),this.retain(e)}mutateIfUnique(t,e){let i=this.objects.get(t);if(i&&i.isShared!==!0)return this.objects.delete(t),this.replace(e,i),i}replace(t,e){let i=this.objects.get(t);this.objects.set(t,e),i!==void 0&&i!==e&&this.release(i)}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){e===this.objects.get(t)&&this.unreachable.delete(t)}endGc(){this.unreachable.forEach(t=>{let e=this.objects.get(t);this.objects.delete(t),this.release(e)}),this.unreachable.clear()}dispose(){new Set(this.objects.values()).forEach(t=>{this.disposeObject(t),this.onObjectDisposed(t)}),this.objects.clear(),this.refs.clear()}retain(t){let e=(this.refs.get(t)??0)+1;this.refs.set(t,e),e>1&&(t.isShared=!0)}release(t){let e=(this.refs.get(t)??1)-1;if(e>0)return this.refs.set(t,e),void(e===1&&!this.sharedByKey.has(t)&&(t.isShared=!1));this.refs.delete(t),this.disposeObject(t),this.onObjectDisposed(t)}},FT=class extends qL{constructor(t){super(),this.flatShading=t,this.dedupeByValue=!1,this.byValue=new Map,this.valueKeyOf=new Map}disposeObject(t){t.dispose()}createObject(t,e,i){let n=hh(t,e,this.flatShading,i);return n.computeBoundingSphere(),n}resolveObject(t,e,i){let n=this.dedupeByValue?function(s,a,o){if(!U8.has(s.type))return;let l=s;if(l.shapeBlendNode!=null||o.isTransientGeometryKey(s))return;let c=a.material;if(c===void 0||Array.isArray(c))return;let h=c;if(typeof h.getLayersOfType!="function"||h.getLayersOfType("outline").length>0||h.getLayersOfType("cavity").length>0)return;let d=s.type;for(let u of Object.keys(l).sort()){let p=l[u];if(p===void 0||u==="type")continue;let f=zT(p);if(f===void 0)return;d+=`|${u}=${f}`}return d}(t,i,e):void 0;if(n!==void 0){let s=this.byValue.get(n);if(s!==void 0)return s}let r=this.createObject(t,e,i);return n!==void 0&&(this.byValue.set(n,r),this.valueKeyOf.set(r,n)),r}mutateIfUnique(t,e){let i=super.mutateIfUnique(t,e);return i!==void 0&&this.forgetValue(i),i}onObjectDisposed(t){this.forgetValue(t)}forgetValue(t){let e=this.valueKeyOf.get(t);e!==void 0&&(this.valueKeyOf.delete(t),this.byValue.get(e)===t&&this.byValue.delete(e))}}});function kb(){return Gx}function z8(){if(Gx==="webgpu"){if(YL!==void 0)return YL;kT||(kT=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered \u2014 import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(NT===void 0)throw new Error('[spe] Classic (WebGL) materials are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return NT}function F8(t,e){return z8().createRootMaterial(t,e)}function XL(t,e,i){return z8().createSharedMaterial(t,e,i)}function $L(t){return t.getLayersOfType===void 0&&Object.assign(t,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),t}function N8(){return yK}var Gx,YL,NT,kT,VT,yK,jT,k8,Lh=z(()=>{Gx="webgl",kT=!1}),_K=z(()=>{k8={markNeedsUpdateRendererDirty:()=>{}}});function ZL(t){return t.data.type!=="displace"&&!!t.data.isMask}function ch(t,e){let i=0;if(!t.layers||t.layers.length===0)return!1;let n=t.layers?.find(s=>s.data.type==="light");if(n){let s=n.data,a=Number(e.getVariable(s.alphaOverride));if((typeof s.alphaOverride=="string"?a/100:s.alphaOverride)<1)return!0}let r=t.layers;for(let s=0;s<r.length;s++){let a=r[s];if(!ZL(a)){if(s>0&&ZL(r[s-1])){if(a.data.type==="light"&&!a.data.visible)return!0;continue}if(a.data.type!=="displace"&&"alpha"in a.data&&a.data.type!=="light"&&a.data.type!=="fresnel"&&a.data.type!=="cavity"&&a.data.type!=="dust"&&a.data.type!=="texture"&&a.data.type!=="matcap"&&a.data.type!=="rainbow"&&a.data.type!=="outline"&&a.data.type!=="pattern"){let o=a.data.visible?a.data.alpha:0;if(typeof o=="string"&&(o=Math.max(0,Math.min(1,Number(e.getVariable(o)??100)/100))),o===1&&a.data.type==="depth"||a.data.type==="gradient"){for(let l of a.data.colors)if(l[3]<1){o=l[3];break}}else if(o===1&&a.data.type==="noise"){let l=e.color(a.data.colorA).a,c=e.color(a.data.colorB).a,h=e.color(a.data.colorC).a,d=e.color(a.data.colorD).a,u=Math.min(l,Math.min(c,Math.min(h,d)));u<1&&(o=u)}i+=(1-i)*o}}}return i<1}var Hx=z(()=>{});function Sp(t){return typeof t=="string"||typeof t=="number"&&t!==0}var Ah,$t,fl,no,Wx,V8,KL,QL,Or,ml=z(()=>{J(),Ah=(t,e,i)=>Math.max(0,Math.min(1,Number(e.getVariable(typeof t=="number"?100*t:t,i)??100)/100))??1,$t=(t,e,i)=>typeof t=="number"?t:e.getVariable(t,i),fl=(t,e)=>(t||(t=new T),t.x=$t(t.x,e)??0,t.y=$t(t.y,e)??0,t.z=$t(t.z,e)??0,t),no=(t,e)=>(t||(t=new et),t.x=$t(t.x,e)??0,t.y=$t(t.y,e)??0,t),Wx={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},V8={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]}}),Bp=z(()=>{J(),Op(),Oi(),KL=class extends Bx(xi){},QL=t=>t.type==="Mesh",Or=class extends KL{constructor(t){super(),this.object=t,this.isClone=!0,this.matrixAutoUpdate=!1}raycast(t,e){}expand(){let t=0,e=this.object.entityChildren(t);for(;e;){let i=this.children[t];(!(i instanceof Or)||i.object!==e)&&(i=new Or(e),this._replaceChildAt(t,i),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=e.matrix,i.shearMatrix=e.shearMatrix,i.pivotMatrix=e.pivotMatrix),i.expand(),t+=1,e=this.object.entityChildren(t)}for(let i of this.object.children){if(!oh(i)||i.object.parent!==this.object)continue;let n=this.children[t];n?.source!==i&&(n=i.createCopy(),this._replaceChildAt(t,n)),n.expand(),t+=1}for(;this.children.length>t;)this.remove(this.children[t]);this.pivotMatrix=this.object.pivotMatrix}_replaceChildAt(t,e){let i=this.children[t];i&&this.remove(i),this.add(e),this.children.splice(t,0,this.children.pop())}get visible(){let t=this.parent,e=oh(t)&&t.object===this.object;return(!e||!t.instancingActive&&!t.insideBoolean)&&(this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||e&&this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0)}set visible(t){}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return QL(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(t){}}});function JL(){return oP}var oP,lP,hP=z(()=>{oP=null,lP=null});function GT(t){return"variable_"+t}var F2,N2,k2,t5,V2,e5,j2,i5,Vb,cP=z(()=>{Xt(),L6(),z6(),X3(),ba(),$3(),Z3(),vK(),Lh(),U6(),_K(),Hx(),ml(),Xr(),Bp(),Ye(),J(),hP(),ke(),F2=new Et,N2=new T,k2=new qt,t5=new T,V2=new ci,e5=class extends R6{constructor(t){super(),this.shared=t}create(t){return new q3(t,this.shared)}},j2=new Set,(Vb=i5=class{constructor(t,e={},i=!0,n=!1){if(this.data=t,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=n,this.geometryCache=new FT(!0),this.geometryCache2=new FT(!1),this.imageHolderCache=new e5(this),this.thisContext={scene:k8,shared:this},this.deletedImage=new tl(mb.emptyImage,this),this.deletedVideo=new tl(gb.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,e.images)for(let[r,s]of Object.entries(e.images))this.addImage(r,s);if(e.videos)for(let[r,s]of Object.entries(e.videos))this.addVideo(r,s);if(e.audios)for(let[r,s]of Object.entries(e.audios))this.addAudio(r,s);if(e.particles)for(let[r,s]of Object.entries(e.particles))this.addParticle(r,s);this.reset(t)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=XL(zi.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,i=!1){this.data=t,this.resetLib(t.lib);for(let{id:n,data:r}of t.variables)this.addVariableHolder(n,r),e&&this.updateVariableHolder(n,r);for(let[n,r]of Object.entries(t.userAPIs??{}))this.addUserAPI(n,r);for(let[n,r]of Object.entries(t.userWebhooks??{}))this.addUserWebhook(n,r);if(!i){for(let[n,r]of Object.entries(t.images))this.addImage(n,r);for(let[n,r]of Object.entries(t.videos))this.addVideo(n,r)}for(let[n,r]of Object.entries(t.colors))this.addColor(n,r);for(let[n,r]of Object.entries(t.lib.materials))this.addMaterial(n,r.asset);for(let[n,r]of Object.entries(t.materials))this.addMaterial(n,r);for(let[n,r]of Object.entries(t.audios))this.addAudio(n,r);for(let[n,r]of Object.entries(t.particles))this.addParticle(n,r);for(let[n,r]of Object.entries(t.fonts))this.addFont(n,r)}addMaterial(t,e){if(e=zi.withRepairedLayers(e),this.materials[t]){let i=this.materials[t];i.reset(e,this.thisContext),i.dispose()}else{let i=XL(e,this.thisContext,t);this.materials[t]=i}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return typeof t=="string"?this.getMaterialOrDeletedPlaceholder(t):t==null?(console.error("material is undefined or null"),this.deletedMaterial):F8(zi.withRepairedLayers(t),this.thisContext)}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new tl(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return typeof t=="string"?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new tl(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}getEntityTexture(t,e={}){let i=t.material;if(!i)return null;for(let n of Array.isArray(i)?i:[i]){let r=n.root??n;for(let s of r?.data?.layers??[]){let a=s?.data;if(a?.type!=="texture"&&a?.type!=="matcap"||e.layer!==void 0&&s.id!==e.layer&&a.type!==e.layer)continue;let o=a.texture?.image;if(o==null)continue;let l=(typeof o=="string"?this.uiBuffer(o):void 0)??this.image(o);if(!l)continue;let c=l.getTexture(a.texture.wrapping??(a.type==="texture"?1e3:1001),a.texture.minFilter??1008,a.texture.magFilter??1006),h=l.img;return{texture:c,width:h?.width??0,height:h?.height??0,layerId:s.id,layerType:a.type}}}return null}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new tl(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return typeof t=="string"?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):(this.colors[t]=new a0(e.r,e.g,e.b,"a"in e?e.a:1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[t];return this.colors[t].r=e.r??i.r,this.colors[t].g=e.g??i.g,this.colors[t].b=e.b??i.b,this.colors[t].a=e.a??i.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if(typeof t!="string")return new _n(t.r,t.g,t.b,"a"in t?t.a:1);{let i=this.getColor(t);i?e=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new _n(0,0,0,0))}return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof Hu)return e;{let i=new Hu({src:e.data});return this.audios[t]=i,i}}addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof Hu&&e.dispose(),delete this.audios[t])}addFont(t,e){let i=Y3;i!==null?(this.fonts[t]=new i(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())):jn("text","a font asset")}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._requestRender=void 0,Object.values(this.audios).forEach(t=>{t instanceof Hu&&t.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(this.variables[t]===void 0){let i=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let n=localStorage.getItem(GT(t));i=n!==null?JSON.parse(n):e.value}return this.variables[t]={value:i,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)this.variables[t].dynamicVariablePlayState!==void 0&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(this.variables[t]===void 0)return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(GT(t),JSON.stringify(e));let i=e;for(;typeof i=="string";)i=this.variables[i].value;let n=this.entityOpContext.scene,r=!1;for(let s=this.variables[t].locations.length-1;s>=0;s--){let a=this.variables[t].locations[s];if(a[0]==="material"){let o=a[1],l=i,c={scene:n,shared:this},h=a.slice(2);n.traverseMaterial(u=>{let p=u.root??u;p.uuid===o&&p.onVariableUpdate(h,l,c)});let d=this.materials[o];d&&d.onVariableUpdate(h,l,c)}else{let o=n.find(a[0]);if(o===void 0){this.variables[t].locations.splice(s,1);continue}if(r=!0,a[1]!=="geometry"&&a[1]!=="particles"){for(let l=1;l<a.length-1;l++)o=o[a[l]];a[1]==="rotation"?o[a[a.length-1]]=i*Pt.DEG2RAD:o[a[a.length-1]]=i}if(o=n.find(a[0]),o.type==="ParticleEmitter"&&o.updateVariableState(i,a),Ie.is(o))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")o.onVariableUpdate();else if(a[1]==="geometry"){let l=o;o.component&&(l=o.component);let c=l.dataPatched;l.chooseGeoemtryCache(this).forceDelete(c.geometry),l.createGeometryDelayed(this.entityOpContext),l.onVariableUpdate(!0),l.invalidateDownstreamBooleanData(),l.instances.forEach(h=>{let d=h.dataPatched;h.chooseGeoemtryCache(this).forceDelete(d.geometry),h.createGeometryDelayed(this.entityOpContext),h.onVariableUpdate(!0),h.invalidateDownstreamBooleanData()})}else a[1]==="morphTargetInfluences"&&o.updateMorphInfluences(a[2],i)}}return r&&n.markShadowsDirty(),this.requestRender(),!0}isTransientGeometryKey(t){return this.transientGeometryKeys.has(t)}updateEntityGeometryParams(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||typeof r.type!="string"||r.type==="VectorGeometry"||r.type==="PathGeometry")return!1;let s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let c of Object.keys(r))a.set(s(c),c);let o={};for(let[c,h]of Object.entries(e??{})){let d=a.get(s(c));if(d===void 0||d==="type"||d==="font"||d==="shape"||d==="path"||d==="data")continue;if(d==="text"){(typeof h=="string"||typeof h=="number")&&(o[d]={textValue:String(h)});continue}let u=r[d];typeof h=="number"&&isFinite(h)&&(typeof u=="number"||typeof u=="string")&&(o[d]=h)}if(Object.keys(o).length===0)return!1;let l={...r,...o};return i.dataPatched={...n,geometry:l},this.transientGeometryKeys.has(r)&&i.chooseGeoemtryCache(this).forceDelete(n.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(t){let e=t;if(e.component&&(e=e.component),typeof e.chooseGeoemtryCache!="function")return!1;let i=e.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(e.dataPatched=e.data,e.chooseGeoemtryCache(this).forceDelete(i),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(t,e){let i=t;if(i.component&&(i=i.component),typeof i.chooseGeoemtryCache!="function")return!1;let n=i.dataPatched,r=n?.geometry;if(!r||r.type!=="NonParametricGeometry")return!1;let s=e?.vertices;if(s===void 0||typeof s.length!="number"||s.length<9||s.length%3!=0||s.length/3>i5.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,c=s instanceof Float32Array?s:Float32Array.from(s),h=c.length/3;if(e.normals!==void 0){if(e.normals.length!==c.length)return!1;a=e.normals instanceof Float32Array?e.normals:Float32Array.from(e.normals)}if(e.uvs!==void 0){if(e.uvs.length!==2*h)return!1;o=e.uvs instanceof Float32Array?e.uvs:Float32Array.from(e.uvs)}if(e.indices!==void 0){let x=h>65535?Uint32Array.from(e.indices):Uint16Array.from(e.indices);if(x.length===0||x.length%3!=0)return!1;for(let w=0;w<x.length;w++)if(x[w]>=h)return!1;l={array:x,itemSize:1,type:x.constructor.name,normalized:!1}}else{let x=r.data,w=x?.index;if(w?.array?.length){let S=(x?.attributes?.position?.array?.length??0)/3;if(h!==S)return function(E,A){let P=`${E}/${A}`;j2.has(P)||(j2.add(P),console.warn(`[spline] updateObject: ignoring a geometry update of ${E} vertices for a mesh that holds ${A}. Without \`indices\` the write is taken as a morph of the mesh's own vertices, which only means anything at the same count \u2014 send \`indices\` alongside \`vertices\` to replace the topology too.`))}(h,S),!1;l=w}}let d=1/0,u=1/0,p=1/0,f=-1/0,g=-1/0,m=-1/0;for(let x=0;x<c.length;x+=3){let w=c[x],S=c[x+1],E=c[x+2];w<d&&(d=w),w>f&&(f=w),S<u&&(u=S),S>g&&(g=S),E<p&&(p=E),E>m&&(m=E)}let v=(x,w)=>({array:x,itemSize:w,type:"Float32Array",normalized:!1}),y={position:v(c,3)};a&&(y.normal=v(a,3)),o&&(y.uv=v(o,2));let _={...r,width:f-d,height:g-u,depth:m-p,data:{attributes:y,...l?{index:l}:{}}},b=this.transientGeometryKeys.has(r);return i.dataPatched={...n,geometry:_},this.transientGeometryKeys.add(_),i.applyTransientGeometryData(this.entityOpContext,b),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(t,e){let i=t;i.component&&(i=i.component);let n=i.cloner;if(n===void 0)return-1;let r=n.children,s=Math.PI/180,a=!1;if(e===null)for(let o of r)o.transformOverride!==void 0&&(o.transformOverride=void 0,a=!0);else{if(!Array.isArray(e))return r.length;{let o=Math.min(e.length,r.length);for(let l=0;l<o;l++){let c=e[l],h=r[l];if(c==null){h.transformOverride!==void 0&&(h.transformOverride=void 0,a=!0);continue}let d=h.transformOverride??{position:[h.position.x,h.position.y,h.position.z],rotation:[h.rotation.x,h.rotation.y,h.rotation.z],scale:[h.scale.x,h.scale.y,h.scale.z]};c.position&&(typeof c.position.x=="number"&&(d.position[0]=c.position.x),typeof c.position.y=="number"&&(d.position[1]=c.position.y),typeof c.position.z=="number"&&(d.position[2]=c.position.z)),c.rotation&&(typeof c.rotation.x=="number"&&(d.rotation[0]=c.rotation.x*s),typeof c.rotation.y=="number"&&(d.rotation[1]=c.rotation.y*s),typeof c.rotation.z=="number"&&(d.rotation[2]=c.rotation.z*s)),c.scale&&(typeof c.scale.x=="number"&&(d.scale[0]=c.scale.x),typeof c.scale.y=="number"&&(d.scale[1]=c.scale.y),typeof c.scale.z=="number"&&(d.scale[2]=c.scale.z)),h.transformOverride=d,h.position.fromArray(d.position),h.rotation.fromArray(d.rotation),h.scale.fromArray(d.scale),h.updateMatrix(),h.hasNonUniformScale&&(h.updateMatrixWorld(),h.updateMatrixWorldRigid())}}}return a?n.update(this.entityOpContext):n.syncInstanceMatrices(),n.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r.length}spawnRuntimeClone(t,e={}){if(typeof t.entityChildren!="function")return;let i=t.parent;if(i===null)return;let n=new Or(t);n.playModeVisible=e.visible!==!1,n.expand(),typeof e.name=="string"&&(n.name=e.name);let r=Math.PI/180;return n.position.copy(t.position),n.rotation.copy(t.rotation),n.scale.copy(t.scale),n.shearMatrix.copy(t.shearMatrix),e.position&&(typeof e.position.x=="number"&&(n.position.x=e.position.x),typeof e.position.y=="number"&&(n.position.y=e.position.y),typeof e.position.z=="number"&&(n.position.z=e.position.z)),e.rotation&&(typeof e.rotation.x=="number"&&(n.rotation.x=e.rotation.x*r),typeof e.rotation.y=="number"&&(n.rotation.y=e.rotation.y*r),typeof e.rotation.z=="number"&&(n.rotation.z=e.rotation.z*r)),e.scale&&(typeof e.scale.x=="number"&&(n.scale.x=e.scale.x),typeof e.scale.y=="number"&&(n.scale.y=e.scale.y),typeof e.scale.z=="number"&&(n.scale.z=e.scale.z)),n.updateMatrix(),i.add(n),n.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),n}destroyRuntimeClone(t){t.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(t,e){let i=t.material;if(!i)return!1;let n=[];for(let c of Array.isArray(i)?i:[i]){let h=c.root??c;h&&Array.isArray(h.layers)&&h.data&&!n.includes(h)&&n.push(h)}if(n.length===0)return!1;let r={scene:this.entityOpContext.scene,shared:this},s=c=>c.toLowerCase().replace(/[\s_.-]+/g,""),a=c=>{if(typeof c=="string"){let h=new _n(1,1,1,1);try{h.set(c)}catch{return null}return{r:h.r,g:h.g,b:h.b,a:void 0}}if(c&&typeof c=="object"&&"r"in c){let h=c;if([h.r,h.g,h.b].some(u=>typeof u!="number"||!isFinite(u)))return null;let d=Math.max(h.r,h.g,h.b)>1?1/255:1;return{r:h.r*d,g:h.g*d,b:h.b*d,a:typeof h.a=="number"?Math.max(0,Math.min(h.a,1)):void 0}}return null},o=(c,h,d)=>{if(!c.hasValue(h))return!1;let u=c.getValue(h);if(!u||typeof u!="object"||!u.isColor)return!1;let p=d.a??(typeof u.a=="number"?u.a:1);return u instanceof a0?c.setValue(h,new _n(d.r,d.g,d.b,p)):typeof u.setRGBA=="function"?u.setRGBA(d.r,d.g,d.b,p):u.setRGB(d.r,d.g,d.b),!0},l=!1;for(let c of n){let h=c.data.layers??[],d=u=>c.layers.find(p=>p.uuid===u);if(e.color!==void 0){let u=a(e.color),p=h.find(g=>g.data.type==="color"),f=p&&d(p.id);if(u&&f&&o(f,"color",u)&&(l=!0,u.a!==void 0)){let g=u.a<1||ch(c.data,this);c.setTransparent?c.setTransparent(g,r.scene):c.transparent=g}}typeof e.alpha=="number"&&isFinite(e.alpha)&&(c.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(e.alpha,100)),r),l=!0);for(let u of e.layers??[]){if(!u||typeof u!="object")continue;let p=typeof u.id=="string"?h.find(v=>v.id===u.id):typeof u.index=="number"?h[u.index]:typeof u.type=="string"?h.find(v=>v.data.type===u.type):void 0,f=p&&d(p.id);if(!p||!f)continue;let g=Wx[p.data.type]??[],m=Object.keys(p.data);for(let[v,y]of Object.entries(u)){if(v==="id"||v==="index"||v==="type")continue;let _=m.find(x=>x===v)??m.find(x=>s(x)===s(v))??v;if(g.includes(_))continue;let b=a(y);if(b&&o(f,_,b))l=!0;else if(typeof y=="number"&&isFinite(y))c.onVariableUpdate?.(["layer",p.id,_],y,r),l=!0;else if(Array.isArray(y)&&y.length<=3&&y.every(x=>typeof x=="number"&&isFinite(x))){let x=["x","y","z"];y.forEach((w,S)=>{c.onVariableUpdate?.(["layer",p.id,_,x[S]],w,r)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(t){this.variables[t]&&delete this.variables[t]}referencesMissingObject(t){return Array.isArray(t)&&t[0]!=="mouse"&&t[0]!=="raycast"&&this.entityOpContext.scene.find(t[0])===void 0}getVariable(t,e){if(Array.isArray(t)){if(t[0]==="mouse")return this.mouseProperty?.[t[1]]??0;if(t[0]==="raycast")return this.raycastProperty?.[t[1]]??0;let i=this.entityOpContext.scene.find(t[0]);if(i===void 0)return;if(t[1]==="width"||t[1]==="height"||t[1]==="depth")return i.geometry.userData.parameters[t[1]];if((t[1]==="position"||t[1]==="rotation")&&t.length>2&&i?.getPhysicsLocalMatrix?.(F2))return F2.decompose(N2,k2,t5),t[1]==="position"?N2[t[2]]:(V2.setFromQuaternion(k2,i.rotation.order),V2[t[2]]*Pt.RAD2DEG);for(let n=1;n<t.length;n++)i=i[t[n]];return t[1]==="rotation"&&(i*=Pt.RAD2DEG),i}for(let i in this.variables){if(e===void 0)break;let n=this.variables[i],r=n.locations?.findIndex(s=>Vn.equal(s,e));r!==void 0&&r!==-1&&n.locations.splice(r,1)}if(typeof t=="string"){let i=t,n=t;do{if(n=i,this.variables[i]===void 0)break;let r=this.variables[i].value;e&&this.variables[n]!==void 0&&this.variables[n].locations.push(e),i=r}while(typeof i=="string");return i}return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){this.variables[t]!==void 0&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i.asset);for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.asset);for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i.asset);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i.asset);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i.asset);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i.asset);for(let[e,i]of Object.entries(t.variables))this.addVariableHolder(e,i.asset)}updateLibByOp(t,e){t.path[0]==="images"?t.path.length===1&&t.type===1?this.addImage(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteImage(t.id):t.path[0]==="videos"?t.path.length===1&&t.type===1?this.addVideo(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVideo(t.id):t.path[0]==="audios"?t.path.length===1&&t.type===1?this.addAudio(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteAudio(t.id):t.path[0]==="particles"?t.path.length===1&&t.type===1?this.addParticle(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteParticle(t.id):t.path[0]==="colors"?t.path.length===1&&t.type===1?this.addColor(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteColor(t.id):t.path[0]==="materials"?t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteMaterial(t.id):t.path[0]==="fonts"?t.path.length===1&&t.type===1?this.addFont(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteFont(t.id):t.path[0]==="variables"?t.path.length===1&&t.type===1?this.addVariableHolder(t.id,t.data.asset):t.path.length===1&&t.type===2&&this.deleteVariable(t.id):t.path[0]==="components"&&e.updateByLibOp(t,this)}updateByOp(t,e,i){if(this.data=e,t.path[0]==="images")t.path.length===2&&t.type===0?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addImage(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteImage(t.id);else if(t.path[0]==="videos")t.path.length===2&&t.type===0?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):t.path.length===1&&t.type===1?this.addVideo(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteVideo(t.id);else if(t.path[0]==="audios")t.path.length===2&&t.type===0?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):t.path.length===1&&t.type===1?this.addAudio(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteAudio(t.id);else if(t.path[0]==="particles")t.path.length===2&&t.type===0?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):t.path.length===1&&t.type===1?this.addParticle(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteParticle(t.id);else if(t.path[0]==="colors")t.path.length===2&&t.type===0?this.updateColor(t.path[1],t.props):t.path.length===1&&t.type===1?this.addColor(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteColor(t.id);else if(t.path[0]==="materials")t.path.length===1&&t.type===1?this.addMaterial(t.id,t.data):t.path.length===1&&t.type===2?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(tr.drop(t,2),e.materials[t.path[1]],{shared:this,scene:i});else if(t.path[0]==="fonts")t.path.length===2&&t.type===0?this.updateFont(t.path[1],t,i):t.path.length===1&&t.type===1?this.addFont(t.id,t.data):t.path.length===1&&t.type===2&&this.deleteFont(t.id);else if(t.path[0]==="variables")t.path.length===2&&t.type===0?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):t.path.length===1&&t.type===4?this.addVariableHolder(t.id,t.data):t.path.length===1&&t.type===5&&this.deleteVariable(t.id);else if(t.path[0]==="userAPIs"){if(t.path.length===1&&t.type===1)this.addUserAPI(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserAPI(t.id);else if(typeof t.path[1]=="string"){let n=e.userAPIs[t.path[1]];if(n){let r=t.type===0&&t.props.debounce===void 0,s=this.getUserAPI(t.path[1]);s!==void 0&&s===this.openAIRealtime?s.update(n):s?.update(n,this,r)}}}else if(t.path[0]==="userWebhooks"){if(t.path.length===1&&t.type===1)this.addUserWebhook(t.id,t.data);else if(t.path.length===1&&t.type===2)this.deleteUserWebhook(t.id);else if(typeof t.path[1]=="string"){let n=e.userWebhooks[t.path[1]];n&&this.getUserWebhook(t.path[1])?.update(n)}}else t.path[0]==="lib"&&this.updateLibByOp(tr.drop(t,1),i)}updateFont(t,e,i){if(e.props.url){let n=this.getFont(t),r={...this.data.fonts[t],url:e.props.url};n.update(r),n.loadingPromise.then(()=>this.requestRender()),i.updateFont(t,this)}}addUserAPI(t,e){if(this.userAPIs[t])return this.userAPIs[t].update(e,this),!0;if(this.openAIRealtime?.id===t)return this.openAIRealtime.update(e),!0;if(e.integration?.type==="VoiceAssistant"){let i=lP;return i===null?(jn("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=i(e,t,this),!1)}{let i=JL();return i===null?(jn("api-services","a user API integration"),!1):(this.userAPIs[t]=i.createUserAPI(t,e,this),!1)}}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){if(this.userWebhooks[t])return this.userWebhooks[t].update(e),!0;{let i=JL();return i===null?(jn("api-services","a user webhook"),!1):(this.userWebhooks[t]=i.createUserWebhook(t,e),!1)}}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}}).MAX_TRANSIENT_VERTICES=6e4,new Vb(Vs.emptyData())});function jb(t){return T6(t)||t?.isTSLNodeMaterial===!0}function n5(t){return function(e){return e?.isClassicSharedMaterial===!0}(t)||t?.isTSLSharedMaterial===!0}function j8(t){let e=t?.root;return n5(t)||e!==void 0&&n5(e)}var qr,G2,H2,W2,r5,q2,Ro,s5,a5,Qf,vi,dP=z(()=>{I6()}),cd=z(()=>{Xt(),Zn(),Lh(),dP(),Ye(),Dn(),qr=class extends sn{setMaterialOverride(t,e){this.materialOverride=$L(t),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),e.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(t,e,i){if(super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.syncShadowCatcher(i),function(n,r){let s=[];if(r.length!==n.length)return null;{let a=0;for(;a<n.length;){if(r[a]==="*")s.push(n[a]);else if(n[a]!==r[a])return null;a+=1}}return s}(t.path,["materials"])!==null&&t.type===0&&Array.isArray(this.material))for(let[n,r]of Object.entries(t.props)){let s=this.material[Number(n)],a=i.shared.material(r);a!==s&&qr.disposeOneMaterial(s),this.material[Number(n)]=a}else if(ri(t.path,["material"])){let n=this.material;!Array.isArray(n)&&typeof n?.updateByOp=="function"&&"material"in e&&typeof e.material!="string"&&n.updateByOp(tr.drop(t,1),e.material,i)}else if(ri(t.path,["materials","*"])&&Array.isArray(this.material)){let n=t.path[1];if("materials"in e&&n<this.material.length){let r=e.materials[n];typeof r!="string"&&this.material[n].updateByOp(tr.drop(t,2),r,i)}}}get needsAO(){return this.material!==void 0&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(t,e){super.updateState(t,e),t.castShadow!==void 0&&(this.castShadow=t.castShadow),t.receiveShadow!==void 0&&(this.receiveShadow=t.receiveShadow);let i,n=this.dataPatched;this.syncShapeBlendNodeLayer(),this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(i={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let r=this.materialOverride!==void 0;!r&&t.geometry?.type!=="NonParametricGeometry"&&"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe,i),e.scene.markNeedsUpdateRendererDirty()),!r&&(t.geometry?.type==="NonParametricGeometry"||"materials"in t)&&("materials"in t&&t.materials!==void 0?(this.disposeMaterial(),this.material=t.materials.map(a=>e.shared.material(a).getFlavor(n.flatShading,n.side,n.wireframe)),e.scene.markNeedsUpdateRendererDirty()):"material"in t&&t.material!==void 0&&(this.disposeMaterial(),this.material=[e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe)],e.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(!r&&s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=e.shared.material(s.materials[0]).getFlavor(n.flatShading,n.side,n.wireframe)),!r&&(t.flatShading!==void 0||t.wireframe!==void 0||t.side!==void 0))if(Array.isArray(this.material))for(let a=0;a<this.material.length;a++)this.material[a]=this.material[a].getFlavor(n.flatShading,n.side,n.wireframe);else this.material=this.material.getFlavor(n.flatShading,n.side,n.wireframe,i);this.syncShadowCatcher(e)}shadowCatcherActive(){let t=this.dataPatched,e=t.geometry?.type;return t.shadowCatcher===!0&&(e==="RectangleGeometry"||e==="PlaneGeometry")}syncShadowCatcher(t){let e=this.dataPatched;if(this.shadowCatcherActive()){if(this.shadowCatcherMaterial===void 0){let i=VT===void 0?null:$L(VT());if(i===null)return;this.shadowCatcherMaterial=i}this.shadowCatcherMaterial.side=e.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,t.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else this.shadowCatcherMaterial!==void 0&&this.material===this.shadowCatcherMaterial&&(this.materialOverride!==void 0?(this.material=this.materialOverride,t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.material=t.shared.material(e.material).getFlavor(e.flatShading,e.side,e.wireframe),t.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow)}static disposeOneMaterial(t){jb(t)&&!j8(t)&&t.nodeMaterialDispose()}disposeMaterial(){this.material&&BN(this.material).forEach(t=>{qr.disposeOneMaterial(t)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}}}),$r=z(()=>{Xt(),Ye(),cP(),cd(),J(),jx(),Ip(),Lp(),O8(),G2=new T,H2=new ye,W2=new ye,r5=new T,q2=new Et,Ro=new gi,s5=Ro.geometry,a5=Ro.material,Qf=new T,vi=class extends qr{constructor(t,e,i){super(t,e),this.data=e,this.isSkinnedMesh=!1,this.localGeometry=void 0,e.bindMode&&e.bindMatrix&&(this.bindMode=e.bindMode,this.bindMatrix=new Et().fromArray(e.bindMatrix),this.bindMatrixInverse=new Et)}chooseGeoemtryCache(t){return t.geometryCache}supportsInPlaceGeometryUpdate(t){return t.isTextGeometry!==!0}markGeometryAsReachable(t){this.geometryCreateDeleyed instanceof jt&&this.chooseGeoemtryCache(t).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(this.localGeometry===void 0)return this.geometryCreateDeleyed instanceof jt?this.geometryCreateDeleyed:void 0}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Vb){let t=this.geometryCreateDeleyed,e=this.chooseGeoemtryCache(t),i=this.dataPatched.geometry;this.geometryCreateDeleyed=e.get(i,t,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(t){this.localGeometry=t}get is2DAndNoDepth(){let t=this.dataPatched.geometry;return bb.is2DParametricMesh(t.type)&&t.depth===0}get is2DType(){return bb.is2DParametricMesh(this.geometry.userData.type)}get isTextType(){return this.geometry.isTextGeometry===!0}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.updateByPatchedOpGeometry(tr.drop(t,1),e.geometry,i)}removeInteractionGeometry(t){this.localGeometry?.dispose(),this.localGeometry=void 0}dispose(){var t;super.dispose(),t=this.uuid,zb.delete(t),this._posed=void 0}get appliedGeometrySize(){let t=this.localGeometry?.userData;if(t!==void 0&&t.sxPrev!==void 0)return[t.sxPrev,t.syPrev,t.szPrev]}updateGeometryInteractions(t,e){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let n,r,s,a=t;if(this.localGeometry===void 0){let d={...this.data.geometry,...a};this.localGeometry=hh(d,e,this.data.flatShading,this)}a.scaleBaked?[n,r,s]=a.scaleBaked:{width:n,height:r,depth:s}=a;let o=this.localGeometry.userData,l=typeof n=="number"?n:1,c=typeof r=="number"?r:1,h=typeof s=="number"?s:1;o.sxPrev!==void 0&<(this.localGeometry.attributes,l/o.sxPrev,c/o.syPrev,h/o.szPrev),o.sxPrev=l,o.syPrev=c,o.szPrev=h}else if(!this.absorbDepthInteraction(t)){let n=hh(i==="VectorGeometry"?xb.merge(this.data.geometry,t):{...this.data.geometry,...t},e,this.data.flatShading,this);this.localGeometry!==void 0&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&I2(this.localGeometry,n)?n.dispose():(this.localGeometry?.dispose(),this.localGeometry=n)}}absorbDepthInteraction(t){let e=this.localGeometry;if(e?.shiftDepthTo===void 0)return!1;let i=t;if(typeof i.depth!="number")return!1;let n=e.userData?.parameters;if(n===void 0)return!1;for(let r of Object.keys(i))if(r!=="depth"&&i[r]!==n[r])return!1;return!!e.shiftDepthTo(i.depth)&&(n.depth=i.depth,!0)}refreshAttachedClonersInteractions(t){for(let e of this.attachedSurfaceCloners)e.update(t)}refreshAttachedCloners(t){for(let e of this.attachedSurfaceCloners)t.scene.addPendingUpdateCloner(e.object)}refreshAttachedPaths(t){for(let e of this.attachedPaths)t.scene.addPendingCommand(()=>e.updateShape())}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.refreshAttachedCloners(t),this.refreshAttachedPaths(t)}updateByPatchedOpGeometry(t,e,i){let n=!1;if(t.type===0&&t.path.length===0&&Object.keys(t.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Vi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(e,t.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&I8(t.props)&&this.geometryCreateDeleyed instanceof Vi&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(e),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!n&&t.type===0&&t.path.length===0&&this.geometryCreateDeleyed instanceof jt&&!(this.geometryCreateDeleyed instanceof Vi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=i.shared,s=this.chooseGeoemtryCache(r),a=this.geometryCreateDeleyed;if(s.getCached(this._geometryCacheKey)===a&&a.isShared!==!0){let o=this.dataPatched.geometry,l=hh(o,r,this.data.flatShading,this);I2(a,l)?(l.dispose(),a.computeBoundingSphere(),s.mutateIfUnique(this._geometryCacheKey,o)):(l.computeBoundingSphere(),s.forceDelete(this._geometryCacheKey),s.adopt(o,l),this.geometryCreateDeleyed=l),this._geometryCacheKey=o,n=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}n||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(t,e){this.createGeometryDelayed(e)}applyTransientGeometryData(t,e){let i=t.shared,n=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof jt&&!(this.geometryCreateDeleyed instanceof Vi)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&this._geometryCacheKey!==void 0){let r=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(r.getCached(this._geometryCacheKey)===s&&s.isShared!==!0){let a=hh(n,i,this.data.flatShading,this);return I2(s,a)?(a.dispose(),s.computeBoundingSphere(),r.mutateIfUnique(this._geometryCacheKey,n)):(a.computeBoundingSphere(),r.forceDelete(this._geometryCacheKey),r.adopt(n,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=n,this.refreshAttachedCloners(t),void this.refreshAttachedPaths(t)}}e&&this._geometryCacheKey!==void 0&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),t.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(t)}updateState(t,e){t.geometry!==void 0&&this.updateGeometryOnStateUpdate(t.geometry,e);let i=t.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:n,value:r}}of i)this.updateMorphInfluences(n,e.shared.getVariable(r,[this.uuid,"morphTargetInfluences",n]))}super.updateState(t,e)}updateMorphInfluences(t,e){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[t];i!==void 0&&(this.morphTargetInfluences[i]=e)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(t,e){let i=this.posedGeometry()?.boundingBox;if(i)return i.getCenter(t),void i.getSize(e).multiplyScalar(.5);let n=this.geometry.userData.parameters;this.is2DType||this.isTextType?t.set(0,0,.5*n.depth):this.isNonParametric?(t.setScalar(0),this.geometry.boundingSphere&&t.copy(this.geometry.boundingSphere.center),e.set(n.width,n.height,n.depth??0).multiplyScalar(.5)):n.centerOffset?t.fromArray(n.centerOffset):t.setScalar(0),e.set(n.width,n.height,n.depth??0).multiplyScalar(.5)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(t,e){this.skeleton=t,this.isSkinnedMesh=!0,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}rebindSkeleton(t){let e=this.dataPatched,i=e.bones?.map(t),n=this.isSkinnedMesh;if(!i?.length||i.some(r=>!r)||e.boneInverses?.length!==i.length?this.isSkinnedMesh=!1:(this.bindMatrix||(this.bindMatrix=new Et,this.bindMatrixInverse=new Et),this.bindMode=e.bindMode??"attached",e.bindMatrix&&this.bindMatrix.fromArray(e.bindMatrix),this.bind(new qg(i,e.boneInverses.map(r=>new Et().fromArray(r))),this.bindMatrix)),n!==this.isSkinnedMesh)for(let r of Array.isArray(this.material)?this.material:[this.material])r.needsUpdate=!0}normalizeSkinWeights(t){let e=new ye,i=this.geometry.attributes.skinWeight;for(let n=0,r=i.count;n<r;n++){e.fromBufferAttribute(i,n);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),i.setXYZW(n,e.x,e.y,e.z,e.w)}}boneTransform(t,e){let i=this.skeleton;if(i===void 0)return;let n=this.geometry;H2.fromBufferAttribute(n.attributes.skinIndex,t),W2.fromBufferAttribute(n.attributes.skinWeight,t),G2.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){let s=W2.getComponent(r);if(s!==0){let a=H2.getComponent(r);q2.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),e.addScaledVector(r5.copy(G2).applyMatrix4(q2),s)}}return e.applyMatrix4(this.bindMatrixInverse)}raycastDeformed(t,e){let i=this.posedGeometry();if(i===void 0)return!1;Ro.geometry=i,Ro.material=this.material,Ro.matrixWorld.copy(this.matrixWorld);let n=e.length;Ro.raycast(t,e);for(let r=n;r<e.length;r++)e[r].object=this;return Ro.geometry=s5,Ro.material=a5,!0}posedGeometry(){let t=this.skeleton;if(!this.isSkinnedMesh||t===void 0)return;let e=this.geometry,{position:i,skinIndex:n,skinWeight:r}=e.attributes;if(!i||!n||!r)return;let s=[...this.bindMatrix.elements,...this.bindMatrixInverse.elements,...this.morphTargetInfluences??[]];for(let d=0;d<t.bones.length;d++){let u=t.bones[d];if(!u||!t.boneInverses[d])return;s.push(...u.matrixWorld.elements)}let a=this._posed;if(a?.source===e&&a.version===i.version&&a.pose.length===s.length&&a.pose.every((d,u)=>d===s[u]))return a.geometry;let o=i.count,l=a?.geometry.attributes.position,c=l?.count===o?l:new Ht(new Float32Array(3*o),3);for(let d=0;d<o;d++)this.boneTransform(d,this.getVertexPosition(d,Qf)),c.setXYZ(d,Qf.x,Qf.y,Qf.z);let h=new jt;h.setAttribute("position",c);for(let d of["normal","uv","uv1"]){let u=e.attributes[d];u&&h.setAttribute(d,u)}return h.setIndex(e.index),h.groups=e.groups,h.drawRange=e.drawRange,h.computeBoundingSphere(),h.computeBoundingBox(),this._posed={source:e,version:i.version,pose:s,geometry:h},h}}});function ap(t){if(Array.isArray(t.material)){for(let e of t.material)if(e.getLayersOfType("outline").length===0)return}else if(!T6(t.material)||t.material.getLayersOfType("outline").length===0)return;t instanceof vi&&t.is2DAndNoDepth?function(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let i=e.geometry.attributes.position.array,n=new Float32Array(i.length),r=new T;for(let s=0;s<i.length;s+=3)r.set(i[s],i[s+1],i[s+2]).normalize(),n[s]=r.x,n[s+1]=r.y,n[s+2]=r.z;e.geometry.setAttribute("extrudeNormal",new kt(n,3))}(t):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let i=new Map,n=e.geometry.attributes,r=n.position.array,s=n.normal.array,a=new Float32Array(r.length);for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=new T(s[o],s[o+1],s[o+2]);i.has(l)?i.get(l)?.normals.push(c):i.set(l,{normals:[c],result:new T})}i.forEach((o,l)=>{for(let c of o.normals)o.result.add(c);o.result.divideScalar(o.normals.length)});for(let o=0;o<r.length;o+=3){let l=`${r[o]}_${r[o+1]}_${r[o+2]}`,c=i.get(l)?.result;c&&(a[o]=c.x,a[o+1]=c.y,a[o+2]=c.z)}e.geometry.setAttribute("extrudeNormal",new kt(a,3))}(t)}function X2(t){return Math.min(2047,Math.max(1,Math.round(2048*t)))/2048}function op(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes,i=e.position.array,n=e.randomColor;if(n!==void 0&&3*n.count===i.length)return;let r=new Float32Array(i.length),s=parseInt(t.uuid.replace(/\D/g,"")),a=[X2(Pt.seededRandom(s)),X2(Pt.seededRandom(s+1e4)),X2(Pt.seededRandom(s+2e4))];for(let o=0;o<i.length;o++)r[o]=a[o%3];t.geometry.setAttribute("randomColor",new Ht(r,3))}var qx=z(()=>{J(),I6(),$r()});function o5(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}function bK(t,e){let i=t.cloner;return i!==void 0&&i.parent===e?i:void 0}function l5(t,e,i,n){let r=16*(e.children.length+1);tg.length<r&&(tg=new Float32Array(r));let s=0,a=l=>{l.toArray(tg,16*s),s++},o=e.parameters.hideBase!==!0;o&&a(n),HT.copy(t.matrix);for(let l of e.children)!lh(l)||l.playModeVisible===!1||(WT.copy(l.matrix).multiply(l.pivotMatrix),K1.multiplyMatrices(HT,WT),(!o||!K1.equals(n))&&a(K1));try{return s===0?0:function(l,c){return H3(Ob().instanced_union(G3(l),c))}(i,tg.subarray(0,16*s))}finally{M6(i)}}var Oo,h5,HT,WT,K1,tg,xh,S0=z(()=>{Zn(),J(),Fx(),qx(),cd(),Oi(),Oo=new Et,h5=new Et,HT=new Et,WT=new Et,K1=new Et,tg=new Float32Array(0),xh=class extends qr{constructor(t,e,i){super(t,e),this.data=e,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new jt,this.onAfterRender=(n,r,s,a,o,l)=>{super.onAfterRender(n,r,s,a,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&t.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(t,e=!0){if(this.booleanMeshSetAddress!==-1&&!t)return;for(let n=0;n<this.children.length;n++){let r=this.children[n];r instanceof xh&&r.dataPatched.visible===!0&&r.recomputeBoolean(t===!0,e)}this.meshSetAddresses=[];for(let n=0;n<this.children.length;n++){let r=this.children[n];if(r instanceof sn&&r.dataPatched.visible===!0&&r.geometry.attributes.position?.count>0&&r.geometry.drawRange.count>0&&r.booleanMeshSetAddress!==0){Oo.copy(r.matrix).multiply(r.pivotMatrix);try{let s=bK(r,this);if(r.booleanMeshSetAddress===-1){if((r.geometry.index??r.geometry.getAttribute("position")).count/3<15e5){let a=VZ(r.geometry,t===!0);r.booleanMeshSetAddress=s===void 0||a===-1?a:l5(r,s,a,Oo)}if(r.booleanMeshSetAddress===-1)return;s===void 0&&M2(r.booleanMeshSetAddress,Oo),r.booleanMatrixInvOld.copy(Oo).invert(),r.booleanWasTransformed=!1}else r instanceof xh&&r.needsTransformForDownstream===!0?(s===void 0?M2(r.booleanMeshSetAddress,Oo):r.booleanMeshSetAddress=l5(r,s,r.booleanMeshSetAddress,Oo),r.needsTransformForDownstream=!1):r.booleanWasTransformed===!0&&(M2(r.booleanMeshSetAddress,h5.multiplyMatrices(Oo,r.booleanMatrixInvOld)),r.booleanMatrixInvOld.copy(Oo).invert(),r.booleanWasTransformed=!1)}catch(s){console.error(s),r.booleanMeshSetAddress=0,r.geometry.userData.booleanOperationDidFail=!0;continue}if(r.booleanMeshSetAddress===0)continue;this.meshSetAddresses.push(r.booleanMeshSetAddress),r.geometry.userData.booleanOperationDidFail=!1}}if(this.meshSetAddresses.length===0){if(this.geometry.getAttribute("position")?.array.length!==0){let n=this.geometry;n.dispose(),this.geometry=new jt,this.geometry.userData=n.userData,this.geometry.boundingSphere=n.boundingSphere,this.geometry.setAttribute("position",new kt([],3))}return void this.geometry.setDrawRange(0,0)}if(t===!0)return function(n,r){let s=Ob(),a=K4(n,r),o=s.mesh_topological_data(a),l=o.positions(),c=o.indices();return o.free(),a.free(),{positions:l,indices:c,verticesPerFace:new Uint8Array(c.length/3).fill(3)}}(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new jt,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=function(n,r,s,a){let o=Ob(),l=K4(n,r),c=o.mesh_render_data(l,Math.max(a,0));if(s.setAttribute("position",new kt(c.positions(),3)),s.setAttribute("normal",new kt(c.normals(),3)),c.free(),s.boundingSphere===null&&(s.boundingSphere=new vr),l.tri_count()===0)s.boundingSphere.center.set(0,0,0),s.boundingSphere.radius=0,s.userData.parameters={width:0,height:0,depth:0};else{let h=l.bounds();s.boundingSphere.center.set(h[0],h[1],h[2]),s.boundingSphere.radius=(h[3]**2+h[4]**2+h[5]**2)**.5,s.userData.parameters={width:2*h[3],height:2*h[4],depth:2*h[5]}}return H3(l)}(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(n){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(n)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,ap(this),op(this)}dispose(){super.dispose(),this.geometry.dispose()}}});function xK(t){return t.isPointLight?Q1.PointLight:t.isSpotLight?Q1.SpotLight:Q1.DirectionalLight}function c5(t){return t.isDirectionalLight?0:t.isSpotLight?1:2}var Q1,Dg,Dc,Gb,Xx,ma,ro,Hb,G8=z(()=>{Q1={PointLight:1,SpotLight:3,DirectionalLight:3},Dg=new WeakSet,Dc=[]}),M0=z(()=>{J(),G8(),Xr(),hd(),(Gb||(Gb={})).is=function(t){return Ie.is(t)&&t instanceof Pu},Xx=(t,e)=>class extends ld(t,e){updateState_Light(i,n){if(this.updateState_Entity(i,n),i.color!==void 0&&(this.color=n.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity*Math.PI),i.depth!==void 0){let r=this.shadow;r.camera.far=i.depth,r.needsUpdate=!0}i.shadows!==void 0&&(function(r){Dg.delete(r)}(this),this.castShadow=i.shadows)}}}),Bh=z(()=>{S0(),Zn(),hd(),ma=t=>t instanceof sn,ro=t=>t!==null&&t instanceof xh,Hb=t=>gT.is(t)});function fr(t,e){return e.color(t)}function d5(t=new Date,e){let i=e.format,n=t.getSeconds(),r=t;e&&e.timeZone!==null&&(r=function(d,u){try{let p=new Intl.DateTimeFormat("en-US",{timeZone:u,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}).formatToParts(d),f=g=>Number(p.find(m=>m.type===g)?.value);return new Date(f("year"),f("month")-1,f("day"),f("hour"),f("minute"),f("second"),d.getMilliseconds())}catch{return new Date(NaN)}}(new Date,e.timeZone));let s,a=r.getHours(),o=r.getMinutes();e.format12h24h==="12ampm"&&(s=a>=12?"PM":"AM");let l,c,h=a;switch(e.format12h24h!=="24"&&(h=a%12,h===0&&(h=12)),i){case"HH:mm:ss":l=[h,o,n];break;case"HH:mm":l=[h,o];break;case"HH":l=[h],s=void 0;break;case"mm":l=[o],s=void 0;break;case"ss":l=[n],s=void 0;break;case"year":c=r.getFullYear();break;case"month":c=r.getMonth()+1;break;case"dayOfYear":c=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":c=r.getDate();break;case"secondOfDay":c=60*a*60+60*o+n;break;default:console.error("Unknown time format",i),c=0}return l!==void 0?{textValue:l,suffix:s}:c}var qT,E0,uP=z(()=>{}),wK=z(()=>{J(),_0(),b0(),qT=class extends Pp(iN){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){Dp(this.object,qT.geometryHelper,t,e)}}}),pP=z(()=>{J(),wK(),M0(),E0=class extends Xx(QF,qT){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=-1e4,n.far=2500;let r=new $g(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof $g&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;t.size!==void 0&&function(n,r){n.shadow.camera.right=r/2,n.shadow.camera.left=-r/2,n.shadow.camera.top=r/2,n.shadow.camera.bottom=-r/2,n.shadow.needsUpdate=!0}(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),i&&this.update()}}});function fP(t){return t instanceof qr&&t.needsAO&&!pl(t)&&t.isDecalObject!==!0}function mP(t){let e=t.cloner;if(e&&Array.isArray(e.children))for(let i of e.children)i?.layers&&(i.layers.mask=t.layers.mask)}function gP(t){return t.getLayersOfType("reflection").filter(e=>e.data.visible).length}function u5(t,e){let i={outline:!1,cavity:!1},n=t.layers.mask&$x,r=e.getLayersOfType("transmission"),s=e.getLayersOfType("outline"),a=gP(e),o=e.getLayersOfType("cavity");return(s.length>0||o.length>0)&&(t.layers.set(8),r.length>0&&t.layers.enable(3),a>0&&t.layers.enable(4),i.outline=s.length>0,i.cavity=o.length>0,op(t),ap(t)),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),n&&t.layers.set(9),!n&&fP(t)&&t.layers.enable(5),mP(t),i}function p5(t,e){if(!e.layers)return!1;let i=t.layers.mask&$x,n=!1,r=e.getLayersOfType("transmission").filter(l=>l.data.visible),s=e.getLayersOfType("outline").filter(l=>l.data.visible),a=gP(e),o=e.getLayersOfType("cavity").filter(l=>l.data.visible);return r.length>0&&(t.layers.set(3),(s.length>0||o.length>0)&&t.layers.enable(8),a>0&&t.layers.enable(4),n=!0),r.length===0&&s.length===0&&o.length===0&&a===0&&t.layers.set(0),i&&t.layers.set(9),!i&&fP(t)&&t.layers.enable(5),mP(t),n}function f5(t,e){var i;if(!e.layers)return!1;let n=t.layers.mask&$x,r=!1,s=gP(e),a=e.getLayersOfType("transmission").filter(c=>c.data.visible),o=e.getLayersOfType("outline").filter(c=>c.data.visible),l=e.getLayersOfType("cavity").filter(c=>c.data.visible);return s>0&&((i=t.userData).__splinePlanarMirror??(i.__splinePlanarMirror=0),t.layers.set(4),a.length>0&&t.layers.enable(3),(o.length>0||l.length>0)&&t.layers.enable(8),r=!0),s===0&&a.length===0&&o.length===0&&l.length===0&&t.layers.set(0),n&&t.layers.set(9),!n&&fP(t)&&t.layers.enable(5),mP(t),r}function XT(t,e,i,n=!1){let r=t.cloner;if(r){let s=null;if((t.raycast===gi.prototype.raycast||t.raycast===sn.prototype.raycast)&&t.isSkinnedMesh!==!0){let a=t.geometry;a&&(a.boundingSphere===null&&a.computeBoundingSphere(),s=a.boundingSphere)}for(let a of r.children){if(s!==null&&($T.copy(s).applyMatrix4(a.matrixWorld),!e.ray.intersectsSphere($T)))continue;let o=W8.copy(a.matrixWorld).invert(),l=q8.copy(e.ray).applyMatrix4(o),c=t.matrixWorld;l.applyMatrix4(c);let h=H8;h.set(l.origin,l.direction),h.near=e.near,h.far=e.far,h.layers.mask=e.layers.mask;let d=h.intersectObject(t,!1);d.length>0&&i.push({...d[0],object:n?a:t})}}}var $x,H8,W8,q8,$T,sy,X8,$2,Y2,Z2,A0,Si,$8=z(()=>{Oi(),qx(),Zn(),cd(),J(),$x=512,H8=new xx,W8=new Et,q8=new il,$T=new vr}),SK=z(()=>{J(),_0(),b0(),sy=class extends Pp(tN){constructor(t,e=6710886){super(t,e),this.object=t,this.matrix=t.matrixWorld,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){Dp(this.object,sy.geometryHelper,t,e)}update(){if(this.object!==void 0){let t=sy._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let r=0,s=this.cone.material.length;r<s;r++)this.cone.material[r].color.set(n);else this.cone.material.color.set(n)}}},(X8=sy)._vector=new T}),vP=z(()=>{J(),SK(),M0(),$2=new T,Y2=new T,Z2=new qt,A0=class extends Xx(ZF,X8){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=2*Pt.RAD2DEG*this.angle,n.aspect=1,n.near=100,n.far=2500;let r=new $g(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof $g&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),Y2.setFromMatrixPosition(this.matrixWorld),Z2.setFromRotationMatrix(this.matrixWorld),$2.copy(this.up).applyQuaternion(Z2).negate().multiplyScalar(this.distance),this.target.position.copy(Y2).add($2),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.penumbraSize!==void 0&&e.scene.markPenumbraSizeDirty(),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}}),$s=z(()=>{Xt(),Xs(),J(),Xr(),ba(),uP(),po(),pP(),Ye(),Lh(),J(),cd(),Bh(),$8(),vP(),ke(),S0(),Si=class extends Ux(as){constructor(t,e,i){if(super(),this.data=e,this.bgColor=new _n(1,1,1,1),this.fog=null,this.backupFog=new ZE(16777215,.1,2e3),this.fogUseBGColor=!1,this.fogMode="linear",this.fogDensity=er.getDensity({}),this.fogHeightFalloff=er.getHeightFalloff({}),this.fogHeightBase=er.getHeightBase({}),this.isActive=!1,this.skyState=null,this.skyStateVersion=0,this.gradingState=null,this.skyHdriHolder=null,this.aoColor=new Jt,this.penumbraSizeArrayCache=null,this.super_Entity(t,e),this.personalCamera=new Ki(od,{...Sg.defaultData,...e.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new YF(13882323,8553090,.75*Math.PI),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),e.uiScene){let n=cT();n===null?jn("ui-2d","a page's 2D scene"):this.uiScene=new n.Scene2D((Array.isArray(t)?t[0]:t)+"-ui",e.uiScene,{dpr:window.devicePixelRatio,shared:i.shared})}else e.uiFrame&&this.createUICanvas(e.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(t,e){let i=cT();i!==null?(this.uiCanvas=new i.UICanvas(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,e),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(t),this.uiCanvas?.applySize()})):jn("ui-2d","a page's UI canvas")}updateVisible(){}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(t,e){t.color!==void 0&&(this.ambientLight.color=fr(t.color,e)),t.intensity!==void 0&&(this.ambientLight.intensity=t.intensity*Math.PI),t.enabled!==void 0&&(t.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(t){this.isActive=!0,t.fog=this.fog,this.traverseEntity(e=>{e instanceof xh&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(t=>{if(t instanceof qr)if(Array.isArray(t.material))for(let e of t.material)e.needsUpdate=!0;else t.material.needsUpdate=!0,t.material.dispose()})}updateShadow(t){if(t.softShadowQuality===void 0&&t.type===void 0||!this.isActive)return;let e=this.data.shadow;var i,n;i=wg.isSoft(e),n=e?.softShadowQuality,jT!==void 0&&jT(i,n)&&this.forceMaterialsUpdate()}updateFog(t,e){t.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=fr(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far,this.fogMode=er.getMode(t),this.fogDensity=er.getDensity(t),this.fogHeightFalloff=er.getHeightFalloff(t),this.fogHeightBase=er.getHeightBase(t)}updateSky(t,e){this.skyState=t??null,this.skyStateVersion++;let i=t?.hdri?.image;this.skyHdriHolder=i!=null?e.image(i):null}updateAo(t,e){t.aoColor!==void 0&&(this.aoColor=fr(t.aoColor,e))}updateByOp(t,e,i,n){let r=this.data.uiFrame;super.updateByOp(t,e,i,n);let s=e;ri(t.path,["fog"])?this.updateFog(s.fog,i.shared):ri(t.path,["sky"])?this.updateSky(s.sky,i.shared):ri(t.path,["grading"])?this.gradingState=s.grading??null:ri(t.path,["ao"])?this.updateAo(s.ao,i.shared):ri(t.path,["ambient"])?this.updateAmbientLight(s.ambient,i.shared):ri(t.path,["shadow"])?this.updateShadow(s.shadow):t.type===0&&t.path.length===0&&(t.props.uiFrame!==void 0||r!==s.uiFrame)&&this.updateUIFrame(t.props.uiFrame,i)}updateUIFrame(t,e){t?(this.uiCanvas||this.createUICanvas(t,e),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(t)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(t,e){this.updateState_Entity(t,e),t.backgroundColor!==void 0&&this.setBackgroundColor(fr(t.backgroundColor,e.shared)),t.fog!==void 0&&this.updateFog(t.fog,e.shared),t.sky!==void 0&&this.updateSky(t.sky,e.shared),t.grading!==void 0&&(this.gradingState=t.grading),t.ambient!==void 0&&this.updateAmbientLight(t.ambient,e.shared),t.ao!==void 0&&this.updateAo(t.ao,e.shared),t.shadow!==void 0&&this.updateShadow(t.shadow)}createFrame(t,e){}raycast(t,e){super.raycast(t,e)}switchActiveCamera(t){t instanceof Ki&&t.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1)}get playCamera(){let t=this.scene?.find(this.data.publish.playCamera);return t instanceof Ki?t:this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(ul).fill(.5);let t=0,e=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof E0&&i.visible&&t<Eg&&(this.penumbraSizeArrayCache[t]=i.data.penumbraSize??.5,t+=1),i instanceof A0&&i.visible&&t<ul-Eg&&(this.penumbraSizeArrayCache[Eg+e]=i.data.penumbraSize??.5,e+=1)})}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let s=r.cloner;Ie.is(r)&&(r.visible||s?.object.data.visible)&&((ma(r)||Hb(r)&&this.scene.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),XT(r,t,e,!0)),i(r))}};return i(this),e}updateEntity2DByOp(t,e,i,n){this.uiCanvas?.updateEntity2DByOp(t,e,i,n)}}});function m5(){return Y8}function K2(){if(Wb===null)throw new Error('[spe] Classic (WebGL) particles are not available in this build \u2014 it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return Wb}function Q2(t){return t?.isWebGPUSplineRenderer===!0}var Y8,Wb,lp,Z8=z(()=>{Y8=null,Wb=null}),yP=z(()=>{J(),Ox(),hd(),lp=class extends ld(Tp,wp){constructor(t,e,i){super(),this.super_Entity(t,e),this.context=i,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}}}),MK=Ep((t,e)=>{var i,n;i=t,n=function(){return r.importState=function(s){var a=new r;return a.importState(s),a},r;function r(){return function(s){var a=0,o=0,l=0,c=1;s.length==0&&(s=[+new Date]);var h=function(){var p=4022871197,f=function(g){g=g.toString();for(var m=0;m<g.length;m++){var v=.02519603282416938*(p+=g.charCodeAt(m));v-=p=v>>>0,p=(v*=p)>>>0,p+=4294967296*(v-=p)}return 23283064365386963e-26*(p>>>0)};return f.version="Mash 0.9",f}();a=h(" "),o=h(" "),l=h(" ");for(var d=0;d<s.length;d++)(a-=h(s[d]))<0&&(a+=1),(o-=h(s[d]))<0&&(o+=1),(l-=h(s[d]))<0&&(l+=1);h=null;var u=function(){var p=2091639*a+23283064365386963e-26*c;return a=o,o=l,l=p-(c=0|p)};return u.next=u,u.uint32=function(){return 4294967296*u()},u.fract53=function(){return u()+11102230246251565e-32*(2097152*u()|0)},u.version="Alea 0.9",u.args=s,u.exportState=function(){return[a,o,l,c]},u.importState=function(p){a=+p[0]||0,o=+p[1]||0,l=+p[2]||0,c=+p[3]||0},u}(Array.prototype.slice.call(arguments))}},typeof t=="object"?e.exports=n():typeof define=="function"&&define.amd?define(n):i.Alea=n()});function EK(t){let e=!1;return t.scene.objects.traverse((i,n)=>{n.type==="Mesh"&&n.geometry.type==="SubdivGeometry"&&(e=!0)}),e}var na,Zd,Mp,T0=z(()=>{Zn(),J(),Lp(),qx(),$r(),na=new hi,Zd=new T,Mp=class extends vi{constructor(t,e,i){super(t,e,i),this.data=e,this.smoothShading=!0,this.skipReactionUpdate=!1,this.shearCompensationIsActive=!1}chooseGeoemtryCache(t){return this.dataPatched.flatShading?t.geometryCache:t.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(t,e){let i=this.geometry.userData.parameters;t.copy(this.originalGeometryNew.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:n,subdivPointer:r}=Vi.build(t,this.subdivPointer,this.smoothShading,this.shearScale);this.subdivPointer=r,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),n!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=n??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ap(this),op(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}updateState(t,e){if(super.updateState(t,e),t.flatShading!==void 0){let i=this.material;this.material=Array.isArray(i)?i.map(n=>n.getFlavor(!1,n.side,n.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!t.flatShading,this.createGeometryDelayed(e)}}updateMesh(t=!1,e=!1,i=!1){e&&this.subdividedGeometry||Vi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t?this.shearScaleInv:void 0,i),this.subdividedGeometry&&Vi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t?this.shearScaleInv:void 0)}updateTopology(){let t=this.localGeometry?.uuid;this.originalGeometry.dispose(),this.originalGeometry=Vi.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Vi.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ap(this),op(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}raycast(t,e){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,sn.prototype.raycast.call(this,t,e),this.localGeometry=i}activateShearCompensation(){this.shearCompensationIsActive=!0,this.matrixWorld.copy(this.matrixWorldRigid)}deactivateShearCompensation(){this.shearCompensationIsActive=!1,this.updateMatrixWorld(!0)}updateMatrixWorld(t){this.shearCompensationIsActive!==!0&&super.updateMatrixWorld(t)}updateWorldMatrix(t,e){this.shearCompensationIsActive!==!0&&super.updateWorldMatrix(t,e)}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new vr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;na.setFromBufferAttribute(e),na.getCenter(i),t.boundingSphere.radius=i.distanceTo(na.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),na.getSize(Zd),Zd.divide(this.scale);let n={width:Zd.x,height:Zd.y,depth:Zd.z};return this.geometry.userData.parameters=n,n}updateBoundingSphere(t){let e=this.originalGeometry;na.min.set(t[0],t[2],t[4]),na.max.set(t[1],t[3],t[5]),na.min.applyMatrix4(this.shearScaleInv),na.max.applyMatrix4(this.shearScaleInv),e.boundingSphere===null&&(e.boundingSphere=new vr);let i=e.boundingSphere.center;na.getCenter(i),e.boundingSphere.radius=i.distanceTo(na.max)}freeSubdivPointer(){this.subdivPointer&&(Vi.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateSubdivisionLevel(t){if(this.skipReactionUpdate===!0)return;let e=this.localGeometry,i=e?.uuid,n=e?.userData.parameters,r=t.subdivisions>0?Vi.buildRefined(this.subdivPointer,t.subdivisions,this.smoothShading?t.phongAngle??35:-1):null;this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0,this.subdividedGeometry&&this.originalGeometry.boundingSphere&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere),this.localGeometry=this.subdividedGeometry??this.originalGeometry,ap(this),op(this),n!==void 0&&(this.localGeometry.userData.parameters=n),i&&(this.localGeometry.uuid=i)}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),this.localGeometry&&(t.type===0&&t.path.length===0&&I8(t.props)&&this.subdivPointer?this.updateSubdivisionLevel(e):this.createGeometryByControls(e))}}});function _P(t){if(t.component){let e=t.component.instances.indexOf(t);e>=0&&t.component.instances.splice(e,1);for(let i of t.children)Ie.is(i)&&_P(i)}}var Rg,YT,Yx,K8=z(()=>{Xr()}),AK=Ep((t,e)=>{function i(n,r,s,a){this.message=n,this.expected=r,this.found=s,this.location=a,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,i)}(function(n,r){function s(){this.constructor=n}s.prototype=r.prototype,n.prototype=new s})(i,Error),i.buildMessage=function(n,r){var s,a={literal:function(d){return'"'+l(d.text)+'"'},class:function(d){var u,p="";for(u=0;u<d.parts.length;u++)p+=d.parts[u]instanceof Array?c(d.parts[u][0])+"-"+c(d.parts[u][1]):c(d.parts[u]);return"["+(d.inverted?"^":"")+p+"]"},any:function(d){return"any character"},end:function(d){return"end of input"},other:function(d){return d.description}};function o(d){return d.charCodeAt(0).toString(16).toUpperCase()}function l(d){return d.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function c(d){return d.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+o(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+o(u)})}function h(d){return a[d.type](d)}return"Expected "+function(d){var u,p,f=new Array(d.length);for(u=0;u<d.length;u++)f[u]=h(d[u]);if(f.sort(),f.length>0){for(u=1,p=1;u<f.length;u++)f[u-1]!==f[u]&&(f[p]=f[u],p++);f.length=p}switch(f.length){case 1:return f[0];case 2:return f[0]+" or "+f[1];default:return f.slice(0,-1).join(", ")+", or "+f[f.length-1]}}(n)+" but "+((s=r)?'"'+l(s)+'"':"end of input")+" found."},e.exports={SyntaxError:i,parse:function(n,r){r=r!==void 0?r:{};var s,a={},o={svg_path:Pe},l=Pe,c=function(Q){if(!Q)return[];for(var At=[],lt=0;lt<Q.length;lt++)At=At.concat.apply(At,Q[lt]);var xt=At[0];return xt&&xt.code=="m"&&(delete xt.relative,xt.code="M"),At},h=function(Q,At){return function(lt,xt){if(!xt)return[lt];for(var Ot=[lt],I=0,nt=xt.length;I<nt;I++)Ot[I+1]=xt[I][1];return Ot}(Q,At)},d=/^[Mm]/,u=be(["M","m"],!1,!1),p=function(Q,At,lt){var xt=vo(Q,[At]);return lt&&(xt=xt.concat(vo(Q=="M"?"L":"l",lt[1]))),xt},f=/^[Zz]/,g=be(["Z","z"],!1,!1),m=function(){return vo("Z")},v=/^[Ll]/,y=be(["L","l"],!1,!1),_=function(Q,At){return vo(Q,At)},b=/^[Hh]/,x=be(["H","h"],!1,!1),w=function(Q,At){return vo(Q,At.map(function(lt){return{x:lt}}))},S=/^[Vv]/,E=be(["V","v"],!1,!1),A=function(Q,At){return vo(Q,At.map(function(lt){return{y:lt}}))},P=/^[Cc]/,C=be(["C","c"],!1,!1),R=function(Q,At,lt){return{x1:Q.x,y1:Q.y,x2:At.x,y2:At.y,x:lt.x,y:lt.y}},O=/^[Ss]/,D=be(["S","s"],!1,!1),F=function(Q,At){return{x2:Q.x,y2:Q.y,x:At.x,y:At.y}},V=/^[Qq]/,U=be(["Q","q"],!1,!1),j=function(Q,At){return{x1:Q.x,y1:Q.y,x:At.x,y:At.y}},q=/^[Tt]/,rt=be(["T","t"],!1,!1),it=/^[Aa]/,Y=be(["A","a"],!1,!1),ht=function(Q,At,lt,xt,Ot,I){return{rx:Q,ry:At,xAxisRotation:lt,largeArc:xt,sweep:Ot,x:I.x,y:I.y}},ot=function(Q,At){return{x:Q,y:At}},ft=function(Q){return 1*Q},pt=function(Q){return 1*Q.join("")},tt=/^[01]/,mt=be(["0","1"],!1,!1),N=function(Q){return Q=="1"},L=function(){return""},H=",",$=_e(",",!1),B=function(Q){return Q.join("")},Z=".",K=_e(".",!1),k=/^[eE]/,st=be(["e","E"],!1,!1),dt=/^[+\-]/,bt=be(["+","-"],!1,!1),ct=/^[0-9]/,It=be([["0","9"]],!1,!1),St=function(Q){return Q.join("")},Rt=/^[ \t\n\r]/,Mt=be([" "," ",`
|
|
4193
4213
|
`,"\r"],!1,!1),W=0,_t=[{line:1,column:1}],Dt=0,Gt=[],Ft=0;if("startRule"in r){if(!(r.startRule in o))throw new Error(`Can't start parsing from rule "`+r.startRule+'".');l=o[r.startRule]}function _e(Q,At){return{type:"literal",text:Q,ignoreCase:At}}function be(Q,At,lt){return{type:"class",parts:Q,inverted:At,ignoreCase:lt}}function Gi(Q){var At,lt=_t[Q];if(lt)return lt;for(At=Q-1;!_t[At];)At--;for(lt={line:(lt=_t[At]).line,column:lt.column};At<Q;)n.charCodeAt(At)===10?(lt.line++,lt.column=1):lt.column++,At++;return _t[Q]=lt,lt}function oe(Q,At){var lt=Gi(Q),xt=Gi(At);return{start:{offset:Q,line:lt.line,column:lt.column},end:{offset:At,line:xt.line,column:xt.column}}}function le(Q){W<Dt||(W>Dt&&(Dt=W,Gt=[]),Gt.push(Q))}function Pe(){var Q,At,lt,xt,Ot;for(Q=W,At=[],lt=Le();lt!==a;)At.push(lt),lt=Le();if(At!==a)if(lt=function(){var I,nt,vt,wt,at,yt;if(I=W,(nt=si())!==a){for(vt=[],wt=W,at=[],yt=Le();yt!==a;)at.push(yt),yt=Le();for(at!==a&&(yt=si())!==a?wt=at=[at,yt]:(W=wt,wt=a);wt!==a;){for(vt.push(wt),wt=W,at=[],yt=Le();yt!==a;)at.push(yt),yt=Le();at!==a&&(yt=si())!==a?wt=at=[at,yt]:(W=wt,wt=a)}vt!==a?I=nt=h(nt,vt):(W=I,I=a)}else W=I,I=a;return I}(),lt===a&&(lt=null),lt!==a){for(xt=[],Ot=Le();Ot!==a;)xt.push(Ot),Ot=Le();xt!==a?Q=At=c(lt):(W=Q,Q=a)}else W=Q,Q=a;else W=Q,Q=a;return Q}function si(){var Q,At,lt,xt,Ot,I;if(Q=W,At=function(){var nt,vt,wt,at,yt,Lt,Yt;if(nt=W,d.test(n.charAt(W))?(vt=n.charAt(W),W++):(vt=a,Ft===0&&le(u)),vt!==a){for(wt=[],at=Le();at!==a;)wt.push(at),at=Le();wt!==a&&(at=xn())!==a?(yt=W,(Lt=xe())===a&&(Lt=null),Lt!==a&&(Yt=Pi())!==a?yt=Lt=[Lt,Yt]:(W=yt,yt=a),yt===a&&(yt=null),yt!==a?nt=vt=p(vt,at,yt):(W=nt,nt=a)):(W=nt,nt=a)}else W=nt,nt=a;return nt}(),At!==a){for(lt=[],xt=W,Ot=[],I=Le();I!==a;)Ot.push(I),I=Le();for(Ot!==a&&(I=ze())!==a?xt=Ot=[Ot,I]:(W=xt,xt=a);xt!==a;){for(lt.push(xt),xt=W,Ot=[],I=Le();I!==a;)Ot.push(I),I=Le();Ot!==a&&(I=ze())!==a?xt=Ot=[Ot,I]:(W=xt,xt=a)}lt!==a?Q=At=h(At,lt):(W=Q,Q=a)}else W=Q,Q=a;return Q}function ze(){var Q,At;return f.test(n.charAt(W))?(At=n.charAt(W),W++):(At=a,Ft===0&&le(g)),At!==a&&(At=m()),(Q=At)===a&&(Q=function(){var lt,xt,Ot,I;if(lt=W,v.test(n.charAt(W))?(xt=n.charAt(W),W++):(xt=a,Ft===0&&le(y)),xt!==a){for(Ot=[],I=Le();I!==a;)Ot.push(I),I=Le();Ot!==a&&(I=Pi())!==a?lt=xt=_(xt,I):(W=lt,lt=a)}else W=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Ot,I;if(lt=W,b.test(n.charAt(W))?(xt=n.charAt(W),W++):(xt=a,Ft===0&&le(x)),xt!==a){for(Ot=[],I=Le();I!==a;)Ot.push(I),I=Le();Ot!==a&&(I=ui())!==a?lt=xt=w(xt,I):(W=lt,lt=a)}else W=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Ot,I;if(lt=W,S.test(n.charAt(W))?(xt=n.charAt(W),W++):(xt=a,Ft===0&&le(E)),xt!==a){for(Ot=[],I=Le();I!==a;)Ot.push(I),I=Le();Ot!==a&&(I=ui())!==a?lt=xt=A(xt,I):(W=lt,lt=a)}else W=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Ot,I;if(lt=W,P.test(n.charAt(W))?(xt=n.charAt(W),W++):(xt=a,Ft===0&&le(C)),xt!==a){for(Ot=[],I=Le();I!==a;)Ot.push(I),I=Le();Ot!==a?(I=function(){var nt,vt,wt,at,yt,Lt;if(nt=W,(vt=on())!==a){for(wt=[],at=W,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=on())!==a?at=yt=[yt,Lt]:(W=at,at=a);at!==a;)wt.push(at),at=W,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=on())!==a?at=yt=[yt,Lt]:(W=at,at=a);wt!==a?nt=vt=h(vt,wt):(W=nt,nt=a)}else W=nt,nt=a;return nt}(),I!==a?lt=xt=_(xt,I):(W=lt,lt=a)):(W=lt,lt=a)}else W=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Ot,I;if(lt=W,O.test(n.charAt(W))?(xt=n.charAt(W),W++):(xt=a,Ft===0&&le(D)),xt!==a){for(Ot=[],I=Le();I!==a;)Ot.push(I),I=Le();Ot!==a?(I=function(){var nt,vt,wt,at,yt,Lt;if(nt=W,(vt=Jr())!==a){for(wt=[],at=W,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=Jr())!==a?at=yt=[yt,Lt]:(W=at,at=a);at!==a;)wt.push(at),at=W,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=Jr())!==a?at=yt=[yt,Lt]:(W=at,at=a);wt!==a?nt=vt=h(vt,wt):(W=nt,nt=a)}else W=nt,nt=a;return nt}(),I!==a?lt=xt=_(xt,I):(W=lt,lt=a)):(W=lt,lt=a)}else W=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Ot,I;if(lt=W,V.test(n.charAt(W))?(xt=n.charAt(W),W++):(xt=a,Ft===0&&le(U)),xt!==a){for(Ot=[],I=Le();I!==a;)Ot.push(I),I=Le();Ot!==a?(I=function(){var nt,vt,wt,at,yt,Lt;if(nt=W,(vt=bn())!==a){for(wt=[],at=W,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=bn())!==a?at=yt=[yt,Lt]:(W=at,at=a);at!==a;)wt.push(at),at=W,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=bn())!==a?at=yt=[yt,Lt]:(W=at,at=a);wt!==a?nt=vt=h(vt,wt):(W=nt,nt=a)}else W=nt,nt=a;return nt}(),I!==a?lt=xt=_(xt,I):(W=lt,lt=a)):(W=lt,lt=a)}else W=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Ot,I;if(lt=W,q.test(n.charAt(W))?(xt=n.charAt(W),W++):(xt=a,Ft===0&&le(rt)),xt!==a){for(Ot=[],I=Le();I!==a;)Ot.push(I),I=Le();Ot!==a?(I=function(){var nt,vt,wt,at,yt,Lt;if(nt=W,(vt=xn())!==a){for(wt=[],at=W,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=xn())!==a?at=yt=[yt,Lt]:(W=at,at=a);at!==a;)wt.push(at),at=W,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=xn())!==a?at=yt=[yt,Lt]:(W=at,at=a);wt!==a?nt=vt=h(vt,wt):(W=nt,nt=a)}else W=nt,nt=a;return nt}(),I!==a?lt=xt=_(xt,I):(W=lt,lt=a)):(W=lt,lt=a)}else W=lt,lt=a;return lt}())===a&&(Q=function(){var lt,xt,Ot,I;if(lt=W,it.test(n.charAt(W))?(xt=n.charAt(W),W++):(xt=a,Ft===0&&le(Y)),xt!==a){for(Ot=[],I=Le();I!==a;)Ot.push(I),I=Le();Ot!==a?(I=function(){var nt,vt,wt,at,yt,Lt;if(nt=W,(vt=ts())!==a){for(wt=[],at=W,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=ts())!==a?at=yt=[yt,Lt]:(W=at,at=a);at!==a;)wt.push(at),at=W,(yt=xe())===a&&(yt=null),yt!==a&&(Lt=ts())!==a?at=yt=[yt,Lt]:(W=at,at=a);wt!==a?nt=vt=h(vt,wt):(W=nt,nt=a)}else W=nt,nt=a;return nt}(),I!==a?lt=xt=_(xt,I):(W=lt,lt=a)):(W=lt,lt=a)}else W=lt,lt=a;return lt}()),Q}function Pi(){var Q,At,lt,xt,Ot,I;if(Q=W,(At=xn())!==a){for(lt=[],xt=W,(Ot=xe())===a&&(Ot=null),Ot!==a&&(I=xn())!==a?xt=Ot=[Ot,I]:(W=xt,xt=a);xt!==a;)lt.push(xt),xt=W,(Ot=xe())===a&&(Ot=null),Ot!==a&&(I=xn())!==a?xt=Ot=[Ot,I]:(W=xt,xt=a);lt!==a?Q=At=h(At,lt):(W=Q,Q=a)}else W=Q,Q=a;return Q}function ui(){var Q,At,lt,xt,Ot,I;if(Q=W,(At=go())!==a){for(lt=[],xt=W,(Ot=xe())===a&&(Ot=null),Ot!==a&&(I=go())!==a?xt=Ot=[Ot,I]:(W=xt,xt=a);xt!==a;)lt.push(xt),xt=W,(Ot=xe())===a&&(Ot=null),Ot!==a&&(I=go())!==a?xt=Ot=[Ot,I]:(W=xt,xt=a);lt!==a?Q=At=h(At,lt):(W=Q,Q=a)}else W=Q,Q=a;return Q}function on(){var Q,At,lt,xt,Ot,I;return Q=W,(At=xn())!==a?((lt=xe())===a&&(lt=null),lt!==a&&(xt=xn())!==a?((Ot=xe())===a&&(Ot=null),Ot!==a&&(I=xn())!==a?Q=At=R(At,xt,I):(W=Q,Q=a)):(W=Q,Q=a)):(W=Q,Q=a),Q}function Jr(){var Q,At,lt,xt;return Q=W,(At=xn())!==a?((lt=xe())===a&&(lt=null),lt!==a&&(xt=xn())!==a?Q=At=F(At,xt):(W=Q,Q=a)):(W=Q,Q=a),Q}function bn(){var Q,At,lt,xt;return Q=W,(At=xn())!==a?((lt=xe())===a&&(lt=null),lt!==a&&(xt=xn())!==a?Q=At=j(At,xt):(W=Q,Q=a)):(W=Q,Q=a),Q}function ts(){var Q,At,lt,xt,Ot,I,nt,vt,wt,at,yt;return Q=W,(At=gt())!==a?((lt=xe())===a&&(lt=null),lt!==a&&(xt=gt())!==a?((Ot=xe())===a&&(Ot=null),Ot!==a&&(I=go())!==a&&xe()!==a&&(nt=Wp())!==a?((vt=xe())===a&&(vt=null),vt!==a&&(wt=Wp())!==a?((at=xe())===a&&(at=null),at!==a&&(yt=xn())!==a?Q=At=ht(At,xt,I,nt,wt,yt):(W=Q,Q=a)):(W=Q,Q=a)):(W=Q,Q=a)):(W=Q,Q=a)):(W=Q,Q=a),Q}function xn(){var Q,At,lt,xt;return Q=W,(At=go())!==a?((lt=xe())===a&&(lt=null),lt!==a&&(xt=go())!==a?Q=At=ot(At,xt):(W=Q,Q=a)):(W=Q,Q=a),Q}function gt(){var Q;return(Q=Xp())===a&&(Q=wa()),Q!==a&&(Q=ft(Q)),Q}function go(){var Q,At,lt;return Q=W,(At=yd())===a&&(At=null),At!==a&&(lt=Xp())!==a?Q=At=[At,lt]:(W=Q,Q=a),Q===a&&(Q=W,(At=yd())===a&&(At=null),At!==a&&(lt=wa())!==a?Q=At=[At,lt]:(W=Q,Q=a)),Q!==a&&(Q=pt(Q)),Q}function Wp(){var Q;return tt.test(n.charAt(W))?(Q=n.charAt(W),W++):(Q=a,Ft===0&&le(mt)),Q!==a&&(Q=N(Q)),Q}function xe(){var Q,At,lt,xt,Ot;if(Q=W,At=[],(lt=Le())!==a)for(;lt!==a;)At.push(lt),lt=Le();else At=a;if(At!==a)if((lt=qp())===a&&(lt=null),lt!==a){for(xt=[],Ot=Le();Ot!==a;)xt.push(Ot),Ot=Le();xt!==a?Q=At=[At,lt,xt]:(W=Q,Q=a)}else W=Q,Q=a;else W=Q,Q=a;if(Q===a){if(Q=W,At=W,(lt=qp())!==a){for(xt=[],Ot=Le();Ot!==a;)xt.push(Ot),Ot=Le();xt!==a?At=lt=[lt,xt]:(W=At,At=a)}else W=At,At=a;At!==a&&(At=L()),Q=At}return Q}function qp(){var Q;return n.charCodeAt(W)===44?(Q=H,W++):(Q=a,Ft===0&&le($)),Q}function Xp(){var Q,At,lt;return Q=W,At=function(){var xt,Ot,I,nt;return xt=W,(Ot=wa())===a&&(Ot=null),Ot!==a?(n.charCodeAt(W)===46?(I=Z,W++):(I=a,Ft===0&&le(K)),I!==a&&(nt=wa())!==a?xt=Ot=[Ot,I,nt]:(W=xt,xt=a)):(W=xt,xt=a),xt===a&&(xt=W,(Ot=wa())!==a?(n.charCodeAt(W)===46?(I=Z,W++):(I=a,Ft===0&&le(K)),I!==a?xt=Ot=[Ot,I]:(W=xt,xt=a)):(W=xt,xt=a)),xt!==a&&(xt=B(xt)),xt}(),At!==a?((lt=$p())===a&&(lt=null),lt!==a?Q=At=[At,lt]:(W=Q,Q=a)):(W=Q,Q=a),Q===a&&(Q=W,(At=wa())!==a&&(lt=$p())!==a?Q=At=[At,lt]:(W=Q,Q=a)),Q!==a&&(Q=B(Q)),Q}function $p(){var Q,At,lt,xt;return Q=W,k.test(n.charAt(W))?(At=n.charAt(W),W++):(At=a,Ft===0&&le(st)),At!==a?((lt=yd())===a&&(lt=null),lt!==a&&(xt=wa())!==a?Q=At=[At,lt,xt]:(W=Q,Q=a)):(W=Q,Q=a),Q!==a&&(Q=B(Q)),Q}function yd(){var Q;return dt.test(n.charAt(W))?(Q=n.charAt(W),W++):(Q=a,Ft===0&&le(bt)),Q}function wa(){var Q,At;if(Q=[],ct.test(n.charAt(W))?(At=n.charAt(W),W++):(At=a,Ft===0&&le(It)),At!==a)for(;At!==a;)Q.push(At),ct.test(n.charAt(W))?(At=n.charAt(W),W++):(At=a,Ft===0&&le(It));else Q=a;return Q!==a&&(Q=St(Q)),Q}function Le(){var Q;return Rt.test(n.charAt(W))?(Q=n.charAt(W),W++):(Q=a,Ft===0&&le(Mt)),Q!==a&&(Q=L()),Q}var _d,bd,Sa,_l={m:"moveto",l:"lineto",h:"horizontal lineto",v:"vertical lineto",c:"curveto",s:"smooth curveto",q:"quadratic curveto",t:"smooth quadratic curveto",a:"elliptical arc",z:"closepath"};for(var Yp in _l)_l[Yp.toUpperCase()]=_l[Yp];function vo(Q,At){At||(At=[{}]);for(var lt=At.length;lt--;){var xt={code:Q,command:_l[Q]};for(var Ot in Q==Q.toLowerCase()&&(xt.relative=!0),At[lt])xt[Ot]=At[lt][Ot];At[lt]=xt}return At}if((s=l())!==a&&W===n.length)return s;throw s!==a&&W<n.length&&le({type:"end"}),_d=Gt,bd=Dt<n.length?n.charAt(Dt):null,Sa=Dt<n.length?oe(Dt,Dt+1):oe(Dt,Dt),new i(i.buildMessage(_d,bd),_d,bd,Sa)}}}),bP=Ep((t,e)=>{var i=AK().parse;i.parseSVG=i,i.makeAbsolute=function(n){var r,s={x:0,y:0},a={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return n.forEach(function(o){for(var l in o.command==="moveto"&&(r=o),o.x0=s.x,o.y0=s.y,a)l in o&&(o[l]+=o.relative?o[a[l]]:0);"x"in o||(o.x=s.x),"y"in o||(o.y=s.y),o.relative=!1,o.code=o.code.toUpperCase(),o.command=="closepath"&&(o.x=r.x,o.y=r.y),s=o}),n},e.exports=i}),Q8=z(()=>{Rg=new Set}),TK=z(()=>{J(),_0(),b0(),YT=class extends Pp(eN){constructor(t,e=15,i=6710886){super(t,e,i),this.object=t,this.name=`PointLightHelper: ${t.uuid}`}raycast(t,e){Dp(this.object,YT.geometryHelper,t,e)}}}),J8=z(()=>{J(),TK(),M0(),Yx=class extends Xx(KF,YT){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=90,n.aspect=1,n.near=100,n.far=2500;let r=new T(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),s=new T(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z),a=new hi(r,s),o=new Yg(a,new Jt(16755200));o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(let t in this.gizmos){let e=this.gizmos[t];if(e instanceof Yg){let i=this.shadow.camera,n=new T(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),r=new T(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);e.box.set(n,r),e.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}});function g5(t){let e=ZT.get(t);return e===void 0&&(e=tV++,ZT.set(t,e)),e}function v5(t){let e=t.states;return e!==void 0&&Object.keys(e).length>0?e:void 0}function CK(t,e,i){let n=lh(t)?t.object:t;return n.builtSharedGeometry===e&&n.material===i}function PK(t,e,i,n){let r=t,s=e;return[g5(i),g5(n),r.layers?.mask??0,r.renderOrder??0,(r.castShadow??s.castShadow)===!0?1:0,(r.receiveShadow??s.receiveShadow)===!0?1:0].join(":")}var ZT,tV,KT,QT,ay,eV,DK=z(()=>{Oi(),ZT=new WeakMap,tV=1}),RK=z(()=>{J(),QT=(KT=[8,32,128,512])[KT.length-1],ay=new Et().makeScale(0,0,0),eV=class extends bx{constructor(t,e,i,n){super(t,e,i),this.isInstanceGroup=!0,this.members=new Array(i).fill(null),this.raycast=()=>{},this.matrixAutoUpdate=!1,this.frustumCulled=!1,this.adoptPassState(n);for(let r=0;r<i;r++)this.setMatrixAt(r,ay);this.instanceMatrix.needsUpdate=!0}adoptPassState(t){this.layers.mask=t.layers.mask,this.renderOrder=t.renderOrder,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow}assign(t,e){this.members[t]=e}writeSlot(t,e,i){return i===!1?(this.setMatrixAt(t,ay),!1):(this.setMatrixAt(t,e.matrixWorld),!0)}park(t){this.members[t]=null,this.setMatrixAt(t,ay)}get memberCount(){let t=0;for(let e of this.members)e!==null&&t++;return t}}});function iV(t,e,i){let n=i.get(t);if(n!==void 0)return n;let r=t.parent,s=r===null?qb:iV(r,e,i),a=t.visible?s&qb:0;return(t===e||(s&Xb)!==0)&&(a|=Xb),i.set(t,a),a}var qb,Xb,nV,OK=z(()=>{DK(),RK(),qb=1,Xb=2,nV=class{constructor(t=8){this.minGroupSize=t,this.groups=[],this.groupKeys=new WeakMap,this.placements=new Map,this.drawStateMemo=new Map,this.transparencyDissolves=new WeakMap,this.frame=0,this.mirrored=[],this.page=null,this.stats={instancingGroups:0,instancedDrawsSaved:0,instancingRegroups:0,instancingParks:0,instancingIneligible:{}},this.reconcileRequested=!1}update(t,e){this.frame++,this.page!==t&&(this.teardown(),this.page=t,e=!0),t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),e&&this.reconcile(t),this.refresh(t);for(let i of this.mirrored)if(i.matrixWorld.determinant()>=0){this.reconcileRequested=!0;break}this.reconcileRequested&&(this.reconcileRequested=!1,this.reconcile(t),this.refresh(t),this.reconcileRequested=!1)}reconcile(t){let e,i={},n=new Map,r=[];for(let o of this.groups){let l=o.material;if(l.transparent!==!0||e?.has(l))continue;(e??(e=new Set)).add(l);let c=this.transparencyDissolves.get(l),h=c!==void 0&&this.frame-c.frame<=600;this.transparencyDissolves.set(l,{count:h?c.count+1:1,frame:this.frame})}t.traverse(o=>{if(o.isInstanceGroup===!0)return;let l=function(h){if(h.isMesh!==!0)return"not-a-mesh";if(pl(h)||Pr(h)||ed(h)||Ag(h))return"excluded-type";let d=function(v){let y=lh(v)?v.object:v;return y.geometry!==void 0?y:void 0}(h);if(d===void 0)return"not-a-mesh";let u=d.material;if(u===void 0)return"not-a-mesh";if(Array.isArray(u))return"array-material";let p=d.builtSharedGeometry;if(p===void 0)return"unrealized-geometry";if(!function(v){return v.isShared===!0}(p))return"unshared-geometry";if(p.attributes.position===void 0)return"empty-geometry";if(p.morphAttributes.position!==void 0)return"morph";if(d.isSkinnedMesh===!0)return"skinned";let f=d.morphTargetInfluences;if(f!==void 0&&f.length>0)return"morph";if(p.drawRange.start!==0||p.drawRange.count!==Number.POSITIVE_INFINITY)return"draw-range";let g=u;if(g.positionNode!=null||g.castShadowPositionNode!=null)return"position-node";if(g.transparent===!0)return"transparent";if(d.userData?.__splinePlanarMirror!==void 0)return"reflection";let m=function(v){let y=v;if(v5(y)!==void 0)return"interaction-states";for(let _=y.parent;_!==null;_=_.parent){let b=v5(_);if(b===void 0)continue;let x=_;for(let w of Object.values(b)){if(x.cloner!==void 0||w.cloner!=null&&w.cloner.disabled!==!0)return"interaction-states";let S=w.scale;if(S!==void 0&&((S.x??1)<0||(S.y??1)<0||(S.z??1)<0))return"mirrored"}}}(d);return m!==void 0?m:h.matrixWorld.determinant()<0?"mirrored":{object:h,owner:d,geometry:p,material:u,key:PK(h,d,p,u)}}(o);if(typeof l!="string"&&this.isChurning(l.material)&&(l="transparency-churn"),typeof l=="string")return i[l]=(i[l]??0)+1,void(l==="mirrored"&&o.matrixWorld.determinant()<0&&r.push(o));let c=n.get(l.key);c===void 0?n.set(l.key,[l]):c.push(l)});let s=new Map;for(let[o,l]of n)for(let c of l)s.set(c.object,o);let a=!1;for(let[o,l]of this.placements)s.get(o)!==this.groupKeys.get(l.group)&&this.parkPlacement(o,l);for(let o=this.groups.length-1;o>=0;o--){let l=this.groups[o];l.memberCount>=this.minGroupSize||(this.destroyGroup(l),this.groups.splice(o,1),a=!0)}for(let[o,l]of n){let c=l.filter(d=>!this.placements.has(d.object));if(c.length===0)continue;let h=0;for(let d of this.groups){if(h>=c.length)break;if(this.groupKeys.get(d)!==o)continue;let{members:u}=d;for(let p=0;p<u.length&&h<c.length;p++)u[p]===null&&this.place(d,p,c[h++].object)}for(;c.length-h>=this.minGroupSize;){let d=c.slice(h,h+QT);this.groups.push(this.createGroup(t,o,d)),h+=d.length,a=!0}}a&&this.stats.instancingRegroups++,this.publishGroupStats(),this.stats.instancingIneligible=i,this.mirrored=r}isChurning(t){let e=this.transparencyDissolves.get(t);return e!==void 0&&e.count>=2&&this.frame-e.frame<=600}createGroup(t,e,i){let n=i[0],r=new eV(n.geometry,n.material,function(s){for(let a of KT)if(s<=a)return a;return QT}(i.length),n.object);this.groupKeys.set(r,e);for(let s=0;s<i.length;s++)this.place(r,s,i[s].object);return t.add(r),r}destroyGroup(t){for(let e=0;e<t.members.length;e++){let i=t.members[e];i!==null&&this.parkPlacement(i,{group:t,slot:e})}t.removeFromParent(),t.dispose()}place(t,e,i){t.assign(e,i),this.placements.set(i,{group:t,slot:e}),i.isDrawSuppressed=!0}parkPlacement(t,e){e.group.park(e.slot),e.group.instanceMatrix.needsUpdate=!0,this.placements.delete(t),t.isDrawSuppressed=!1,this.stats.instancingParks++}refresh(t){this.drawStateMemo.clear();for(let e of this.groups){let{members:i}=e,n=e.material;(n.transparent===!0||n.positionNode!=null||n.castShadowPositionNode!=null)&&(this.reconcileRequested=!0);let r=null;for(let s=0;s<i.length;s++){let a=i[s];if(a===null)continue;r===null&&(r=a);let o=iV(a,t,this.drawStateMemo),l=(o&qb)!==0;((o&Xb)===0||a.matrixWorld.determinant()<0||!CK(a,e.geometry,e.material))&&(l=!1,this.reconcileRequested=!0),e.writeSlot(s,a,l)}r!==null&&(e.adoptPassState(r),e.instanceMatrix.needsUpdate=!0)}}teardown(){for(let t of this.groups)this.destroyGroup(t);this.groups.length=0;for(let t of this.placements.keys())t.isDrawSuppressed=!1;this.placements.clear(),this.publishGroupStats()}dispose(){this.teardown(),this.page=null,this.mirrored=[]}publishGroupStats(){let t=0;for(let e of this.groups){let i=e.memberCount;i>0&&(t+=i-1)}this.stats.instancingGroups=this.groups.length,this.stats.instancedDrawsSaved=t}}});function IK(t,e,i){i.length=0;let{axis:n,sign:r,limit:s}=e;for(let a=0;a<t.length;a++){let o=t[a],l=t[(a+1)%t.length],c=(n===0?o.px:n===1?o.py:o.pz)*r-s,h=(n===0?l.px:n===1?l.py:l.pz)*r-s,d=c<=0,u=h<=0;if(d&&i.push(o),d!==u){let p=c/(c-h);i.push({px:o.px+(l.px-o.px)*p,py:o.py+(l.py-o.py)*p,pz:o.pz+(l.pz-o.pz)*p,nx:o.nx+(l.nx-o.nx)*p,ny:o.ny+(l.ny-o.ny)*p,nz:o.nz+(l.nz-o.nz)*p})}}return i}function LK(t,e,i,n,r,s,a,o,l){let c=t.geometry,h=c.getAttribute("position");if(h===void 0||h.count===0)return!0;let d=c.getAttribute("normal"),u=c.getIndex(),p=u!==null?u.count:h.count;if(p>rV)return!0;let f=c.drawRange.start,g=f+(c.drawRange.count===1/0?p-f:Math.min(c.drawRange.count,p-f));zu.copy(t.objectToDecal),eg.getNormalMatrix(zu);let m=[],v=[];for(let y=f;y+2<g;y+=3){let _=u!==null?u.getX(y):y,b=u!==null?u.getX(y+1):y+1,x=u!==null?u.getX(y+2):y+2;if(Ha.fromBufferAttribute(h,_).applyMatrix4(zu),Go.fromBufferAttribute(h,b).applyMatrix4(zu),Ho.fromBufferAttribute(h,x).applyMatrix4(zu),Ha.z>i&&Go.z>i&&Ho.z>i||Ha.z<-i&&Go.z<-i&&Ho.z<-i)continue;Vr.subVectors(Go,Ha),JT.subVectors(Ho,Ha),Wl.crossVectors(Vr,JT);let w=Wl.length();if(!(w===0||Wl.z/w<=aV)){if(m.length=0,d!==void 0)Vr.fromBufferAttribute(d,_).applyMatrix3(eg),m.push({px:Ha.x,py:Ha.y,pz:Ha.z,nx:Vr.x,ny:Vr.y,nz:Vr.z}),Vr.fromBufferAttribute(d,b).applyMatrix3(eg),m.push({px:Go.x,py:Go.y,pz:Go.z,nx:Vr.x,ny:Vr.y,nz:Vr.z}),Vr.fromBufferAttribute(d,x).applyMatrix3(eg),m.push({px:Ho.x,py:Ho.y,pz:Ho.z,nx:Vr.x,ny:Vr.y,nz:Vr.z});else{Wl.divideScalar(w);for(let S of[Ha,Go,Ho])m.push({px:S.x,py:S.y,pz:S.z,nx:Wl.x,ny:Wl.y,nz:Wl.z})}for(let S of e){if(m.length===0)break;let E=IK(m,S,v);v=m,m=E}if(!(m.length<3)){if(a.length/3+3*(m.length-2)>sV)return!1;for(let S=1;S+1<m.length;S++)for(let E of[m[0],m[S],m[S+1]]){l.push(E.px*n+.5,E.py*r+.5);let A=E.nx,P=E.ny,C=E.nz,R=Math.hypot(A,P,C);R>0?(A/=R,P/=R,C/=R):(A=0,P=0,C=1),a.push(E.px+A*s,E.py+P*s,E.pz+C*s),o.push(A,P,C)}}}}return!0}var rV,sV,aV,zu,eg,Ha,Go,Ho,Vr,JT,Wl,oy,J2,tM,eM,J1,oV,BK=z(()=>{J(),rV=15e5,sV=3e5,aV=.01,zu=new Et,eg=new ue,Ha=new T,Go=new T,Ho=new T,Vr=new T,JT=new T,Wl=new T}),UK=z(()=>{J(),Ye(),cd(),Zn(),Xr(),BK(),qx(),oy=new hi,J2=new hi,tM=new Et,eM=new T,J1=class extends qr{constructor(t,e,i){super(t,e),this.data=e,this.geometry=new jt,this.lastSignature=[],this.nextSignature=[],this.scanned=[],this.lastParams={width:0,height:0,depth:0,offset:0},this.targetFilter=new Set,this.context=i;let n=this.data.geometry;this.lastParams={width:this.resolveNumber(n.width,0),height:this.resolveNumber(n.height,0),depth:this.resolveNumber(n.depth,0),offset:n.offset??0},this.geometry.userData={type:"DecalGeometry",parameters:{...this.lastParams}}}get isLOD(){return this.updateDecal(),!1}get isDecalObject(){return!0}resolveNumber(t,e){if(typeof t=="number")return t;let i=Number(this.context.shared.getVariable(t));return Number.isFinite(i)?i:e}currentParams(){let t=this.dataPatched.geometry;return{width:this.resolveNumber(t.width,this.lastParams.width),height:this.resolveNumber(t.height,this.lastParams.height),depth:this.resolveNumber(t.depth,this.lastParams.depth),offset:t.offset??0}}projectionRoot(){let t=this.parent;for(;t!==null&&Ie.is(t);){if(t.data?.type==="Page")return t;t=t.parent}return this.context.scene}currentTargetFilter(){let t=this.dataPatched.geometry;if(t.projection!=="select")return null;let e=t.projectionTargets;if(e!==this.targetFilterSource&&(this.targetFilterSource=e,this.targetFilter.clear(),e!==void 0))for(let i of e)this.targetFilter.add(i);return this.targetFilter}static matchesTargetFilter(t,e,i){let n=t;for(;n!==null&&n!==i;){if(e.has(n.uuid))return!0;n=n.parent}return!1}scanTargets(t,e,i){let n=this.scanned;n.length=0;let r=this.projectionRoot();if(r===null)return n;let s=this.currentTargetFilter();if(s!==null&&s.size===0)return n;oy.makeEmpty();for(let a=0;a<8;a++)eM.set((1&a?.5:-.5)*t,(2&a?.5:-.5)*e,(4&a?.5:-.5)*i).applyMatrix4(this.matrixWorld),oy.expandByPoint(eM);return r.traverse(a=>{if(a===this||!Ie.is(a)||!(a instanceof sn)||a instanceof J1||a.dataPatched?.type!=="Mesh"||!a.visible||a.destroyedInAction||512&a.layers.mask||s!==null&&!J1.matchesTargetFilter(a,s,r))return;let o=a.geometry,l=o?.getAttribute("position");l===void 0||l.count===0||o.drawRange.count!==0&&(o.boundingBox===null&&o.computeBoundingBox(),J2.copy(o.boundingBox).applyMatrix4(a.matrixWorld),oy.intersectsBox(J2)&&n.push(a))}),n}collectSignature(t,e,i){t.length=0,t.push(i.width,i.height,i.depth,i.offset);for(let n of this.matrixWorld.elements)t.push(n);for(let n of e){t.push(n.id,n.geometry.id);let r=n.geometry.getAttribute("position");t.push(r===void 0?-1:"version"in r?r.version:r.data.version);let s=n.geometry.getIndex();t.push(s!==null?s.version:-1),t.push(n.geometry.drawRange.count===1/0?-1:n.geometry.drawRange.count);for(let a of n.matrixWorld.elements)t.push(a)}}signaturesEqual(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}updateDecal(){if(this.disposed)return!1;this.updateWorldMatrix(!0,!1);let t=this.currentParams(),e=this.scanTargets(t.width,t.height,t.depth);if(this.collectSignature(this.nextSignature,e,t),this.signaturesEqual(this.nextSignature,this.lastSignature))return!1;let i=this.lastSignature;this.lastSignature=this.nextSignature,this.nextSignature=i,this.lastParams=t,tM.copy(this.matrixWorld).invert();let n=e.map(r=>({geometry:r.geometry,objectToDecal:new Et().multiplyMatrices(tM,r.matrixWorld)}));return this.geometry.dispose(),this.geometry=function(r,s){let a=Math.max(Math.abs(s.width),1e-6),o=Math.max(Math.abs(s.height),1e-6),l=Math.max(Math.abs(s.depth),1e-6),c=[{axis:0,sign:1,limit:a/2},{axis:0,sign:-1,limit:a/2},{axis:1,sign:1,limit:o/2},{axis:1,sign:-1,limit:o/2},{axis:2,sign:1,limit:l/2},{axis:2,sign:-1,limit:l/2}],h=[],d=[],u=[];for(let f of r)if(!LK(f,c,l/2,1/a,1/o,s.offset,h,d,u))break;let p=new jt;return p.setAttribute("position",new kt(h,3)),p.setAttribute("normal",new kt(d,3)),p.setAttribute("uv",new kt(u,2)),h.length===0?(p.setDrawRange(0,0),p.boundingSphere=new vr):p.computeBoundingSphere(),p}(n,t),this.geometry.userData={type:"DecalGeometry",parameters:{width:t.width,height:t.height,depth:t.depth}},ap(this),op(this),this.resetBBoxNeedsUpdate(),!0}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ri(t.path,["geometry"])&&this.resetBBoxNeedsUpdate()}updateEntityBoxSize(t,e){let i=this.currentParams();t.setScalar(0),e.set(i.width,i.height,i.depth).multiplyScalar(.5)}dispose(){super.dispose(),this.geometry.dispose()}}}),zK=z(()=>{J(),Ox(),hd(),oV=class extends ld(tA,wp){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}}});function xP(t,e,i){if(console.assert(e.type!==void 0),e.type==="Mesh")return function(n,r,s){let a;if(t_!==void 0&&r?.geometry&&"subdivisions"in r.geometry&&(r.geometry.subdivisions??0)>t_&&Object.assign(r.geometry,{subdivisions:t_}),r.geometry.type==="TextGeometry"||r.geometry.type==="InputGeometry"){let o=_2(r.geometry.type);return o?o(n,r,s):(jn(r.geometry.type==="InputGeometry"?"textinputs":"text",`a Mesh with ${r.geometry.type}`),new vi(n,r,s))}if(r.geometry.type==="SubdivGeometry")a=new Mp(n,r,s);else if(r.geometry.type==="PathGeometry"||r.geometry.type==="VectorGeometry"||r.geometry.type==="ShapeBlendGeometry"){let o=_2(r.geometry.type);o?a=o(n,r,s):(jn(r.geometry.type==="ShapeBlendGeometry"?"shape-blends":r.geometry.type==="PathGeometry"?"3d-paths":"vector-shapes",`a Mesh with ${r.geometry.type}`),a=new vi(n,r,s))}else if(r.geometry.type==="BooleanGeometry")a=new xh(n,r,s);else if(r.geometry.type==="DecalGeometry")a=new J1(n,r,s);else if(r.geometry.type==="UIGeometry"){let o=_2("UIGeometry");o?a=o(n,r,s):(jn("ui-2d","a Mesh with UIGeometry"),a=new vi(n,r,s))}else a=new vi(n,r,s);return a}(t,e,i);if(e.type==="Empty")return new Ka(t,e);if(e.type==="Particle"){let n=y2("Particle");return n?n(t,e,i):(jn("particles","a Particle system"),new Ka(t,e))}if(e.type==="ParticleCollider")return new lp(t,e,i);if(e.type==="Hair"){let n=y2("Hair");return n?n(t,e,i):(jn("hair","a Hair System"),new Ka(t,e))}if(e.type==="Splat")return new Ka(t,e);if(e.type==="Bone")return new oV(t,e);if(e.type==="Page")return new Si(t,e,i);if(e.type==="PointLight")return new Yx(t,e,i);if(e.type==="SpotLight")return new A0(t,e,i);if(e.type==="DirectionalLight")return new E0(t,e,i);if(e.type==="Component"||e.type==="Instance"){let n=y2(e.type);return n?n(t,e,i):(jn("components",`a ${e.type}`),new Ka(t,e))}return Jc.is(e.type)?new Ki(t,e):(console.error(e),new Ka(t,e))}function FK(t,e,i){let n=xP(t.identity,e,i),r=t.children,s=t.attachedPaths,a=t.parent,o=t.component,l=t.instances,c=t.overrideData,h=t.uuid,d=t.stateSelection,u=function(p){if(!(p instanceof vi&&p.isSkinnedMesh))return;let f=p.dataPatched.bones,g=p.skeleton.bones;return f&&f.length===g.length?new Map(f.map((m,v)=>[m,g[v]])):void 0}(t);t.dispose();for(let p of Object.keys(t))delete t[p];Object.setPrototypeOf(t,Object.getPrototypeOf(n));for(let p of Object.keys(n))t[p]=n[p];t.children=[...t.children,...r],t.attachedPaths=s,t.parent=a,t.component=o,t.instances=l,t.uuid=h,t.overrideData=c,t.updateState(t.data,i),d&&t.changeSelectedState(d,i),u&&t instanceof vi&&t.rebindSkeleton(p=>u.get(p)??i.scene.find(p)??void 0),t.resetBBoxNeedsUpdate()}var t_,lV,hV,cV,dh,e_,dV,tC,NK=z(()=>{Xt(),T0(),S0(),UK(),$r(),zx(),J8(),vP(),pP(),Xs(),Pb(),zK(),$s(),yP(),ke(),t_=function(){try{let t=window.location.href;if(t.includes("reducesubdiv=")){let e=t.indexOf("reducesubdiv=")+13;return parseInt(t.slice(e,e+1))}}catch{}}(),hl.createEntity=xP,hl.changeEntityProptotype=FK}),kK=z(()=>{lV=class{constructor(){this._constraints=new Map}setConstraint(t,e){e===null?this._constraints.delete(t):this._constraints.set(t,e)}getConstraint(t){return this._constraints.get(t)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((i,n)=>{let r=[n,i],s=i;for(;this._constraints.has(s);){if(s=this._constraints.get(s),r.includes(s)){console.warn(`circular dependency detected: ${r.join(" -> ")}`);break}e.has(s)||r.push(s)}for(let a=r.length-2;a>=0;a--)if(!e.has(r[a])){let o=t.find(r[a]);o?o.applyPathSnapping(t):console.warn(`missing entity ${r[a]}`),e.add(r[a])}})}findDependency(t,e){let i=t;for(;this._constraints.has(i);)if(i=this._constraints.get(i),i===e)return!0;return!1}}}),VK=z(()=>{hV="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"}),jK=z(()=>{cV=`
|
|
4194
4214
|
function sortWorker(self) {
|
|
4195
4215
|
let wasmInstance;
|
|
@@ -4704,7 +4724,7 @@ function sortWorker(self) {
|
|
|
4704
4724
|
gl_FragColor = vec4(color.rgb, A);
|
|
4705
4725
|
gVelocity = vec4(0.0);
|
|
4706
4726
|
}`,transparent:!0,alphaTest:1,blending:fh,depthTest:!0,depthWrite:!1,side:Gn})}static buildGeomtery(t){let e=new jt;e.setIndex([0,1,2,0,2,3]);let i=new Float32Array(12),n=new Ht(i,3);e.setAttribute("position",n),n.setXYZ(0,-1,-1,0),n.setXYZ(1,-1,1,0),n.setXYZ(2,1,1,0),n.setXYZ(3,1,-1,0),n.needsUpdate=!0;let r=new J_().copy(e),s=new Uint32Array(t),a=new Vu(s,1,!1);return a.setUsage(LF),r.setAttribute("splatIndex",a),r.instanceCount=t,r}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(n=>n.buildPreComputedBuffers()),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);let t=0,e=0,i=0;for(let n of this.splatBuffers){let r=n.nsplats;this.colors.subarray(t,t+4*r).set(n.colorsA),t+=4*r,this.centers.subarray(e,e+3*r).set(n.decoded.xyz.denormDequant().data),e+=3*r,this.covariances.subarray(i,i+6*r).set(new Float32Array(n.precomputedCovarianceBufferData)),i+=6*r}}allocateAndStoreLocalSplatDataInTextures(){let t=this.splatCount,e=new et(4096,1024);for(;e.x*e.y*2<6*t;)e.y*=2;let i,n,r=new et(4096,1024);for(;r.x*r.y*4<4*t;)r.y*=2;if(this.halfPrecisionCovariancesOnGPU){n=new Uint16Array(e.x*e.y*2);for(let c=0;c<this.covariances.length;c++)n[c]=th.toHalfFloat(this.covariances[c]);i=new Cn(n,e.x,e.y,co,Xn)}else n=new Float32Array(e.x*e.y*2),n.set(this.covariances),i=new Cn(n,e.x,e.y,co,$e);i.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=i,this.material.uniforms.covariancesTextureSize.value.copy(e);let s=new Uint32Array(r.x*r.y*4);for(let c=0;c<t;c++){let h=4*c,d=3*c,u=4*c;s[u]=dV(this.colors[h],this.colors[h+1],this.colors[h+2],this.colors[h+3]),s[u+1]=e_(this.centers[d]),s[u+2]=e_(this.centers[d+1]),s[u+3]=e_(this.centers[d+2])}let a=new Cn(s,r.x,r.y,p0,Ws);kb()!=="webgpu"&&(a.internalFormat="RGBA32UI"),a.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=a,this.material.uniforms.centersColorsTextureSize.value.copy(r);let o=new Float32Array(4096);for(let c=0;c<this.meshMatrixWorlds.length;c++)o.set(this.meshMatrixWorlds[c].elements,16*c);let l=new Cn(o,1024,1,Yi,$e);l.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=l,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:n,texture:i,size:e},centerColors:{data:s,texture:a,size:r},meshMatrixWorlds:{data:o,texture:l}}}updateIndexes(t){let e=this.geometry;e.attributes.splatIndex.set(t),e.attributes.splatIndex.needsUpdate=!0,e.instanceCount=t.length}updateUniforms(t,e,i,n){this.splatCount>0&&(Jf.set(t.x*this.devicePixelRatio,t.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(Jf),this.material.uniforms.basisViewport.value.set(2/Jf.x,2/Jf.y),this.material.uniforms.focal.value.set(e,i),this.material.uniforms.orthoZoom.value=n,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose()),this.removeFromParent()}}});function qK(){if(!eC)return _5||(_5=async function(){let t=await Promise.resolve().then(()=>(tR(),JD));pV(t),eC=!0}())}var pV,fV,eC,_5,b5,mV,iC,iM,Zx,gV=z(()=>{fV=new Promise(t=>{pV=t}),eC=!1}),XK=z(()=>{GK(),J(),uV(),gV(),fV.then(t=>b5=t),mV=class{constructor(t={}){to(this,"updateView",function(){let e=new Et,i=[],n=new T(0,0,-1),r=new T(0,0,-1),s=new T,a=new T;return function(o=!1,l){let c=this.updateMatrixWorldsInWorkerIfNeeded(),h=this.cropsChanged();if(!o){r.set(0,0,-1).applyQuaternion(l.quaternion);let u=!1,p=!1;if(r.dot(n)<=.95&&(u=!0),a.copy(l.position).sub(s).length()>=1&&(p=!0),!(u||p||c||h||this.needsInitialRender))return}this.needsInitialRender=!1,s.copy(l.position),n.copy(r),e.copy(l.matrixWorld).invert(),e.premultiply(this.dummyPerspectiveMatrix),i[0]=l.position.x,i[1]=l.position.y,i[2]=l.position.z;let d={sort:{view:e.elements,cameraPosition:i,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...c?{newMatrixWorlds:this.meshMatrixWorlds}:{},...h?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=d:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(d))}}()),this.scene=t.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=new Et().makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(t,e){let i=new et;this.splatMesh!==null&&this.splatMesh.getSplatCount()>0&&(t.getSize(i),this.cameraFocalLengthX=e.projectionMatrix.elements[0]*this.devicePixelRatio*i.x*.45,this.cameraFocalLengthY=e.projectionMatrix.elements[5]*this.devicePixelRatio*i.y*.45,this.splatMesh.updateUniforms(i,this.cameraFocalLengthX,this.cameraFocalLengthY,e.isPerspectiveCamera?-1:e.zoom*this.devicePixelRatio))}loadSplat(t={}){this.activePage=this.scene.activePage,t.position&&(t.position=new T().fromArray(t.position)),t.orientation&&(t.orientation=new qt().fromArray(t.orientation)),t.halfPrecisionCovariances=!!t.halfPrecisionCovariances;let e=[];if(this.splatEntries=e,this.activePage.traverseVisibleEntity(s=>{s.data.type==="Splat"&&e.push(s)}),this.splatMesh&&this.splatMesh.dispose(),e.length===0)return this.splatMesh=null,!1;this.meshMatrixWorlds=e.map(s=>s.matrixWorld),this.meshMatrixWorldsOld=e.map(s=>s.matrixWorld.clone()),this.cropsArray=e.map(s=>s.data.crops.map(a=>a.data)),this._splatBufferCache??(this._splatBufferCache=new WeakMap);let i=e.map(s=>{let a=this._splatBufferCache.get(s.data.buffer);return a===void 0&&(a=new b5.GSplineBuffer(new Uint8Array(s.data.buffer).buffer),this._splatBufferCache.set(s.data.buffer,a)),a}),n=0,r=[0];for(let s of i)n+=s.getSplatCount(),r.push(n);return this.setupSplatMesh(i,n,t.position,t.orientation,t.halfPrecisionCovariances,this.devicePixelRatio,r,this.meshMatrixWorlds),this.setupSortWorker(n),!0}updateMatrixWorldsInWorkerIfNeeded(){let t=this.splatDataTextures.meshMatrixWorlds.data;for(let e=0;e<this.meshMatrixWorlds.length;e++)t.set(this.meshMatrixWorlds[e].elements,16*e);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,!this.meshMatrixWorlds.every((e,i)=>e.equals(this.meshMatrixWorldsOld[i]))&&(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(e=>e.clone()),!0)}cropsChanged(){let t=!1;return this.splatEntries.forEach((e,i)=>{e.data.crops.forEach((n,r)=>{this.cropsArray[i][r]===void 0?(t=!0,this.cropsArray[i][r]=n.data):Object.entries(n.data).forEach(([s,a])=>{(Array.isArray(a)&&a.some((o,l)=>o!==this.cropsArray[i][r][s][l])||a!==this.cropsArray[i][r]?.[s])&&(t=!0,this.cropsArray[i][r][s]=a)})}),e.data.crops.length!==this.cropsArray[i]?.length&&(this.cropsArray[i].length=e.data.crops.length,t=!0)}),t}setupSplatMesh(t,e,i=new T,n=new qt,r=!1,s=1,a,o){this.splatMesh=ig.buildMesh(t,e,r,s,a,o),this.splatMesh.position.copy(i),this.splatMesh.quaternion.copy(n),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=e,this.splatMesh.onBeforeRender=(l,c,h)=>this.update(l,h)}setupSortWorker(t){this.sortWorker=function(e){let i=new Worker(URL.createObjectURL(new Blob(["(",cV,")(self)"],{type:"application/javascript"}))),n=atob(hV),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return i.postMessage({init:{sorterWasmBytes:r.buffer,splatCount:e,Constants:{BytesPerFloat:dh.BytesPerFloat,BytesPerInt:dh.BytesPerInt,DepthMapRange:dh.DepthMapRange,MemoryPageSize:dh.MemoryPageSize}}}),i}(t),this.sortWorker.onmessage=e=>{e.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(e.data.indexesBuffer)),this.lastSortTime=e.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):e.data.sortCanceled?this.sortRunning=!1:e.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):e.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(t,e){this.splatMesh!==null&&(this.updateSplatMeshUniforms(t,e),this.updateView(!1,e))}getSplatMesh(){return this.splatMesh}}}),wP=z(()=>{J(),Xs(),Xr(),Bh(),Xt(),OK(),Ye(),$8(),dP(),Zn(),S0(),NK(),zx(),$r(),Oi(),$s(),K8(),Oi(),Dn(),Op(),kK(),XK(),(iC=new qs).wireframe=!0,iM=new T,Zx=class extends as{constructor(t,e){super(),this.data=t,this.sharedAssets=e,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this._normalPassNeeds={outline:!1,cavity:!1},this._needsReflection=!1,this.geometryCacheChanged=!1,this.splatViewer=null,this.shapeBlendIntances=[],this.hairInstances=[],this.shadowsDirty=!0,this.instanceGroupsDirty=!0,this._autoInstancing=null,this.entityByUuid={},this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new lV,this.invisibleObjects=new Ka("jflkdsafjasdifjaslk",{...Sb.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(t,e),this.matrixAutoUpdate=!1,this.errorPage=new Si("fdasfa",{...qc.defaultData,name:""},{shared:e,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markShadowsDirty(){this.shadowsDirty=!0}markInstanceGroupsDirty(){this.instanceGroupsDirty=!0}get autoInstancing(){return this._autoInstancing}updateInstanceGroups(t,e){let i=this._autoInstancing;(i===null||i.minGroupSize!==e)&&(i?.dispose(),i=new nV(e),this._autoInstancing=i);let n=this.instanceGroupsDirty;return this.instanceGroupsDirty=!1,i.update(t,n),i.stats}releaseInstanceGroups(){this._autoInstancing?.teardown(),this.instanceGroupsDirty=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this.shadowsDirty=!0,this.instanceGroupsDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=function(t){let e=!1;return t.traverseEntity(i=>{if(i instanceof qr)if(Array.isArray(i.material))for(let n=0;n<i.material.length;n++)p5(i,i.material[n])&&(e=!0);else p5(i,i.material)&&(e=!0)}),e}(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._normalPassNeeds=function(t){let e={outline:!1,cavity:!1},i=n=>{e.outline=e.outline||n.outline,e.cavity=e.cavity||n.cavity};return t.traverseEntity(n=>{if(n instanceof qr)if(Array.isArray(n.material))for(let r=0;r<n.material.length;r++)i(u5(n,n.material[r]));else i(u5(n,n.material))}),e}(this),this._needsNormal=this._normalPassNeeds.outline||this._normalPassNeeds.cavity,this.needsNormalDirty=!1),this._needsNormal}normalPassNeeds(){return this.needsNormal(),this._normalPassNeeds}needsReflection(){return this.needsReflectionDirty&&(this._needsReflection=function(t){let e=!1;return t.traverseEntity(i=>{if(i instanceof qr)if(Array.isArray(i.material))for(let n=0;n<i.material.length;n++)f5(i,i.material[n])&&(e=!0);else f5(i,i.material)&&(e=!0)}),e}(this),this.needsReflectionDirty=!1),this._needsReflection}registerInstanceAndSetUuid(t){let e=t.identity.join("-"),i=this.entityIdentityToEntity[e];i&&(t.uuid=i.uuid),this.entityIdentityToEntity[e]=t,this.entityByUuid[t.uuid]=t}markPenumbraSizeDirty(){for(let t of this.children)t instanceof Si&&(t.penumbraSizeArrayCache=null)}findInstance(t){return this.entityIdentityToEntity[t.join("-")]}findInInstance(t,e){let i=e??null;if(!Ie.is(i))return;let n=i.data.type==="Instance";if(!n&&!i.isVirtualEntity)return;let r=typeof i.identity=="string"?[i.identity]:i.identity;for(let s=r.length-(n?0:1);s>=1;s--){let a=this.findInstance([...r.slice(0,s),t]);if(a)return a}for(let s=i;Ie.is(s);s=s.parent)if(s.data.type==="Instance"&&s.data.component===t)return s}findFrom(t,e){return this.findInInstance(t,e)??this.find(t)}syncInstancePathConstraint(t){let e=t.data.pathSnapping?.pathId;if(e){let i=this.findFrom(e,t);this.pathConstraints.setConstraint(t.uuid,i?.uuid??e)}else this.pathConstraints.removeDependencies(t.uuid)}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(t){let e=this.find(t);if(e===void 0)return;let i=[],n=e;for(;n!==this;){let r=n;n=n.parent;let s=n.children.indexOf(r);i.splice(0,0,s)}return{entity:e,sortKey:i}}getAllSorted(t){let e=[];for(let i of t){let n=this.getWithSortKey(i.id);n!==void 0&&e.push(n)}return e.sort((i,n)=>eb(i.sortKey,n.sortKey)),e.map(i=>i.entity)}nonExistOrDescendantOf(t,e){let i=this.find(t);if(i===void 0)return!0;for(;i;){if(i.uuid===e)return!0;i=i.parent}return!1}find(t){if(this.activePage&&this.activePage.personalCamera.parent){if(t==="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera")return this.activePage.personalCamera;if(t===od)return this.activePage.personalCamera}if(t===""||t===void 0)return;let e=this.entityByUuid[t];return e===void 0?this.getObjectByProperty("uuid",t):e}find2D(t){for(let e of this.children)if(e instanceof Si&&e.uiScene){let i=e.uiScene.find(t);if(i)return i}}findScene2DfromObject2D(t){for(let e of this.children)if(e instanceof Si&&e.uiScene&&e.uiScene.find(t))return e.uiScene}find2DInUIObjects(t){let e;return this.traverseEntity(i=>{e===void 0&&Pr(i)&&(e=i.uiCanvas.find(t))}),e}traverse2D(t){for(let e of this.children)e instanceof Si&&e.uiScene&&e.uiScene.traverse(t)}debugEnsureEntity(t){let e=this.find(t);e?Array.isArray(e.identity)&&this.findInstance(e.identity)===void 0&&console.error("not found instance"):console.error("not found")}addPendingExpandCloner(t){this.toExpandCloner.add(t)}addPendingUpdateCloner(t){this.toUpdateCloner.add(t)}markToExpandCloner(t){this.toExpandCloner.add(t),t.traverseEntityAncestors(e=>{this.toExpandCloner.add(e)})}doPendingExpandCloner(t){this.toExpandCloner.forEach(e=>{e.expandCloner(t)}),this.toExpandCloner.clear()}doPendingUpdateCloner(t){this.toUpdateCloner.forEach(e=>{e.cloner?.update(t)}),this.toUpdateCloner.clear()}doPendingUpdates(t){this.doPendingExpandCloner(t),this.doPendingUpdateCloner(t),this.applyPendingCommands()}addPendingCommand(t){this.pendingCommands.push(t)}applyPendingCommands(){this.pendingCommands.forEach(t=>t()),this.pendingCommands.length=0}updateByLibOp(t,e){t.path.length===1&&t.path[0]==="components"&&t.type===1&&this.createChildrenObjects([{...t.data.asset,id:t.id}],this.invisibleObjects,e)}updateTreeByOp(t,e){if(t.path.length===0&&t.type===7){let i=t.parent===null?this:this.find(t.parent);if(i===void 0)throw new Error(`scene tree add: parent ${t.parent} not found for object ${t.id}`);let n=this.createObject(t.id,t.data,t.children,i,t.localIndex,e);n.updateVisible(this),n.resetBBoxNeedsUpdate(),ma(n)&&ro(n.parent)&&(n.invalidateUpstreamBooleanData(),n.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(n),this.markToExpandCloner(n),this.markPenumbraSizeDirty(),n.updatePathSnapping()}else if(t.path.length===0&&t.type===8){let i=this.find(t.id);if(i===void 0)throw new Error(`scene tree delete: object ${t.id} not found`);i.traverseEntity(r=>{pl(r)&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(s=>s!==r)),ed(r)&&(this.hairInstances=this.hairInstances.filter(s=>s!==r))}),this.markToExpandCloner(i),i.resetBBoxNeedsUpdate(),this.unregisterObject(i);let n=i.parent;this.markNeedsRecomputeInstancesForAncessors(n),this.markNeedsRecomputeInstancesForChildren(i),this.markPenumbraSizeDirty(),i.parent.remove(i),ro(i.parent)&&(i.parent.invalidateUpstreamBooleanData(),i.parent.invalidateDownstreamBooleanData().recomputeBoolean()),ma(i)&&(i.freeBooleanPointer(),n instanceof xh&&n.invalidateDownstreamBooleanData().recomputeBoolean()),Ix(i)&&i.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(i),this.pathConstraints.removeDependencies(i.uuid),i.updatePathSnapping()}else if(t.path.length===0&&t.type===9){let i=this.find(t.id);if(i===void 0)throw new Error(`scene tree move: object ${t.id} not found`);this.markNeedsRecomputeInstancesForChildren(i);let n=i.parent;this.markNeedsRecomputeInstancesForAncessors(n),i.cloner?.resetOnMove(),this.markToExpandCloner(i);let r=t.parent===null?this:this.find(t.parent);if(r===void 0)throw new Error(`scene tree move: new parent ${t.parent} not found for object ${t.id}`);r.add(i),this.markNeedsRecomputeInstancesForAncessors(r),this.markToExpandCloner(i),i.invalidateClonerTransform(i),i.updateVisible(this),i.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let s=t.localIndex;r.children.splice(s,0,r.children.pop()),ma(i)&&(i.invalidateUpstreamBooleanData(),ro(i.parent)?i.parent.invalidateDownstreamBooleanData().recomputeBoolean():n instanceof xh&&n.invalidateDownstreamBooleanData().recomputeBoolean()),i.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(t){this.shadowsDirty=!0,this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let e of this.children)e instanceof Si&&(e.visible=e.uuid===t,e.visible&&(this.activePage=e,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(t,e,i,n){if(this.shadowsDirty=!0,e.type===0){if(("overrides"in e.props||"component"in e.props)&&this.markNeedsRecomputeInstances(),"visible"in e.props&&this.markPenumbraSizeDirty(),e.path.includes("overrides")&&"states"in e.props){let{rest:s}=e.props;e={...e,props:s},this.markNeedsRecomputeInstances()}e.path[0]==="pathSnapping"&&e.props.pathId!==void 0&&this.pathConstraints.setConstraint(t,e.props.pathId)}let r=this.find(t);if(r)try{(function(s,a,o,l){s.updateByOp(a,o,l,!1)})(r,e,i,{scene:this,shared:n}),r instanceof vi&&r.updateGeometryGroupsIfNeeded()}catch(s){console.error(s)}}updateEntity2DByOp(t,e,i,n,r,s=[]){t.updateEntityByOp(e,i,n,r),this.traverseEntity(a=>{(Pr(a)||a instanceof Si)&&(s.includes(a.frameId??"")||a.frameId===e)&&a.updateEntity2DByOp(e,i,n,r)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(t){this.activePage.switchActiveCamera(t)}isInvisibleObjects(t){return t===this.invisibleObjects||t.hasAnccestor(this.invisibleObjects)}init(t,e){let i=Object.entries(e.data.lib.components).map((n,r)=>({data:n[1].asset.data,children:n[1].asset.children,id:n[0],fi:r}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:e}),this.add(this.invisibleObjects),this.createChildrenObjects(i,this.invisibleObjects,e),this.createChildrenObjects(t.objects,this,e),this.updatePage(t.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(e,!0),this.traverseEntity(n=>{n instanceof Ki&&n.updateUp()}),this.doPendingExpandCloner({scene:this,shared:e}),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(t){t.traverseEntity(e=>{(e.data.type==="Component"||e.data.type==="Instance")&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(t){Ie.is(t)&&(t.data.type==="Component"&&this.markNeedsRecomputeInstances(),t.traverseAncestors(e=>{Ie.is(e)&&e.data.type==="Component"&&this.markNeedsRecomputeInstances()}))}relativeizeInner(t,e,i,n,r,s,a){if(t){let o=n.find(t);o&&o!==n&&r.forInstancesRec(l=>{l.data=rb(l.data,c=>{let h=c.events.data(a.id),d=l.goUp(s);if(d){let u=[...BN(d.identity),t].join("-"),p=this.entityIdentityToEntity[u];if(p){let f=p.uuid;Vn.zoom(h,e)[i]=f}else console.warn("cannot find instance")}}).data})}}rewriteActions(t,e,i,n,r,s){t.forEach(a=>{a.data.type==="Transition"||a.data.type==="Animation"&&a.data.object?this.relativeizeInner(a.data.object,[...e,a.id],"object",i,n,r,s):a.data.type==="Conditional"&&(this.rewriteActions(a.data.ifActions,[...e,a.id,"ifActions"],i,n,r,s),this.rewriteActions(a.data.elseActions,[...e,a.id,"elseActions"],i,n,r,s))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(t=>{if(W1(t)&&typeof t.identity=="string"&&t.data.type==="Component")return t.traverseEntity((e,i)=>{e.data.events.forEach(n=>{if(n.data.type==="GameControl"){let r=!1;if(e.forInstancesRec(s=>{s.data=rb(s.data,a=>{s.isInstanceRoot||(a.events.delete(n.id),r=!0)}).data}),r===!1)for(let s of Tb.list)this.rewriteActions(n.data.gameActions[s],["gameActions",s],t,e,i,n)}else n.data.type==="Conditional"?(n.data.condition.type==="Distance"?(this.relativeizeInner(n.data.condition.fromObject,["condition"],"fromObject",t,e,i,n),this.relativeizeInner(n.data.condition.toObject,["condition"],"toObject",t,e,i,n)):n.data.condition.type==="State"?this.relativeizeInner(n.data.condition.object,["condition"],"object",t,e,i,n):n.data.condition.type==="Comparison"&&(n.data.condition.lOperand.type==="Property"&&this.relativeizeInner(n.data.condition.lOperand.value[0],["condition","lOperand","value"],0,t,e,i,n),n.data.condition.rOperand.type==="Property"&&this.relativeizeInner(n.data.condition.rOperand.value[0],["condition","rOperand","value"],0,t,e,i,n)),this.rewriteActions(n.data.inActions,["inActions"],t,e,i,n),this.rewriteActions(n.data.outActions,["outActions"],t,e,i,n)):"actions"in n.data&&this.rewriteActions(n.data.actions,["actions"],t,e,i,n)})}),!0})}expandInstances(t,e,i){let n=new Set;this.traverseEntity(r=>{if(W1(r)&&r.isInstanceRoot)return r.expandInstanceChildren({scene:this,shared:t,pendingDeletes:n}),e||r.resetBBoxNeedsUpdate(),i&&r.traverseEntity(s=>{i.addClip(s)}),!0});for(let r of n)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(r),_P(r)}recomputeInstances(t,e){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(i=>{W1(i)&&i.isInstanceRoot&&(i.component=void 0)}),this.expandInstances(t,!1,e))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(t){t.traverseEntity(e=>{let i=typeof e.identity=="string"?e.identity:e.identity.join("-");this.entityIdentityToEntity[i]===e&&(delete this.entityByUuid[e.uuid],delete this.entityIdentityToEntity[i],this.pathConstraints.removeDependencies(e.uuid)),e.dispose()})}clearScene(){this._autoInstancing?.dispose(),this._autoInstancing=null,this.instanceGroupsDirty=!0;for(let t of this.children)Ie.is(t)&&t.disposeRecursively();this.children.length=0}resetAfterClear(t,e){this.init(t,e)}raycast(t){return this.raycast1(t,!1)}raycast1(t,e){let i=[],n=r=>{for(let s of r.children){let a=s.cloner;if(Ie.is(s)&&!s.raycastLock&&(s.visible||a?.object.data.visible))if(e===!0&&s.isInstanceRoot){let o=[];if(t.intersectObject(s,!0,o),o.length){let l=o[0];l.object=s,l.point.applyMatrix4(l.object.matrixWorld);let c=s.matrixWorld.clone().invert();l.point.applyMatrix4(c),i.push(l)}}else(ma(s)||Hb(s)&&this.enableHelpers&&s.objectHelper.visible)&&(t.intersectObject(s,!1,i),XT(s,t,i)),n(s)}};return n(this.activePage),i}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let s=r.cloner;Ie.is(r)&&(r.visible||s?.object.data.visible)&&((ma(r)||Hb(r)&&this.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),XT(r,t,e,!0)),i(r))}};return i(this),e}forEachEntity(t){for(let e of this.children)Ie.is(e)&&t(e)}traverseConcreteEntity(t){for(let e of this.children)Ie.is(e)&&e.isConcreteEntity&&e.traverseEntity(t)}traverseEntity(t){for(let e of this.children)Ie.is(e)&&e.traverseEntity(t)}updateFont(t,e){this.traverseEntity(i=>{if(i instanceof vi&&i.data.type==="Mesh"&&(i.data.geometry.type==="TextGeometry"||i.data.geometry.type==="InputGeometry")&&i.data.geometry.font===t){let n=i.geometry,r=i.data.geometry;n.updateFont(t,e).then(()=>{n.update(r,e);let s=i.invalidateDownstreamBooleanData();ro(s)&&s.recomputeBoolean()})}})}traverseObject(t){for(let e of this.children)kc.is(e)&&e.traverseObject(t)}traverseVisibleEntity(t){for(let e of this.children)Ie.is(e)&&e.visible&&e.traverseVisibleEntity(t)}dispose(){this.clearScene()}createChildrenObjects(t,e,i){let n=0;for(let r of t)this.createObject(r.id,r.data,r.children,e,n,i),n+=1}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let e of t.children)this.unregisterObject(e)}createObject(t,e,i,n,r,s){let a={scene:this,shared:s},o=xP(t,e,a);return pl(o)&&this.shapeBlendIntances.push(o),ed(o)&&this.hairInstances.push(o),o&&(this.entityByUuid[t]=o,n.add(o),n.children.splice(r,0,n.children.pop()),i.length>0&&(o.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(i,o,s)),o.updateState(e,a),o instanceof vi&&o.updateGeometryGroupsIfNeeded(),o.updateVisible(this),o.cloner&&this.toExpandCloner.add(o),e.pathSnapping?.pathId&&this.pathConstraints.setConstraint(t,e.pathSnapping.pathId)),e.type==="Empty"&&e.animations&&o.traverseEntity(l=>{let c=l.dataPatched;if(l instanceof vi&&c.bones&&c.boneInverses){let h=c.bones.map(p=>this.find(p)),d=c.boneInverses.map(p=>new Et().fromArray(p)),u=new qg(h,d);l.bind(u,l.bindMatrix)}else l.matrixAutoUpdate=!0}),o}getCenter(t){let e=[];for(let n=0,r=t.length;n<r;++n){let{id:s,recursive:a}=t[n],o=this.find(s),l=a?o.recursiveBBox:o.singleBBox;e.push(...l.vertices)}let i=new hi;return i.setFromPoints(e),i.getCenter(iM),iM}copyMatrixWorld(t,e){if(t===null)return void e.identity();let i=this.find(t);i?(i.updateWorldMatrix(!0,!1),e.copy(i.matrixWorld)):e.identity()}copyParentMatrixWorld(t,e){if(t===null)return void e.identity();let i=this.find(t)?.parent;i?(i.updateWorldMatrix(!0,!1),e.copy(i.matrixWorld)):e.identity()}traverseMaterial(t){this.traverseEntity(e=>{if(e instanceof sn)if(Array.isArray(e.material))for(let i of e.material)jb(i)&&t(i);else jb(e.material)&&t(e.material)})}updateViewPlaneSize(t,e,i=!1){this.traverseConcreteEntity(n=>{n instanceof Ki&&n.setViewplaneSize(t,e,i)})}initializeSplatViewer(){this.splatViewer=new mV({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}}}),vV={};function $K(){let t,e;function i(n,r,s,a,o,l){let c=s.num_points(),h=l.num_components(),d=function(b,x){switch(x){case Float32Array:return b.DT_FLOAT32;case Int8Array:return b.DT_INT8;case Int16Array:return b.DT_INT16;case Int32Array:return b.DT_INT32;case Uint8Array:return b.DT_UINT8;case Uint16Array:return b.DT_UINT16;case Uint32Array:return b.DT_UINT32}}(n,o),u=h*o.BYTES_PER_ELEMENT,p=4*Math.ceil(u/4),f=p/o.BYTES_PER_ELEMENT,g=c*u,m=c*p,v=n._malloc(g);r.GetAttributeDataArrayForAllPoints(s,l,d,g,v);let y,_=new o(n.HEAPF32.buffer,v,g/o.BYTES_PER_ELEMENT);if(u===p)y=_.slice();else{y=new o(m/o.BYTES_PER_ELEMENT);let b=0;for(let x=0,w=_.length;x<w;x++){for(let S=0;S<h;S++)y[b+S]=_[x*h+S];b+=f}}return n._free(v),{name:a,count:c,itemSize:h,array:y,stride:f}}onmessage=function(n){let r=n.data;switch(r.type){case"init":t=r.decoderConfig,e=new Promise(function(o){t.onModuleLoaded=function(l){o({draco:l})},DracoDecoderModule(t)});break;case"decode":let s=r.buffer,a=r.taskConfig;e.then(o=>{let l=o.draco,c=new l.Decoder;try{let h=function(u,p,f,g){let m,v,y=g.attributeIDs,_=g.attributeTypes,b=p.GetEncodedGeometryType(f);if(b===u.TRIANGULAR_MESH)m=new u.Mesh,v=p.DecodeArrayToMesh(f,f.byteLength,m);else{if(b!==u.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");m=new u.PointCloud,v=p.DecodeArrayToPointCloud(f,f.byteLength,m)}if(!v.ok()||m.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());let x={index:null,attributes:[]};for(let w in y){let S,E,A=self[_[w]];if(g.useUniqueIDs)E=y[w],S=p.GetAttributeByUniqueId(m,E);else{if(E=p.GetAttributeId(m,u[y[w]]),E===-1)continue;S=p.GetAttribute(m,E)}let P=i(u,p,m,w,A,S);w==="color"&&(P.vertexColorSpace=g.vertexColorSpace),x.attributes.push(P)}return b===u.TRIANGULAR_MESH&&(x.index=function(w,S,E){let A=3*E.num_faces(),P=4*A,C=w._malloc(P);S.GetTrianglesUInt32Array(E,P,C);let R=new Uint32Array(w.HEAPF32.buffer,C,A).slice();return w._free(C),{array:R,itemSize:1}}(u,p,m)),u.destroy(m),x}(l,c,new Int8Array(s),a),d=h.attributes.map(u=>u.array.buffer);h.index&&d.push(h.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:h},d)}catch(h){console.error(h),self.postMessage({type:"error",id:r.id,error:h.message})}finally{l.destroy(c)}})}}}d0(vV,{DRACOLoader:()=>_V,DRACO_GLTF_CONFIG:()=>yV});var ly,yV,_V,YK=z(()=>{J(),ly=new WeakMap,yV={js:"",wasm:""},_V=class extends Ac{constructor(t){super(t),this.decoderPaths={js:"",wasm:"",dep_js:""},this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){let{decoderPaths:e}=this;return typeof t=="object"?(e.js=t.js,e.wasm=t.wasm,e.dep_js=null):(e.js=L1.resolveURL("draco_wasm_wrapper.js",t),e.wasm=L1.resolveURL("draco_decoder.wasm",t),e.dep_js=L1.resolveURL("draco_decoder.js",t)),this}setDecoderConfig(t){return console.warn("THREE.DRACOLoader: setDecoderConfig to has been deprecated and will be removed in r194."),this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,i,n){let r=new yg(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,s=>{this.parse(s,e,n)},i,n)}parse(t,e,i=()=>{}){this.decodeDracoFile(t,e,null,null,Ue,i).catch(i)}decodeDracoFile(t,e,i,n,r=Ku,s=()=>{}){let a={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:r};return this.decodeGeometry(t,a).then(e).catch(s)}decodeGeometry(t,e){let i=JSON.stringify(e);if(ly.has(t)){let o=ly.get(t);if(o.key===i)return o.promise;if(t.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n,r=this.workerNextTaskID++,s=t.byteLength,a=this._getWorker(r,s).then(o=>(n=o,new Promise((l,c)=>{n._callbacks[r]={resolve:l,reject:c},n.postMessage({type:"decode",id:r,taskConfig:e,buffer:t},[t])}))).then(o=>this._createGeometry(o.geometry));return a.catch(()=>!0).then(()=>{n&&r&&this._releaseTask(n,r)}),ly.set(t,{key:i,promise:a}),a}_createGeometry(t){let e=new jt;t.index&&e.setIndex(new Ht(t.index.array,1));for(let i=0;i<t.attributes.length;i++){let n,{name:r,array:s,itemSize:a,stride:o,vertexColorSpace:l}=t.attributes[i];if(a===o)n=new Ht(s,a);else{let c=new QE(s,o);n=new Rm(c,a,0)}r==="color"&&(this._assignVertexColorSpace(n,l),n.normalized=!(s instanceof Float32Array)),e.setAttribute(r,n)}return e}_assignVertexColorSpace(t,e){if(e!==Ue)return;let i=new Jt;for(let n=0,r=t.count;n<r;n++)i.fromBufferAttribute(t,n),Ve.colorSpaceToWorking(i,Ue),t.setXYZ(n,i.r,i.g,i.b)}_loadLibrary(t,e){let i=new yg(this.manager);return i.setResponseType(e),i.setWithCredentials(this.withCredentials),new Promise((n,r)=>{i.load(t,n,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[],{decoderPaths:i}=this;if(t){if(i.dep_js===null)throw new Error("THREE.DRACOLoader: WebAssembly is required when using a custom decoder paths.");e.push(this._loadLibrary(i.dep_js,"text"))}else e.push(this._loadLibrary(i.js,"text")),e.push(this._loadLibrary(i.wasm,"arraybuffer"));return this.decoderPending=Promise.all(e).then(n=>{let r=n[0];t||(this.decoderConfig.wasmBinary=n[1]);let s=$K.toString(),a=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
|
|
4707
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(r){let s=r.data;switch(s.type){case"decode":n._callbacks[s.id].resolve(s);break;case"error":n._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,r){return n._taskLoad>r._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}}),ZK=z(()=>{});function x5(t,e){let{url:i,fallback:n}=function(r){return function(s,{basePath:a,moduleUrl:o,cdnBuild:l}){if(a!==void 0)return{url:`${a}/${s}`};let c=`${l}/${s}`;if(o===void 0||o.startsWith("file:"))return{url:c};let h=o.slice(0,o.lastIndexOf("/")+1)+s;return h===c?{url:h}:{url:h,fallback:c}}(r,{basePath:bV,moduleUrl:typeof import.meta.url=="string"?import.meta.url:void 0,cdnBuild:"https://cdn.spline.design/@splinetool/runtime@2.0.
|
|
4727
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(r){let s=r.data;switch(s.type){case"decode":n._callbacks[s.id].resolve(s);break;case"error":n._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,r){return n._taskLoad>r._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}}),ZK=z(()=>{});function x5(t,e){let{url:i,fallback:n}=function(r){return function(s,{basePath:a,moduleUrl:o,cdnBuild:l}){if(a!==void 0)return{url:`${a}/${s}`};let c=`${l}/${s}`;if(o===void 0||o.startsWith("file:"))return{url:c};let h=o.slice(0,o.lastIndexOf("/")+1)+s;return h===c?{url:h}:{url:h,fallback:c}}(r,{basePath:bV,moduleUrl:typeof import.meta.url=="string"?import.meta.url:void 0,cdnBuild:"https://cdn.spline.design/@splinetool/runtime@2.0.158/build"})}(e);n!==void 0&&t.addEventListener("error",()=>{t.src=n},{once:!0}),t.src=i}var bV,xV=z(()=>{ZK()});function Uh(t,e){Kx.set(t,e)}function KK(t){return Kx.get(t)}function QK(t,e){let i=`${e}:${t}`;nC.has(i)||nC.add(i)}var Kx,nC,gl=z(()=>{Kx=new Map,nC=new Set});function w5(t,e,i){return t*(e-i)-e}function nM(t,e,i){return Math.min(Math.max((t+e)/(e-i),0),1)}function S5(t,e,i){for(let n of e){let r="$1"+t+n.charAt(0).toUpperCase()+n.slice(1),s=new RegExp("([^\\.])(\\b"+n+"\\b)","g");for(let a of i.entries())a[1]!==null&&i.set(a[0],a[1].replace(s,r))}}function JK(t,e,i,n,r,s,a){let o=new Map([["fragment",e.getFragmentShader()],["vertex",e.getVertexShader()]]),l=o.get("fragment")!==void 0&&/mainImage/.test(o.get("fragment")),c=o.get("fragment")!==void 0&&/mainUv/.test(o.get("fragment")),h=[],d=[],u=!1,p=!1;if(o.get("fragment")===void 0)console.error("Missing fragment shader",e);else if(c&&(a&la.CONVOLUTION)!==0)console.error("Effects that transform UV coordinates are incompatible with convolution effects",e);else if(l||c){let f=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,g=i_.Section;if(c){let v=` ${t}MainUv(UV);
|
|
4708
4728
|
`;i.set(g.FRAGMENT_MAIN_UV,i.get(g.FRAGMENT_MAIN_UV)+v),u=!0}if(o.get("vertex")!==null&&/mainSupport/.test(o.get("vertex"))){let v=` ${t}MainSupport(`;v+=/mainSupport *\([\w\s]*?uv\s*?\)/.test(o.get("vertex"))?`vUv);
|
|
4709
4729
|
`:`);
|
|
4710
4730
|
`,i.set(g.VERTEX_MAIN_SUPPORT,i.get(g.VERTEX_MAIN_SUPPORT)+v),h=h.concat([...o.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map(y=>y[1])),d=d.concat(h).concat([...o.get("vertex").matchAll(f)].map(y=>y[1]))}d=d.concat([...o.get("fragment").matchAll(f)].map(v=>v[1])),d=d.concat([...e.defines.keys()].map(v=>v.replace(/\([\w\s,]*\)/g,""))),d=d.concat([...e.uniforms.keys()]),e.uniforms.forEach((v,y)=>s.set(t+y.charAt(0).toUpperCase()+y.slice(1),v)),e.defines.forEach((v,y)=>r.set(t+y.charAt(0).toUpperCase()+y.slice(1),v)),S5(t,d,r),S5(t,d,o);let m=e.blendMode;if(n.set(m.blendFunction,m),l){let v=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/,y=`${t}MainImage(color0, UV, `;(a&la.DEPTH)!==0&&v.test(o.get("fragment"))&&(y+="depth, ",p=!0),y+=`color1);
|
|
@@ -9878,11 +9898,11 @@ void main() {
|
|
|
9878
9898
|
void main() {
|
|
9879
9899
|
vec4 texel = texture2D( tDiffuse, vUv );
|
|
9880
9900
|
gl_FragColor = texel;
|
|
9881
|
-
}`}),Vet=new class{constructor(t){this._mesh=new gi(ket,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,Net)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}(s7),jM=null,GM=null,jet=me.identity(),a7=class{constructor(t,e,i,n){var r;this.uuid=t,this.width=e,this.height=i,this.context=n,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||Rg.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let s=this.width,a=this.height;this.renderer.dpr=_U(s,a,this.dpr,this.isScreenSpace),this.renderer.setSize(s,a)},this.onFrameOverrideObjectEvent=s=>{if(s.target?.uuid!==void 0){let a=this.frameRoot?.find(s.target.uuid);a&&a.dispatchEvent({...s,target:a})}},this.scene2d=new GP(Pt.generateUUID(),aT.defaultData,{dpr:window.devicePixelRatio,shared:n.shared}),this.canvas=(jM===null&&(jM=document.createElement("canvas")),jM),this.renderer=(r=this.canvas,GM===null&&(GM=new Oet(r)),GM),this.promise=this.init(),this.renderTarget=new Ne(1,1,{type:Xn,stencilBuffer:!1,depthBuffer:!1}),n.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=n.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new kF(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(t){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,t.blitTextureToTarget)t.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{s7.uniforms.tDiffuse.value=this.canvasTexture;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),Vet.render(t),t.setRenderTarget(e)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,i,n){this.scene2d.updateEntityByOp(t,e,i,n),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,i=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=i,this.frameOverride.localMatrix=jet,this.isScreenSpace&&(this.frameOverride.fill.color=Je.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:i},o7({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(t,e=window.devicePixelRatio){let i=Math.max(1,t?.width??this.width),n=Math.max(1,t?.height??this.height);this.dpr=e,this.width=i,this.height=n,this._innerApplySize();let r=function(s,a,o,l){let c=_U(s,a,o,l),h=Math.max(o,512/Math.min(s,a)),d=Math.min(h,c);return{width:Math.max(1,Math.ceil(s*d)),height:Math.max(1,Math.ceil(a*d))}}(i,n,e,this.isScreenSpace);this.renderTarget.setSize(r.width,r.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(t),this.frameOverride?.requestRender()}applyFrame(t){let e=this.context.scene.find2D(t);if(e&&e instanceof lo)return this.disposeFrameOverride(),this.frameRoot=e,this.frameOverride=e.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(i=>{i.addEventListener("beginState",this.onFrameOverrideObjectEvent),i.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginState",this.onFrameOverrideObjectEvent),t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function o7({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){if(t instanceof lo&&e instanceof lo||t instanceof Sh&&e instanceof Sh)for(let a=0,o=t.children.length;a<o;a++){let l=t.children[a],c=e.children[a];l&&c&&l.uuid===c.uuid&&Get({objectOverride:l,objectRoot:c,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s})}}function Get({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){let[a,o]=function(d){if(HM(d))return[d.width,d.height];if(d instanceof ax){let[u,p]=d.getHalfSize();return[2*u,2*p]}if(d instanceof Sh){let[u,p]=d.recursiveBBox.getHalfSize();return[2*u,2*p]}return[0,0]}(e),{width:l,height:c,position:h}=r7({constraints:t.data,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:e.position});if(t.position=h,t.data={...t.data,position:h},t.states)for(let d in t.states)Het({stateId:d,objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s});if(HM(t)||t instanceof Sh)HM(t)&&(t.width=l,t.height=c,t.data={...t.data,width:l,height:c}),o7({objectOverride:t,objectRoot:e,newParentWidth:l,newParentHeight:c,initialParentWidth:a,initialParentHeight:o});else if(t instanceof ax){let d=e,u=a!==0?l/a:1,p=o!==0?c/o:1;t.path=function(f,g=1,m=1){if(g<=0||m<=0)return f;if(i7(f))return console.warn("Cannot scale invalid path",f),VM([]);if(g===1&&m===1)return f;try{return VM((0,Fet.parseSVG)(f).map(v=>{let y={...v};return"x"in y&&(y.x=y.x*g),"y"in y&&(y.y=y.y*m),"x1"in y&&(y.x1=y.x1*g),"x2"in y&&(y.x2=y.x2*g),"y1"in y&&(y.y1=y.y1*m),"y2"in y&&(y.y2=y.y2*m),"rx"in y&&(y.rx=y.rx*g),"ry"in y&&(y.ry=y.ry*m),y}))}catch(v){return console.warn("Error parsing SVG path",v),VM([])}}(d.path,u,p),t.data={...t.data,path:t.path}}}function Het({stateId:t,objectOverride:e,objectRoot:i,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a}){let o=e.states?.[t],l=i.states?.[t];if(o&&l){let{width:c,height:h,position:d}=r7({constraints:e.data,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a,objectInitialWidth:Xc.isResizeable(l)?l.width:0,objectInitialHeight:Xc.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(e.states[t],{position:d}),Xc.isResizeable(o)&&Object.assign(e.states[t],{width:c,height:h})}}function HM(t){return t instanceof D0||t instanceof lo||t instanceof VP||t instanceof jP}jx();var bU,Wet=class extends vi{constructor(t,e,i){super(t,e,i),this.isUIObject=!0,this.uiCanvas=new a7(t+"-canvas",e.geometry.width,e.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),t.type===0&&(t.props.frame!==void 0&&this.applyFrame(t.props.frame,i.shared),(t.props.width!==void 0||t.props.height!==void 0)&&this.applySize(t.props,i.shared))}applySize(t,e){let i=t?.width??this.dataPatched.geometry.width,n=t?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:n}),this.applyGeometryParametersFromFrame(e)}applyFrame(t,e){this.uiCanvas.applyFrame(t),this.applyGeometryParametersFromFrame(e),this.applyMaterialParametersFromFrame({shared:e})}applyGeometryParametersFromFrame(t){let e=this.frame;e&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=hh(this.dataPatched.geometry,t,this.data.flatShading,this))}applyMaterialParametersFromFrame(t){let e=this.frame;if(e){let i=e.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,t,!0)}}updateEntity2DByOp(t,e,i,n){this.uiCanvas.updateEntity2DByOp(t,e,i,n),t===this.frameId&&e.type===0&&(e.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(n):ri(e.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:n}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(t){super.removeInteractionGeometry(t),this.applySize({},t)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.applySize({width:t.width,height:t.height},e);let i={...this.data.geometry,...t};this.localGeometry?.dispose(),this.localGeometry=hh(i,e,this.data.flatShading,this)}};ke(),Rp("UIGeometry",(t,e,i)=>new Wet(t,e,i)),Lx=bU={Scene2D:GP,UICanvas:a7,loadHanaUIRUNTIME:function(){return nx||(nx=async()=>async function(t,e){return await t.default(e?{module_or_path:e}:void 0),Object.getOwnPropertyDescriptor(t.Engine.prototype,"scene")||Object.defineProperty(t.Engine.prototype,"scene",{get:function(){let i=Object.create(t.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>t.Engine.create(i,JSON.parse('{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}'),!0)}}(await Promise.resolve().then(()=>(wR(),xR)),sU??function(){let t=typeof process<"u"?"2.0.157":void 0;return`https://cdn.spline.design/@splinetool/runtime${t?`@${t}`:""}/build/hana-ui.wasm`}())),t7().then(()=>{})},setHanaUIWasmUrl:function(t){sU=t}},Rb!==null&&bU.setHanaUIWasmUrl(Rb),Ei("ui-2d"),P8(),J();var l7,WM,qet=class{constructor(){this.type="ShapePath",this.color=new Jt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new vg,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath?.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){return this.currentPath?.bezierCurveTo(t,e,i,n,r,s),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let t={loc:0,t:0};function e(c,h,d,u){let p=c.x,f=h.x,g=d.x,m=u.x,v=c.y,y=h.y,_=d.y,b=u.y,x=(m-g)*(v-_)-(b-_)*(p-g),w=(b-_)*(f-p)-(m-g)*(y-v),S=x/w,E=((f-p)*(v-_)-(y-v)*(p-g))/w;if(w===0&&x!==0||S<=0||S>=1||E<0||E>1)return null;if(x===0&&w===0){for(let A=0;A<2;A++){if(i(A===0?d:u,c,h),t.loc===0){let P=A===0?d:u;return{x:P.x,y:P.y,t:t.t}}if(t.loc===2)return{x:+(p+t.t*(f-p)).toPrecision(10),y:+(v+t.t*(y-v)).toPrecision(10),t:t.t}}return null}for(let A=0;A<2;A++)if(i(A===0?d:u,c,h),t.loc===0){let P=A===0?d:u;return{x:P.x,y:P.y,t:t.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(v+S*(y-v)).toPrecision(10),t:S}}function i(c,h,d){let u,p=d.x-h.x,f=d.y-h.y,g=c.x-h.x,m=c.y-h.y,v=p*m-g*f;return c.x===h.x&&c.y===h.y?(t.loc=0,void(t.t=0)):c.x===d.x&&c.y===d.y?(t.loc=1,void(t.t=1)):void(v<-Number.EPSILON?t.loc=3:v>Number.EPSILON?t.loc=4:p*g<0||f*m<0?t.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(g*g+m*m)?t.loc=6:(u=p!==0?g/p:m/f,t.loc=2,t.t=u))}let n=0,r=999999999,s=-999999999,a=[];this.subPaths.forEach(c=>{let h=c.getPoints(),d=-999999999,u=999999999,p=-999999999,f=999999999;for(let g=0;g<h.length;g++){let m=h[g];m.y>d&&(d=m.y),m.y<u&&(u=m.y),m.x>p&&(p=m.x),m.x<f&&(f=m.x)}s<=p&&(s=p+1),r>=f&&(r=f-1),h.length&&a.push({curves:c.curves,points:h,isCW:sA.isClockWise(h),identifier:n++,boundingBox:new o3(new et(f,u),new et(p,d))})});let o=a.map(c=>function(h,d,u,p,f){(f==null||f==="")&&(f="nonzero");let g=new et;h.boundingBox.getCenter(g);let m=function(w,S,E){let A=new et;S.getCenter(A);let P=[];return E.forEach(C=>{C.boundingBox.containsPoint(A)&&function(R,O){let D=[],F=[];for(let V=1;V<R.length;V++){let U=R[V-1],j=R[V];for(let q=1;q<O.length;q++){let rt=e(U,j,O[q-1],O[q]);rt!==null&&D.find(it=>it.t<=rt.t+Number.EPSILON&&it.t>=rt.t-Number.EPSILON)===void 0&&(D.push(rt),F.push(new et(rt.x,rt.y)))}}return F}(w,C.points).forEach(R=>{P.push({identifier:C.identifier,isCW:C.isCW,point:R})})}),P.sort((C,R)=>C.point.x-R.point.x),P}([new et(u,g.y),new et(p,g.y)],h.boundingBox,d);m.sort((w,S)=>w.point.x-S.point.x);let v=[],y=[];m.forEach(w=>{w.identifier===h.identifier?v.push(w):y.push(w)});let _=v[0].point.x,b=[],x=0;for(;x<y.length&&y[x].point.x<_;)b.length>0&&b[b.length-1]===y[x].identifier?b.pop():b.push(y[x].identifier),x++;if(b.push(h.identifier),f==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:h.identifier,isHole:w,for:S}}if(f==="nonzero"){let w=!0,S=null,E=null;for(let A=0;A<b.length;A++){let P=b[A];d[P]&&(w?(E=d[P].isCW,w=!1,S=P):E!==d[P].isCW&&(E=d[P].isCW,w=!0))}return{identifier:h.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(c,a,r,s,this.userData?.style.fillRule)),l=[];return a.forEach(c=>{let h=o[c.identifier];if(h&&!h.isHole){let d=new Xg;d.curves=c.curves,o.filter(u=>u?.isHole&&u.for===c.identifier).forEach(u=>{if(u){let p=a[u.identifier],f=new vg;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},h7=!1,xU=new Promise(t=>{l7=t}),wU=!1;function SU(){if(h7=!0,!wU)return WM||(WM=async function(){let t=await import("./opentype.js");l7(t),wU=!0}(),WM)}var Xet=new class{async load(t,e,i=()=>{}){let{load:n}=await xU;n(t,(r,s)=>{r||!s?i(r??"Something went wrong"):e(s)})}async parse(t){let{parse:e,Bidi:i}=await xU;try{let n=e(t),r=new i,s=a=>n.charToGlyphIndex(a.char);return r.registerModifier("glyphIndex",null,s),r.applyFeatures(n,n.defaultRenderOptions.features),{font:n,bidi:r}}catch(n){console.error(n)}}};function $et(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}J(),Z3(),ke(),Rp("TextGeometry",(t,e,i)=>new kP(t,e,i));var MU={create:(t,e)=>new OT(t,e)};hT("TextGeometry",MU),hT("InputGeometry",MU),Y3=class{constructor(t){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}update(t){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}async load(t){try{this._layoutErrorWarned=!1;let e=await async function(i){let n,r,s=!1;if(i.url?(n=await async function(a){let o;try{o=await fetch(a)}catch(l){throw new Error(`could not fetch the font at ${a}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${a}`);return await o.arrayBuffer()}(i.url),r=i.url,s=i.url.startsWith("/")):i.data&&(n=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),n){if(!h7)return{font:void 0,url:r,intercepted:s,arr:n,bidi:null};{let a=await Xet.parse(n);if(a)return{font:a.font,url:r,intercepted:s,arr:n,bidi:a.bidi}}}}(t);e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}catch(e){console.warn(`Could not load the font "${t.url??"(inline data)"}"`,e)}}warnLayoutError(t){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,t))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(t,e,i){if(!this._bidi)return[];let n=this._bidi;n.getTextGlyphs(e);let r=n.tokenizer.tokens,s=[],a=0,o=i.length===r.length;for(let l=0;l<i.length;l++){let c=i[l].index,h=String.fromCharCode(i[l].unicode),d=r[a];if($et(c,d)||o)s.push({char:h,index:c,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let u=d.char,p="",f=[d.state.glyphIndex],g=[],m=!1;for(;!m;)a++,p=e.charAt(a),u+=p,f.push(t.charToGlyphIndex(p)),g=t.stringToGlyphs(u),g.length===1&&g[0].index===c&&(m=!0),a>e.length&&(m=!0);s.push({char:h,index:c,replacements:f,replacementChars:Array.from(u)}),a++}}return s}generateShapes(t,e,i){if(!this._isLoaded)return;let n=this.font,r=e.fontSize/this.unitsPerEm,s=e.fontSize*e.lineHeight,a=t.map(v=>this.getTextWidth(v,e)),o=typeof e.width=="string"?Number(i.getVariable(e.width)):e.width,l=typeof e.height=="string"?Number(i.getVariable(e.height)):e.height,c=this.getCharWidth(`
|
|
9901
|
+
}`}),Vet=new class{constructor(t){this._mesh=new gi(ket,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,Net)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}(s7),jM=null,GM=null,jet=me.identity(),a7=class{constructor(t,e,i,n){var r;this.uuid=t,this.width=e,this.height=i,this.context=n,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||Rg.add(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let s=this.width,a=this.height;this.renderer.dpr=_U(s,a,this.dpr,this.isScreenSpace),this.renderer.setSize(s,a)},this.onFrameOverrideObjectEvent=s=>{if(s.target?.uuid!==void 0){let a=this.frameRoot?.find(s.target.uuid);a&&a.dispatchEvent({...s,target:a})}},this.scene2d=new GP(Pt.generateUUID(),aT.defaultData,{dpr:window.devicePixelRatio,shared:n.shared}),this.canvas=(jM===null&&(jM=document.createElement("canvas")),jM),this.renderer=(r=this.canvas,GM===null&&(GM=new Oet(r)),GM),this.promise=this.init(),this.renderTarget=new Ne(1,1,{type:Xn,stencilBuffer:!1,depthBuffer:!1}),n.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=n.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new kF(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(t){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,t.blitTextureToTarget)t.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{s7.uniforms.tDiffuse.value=this.canvasTexture;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),Vet.render(t),t.setRenderTarget(e)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,i,n){this.scene2d.updateEntityByOp(t,e,i,n),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,i=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=i,this.frameOverride.localMatrix=jet,this.isScreenSpace&&(this.frameOverride.fill.color=Je.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:i},o7({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(t,e=window.devicePixelRatio){let i=Math.max(1,t?.width??this.width),n=Math.max(1,t?.height??this.height);this.dpr=e,this.width=i,this.height=n,this._innerApplySize();let r=function(s,a,o,l){let c=_U(s,a,o,l),h=Math.max(o,512/Math.min(s,a)),d=Math.min(h,c);return{width:Math.max(1,Math.ceil(s*d)),height:Math.max(1,Math.ceil(a*d))}}(i,n,e,this.isScreenSpace);this.renderTarget.setSize(r.width,r.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(t),this.frameOverride?.requestRender()}applyFrame(t){let e=this.context.scene.find2D(t);if(e&&e instanceof lo)return this.disposeFrameOverride(),this.frameRoot=e,this.frameOverride=e.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(i=>{i.addEventListener("beginState",this.onFrameOverrideObjectEvent),i.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginState",this.onFrameOverrideObjectEvent),t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function o7({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){if(t instanceof lo&&e instanceof lo||t instanceof Sh&&e instanceof Sh)for(let a=0,o=t.children.length;a<o;a++){let l=t.children[a],c=e.children[a];l&&c&&l.uuid===c.uuid&&Get({objectOverride:l,objectRoot:c,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s})}}function Get({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){let[a,o]=function(d){if(HM(d))return[d.width,d.height];if(d instanceof ax){let[u,p]=d.getHalfSize();return[2*u,2*p]}if(d instanceof Sh){let[u,p]=d.recursiveBBox.getHalfSize();return[2*u,2*p]}return[0,0]}(e),{width:l,height:c,position:h}=r7({constraints:t.data,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:e.position});if(t.position=h,t.data={...t.data,position:h},t.states)for(let d in t.states)Het({stateId:d,objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s});if(HM(t)||t instanceof Sh)HM(t)&&(t.width=l,t.height=c,t.data={...t.data,width:l,height:c}),o7({objectOverride:t,objectRoot:e,newParentWidth:l,newParentHeight:c,initialParentWidth:a,initialParentHeight:o});else if(t instanceof ax){let d=e,u=a!==0?l/a:1,p=o!==0?c/o:1;t.path=function(f,g=1,m=1){if(g<=0||m<=0)return f;if(i7(f))return console.warn("Cannot scale invalid path",f),VM([]);if(g===1&&m===1)return f;try{return VM((0,Fet.parseSVG)(f).map(v=>{let y={...v};return"x"in y&&(y.x=y.x*g),"y"in y&&(y.y=y.y*m),"x1"in y&&(y.x1=y.x1*g),"x2"in y&&(y.x2=y.x2*g),"y1"in y&&(y.y1=y.y1*m),"y2"in y&&(y.y2=y.y2*m),"rx"in y&&(y.rx=y.rx*g),"ry"in y&&(y.ry=y.ry*m),y}))}catch(v){return console.warn("Error parsing SVG path",v),VM([])}}(d.path,u,p),t.data={...t.data,path:t.path}}}function Het({stateId:t,objectOverride:e,objectRoot:i,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a}){let o=e.states?.[t],l=i.states?.[t];if(o&&l){let{width:c,height:h,position:d}=r7({constraints:e.data,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a,objectInitialWidth:Xc.isResizeable(l)?l.width:0,objectInitialHeight:Xc.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(e.states[t],{position:d}),Xc.isResizeable(o)&&Object.assign(e.states[t],{width:c,height:h})}}function HM(t){return t instanceof D0||t instanceof lo||t instanceof VP||t instanceof jP}jx();var bU,Wet=class extends vi{constructor(t,e,i){super(t,e,i),this.isUIObject=!0,this.uiCanvas=new a7(t+"-canvas",e.geometry.width,e.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),t.type===0&&(t.props.frame!==void 0&&this.applyFrame(t.props.frame,i.shared),(t.props.width!==void 0||t.props.height!==void 0)&&this.applySize(t.props,i.shared))}applySize(t,e){let i=t?.width??this.dataPatched.geometry.width,n=t?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:n}),this.applyGeometryParametersFromFrame(e)}applyFrame(t,e){this.uiCanvas.applyFrame(t),this.applyGeometryParametersFromFrame(e),this.applyMaterialParametersFromFrame({shared:e})}applyGeometryParametersFromFrame(t){let e=this.frame;e&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=hh(this.dataPatched.geometry,t,this.data.flatShading,this))}applyMaterialParametersFromFrame(t){let e=this.frame;if(e){let i=e.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,t,!0)}}updateEntity2DByOp(t,e,i,n){this.uiCanvas.updateEntity2DByOp(t,e,i,n),t===this.frameId&&e.type===0&&(e.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(n):ri(e.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:n}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(t){super.removeInteractionGeometry(t),this.applySize({},t)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.applySize({width:t.width,height:t.height},e);let i={...this.data.geometry,...t};this.localGeometry?.dispose(),this.localGeometry=hh(i,e,this.data.flatShading,this)}};ke(),Rp("UIGeometry",(t,e,i)=>new Wet(t,e,i)),Lx=bU={Scene2D:GP,UICanvas:a7,loadHanaUIRUNTIME:function(){return nx||(nx=async()=>async function(t,e){return await t.default(e?{module_or_path:e}:void 0),Object.getOwnPropertyDescriptor(t.Engine.prototype,"scene")||Object.defineProperty(t.Engine.prototype,"scene",{get:function(){let i=Object.create(t.SceneController.prototype);return i.__wbg_ptr=this.__wbg_ptr,i}}),{createEngine:i=>t.Engine.create(i,JSON.parse('{"schema":13,"scenes":[{"fi":0,"id":"32603ebf4-bd9a-54ba-c1e9-6645c3ee7a53","data":{"name":"Page","backgroundColor":[0,0,0,0],"objects":[]}}],"assets":{"images":{},"videos":{},"colors":{},"audios":{},"numbers":{},"booleans":{},"strings":{},"dynamicVariables":{"counters":{},"randoms":{},"timers":{},"times":{}},"fonts":{},"animations":{},"geometries":{},"emojiArt":{}},"publish":{"logo":true,"presentationSizing":"Contain","allowPageScroll":true,"showBackground":true},"framePublish":{},"components":{}}'),!0)}}(await Promise.resolve().then(()=>(wR(),xR)),sU??function(){let t=typeof process<"u"?"2.0.158":void 0;return`https://cdn.spline.design/@splinetool/runtime${t?`@${t}`:""}/build/hana-ui.wasm`}())),t7().then(()=>{})},setHanaUIWasmUrl:function(t){sU=t}},Rb!==null&&bU.setHanaUIWasmUrl(Rb),Ei("ui-2d"),P8(),J();var l7,WM,qet=class{constructor(){this.type="ShapePath",this.color=new Jt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new vg,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath?.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){return this.currentPath?.bezierCurveTo(t,e,i,n,r,s),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let t={loc:0,t:0};function e(c,h,d,u){let p=c.x,f=h.x,g=d.x,m=u.x,v=c.y,y=h.y,_=d.y,b=u.y,x=(m-g)*(v-_)-(b-_)*(p-g),w=(b-_)*(f-p)-(m-g)*(y-v),S=x/w,E=((f-p)*(v-_)-(y-v)*(p-g))/w;if(w===0&&x!==0||S<=0||S>=1||E<0||E>1)return null;if(x===0&&w===0){for(let A=0;A<2;A++){if(i(A===0?d:u,c,h),t.loc===0){let P=A===0?d:u;return{x:P.x,y:P.y,t:t.t}}if(t.loc===2)return{x:+(p+t.t*(f-p)).toPrecision(10),y:+(v+t.t*(y-v)).toPrecision(10),t:t.t}}return null}for(let A=0;A<2;A++)if(i(A===0?d:u,c,h),t.loc===0){let P=A===0?d:u;return{x:P.x,y:P.y,t:t.t}}return{x:+(p+S*(f-p)).toPrecision(10),y:+(v+S*(y-v)).toPrecision(10),t:S}}function i(c,h,d){let u,p=d.x-h.x,f=d.y-h.y,g=c.x-h.x,m=c.y-h.y,v=p*m-g*f;return c.x===h.x&&c.y===h.y?(t.loc=0,void(t.t=0)):c.x===d.x&&c.y===d.y?(t.loc=1,void(t.t=1)):void(v<-Number.EPSILON?t.loc=3:v>Number.EPSILON?t.loc=4:p*g<0||f*m<0?t.loc=5:Math.sqrt(p*p+f*f)<Math.sqrt(g*g+m*m)?t.loc=6:(u=p!==0?g/p:m/f,t.loc=2,t.t=u))}let n=0,r=999999999,s=-999999999,a=[];this.subPaths.forEach(c=>{let h=c.getPoints(),d=-999999999,u=999999999,p=-999999999,f=999999999;for(let g=0;g<h.length;g++){let m=h[g];m.y>d&&(d=m.y),m.y<u&&(u=m.y),m.x>p&&(p=m.x),m.x<f&&(f=m.x)}s<=p&&(s=p+1),r>=f&&(r=f-1),h.length&&a.push({curves:c.curves,points:h,isCW:sA.isClockWise(h),identifier:n++,boundingBox:new o3(new et(f,u),new et(p,d))})});let o=a.map(c=>function(h,d,u,p,f){(f==null||f==="")&&(f="nonzero");let g=new et;h.boundingBox.getCenter(g);let m=function(w,S,E){let A=new et;S.getCenter(A);let P=[];return E.forEach(C=>{C.boundingBox.containsPoint(A)&&function(R,O){let D=[],F=[];for(let V=1;V<R.length;V++){let U=R[V-1],j=R[V];for(let q=1;q<O.length;q++){let rt=e(U,j,O[q-1],O[q]);rt!==null&&D.find(it=>it.t<=rt.t+Number.EPSILON&&it.t>=rt.t-Number.EPSILON)===void 0&&(D.push(rt),F.push(new et(rt.x,rt.y)))}}return F}(w,C.points).forEach(R=>{P.push({identifier:C.identifier,isCW:C.isCW,point:R})})}),P.sort((C,R)=>C.point.x-R.point.x),P}([new et(u,g.y),new et(p,g.y)],h.boundingBox,d);m.sort((w,S)=>w.point.x-S.point.x);let v=[],y=[];m.forEach(w=>{w.identifier===h.identifier?v.push(w):y.push(w)});let _=v[0].point.x,b=[],x=0;for(;x<y.length&&y[x].point.x<_;)b.length>0&&b[b.length-1]===y[x].identifier?b.pop():b.push(y[x].identifier),x++;if(b.push(h.identifier),f==="evenodd"){let w=b.length%2==0,S=b[b.length-2];return{identifier:h.identifier,isHole:w,for:S}}if(f==="nonzero"){let w=!0,S=null,E=null;for(let A=0;A<b.length;A++){let P=b[A];d[P]&&(w?(E=d[P].isCW,w=!1,S=P):E!==d[P].isCW&&(E=d[P].isCW,w=!0))}return{identifier:h.identifier,isHole:w,for:S}}console.warn('fill-rule: "'+f+'" is currently not implemented.')}(c,a,r,s,this.userData?.style.fillRule)),l=[];return a.forEach(c=>{let h=o[c.identifier];if(h&&!h.isHole){let d=new Xg;d.curves=c.curves,o.filter(u=>u?.isHole&&u.for===c.identifier).forEach(u=>{if(u){let p=a[u.identifier],f=new vg;f.curves=p.curves,d.holes.push(f)}}),l.push(d)}}),l}},h7=!1,xU=new Promise(t=>{l7=t}),wU=!1;function SU(){if(h7=!0,!wU)return WM||(WM=async function(){let t=await import("./opentype.js");l7(t),wU=!0}(),WM)}var Xet=new class{async load(t,e,i=()=>{}){let{load:n}=await xU;n(t,(r,s)=>{r||!s?i(r??"Something went wrong"):e(s)})}async parse(t){let{parse:e,Bidi:i}=await xU;try{let n=e(t),r=new i,s=a=>n.charToGlyphIndex(a.char);return r.registerModifier("glyphIndex",null,s),r.applyFeatures(n,n.defaultRenderOptions.features),{font:n,bidi:r}}catch(n){console.error(n)}}};function $et(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}J(),Z3(),ke(),Rp("TextGeometry",(t,e,i)=>new kP(t,e,i));var MU={create:(t,e)=>new OT(t,e)};hT("TextGeometry",MU),hT("InputGeometry",MU),Y3=class{constructor(t){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._layoutErrorWarned=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}update(t){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=this.load(t)}async load(t){try{this._layoutErrorWarned=!1;let e=await async function(i){let n,r,s=!1;if(i.url?(n=await async function(a){let o;try{o=await fetch(a)}catch(l){throw new Error(`could not fetch the font at ${a}: ${l}`)}if(!o.ok)throw new Error(`${o.status} ${o.statusText} fetching the font at ${a}`);return await o.arrayBuffer()}(i.url),r=i.url,s=i.url.startsWith("/")):i.data&&(n=i.data.buffer.slice(i.data.byteOffset,i.data.byteOffset+i.data.byteLength)),n){if(!h7)return{font:void 0,url:r,intercepted:s,arr:n,bidi:null};{let a=await Xet.parse(n);if(a)return{font:a.font,url:r,intercepted:s,arr:n,bidi:a.bidi}}}}(t);e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)}catch(e){console.warn(`Could not load the font "${t.url??"(inline data)"}"`,e)}}warnLayoutError(t){this._layoutErrorWarned||(this._layoutErrorWarned=!0,console.warn(`Text layout failed for the font "${this._url??"(inline data)"}"`,t))}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(t,e,i){if(!this._bidi)return[];let n=this._bidi;n.getTextGlyphs(e);let r=n.tokenizer.tokens,s=[],a=0,o=i.length===r.length;for(let l=0;l<i.length;l++){let c=i[l].index,h=String.fromCharCode(i[l].unicode),d=r[a];if($et(c,d)||o)s.push({char:h,index:c,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),a++;else{let u=d.char,p="",f=[d.state.glyphIndex],g=[],m=!1;for(;!m;)a++,p=e.charAt(a),u+=p,f.push(t.charToGlyphIndex(p)),g=t.stringToGlyphs(u),g.length===1&&g[0].index===c&&(m=!0),a>e.length&&(m=!0);s.push({char:h,index:c,replacements:f,replacementChars:Array.from(u)}),a++}}return s}generateShapes(t,e,i){if(!this._isLoaded)return;let n=this.font,r=e.fontSize/this.unitsPerEm,s=e.fontSize*e.lineHeight,a=t.map(v=>this.getTextWidth(v,e)),o=typeof e.width=="string"?Number(i.getVariable(e.width)):e.width,l=typeof e.height=="string"?Number(i.getVariable(e.height)):e.height,c=this.getCharWidth(`
|
|
9882
9902
|
`,e),h=e.horizontalAlign===1?c:0,d=this.getLineInitialOffsetX(a[0],o,e.horizontalAlign,t[0],c),u=this.getLineInitialOffsetY(s,t.length,l,r,e.verticalAlign),p=[],f=t.map(()=>[]),g=t.map(()=>[]);for(let v=0;v<t.length;v++){let y=t[v],_={features:{liga:!0},letterSpacing:e.letterSpacing},b=[];try{b=n.stringToGlyphs(y,_)}catch(A){this.warnLayoutError(A)}d=this.getLineInitialOffsetX(a[v],o,e.horizontalAlign,y,c);let x=[];try{x=this.reverseLigaturesTable(n,y,b)}catch(A){this.warnLayoutError(A)}let w=this.computeSpaceWidthForLine(t,v,e,i),S=0,E=b[0];E&&e.horizontalAlign===2&&E.leftSideBearing!==void 0&&(d-=E.leftSideBearing*r);try{this.font?.forEachGlyph(y,d,u,e.fontSize,_,(A,P,C,R,O)=>{let D=A.index===0?`
|
|
9883
9903
|
`:A.unicode?String.fromCharCode(A.unicode):void 0,F=x[S],V=0;if(D===`
|
|
9884
9904
|
`)V=h;else if(D===" ")V=w;else{let U=this.createPath(A,r,P,C,e);U&&(V=U.offsetX,p.push(U.path))}if(F&&F.replacements.length!==1){let U=F.replacements.map(it=>(n.glyphs.get(it).advanceWidth??0)*r),j=U.reduce((it,Y)=>it+Y,0),q=U.map(it=>it/j),rt=P;for(let it=0;it<q.length;it++){let Y=V*q[it];g[v].push([rt,C]),f[v].push(Y),rt+=Y}}else g[v].push([P,C]),f[v].push(V);S++})}catch(A){this.warnLayoutError(A)}u-=s}let m=[];for(let v=0,y=p.length;v<y;v++)m.push(...p[v].toShapes());return{shapes:m,charWidths:f,lineWidths:a,charCoords:g}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(t,e,i,n,r){return(i===3||i===2)&&n.indexOf(`
|
|
9885
|
-
`)>=0&&(t-=r),i===3?.5*e-.5*t:i===2?e-t:0}getLineInitialOffsetY(t,e,i,n,r){let s=e*t,a=t-Math.abs(this.ascender-this.descender)*n,o=-this.ascender*n-a/2;return r===3?-(i-s-o):r===2?-(.5*i-.5*s-o):o}createPath(t,e,i,n,r){let s=t.getPath(i,-n,r.fontSize,{kerning:!1,letterSpacing:r.letterSpacing});if(!s)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");let a=new qet,o=(t.advanceWidth??1)*e;if(t)for(let l of s.commands){let c=a.currentPath?.currentPoint;if(!c||l.type==="Z"||c.x!==l.x||-c.y!==l.y)switch(l.type){case"M":a.moveTo(l.x,-l.y);break;case"L":a.lineTo(l.x,-l.y);break;case"Q":a.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":a.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return a.subPaths.forEach(l=>{let c=function(h){if(h.length){let d=h[0];if(d instanceof gs)return d.v1;if(d instanceof ks||d instanceof Ko)return d.v0}}(l.curves);c!==void 0&&l.currentPoint.distanceTo(c)>0&&l.lineTo(c.x,c.y)}),{offsetX:o,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(t,e,i,n){let r=this.getCharWidth(" ",i),s=t[e];if(s){let a=this.countSpaces(s.trimEnd());if(i.horizontalAlign===4&&e<t.length-1&&a)return((typeof i.width=="string"?Number(n.getVariable(i.width)):i.width)-(this.getTextWidth(s,i)-a*r))/a}return r}countSpaces(t){return(t.match(/ /g)||[]).length}},Ei("text"),Xt();var c7=null;function EU(){return c7}function Yet(t){let e=!1;return t.scene.objects.forEach(i=>{i.data.type==="Page"&&!e&&i.data.publish.gameControlObject&&td.traverseModuleInstances(t,i.id,(n,r,s)=>{for(let a of s)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(e=!0)})}),e}ti();var Fy=(t,e)=>{let i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},qM=t=>t*(Math.PI/180),Ny=new Map,ox=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.addEventListener?t.addEventListener(n,i,!1):t.attachEvent&&t.attachEvent(n,i)},lx=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.removeEventListener?t.removeEventListener(n,i):t.detachEvent&&t.detachEvent(n,i)},d7=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),AU=()=>{if(!(typeof window>"u"))return{x:window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},XM=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},$M=(t,e,i)=>{let n=u7(t);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof e=="string")n[r]=e+" "+i;else{let s="";for(let a=0,o=e.length;a<o;a+=1)s+=e[a]+" "+i+", ";n[r]=s.slice(0,-2)}return n},u7=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},YM=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},TC=(t,e)=>{if(t.length)for(let i=0,n=t.length;i<n;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(p7="ontouchstart"in window,f7=!!window.PointerEvent,m7=!!window.MSPointerEvent);var p7,f7,m7,ou,TU={start:"mousedown",move:"mousemove",end:"mouseup"},pm={};function Rc(){}f7?ou={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:m7?ou={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:p7?(ou={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},pm=TU):ou=TU,Rc.prototype.on=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]=n._handlers_[i]||[],n._handlers_[i].push(e);return n},Rc.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},t===void 0?i._handlers_={}:e===void 0?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},Rc.prototype.trigger=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]&&n._handlers_[i].length&&n._handlers_[i].forEach(function(a){a.call(n,{type:i,target:n},e)})},Rc.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((i,n)=>{let r={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&Object.prototype.hasOwnProperty.call(n,s)?r[s]=n[s]:Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s]);return r})(e.options,t))},Rc.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){typeof i["on"+e]=="function"?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},ox(t,ou[e],i._domHandlers_[e]),pm[e]&&ox(t,pm[e],i._domHandlers_[e]),i},Rc.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},lx(t,ou[e],i._domHandlers_[e]),pm[e]&&lx(t,pm[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var HP=Rc;function Fn(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=Fn.id,Fn.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}Fn.prototype=new HP,Fn.constructor=Fn,Fn.id=0,Fn.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},Fn.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let r=u7("borderRadius");for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]="50%");return r})(),i=$M("transition","opacity",t),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},YM(n.el,i),this.options.shape==="circle"&&YM(n.back,e),YM(n.front,e),this.applyStyles(n),this},Fn.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},Fn.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},Fn.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},Fn.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},Fn.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),typeof t=="function"&&t.call(this)},e.options.fadeTime)),e},Fn.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i=e.options.mode==="dynamic"?"none":"block";e.ui.el.style.display=i,typeof t=="function"&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,n={};n.x=i===!0||i.x!==!1?0:e.instance.frontPosition.x,n.y=i===!0||i.y!==!1?0:e.instance.frontPosition.y,e.setPosition(t,n)}return e},Fn.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var n=i.options.fadeTime+"ms",r={};r.front=$M("transition",["top","left"],n);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(r),i.applyStyles(s),i.restTimeout=setTimeout(function(){typeof t=="function"&&t.call(i),i.restCallback()},i.options.fadeTime)},Fn.prototype.restCallback=function(){var t=this,e={};e.front=$M("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},Fn.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},Fn.prototype.computeDirection=function(t){var e,i,n,r=t.angle.radian,s=Math.PI/4,a=Math.PI/2;if(r>s&&r<3*s&&!t.lockX?e="up":r>-s&&r<=s&&!t.lockY?e="left":r>3*-s&&r<=-s&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=r>-a&&r<a?"left":"right"),t.lockX||(n=r>0?"up":"down"),t.force>this.options.threshold){var o,l={};for(o in this.direction)Object.prototype.hasOwnProperty.call(this.direction,o)&&(l[o]=this.direction[o]);var c={};for(o in this.direction={x:i,y:n,angle:e},t.direction=this.direction,l)l[o]===this.direction[o]&&(c[o]=!0);if(c.x&&c.y&&c.angle)return t;(!c.x||!c.y)&&this.trigger("plain",t),c.x||this.trigger("plain:"+i,t),c.y||this.trigger("plain:"+n,t),c.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var Zet=Fn;function pn(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=pn.id,pn.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let n=getComputedStyle(i.options.zone.parentElement);return n&&n.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}pn.prototype=new HP,pn.constructor=pn,pn.id=0,pn.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(i){if(i===void 0)return e[0];for(var n=0,r=e.length;n<r;n+=1)if(e[n].identifier===i)return e[n];return!1}},pn.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},pn.prototype.begin=function(){var t=this,e=t.options;if(e.mode==="static"){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},pn.prototype.createNipple=function(t,e){var i=this,n=i.manager.scroll,r={},s=i.options,a=i.parentIsFlex?n.x:n.x+i.box.left,o=i.parentIsFlex?n.y:n.y+i.box.top;if(t.x&&t.y)r={x:t.x-a,y:t.y-o};else if(t.top||t.right||t.bottom||t.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=t.top,l.style.right=t.right,l.style.bottom=t.bottom,l.style.left=t.left,l.style.position="absolute",s.zone.appendChild(l);var c=l.getBoundingClientRect();s.zone.removeChild(l),r=t,t={x:c.left+n.x,y:c.top+n.y}}var h=new Zet(i,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:e,position:t,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(XM(h.ui.el,r),XM(h.ui.front,h.frontPosition)),i.nipples.push(h),i.trigger("added "+h.identifier+":added",h),i.manager.trigger("added "+h.identifier+":added",h),i.bindNipple(h),h},pn.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},pn.prototype.bindNipple=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},pn.prototype.pressureFn=function(t,e,i){var n=this,r=0;clearInterval(n.pressureIntervals[i]),n.pressureIntervals[i]=setInterval(function(){var s=t.force||t.pressure||t.webkitForce||0;s!==r&&(e.trigger("pressure",s),n.trigger("pressure "+e.identifier+":pressure",s),r=s)}.bind(n),100)},pn.prototype.onstart=function(t){var e=this,i=e.options,n=t;return t=d7(t),e.updateBox(),TC(t,function(r){e.actives.length<i.maxNumberOfNipples?e.processOnStart(r):n.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(s){if(Object.values(n.touches).findIndex(function(o){return o.identifier===s})<0){var a=[t[0]];a.identifier=s,e.processOnEnd(a)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(r))}),e.manager.bindDocument(),!1},pn.prototype.processOnStart=function(t){var e,i=this,n=i.options,r=i.manager.getIdentifier(t),s=t.force||t.pressure||t.webkitForce||0,a={x:t.pageX,y:t.pageY},o=i.getOrCreate(r,a);o.identifier!==r&&i.manager.removeIdentifier(o.identifier),o.identifier=r;var l=function(c){c.trigger("start",c),i.trigger("start "+c.id+":start",c),c.show(),s>0&&i.pressureFn(t,c,c.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(o))>=0&&i.idles.splice(e,1),i.actives.push(o),i.ids.push(o.identifier),n.mode!=="semi")l(o);else{if(!(Fy(a,o.position)<=n.catchDistance))return o.destroy(),void i.processOnStart(t);l(o)}return o},pn.prototype.getOrCreate=function(t,e){var i,n=this,r=n.options;return/(semi|static)/.test(r.mode)?(i=n.idles[0])?(n.idles.splice(0,1),i):r.mode==="semi"?n.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=n.createNipple(e,t)},pn.prototype.processOnMove=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(t)){if(!r)return console.error("Found zombie joystick with ID "+n),void e.manager.removeIdentifier(n);if(i.dynamicPage){var a=r.el.getBoundingClientRect();r.position={x:s.x+a.left,y:s.y+a.top}}r.identifier=n;var o=r.options.size/2,l={x:t.pageX,y:t.pageY};i.lockX&&(l.y=r.position.y),i.lockY&&(l.x=r.position.x);var c,h,d=Fy(l,r.position),u=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,r.position),p=qM(u),f=d/o,g={distance:d,position:l};if(r.options.shape==="circle"?(c=Math.min(d,o),h=((_,b,x)=>{let w={x:0,y:0};return x=qM(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(r.position,c,u)):(h=((_,b,x)=>({x:Math.min(Math.max(_.x,b.x-x),b.x+x),y:Math.min(Math.max(_.y,b.y-x),b.y+x)}))(l,r.position,o),c=Fy(h,r.position)),i.follow){if(d>o){let _=l.x-h.x,b=l.y-h.y;r.position.x+=_,r.position.y+=b,r.el.style.top=r.position.y-(e.box.top+s.y)+"px",r.el.style.left=r.position.x-(e.box.left+s.x)+"px",d=Fy(l,r.position)}}else l=h,d=c;var m=l.x-r.position.x,v=l.y-r.position.y;r.frontPosition={x:m,y:v},i.dataOnly||XM(r.ui.front,r.frontPosition);var y={identifier:r.identifier,position:l,force:f,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:u},vector:{x:m/o,y:-v/o},raw:g,instance:r,lockX:i.lockX,lockY:i.lockY};(y=r.computeDirection(y)).angle={radian:qM(180-u),degree:180-u},r.trigger("move",y),e.trigger("move "+r.id+":move",y)}else this.processOnEnd(t)},pn.prototype.processOnEnd=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.removeIdentifier(r.identifier);!r||(i.dataOnly||r.hide(function(){i.mode==="dynamic"&&(r.trigger("removed",r),e.trigger("removed "+r.id+":removed",r),e.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(e.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),e.trigger("end "+r.id+":end",r),e.ids.indexOf(r.identifier)>=0&&e.ids.splice(e.ids.indexOf(r.identifier),1),e.actives.indexOf(r)>=0&&e.actives.splice(e.actives.indexOf(r),1),/(semi|static)/.test(i.mode)?e.idles.push(r):e.nipples.indexOf(r)>=0&&e.nipples.splice(e.nipples.indexOf(r),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[s.id]=s.identifier))},pn.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},pn.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(i){i.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var Ket=pn;function An(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=AU(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var n;e.collections.forEach(function(r){r.forEach(function(s){n=s.el.getBoundingClientRect(),s.position={x:e.scroll.x+n.left,y:e.scroll.y+n.top}})})};return e._onResize=function(){(n=>{Ny.has(n)&&clearTimeout(Ny.get(n)),Ny.set(n,setTimeout(function(){Ny.delete(n),n()},100))})(i)},e._onScroll=function(){e.scroll=AU()},e.collections}An.prototype=new HP,An.constructor=An,An.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(n){return!(i=n.get(e))}),i}},An.prototype.create=function(t){return this.createCollection(t)},An.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,ox(window,"resize",t._onResize),ox(window,"scroll",t._onScroll))},An.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,lx(window,"resize",t._onResize),lx(window,"scroll",t._onScroll))},An.prototype.createCollection=function(t){var e=this,i=new Ket(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},An.prototype.bindCollection=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},An.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},An.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||t===!0)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},An.prototype.getIdentifier=function(t){var e;return t?(e=t.identifier===void 0?t.pointerId:t.identifier)===void 0&&(e=this.latest||0):e=this.index,this.ids[e]===void 0&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},An.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},An.prototype.onmove=function(t){return this.onAny("move",t),!1},An.prototype.onend=function(t){return this.onAny("end",t),!1},An.prototype.oncancel=function(t){return this.onAny("end",t),!1},An.prototype.onAny=function(t,e){var i,n=this,r="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=d7(e);var s=function(a,o,l){l.ids.indexOf(o)>=0&&(l[r](a),a._found_=!0)};return TC(e,function(a){i=n.getIdentifier(a),TC(n.collections,s.bind(null,a,i)),a._found_||n.removeIdentifier(i)}),!1},An.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(e){e.destroy()}),t.collections=[],t.off()},An.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),i.collections.length===0&&i.unbindWindowEvents()};var Qet=An,up=null;function CU(){return up||(up=new Qet),up}var Jet={create:function(t){return CU().create(t)},destroy:function(){up&&(up.destroy(),up=null)},get factory(){return CU()}},tit=Jet;ti(),Xt(),J(),Xs(),Op(),$s(),Xr(),Xt();var g7=null;function ZM(){return g7}var v7,KM,eit=new Promise(t=>{v7=t});function iit(t){return KM||(KM=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.157/build",i=import("./physics.js"),[n,r]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(s=>s.arrayBuffer())]);await n.init(r),v7(n)}(),KM)}function y7(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,n=e[4]**2+e[5]**2+e[6]**2,r=e[8]**2+e[9]**2+e[10]**2,s=e[0]**2+e[4]**2+e[8]**2,a=e[1]**2+e[5]**2+e[9]**2,o=e[2]**2+e[6]**2+e[10]**2,l=1e-8;return i<l||n<l||r<l||s<l||a<l||o<l}function Yo(t,e){let i=new jt;if(e&&y7(e))return i.setAttribute("position",new kt([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new kt([],3)),i.setIndex([]),i;let{positions:n,triIndices:r}=aP(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new kt(n,3)),i.setIndex(r),e&&i.applyMatrix4(e),i}Oi(),Xr(),ke(),yP(),J(),J(),Lp(),y0();var Ge,nit=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=Rn(e,e.actions,n,r,s,i),this.target=e.target}disconnect(){nr(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},PU=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.page=n,this.currentIntersectedObjects=[],this.actions=Rn(e,e.actions,n,r,s,i),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let o=n.scene.findFrom(a,i);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(t){return this.target==="all"||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){nr(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};Oi(),v0(),Dx(),eit.then(t=>Ge=t);var En=new T,Ls=new qt,QM=new T,rit=new T(1,1,1),JM=(new ci(0,0,0,"YXZ"),new ci(0,0,0,"XYZ")),Uo=new T,DU=new T,fm=new qt,ky=new Et,RU=new Et,sit={type:"updateMatrix"},tE=(new qt,new vr),eE=.01,CC={type:"beginEvent",eventName:"Collision"},ait={type:"beginEvent",eventName:"Trigger"},hx=t=>t.states.some(e=>e.data.position!==void 0||e.data.rotation!==void 0||e.data.shear!==void 0||e.data.cloner!==void 0||e.data.pathSnapping!==void 0);function lu(t){return function(e){return typeof e=="object"&&e!==null&&"booleanOp"in e}(lh(t)?t.object:t)}var oit=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=e=>{if(e.bodyType()!==Ge.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[i,n]=this.rigidBodyToMesh.get(e.handle);if(En.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),Ls.copy(e.rotation()),i.matrixWorld.makeRotationFromQuaternion(Ls).setPosition(En),i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(sit),n){let r=i.cloner;if(r&&r.objectForSample===void 0){r.matrixWorld.copy(i.matrixWorld);for(let s of r.children)s.updateMatrixWorld(!0)}for(let s of i.children)s.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,i,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[e]?(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(r=this.sensorToTriggerEvent[i],s=this.sharedGameControlGlobals.colliderToEntity.get(e)),r&&s&&r.isValidTriggeringObject(s))r.dispatch();else{for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===e||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let a=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,e)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,a,e);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let h of c)h.data.target==="scene"&&this.dispatchCollisionEvent(h,l,i)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events){if(i.data.disabled===!0)continue;let n=i.data.actions?.find(r=>r.data.type==="Destroy")?.data;if(n)for(let r of n.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let n of i.data.objects){let r=this.page.scene.find(n);r&&(r.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(ZM()===null)return void jn("collision-bvh","trigger/collision detection");let t=[],e=[];if(this.page.traverseChildren(i=>{let n,r=i instanceof lp,s=Ag(i);if(oh(i)||r||s)return;n=lh(i)?i.object:i;let a=n.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let o=i.geometry,l=n.userData.hasDestroy===!0,c=n.userData.hasDrag===!0;if(hx(a)||l||c||n.dataPatched.events.some(h=>h.data.disabled!==!0&&(h.data.type==="GameControl"||h.data.type==="Follow")))return i.updateMatrixWorldRigid(),this.addBoundsTree(i),!0;if(o){let h=o.getAttribute("position");if(h!==void 0&&h.count>0){t.push({geometry:o,matrixWorld:i.matrixWorld}),e.push(o.id,this._staticBVHIdOf(h),h.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)e.push(d)}}return!!lu(i)||void 0}),t.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===e.length&&i.signature.every((s,a)=>s===e[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let n=Nc(t.map(s=>Yo(s.geometry,s.matrixWorld)),!1),r=new(ZM())(n);this._staticBVHCache={signature:e,bvh:r},this.sharedGameControlGlobals.staticMeshBVH=r}}addRigidBody(t,e,i){if(y7(t.matrixWorld))return;let n=[],r="geometry"in t?t.geometry:void 0,s=e.dataPatched;if(r?.getAttribute("position")!==void 0&&n.push(Yo(r,t.shearScale)),s.physics.fusedBody){let a=this.gatherChildrenGeom(t,n);t.traverseObject(a),t.children.forEach(l=>l.updateMatrixWorld(!0));let o=t.cloner;o&&o.objectForSample===void 0&&s.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(n.length>0){let a,o=!1,l=!i.fromCreate&&s.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=Ge.RigidBodyDesc.dynamic(),a.setLinearDamping(s.physics.damping).setAngularDamping(s.physics.damping).setAdditionalMass(1e-9).setGravityScale(s.physics.gravityScale).enabledRotations(...s.physics.enabledRotation).enabledTranslations(...s.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(a=Ge.RigidBodyDesc.kinematicPositionBased(),o=!0):a=Ge.RigidBodyDesc.fixed();let c=Nc(n);En.setFromMatrixPosition(t.matrixWorld),Ls.setFromRotationMatrix(t.matrixWorldRigid),t.position0=En.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Ls.clone(),En.divideScalar(this.pixelsPerMeter),a.setTranslation(En.x,En.y,En.z).setRotation(Ls),c?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),d=!(s.geometry===void 0||s.geometry.type==="SubdivGeometry"||s.geometry.type==="NonParametricGeometry"||s.geometry.type==="BooleanGeometry"||s.geometry.type==="VectorGeometry"||s.geometry.type==="StarGeometry"||s.geometry.type==="RectangleGeometry"||s.geometry.type==="EllipseGeometry"||s.geometry.type==="TriangleGeometry"||s.geometry.type==="TorusGeometry"||s.geometry.type==="HelixGeometry");try{this.addCollider(h,s.physics,c,e,d)}catch{try{this.addCollider(h,s.physics,c,e,!1)}catch(u){console.error(u)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[t,s.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,h,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=h}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(Yo(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(i=>i.updateMatrixWorld(!0)),e.length>0){let i=Nc(e,!1);t.bvhGeometry=i,i.getAttribute("position").count>0&&(t.bvhGeometry.boundsTree=new(ZM())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t))}}addCollider(t,e,i,n,r=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let s;i&&(s=e.colliderType==="trimesh"?Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Ge.ColliderDesc.convexMesh(i.getAttribute("position").array,r?i.getIndex().array:void 0)),s.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setRestitutionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(s,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,n),this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=lu(t);return(n,r)=>{if(r===0)return;if(i&&n.parent===t)return!0;let s;if(oh(n)){if(!n.objectForSample)return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(n.objectForSample.dataPatched.physics.fusedBody)return;s=n.object}else if(lh(n))s=n.object;else if(s=n,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;r===1?n.matrixWorld.copy(t.shearScale):n.matrixWorld.copy(n.parent.matrixWorld),n.matrixWorld.multiply(n.matrix);let o=n.geometry;return o?.getAttribute("position")!==void 0&&e.push(Yo(o,n.matrixWorld)),!!lu(n)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(a=>{for(let o of a.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let n=EU();if(n!==null?i=n.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&jn("game-controls","the scene's game controls"),i===!1){let{enableRotate:a,enablePan:o,enableZoom:l,autoRotate:c,hoverRotatePanMode:h}=this.eventManager.publish.orbitControls;(a||o||l||c||h!==0)&&(this.orbitControls=new j9(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let r=this.renderer.domElement.width/this.renderer.getPixelRatio(),s=this.renderer.domElement.height/this.renderer.getPixelRatio();EU()?.createJoysticks(this,r,s),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Ge.World(new Ge.Vector3(0,this.gravity,0)),this.events=new Ge.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let o;if(oh(a)){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(lh(a))o=a.object;else{if(Ag(a)||ed(a)||a instanceof lp)return;if(o=a,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,c=o.dataPatched;for(let m of c.events)m.data.disabled!==!0&&m.data.type==="GameControl"&&(l=m.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;a.updateMatrixWorldRigid();let h=hx(c),d=!1,u=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let m of c.events)if(m.data.disabled!==!0){if(m.data.type==="Collision"){d=!0;let v=new nit(m.id,m.data,o,this.page,this.sharedAssets,this.eventManager);v.initialDisabled=!0,this.collisionEvents.push(v),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(y=>y.id!==m.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[v]}else if(m.data.type==="Follow"){f=!0;let v=m.data.target;a.traverseVisible(y=>{y.userData.isFollowingObj=v})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let g=a.geometry;if(l!==void 0){let m=Ge.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(En,Ls,QM),a.position0=En.clone().divideScalar(this.pixelsPerMeter),a.rotation0=Ls.clone(),En.divideScalar(this.pixelsPerMeter),m.setTranslation(En.x,En.y,En.z).setRotation(Ls);let v,y=this.sharedGameControlGlobals.rapierWorld.createRigidBody(m);a.rigidBody=y,v=l.collider.type==="sphere"?Ge.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Ge.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Ge.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),v.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(Ge.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(v,y);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),En.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(QM.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(En);let b=new qt().setFromEuler(new ci().setFromVector3(new T().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else c.physics.rigidBody==="dynamic"||h||f||u||p||d?(this.addRigidBody(a,o,{hasFollow:f,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,c.physics.fusedBody)):(g&&t.push(Yo(g,a.matrixWorld)),c.physics.fusedBody&&!lu(a)&&a.traverseObject((m,v)=>{if(v===0)return;let y;if(oh(m)){if(!m.objectForSample)return m.object.dataPatched.physics.fusedBody===!0&&m.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(m.objectForSample.dataPatched.physics.fusedBody)return;y=m.object}else{if(Ag(m)||ed(m)||m instanceof lp)return;if(lh(m))y=m.object;else if(y=m,y.dataPatched.cloner?.hideBase)return!0}let _=y.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=m.geometry;return b?.getAttribute("position")!==void 0&&t.push(Yo(b,m.matrixWorld)),!!lu(m)||void 0}),this.generateSensorColliderDescs(o,c.physics.fusedBody,e));return!(c.physics?.fusedBody!==!0&&!l&&!lu(a))||void 0}),t.length===0)return;let i=Nc(t),n=i.getIndex().count>0;if(!n&&e.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=Ge.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r);if(n){let a=Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Ge.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Ge.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s)}for(let[a,o]of e){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(a,s);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let i=new PU(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),n=new Et().compose(Uo.fromArray(e.data.position.map(r=>typeof r=="number"?r:0)),fm.setFromEuler(JM.fromArray(e.data.rotation.map(r=>typeof r=="number"?r:0))),rit);if(e.data.triggerZone==="box"){let r=new hi;r.min.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(-.5),r.max.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([r,n,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,n,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let n=t/1e3;n<i&&n>.55*i&&(n=i),this.accumulator+=n;let r=performance.now(),s=0,a=6;for(;this.accumulator>=i&&s<a&&(e=this.stepPhysics()&&e,this.accumulator-=i,s++,!(performance.now()-r>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(En,Ls,QM);let e=t;e.prevQ===void 0?(e.prevQ=Ls.clone(),e.prevT=En.clone()):(e.prevQ.copy(Ls),e.prevT.copy(En))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,n]=this.fixedBodiesToWatch[t];e.rigidBody===i?(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(n)||(i.setBodyType(Ge.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1)):this.fixedBodiesToWatch.splice(t,1)}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),n=t.translation(),r=Math.hypot(i.x,i.z);for(let s=0;s<t.numColliders();s++){let a=t.collider(s);e.contactPairsWith(a,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let c=l.translation(),h=-1/0,d=0,u=0;if(e.contactPair(a,o,v=>{let y=v.normal(),_=y.x*(c.x-n.x)+y.y*(c.y-n.y)+y.z*(c.z-n.z)<0?-1:1;if(Math.abs(y.y)>.7)return;let b=_*y.x,x=_*y.z,w=Math.hypot(b,x);if(w<1e-4)return;let S=(i.x*b+i.z*x)/w;S>h&&(h=S,d=b/w,u=x/w)}),h===-1/0)return;let p=i.x*d+i.z*u;if(p<-eE)return;let f=l.linvel();if(r>eE&&p>eE){let v=f.x*d+f.z*u;if(v<=0)return;let y=Math.min(v,p);return void l.setLinvel({x:d*y,y:f.y,z:u*y},!0)}let g=f.x*d+f.z*u-Math.max(0,p);if(g<=0)return;let m=.5*g;l.setLinvel({x:f.x-d*m,y:f.y,z:f.z-u*m},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();let t=this.sharedGameControlGlobals.kinematicBodyToEntity;for(let[e,i]of t)i.rigidBody!==void 0?(this.recordPhysicsPose(i),i.rigidBody.setNextKinematicTranslation(En.divideScalar(this.pixelsPerMeter)),i.rigidBody.setNextKinematicRotation(Ls)):t.delete(e);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)e.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(e);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let n,r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner){for(let s of e.cloner.children)if(s.rigidBody===r){n=s;break}}t.dispatch(n),e.dispatchEvent(CC)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let n=RU.copy(t.matrixWorld).invert();t.traverseEntity((r,s)=>{if(e===!1&&s===1)return!0;for(let a of r.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new PU(a.id,a.data,r,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?Ge.ColliderDesc.cuboid(...a.data.size.map(c=>(typeof c=="number"?c:1)/(2*this.pixelsPerMeter))):Ge.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),Uo.fromArray(a.data.position.map(c=>typeof c=="number"?c:0)),fm.setFromEuler(JM.fromArray(a.data.rotation.map(c=>typeof c=="number"?c:0))),ky.makeRotationFromEuler(JM).setPosition(Uo).premultiply(r.matrixWorld),i?(ll(ky,{translation:Uo,quaternion:fm,scale:DU}),o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED)):(ll(ky.premultiply(n),{translation:Uo,quaternion:fm,scale:DU}),t.rigidBody.bodyType()===Ge.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===Ge.RigidBodyType.Fixed?o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Ge.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Uo.divideScalar(this.pixelsPerMeter),o.setTranslation(Uo.x,Uo.y,Uo.z),o.setRotation(fm),i)i.push([o,l]);else{let c=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t.rigidBody);this.sensorToTriggerEvent[c.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,n,r,s]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(r===o||s.isValidTriggeringObject(Ie.is(o)?o:o.object)===!1)continue;let l=RU.copy(Ek(r.matrixWorld)).copyPosition(r.matrixWorld).multiply(n),c=ky.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof hi?t=h.intersectsBox(i,c):(tE.radius=i,tE.center.setFromMatrixPosition(c),t=h.intersectsSphere(tE)),t?s.currentIntersectedObjects.indexOf(o)===-1&&(s.currentIntersectedObjects.push(o),s.dispatch(),r.dispatchEvent(ait)):s.currentIntersectedObjects=s.currentIntersectedObjects.filter(d=>d!==o)}}}};Bp(),J(),Lb(),Ye(),v0(),Lh();var iE=.02,OU=new T,IU=new T,lit=new T,Mr=new T,zo=new T,hu=new T,nE=new Et,LU=new Et,hit=new Et,fs=new qt,_c=new qt,cu=new ci(0,0,0,"YXZ"),cit=new T(1,0,0),ka=new T(0,1,0),dit=new T(0,0,1),BU=new T(1,1,1),UU=[],zU=t=>UU[t]??(UU[t]=new T),rE=new T,uit=new T,pit=new T,fit=new T,FU=new qt,mit=new T,NU=new qt,Kn=new bs,Bs=new hi,git={type:"requestRender"},vit={type:"updateMatrix"},PC=class extends kn{constructor(t,e,i,n,r,s,a,o,l){super(),this.object=t,this.domElement=e,this.data=i,this.gloabalPhysics=n,this.controlsManager=r,this.cameraFollow=s,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.target0=new T,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new ci(0,0,0,"YXZ"),this.shearMatrix0=new Et,this.cameraShearMatrix0=new Et,this.position0Cam=new T,this.quat0Cam=new qt,this.scale0Cam=new T,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new bs(new T(0,-40,0),new T(0,40,0)),matrix:new Et,position:new T,rotation:new qt},this.euler=new ci(0,0,0,"YXZ"),this.eulerDelta=new T,this.lastPosition=new T,this.lastCameraQuaternion=new qt,this.lastCameraPosition=new T,this.PI_2=Math.PI/2,this.prevMouse=new et,this.velocityTarget=new T,this.velocity=new T,this.directionXZ=new T,this.rotVelocityStick=new T,this.rotVelocityTarget=new T,this.rotVelocity=new T,this.rotDirection=new T,this.nonColliderRotOffset=new Et,this.nonColliderPosOffset=new Et,this.firstPointerId=-1,this.rot=new T,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new Et,this.objectToTarget=new T,this.objectToTarget0=new T,this.objectToCamXZ=new T,this.objectToCamXZ0=new T,this.targetToCamera=new T,this.targetToCamera0=new T,this.cameraPolarAxis0=new T,this.targetPos=new T,this.targetQuat=new qt,this.lerpFactorPos=new T().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new qt,this.objXZQuatInv=new qt,this.objXZRotMat=new Et,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new T,this.pushedVelocity=new T,this.groundYRotation=0,this.objectRealQuat=new qt,this.colliderWorldQuat=new qt,this.groundNormal=new T,this.groundTilt=new qt,this.groundTiltInv=new qt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new T,this.quaternion=new qt,this.scale=new T,this.initialAction=!0,this.onPointerDown=f=>{!(f.target===this.domElement||f.target instanceof HTMLElement&&f.target.tagName==="SPLINE-VIEWER"&&f.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=f.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!os&&!xA&&this.domElement.requestPointerLock(),this.prevMouse.set(f.clientX,f.clientY))},this.onPointerUp=f=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),f.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=f=>{if(f.pointerId!==this.firstPointerId)return;let g=f.clientX-this.prevMouse.x,m=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(xA&&RN<15.5&&!os?(this.eulerDelta.y=-g*this.mouseOrbitSensitivity,this.eulerDelta.x=-m*this.mouseOrbitSensitivity):(this.eulerDelta.y=-f.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-f.movementY*this.mouseOrbitSensitivity)),f.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-g*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-m*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?PC.isLocked=!0:PC.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let f in this.movementState)this.movementState[f]=0},this.onKeyDown=f=>{!(f.target instanceof HTMLInputElement)&&(f.code==="ArrowLeft"||f.code==="ArrowUp"||f.code==="ArrowRight"||f.code==="ArrowDown"||f.code==="Space")&&f.preventDefault();for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]){this.movementState[g[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]||f.code.slice(3,f.code.length).toUpperCase()===g[1]){this.movementState[g[0]]=0;break}},this.copyVRGamePadValues=(f,g)=>{for(let m=2;m<4;m++){let v=f.axes[m];g===0?m===2?this.movementState.movePosX=v:this.movementState.movePosZ=v:(f.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,m===2?this.movementState.rotPosY=v:this.moveMode==="fly"&&(this.movementState.moveNegY=v))}},this.sharedGameControlGlobals=r.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.object.parent instanceof Si||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),this.shearMatrix0.copy(this.object.shearMatrix),ll(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix}),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let c=this.euler0.clone(),h=c.y;if(this.objectRealQuat.copy(this.quaternion),c.y=0,this.quaternion.setFromEuler(c),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),c.set(0,h,0),this.quaternion.setFromEuler(c),this.rot.setFromEuler(c),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.camera.parent instanceof Si||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),this.cameraShearMatrix0.copy(this.camera.shearMatrix),ll(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix})),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let f,g=new T(0,0,-1).applyQuaternion(this.camera.quaternion),m=new T().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(m),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(g.y)<1e-6?(m.y=0,g.y=0,f=m.projectOnVector(g)):f=m.y/g.y>0?g.multiplyScalar(m.y/g.y):g.multiplyScalar(m.length()),this.targetToCamera0.copy(f).negate();let v=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(v,this.position);let y=new ci().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-y.x,y.x=0,y.z=0,y.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(y)}if(this.object instanceof Ki&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=1*(i.speedTranslate??250),this.speedOrbit=.025*(i.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(i.speedRotate??100),this.keyAssignments=i.keyAssignments.map(f=>{let g=[f[0],f[1]];return g[1]==="\u25B2"?g[1]="ArrowUp":g[1]==="\u25C0"?g[1]="ArrowLeft":g[1]==="\u25BC"?g[1]="ArrowDown":g[1]==="\u25B6"?g[1]="ArrowRight":g[1]==="\u21E7"?g[1]="Shift":g[1]==="\u21B5"?g[1]="Enter":g[1]==="Space"?g[1]=" ":g[1]==="\u2318"?g[1]="Meta":g[1]==="Ctrl"?g[1]="Control":g[1]==="Esc"&&(g[1]="Escape"),g}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(g=>g[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotNegY"),f!==-1&&(this.keyAssignments[f][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(i.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(i.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(i.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(i.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(i.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(i.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??np.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??np.defaultData.usePhysics,this.jumpPower=20*i.jumpPower,this.resetYPosition=this.position.y+Math.abs(i.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=i.alignToGround??!1,this.orientMode=i.autoOrientMove?i.orientMode:"none",this.orientWith=i.orientWith??Cb.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,i.collider.type==="capsule"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=i.collider.height/2-i.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=i.collider.height*iE/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height):i.collider.type==="sphere"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*i.collider.radius*iE/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*iE/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new T().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),u=new qt().setFromEuler(new ci().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(u),this.collider.matrix.compose(d,u,BU),i.cameraXAxis!==void 0&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let p=2*i.navmesh.destinationHelperRadius;if(p>0){let f=new Nt;f.push({fi:0,data:{...Xi.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...Xi.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let g=F8({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new gi(K3.create({parameters:{width:p,height:p/10,hollow:.7}}),g),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.matrixWorldAutoUpdate=!0,this.camera.matrixWorldAutoUpdate=!0,this.object.shearMatrix.copy(this.shearMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.parent instanceof Si||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),ll(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix});let e=new ci().setFromQuaternion(this.quaternion,"YXZ"),i=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,i,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof Ki?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.shearMatrix.copy(this.cameraShearMatrix0),t?(this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.camera.parent instanceof Si||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),ll(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix}))):this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;t.gameActions!==void 0&&(this.actions={},Tb.list.forEach(i=>{this.actions[i]=Rn({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),nr(this.actions.idle),nr(this.actions.move),nr(this.actions.run),nr(this.actions.jump)}dispatchStartEvent(t){this.actions[t]!==void 0&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(e=>{e.play()}),this.actions[t].Animation.forEach(e=>{e.play(this.initialAction===!1)}),this.actions[t].TimelineAnimation.forEach(e=>{e.play()}),this.actions[t].Create.forEach(e=>{e.dispatchStart()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(t){this.actions[t]!==void 0&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(e=>{e.stop(),e.object.currentState!==null&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[t].Create.forEach(e=>{e.dispatchStop()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Mr.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,n=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let s=zo.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(a){this.onObject=!0,this.groundNormal.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(n=!0),a.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=a.collider.parent(),l=o!==null&&o.isKinematic()?o:null,c=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&c?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition(Mr).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(h);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*e}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let s=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let a=Mr.subVectors(this.path[1],this.position),o=zo.subVectors(this.path[1],this.path[0]);a.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),s.opacity=s.userData.opacity0}else s.opacity-=.05*s.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let r=lit.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=zo.copy(r);s.y=0,r.set(0,r.y,s.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let s=Mr;this.camera.getWorldDirection(s);let a=hu.copy(ka).multiplyScalar(s.dot(ka));s.sub(a);let o=zo.copy(this.directionXZ);o.x*=-1,this.rot.y=s.angleTo(o)*(s.cross(o).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(cu.setFromVector3(this.rot),this.moveMode==="walk"&&(cu.x=0),r.applyEuler(cu),n&&(_c.setFromUnitVectors(ka,this.groundNormal),r.applyQuaternion(_c)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let s=0;for(let a of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(a.rigidBody===void 0||a.prevQ===void 0)continue;(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(rE,FU,uit);let o=this.object.getWorldPosition(pit).add(this.collider.position).sub(rE);NU.copy(a.prevQ).invert().premultiply(FU);let l=hu.subVectors(rE,a.prevT).add(fit.copy(o).applyQuaternion(NU).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),c=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),Mr.copy(r).divideScalar(this.pixelsPerMeter),0,e,!1);l.multiplyScalar(this.pixelsPerMeter);let h=Ie.is(a)?a:a.object;if(c!==null&&this.lastHitObj!==h){let d;a instanceof Or&&(d=a);let u=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(u)for(let p of u)p.data.target==="character"&&(p.dispatch(d),h.dispatchEvent(CC));this.lastHitObj=h}c!==null&&(Math.abs(l.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=l.x),Math.abs(l.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=l.y),Math.abs(l.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=l.z),zU(s++).copy(c.normal1).applyQuaternion(a.quaternion))}if(s>0){for(let a=0;a<s;a++){let o=zU(a),l=o.dot(r);l<0&&r.addScaledVector(o,-l)}r.add(this.pushedVelocity)}else r.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(ka,this.euler.y-this.euler0.y);let s=zo.copy(this.objectToCamXZ).normalize(),a=hu.copy(r).multiplyScalar(e);a.y=0;let o=a.sub(Mr.copy(s).multiplyScalar(a.dot(s))).cross(s).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=Pt.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=Pt.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=Pt.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(cu.copy(this.euler),cu.y=0,this.nonColliderRotOffset.makeRotationFromEuler(cu)),fs.setFromAxisAngle(cit,this.rot.x),_c.setFromAxisAngle(ka,this.rot.y),_c.multiply(fs),fs.setFromAxisAngle(dit,this.rot.z),_c.multiply(fs),this.quaternion.copy(_c),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let s=zo.copy(r).multiplyScalar(e/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new T;for(let h=0;h<5;h++){let d=s.length(),u=hu.copy(s).normalize();if(a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,u,this.object.rigidBody.collider(0).shape,0,d,!1,12,void 0,void 0,this.object.rigidBody),a===null){h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(s);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(a.collider.handle);if(p!==this.lastHitObj&&h===0){this.lastHitObj=p;let v=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(v){for(let y of v)if(y.data.target==="character"){let _,b=(this.sharedGameControlGlobals.rapierWorld?.getCollider(a.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}y.dispatch(_),p.dispatchEvent(CC)}}}let f=OU.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),g=IU.copy(u).multiplyScalar(a.time_of_impact).dot(f),m=a.time_of_impact;if(m===0&&(this.position.y+=this.offset*this.pixelsPerMeter),g>this.offset&&(m=a.time_of_impact*(g-this.offset)/g,o.addScaledVector(u,m)),s.copy(u).multiplyScalar(d-m),Math.acos(-f.y)>this.slopeThresh){let v=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),y=hu.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);y.y=0;let _=v.add(y);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(f.y=0,f.normalize())}s.addScaledVector(f,-s.dot(f))}}this.position.addScaledVector(o,this.pixelsPerMeter),Mr.copy(this.position).divideScalar(this.pixelsPerMeter),fs.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,c=l!==void 0&&mit.copy(Mr).sub(l.translation()).lengthSq()>1;l!==void 0&&(c?(l.setTranslation(Mr,!0),l.setRotation(fs,!0)):(l.setNextKinematicTranslation(Mr),l.setNextKinematicRotation(fs)))}else{let s=this.onObject?1:5,a=r.multiplyScalar(e/s);for(let o=0;o<s;o++)this.position.add(a),this.collisionAdjustment(e/s)}else this.position.addScaledVector(r,e);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),p6(this.position,this.quaternion,this.object.shearMatrix,this.scale,this.object.matrix).multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.object.parent instanceof Si?this.object.matrixWorld.multiplyMatrices(this.object.parent.matrixWorld,this.object.matrix).multiply(this.object.pivotMatrix):this.object.matrixWorld.copy(this.object.matrix),this.object.children.forEach(s=>{s.updateMatrixWorld(!0)}),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let s=this.objectToTarget.add(this.position),a=this.targetToCamera.add(s);nE.lookAt(a,s,ka).setPosition(a),nE.decompose(this.targetPos,this.targetQuat,Mr),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**i),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**i),this.camera.updateMatrix(),this.camera.matrixWorld.copy(this.camera.matrix),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=Pt.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=Pt.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(vit),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)||(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(git),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=fs.setFromAxisAngle(ka,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?Pt.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e),t=this.cameraXAxis==="Limit"?Pt.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):Pt.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Mr.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let n=_c.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(n)}groundTiltAdjustment(t){180*ka.angleTo(t)/Math.PI<15||180*ka.angleTo(t)/Math.PI>85?fs.identity():fs.setFromUnitVectors(ka,t),this.groundTilt.slerp(fs,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=IU.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=nE.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Mr,fs,zo).compose(Mr,fs,BU);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(r=>{if(r===this.object||r.isDescendantOf(this.object)||!r.bvhGeometry||!r.bvhGeometry.boundsTree)return;Bs.makeEmpty(),r.updateMatrixWorldRigid();let s=r.matrixWorldRigid,a=LU.copy(s).invert(),o=hit.copy(LU).multiply(i);Kn.copy(this.collider.segment),Kn.start.applyMatrix4(o),Kn.end.applyMatrix4(o);let l=OU.copy(this.position).applyMatrix4(a);Bs.expandByPoint(Kn.start),Bs.expandByPoint(Kn.end),Bs.min.addScalar(-this.collider.radius),Bs.max.addScalar(this.collider.radius),r.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:c=>c.distanceToPoint(Kn.end),intersectsBounds:c=>c.intersectsBox(Bs),intersectsTriangle:c=>{let h=Mr,d=zo,u=c.closestPointToSegment(Kn,h,d);if(u<this.collider.radius){let p=this.collider.radius-u,f=d.sub(h).normalize(),g=hu.copy(l);g.addScaledVector(f,p);let m=g.applyMatrix4(s).sub(this.position);e.add(m),Kn.start.addScaledVector(f,p),Kn.end.addScaledVector(f,p)}}})}),Bs.makeEmpty(),Kn.copy(this.collider.segment),Kn.start.applyMatrix4(i),Kn.end.applyMatrix4(i),Bs.expandByPoint(Kn.start),Bs.expandByPoint(Kn.end),Bs.min.addScalar(-this.collider.radius),Bs.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:r=>r.distanceToPoint(Kn.end),intersectsBounds:r=>r.intersectsBox(Bs),intersectsTriangle:r=>{let s=Mr,a=zo,o=r.closestPointToSegment(Kn,s,a);if(o<this.collider.radius){let l=this.collider.radius-o,c=a.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(c),e.addScaledVector(c,l),Kn.start.addScaledVector(c,l),Kn.end.addScaledVector(c,l)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let n=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(n),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},_7=PC;_7.isLocked=!1,J(),y0(),Bp(),Lp();var b7,x7,sE,yit=new Promise(t=>{b7=t});function _it(t){return sE||(sE=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.157/build";typeof window<"u"&&(x7=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[n,r]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});b7(a)}(),sE)}ti();var w7,Fe,dr,bit=t=>`
|
|
9905
|
+
`)>=0&&(t-=r),i===3?.5*e-.5*t:i===2?e-t:0}getLineInitialOffsetY(t,e,i,n,r){let s=e*t,a=t-Math.abs(this.ascender-this.descender)*n,o=-this.ascender*n-a/2;return r===3?-(i-s-o):r===2?-(.5*i-.5*s-o):o}createPath(t,e,i,n,r){let s=t.getPath(i,-n,r.fontSize,{kerning:!1,letterSpacing:r.letterSpacing});if(!s)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+this.familyName+".");let a=new qet,o=(t.advanceWidth??1)*e;if(t)for(let l of s.commands){let c=a.currentPath?.currentPoint;if(!c||l.type==="Z"||c.x!==l.x||-c.y!==l.y)switch(l.type){case"M":a.moveTo(l.x,-l.y);break;case"L":a.lineTo(l.x,-l.y);break;case"Q":a.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":a.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return a.subPaths.forEach(l=>{let c=function(h){if(h.length){let d=h[0];if(d instanceof gs)return d.v1;if(d instanceof ks||d instanceof Ko)return d.v0}}(l.curves);c!==void 0&&l.currentPoint.distanceTo(c)>0&&l.lineTo(c.x,c.y)}),{offsetX:o,path:a}}getCharWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}getTextWidth(t,e){try{return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}catch(i){return this.warnLayoutError(i),0}}computeSpaceWidthForLine(t,e,i,n){let r=this.getCharWidth(" ",i),s=t[e];if(s){let a=this.countSpaces(s.trimEnd());if(i.horizontalAlign===4&&e<t.length-1&&a)return((typeof i.width=="string"?Number(n.getVariable(i.width)):i.width)-(this.getTextWidth(s,i)-a*r))/a}return r}countSpaces(t){return(t.match(/ /g)||[]).length}},Ei("text"),Xt();var c7=null;function EU(){return c7}function Yet(t){let e=!1;return t.scene.objects.forEach(i=>{i.data.type==="Page"&&!e&&i.data.publish.gameControlObject&&td.traverseModuleInstances(t,i.id,(n,r,s)=>{for(let a of s)a.data.type==="GameControl"&&a.data.navmesh.enabled&&(e=!0)})}),e}ti();var Fy=(t,e)=>{let i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},qM=t=>t*(Math.PI/180),Ny=new Map,ox=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.addEventListener?t.addEventListener(n,i,!1):t.attachEvent&&t.attachEvent(n,i)},lx=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.removeEventListener?t.removeEventListener(n,i):t.detachEvent&&t.detachEvent(n,i)},d7=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),AU=()=>{if(!(typeof window>"u"))return{x:window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},XM=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},$M=(t,e,i)=>{let n=u7(t);for(let r in n)if(Object.prototype.hasOwnProperty.call(n,r))if(typeof e=="string")n[r]=e+" "+i;else{let s="";for(let a=0,o=e.length;a<o;a+=1)s+=e[a]+" "+i+", ";n[r]=s.slice(0,-2)}return n},u7=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},YM=(t,e)=>{for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},TC=(t,e)=>{if(t.length)for(let i=0,n=t.length;i<n;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(p7="ontouchstart"in window,f7=!!window.PointerEvent,m7=!!window.MSPointerEvent);var p7,f7,m7,ou,TU={start:"mousedown",move:"mousemove",end:"mouseup"},pm={};function Rc(){}f7?ou={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:m7?ou={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:p7?(ou={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},pm=TU):ou=TU,Rc.prototype.on=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]=n._handlers_[i]||[],n._handlers_[i].push(e);return n},Rc.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},t===void 0?i._handlers_={}:e===void 0?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},Rc.prototype.trigger=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]&&n._handlers_[i].length&&n._handlers_[i].forEach(function(a){a.call(n,{type:i,target:n},e)})},Rc.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((i,n)=>{let r={};for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&Object.prototype.hasOwnProperty.call(n,s)?r[s]=n[s]:Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s]);return r})(e.options,t))},Rc.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){typeof i["on"+e]=="function"?i["on"+e].apply(i,arguments):console.warn('[WARNING] : Missing "on'+e+'" handler.')},ox(t,ou[e],i._domHandlers_[e]),pm[e]&&ox(t,pm[e],i._domHandlers_[e]),i},Rc.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},lx(t,ou[e],i._domHandlers_[e]),pm[e]&&lx(t,pm[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var HP=Rc;function Fn(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(e),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=Fn.id,Fn.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}Fn.prototype=new HP,Fn.constructor=Fn,Fn.id=0,Fn.prototype.buildEl=function(t){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},Fn.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=(()=>{let r=u7("borderRadius");for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(r[s]="50%");return r})(),i=$M("transition","opacity",t),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},n.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},YM(n.el,i),this.options.shape==="circle"&&YM(n.back,e),YM(n.front,e),this.applyStyles(n),this},Fn.prototype.applyStyles=function(t){for(var e in this.ui)if(Object.prototype.hasOwnProperty.call(this.ui,e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},Fn.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},Fn.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},Fn.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},Fn.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),typeof t=="function"&&t.call(this)},e.options.fadeTime)),e},Fn.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i=e.options.mode==="dynamic"?"none":"block";e.ui.el.style.display=i,typeof t=="function"&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,n={};n.x=i===!0||i.x!==!1?0:e.instance.frontPosition.x,n.y=i===!0||i.y!==!1?0:e.instance.frontPosition.y,e.setPosition(t,n)}return e},Fn.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var n=i.options.fadeTime+"ms",r={};r.front=$M("transition",["top","left"],n);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(r),i.applyStyles(s),i.restTimeout=setTimeout(function(){typeof t=="function"&&t.call(i),i.restCallback()},i.options.fadeTime)},Fn.prototype.restCallback=function(){var t=this,e={};e.front=$M("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},Fn.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},Fn.prototype.computeDirection=function(t){var e,i,n,r=t.angle.radian,s=Math.PI/4,a=Math.PI/2;if(r>s&&r<3*s&&!t.lockX?e="up":r>-s&&r<=s&&!t.lockY?e="left":r>3*-s&&r<=-s&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=r>-a&&r<a?"left":"right"),t.lockX||(n=r>0?"up":"down"),t.force>this.options.threshold){var o,l={};for(o in this.direction)Object.prototype.hasOwnProperty.call(this.direction,o)&&(l[o]=this.direction[o]);var c={};for(o in this.direction={x:i,y:n,angle:e},t.direction=this.direction,l)l[o]===this.direction[o]&&(c[o]=!0);if(c.x&&c.y&&c.angle)return t;(!c.x||!c.y)&&this.trigger("plain",t),c.x||this.trigger("plain:"+i,t),c.y||this.trigger("plain:"+n,t),c.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var Zet=Fn;function pn(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=pn.id,pn.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(e),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let n=getComputedStyle(i.options.zone.parentElement);return n&&n.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}pn.prototype=new HP,pn.constructor=pn,pn.id=0,pn.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(i){if(i===void 0)return e[0];for(var n=0,r=e.length;n<r;n+=1)if(e[n].identifier===i)return e[n];return!1}},pn.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},pn.prototype.begin=function(){var t=this,e=t.options;if(e.mode==="static"){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},pn.prototype.createNipple=function(t,e){var i=this,n=i.manager.scroll,r={},s=i.options,a=i.parentIsFlex?n.x:n.x+i.box.left,o=i.parentIsFlex?n.y:n.y+i.box.top;if(t.x&&t.y)r={x:t.x-a,y:t.y-o};else if(t.top||t.right||t.bottom||t.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=t.top,l.style.right=t.right,l.style.bottom=t.bottom,l.style.left=t.left,l.style.position="absolute",s.zone.appendChild(l);var c=l.getBoundingClientRect();s.zone.removeChild(l),r=t,t={x:c.left+n.x,y:c.top+n.y}}var h=new Zet(i,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:e,position:t,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(XM(h.ui.el,r),XM(h.ui.front,h.frontPosition)),i.nipples.push(h),i.trigger("added "+h.identifier+":added",h),i.manager.trigger("added "+h.identifier+":added",h),i.bindNipple(h),h},pn.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},pn.prototype.bindNipple=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},pn.prototype.pressureFn=function(t,e,i){var n=this,r=0;clearInterval(n.pressureIntervals[i]),n.pressureIntervals[i]=setInterval(function(){var s=t.force||t.pressure||t.webkitForce||0;s!==r&&(e.trigger("pressure",s),n.trigger("pressure "+e.identifier+":pressure",s),r=s)}.bind(n),100)},pn.prototype.onstart=function(t){var e=this,i=e.options,n=t;return t=d7(t),e.updateBox(),TC(t,function(r){e.actives.length<i.maxNumberOfNipples?e.processOnStart(r):n.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(s){if(Object.values(n.touches).findIndex(function(o){return o.identifier===s})<0){var a=[t[0]];a.identifier=s,e.processOnEnd(a)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(r))}),e.manager.bindDocument(),!1},pn.prototype.processOnStart=function(t){var e,i=this,n=i.options,r=i.manager.getIdentifier(t),s=t.force||t.pressure||t.webkitForce||0,a={x:t.pageX,y:t.pageY},o=i.getOrCreate(r,a);o.identifier!==r&&i.manager.removeIdentifier(o.identifier),o.identifier=r;var l=function(c){c.trigger("start",c),i.trigger("start "+c.id+":start",c),c.show(),s>0&&i.pressureFn(t,c,c.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(o))>=0&&i.idles.splice(e,1),i.actives.push(o),i.ids.push(o.identifier),n.mode!=="semi")l(o);else{if(!(Fy(a,o.position)<=n.catchDistance))return o.destroy(),void i.processOnStart(t);l(o)}return o},pn.prototype.getOrCreate=function(t,e){var i,n=this,r=n.options;return/(semi|static)/.test(r.mode)?(i=n.idles[0])?(n.idles.splice(0,1),i):r.mode==="semi"?n.createNipple(e,t):(console.warn("Coudln't find the needed nipple."),!1):i=n.createNipple(e,t)},pn.prototype.processOnMove=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.scroll;if((_=>isNaN(_.buttons)?_.pressure!==0:_.buttons!==0)(t)){if(!r)return console.error("Found zombie joystick with ID "+n),void e.manager.removeIdentifier(n);if(i.dynamicPage){var a=r.el.getBoundingClientRect();r.position={x:s.x+a.left,y:s.y+a.top}}r.identifier=n;var o=r.options.size/2,l={x:t.pageX,y:t.pageY};i.lockX&&(l.y=r.position.y),i.lockY&&(l.x=r.position.x);var c,h,d=Fy(l,r.position),u=((_,b)=>{let x=b.x-_.x,w=b.y-_.y;return(S=>S*(180/Math.PI))(Math.atan2(w,x))})(l,r.position),p=qM(u),f=d/o,g={distance:d,position:l};if(r.options.shape==="circle"?(c=Math.min(d,o),h=((_,b,x)=>{let w={x:0,y:0};return x=qM(x),w.x=_.x-b*Math.cos(x),w.y=_.y-b*Math.sin(x),w})(r.position,c,u)):(h=((_,b,x)=>({x:Math.min(Math.max(_.x,b.x-x),b.x+x),y:Math.min(Math.max(_.y,b.y-x),b.y+x)}))(l,r.position,o),c=Fy(h,r.position)),i.follow){if(d>o){let _=l.x-h.x,b=l.y-h.y;r.position.x+=_,r.position.y+=b,r.el.style.top=r.position.y-(e.box.top+s.y)+"px",r.el.style.left=r.position.x-(e.box.left+s.x)+"px",d=Fy(l,r.position)}}else l=h,d=c;var m=l.x-r.position.x,v=l.y-r.position.y;r.frontPosition={x:m,y:v},i.dataOnly||XM(r.ui.front,r.frontPosition);var y={identifier:r.identifier,position:l,force:f,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:u},vector:{x:m/o,y:-v/o},raw:g,instance:r,lockX:i.lockX,lockY:i.lockY};(y=r.computeDirection(y)).angle={radian:qM(180-u),degree:180-u},r.trigger("move",y),e.trigger("move "+r.id+":move",y)}else this.processOnEnd(t)},pn.prototype.processOnEnd=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.removeIdentifier(r.identifier);!r||(i.dataOnly||r.hide(function(){i.mode==="dynamic"&&(r.trigger("removed",r),e.trigger("removed "+r.id+":removed",r),e.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(e.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),e.trigger("end "+r.id+":end",r),e.ids.indexOf(r.identifier)>=0&&e.ids.splice(e.ids.indexOf(r.identifier),1),e.actives.indexOf(r)>=0&&e.actives.splice(e.actives.indexOf(r),1),/(semi|static)/.test(i.mode)?e.idles.push(r):e.nipples.indexOf(r)>=0&&e.nipples.splice(e.nipples.indexOf(r),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[s.id]=s.identifier))},pn.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},pn.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(i){i.destroy()}),t.pressureIntervals)Object.prototype.hasOwnProperty.call(t.pressureIntervals,e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off(),t.pressureIntervals={},t.nipples=[],t.idles=[],t.actives=[],t.ids=[],t.manager=null};var Ket=pn;function An(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=AU(),e._windowBound=!1,e.config(t),e.prepareCollections();var i=function(){var n;e.collections.forEach(function(r){r.forEach(function(s){n=s.el.getBoundingClientRect(),s.position={x:e.scroll.x+n.left,y:e.scroll.y+n.top}})})};return e._onResize=function(){(n=>{Ny.has(n)&&clearTimeout(Ny.get(n)),Ny.set(n,setTimeout(function(){Ny.delete(n),n()},100))})(i)},e._onScroll=function(){e.scroll=AU()},e.collections}An.prototype=new HP,An.constructor=An,An.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(n){return!(i=n.get(e))}),i}},An.prototype.create=function(t){return this.createCollection(t)},An.prototype.bindWindowEvents=function(){var t=this;t._windowBound||typeof window>"u"||(t._windowBound=!0,ox(window,"resize",t._onResize),ox(window,"scroll",t._onScroll))},An.prototype.unbindWindowEvents=function(){var t=this;!t._windowBound||typeof window>"u"||(t._windowBound=!1,lx(window,"resize",t._onResize),lx(window,"scroll",t._onScroll))},An.prototype.createCollection=function(t){var e=this,i=new Ket(e,t);return e.bindCollection(i),e.collections.push(i),e.bindWindowEvents(),i},An.prototype.bindCollection=function(t){var e,i=this,n=function(r,s){e=r.type+" "+s.id+":"+r.type,i.trigger(e,s)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},An.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},An.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||t===!0)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},An.prototype.getIdentifier=function(t){var e;return t?(e=t.identifier===void 0?t.pointerId:t.identifier)===void 0&&(e=this.latest||0):e=this.index,this.ids[e]===void 0&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},An.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},An.prototype.onmove=function(t){return this.onAny("move",t),!1},An.prototype.onend=function(t){return this.onAny("end",t),!1},An.prototype.oncancel=function(t){return this.onAny("end",t),!1},An.prototype.onAny=function(t,e){var i,n=this,r="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=d7(e);var s=function(a,o,l){l.ids.indexOf(o)>=0&&(l[r](a),a._found_=!0)};return TC(e,function(a){i=n.getIdentifier(a),TC(n.collections,s.bind(null,a,i)),a._found_||n.removeIdentifier(i)}),!1},An.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.unbindWindowEvents(),t.ids={},t.index=0,t.collections.forEach(function(e){e.destroy()}),t.collections=[],t.off()},An.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1),i.collections.length===0&&i.unbindWindowEvents()};var Qet=An,up=null;function CU(){return up||(up=new Qet),up}var Jet={create:function(t){return CU().create(t)},destroy:function(){up&&(up.destroy(),up=null)},get factory(){return CU()}},tit=Jet;ti(),Xt(),J(),Xs(),Op(),$s(),Xr(),Xt();var g7=null;function ZM(){return g7}var v7,KM,eit=new Promise(t=>{v7=t});function iit(t){return KM||(KM=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.158/build",i=import("./physics.js"),[n,r]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(s=>s.arrayBuffer())]);await n.init(r),v7(n)}(),KM)}function y7(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,n=e[4]**2+e[5]**2+e[6]**2,r=e[8]**2+e[9]**2+e[10]**2,s=e[0]**2+e[4]**2+e[8]**2,a=e[1]**2+e[5]**2+e[9]**2,o=e[2]**2+e[6]**2+e[10]**2,l=1e-8;return i<l||n<l||r<l||s<l||a<l||o<l}function Yo(t,e){let i=new jt;if(e&&y7(e))return i.setAttribute("position",new kt([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new kt([],3)),i.setIndex([]),i;let{positions:n,triIndices:r}=aP(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new kt(n,3)),i.setIndex(r),e&&i.applyMatrix4(e),i}Oi(),Xr(),ke(),yP(),J(),J(),Lp(),y0();var Ge,nit=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=Rn(e,e.actions,n,r,s,i),this.target=e.target}disconnect(){nr(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>e.play()),this.actions.Animation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},PU=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.page=n,this.currentIntersectedObjects=[],this.actions=Rn(e,e.actions,n,r,s,i),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let o=n.scene.findFrom(a,i);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(t){return this.target==="all"||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){nr(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};Oi(),v0(),Dx(),eit.then(t=>Ge=t);var En=new T,Ls=new qt,QM=new T,rit=new T(1,1,1),JM=(new ci(0,0,0,"YXZ"),new ci(0,0,0,"XYZ")),Uo=new T,DU=new T,fm=new qt,ky=new Et,RU=new Et,sit={type:"updateMatrix"},tE=(new qt,new vr),eE=.01,CC={type:"beginEvent",eventName:"Collision"},ait={type:"beginEvent",eventName:"Trigger"},hx=t=>t.states.some(e=>e.data.position!==void 0||e.data.rotation!==void 0||e.data.shear!==void 0||e.data.cloner!==void 0||e.data.pathSnapping!==void 0);function lu(t){return function(e){return typeof e=="object"&&e!==null&&"booleanOp"in e}(lh(t)?t.object:t)}var oit=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=e=>{if(e.bodyType()!==Ge.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[i,n]=this.rigidBodyToMesh.get(e.handle);if(En.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),Ls.copy(e.rotation()),i.matrixWorld.makeRotationFromQuaternion(Ls).setPosition(En),i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(sit),n){let r=i.cloner;if(r&&r.objectForSample===void 0){r.matrixWorld.copy(i.matrixWorld);for(let s of r.children)s.updateMatrixWorld(!0)}for(let s of i.children)s.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,i,n)=>{if(n===!1)return;let r,s;if(this.sensorToTriggerEvent[e]?(r=this.sensorToTriggerEvent[e],s=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(r=this.sensorToTriggerEvent[i],s=this.sharedGameControlGlobals.colliderToEntity.get(e)),r&&s&&r.isValidTriggeringObject(s))r.dispatch();else{for(let a=this.sharedGameControlGlobals.createdObjects.length-1;a>=0;a--){let o=this.sharedGameControlGlobals.createdObjects[a];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===e||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(a,1),o.removeFromParent();let l=o.rigidBody;requestAnimationFrame(()=>{o.rigidBody===l&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(l),o.rigidBody=void 0)});break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let a=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,a,e)}else{let a=this.sharedGameControlGlobals.colliderToEntity.get(e),o=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];if(o!==void 0)for(let h of o)h.data.target==="scene"&&this.dispatchCollisionEvent(h,a,e);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),c=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(c!==void 0)for(let h of c)h.data.target==="scene"&&this.dispatchCollisionEvent(h,l,i)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events){if(i.data.disabled===!0)continue;let n=i.data.actions?.find(r=>r.data.type==="Destroy")?.data;if(n)for(let r of n.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events)if(i.data.disabled!==!0&&i.data.type==="DragDrop")for(let n of i.data.objects){let r=this.page.scene.find(n);r&&(r.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return e===void 0&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(ZM()===null)return void jn("collision-bvh","trigger/collision detection");let t=[],e=[];if(this.page.traverseChildren(i=>{let n,r=i instanceof lp,s=Ag(i);if(oh(i)||r||s)return;n=lh(i)?i.object:i;let a=n.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let o=i.geometry,l=n.userData.hasDestroy===!0,c=n.userData.hasDrag===!0;if(hx(a)||l||c||n.dataPatched.events.some(h=>h.data.disabled!==!0&&(h.data.type==="GameControl"||h.data.type==="Follow")))return i.updateMatrixWorldRigid(),this.addBoundsTree(i),!0;if(o){let h=o.getAttribute("position");if(h!==void 0&&h.count>0){t.push({geometry:o,matrixWorld:i.matrixWorld}),e.push(o.id,this._staticBVHIdOf(h),h.version,o.index!==null?this._staticBVHIdOf(o.index):-1,o.index!==null?o.index.version:-1);for(let d of i.matrixWorld.elements)e.push(d)}}return!!lu(i)||void 0}),t.length>0){let i=this._staticBVHCache;if(i!==void 0&&i.signature.length===e.length&&i.signature.every((s,a)=>s===e[a]))return void(this.sharedGameControlGlobals.staticMeshBVH=i.bvh);let n=Nc(t.map(s=>Yo(s.geometry,s.matrixWorld)),!1),r=new(ZM())(n);this._staticBVHCache={signature:e,bvh:r},this.sharedGameControlGlobals.staticMeshBVH=r}}addRigidBody(t,e,i){if(y7(t.matrixWorld))return;let n=[],r="geometry"in t?t.geometry:void 0,s=e.dataPatched;if(r?.getAttribute("position")!==void 0&&n.push(Yo(r,t.shearScale)),s.physics.fusedBody){let a=this.gatherChildrenGeom(t,n);t.traverseObject(a),t.children.forEach(l=>l.updateMatrixWorld(!0));let o=t.cloner;o&&o.objectForSample===void 0&&s.physics.rigidBody==="dynamic"&&(o.traverseObject(a),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(n.length>0){let a,o=!1,l=!i.fromCreate&&s.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;l?(a=Ge.RigidBodyDesc.dynamic(),a.setLinearDamping(s.physics.damping).setAngularDamping(s.physics.damping).setAdditionalMass(1e-9).setGravityScale(s.physics.gravityScale).enabledRotations(...s.physics.enabledRotation).enabledTranslations(...s.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(a=Ge.RigidBodyDesc.kinematicPositionBased(),o=!0):a=Ge.RigidBodyDesc.fixed();let c=Nc(n);En.setFromMatrixPosition(t.matrixWorld),Ls.setFromRotationMatrix(t.matrixWorldRigid),t.position0=En.clone().divideScalar(this.pixelsPerMeter),t.rotation0=Ls.clone(),En.divideScalar(this.pixelsPerMeter),a.setTranslation(En.x,En.y,En.z).setRotation(Ls),c?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(a),d=!(s.geometry===void 0||s.geometry.type==="SubdivGeometry"||s.geometry.type==="NonParametricGeometry"||s.geometry.type==="BooleanGeometry"||s.geometry.type==="VectorGeometry"||s.geometry.type==="StarGeometry"||s.geometry.type==="RectangleGeometry"||s.geometry.type==="EllipseGeometry"||s.geometry.type==="TriangleGeometry"||s.geometry.type==="TorusGeometry"||s.geometry.type==="HelixGeometry");try{this.addCollider(h,s.physics,c,e,d)}catch{try{this.addCollider(h,s.physics,c,e,!1)}catch(u){console.error(u)}}if(h.numColliders()===0)return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(h);l?this.rigidBodyToMesh.set(h.handle,[t,s.physics.fusedBody]):o?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(h.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,h,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=h}}addBoundsTree(t){let e=[];if(t.geometry?.getAttribute("position")!==void 0&&t.geometry?.getAttribute("position").count>0&&e.push(Yo(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(i=>i.updateMatrixWorld(!0)),e.length>0){let i=Nc(e,!1);t.bvhGeometry=i,i.getAttribute("position").count>0&&(t.bvhGeometry.boundsTree=new(ZM())(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t))}}addCollider(t,e,i,n,r=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let s;i&&(s=e.colliderType==="trimesh"?Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):Ge.ColliderDesc.convexMesh(i.getAttribute("position").array,r?i.getIndex().array:void 0)),s.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setRestitutionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(s,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,n),this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid]?.some(o=>o.target==="scene")&&a.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=lu(t);return(n,r)=>{if(r===0)return;if(i&&n.parent===t)return!0;let s;if(oh(n)){if(!n.objectForSample)return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(n.objectForSample.dataPatched.physics.fusedBody)return;s=n.object}else if(lh(n))s=n.object;else if(s=n,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;r===1?n.matrixWorld.copy(t.shearScale):n.matrixWorld.copy(n.parent.matrixWorld),n.matrixWorld.multiply(n.matrix);let o=n.geometry;return o?.getAttribute("position")!==void 0&&e.push(Yo(o,n.matrixWorld)),!!lu(n)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(a=>{for(let o of a.dataPatched.events)if(o.data.disabled===!1&&o.data.type==="Trigger")return this.needsCollisionDetection=!0,!0});let n=EU();if(n!==null?i=n.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:this.page.data.publish.gameControlObject!==null&&jn("game-controls","the scene's game controls"),i===!1){let{enableRotate:a,enablePan:o,enableZoom:l,autoRotate:c,hoverRotatePanMode:h}=this.eventManager.publish.orbitControls;(a||o||l||c||h!==0)&&(this.orbitControls=new j9(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let r=this.renderer.domElement.width/this.renderer.getPixelRatio(),s=this.renderer.domElement.height/this.renderer.getPixelRatio();EU()?.createJoysticks(this,r,s),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(a=>a.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Ge.World(new Ge.Vector3(0,this.gravity,0)),this.events=new Ge.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(a=>{let o;if(oh(a)){if(!a.objectForSample)return a.object.dataPatched.physics.fusedBody===!0&&a.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(a.objectForSample.dataPatched.physics.fusedBody)return;o=a.object}else if(lh(a))o=a.object;else{if(Ag(a)||ed(a)||a instanceof lp)return;if(o=a,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l,c=o.dataPatched;for(let m of c.events)m.data.disabled!==!0&&m.data.type==="GameControl"&&(l=m.data);if(!c.physics||(c.physics.enabled==="visibility"?!c.visible:!c.physics.enabled))return!0;a.updateMatrixWorldRigid();let h=hx(c),d=!1,u=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let m of c.events)if(m.data.disabled!==!0){if(m.data.type==="Collision"){d=!0;let v=new nit(m.id,m.data,o,this.page,this.sharedAssets,this.eventManager);v.initialDisabled=!0,this.collisionEvents.push(v),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(y=>y.id!==m.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[v]}else if(m.data.type==="Follow"){f=!0;let v=m.data.target;a.traverseVisible(y=>{y.userData.isFollowingObj=v})}}c.physics.rigidBody==="dynamic"&&c.physics.fusedBody===!1&&(a.matrixWorldFusedFalse=a.matrixWorld.clone());let g=a.geometry;if(l!==void 0){let m=Ge.RigidBodyDesc.kinematicPositionBased();(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(En,Ls,QM),a.position0=En.clone().divideScalar(this.pixelsPerMeter),a.rotation0=Ls.clone(),En.divideScalar(this.pixelsPerMeter),m.setTranslation(En.x,En.y,En.z).setRotation(Ls);let v,y=this.sharedGameControlGlobals.rapierWorld.createRigidBody(m);a.rigidBody=y,v=l.collider.type==="sphere"?Ge.ColliderDesc.ball(l.collider.radius/this.pixelsPerMeter):l.collider.type==="capsule"?Ge.ColliderDesc.capsule((l.collider.height/2-l.collider.radius)/this.pixelsPerMeter,l.collider.radius/this.pixelsPerMeter):Ge.ColliderDesc.cuboid(l.collider.width/this.pixelsPerMeter/2,l.collider.height/this.pixelsPerMeter/2,l.collider.depth/this.pixelsPerMeter/2),v.setFrictionCombineRule(Ge.CoefficientCombineRule.Average).setDensity(c.physics.density).setFriction(c.physics.friction).setRestitution(0).setRestitutionCombineRule(Ge.CoefficientCombineRule.Min);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(v,y);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,o),En.fromArray(l.collider.position.map(x=>typeof x=="number"?x:0)).multiply(QM.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(En);let b=new qt().setFromEuler(new ci().setFromVector3(new T().fromArray(l.collider.rotation.map(x=>typeof x=="number"?x:0))));_.setRotationWrtParent(b),_.setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else c.physics.rigidBody==="dynamic"||h||f||u||p||d?(this.addRigidBody(a,o,{hasFollow:f,hasTransformAnim:h,hasDrag:p}),this.generateSensorColliderDescs(o,c.physics.fusedBody)):(g&&t.push(Yo(g,a.matrixWorld)),c.physics.fusedBody&&!lu(a)&&a.traverseObject((m,v)=>{if(v===0)return;let y;if(oh(m)){if(!m.objectForSample)return m.object.dataPatched.physics.fusedBody===!0&&m.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(m.objectForSample.dataPatched.physics.fusedBody)return;y=m.object}else{if(Ag(m)||ed(m)||m instanceof lp)return;if(lh(m))y=m.object;else if(y=m,y.dataPatched.cloner?.hideBase)return!0}let _=y.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let b=m.geometry;return b?.getAttribute("position")!==void 0&&t.push(Yo(b,m.matrixWorld)),!!lu(m)||void 0}),this.generateSensorColliderDescs(o,c.physics.fusedBody,e));return!(c.physics?.fusedBody!==!0&&!l&&!lu(a))||void 0}),t.length===0)return;let i=Nc(t),n=i.getIndex().count>0;if(!n&&e.length===0)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=Ge.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r);if(n){let a=Ge.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Ge.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Ge.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s)}for(let[a,o]of e){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(a,s);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(e.data.type==="Trigger"&&e.data.disabled!==!0){let i=new PU(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),n=new Et().compose(Uo.fromArray(e.data.position.map(r=>typeof r=="number"?r:0)),fm.setFromEuler(JM.fromArray(e.data.rotation.map(r=>typeof r=="number"?r:0))),rit);if(e.data.triggerZone==="box"){let r=new hi;r.min.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(-.5),r.max.fromArray(e.data.size.map(s=>typeof s=="number"?s:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([r,n,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,n,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):this.initializationCounter===2&&this.gameControl&&(e=!this.gameControl.update(t)&&e),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(t===0)e=this.stepPhysics()&&e;else{let n=t/1e3;n<i&&n>.55*i&&(n=i),this.accumulator+=n;let r=performance.now(),s=0,a=6;for(;this.accumulator>=i&&s<a&&(e=this.stepPhysics()&&e,this.accumulator-=i,s++,!(performance.now()-r>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(En,Ls,QM);let e=t;e.prevQ===void 0?(e.prevQ=Ls.clone(),e.prevT=En.clone()):(e.prevQ.copy(Ls),e.prevT.copy(En))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,n]=this.fixedBodiesToWatch[t];e.rigidBody===i?(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(n)||(i.setBodyType(Ge.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1)):this.fixedBodiesToWatch.splice(t,1)}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(t===void 0)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),n=t.translation(),r=Math.hypot(i.x,i.z);for(let s=0;s<t.numColliders();s++){let a=t.collider(s);e.contactPairsWith(a,o=>{let l=o.parent();if(l===null||!l.isDynamic())return;let c=l.translation(),h=-1/0,d=0,u=0;if(e.contactPair(a,o,v=>{let y=v.normal(),_=y.x*(c.x-n.x)+y.y*(c.y-n.y)+y.z*(c.z-n.z)<0?-1:1;if(Math.abs(y.y)>.7)return;let b=_*y.x,x=_*y.z,w=Math.hypot(b,x);if(w<1e-4)return;let S=(i.x*b+i.z*x)/w;S>h&&(h=S,d=b/w,u=x/w)}),h===-1/0)return;let p=i.x*d+i.z*u;if(p<-eE)return;let f=l.linvel();if(r>eE&&p>eE){let v=f.x*d+f.z*u;if(v<=0)return;let y=Math.min(v,p);return void l.setLinvel({x:d*y,y:f.y,z:u*y},!0)}let g=f.x*d+f.z*u-Math.max(0,p);if(g<=0)return;let m=.5*g;l.setLinvel({x:f.x-d*m,y:f.y,z:f.z-u*m},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();let t=this.sharedGameControlGlobals.kinematicBodyToEntity;for(let[e,i]of t)i.rigidBody!==void 0?(this.recordPhysicsPose(i),i.rigidBody.setNextKinematicTranslation(En.divideScalar(this.pixelsPerMeter)),i.rigidBody.setNextKinematicRotation(Ls)):t.delete(e);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)e.rigidBody?.isKinematic()!==!0&&this.recordPhysicsPose(e);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let n,r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner){for(let s of e.cloner.children)if(s.rigidBody===r){n=s;break}}t.dispatch(n),e.dispatchEvent(CC)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let n=RU.copy(t.matrixWorld).invert();t.traverseEntity((r,s)=>{if(e===!1&&s===1)return!0;for(let a of r.dataPatched.events)if(a.data.type==="Trigger"&&a.data.disabled!==!0){let o,l=new PU(a.id,a.data,r,this.page,this.sharedAssets,this.eventManager);if(o=a.data.triggerZone==="box"?Ge.ColliderDesc.cuboid(...a.data.size.map(c=>(typeof c=="number"?c:1)/(2*this.pixelsPerMeter))):Ge.ColliderDesc.ball(a.data.radius/this.pixelsPerMeter),o.setDensity(0).setSensor(!0).setActiveEvents(Ge.ActiveEvents.COLLISION_EVENTS),Uo.fromArray(a.data.position.map(c=>typeof c=="number"?c:0)),fm.setFromEuler(JM.fromArray(a.data.rotation.map(c=>typeof c=="number"?c:0))),ky.makeRotationFromEuler(JM).setPosition(Uo).premultiply(r.matrixWorld),i?(ll(ky,{translation:Uo,quaternion:fm,scale:DU}),o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED)):(ll(ky.premultiply(n),{translation:Uo,quaternion:fm,scale:DU}),t.rigidBody.bodyType()===Ge.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===Ge.RigidBodyType.Fixed?o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_FIXED|Ge.ActiveCollisionTypes.DYNAMIC_FIXED):o.setActiveCollisionTypes(Ge.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Ge.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Uo.divideScalar(this.pixelsPerMeter),o.setTranslation(Uo.x,Uo.y,Uo.z),o.setRotation(fm),i)i.push([o,l]);else{let c=this.sharedGameControlGlobals.rapierWorld.createCollider(o,t.rigidBody);this.sensorToTriggerEvent[c.handle]=l}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,n,r,s]=this.sharedGameControlGlobals.triggers[e];for(let a=0;a<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;a++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[a];if(r===o||s.isValidTriggeringObject(Ie.is(o)?o:o.object)===!1)continue;let l=RU.copy(Ek(r.matrixWorld)).copyPosition(r.matrixWorld).multiply(n),c=ky.copy(o.matrixWorld).invert().multiply(l),h=o.bvhGeometry.boundsTree;i instanceof hi?t=h.intersectsBox(i,c):(tE.radius=i,tE.center.setFromMatrixPosition(c),t=h.intersectsSphere(tE)),t?s.currentIntersectedObjects.indexOf(o)===-1&&(s.currentIntersectedObjects.push(o),s.dispatch(),r.dispatchEvent(ait)):s.currentIntersectedObjects=s.currentIntersectedObjects.filter(d=>d!==o)}}}};Bp(),J(),Lb(),Ye(),v0(),Lh();var iE=.02,OU=new T,IU=new T,lit=new T,Mr=new T,zo=new T,hu=new T,nE=new Et,LU=new Et,hit=new Et,fs=new qt,_c=new qt,cu=new ci(0,0,0,"YXZ"),cit=new T(1,0,0),ka=new T(0,1,0),dit=new T(0,0,1),BU=new T(1,1,1),UU=[],zU=t=>UU[t]??(UU[t]=new T),rE=new T,uit=new T,pit=new T,fit=new T,FU=new qt,mit=new T,NU=new qt,Kn=new bs,Bs=new hi,git={type:"requestRender"},vit={type:"updateMatrix"},PC=class extends kn{constructor(t,e,i,n,r,s,a,o,l){super(),this.object=t,this.domElement=e,this.data=i,this.gloabalPhysics=n,this.controlsManager=r,this.cameraFollow=s,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.target0=new T,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new ci(0,0,0,"YXZ"),this.shearMatrix0=new Et,this.cameraShearMatrix0=new Et,this.position0Cam=new T,this.quat0Cam=new qt,this.scale0Cam=new T,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new bs(new T(0,-40,0),new T(0,40,0)),matrix:new Et,position:new T,rotation:new qt},this.euler=new ci(0,0,0,"YXZ"),this.eulerDelta=new T,this.lastPosition=new T,this.lastCameraQuaternion=new qt,this.lastCameraPosition=new T,this.PI_2=Math.PI/2,this.prevMouse=new et,this.velocityTarget=new T,this.velocity=new T,this.directionXZ=new T,this.rotVelocityStick=new T,this.rotVelocityTarget=new T,this.rotVelocity=new T,this.rotDirection=new T,this.nonColliderRotOffset=new Et,this.nonColliderPosOffset=new Et,this.firstPointerId=-1,this.rot=new T,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new Et,this.objectToTarget=new T,this.objectToTarget0=new T,this.objectToCamXZ=new T,this.objectToCamXZ0=new T,this.targetToCamera=new T,this.targetToCamera0=new T,this.cameraPolarAxis0=new T,this.targetPos=new T,this.targetQuat=new qt,this.lerpFactorPos=new T().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new qt,this.objXZQuatInv=new qt,this.objXZRotMat=new Et,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new T,this.pushedVelocity=new T,this.groundYRotation=0,this.objectRealQuat=new qt,this.colliderWorldQuat=new qt,this.groundNormal=new T,this.groundTilt=new qt,this.groundTiltInv=new qt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new T,this.quaternion=new qt,this.scale=new T,this.initialAction=!0,this.onPointerDown=f=>{!(f.target===this.domElement||f.target instanceof HTMLElement&&f.target.tagName==="SPLINE-VIEWER"&&f.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=f.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!os&&!xA&&this.domElement.requestPointerLock(),this.prevMouse.set(f.clientX,f.clientY))},this.onPointerUp=f=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),f.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=f=>{if(f.pointerId!==this.firstPointerId)return;let g=f.clientX-this.prevMouse.x,m=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(xA&&RN<15.5&&!os?(this.eulerDelta.y=-g*this.mouseOrbitSensitivity,this.eulerDelta.x=-m*this.mouseOrbitSensitivity):(this.eulerDelta.y=-f.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-f.movementY*this.mouseOrbitSensitivity)),f.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-g*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-m*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?PC.isLocked=!0:PC.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let f in this.movementState)this.movementState[f]=0},this.onKeyDown=f=>{!(f.target instanceof HTMLInputElement)&&(f.code==="ArrowLeft"||f.code==="ArrowUp"||f.code==="ArrowRight"||f.code==="ArrowDown"||f.code==="Space")&&f.preventDefault();for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]){this.movementState[g[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let g of this.keyAssignments)if(f.key.toUpperCase()===g[1]||f.key===g[1]||f.code.slice(3,f.code.length).toUpperCase()===g[1]){this.movementState[g[0]]=0;break}},this.copyVRGamePadValues=(f,g)=>{for(let m=2;m<4;m++){let v=f.axes[m];g===0?m===2?this.movementState.movePosX=v:this.movementState.movePosZ=v:(f.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,m===2?this.movementState.rotPosY=v:this.moveMode==="fly"&&(this.movementState.moveNegY=v))}},this.sharedGameControlGlobals=r.sharedGameControlGlobals,t===a&&(this.isFirstPerson=!0),this.object.parent instanceof Si||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),this.shearMatrix0.copy(this.object.shearMatrix),ll(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix}),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let c=this.euler0.clone(),h=c.y;if(this.objectRealQuat.copy(this.quaternion),c.y=0,this.quaternion.setFromEuler(c),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),c.set(0,h,0),this.quaternion.setFromEuler(c),this.rot.setFromEuler(c),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.camera.parent instanceof Si||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),this.cameraShearMatrix0.copy(this.camera.shearMatrix),ll(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix})),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let f,g=new T(0,0,-1).applyQuaternion(this.camera.quaternion),m=new T().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(m),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(g.y)<1e-6?(m.y=0,g.y=0,f=m.projectOnVector(g)):f=m.y/g.y>0?g.multiplyScalar(m.y/g.y):g.multiplyScalar(m.length()),this.targetToCamera0.copy(f).negate();let v=this.camera.position.clone().add(f);this.objectToTarget0.subVectors(v,this.position);let y=new ci().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-y.x,y.x=0,y.z=0,y.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(y)}if(this.object instanceof Ki&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=1*(i.speedTranslate??250),this.speedOrbit=.025*(i.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(i.speedRotate??100),this.keyAssignments=i.keyAssignments.map(f=>{let g=[f[0],f[1]];return g[1]==="\u25B2"?g[1]="ArrowUp":g[1]==="\u25C0"?g[1]="ArrowLeft":g[1]==="\u25BC"?g[1]="ArrowDown":g[1]==="\u25B6"?g[1]="ArrowRight":g[1]==="\u21E7"?g[1]="Shift":g[1]==="\u21B5"?g[1]="Enter":g[1]==="Space"?g[1]=" ":g[1]==="\u2318"?g[1]="Meta":g[1]==="Ctrl"?g[1]="Control":g[1]==="Esc"&&(g[1]="Escape"),g}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(g=>g[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(g=>g[0]==="rotNegY"),f!==-1&&(this.keyAssignments[f][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(i.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(i.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(i.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(i.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(i.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(i.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??np.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??np.defaultData.usePhysics,this.jumpPower=20*i.jumpPower,this.resetYPosition=this.position.y+Math.abs(i.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=i.alignToGround??!1,this.orientMode=i.autoOrientMove?i.orientMode:"none",this.orientWith=i.orientWith??Cb.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,i.collider.type==="capsule"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=i.collider.height/2-i.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=i.collider.height*iE/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height):i.collider.type==="sphere"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*i.collider.radius*iE/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*iE/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new T().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),u=new qt().setFromEuler(new ci().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(u),this.collider.matrix.compose(d,u,BU),i.cameraXAxis!==void 0&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let p=2*i.navmesh.destinationHelperRadius;if(p>0){let f=new Nt;f.push({fi:0,data:{...Xi.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{...Xi.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let g=F8({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new gi(K3.create({parameters:{width:p,height:p/10,hollow:.7}}),g),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.matrixWorldAutoUpdate=!0,this.camera.matrixWorldAutoUpdate=!0,this.object.shearMatrix.copy(this.shearMatrix0),t){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.parent instanceof Si||(this.object.matrixWorldAutoUpdate=!1,this.object.matrix.copy(this.object.matrixWorld)),ll(this.object.matrix,{translation:this.position,quaternion:this.quaternion,scale:this.scale,shearMatrix:this.object.shearMatrix});let e=new ci().setFromQuaternion(this.quaternion,"YXZ"),i=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,i,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof Ki?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.shearMatrix.copy(this.cameraShearMatrix0),t?(this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.camera.parent instanceof Si||(this.camera.matrixWorldAutoUpdate=!1,this.camera.matrix.copy(this.camera.matrixWorld),ll(this.camera.matrix,{translation:this.camera.position,quaternion:this.camera.quaternion,scale:this.camera.scale,shearMatrix:this.camera.shearMatrix}))):this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let t=this.data,e=this.sharedAssets;t.gameActions!==void 0&&(this.actions={},Tb.list.forEach(i=>{this.actions[i]=Rn({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),nr(this.actions.idle),nr(this.actions.move),nr(this.actions.run),nr(this.actions.jump)}dispatchStartEvent(t){this.actions[t]!==void 0&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(e=>{e.play()}),this.actions[t].Animation.forEach(e=>{e.play(this.initialAction===!1)}),this.actions[t].TimelineAnimation.forEach(e=>{e.play()}),this.actions[t].Create.forEach(e=>{e.dispatchStart()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(t){this.actions[t]!==void 0&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(e=>{e.stop(),e.object.currentState!==null&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[t].Create.forEach(e=>{e.dispatchStop()}),this.actions[t].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(e=>{e.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Mr.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let e=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let i=60*e,n=!1;if(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let s=zo.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*e,0).divideScalar(this.pixelsPerMeter),a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,8,void 0,void 0,this.object.rigidBody);if(a){this.onObject=!0,this.groundNormal.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(n=!0),a.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let o=a.collider.parent(),l=o!==null&&o.isKinematic()?o:null,c=l===null?void 0:this.sharedGameControlGlobals.kinematicBodyToEntity.get(l.handle);if(l!==null&&c?.userData.isFollowingObj!==this.object.uuid){let h=this.object.getWorldPosition(Mr).add(this.collider.position).divideScalar(this.pixelsPerMeter),d=l.velocityAtPoint(h);this.groundVelocity.set(d.x,d.y,d.z).multiplyScalar(this.pixelsPerMeter),this.groundYRotation=l.angvel().y*e}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*i),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let s=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let a=Mr.subVectors(this.path[1],this.position),o=zo.subVectors(this.path[1],this.path[0]);a.dot(o)<0?this.path.shift():(this.directionXZ.x=o.x,this.directionXZ.z=o.z),s.opacity=s.userData.opacity0}else s.opacity-=.05*s.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**i),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**i),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**i)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let r=lit.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let s=zo.copy(r);s.y=0,r.set(0,r.y,s.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let s=Mr;this.camera.getWorldDirection(s);let a=hu.copy(ka).multiplyScalar(s.dot(ka));s.sub(a);let o=zo.copy(this.directionXZ);o.x*=-1,this.rot.y=s.angleTo(o)*(s.cross(o).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(cu.setFromVector3(this.rot),this.moveMode==="walk"&&(cu.x=0),r.applyEuler(cu),n&&(_c.setFromUnitVectors(ka,this.groundNormal),r.applyQuaternion(_c)),this.usePhysics===!0&&this.object.rigidBody){this.pushedVelocity.set(0,0,0);let s=0;for(let a of this.sharedGameControlGlobals.entitiesWithTransformAnim){if(a.rigidBody===void 0||a.prevQ===void 0)continue;(a.hasNonUniformScale?a.matrixWorldRigid:a.matrixWorld).decompose(rE,FU,uit);let o=this.object.getWorldPosition(pit).add(this.collider.position).sub(rE);NU.copy(a.prevQ).invert().premultiply(FU);let l=hu.subVectors(rE,a.prevT).add(fit.copy(o).applyQuaternion(NU).sub(o)).divideScalar(e).divideScalar(this.pixelsPerMeter),c=a.rigidBody.collider(0).castCollider(l,this.object.rigidBody.collider(0),Mr.copy(r).divideScalar(this.pixelsPerMeter),0,e,!1);l.multiplyScalar(this.pixelsPerMeter);let h=Ie.is(a)?a:a.object;if(c!==null&&this.lastHitObj!==h){let d;a instanceof Or&&(d=a);let u=this.sharedGameControlGlobals.entityToCollisionEvents[h.uuid];if(u)for(let p of u)p.data.target==="character"&&(p.dispatch(d),h.dispatchEvent(CC));this.lastHitObj=h}c!==null&&(Math.abs(l.x)>Math.abs(this.pushedVelocity.x)&&(this.pushedVelocity.x=l.x),Math.abs(l.y)>Math.abs(this.pushedVelocity.y)&&(this.pushedVelocity.y=l.y),Math.abs(l.z)>Math.abs(this.pushedVelocity.z)&&(this.pushedVelocity.z=l.z),zU(s++).copy(c.normal1).applyQuaternion(a.quaternion))}if(s>0){for(let a=0;a<s;a++){let o=zU(a),l=o.dot(r);l<0&&r.addScaledVector(o,-l)}r.add(this.pushedVelocity)}else r.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(e),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**i):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**i),this.euler.x+=this.rotVelocity.x*e,this.euler.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*e),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(ka,this.euler.y-this.euler0.y);let s=zo.copy(this.objectToCamXZ).normalize(),a=hu.copy(r).multiplyScalar(e);a.y=0;let o=a.sub(Mr.copy(s).multiplyScalar(a.dot(s))).cross(s).y;this.euler.y-=Math.atan2(o,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*e+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=Pt.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=Pt.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=Pt.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(cu.copy(this.euler),cu.y=0,this.nonColliderRotOffset.makeRotationFromEuler(cu)),fs.setFromAxisAngle(cit,this.rot.x),_c.setFromAxisAngle(ka,this.rot.y),_c.multiply(fs),fs.setFromAxisAngle(dit,this.rot.z),_c.multiply(fs),this.quaternion.copy(_c),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let s=zo.copy(r).multiplyScalar(e/this.pixelsPerMeter),a=null;this.didHit=!1;let o=new T;for(let h=0;h<5;h++){let d=s.length(),u=hu.copy(s).normalize();if(a=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),this.colliderWorldQuat,u,this.object.rigidBody.collider(0).shape,0,d,!1,12,void 0,void 0,this.object.rigidBody),a===null){h===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),o.add(s);break}{this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(a.collider.handle);if(p!==this.lastHitObj&&h===0){this.lastHitObj=p;let v=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(v){for(let y of v)if(y.data.target==="character"){let _,b=(this.sharedGameControlGlobals.rapierWorld?.getCollider(a.collider.handle))._parent;if(p.cloner){for(let x of p.cloner.children)if(x.rigidBody===b){_=x;break}}y.dispatch(_),p.dispatchEvent(CC)}}}let f=OU.set(a.normal2.x,a.normal2.y,a.normal2.z).applyQuaternion(this.colliderWorldQuat),g=IU.copy(u).multiplyScalar(a.time_of_impact).dot(f),m=a.time_of_impact;if(m===0&&(this.position.y+=this.offset*this.pixelsPerMeter),g>this.offset&&(m=a.time_of_impact*(g-this.offset)/g,o.addScaledVector(u,m)),s.copy(u).multiplyScalar(d-m),Math.acos(-f.y)>this.slopeThresh){let v=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(o),y=hu.copy(a.witness2).applyQuaternion(this.colliderWorldQuat);y.y=0;let _=v.add(y);_.y+=this.stepThresh;let b=this.sharedGameControlGlobals.rapierWorld.castShape(_,this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,0,1,!1,12,void 0,void 0,this.object.rigidBody);b!==null&&b.time_of_impact===0&&(f.y=0,f.normalize())}s.addScaledVector(f,-s.dot(f))}}this.position.addScaledVector(o,this.pixelsPerMeter),Mr.copy(this.position).divideScalar(this.pixelsPerMeter),fs.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat);let l=this.object.rigidBody,c=l!==void 0&&mit.copy(Mr).sub(l.translation()).lengthSq()>1;l!==void 0&&(c?(l.setTranslation(Mr,!0),l.setRotation(fs,!0)):(l.setNextKinematicTranslation(Mr),l.setNextKinematicRotation(fs)))}else{let s=this.onObject?1:5,a=r.multiplyScalar(e/s);for(let o=0;o<s;o++)this.position.add(a),this.collisionAdjustment(e/s)}else this.position.addScaledVector(r,e);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),p6(this.position,this.quaternion,this.object.shearMatrix,this.scale,this.object.matrix).multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.object.parent instanceof Si?this.object.matrixWorld.multiplyMatrices(this.object.parent.matrixWorld,this.object.matrix).multiply(this.object.pivotMatrix):this.object.matrixWorld.copy(this.object.matrix),this.object.children.forEach(s=>{s.updateMatrixWorld(!0)}),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let s=this.objectToTarget.add(this.position),a=this.targetToCamera.add(s);nE.lookAt(a,s,ka).setPosition(a),nE.decompose(this.targetPos,this.targetQuat,Mr),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**i),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**i),this.camera.updateMatrix(),this.camera.matrixWorld.copy(this.camera.matrix),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=Pt.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=Pt.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(vit),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)||(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(git),0))}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=fs.setFromAxisAngle(ka,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?Pt.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e),t=this.cameraXAxis==="Limit"?Pt.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):Pt.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Mr.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let n=_c.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(n)}groundTiltAdjustment(t){180*ka.angleTo(t)/Math.PI<15||180*ka.angleTo(t)/Math.PI>85?fs.identity():fs.setFromUnitVectors(ka,t),this.groundTilt.slerp(fs,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=IU.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);let i=nE.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Mr,fs,zo).compose(Mr,fs,BU);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(r=>{if(r===this.object||r.isDescendantOf(this.object)||!r.bvhGeometry||!r.bvhGeometry.boundsTree)return;Bs.makeEmpty(),r.updateMatrixWorldRigid();let s=r.matrixWorldRigid,a=LU.copy(s).invert(),o=hit.copy(LU).multiply(i);Kn.copy(this.collider.segment),Kn.start.applyMatrix4(o),Kn.end.applyMatrix4(o);let l=OU.copy(this.position).applyMatrix4(a);Bs.expandByPoint(Kn.start),Bs.expandByPoint(Kn.end),Bs.min.addScalar(-this.collider.radius),Bs.max.addScalar(this.collider.radius),r.bvhGeometry.boundsTree.shapecast({boundsTraverseOrder:c=>c.distanceToPoint(Kn.end),intersectsBounds:c=>c.intersectsBox(Bs),intersectsTriangle:c=>{let h=Mr,d=zo,u=c.closestPointToSegment(Kn,h,d);if(u<this.collider.radius){let p=this.collider.radius-u,f=d.sub(h).normalize(),g=hu.copy(l);g.addScaledVector(f,p);let m=g.applyMatrix4(s).sub(this.position);e.add(m),Kn.start.addScaledVector(f,p),Kn.end.addScaledVector(f,p)}}})}),Bs.makeEmpty(),Kn.copy(this.collider.segment),Kn.start.applyMatrix4(i),Kn.end.applyMatrix4(i),Bs.expandByPoint(Kn.start),Bs.expandByPoint(Kn.end),Bs.min.addScalar(-this.collider.radius),Bs.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({boundsTraverseOrder:r=>r.distanceToPoint(Kn.end),intersectsBounds:r=>r.intersectsBox(Bs),intersectsTriangle:r=>{let s=Mr,a=zo,o=r.closestPointToSegment(Kn,s,a);if(o<this.collider.radius){let l=this.collider.radius-o,c=a.sub(s).normalize();this.alignToGround&&this.groundTiltAdjustment(c),e.addScaledVector(c,l),Kn.start.addScaledVector(c,l),Kn.end.addScaledVector(c,l)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let n=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(n),this.position.add(e)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},_7=PC;_7.isLocked=!1,J(),y0(),Bp(),Lp();var b7,x7,sE,yit=new Promise(t=>{b7=t});function _it(t){return sE||(sE=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.158/build";typeof window<"u"&&(x7=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[n,r]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(o=>o.arrayBuffer())]),s=n.default,a=await s({wasmBinary:r});b7(a)}(),sE)}ti();var w7,Fe,dr,bit=t=>`
|
|
9886
9906
|
(async function() {
|
|
9887
9907
|
const [wasmImport, wasmBinary] = await Promise.all([
|
|
9888
9908
|
import('${t}' + 'navmesh.js'),
|
|
@@ -9892,7 +9912,7 @@ void main() {
|
|
|
9892
9912
|
self.module = await wasmModule({ wasmBinary });
|
|
9893
9913
|
postMessage('ready');
|
|
9894
9914
|
})();
|
|
9895
|
-
`,xit={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};yit.then(t=>{w7=t,Fe=new t.Vec3,dr=new t.Vec3});var wit=new T,Sit=class{constructor(t=!1,e=!1){this.usePhysics=t,this.isExport=e,this.onPointerDown=i=>{if(ae.length!==1)return;let{raycaster:n,page:r}=this.eventContext;this.eventContext.updateRaycaster(i);let s=r.raycastWithClones(n);if(s.length!==0){if(this.gameControl){let a=wit.copy(this.gameControl.colliderWorldPosition);a.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(a,s[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,n)=>r=>{let s;if(r instanceof wh){if(!r.objectForSample)return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(r.objectForSample.dataPatched.physics.fusedBody)return;s=r.object}else if(r instanceof Or)s=r.object;else if(s=r,s.dataPatched.cloner?.disabled===!1&&s.dataPatched.cloner?.hideBase&&s.dataPatched.physics?.fusedBody!==!0)return!0;if(n&&!s.userData.navmesh)return;let a=s.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;r.updateMatrixWorldRigid();let o=hx(a),l=s.userData.hasDestroy,c=s.userData.hasDrag,h=!1,d=!1;for(let u of a.events)u.data.disabled!==!0&&(u.data.type==="GameControl"?h=!0:u.data.type==="Follow"&&(d=!0));if(h||o||d||l||c)return!0;if(this.usePhysics&&a.physics?.rigidBody==="dynamic"){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in r&&r.geometry&&i.push(Yo(r.geometry,r.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return r.traverseObject((u,p)=>{if(p===0)return;let f;if(u instanceof wh){if(!u.objectForSample)return u.object.dataPatched.physics.fusedBody===!0&&u.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(u.objectForSample.dataPatched.physics.fusedBody)return;f=u.object}else if(u instanceof Or)f=u.object;else if(f=u,u.dataPatched.cloner?.hideBase)return!0;let g=f.dataPatched;if(!g.visible&&g.physics?.enabled!==!0)return!0;"geometry"in u&&u.geometry&&i.push(Yo(u.geometry,u.matrixWorld))}),!0},this.traverseNoPhysics=(i,n)=>r=>{let s;if(r instanceof wh)return;s=r instanceof Or?r.object:r;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(n&&!s.userData.navmesh)return;let o=r.geometry,l=s.userData.hasDestroy===!0,c=s.userData.hasDrag===!0;if(hx(a)||l||c||s.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(Yo(o,r.matrixWorld))},this.navmeshWasm=w7,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(e?bit(x7??"https://cdn.spline.design/@splinetool/runtime@2.0.
|
|
9915
|
+
`,xit={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};yit.then(t=>{w7=t,Fe=new t.Vec3,dr=new t.Vec3});var wit=new T,Sit=class{constructor(t=!1,e=!1){this.usePhysics=t,this.isExport=e,this.onPointerDown=i=>{if(ae.length!==1)return;let{raycaster:n,page:r}=this.eventContext;this.eventContext.updateRaycaster(i);let s=r.raycastWithClones(n);if(s.length!==0){if(this.gameControl){let a=wit.copy(this.gameControl.colliderWorldPosition);a.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(a,s[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,n)=>r=>{let s;if(r instanceof wh){if(!r.objectForSample)return r.object.dataPatched.physics.fusedBody===!0&&r.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(r.objectForSample.dataPatched.physics.fusedBody)return;s=r.object}else if(r instanceof Or)s=r.object;else if(s=r,s.dataPatched.cloner?.disabled===!1&&s.dataPatched.cloner?.hideBase&&s.dataPatched.physics?.fusedBody!==!0)return!0;if(n&&!s.userData.navmesh)return;let a=s.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;r.updateMatrixWorldRigid();let o=hx(a),l=s.userData.hasDestroy,c=s.userData.hasDrag,h=!1,d=!1;for(let u of a.events)u.data.disabled!==!0&&(u.data.type==="GameControl"?h=!0:u.data.type==="Follow"&&(d=!0));if(h||o||d||l||c)return!0;if(this.usePhysics&&a.physics?.rigidBody==="dynamic"){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in r&&r.geometry&&i.push(Yo(r.geometry,r.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return r.traverseObject((u,p)=>{if(p===0)return;let f;if(u instanceof wh){if(!u.objectForSample)return u.object.dataPatched.physics.fusedBody===!0&&u.object.dataPatched.physics.rigidBody==="dynamic"||void 0;if(u.objectForSample.dataPatched.physics.fusedBody)return;f=u.object}else if(u instanceof Or)f=u.object;else if(f=u,u.dataPatched.cloner?.hideBase)return!0;let g=f.dataPatched;if(!g.visible&&g.physics?.enabled!==!0)return!0;"geometry"in u&&u.geometry&&i.push(Yo(u.geometry,u.matrixWorld))}),!0},this.traverseNoPhysics=(i,n)=>r=>{let s;if(r instanceof wh)return;s=r instanceof Or?r.object:r;let a=s.dataPatched;if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;if(n&&!s.userData.navmesh)return;let o=r.geometry,l=s.userData.hasDestroy===!0,c=s.userData.hasDrag===!0;if(hx(a)||l||c||s.dataPatched.events.some(h=>h.data.disabled!==!0&&h.data.type==="GameControl"))return!0;o&&i.push(Yo(o,r.matrixWorld))},this.navmeshWasm=w7,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(e?bit(x7??"https://cdn.spline.design/@splinetool/runtime@2.0.158/build/"):`
|
|
9896
9916
|
(async function() {
|
|
9897
9917
|
const [wasmImport, wasmBinary] = await Promise.all([
|
|
9898
9918
|
import(self.location.origin + '/_libraries/navmesh.js'),
|
|
@@ -9967,7 +9987,7 @@ onmessage = function(messageEvent) {
|
|
|
9967
9987
|
[${u_}] { pointer-events: none; }
|
|
9968
9988
|
[${u_}] > * { pointer-events: auto; }
|
|
9969
9989
|
[${u_}] [data-spline-passthrough] { pointer-events: none; }
|
|
9970
|
-
`,W7=class{constructor(t,e,i,n,r,s){this.container=t,this.host=e,this.observer=i,this.spline=n,this.previousSplineGlobal=r,this.removeLateLifecycleShim=s}static mount(t,e,i,n){if(typeof document>"u")return null;let r=e.parentElement;if(!r)return null;getComputedStyle(r).position==="static"&&(r.style.position="relative");let s=document.createElement("div");s.setAttribute(u_,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(r);let c=document.createElement("style");c.textContent=qrt,s.appendChild(c);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let y of d)y.remove();for(let y of Array.from(h.head.children))(y.tagName==="STYLE"||y.tagName==="LINK"&&y.rel==="stylesheet")&&s.appendChild(y);for(;h.body.firstChild;)s.appendChild(h.body.firstChild);r.insertBefore(s,e.nextSibling),s.addEventListener("wheel",y=>{y.ctrlKey&&!y.defaultPrevented&&!e.dispatchEvent(new WheelEvent("wheel",y))&&y.preventDefault()},{passive:!1});let u=new Map,p=new m3(G7(t,e,n),(y,_)=>{y==="warn"?console.warn(`[spline html] ${_}`):y==="error"&&console.error(`[spline html] ${_}`)},(y,_)=>{let b=u.get(y);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),f=(y,_)=>{try{return Promise.resolve(p.execute(y,_))}catch(b){return Promise.reject(b)}},g={ready:Promise.resolve(),setVariable:(y,_)=>f("setVariable",[y,_]),setVariables:y=>f("setVariables",[y]),getVariable:y=>f("getVariable",[y]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:y=>f("findObjectByName",[y]),findObjectById:y=>f("findObjectById",[y]),getGeometry:(y,_)=>f("getGeometry",[y,_??{}]),updateObject:(y,_)=>f("updateObject",[y,_]),createObject:(y,_)=>f("createObject",[y,_??{}]),createCustomMaterial:y=>f("createCustomMaterial",[y]),getTexture:(y,_)=>f("getTexture",[y,_??{}]),setMaterial:(y,_)=>f("setMaterial",[y,_]),cloneObject:(y,_)=>f("cloneObject",[y,_??{}]),removeObject:y=>f("removeObject",[y]),spawnObject:(y,_)=>f("spawnObject",[y,_??{}]),destroyObject:y=>f("destroyObject",[y]),setInstanceTransforms:(y,_)=>f("setInstanceTransforms",[y,_??null]),getAnimations:y=>f("getAnimations",[y]),playAnimation:(y,_,b)=>f("playAnimation",[y,_,b]),pauseAnimation:(y,_)=>f("pauseAnimation",[y,_]),stopAnimation:(y,_)=>f("stopAnimation",[y,_]),emitEvent:(y,_)=>f("emitEvent",[y,_]),emitEventReverse:(y,_)=>f("emitEventReverse",[y,_]),requestRender:()=>f("requestRender",[]),addEventListener:(y,_)=>{if(typeof _!="function")return;let b=u.get(y);b||(b=new Set,u.set(y,b),f("listenEvent",[y])),b.add(_)},removeEventListener:(y,_)=>{let b=u.get(y);!b||(b.delete(_),b.size===0&&(u.delete(y),f("unlistenEvent",[y])))}},m=window.spline;window.spline=g;let v=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let y=[],_=(x,w)=>{let S=new Set,E=x.addEventListener.bind(x),A=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(P,C,R)=>{if(E(P,C,R),!w.includes(P)||C==null)return;let O={type:P,listener:C};S.add(O),queueMicrotask(()=>{!S.delete(O)||((D,F,V)=>{let U=new Event(V);try{typeof F=="function"?F.call(D,U):F.handleEvent?.(U)}catch(j){console.error(j)}})(x,O.listener,O.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(P,C,R)=>{A(P,C,R);for(let O of S)O.type===P&&O.listener===C&&S.delete(O)}}),y.push(()=>{delete x.addEventListener,delete x.removeEventListener,S.clear()})};_(document,["DOMContentLoaded"]),_(window,["load"]);let b=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:x=>{typeof x=="function"&&queueMicrotask(()=>{try{x.call(window,new Event("load"))}catch(w){console.error(w)}})}}),y.push(()=>{b?Object.defineProperty(window,"onload",b):delete window.onload}),()=>{for(let x of y)x()}}();for(let y of d){let _=document.createElement("script");for(let b of Array.from(y.attributes))_.setAttribute(b.name,b.value);y.src?_.async=!1:_.textContent=y.textContent,s.appendChild(_)}return new W7(s,p,l,g,m,v)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline===this.spline&&(window.spline=this.previousSplineGlobal)}};function q7(t){return typeof t=="object"&&t!==null&&t.isMaterial===!0}function qz(t){if(typeof t.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!q7(t.material))return{options:t};let e=t.material;if(e.isNodeMaterial===!0){let i=N8()?.NodeMaterial;if(i!==void 0&&e instanceof i)return{options:{...t,material:void 0},material:e};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(e.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...t,material:void 0},material:e}}Xt(),Ye(),J(),L8(),ba(),Ye(),Xt(),OZ(),Lh();var Xrt=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),Xz="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",$rt={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},Yrt={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Zrt={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},Krt={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},Qrt={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function c0(t,e){return t===void 0?[e[0],e[1],e[2]]:Array.isArray(t)?[t[0]??e[0],t[1]??e[1],t[2]??e[2]]:[t.x??e[0],t.y??e[1],t.z??e[2]]}function X7(t){return typeof t=="number"?[t,t,t]:c0(t,[1,1,1])}function ZC(t){let e=new _n(0,0,0,1);return e.setStyle(t),{r:e.r,g:e.g,b:e.b}}function $z(t,e){let i=t.material??(t.color!==void 0?{color:t.color}:void 0);if(i===void 0)return zi.defaultColorMaterial(Yz(Ir),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(e.shared.materials))if(a===i||o.name===i)return a;if(function(a){let o=a.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||Jt.NAMES[o]!==void 0}(i))return zi.defaultColorMaterial(ZC(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(a){let o=Object.entries(a.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(e)}) and is not a valid CSS color.`)}if(typeof i=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(q7(i))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=i.color!==void 0?ZC(i.color):Yz(Ir),r=zi.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(a=>a.data.type==="light");if(s){let a={};i.roughness!==void 0&&(a.roughness=i.roughness),i.metalness!==void 0&&(a.metalness=i.metalness),i.reflectivity!==void 0&&(a.reflectivity=i.reflectivity),Object.assign(s.data,a)}if(i.alpha!==void 0){let a=r.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return r}function Yz(t){return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255}}function Jrt(t){let e=Qo.defaultData("TextGeometry"),{text:i,...n}=t,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=350*r/16),r!==void 0&&n.height===void 0&&(n.height=50*r/16),Object.assign(e,n),i!==void 0&&Object.assign(e,{text:{textValue:String(i)}}),e}function g1(t){return Array.isArray(t)?t:!ArrayBuffer.isView(t)||t instanceof DataView?null:Array.from(t)}function tst(t,e){return o6({userData:{type:t,...UT[t].normalizeInputs({parameters:e})}})}function est(t,e,i){let{objectType:n,geometryType:r}=t,s=function(l){let c={};for(let[h,d]of Object.entries(l))!Xrt.has(h)&&d!==void 0&&(c[h]=d);return c}(e),a={states:new Nt,events:new Nt};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=function(h){let d=g1(h.vertices);if(!d||d.length<9||d.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let u=d.length/3;if(u>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${u}); keep it under 60000.`);let p=g1(h.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=u);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${u} vertices).`)}else p=null;let f=new jt;f.setAttribute("position",new kt(d,3));let g=g1(h.normals),m=g!==null&&g.length===d.length;m&&f.setAttribute("normal",new kt(g,3));let v=g1(h.uvs);v&&v.length===2*u&&f.setAttribute("uv",new kt(v,2));let y=!1;if(!m){let _=p??Array.from({length:u},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let E=w.length/3,A=new Map,P=new Array(E);for(let D=0;D<E;D++){let F=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,V=A.get(F);V===void 0?(A.set(F,D),P[D]=D):P[D]=V}let C=new Map;for(let D=0;D+2<S.length;D+=3){let F=P[S[D]],V=P[S[D+1]],U=P[S[D+2]];for(let[j,q]of[[F,V],[V,U],[U,F]]){if(j===q)continue;let rt=j<q?j+"_"+q:q+"_"+j;C.set(rt,(C.get(rt)??0)+1)}}let R=C.size>0;for(let D of C.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let O=0;for(let D=0;D+2<S.length;D+=3){let F=3*S[D],V=3*S[D+1],U=3*S[D+2],j=w[F],q=w[F+1],rt=w[F+2],it=w[V],Y=w[V+1],ht=w[V+2],ot=w[U],ft=w[U+1],pt=w[U+2];O+=j*(Y*pt-ht*ft)+q*(ht*ot-it*pt)+rt*(it*ft-Y*ot)}return{closed:!0,inverted:O<0}}(d,_);if(b&&x){for(let w=0;w+2<_.length;w+=3){let S=_[w+1];_[w+1]=_[w+2],_[w+2]=S}p=_}else b||(y=!0)}return p&&f.setIndex(p),m||f.computeVertexNormals(),{geometry:o6({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:y}}(s);Object.assign(a,Xa.defaultData,{geometry:l,materials:[$z(e,i)]}),c&&(a.side=2)}else Object.assign(a,Xa.defaultData,{geometry:r==="TextGeometry"?Jrt(s):tst(r,s),material:$z(e,i)});e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow)}else n==="Empty"?Object.assign(a,Sb.defaultData):(Object.assign(a,Mb.defaultData(n),s),e.color!==void 0&&(a.color=ZC(e.color)));a.visible=e.visible??!0,a.position=c0(e.position,[0,0,0]),a.rotation=c0(e.rotation,[0,0,0]),a.scale=X7(e.scale);let o=(r&&Krt[r])??Qrt[n]??n;return a.name=e.name??$7(o,i.scene.objects),a}function $7(t,e){let i=new Set;if(e.traverse((r,s)=>{i.add(s.name??"")}),!i.has(t))return t;let n=2;for(;i.has(`${t} ${n}`);)n++;return`${t} ${n}`}function Y7(t,e){let i=Pt.generateUUID();if(t.data.type==="Component")return{data:{...al.fromComponentData(t),name:t.data.name+" Instance"},id:i,fi:t.fi,children:[]};e[t.id]=i;let n=t.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:dZ(n.animations,Pt.generateUUID,e)}),{...t,id:i,data:n,children:t.children.map(r=>Y7(r,e))}}function ist(t){let e={};return function(i,n){return Ju(i,n,null)??i}(Y7(t,e),e)}function nst(t){let e=Array.isArray(t)?t[0]:t,i=e.layers?.map(rst)??[],n=e.layers?.find(r=>r.type==="light");return{layers:i,alpha:n?.node.alphaOverride?.value??1}}function rst(t){return t.type==="texture"||t.type==="video"||t.type==="matcap"?{...t.data,updateTexture:e=>t.color.texture.image.updateSrc(e)}:{...t.data}}Lh(),Oi(),$3(),ba();var Tm=new _n(0,0,0,1),sst={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};Xt(),Xt();var ast=new et;function Zz(t){let e=new _n(0,0,0,1);try{e.setStyle(t)}catch(i){console.error(i)}return e}var Z7=class{constructor(t,{renderOnDemand:e,renderMode:i="auto",wasmPath:n,renderer:r,htmlContentMode:s="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._startOrder=0,this._claimedOrder=0,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=a=>{if(this.time=a,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<h6?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),ed(o)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&o.warnClassicFallbackOnce(),o.isSimulating&&(o.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let o=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=o,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=a=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=ast.set(this._viewportWidth,this._viewportHeight)),a){let o=this._viewportWidth,l=this._viewportHeight;this._renderer.setSize(o-1,l-1,!1),this._renderer.setSize(o,l,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=Qg(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=t,this._htmlContentMode=s,this.renderMode=e?"auto":i,n!==void 0&&(this._wasmPath=function(a){let o=a.length;for(;o>0&&"/".includes(a[o-1]);)o--;return a.slice(0,o)}(n)),this._rendererBackend=r??"webgl",r===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(EQ(),VV)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",YO,!0),a.addEventListener("pointerdown",Dv,!0),a.addEventListener("pointermove",Dv,!0),a.addEventListener("pointerup",Vd,!0),a.addEventListener("pointercancel",Vd,!0),a.addEventListener("pointerleave",Vd,!0),window.addEventListener("keydown",ZO,!0),window.addEventListener("keyup",KO,!0)}(t)}async _ensureRenderer(){return this._renderer?this._renderer:(this._rendererInit||(this._rendererInit=this._initRenderer().then(t=>(this._rendererInit=void 0,t&&(this._renderer=t),t),t=>{throw this._rendererInit=void 0,t})),this._rendererInit)}async _initRenderer(){if(this.disposed)return null;let t=await this._createRenderer();return this.disposed?(this._disposeRenderer(t),null):t}_disposeRenderer(t){let e=function(n){let r=n.backend;if(r!==void 0)return r.isWebGLBackend===!0?r.gl??null:null;let s=n.getContext,a=typeof s=="function"?s.call(n):null;return a&&typeof a.getExtension=="function"?a:null}(t);if(e&&!function(n,r){return Hz.get(n)===r}(this.canvas,this))return void(function(n){return n.backend?.isWebGLBackend===!0}(t)||t.dispose());let i=e?function(n,r){let s=r.getExtension("WEBGL_lose_context");if(!s||r.isContextLost())return()=>{};let a=()=>{},o=new Promise(l=>{a=Wz(n,"webglcontextlost",c=>{c.preventDefault(),l(s)})});return p1.set(n,{gl:r,lost:o,stopListening:a}),()=>{r.isContextLost()||s.loseContext()}}(this.canvas,e):void 0;try{t.dispose()}finally{i?.()}}async _createRenderer(){(function(t,e){Hz.set(t,e)})(this.canvas,this),await async function(t){let e=p1.get(t);if(e&&(e.restoring??(e.restoring=async function(i,n){if(!n.gl.isContextLost())return void n.stopListening();let r,s=()=>{},a=n.lost.then(l=>new Promise(c=>{s=Wz(i,"webglcontextrestored",()=>c()),l.restoreContext()})),o=new Promise(l=>{r=setTimeout(l,2e3)});await Promise.race([a,o]),clearTimeout(r),s(),n.stopListening()}(t,e).finally(()=>{e.restoring=void 0,!e.gl.isContextLost()&&p1.get(t)===e&&p1.delete(t)})),await e.restoring,e.gl.isContextLost()))throw new Error("[spline] The browser did not restore the WebGL context this canvas had before dispose(); the scene cannot render on it. Use a new canvas.")}(this.canvas),this._rendererBackend,this._rendererBackend;{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>(_B(),mC));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_asyncShaderCompilation(){let t=this._data?.scene.publish?.asyncShaderCompilation!==!1;try{let e=new URLSearchParams(window.location.search);if(e.get("forcegl")==="1")return!1;let i=e.get("asynccomp");i==="off"||i==="0"||i==="false"||i==="no"?t=!1:(i==="on"||i==="1"||i==="true"||i==="always")&&(t=!0)}catch{}return t}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=i*t;let n=this.canvas.getContext("2d");n&&(n.scale(t,t),n.fillStyle="rgba(127, 127, 127, 0.85)",n.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",n.textAlign="center",n.textBaseline="middle",n.fillText("This scene requires a WebGPU-capable browser.",e/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,i){(function(r){let s="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";r.endsWith(".spline")?console.warn(s+" The .spline files are only meant to be used by the Editor."):r.endsWith(".splinecode")||console.warn(s)})(t),this.disposed=!1;let n=await(await fetch(t,i)).arrayBuffer();await this.start(n,{variables:e})}async start(t,e={}){if(this.disposed)return;let i,n=++this._startOrder,r=()=>this._claimedOrder>n;return i=this._start(t,e,r,()=>!r()&&(this._claimedOrder=n,this._claimedStart=i,!0)).then(()=>r()?this._claimedStart:void 0,s=>{if(!r())throw s;return this._claimedStart}),i}async _start(t,{interactive:e=!0,variables:i},n,r){rn.init();let s=await async function(g){let[m,v]=jm(Jg.deserialize(new Uint8Array(g)));if((m.schema??0)!==135){let{updateDocumentSchema:y}=await Promise.resolve().then(()=>(Rx(),Yk));y(m)}return v.result().data}(t);if(n())return;let a=function(g){let m=[];return g.scene.objects.traverse((v,y)=>{y.type==="Mesh"&&y.geometry.type==="NonParametricGeometry"&&y.geometry.data.draco!==void 0&&m.push(y)}),m}(s);s.version&&(0,Hrt.default)(s.version,"2.0.157")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),function(g){bV=g}(this._wasmPath));let o=async function(){}();if(await Promise.all([o,a.length&&jz(this._wasmPath),o5(s)&&kZ(this._wasmPath),lK(s)&&oK(this._wasmPath),EK(s)&&mK(this._wasmPath),td.physicsEnabled(s.scene.objects)&&iit(this._wasmPath),aL(s)&&SU(),y5(s)&&qK(),ZZ(s)&&YZ(),mU(s)&&o.then(()=>cT()?.loadHanaUIRUNTIME()),Yet(s)&&_it(this._wasmPath)].filter(Boolean)),n()||a.length&&(await Gz(a),n())||!r())return;this._data=s,this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let l=s.scene.publish.renderer;if(this._rendererAuto&&l==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&l==="webgpu")return n()?void 0:void this._failWebGPURequired();let c=function(g){let m=new Set;return g.scene.objects.traverse((v,y)=>{if(y.type!=="Page")return;let _=y.postprocessing;if(_&&typeof _=="object"&&_.enabled===!0)for(let[b,x]of Object.entries(_))b!=="enabled"&&x&&typeof x=="object"&&x.enabled===!0&&m.add(b)}),[...m]}(s);if(this._rendererBackend,this._rendererBackend!=="webgpu"&&(await Promise.all([Promise.resolve().then(()=>(_B(),mC)),Grt(c)]),n()))return;(function(g){Gx=g})((this._rendererBackend,"webgl"));let h=new krt(s,{},!0,{dedupeParametricGeometries:!0});if(h.resetPersonalCameraFromDocumentData(),this._scene=h.scene,this._sharedAssetsManager=h.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:g}=await Promise.resolve().then(()=>(att(),A9));if(n())return;let m=performance.now();g(s,h.scene);let v=performance.now();console.log("Merged geometries in ",v-m," ms")}o5(s)&&this._scene.traverse(g=>{ro(g)&&g.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(g=>{oh(g)&&g.pendingMediaLoad&&g.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(g=>{g.type==="ParticleSystem"&&(g.wakeUp(),g.data.autoPlay?g.start():g.stop()),ed(g)&&g.setPlayMode(!0)});let d=Object.keys(s.shared.fonts).flatMap(g=>{let m=this._sharedAssetsManager.getFont(g);return m?[m.loadingPromise]:[]});if(Promise.all(d).then(()=>{this.disposed||(h.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),aL(s)&&function(g){if(td.physicsEnabled(g.scene.objects))return!0;let m=!1;return g.scene.objects.traverse((v,y)=>{if(y.events){if(Array.isArray(y.events)){for(let _ of y.events)if(_.data.disabled!==!0&&_.data.type==="GameControl"&&_.data.collisionEnabled){m=!0;break}}else for(let _ of Object.values(y.events))if(_.disabled!==!0&&_.type==="GameControl"&&_.collisionEnabled){m=!0;break}}}),m}(s)&&(await Promise.all(d),n()))return;if(mU(s)){let g=[];if(this._scene.traverseEntity(m=>{(Pr(m)||m instanceof Si)&&m.uiCanvas&&g.push(m.uiCanvas)}),await Promise.all(g.map(m=>m.promise)),n())return}this._scene.rewriteEventsBeforeGoToPlayMode(),ZP(this._scene.activePage,this._sharedAssetsManager);let u=await this._ensureRenderer();if(n()||!u)return;if(this._rendererConfigured||(this._rendererConfigured=!0,u.pipeline.enableUIOverlay(),u.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode)),u.hdTransmission=s.scene.publish.hdTransmission===!0,u.setPixelRatio(this._getPixelRatio(/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?s.scene.publish.settings.web.pixelRatioMobile:s.scene.publish.settings.web.pixelRatioDesktop)),u.setAsyncCompilationPolicy?.(this._asyncShaderCompilation()),s.shared.images.SplineWatermark){let g=this._sharedAssetsManager.getImage("SplineWatermark");if(await g.loadPromise,n())return;let m=g.getTexture(1001);u.pipeline.setWatermark(m)}else u.pipeline.setWatermark(null);y5(s)&&this._scene.initializeSplatViewer(),s.scene.blueNoiseTextureData!==void 0&&u.pipeline.updateBlueNoiseTexture(s.scene.blueNoiseTextureData);let p=Object.values(s.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(p.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=p.size[0],this._viewportHeight=p.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),u.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new Vtt(u,this._camera,new et(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(p.allowResponsive??!1)&&p.preset==="fullscreen"),e){let g=new btt(u,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,p);this._scene.updateMatrixWorld(!0),this._controls=new oit(g),this._animationControls=new Rrt(this._scene,this._requestRenderAutoMode),this._eventManager=new Btt(s.scene.publish,this._controls,this._animationControls,g,s.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),i!==void 0&&this.setVariables(i),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),e&&(this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0);let f=s.scene.publish.htmlContent?.html;if(e&&f&&this._htmlContentMode!=="none"){let g={shared:this._sharedAssetsManager,findEntity:m=>this._scene?.getObjectByProperty("uuid",m)??this._scene?.getObjectByName(m),getAnimationControls:()=>this._animationControls};this._htmlContentOverlay=(this._htmlContentMode==="inline"?W7.mount(this,this.canvas,f,g):H7.mount(this,this.canvas,f,g))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[i,n]of e)this.setVariable(i,n)}}setVariable(t,e){let i=this._getVariableByName(t);if(i&&!("dynamicVariableType"in i.data)){if(e==null)return void console.warn(`Variable ${t} was not updated: received ${e}. Pass a number, boolean or string.`);let n=e;if(typeof i.data.value=="number"){if(n=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e),!Number.isFinite(n))return void console.warn(`Variable ${t} is a number variable and ${JSON.stringify(e)} cannot be converted to a number. The variable was not updated.`)}else typeof i.data.value=="boolean"?n=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()!=="false"&&!!e:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(n=e.toString());let r=typeof n=="string"?{textValue:n}:n;this._sharedAssetsManager?.updateVariable(i.id,r),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let i=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(i)}}_getVariableValue(t){return typeof t!="string"&&_r.isTextValue(t)?_r.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(i=>i.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(!(e.uuid===od||this._scene.isInvisibleObjects(e)||e instanceof Si)){let i=this._createProxyObject(e);i&&t.push(i)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof j9&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=Zz(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._claimedOrder=++this._startOrder,this._claimedStart=void 0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,Cg&&Cg.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{TM.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer&&this._disposeRenderer(this._renderer),this._renderer=void 0,this._rendererConfigured=!1,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(t){t.removeEventListener("pointerdown",YO,!0),t.removeEventListener("pointerdown",Dv,!0),t.removeEventListener("pointermove",Dv,!0),t.removeEventListener("pointerup",Vd,!0),t.removeEventListener("pointercancel",Vd,!0),t.removeEventListener("pointerleave",Vd,!0),window.removeEventListener("keydown",ZO,!0),window.removeEventListener("keyup",KO,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),rn.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e,i=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);t.traverseAncestors(h=>{h instanceof Si&&(e=h.name)});let n=this._sharedAssetsManager,r={shared:n,scene:this._scene},s=h=>{if(h===null||h==="Base State")return null;if(h&&t.data.states){let d=t.data.states.find(u=>u.data.name===h);return d?d.id:void 0}},a="material"in t?t.material:void 0,o=t.materialOverride,l={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:e,material:o??(a?nst(a):void 0),parentUuid:t.parent instanceof Si||t instanceof Zx?void 0:t.parent?.uuid,emitEvent(h){t.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){t.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){t.visible&&(t.visible=!1,r.shared.requestRender())},show(){t.visible||(t.visible=!0,r.shared.requestRender())},get state(){let h=t.stateSelection;if(h!==null)return t.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let u=typeof h=="string"?t.data.states.find(({id:p})=>p===h):t.data.states[h];if(u)d=u.id;else{let p=typeof h=="string"?s(h):void 0;p&&(d=p)}}t.changeSelectedState(d??null,r),t.currentState=d??null,t.dispatchEvent({type:"completeState",state:d??null}),r.shared.requestRender()},transition(h){let d=j7;if(d===null)return jn("transitions","obj.transition()"),{transition(b){return this},play(){return this},pause(){return this},reset(){return this},seek(b){return this}};let u,p,f=this,g=[],m=!1,v=()=>{p=new A7({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},g.map(b=>b.runner))},y={update(b){p?.update(b),p?.isPlaying!==!0&&rn.remove(y)}},_={transition({from:b,to:x,duration:w,delay:S,...E}){let A=s(b);A===void 0&&(A=u);let P=s(x);return u=P,g.push(new d(t,A,P,{state:P,repeat:0,delay:S??0,delayDirection:"start-once",direction:"normal",duration:w??1e3,...E,...E.easing===6?rh.defaultData:E.easing===5?bp.defaultData:{}},n,!1,i.activePage,{onBegin:()=>{(b&&A||b==="Base State"&&!A)&&(f.state=A??void 0)},onComplete:()=>{f.state=P??void 0}})),v(),this},play(){return p?(m=!0,p.play(rn.time),p.isPlaying&&rn.add(y),this):this},pause(){return p?.stop(),rn.remove(y),this},reset(){return this.pause(),m=!1,v(),p?.seek(0),this},seek(b){let x=g.reduce((w,S)=>w+S.runner.duration,0);return x>0&&p?.seek(b/1e3/x),this}};return _.transition(h),(h.autoPlay??!0)&&queueMicrotask(()=>{m||_.play()}),_},set color(h){let d=Zz(h);if(Gb.is(t))return void(t.color=d);if(!(t.type==="Mesh"&&"material"in t&&t instanceof qr))return;let u={r:d.r,g:d.g,b:d.b,a:d.a},p=t.materialOverride;if(p!==void 0){let m=p.color;return void(m?.isColor===!0&&typeof m.setStyle=="function"&&(m.setStyle(h),r.shared.requestRender()))}let f=Array.isArray(t.material)?t.material[0]:t.material,g=f.data.layers.find(m=>m.data.type==="color")?.id;if(g)f.updateByOp({type:0,path:["layers",g],props:{color:{...u}}},f.data,r);else{let m=f.data,v=m.layers.find(S=>S.data.type==="light");if(!v)return;let y=m.layers.indexOf(v)===0?v:null,_=m.layers.at(y?m.layers.indexOf(y)+1:0),b={type:4,fi:y?y.fi+(_?(_.fi-y.fi)/2:1):_?_.fi/2:1,id:Pt.generateUUID(),data:{...Xi.defaultData("color"),color:u},localIndex:0},x=m.layers.insertAfterHelper(y?.id??null,1),w=m.layers.runOp({...b,fi:x[0]}).data;Object.assign(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,r)}}},c=TM(l,(h,d)=>{let u=t[h],p=function(f){return f.split(".")}(h);p[0]==="material"&&a&&o===void 0&&function(f,g,m){let v=Array.isArray(m)?m[0]:m;if(f[0]==="layers"){let y=parseInt(f[1]),_=v.layers[y],b=f[2];_&&b&&function(x,w,S){let E=x[0];try{if(function(A,P){return!!sst[P]?.includes(A)}(E,S.type,x.slice(1)))if(E==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let A=parseInt(x[1]),P=S.getValue(E)?.[A];if(!P)throw new Error("Color index out of range");Tm.setStyle(w),P.set(Tm.r,Tm.g,Tm.b,Tm.a)}else S.getValue(E)?.setStyle(w);else if(E==="texture"||E==="video"){let A=S.color;(function(P,C,R,O){let D=P[0];if(D==="repeat"||D==="offset"||D==="rotation"){let F=O.getNode("mat"),V=F&&typeof F.updateMatrix=="function"?F:O.getValue("mat");if(!V)return;if(D==="rotation")V.rotation=parseFloat(C);else{let U=P[1];if(U===void 0)C instanceof Array&&C.length===2&&Object.assign(V,{[D]:C});else{let j=V[D],q=parseInt(U)===0?[parseFloat(C),j[1]]:[j[0],parseFloat(C)];Object.assign(V,{[D]:q})}}V.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=C:R.texture[D]=C:D==="image"&&P[1]==="data"&&R.texture.image.updateSrc(C)})(x.slice(1),w,A,S)}else{let A=x[1],P=S.getValue(E);P?.isVector3&&A!==void 0||P?.isVector2&&A!==void 0?P.setComponent(parseInt(A),w):S.setValue(E,w)}}catch(A){console.error("Error setting material value",A)}}(f.slice(2),g,_)}else f[0]==="alpha"&&v.layers.forEach(y=>{y.type==="light"&&y.node.alphaOverride!==void 0&&(y.node.alphaOverride.value=g,g<1&&(v.transparent=!0))})}(p.slice(1),d,a),typeof u!="object"&&Object.getOwnPropertyDescriptor(t,h)?.writable&&(t[h]=d),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,c),c}setUIWasmUrl(t){(function(e){Rb=e,Lx?.setHanaUIWasmUrl(e)})(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let i;if(typeof e=="string"){if(!e.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(e)).arrayBuffer();i=new Uint8Array(l)}}else i=e;let n=Jg.deserialize(i),r="data"in n&&n.data.draco!==void 0;r&&await jz(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!s)return void console.warn(`Object ${t} not found`);if(s.data.type!=="Mesh"||!(s instanceof qr))return void console.warn(`Object ${t} is not a mesh`);let a=s,o={...a.data,geometry:n};r&&await Gz([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of a.data.states){let c={...l.data};a.states||(a.states={}),a.states[l.id]=ah.patch(o,c)}return i}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let i=e.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,i=this._findEntity(e);if(!i)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=N8();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let i=t(e);if(typeof i!="object"||i===null||i.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return i}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let i=this._scene;if(!i)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let n=typeof t=="string"?t:t.uuid,r=this._findEntity(n);if(!r)throw new Error(`setMaterial: '${n}' \u2014 no object with that name or uuid in the scene.`);if(!(r instanceof qr))throw new Error(`setMaterial: '${n}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let s=typeof e=="function"?await this.createCustomMaterial(e):e;if(kb()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=qz({material:s});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return r.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(r.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let r=function(m){if(typeof m!="string"||m.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${Xz}.`);let v=m.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),y=Yrt[v];if(y)return{objectType:y};let _=$rt[v];if(_)return{objectType:"Mesh",geometryType:_};let b=Zrt[v];throw b?new Error(`createObject: '${m}' is not supported \u2014 ${b}`):new Error(`createObject: '${m}' is not a creatable Spline type \u2014 use one of ${Xz}, e.g. createObject('Cube', { width: 200 }).`)}(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let s,a,{options:o,material:l}=qz(e);if(l!==void 0){if(r.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(kb()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if(r.geometryType==="TextGeometry"){if(!N3.has("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await SU(),a=e.font??Ou,n.shared.fonts[a]===void 0){if(a!==Ou){let m=Object.keys(n.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${m||"(none)"}.`)}s={name:Ou,url:rk}}}let c=this._resolveParentId(e.parent),h=est(r,o,n),d=Pt.generateUUID(),[u,p]=jm(n);s&&(u.shared.fonts[Ou]=s),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let f=p.result();if(s&&this._sharedAssetsManager.addFont(Ou,s),a!==void 0){let m=this._sharedAssetsManager.getFont(a);m&&await m.loadingPromise}this._applyDocumentTransaction(f);let g=i.find(d);return l!==void 0&&g.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(g)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)throw new Error(`cloneObject: '${r}' \u2014 no object with that name or uuid in the scene.`);if(s instanceof Si)throw new Error("cloneObject: pages cannot be cloned.");let a=n.scene.objects.get(s.uuid);if(!a)throw new Error(`cloneObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let o=function(p,f,g){let m={...p.data};return f.position!==void 0&&(m.position=c0(f.position,[0,0,0])),f.rotation!==void 0&&(m.rotation=c0(f.rotation,[0,0,0])),f.scale!==void 0&&(m.scale=X7(f.scale)),f.visible!==void 0&&(m.visible=f.visible),m.name=f.name??$7(`${p.data.name??"Object"} Copy`,g),{...p,data:m}}(ist(a),e,n.scene.objects),l=e.parent!==void 0?this._resolveParentId(e.parent):n.scene.objects.parent(s.uuid)??null,c=e.parent!==void 0?null:s.uuid,[h,d]=jm(n);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(t){let e=this._scene,i=this._data;if(this.disposed||!e||!i)return!1;let n=typeof t=="string"?t:t?.uuid,r=n?this._findEntity(n):void 0;if(!r)return!1;if(r instanceof Si)throw new Error("removeObject: pages cannot be removed.");if(r.data.type==="PerspectiveCamera"||r.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(r.uuid)===void 0)throw new Error(`removeObject: '${n}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let s=[];r.traverseEntity(l=>{s.push(l.uuid)});let[a,o]=jm(i);a.scene.objects.delete(r.uuid),this._applyDocumentTransaction(o.result());for(let l of s){let c=this._proxyObjectCache.get(l);c&&(TM.unsubscribe(c),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var sw=window,aw=sw.ShadowRoot&&(sw.ShadyCSS===void 0||sw.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,KP=Symbol(),K7=new WeakMap,R0=class{constructor(e,i,n){if(this._$cssResult$=!0,n!==KP)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o,i=this.t;if(aw&&e===void 0){let n=i!==void 0&&i.length===1;n&&(e=K7.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&K7.set(i,e))}return e}toString(){return this.cssText}},Q7=t=>new R0(typeof t=="string"?t:t+"",void 0,KP),QP=(t,...e)=>{let i=t.length===1?t[0]:e.reduce((n,r,s)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[s+1],t[0]);return new R0(i,t,KP)},JP=(t,e)=>{aw?t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):e.forEach(i=>{let n=document.createElement("style"),r=sw.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=i.cssText,t.appendChild(n)})},ow=aw?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let n of e.cssRules)i+=n.cssText;return Q7(i)})(t):t;var tD,lw=window,J7=lw.trustedTypes,ost=J7?J7.emptyScript:"",tG=lw.reactiveElementPolyfillSupport,iD={toAttribute(t,e){switch(e){case Boolean:t=t?ost:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},eG=(t,e)=>e!==t&&(e==e||t==t),eD={attribute:!0,type:String,converter:iD,reflect:!1,hasChanged:eG},nD="finalized",yl=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((i,n)=>{let r=this._$Ep(n,i);r!==void 0&&(this._$Ev.set(r,n),e.push(r))}),e}static createProperty(e,i=eD){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(e,i),!i.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,r=this.getPropertyDescriptor(e,n,i);r!==void 0&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,i,n){return{get(){return this[i]},set(r){let s=this[e];this[i]=r,this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||eD}static finalize(){if(this.hasOwnProperty(nD))return!1;this[nD]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,n=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let r of n)this.createProperty(r,i[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let i=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)i.unshift(ow(r))}else e!==void 0&&i.push(ow(e));return i}static _$Ep(e,i){let n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(i=>i(this))}addController(e){var i,n;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var e;let i=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return JP(i,this.constructor.elementStyles),i}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostConnected)===null||n===void 0?void 0:n.call(i)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostDisconnected)===null||n===void 0?void 0:n.call(i)})}attributeChangedCallback(e,i,n){this._$AK(e,n)}_$EO(e,i,n=eD){var r;let s=this.constructor._$Ep(e,n);if(s!==void 0&&n.reflect===!0){let a=(((r=n.converter)===null||r===void 0?void 0:r.toAttribute)!==void 0?n.converter:iD).toAttribute(i,n.type);this._$El=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(e,i){var n;let r=this.constructor,s=r._$Ev.get(e);if(s!==void 0&&this._$El!==s){let a=r.getPropertyOptions(s),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((n=a.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?a.converter:iD;this._$El=s,this[s]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(e,i,n){let r=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||eG)(this[e],i)?(this._$AL.has(e)||this._$AL.set(e,i),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((r,s)=>this[s]=r),this._$Ei=void 0);let i=!1,n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var s;return(s=r.hostUpdate)===null||s===void 0?void 0:s.call(r)}),this.update(n)):this._$Ek()}catch(r){throw i=!1,this._$Ek(),r}i&&this._$AE(n)}willUpdate(e){}_$AE(e){var i;(i=this._$ES)===null||i===void 0||i.forEach(n=>{var r;return(r=n.hostUpdated)===null||r===void 0?void 0:r.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((i,n)=>this._$EO(n,this[n],i)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};yl[nD]=!0,yl.elementProperties=new Map,yl.elementStyles=[],yl.shadowRootOptions={mode:"open"},tG?.({ReactiveElement:yl}),((tD=lw.reactiveElementVersions)!==null&&tD!==void 0?tD:lw.reactiveElementVersions=[]).push("1.6.3");var rD,hw=window,jp=hw.trustedTypes,iG=jp?jp.createPolicy("lit-html",{createHTML:t=>t}):void 0,aD="$lit$",Fh=`lit$${(Math.random()+"").slice(9)}$`,hG="?"+Fh,lst=`<${hG}>`,fd=document,I0=()=>fd.createComment(""),L0=t=>t===null||typeof t!="object"&&typeof t!="function",cG=Array.isArray,hst=t=>cG(t)||typeof t?.[Symbol.iterator]=="function",sD=`[
|
|
9990
|
+
`,W7=class{constructor(t,e,i,n,r,s){this.container=t,this.host=e,this.observer=i,this.spline=n,this.previousSplineGlobal=r,this.removeLateLifecycleShim=s}static mount(t,e,i,n){if(typeof document>"u")return null;let r=e.parentElement;if(!r)return null;getComputedStyle(r).position==="static"&&(r.style.position="relative");let s=document.createElement("div");s.setAttribute(u_,"");let a=s.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${e.offsetLeft}px`,a.top=`${e.offsetTop}px`,a.width=`${e.offsetWidth}px`,a.height=`${e.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(e),l.observe(r);let c=document.createElement("style");c.textContent=qrt,s.appendChild(c);let h=new DOMParser().parseFromString(i,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let y of d)y.remove();for(let y of Array.from(h.head.children))(y.tagName==="STYLE"||y.tagName==="LINK"&&y.rel==="stylesheet")&&s.appendChild(y);for(;h.body.firstChild;)s.appendChild(h.body.firstChild);r.insertBefore(s,e.nextSibling),s.addEventListener("wheel",y=>{y.ctrlKey&&!y.defaultPrevented&&!e.dispatchEvent(new WheelEvent("wheel",y))&&y.preventDefault()},{passive:!1});let u=new Map,p=new m3(G7(t,e,n),(y,_)=>{y==="warn"?console.warn(`[spline html] ${_}`):y==="error"&&console.error(`[spline html] ${_}`)},(y,_)=>{let b=u.get(y);if(b)for(let x of b)try{x(_)}catch(w){console.error(w)}}),f=(y,_)=>{try{return Promise.resolve(p.execute(y,_))}catch(b){return Promise.reject(b)}},g={ready:Promise.resolve(),setVariable:(y,_)=>f("setVariable",[y,_]),setVariables:y=>f("setVariables",[y]),getVariable:y=>f("getVariable",[y]),getVariables:()=>f("getVariables",[]),getAllObjects:()=>f("getAllObjects",[]),findObjectByName:y=>f("findObjectByName",[y]),findObjectById:y=>f("findObjectById",[y]),getGeometry:(y,_)=>f("getGeometry",[y,_??{}]),updateObject:(y,_)=>f("updateObject",[y,_]),createObject:(y,_)=>f("createObject",[y,_??{}]),createCustomMaterial:y=>f("createCustomMaterial",[y]),getTexture:(y,_)=>f("getTexture",[y,_??{}]),setMaterial:(y,_)=>f("setMaterial",[y,_]),cloneObject:(y,_)=>f("cloneObject",[y,_??{}]),removeObject:y=>f("removeObject",[y]),spawnObject:(y,_)=>f("spawnObject",[y,_??{}]),destroyObject:y=>f("destroyObject",[y]),setInstanceTransforms:(y,_)=>f("setInstanceTransforms",[y,_??null]),getAnimations:y=>f("getAnimations",[y]),playAnimation:(y,_,b)=>f("playAnimation",[y,_,b]),pauseAnimation:(y,_)=>f("pauseAnimation",[y,_]),stopAnimation:(y,_)=>f("stopAnimation",[y,_]),emitEvent:(y,_)=>f("emitEvent",[y,_]),emitEventReverse:(y,_)=>f("emitEventReverse",[y,_]),requestRender:()=>f("requestRender",[]),addEventListener:(y,_)=>{if(typeof _!="function")return;let b=u.get(y);b||(b=new Set,u.set(y,b),f("listenEvent",[y])),b.add(_)},removeEventListener:(y,_)=>{let b=u.get(y);!b||(b.delete(_),b.size===0&&(u.delete(y),f("unlistenEvent",[y])))}},m=window.spline;window.spline=g;let v=function(){if(typeof document>"u"||document.readyState==="loading")return()=>{};let y=[],_=(x,w)=>{let S=new Set,E=x.addEventListener.bind(x),A=x.removeEventListener.bind(x);Object.defineProperty(x,"addEventListener",{configurable:!0,writable:!0,value:(P,C,R)=>{if(E(P,C,R),!w.includes(P)||C==null)return;let O={type:P,listener:C};S.add(O),queueMicrotask(()=>{!S.delete(O)||((D,F,V)=>{let U=new Event(V);try{typeof F=="function"?F.call(D,U):F.handleEvent?.(U)}catch(j){console.error(j)}})(x,O.listener,O.type)})}}),Object.defineProperty(x,"removeEventListener",{configurable:!0,writable:!0,value:(P,C,R)=>{A(P,C,R);for(let O of S)O.type===P&&O.listener===C&&S.delete(O)}}),y.push(()=>{delete x.addEventListener,delete x.removeEventListener,S.clear()})};_(document,["DOMContentLoaded"]),_(window,["load"]);let b=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:x=>{typeof x=="function"&&queueMicrotask(()=>{try{x.call(window,new Event("load"))}catch(w){console.error(w)}})}}),y.push(()=>{b?Object.defineProperty(window,"onload",b):delete window.onload}),()=>{for(let x of y)x()}}();for(let y of d){let _=document.createElement("script");for(let b of Array.from(y.attributes))_.setAttribute(b.name,b.value);y.src?_.async=!1:_.textContent=y.textContent,s.appendChild(_)}return new W7(s,p,l,g,m,v)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),window.spline===this.spline&&(window.spline=this.previousSplineGlobal)}};function q7(t){return typeof t=="object"&&t!==null&&t.isMaterial===!0}function qz(t){if(typeof t.material=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(!q7(t.material))return{options:t};let e=t.material;if(e.isNodeMaterial===!0){let i=N8()?.NodeMaterial;if(i!==void 0&&e instanceof i)return{options:{...t,material:void 0},material:e};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => \u2026) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, \u2026).")}if(e.isShaderMaterial===!0)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend \u2014 port the shader to TSL with app.createCustomMaterial((three) => \u2026), or use a built-in material (MeshStandardMaterial, \u2026).");return{options:{...t,material:void 0},material:e}}Xt(),Ye(),J(),L8(),ba(),Ye(),Xt(),OZ(),Lh();var Xrt=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),Xz="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",$rt={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},Yrt={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Zrt={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data \u2014 clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data \u2014 clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime \u2014 clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto \u2014 clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame \u2014 clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime \u2014 clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor \u2014 clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},Krt={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},Qrt={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function c0(t,e){return t===void 0?[e[0],e[1],e[2]]:Array.isArray(t)?[t[0]??e[0],t[1]??e[1],t[2]??e[2]]:[t.x??e[0],t.y??e[1],t.z??e[2]]}function X7(t){return typeof t=="number"?[t,t,t]:c0(t,[1,1,1])}function ZC(t){let e=new _n(0,0,0,1);return e.setStyle(t),{r:e.r,g:e.g,b:e.b}}function $z(t,e){let i=t.material??(t.color!==void 0?{color:t.color}:void 0);if(i===void 0)return zi.defaultColorMaterial(Yz(Ir),"physical","layer1","layer2");if(typeof i=="string"){for(let[a,o]of Object.entries(e.shared.materials))if(a===i||o.name===i)return a;if(function(a){let o=a.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)||/^(rgb|hsl)a?\(/.test(o)||Jt.NAMES[o]!==void 0}(i))return zi.defaultColorMaterial(ZC(i),"physical","layer1","layer2");throw new Error(`createObject: material '${i}' matches no shared material in this document (available: ${function(a){let o=Object.entries(a.shared.materials).map(([,l])=>`'${l.name}'`).filter(l=>l!=="'undefined'");return o.length?o.join(", "):"(none)"}(e)}) and is not a valid CSS color.`)}if(typeof i=="function")throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation \u2014 this entry point does not support it.");if(q7(i))throw new Error("createObject: a three.js material instance cannot be stored in the document \u2014 this entry point does not support it.");let n=i.color!==void 0?ZC(i.color):Yz(Ir),r=zi.defaultColorMaterial(n,"physical","layer1","layer2"),s=r.layers.find(a=>a.data.type==="light");if(s){let a={};i.roughness!==void 0&&(a.roughness=i.roughness),i.metalness!==void 0&&(a.metalness=i.metalness),i.reflectivity!==void 0&&(a.reflectivity=i.reflectivity),Object.assign(s.data,a)}if(i.alpha!==void 0){let a=r.layers.find(o=>o.data.type==="color");a&&Object.assign(a.data,{alpha:i.alpha})}return r}function Yz(t){return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255}}function Jrt(t){let e=Qo.defaultData("TextGeometry"),{text:i,...n}=t,r=n.fontSize;return r!==void 0&&n.width===void 0&&(n.width=350*r/16),r!==void 0&&n.height===void 0&&(n.height=50*r/16),Object.assign(e,n),i!==void 0&&Object.assign(e,{text:{textValue:String(i)}}),e}function g1(t){return Array.isArray(t)?t:!ArrayBuffer.isView(t)||t instanceof DataView?null:Array.from(t)}function tst(t,e){return o6({userData:{type:t,...UT[t].normalizeInputs({parameters:e})}})}function est(t,e,i){let{objectType:n,geometryType:r}=t,s=function(l){let c={};for(let[h,d]of Object.entries(l))!Xrt.has(h)&&d!==void 0&&(c[h]=d);return c}(e),a={states:new Nt,events:new Nt};if(n==="Mesh"&&r){if(r==="NonParametricGeometry"){let{geometry:l,doubleSide:c}=function(h){let d=g1(h.vertices);if(!d||d.length<9||d.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let u=d.length/3;if(u>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${u}); keep it under 60000.`);let p=g1(h.indices);if(p&&p.length){let _=p.find(b=>!Number.isInteger(b)||b<0||b>=u);if(_!==void 0)throw new Error(`createObject('CustomMesh'): index ${_} is out of range (mesh has ${u} vertices).`)}else p=null;let f=new jt;f.setAttribute("position",new kt(d,3));let g=g1(h.normals),m=g!==null&&g.length===d.length;m&&f.setAttribute("normal",new kt(g,3));let v=g1(h.uvs);v&&v.length===2*u&&f.setAttribute("uv",new kt(v,2));let y=!1;if(!m){let _=p??Array.from({length:u},(w,S)=>S),{closed:b,inverted:x}=function(w,S){let E=w.length/3,A=new Map,P=new Array(E);for(let D=0;D<E;D++){let F=`${Math.round(1e4*w[3*D])},${Math.round(1e4*w[3*D+1])},${Math.round(1e4*w[3*D+2])}`,V=A.get(F);V===void 0?(A.set(F,D),P[D]=D):P[D]=V}let C=new Map;for(let D=0;D+2<S.length;D+=3){let F=P[S[D]],V=P[S[D+1]],U=P[S[D+2]];for(let[j,q]of[[F,V],[V,U],[U,F]]){if(j===q)continue;let rt=j<q?j+"_"+q:q+"_"+j;C.set(rt,(C.get(rt)??0)+1)}}let R=C.size>0;for(let D of C.values())if(D!==2){R=!1;break}if(!R)return{closed:!1,inverted:!1};let O=0;for(let D=0;D+2<S.length;D+=3){let F=3*S[D],V=3*S[D+1],U=3*S[D+2],j=w[F],q=w[F+1],rt=w[F+2],it=w[V],Y=w[V+1],ht=w[V+2],ot=w[U],ft=w[U+1],pt=w[U+2];O+=j*(Y*pt-ht*ft)+q*(ht*ot-it*pt)+rt*(it*ft-Y*ot)}return{closed:!0,inverted:O<0}}(d,_);if(b&&x){for(let w=0;w+2<_.length;w+=3){let S=_[w+1];_[w+1]=_[w+2],_[w+2]=S}p=_}else b||(y=!0)}return p&&f.setIndex(p),m||f.computeVertexNormals(),{geometry:o6({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:f.toJSON().data}),doubleSide:y}}(s);Object.assign(a,Xa.defaultData,{geometry:l,materials:[$z(e,i)]}),c&&(a.side=2)}else Object.assign(a,Xa.defaultData,{geometry:r==="TextGeometry"?Jrt(s):tst(r,s),material:$z(e,i)});e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow)}else n==="Empty"?Object.assign(a,Sb.defaultData):(Object.assign(a,Mb.defaultData(n),s),e.color!==void 0&&(a.color=ZC(e.color)));a.visible=e.visible??!0,a.position=c0(e.position,[0,0,0]),a.rotation=c0(e.rotation,[0,0,0]),a.scale=X7(e.scale);let o=(r&&Krt[r])??Qrt[n]??n;return a.name=e.name??$7(o,i.scene.objects),a}function $7(t,e){let i=new Set;if(e.traverse((r,s)=>{i.add(s.name??"")}),!i.has(t))return t;let n=2;for(;i.has(`${t} ${n}`);)n++;return`${t} ${n}`}function Y7(t,e){let i=Pt.generateUUID();if(t.data.type==="Component")return{data:{...al.fromComponentData(t),name:t.data.name+" Instance"},id:i,fi:t.fi,children:[]};e[t.id]=i;let n=t.data;return n.type==="Empty"&&n.animations?.length&&(n={...n,animations:dZ(n.animations,Pt.generateUUID,e)}),{...t,id:i,data:n,children:t.children.map(r=>Y7(r,e))}}function ist(t){let e={};return function(i,n){return Ju(i,n,null)??i}(Y7(t,e),e)}function nst(t){let e=Array.isArray(t)?t[0]:t,i=e.layers?.map(rst)??[],n=e.layers?.find(r=>r.type==="light");return{layers:i,alpha:n?.node.alphaOverride?.value??1}}function rst(t){return t.type==="texture"||t.type==="video"||t.type==="matcap"?{...t.data,updateTexture:e=>t.color.texture.image.updateSrc(e)}:{...t.data}}Lh(),Oi(),$3(),ba();var Tm=new _n(0,0,0,1),sst={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]};Xt(),Xt();var ast=new et;function Zz(t){let e=new _n(0,0,0,1);try{e.setStyle(t)}catch(i){console.error(i)}return e}var Z7=class{constructor(t,{renderOnDemand:e,renderMode:i="auto",wasmPath:n,renderer:r,htmlContentMode:s="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._startOrder=0,this._claimedOrder=0,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=a=>{if(this.time=a,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<h6?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(o=>{o.type==="ParticleSystem"&&(o.update(this.dt),this._skipRender=!1),ed(o)&&(this._renderer?.isWebGPUSplineRenderer!==!0&&o.warnClassicFallbackOnce(),o.isSimulating&&(o.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let o=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=o,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),this._renderer.lastFrameIncomplete===!0&&(this._skipRender=!1),this._renderer.skyAnimationActive===!0&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=a=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=ast.set(this._viewportWidth,this._viewportHeight)),a){let o=this._viewportWidth,l=this._viewportHeight;this._renderer.setSize(o-1,l-1,!1),this._renderer.setSize(o,l,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera&&(this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=Qg(this._resize,10),this._onScroll=a=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=t,this._htmlContentMode=s,this.renderMode=e?"auto":i,n!==void 0&&(this._wasmPath=function(a){let o=a.length;for(;o>0&&"/".includes(a[o-1]);)o--;return a.slice(0,o)}(n)),this._rendererBackend=r??"webgl",r===void 0){let a=null;try{a=new URLSearchParams(window.location.search).get("renderer")}catch{}a==="webgpu"||a==="webgl"||a==="webgl2"?this._rendererBackend=a==="webgl2"?"webgl":a:(this._rendererAuto=!0,this._rendererBackend="webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&Promise.resolve().then(()=>(EQ(),VV)).then(({Perfs:a})=>{this._perfs=new a({x:10,y:10})}),function(a){a.addEventListener("pointerdown",YO,!0),a.addEventListener("pointerdown",Dv,!0),a.addEventListener("pointermove",Dv,!0),a.addEventListener("pointerup",Vd,!0),a.addEventListener("pointercancel",Vd,!0),a.addEventListener("pointerleave",Vd,!0),window.addEventListener("keydown",ZO,!0),window.addEventListener("keyup",KO,!0)}(t)}async _ensureRenderer(){return this._renderer?this._renderer:(this._rendererInit||(this._rendererInit=this._initRenderer().then(t=>(this._rendererInit=void 0,t&&(this._renderer=t),t),t=>{throw this._rendererInit=void 0,t})),this._rendererInit)}async _initRenderer(){if(this.disposed)return null;let t=await this._createRenderer();return this.disposed?(this._disposeRenderer(t),null):t}_disposeRenderer(t){let e=function(n){let r=n.backend;if(r!==void 0)return r.isWebGLBackend===!0?r.gl??null:null;let s=n.getContext,a=typeof s=="function"?s.call(n):null;return a&&typeof a.getExtension=="function"?a:null}(t);if(e&&!function(n,r){return Hz.get(n)===r}(this.canvas,this))return void(function(n){return n.backend?.isWebGLBackend===!0}(t)||t.dispose());let i=e?function(n,r){let s=r.getExtension("WEBGL_lose_context");if(!s||r.isContextLost())return()=>{};let a=()=>{},o=new Promise(l=>{a=Wz(n,"webglcontextlost",c=>{c.preventDefault(),l(s)})});return p1.set(n,{gl:r,lost:o,stopListening:a}),()=>{r.isContextLost()||s.loseContext()}}(this.canvas,e):void 0;try{t.dispose()}finally{i?.()}}async _createRenderer(){(function(t,e){Hz.set(t,e)})(this.canvas,this),await async function(t){let e=p1.get(t);if(e&&(e.restoring??(e.restoring=async function(i,n){if(!n.gl.isContextLost())return void n.stopListening();let r,s=()=>{},a=n.lost.then(l=>new Promise(c=>{s=Wz(i,"webglcontextrestored",()=>c()),l.restoreContext()})),o=new Promise(l=>{r=setTimeout(l,2e3)});await Promise.race([a,o]),clearTimeout(r),s(),n.stopListening()}(t,e).finally(()=>{e.restoring=void 0,!e.gl.isContextLost()&&p1.get(t)===e&&p1.delete(t)})),await e.restoring,e.gl.isContextLost()))throw new Error("[spline] The browser did not restore the WebGL context this canvas had before dispose(); the scene cannot render on it. Use a new canvas.")}(this.canvas),this._rendererBackend,this._rendererBackend;{let{SplineRenderer:t,rendererGlobals:e}=await Promise.resolve().then(()=>(_B(),mC));try{new URLSearchParams(window.location.search).get("taa")==="off"&&(e.taaEnabled.value=!1)}catch{}return new t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_asyncShaderCompilation(){let t=this._data?.scene.publish?.asyncShaderCompilation!==!1;try{let e=new URLSearchParams(window.location.search);if(e.get("forcegl")==="1")return!1;let i=e.get("asynccomp");i==="off"||i==="0"||i==="false"||i==="no"?t=!1:(i==="on"||i==="1"||i==="true"||i==="always")&&(t=!0)}catch{}return t}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let t=window.devicePixelRatio||1,e=this.canvas.clientWidth||300,i=this.canvas.clientHeight||150;this.canvas.width=e*t,this.canvas.height=i*t;let n=this.canvas.getContext("2d");n&&(n.scale(t,t),n.fillStyle="rgba(127, 127, 127, 0.85)",n.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",n.textAlign="center",n.textBaseline="middle",n.fillText("This scene requires a WebGPU-capable browser.",e/2,i/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(t,e,i){(function(r){let s="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";r.endsWith(".spline")?console.warn(s+" The .spline files are only meant to be used by the Editor."):r.endsWith(".splinecode")||console.warn(s)})(t),this.disposed=!1;let n=await(await fetch(t,i)).arrayBuffer();await this.start(n,{variables:e})}async start(t,e={}){if(this.disposed)return;let i,n=++this._startOrder,r=()=>this._claimedOrder>n;return i=this._start(t,e,r,()=>!r()&&(this._claimedOrder=n,this._claimedStart=i,!0)).then(()=>r()?this._claimedStart:void 0,s=>{if(!r())throw s;return this._claimedStart}),i}async _start(t,{interactive:e=!0,variables:i},n,r){rn.init();let s=await async function(g){let[m,v]=jm(Jg.deserialize(new Uint8Array(g)));if((m.schema??0)!==135){let{updateDocumentSchema:y}=await Promise.resolve().then(()=>(Rx(),Yk));y(m)}return v.result().data}(t);if(n())return;let a=function(g){let m=[];return g.scene.objects.traverse((v,y)=>{y.type==="Mesh"&&y.geometry.type==="NonParametricGeometry"&&y.geometry.data.draco!==void 0&&m.push(y)}),m}(s);s.version&&(0,Hrt.default)(s.version,"2.0.158")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),function(g){bV=g}(this._wasmPath));let o=async function(){}();if(await Promise.all([o,a.length&&jz(this._wasmPath),o5(s)&&kZ(this._wasmPath),lK(s)&&oK(this._wasmPath),EK(s)&&mK(this._wasmPath),td.physicsEnabled(s.scene.objects)&&iit(this._wasmPath),aL(s)&&SU(),y5(s)&&qK(),ZZ(s)&&YZ(),mU(s)&&o.then(()=>cT()?.loadHanaUIRUNTIME()),Yet(s)&&_it(this._wasmPath)].filter(Boolean)),n()||a.length&&(await Gz(a),n())||!r())return;this._data=s,this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let l=s.scene.publish.renderer;if(this._rendererAuto&&l==="webgl")this._rendererBackend="webgl";else if(this._rendererAuto&&l==="webgpu")return n()?void 0:void this._failWebGPURequired();let c=function(g){let m=new Set;return g.scene.objects.traverse((v,y)=>{if(y.type!=="Page")return;let _=y.postprocessing;if(_&&typeof _=="object"&&_.enabled===!0)for(let[b,x]of Object.entries(_))b!=="enabled"&&x&&typeof x=="object"&&x.enabled===!0&&m.add(b)}),[...m]}(s);if(this._rendererBackend,this._rendererBackend!=="webgpu"&&(await Promise.all([Promise.resolve().then(()=>(_B(),mC)),Grt(c)]),n()))return;(function(g){Gx=g})((this._rendererBackend,"webgl"));let h=new krt(s,{},!0,{dedupeParametricGeometries:!0});if(h.resetPersonalCameraFromDocumentData(),this._scene=h.scene,this._sharedAssetsManager=h.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:g}=await Promise.resolve().then(()=>(att(),A9));if(n())return;let m=performance.now();g(s,h.scene);let v=performance.now();console.log("Merged geometries in ",v-m," ms")}o5(s)&&this._scene.traverse(g=>{ro(g)&&g.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(g=>{oh(g)&&g.pendingMediaLoad&&g.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(g=>{g.type==="ParticleSystem"&&(g.wakeUp(),g.data.autoPlay?g.start():g.stop()),ed(g)&&g.setPlayMode(!0)});let d=Object.keys(s.shared.fonts).flatMap(g=>{let m=this._sharedAssetsManager.getFont(g);return m?[m.loadingPromise]:[]});if(Promise.all(d).then(()=>{this.disposed||(h.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),aL(s)&&function(g){if(td.physicsEnabled(g.scene.objects))return!0;let m=!1;return g.scene.objects.traverse((v,y)=>{if(y.events){if(Array.isArray(y.events)){for(let _ of y.events)if(_.data.disabled!==!0&&_.data.type==="GameControl"&&_.data.collisionEnabled){m=!0;break}}else for(let _ of Object.values(y.events))if(_.disabled!==!0&&_.type==="GameControl"&&_.collisionEnabled){m=!0;break}}}),m}(s)&&(await Promise.all(d),n()))return;if(mU(s)){let g=[];if(this._scene.traverseEntity(m=>{(Pr(m)||m instanceof Si)&&m.uiCanvas&&g.push(m.uiCanvas)}),await Promise.all(g.map(m=>m.promise)),n())return}this._scene.rewriteEventsBeforeGoToPlayMode(),ZP(this._scene.activePage,this._sharedAssetsManager);let u=await this._ensureRenderer();if(n()||!u)return;if(this._rendererConfigured||(this._rendererConfigured=!0,u.pipeline.enableUIOverlay(),u.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode)),u.hdTransmission=s.scene.publish.hdTransmission===!0,u.setPixelRatio(this._getPixelRatio(/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?s.scene.publish.settings.web.pixelRatioMobile:s.scene.publish.settings.web.pixelRatioDesktop)),u.setAsyncCompilationPolicy?.(this._asyncShaderCompilation()),s.shared.images.SplineWatermark){let g=this._sharedAssetsManager.getImage("SplineWatermark");if(await g.loadPromise,n())return;let m=g.getTexture(1001);u.pipeline.setWatermark(m)}else u.pipeline.setWatermark(null);y5(s)&&this._scene.initializeSplatViewer(),s.scene.blueNoiseTextureData!==void 0&&u.pipeline.updateBlueNoiseTexture(s.scene.blueNoiseTextureData);let p=Object.values(s.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(p.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=p.size[0],this._viewportHeight=p.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),u.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new Vtt(u,this._camera,new et(this._viewportWidth,this._viewportHeight)),this._frameView.enableResponsive=(p.allowResponsive??!1)&&p.preset==="fullscreen"),e){let g=new btt(u,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,p);this._scene.updateMatrixWorld(!0),this._controls=new oit(g),this._animationControls=new Rrt(this._scene,this._requestRenderAutoMode),this._eventManager=new Btt(s.scene.publish,this._controls,this._animationControls,g,s.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),i!==void 0&&this.setVariables(i),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),e&&(this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0);let f=s.scene.publish.htmlContent?.html;if(e&&f&&this._htmlContentMode!=="none"){let g={shared:this._sharedAssetsManager,findEntity:m=>this._scene?.getObjectByProperty("uuid",m)??this._scene?.getObjectByName(m),getAnimationControls:()=>this._animationControls};this._htmlContentOverlay=(this._htmlContentMode==="inline"?W7.mount(this,this.canvas,f,g):H7.mount(this,this.canvas,f,g))??void 0}}setVariables(t){if(this._data!==void 0){let e=Object.entries(t);for(let[i,n]of e)this.setVariable(i,n)}}setVariable(t,e){let i=this._getVariableByName(t);if(i&&!("dynamicVariableType"in i.data)){if(e==null)return void console.warn(`Variable ${t} was not updated: received ${e}. Pass a number, boolean or string.`);let n=e;if(typeof i.data.value=="number"){if(n=typeof e=="number"?e:typeof e=="boolean"?e===!0?1:0:parseFloat(e),!Number.isFinite(n))return void console.warn(`Variable ${t} is a number variable and ${JSON.stringify(e)} cannot be converted to a number. The variable was not updated.`)}else typeof i.data.value=="boolean"?n=typeof e=="number"?!!e:typeof e=="boolean"?e:e.toLocaleLowerCase()!=="false"&&!!e:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(n=e.toString());let r=typeof n=="string"?{textValue:n}:n;this._sharedAssetsManager?.updateVariable(i.id,r),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${t} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${t} cannot be updated from code.`)}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{t[e.data.name]===void 0&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let i=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(i)}}_getVariableValue(t){return typeof t!="string"&&_r.isTextValue(t)?_r.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(i=>i.data.name===t);return e&&this._variablesCache.set(t,e),e}}_getPixelRatio(t){switch(t){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(!(e.uuid===od||this._scene.isInvisibleObjects(e)||e instanceof Si)){let i=this._createProxyObject(e);i&&t.push(i)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof j9&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=Zz(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._claimedOrder=++this._startOrder,this._claimedStart=void 0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,Cg&&Cg.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(t=>{TM.unsubscribe(t)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer&&this._disposeRenderer(this._renderer),this._renderer=void 0,this._rendererConfigured=!1,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,function(t){t.removeEventListener("pointerdown",YO,!0),t.removeEventListener("pointerdown",Dv,!0),t.removeEventListener("pointermove",Dv,!0),t.removeEventListener("pointerup",Vd,!0),t.removeEventListener("pointercancel",Vd,!0),t.removeEventListener("pointerleave",Vd,!0),window.removeEventListener("keydown",ZO,!0),window.removeEventListener("keyup",KO,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll),rn.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene)return;let e,i=this._scene;if(t==null)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);t.traverseAncestors(h=>{h instanceof Si&&(e=h.name)});let n=this._sharedAssetsManager,r={shared:n,scene:this._scene},s=h=>{if(h===null||h==="Base State")return null;if(h&&t.data.states){let d=t.data.states.find(u=>u.data.name===h);return d?d.id:void 0}},a="material"in t?t.material:void 0,o=t.materialOverride,l={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:e,material:o??(a?nst(a):void 0),parentUuid:t.parent instanceof Si||t instanceof Zx?void 0:t.parent?.uuid,emitEvent(h){t.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){t.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){t.visible&&(t.visible=!1,r.shared.requestRender())},show(){t.visible||(t.visible=!0,r.shared.requestRender())},get state(){let h=t.stateSelection;if(h!==null)return t.data.states.find(({id:d})=>d===h)?.data.name},set state(h){let d;if(h!==void 0){let u=typeof h=="string"?t.data.states.find(({id:p})=>p===h):t.data.states[h];if(u)d=u.id;else{let p=typeof h=="string"?s(h):void 0;p&&(d=p)}}t.changeSelectedState(d??null,r),t.currentState=d??null,t.dispatchEvent({type:"completeState",state:d??null}),r.shared.requestRender()},transition(h){let d=j7;if(d===null)return jn("transitions","obj.transition()"),{transition(b){return this},play(){return this},pause(){return this},reset(){return this},seek(b){return this}};let u,p,f=this,g=[],m=!1,v=()=>{p=new A7({delay:0,delayDirection:"start-once",direction:"normal",repeat:0,runMode:"Repeat"},g.map(b=>b.runner))},y={update(b){p?.update(b),p?.isPlaying!==!0&&rn.remove(y)}},_={transition({from:b,to:x,duration:w,delay:S,...E}){let A=s(b);A===void 0&&(A=u);let P=s(x);return u=P,g.push(new d(t,A,P,{state:P,repeat:0,delay:S??0,delayDirection:"start-once",direction:"normal",duration:w??1e3,...E,...E.easing===6?rh.defaultData:E.easing===5?bp.defaultData:{}},n,!1,i.activePage,{onBegin:()=>{(b&&A||b==="Base State"&&!A)&&(f.state=A??void 0)},onComplete:()=>{f.state=P??void 0}})),v(),this},play(){return p?(m=!0,p.play(rn.time),p.isPlaying&&rn.add(y),this):this},pause(){return p?.stop(),rn.remove(y),this},reset(){return this.pause(),m=!1,v(),p?.seek(0),this},seek(b){let x=g.reduce((w,S)=>w+S.runner.duration,0);return x>0&&p?.seek(b/1e3/x),this}};return _.transition(h),(h.autoPlay??!0)&&queueMicrotask(()=>{m||_.play()}),_},set color(h){let d=Zz(h);if(Gb.is(t))return void(t.color=d);if(!(t.type==="Mesh"&&"material"in t&&t instanceof qr))return;let u={r:d.r,g:d.g,b:d.b,a:d.a},p=t.materialOverride;if(p!==void 0){let m=p.color;return void(m?.isColor===!0&&typeof m.setStyle=="function"&&(m.setStyle(h),r.shared.requestRender()))}let f=Array.isArray(t.material)?t.material[0]:t.material,g=f.data.layers.find(m=>m.data.type==="color")?.id;if(g)f.updateByOp({type:0,path:["layers",g],props:{color:{...u}}},f.data,r);else{let m=f.data,v=m.layers.find(S=>S.data.type==="light");if(!v)return;let y=m.layers.indexOf(v)===0?v:null,_=m.layers.at(y?m.layers.indexOf(y)+1:0),b={type:4,fi:y?y.fi+(_?(_.fi-y.fi)/2:1):_?_.fi/2:1,id:Pt.generateUUID(),data:{...Xi.defaultData("color"),color:u},localIndex:0},x=m.layers.insertAfterHelper(y?.id??null,1),w=m.layers.runOp({...b,fi:x[0]}).data;Object.assign(f.data,{layers:w}),f.updateByOp({...b,path:["layers"]},f.data,r)}}},c=TM(l,(h,d)=>{let u=t[h],p=function(f){return f.split(".")}(h);p[0]==="material"&&a&&o===void 0&&function(f,g,m){let v=Array.isArray(m)?m[0]:m;if(f[0]==="layers"){let y=parseInt(f[1]),_=v.layers[y],b=f[2];_&&b&&function(x,w,S){let E=x[0];try{if(function(A,P){return!!sst[P]?.includes(A)}(E,S.type,x.slice(1)))if(E==="colors"){if(x.length<2)throw new Error("You cannot mutate the colors array, only its items");let A=parseInt(x[1]),P=S.getValue(E)?.[A];if(!P)throw new Error("Color index out of range");Tm.setStyle(w),P.set(Tm.r,Tm.g,Tm.b,Tm.a)}else S.getValue(E)?.setStyle(w);else if(E==="texture"||E==="video"){let A=S.color;(function(P,C,R,O){let D=P[0];if(D==="repeat"||D==="offset"||D==="rotation"){let F=O.getNode("mat"),V=F&&typeof F.updateMatrix=="function"?F:O.getValue("mat");if(!V)return;if(D==="rotation")V.rotation=parseFloat(C);else{let U=P[1];if(U===void 0)C instanceof Array&&C.length===2&&Object.assign(V,{[D]:C});else{let j=V[D],q=parseInt(U)===0?[parseFloat(C),j[1]]:[j[0],parseFloat(C)];Object.assign(V,{[D]:q})}}V.updateMatrix()}else D==="wrapping"||D==="minFilter"||D==="magFilter"?D==="wrapping"?R.texture.wrap=C:R.texture[D]=C:D==="image"&&P[1]==="data"&&R.texture.image.updateSrc(C)})(x.slice(1),w,A,S)}else{let A=x[1],P=S.getValue(E);P?.isVector3&&A!==void 0||P?.isVector2&&A!==void 0?P.setComponent(parseInt(A),w):S.setValue(E,w)}}catch(A){console.error("Error setting material value",A)}}(f.slice(2),g,_)}else f[0]==="alpha"&&v.layers.forEach(y=>{y.type==="light"&&y.node.alphaOverride!==void 0&&(y.node.alphaOverride.value=g,g<1&&(v.transparent=!0))})}(p.slice(1),d,a),typeof u!="object"&&Object.getOwnPropertyDescriptor(t,h)?.writable&&(t[h]=d),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,c),c}setUIWasmUrl(t){(function(e){Rb=e,Lx?.setHanaUIWasmUrl(e)})(t)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(t,e){let i;if(typeof e=="string"){if(!e.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let l=await(await fetch(e)).arrayBuffer();i=new Uint8Array(l)}}else i=e;let n=Jg.deserialize(i),r="data"in n&&n.data.draco!==void 0;r&&await jz(this._wasmPath);let s=this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t);if(!s)return void console.warn(`Object ${t} not found`);if(s.data.type!=="Mesh"||!(s instanceof qr))return void console.warn(`Object ${t} is not a mesh`);let a=s,o={...a.data,geometry:n};r&&await Gz([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of a.data.states){let c={...l.data};a.states||(a.states={}),a.states[l.id]=ah.patch(o,c)}return i}_applyDocumentTransaction(t){this._data=t.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let e of t.actual){let i=e.path;Array.isArray(i)&&i.length===2&&i[0]==="scene"&&i[1]==="objects"&&this._scene?.updateTreeByOp({...e,path:[]},this._sharedAssetsManager)}}_findEntity(t){return this._scene?.getObjectByProperty("uuid",t)??this._scene?.getObjectByName(t)}_resolveParentId(t){if(t===void 0)return this._scene.activePage.uuid;let e=typeof t=="string"?t:t.uuid,i=this._findEntity(e);if(!i)throw new Error(`parent '${e}' \u2014 no object with that name or uuid in the scene.`);return i.uuid}async createCustomMaterial(t){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if(typeof t!="function")throw new Error("createCustomMaterial: expected a factory function \u2014 createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let e=N8();if(e===void 0&&e===void 0)throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let i=t(e);if(typeof i!="object"||i===null||i.isMaterial!==!0)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives \u2014 e.g. (three) => new three.MeshStandardNodeMaterial().");return i}async setMaterial(t,e){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let i=this._scene;if(!i)throw new Error("setMaterial: no scene loaded \u2014 call load() or start() first.");let n=typeof t=="string"?t:t.uuid,r=this._findEntity(n);if(!r)throw new Error(`setMaterial: '${n}' \u2014 no object with that name or uuid in the scene.`);if(!(r instanceof qr))throw new Error(`setMaterial: '${n}' is not a mesh \u2014 lights, groups, and cameras have no material.`);let s=typeof e=="function"?await this.createCustomMaterial(e):e;if(kb()!=="webgpu")throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=qz({material:s});if(a.material===void 0)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return r.setMaterialOverride(a.material,{scene:i,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(r.uuid),this._requestRenderAutoMode(),a.material}async createObject(t,e={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("createObject: no scene loaded \u2014 call load() or start() first.");let r=function(m){if(typeof m!="string"||m.length===0)throw new Error(`createObject: expected a type name string \u2014 one of ${Xz}.`);let v=m.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),y=Yrt[v];if(y)return{objectType:y};let _=$rt[v];if(_)return{objectType:"Mesh",geometryType:_};let b=Zrt[v];throw b?new Error(`createObject: '${m}' is not supported \u2014 ${b}`):new Error(`createObject: '${m}' is not a creatable Spline type \u2014 use one of ${Xz}, e.g. createObject('Cube', { width: 200 }).`)}(t);typeof e.material=="function"&&(e={...e,material:await this.createCustomMaterial(e.material)});let s,a,{options:o,material:l}=qz(e);if(l!==void 0){if(r.objectType!=="Mesh")throw new Error("createObject: a three.js material instance only applies to mesh types \u2014 lights and groups have no material.");if(kb()!=="webgpu")throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline \u2014 pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if(r.geometryType==="TextGeometry"){if(!N3.has("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature \u2014 re-export the scene with a Text object present, or load the full runtime build.");if(await SU(),a=e.font??Ou,n.shared.fonts[a]===void 0){if(a!==Ou){let m=Object.keys(n.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document \u2014 available fonts: ${m||"(none)"}.`)}s={name:Ou,url:rk}}}let c=this._resolveParentId(e.parent),h=est(r,o,n),d=Pt.generateUUID(),[u,p]=jm(n);s&&(u.shared.fonts[Ou]=s),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let f=p.result();if(s&&this._sharedAssetsManager.addFont(Ou,s),a!==void 0){let m=this._sharedAssetsManager.getFont(a);m&&await m.loadingPromise}this._applyDocumentTransaction(f);let g=i.find(d);return l!==void 0&&g.setMaterialOverride(l,{scene:i,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(g)}cloneObject(t,e={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let i=this._scene,n=this._data;if(!i||!n)throw new Error("cloneObject: no scene loaded \u2014 call load() or start() first.");let r=typeof t=="string"?t:t?.uuid,s=r?this._findEntity(r):void 0;if(!s)throw new Error(`cloneObject: '${r}' \u2014 no object with that name or uuid in the scene.`);if(s instanceof Si)throw new Error("cloneObject: pages cannot be cloned.");let a=n.scene.objects.get(s.uuid);if(!a)throw new Error(`cloneObject: '${r}' is not part of the document tree (expanded clones and instanced children cannot be cloned \u2014 clone their source object instead).`);let o=function(p,f,g){let m={...p.data};return f.position!==void 0&&(m.position=c0(f.position,[0,0,0])),f.rotation!==void 0&&(m.rotation=c0(f.rotation,[0,0,0])),f.scale!==void 0&&(m.scale=X7(f.scale)),f.visible!==void 0&&(m.visible=f.visible),m.name=f.name??$7(`${p.data.name??"Object"} Copy`,g),{...p,data:m}}(ist(a),e,n.scene.objects),l=e.parent!==void 0?this._resolveParentId(e.parent):n.scene.objects.parent(s.uuid)??null,c=e.parent!==void 0?null:s.uuid,[h,d]=jm(n);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=i.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(t){let e=this._scene,i=this._data;if(this.disposed||!e||!i)return!1;let n=typeof t=="string"?t:t?.uuid,r=n?this._findEntity(n):void 0;if(!r)return!1;if(r instanceof Si)throw new Error("removeObject: pages cannot be removed.");if(r.data.type==="PerspectiveCamera"||r.data.type==="OrthographicCamera")throw new Error("removeObject: cameras cannot be removed.");if(i.scene.objects.get(r.uuid)===void 0)throw new Error(`removeObject: '${n}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let s=[];r.traverseEntity(l=>{s.push(l.uuid)});let[a,o]=jm(i);a.scene.objects.delete(r.uuid),this._applyDocumentTransaction(o.result());for(let l of s){let c=this._proxyObjectCache.get(l);c&&(TM.unsubscribe(c),this._proxyObjectCache.delete(l))}return this._requestRenderAutoMode(),!0}};var sw=window,aw=sw.ShadowRoot&&(sw.ShadyCSS===void 0||sw.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,KP=Symbol(),K7=new WeakMap,R0=class{constructor(e,i,n){if(this._$cssResult$=!0,n!==KP)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o,i=this.t;if(aw&&e===void 0){let n=i!==void 0&&i.length===1;n&&(e=K7.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&K7.set(i,e))}return e}toString(){return this.cssText}},Q7=t=>new R0(typeof t=="string"?t:t+"",void 0,KP),QP=(t,...e)=>{let i=t.length===1?t[0]:e.reduce((n,r,s)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[s+1],t[0]);return new R0(i,t,KP)},JP=(t,e)=>{aw?t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet):e.forEach(i=>{let n=document.createElement("style"),r=sw.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=i.cssText,t.appendChild(n)})},ow=aw?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(let n of e.cssRules)i+=n.cssText;return Q7(i)})(t):t;var tD,lw=window,J7=lw.trustedTypes,ost=J7?J7.emptyScript:"",tG=lw.reactiveElementPolyfillSupport,iD={toAttribute(t,e){switch(e){case Boolean:t=t?ost:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},eG=(t,e)=>e!==t&&(e==e||t==t),eD={attribute:!0,type:String,converter:iD,reflect:!1,hasChanged:eG},nD="finalized",yl=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var i;this.finalize(),((i=this.h)!==null&&i!==void 0?i:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((i,n)=>{let r=this._$Ep(n,i);r!==void 0&&(this._$Ev.set(r,n),e.push(r))}),e}static createProperty(e,i=eD){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(e,i),!i.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,r=this.getPropertyDescriptor(e,n,i);r!==void 0&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,i,n){return{get(){return this[i]},set(r){let s=this[e];this[i]=r,this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||eD}static finalize(){if(this.hasOwnProperty(nD))return!1;this[nD]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let i=this.properties,n=[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)];for(let r of n)this.createProperty(r,i[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let i=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)i.unshift(ow(r))}else e!==void 0&&i.push(ow(e));return i}static _$Ep(e,i){let n=i.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(i=>i(this))}addController(e){var i,n;((i=this._$ES)!==null&&i!==void 0?i:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var i;(i=this._$ES)===null||i===void 0||i.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])})}createRenderRoot(){var e;let i=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return JP(i,this.constructor.elementStyles),i}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostConnected)===null||n===void 0?void 0:n.call(i)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var n;return(n=i.hostDisconnected)===null||n===void 0?void 0:n.call(i)})}attributeChangedCallback(e,i,n){this._$AK(e,n)}_$EO(e,i,n=eD){var r;let s=this.constructor._$Ep(e,n);if(s!==void 0&&n.reflect===!0){let a=(((r=n.converter)===null||r===void 0?void 0:r.toAttribute)!==void 0?n.converter:iD).toAttribute(i,n.type);this._$El=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$El=null}}_$AK(e,i){var n;let r=this.constructor,s=r._$Ev.get(e);if(s!==void 0&&this._$El!==s){let a=r.getPropertyOptions(s),o=typeof a.converter=="function"?{fromAttribute:a.converter}:((n=a.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?a.converter:iD;this._$El=s,this[s]=o.fromAttribute(i,a.type),this._$El=null}}requestUpdate(e,i,n){let r=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||eG)(this[e],i)?(this._$AL.has(e)||this._$AL.set(e,i),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(i){Promise.reject(i)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((r,s)=>this[s]=r),this._$Ei=void 0);let i=!1,n=this._$AL;try{i=this.shouldUpdate(n),i?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var s;return(s=r.hostUpdate)===null||s===void 0?void 0:s.call(r)}),this.update(n)):this._$Ek()}catch(r){throw i=!1,this._$Ek(),r}i&&this._$AE(n)}willUpdate(e){}_$AE(e){var i;(i=this._$ES)===null||i===void 0||i.forEach(n=>{var r;return(r=n.hostUpdated)===null||r===void 0?void 0:r.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((i,n)=>this._$EO(n,this[n],i)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};yl[nD]=!0,yl.elementProperties=new Map,yl.elementStyles=[],yl.shadowRootOptions={mode:"open"},tG?.({ReactiveElement:yl}),((tD=lw.reactiveElementVersions)!==null&&tD!==void 0?tD:lw.reactiveElementVersions=[]).push("1.6.3");var rD,hw=window,jp=hw.trustedTypes,iG=jp?jp.createPolicy("lit-html",{createHTML:t=>t}):void 0,aD="$lit$",Fh=`lit$${(Math.random()+"").slice(9)}$`,hG="?"+Fh,lst=`<${hG}>`,fd=document,I0=()=>fd.createComment(""),L0=t=>t===null||typeof t!="object"&&typeof t!="function",cG=Array.isArray,hst=t=>cG(t)||typeof t?.[Symbol.iterator]=="function",sD=`[
|
|
9971
9991
|
\f\r]`,O0=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,nG=/-->/g,rG=/>/g,ud=RegExp(`>|${sD}(?:([^\\s"'>=/]+)(${sD}*=${sD}*(?:[^
|
|
9972
9992
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),sG=/'/g,aG=/"/g,dG=/^(?:script|style|textarea|title)$/i,uG=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),pG=uG(1),Nmt=uG(2),md=Symbol.for("lit-noChange"),lr=Symbol.for("lit-nothing"),oG=new WeakMap,pd=fd.createTreeWalker(fd,129,null,!1);function fG(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return iG!==void 0?iG.createHTML(e):e}var cst=(t,e)=>{let i=t.length-1,n=[],r,s=e===2?"<svg>":"",a=O0;for(let o=0;o<i;o++){let l=t[o],c,h,d=-1,u=0;for(;u<l.length&&(a.lastIndex=u,h=a.exec(l),h!==null);)u=a.lastIndex,a===O0?h[1]==="!--"?a=nG:h[1]!==void 0?a=rG:h[2]!==void 0?(dG.test(h[2])&&(r=RegExp("</"+h[2],"g")),a=ud):h[3]!==void 0&&(a=ud):a===ud?h[0]===">"?(a=r??O0,d=-1):h[1]===void 0?d=-2:(d=a.lastIndex-h[2].length,c=h[1],a=h[3]===void 0?ud:h[3]==='"'?aG:sG):a===aG||a===sG?a=ud:a===nG||a===rG?a=O0:(a=ud,r=void 0);let p=a===ud&&t[o+1].startsWith("/>")?" ":"";s+=a===O0?l+lst:d>=0?(n.push(c),l.slice(0,d)+aD+l.slice(d)+Fh+p):l+Fh+(d===-2?(n.push(void 0),o):p)}return[fG(t,s+(t[i]||"<?>")+(e===2?"</svg>":"")),n]},gd=class{constructor({strings:e,_$litType$:i},n){let r;this.parts=[];let s=0,a=0,o=e.length-1,l=this.parts,[c,h]=cst(e,i);if(this.el=gd.createElement(c,n),pd.currentNode=this.el.content,i===2){let d=this.el.content,u=d.firstChild;u.remove(),d.append(...u.childNodes)}for(;(r=pd.nextNode())!==null&&l.length<o;){if(r.nodeType===1){if(r.hasAttributes()){let d=[];for(let u of r.getAttributeNames())if(u.endsWith(aD)||u.startsWith(Fh)){let p=h[a++];if(d.push(u),p!==void 0){let f=r.getAttribute(p.toLowerCase()+aD).split(Fh),g=/([.?@])?(.*)/.exec(p);l.push({type:1,index:s,name:g[2],strings:f,ctor:g[1]==="."?lD:g[1]==="?"?hD:g[1]==="@"?cD:Hp})}else l.push({type:6,index:s})}for(let u of d)r.removeAttribute(u)}if(dG.test(r.tagName)){let d=r.textContent.split(Fh),u=d.length-1;if(u>0){r.textContent=jp?jp.emptyScript:"";for(let p=0;p<u;p++)r.append(d[p],I0()),pd.nextNode(),l.push({type:2,index:++s});r.append(d[u],I0())}}}else if(r.nodeType===8)if(r.data===hG)l.push({type:2,index:s});else{let d=-1;for(;(d=r.data.indexOf(Fh,d+1))!==-1;)l.push({type:7,index:s}),d+=Fh.length-1}s++}}static createElement(e,i){let n=fd.createElement("template");return n.innerHTML=e,n}};function Gp(t,e,i=t,n){var r,s,a,o;if(e===md)return e;let l=n!==void 0?(r=i._$Co)===null||r===void 0?void 0:r[n]:i._$Cl,c=L0(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((s=l?._$AO)===null||s===void 0||s.call(l,!1),c===void 0?l=void 0:(l=new c(t),l._$AT(t,i,n)),n!==void 0?((a=(o=i)._$Co)!==null&&a!==void 0?a:o._$Co=[])[n]=l:i._$Cl=l),l!==void 0&&(e=Gp(t,l._$AS(t,e.values),l,n)),e}var oD=class{constructor(e,i){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var i;let{el:{content:n},parts:r}=this._$AD,s=((i=e?.creationScope)!==null&&i!==void 0?i:fd).importNode(n,!0);pd.currentNode=s;let a=pd.nextNode(),o=0,l=0,c=r[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new vd(a,a.nextSibling,this,e):c.type===1?h=new c.ctor(a,c.name,c.strings,this,e):c.type===6&&(h=new dD(a,this,e)),this._$AV.push(h),c=r[++l]}o!==c?.index&&(a=pd.nextNode(),o++)}return pd.currentNode=fd,s}v(e){let i=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,i),i+=n.strings.length-2):n._$AI(e[i])),i++}},vd=class{constructor(e,i,n,r){var s;this.type=2,this._$AH=lr,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=n,this.options=r,this._$Cp=(s=r?.isConnected)===null||s===void 0||s}get _$AU(){var e,i;return(i=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&i!==void 0?i:this._$Cp}get parentNode(){let e=this._$AA.parentNode,i=this._$AM;return i!==void 0&&e?.nodeType===11&&(e=i.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,i=this){e=Gp(this,e,i),L0(e)?e===lr||e==null||e===""?(this._$AH!==lr&&this._$AR(),this._$AH=lr):e!==this._$AH&&e!==md&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):hst(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==lr&&L0(this._$AH)?this._$AA.nextSibling.data=e:this.$(fd.createTextNode(e)),this._$AH=e}g(e){var i;let{values:n,_$litType$:r}=e,s=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=gd.createElement(fG(r.h,r.h[0]),this.options)),r);if(((i=this._$AH)===null||i===void 0?void 0:i._$AD)===s)this._$AH.v(n);else{let a=new oD(s,this),o=a.u(this.options);a.v(n),this.$(o),this._$AH=a}}_$AC(e){let i=oG.get(e.strings);return i===void 0&&oG.set(e.strings,i=new gd(e)),i}T(e){cG(this._$AH)||(this._$AH=[],this._$AR());let i=this._$AH,n,r=0;for(let s of e)r===i.length?i.push(n=new vd(this.k(I0()),this.k(I0()),this,this.options)):n=i[r],n._$AI(s),r++;r<i.length&&(this._$AR(n&&n._$AB.nextSibling,r),i.length=r)}_$AR(e=this._$AA.nextSibling,i){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,i);e&&e!==this._$AB;){let r=e.nextSibling;e.remove(),e=r}}setConnected(e){var i;this._$AM===void 0&&(this._$Cp=e,(i=this._$AP)===null||i===void 0||i.call(this,e))}},Hp=class{constructor(e,i,n,r,s){this.type=1,this._$AH=lr,this._$AN=void 0,this.element=e,this.name=i,this._$AM=r,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=lr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,i=this,n,r){let s=this.strings,a=!1;if(s===void 0)e=Gp(this,e,i,0),a=!L0(e)||e!==this._$AH&&e!==md,a&&(this._$AH=e);else{let o=e,l,c;for(e=s[0],l=0;l<s.length-1;l++)c=Gp(this,o[n+l],i,l),c===md&&(c=this._$AH[l]),a||(a=!L0(c)||c!==this._$AH[l]),c===lr?e=lr:e!==lr&&(e+=(c??"")+s[l+1]),this._$AH[l]=c}a&&!r&&this.j(e)}j(e){e===lr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},lD=class extends Hp{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===lr?void 0:e}},dst=jp?jp.emptyScript:"",hD=class extends Hp{constructor(){super(...arguments),this.type=4}j(e){e&&e!==lr?this.element.setAttribute(this.name,dst):this.element.removeAttribute(this.name)}},cD=class extends Hp{constructor(e,i,n,r,s){super(e,i,n,r,s),this.type=5}_$AI(e,i=this){var n;if((e=(n=Gp(this,e,i,0))!==null&&n!==void 0?n:lr)===md)return;let r=this._$AH,s=e===lr&&r!==lr||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,a=e!==lr&&(r===lr||s);s&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var i,n;typeof this._$AH=="function"?this._$AH.call((n=(i=this.options)===null||i===void 0?void 0:i.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}},dD=class{constructor(e,i,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=i,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Gp(this,e)}};var lG=hw.litHtmlPolyfillSupport;lG?.(gd,vd),((rD=hw.litHtmlVersions)!==null&&rD!==void 0?rD:hw.litHtmlVersions=[]).push("2.8.0");var B0=(t,e,i)=>{var n,r;let s=(n=i?.renderBefore)!==null&&n!==void 0?n:e,a=s._$litPart$;if(a===void 0){let o=(r=i?.renderBefore)!==null&&r!==void 0?r:null;s._$litPart$=a=new vd(e.insertBefore(I0(),o),o,void 0,i??{})}return a._$AI(t),a};var uD,pD;var Nh=class extends yl{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,i;let n=super.createRenderRoot();return(e=(i=this.renderOptions).renderBefore)!==null&&e!==void 0||(i.renderBefore=n.firstChild),n}update(e){let i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=B0(i,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return md}};Nh.finalized=!0,Nh._$litElement$=!0,(uD=globalThis.litElementHydrateSupport)===null||uD===void 0||uD.call(globalThis,{LitElement:Nh});var mG=globalThis.litElementPolyfillSupport;mG?.({LitElement:Nh});((pD=globalThis.litElementVersions)!==null&&pD!==void 0?pD:globalThis.litElementVersions=[]).push("3.3.3");var gG=t=>e=>typeof e=="function"?((i,n)=>(customElements.define(i,n),n))(t,e):((i,n)=>{let{kind:r,elements:s}=n;return{kind:r,elements:s,finisher(a){customElements.define(i,a)}}})(t,e);var ust=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}},pst=(t,e,i)=>{e.constructor.createProperty(i,t)};function Ms(t){return(e,i)=>i!==void 0?pst(t,e,i):ust(t,e)}var fD,ugt=((fD=window.HTMLSlotElement)===null||fD===void 0?void 0:fD.prototype.assignedElements)!=null?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter(i=>i.nodeType===Node.ELEMENT_NODE);var cw=window.IntersectionObserver!=null;var vG=(t=32,e=2)=>{let i=t/2;return pG` <style>
|
|
9973
9993
|
:host {
|