@jack120/test 0.2.9 → 0.2.10

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/dist/index.js CHANGED
@@ -1 +1 @@
1
- var z=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});import{platform as $}from"node:os";var F=$()==="darwin"?z("./native-bindings-osx.node"):z("./native-bindings-win.node"),a=class i{static Init(){F.Rpc_RegisterCbHandler((e,t)=>{let n=JSON.parse(t),r=i.keyValueToObject(n.keys,n.values);try{i.callbackRegistry[e](r)}catch(l){console.error(`${l}`)}})}static RegisterCallback(e){let t=Number(i.Call("_RPC::AllocateCallback",{clientId:i.GetClientId()}));return i.callbackRegistry[t]=e,t}static Call(e,t){this.initialized||(this.initialized=!0,i.Init());let n={};for(let[r,l]of Object.entries(t))typeof l=="function"?n[r]=i.RegisterCallback(l):n[r]=l;return JSON.parse(F.Rpc_Call(e,JSON.stringify(this.objectToKeyValue(n)))).result}static GetClientId(){return Number(F.Rpc_GetClientId())}static objectToKeyValue(e){let t=Object.keys(e),n=t.map(r=>e[r]);return{keys:t,values:n}}static keyValueToObject(e,t){let n={};return e.forEach((r,l)=>{n[r]=t[l]}),n}static{this.callbackRegistry={}}static{this.initialized=!1}};var J=class{static OnCmdCallback(e){return a.Call("DebugWindow::GetCommand",{callback:e})}};var X=class{static GetLeftPosition(){return JSON.parse(a.Call("XRI Left/Position",{}))}static GetLeftRotation(){return JSON.parse(a.Call("XRI Left/Rotation",{}))}static GetLeftThumbstick(){return JSON.parse(a.Call("XRI Left/Thumbstick",{}))}static GetLeftSelect(){return JSON.parse(a.Call("XRI Left Interaction/Select Value",{}))}static GetLeftActivate(){return JSON.parse(a.Call("XRI Left Interaction/Activate Value",{}))}static GetLeftTurn(){return JSON.parse(a.Call("XRI Left Locomotion/Turn",{}))}static GetLeftSnapTurn(){return JSON.parse(a.Call("XRI Left Locomotion/Snap Turn",{}))}static GetLeftMove(){return JSON.parse(a.Call("XRI Left Locomotion/Move",{}))}static GetLeftGrabMove(){return JSON.parse(a.Call("XRI Left Locomotion/Grab Move",{}))}static GetRightPosition(){return JSON.parse(a.Call("XRI Right/Position",{}))}static GetRightRotation(){return JSON.parse(a.Call("XRI Right/Rotation",{}))}static GetRightThumbstick(){return JSON.parse(a.Call("XRI Right/Thumbstick",{}))}static GetRightSelect(){return JSON.parse(a.Call("XRI Right Interaction/Select Value",{}))}static GetRightActivate(){return JSON.parse(a.Call("XRI Right Interaction/Activate Value",{}))}static GetRightTurn(){return JSON.parse(a.Call("XRI Right Locomotion/Turn",{}))}static GetRightSnapTurn(){return JSON.parse(a.Call("XRI Right Locomotion/Snap Turn",{}))}static GetRightMove(){return JSON.parse(a.Call("XRI Right Locomotion/Move",{}))}static GetRightGrabMove(){return JSON.parse(a.Call("XRI Right Locomotion/Grab Move",{}))}static GetHeadPosition(){return JSON.parse(a.Call("XRI Head/Position",{}))}static GetHeadRotation(){return JSON.parse(a.Call("XRI Head/Rotation",{}))}static GetLeftWorldPosition(){return JSON.parse(a.Call("XRI Left/WorldPosition",{}))}static GetLeftWorldRotation(){return JSON.parse(a.Call("XRI Left/WorldRotation",{}))}static GetRightWorldPosition(){return JSON.parse(a.Call("XRI Right/WorldPosition",{}))}static GetRightWorldRotation(){return JSON.parse(a.Call("XRI Right/WorldRotation",{}))}static GetHeadWorldPosition(){return JSON.parse(a.Call("XRI Head/WorldPosition",{}))}static GetHeadWorldRotation(){return JSON.parse(a.Call("XRI Head/WorldRotation",{}))}},j=class{static{this.KEYCODE=Object.freeze({LEFT_EYE:"Left Eye",RIGHT_EYE:"Right Eye",LEFT_AIM:"Left Aim",RIGHT_AIM:"Right Aim",LEFT_GRIP:"Left Grip",RIGHT_GRIP:"Right Grip",LEFT_SQUEEZE:"Left Squeeze",RIGHT_SQUEEZE:"Right Squeeze",LEFT_TRIGGER:"Left Trigger",RIGHT_TRIGGER:"Right Trigger",LEFT_THUMBSTICK_X:"Left Thumbstick X",RIGHT_THUMBSTICK_X:"Right Thumbstick X",LEFT_THUMBSTICK_Y:"Left Thumbstick Y",RIGHT_THUMBSTICK_Y:"Right Thumbstick Y",LEFT_TRIGGER_TOUCH:"Left Trigger Touch",RIGHT_TRIGGER_TOUCH:"Right Trigger Touch",LEFT_THUMBSTICK_CLICK:"Left Thumbstick Click",RIGHT_THUMBSTICK_CLICK:"Right Thumbstick Click",LEFT_THUMBSTICK_TOUCH:"Left Thumbstick Touch",RIGHT_THUMBSTICK_TOUCH:"Right Thumbstick Touch",LEFT_X_CLICK:"Left X Click",LEFT_X_TOUCH:"Left X Touch",LEFT_Y_CLICK:"Left Y Click",LEFT_Y_TOUCH:"Left Y Touch",LEFT_MENU_CLICK:"Left Menu Click",RIGHT_A_CLICK:"Right A Click",RIGHT_A_TOUCH:"Right A Touch",RIGHT_B_CLIKC:"Right B Click",RIGHT_B_TOUCH:"Right B Touch",RIGHT_SYSTEM_CLICK:"Right System Click"})}},W=class{static{this.MOUSE=Object.freeze({BUTTON_LEFT:0,BUTTON_RIGHT:1,BUTTON_MIDDLE:2})}static{this.KEYCODE=Object.freeze({SPACE:32,APOSTROPHE:39,COMMA:44,MINUS:45,PERIOD:46,SLASH:47,NUM_0:48,NUM_1:49,NUM_2:50,NUM_3:51,NUM_4:52,NUM_5:53,NUM_6:54,NUM_7:55,NUM_8:56,NUM_9:57,SEMICOLON:59,EQUAL:61,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,LEFT_BRACKET:91,BACKSLASH:92,RIGHT_BRACKET:93,GRAVE_ACCENT:96,WORLD_1:161,WORLD_2:162,ESCAPE:256,ENTER:257,TAB:258,BACKSPACE:259,INSERT:260,DELETE:261,RIGHT:262,LEFT:263,DOWN:264,UP:265,PAGE_UP:266,PAGE_DOWN:267,HOME:268,END:269,CAPS_LOCK:280,SCROLL_LOCK:281,NUM_LOCK:282,PRINT_SCREEN:283,PAUSE:284,F1:290,F2:291,F3:292,F4:293,F5:294,F6:295,F7:296,F8:297,F9:298,F10:299,F11:300,F12:301,F13:302,F14:303,F15:304,F16:305,F17:306,F18:307,F19:308,F20:309,F21:310,F22:311,F23:312,F24:313,F25:314,KP_0:320,KP_1:321,KP_2:322,KP_3:323,KP_4:324,KP_5:325,KP_6:326,KP_7:327,KP_8:328,KP_9:329,KP_DECIMAL:330,KP_DIVIDE:331,KP_MULTIPLY:332,KP_SUBTRACT:333,KP_ADD:334,KP_ENTER:335,KP_EQUAL:336,LEFT_SHIFT:340,LEFT_CONTROL:341,LEFT_ALT:342,LEFT_SUPER:343,RIGHT_SHIFT:344,RIGHT_CONTROL:345,RIGHT_ALT:346,RIGHT_SUPER:347,MENU:348})}static{this.ACTION=Object.freeze({RELEASE:0,PRESS:1,REPEAT:2})}static{this.MODIFIER=Object.freeze({SHIFT:1,CONTROL:2,ALT:4,SUPER:8,CAPS_LOCK:16,NUM_LOCK:32})}};var O=class{static Create(e){return Number(a.Call("Entity_Create",{name:e,clientId:a.GetClientId()}))}static Destroy(e){return!!a.Call("Entity_Destroy",{entityHandle:e})}static SetName(e,t){return!!a.Call("Entity_SetName",{entityHandle:e,name:t})}static GetName(e){return a.Call("Entity_GetName",{entityHandle:e})}};var h=class{static Create(e){return!!a.Call("GrabInteractableAPI_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("GrabInteractableAPI_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("GrabInteractableAPI_HasComponent",{entityHandle:e})}static GetTrackPosition(e){return!!a.Call("GrabInteractableAPI_GetTrackPosition",{entityHandle:e})}static SetTrackPosition(e,t){return!!a.Call("GrabInteractableAPI_SetTrackPosition",{entityHandle:e,isTracking:t})}static GetTrackRotation(e){return JSON.parse(a.Call("GrabInteractableAPI_GetTrackRotation",{entityHandle:e}))}static SetTrackRotation(e,t){return JSON.parse(a.Call("GrabInteractableAPI_SetTrackRotation",{entityHandle:e,isTracking:t}))}static GetTrackScale(e){return!!a.Call("GrabInteractableAPI_GetTrackScale",{entityHandle:e})}static SetTrackScale(e,t){return!!a.Call("GrabInteractableAPI_SetTrackScale",{entityHandle:e,isTracking:t})}static GetThrowOnDetach(e){return!!a.Call("GrabInteractableAPI_GetThrowOnDetach",{entityHandle:e})}static SetThrowOnDetach(e,t){return!!a.Call("GrabInteractableAPI_SetThrowOnDetach",{entityHandle:e,enable:t})}static GetAttachEntity(e){return!!a.Call("GrabInteractableAPI_GetAttachEntity",{entityHandle:e})}static SetAttachEntity(e,t){return!!a.Call("GrabInteractableAPI_SetAttachEntity",{entityHandle:e,attachEntityHandle:t})}static AddSelectEnteredCallback(e,t){return!!a.Call("GrabInteractableAPI_AddSelectEnteredCallback",{entityHandle:e,onSelectEntered:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddSelectExitedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddSelectExitedCallback",{entityHandle:e,onSelectExited:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddActivatedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddActivatedCallback",{entityHandle:e,onActivated:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddDeactivatedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddDeactivatedCallback",{entityHandle:e,onDeactivated:n=>{t(n.interactableEntity,n.interactorEntity)}})}};var Y=class i{static{this.stateMap=new Map}static GetNetworkID(){return a.Call("_Main::GetNetworkPrefabIdByPid",{pid:process.pid})}static CreateNetworkState(e,t,n=()=>{}){let r=structuredClone(t);i.stateMap.set(e,r);let l=new Proxy(r,{get(o,u){return Reflect.get(o,u)},set(o,u,g){return Reflect.set(o,u,g),a.Call("_RPC::BroadcastState",{networkId:i.GetNetworkID(),key:e,payload:JSON.stringify({prop:u,value:g})}),!0}});return a.Call("_RPC::AddNewState",{networkId:i.GetNetworkID(),key:e,onReceived:o=>{console.log("onReceived: "+o.data);let u=i.stateMap.get(e);if(!u)return;let{prop:g,value:c}=JSON.parse(o.data);u[g]=c,n(g,c)}}),l}static IsStateAuthority(){return a.Call("_RPC:IsStateAuthority",{networkId:i.GetNetworkID()})}static GetPlayerId(){return a.Call("Multiplayer_GetPlayerId",{})}};import{vec3 as U}from"gl-matrix";var S=class{static CreateBox(e){return Number(a.Call("ColliderAPI_CreateBox",{entityHandle:e}))}static CreateSphere(e){return Number(a.Call("ColliderAPI_CreateSphere",{entityHandle:e}))}static CreateCapsule(e){return Number(a.Call("ColliderAPI_CreateCapsule",{entityHandle:e}))}static Destroy(e,t){return!!a.Call("ColliderAPI_Destroy",{entityHandle:e,colliderHandle:t})}static HasComponent(e,t){return!!a.Call("ColliderAPI_HasComponent",{entityHandle:e,colliderHandle:t})}static GetGameObject(e){return Number(a.Call("ColliderAPI_GetGameObject",{entityHandle:e}))}static GetBoxColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetBoxColliderCenter",{colliderHandle:e}));return U.fromValues(t[0],t[1],t[2])}static SetBoxColliderCenter(e,t){return a.Call("ColliderAPI_SetBoxColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetBoxColliderSize(e){let t=JSON.parse(a.Call("ColliderAPI_GetBoxColliderSize",{colliderHandle:e}));return U.fromValues(t[0],t[1],t[2])}static SetBoxColliderSize(e,t){return a.Call("ColliderAPI_SetBoxColliderSize",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetSphereColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetSphereColliderCenter",{colliderHandle:e}));return U.fromValues(t[0],t[1],t[2])}static SetSphereColliderCenter(e,t){return a.Call("ColliderAPI_SetSphereColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetSphereColliderRadius(e){return a.Call("ColliderAPI_GetSphereColliderRadius",{colliderHandle:e})}static SetSphereColliderRadius(e,t){return a.Call("ColliderAPI_SetSphereColliderRadius",{colliderHandle:e,radius:t})}static GetCapsuleColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetCapsuleColliderCenter",{colliderHandle:e}));return U.fromValues(t[0],t[1],t[2])}static SetCapsuleColliderCenter(e,t){return a.Call("ColliderAPI_SetCapsuleColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetCapsuleColliderRadius(e){return a.Call("ColliderAPI_GetCapsuleColliderRadius",{colliderHandle:e})}static SetCapsuleColliderRadius(e,t){return a.Call("ColliderAPI_SetCapsuleColliderRadius",{colliderHandle:e,radius:t})}static GetCapsuleColliderHeight(e){return a.Call("ColliderAPI_GetCapsuleColliderHeight",{colliderHandle:e})}static SetCapsuleColliderHeight(e,t){return a.Call("ColliderAPI_SetCapsuleColliderHeight",{colliderHandle:e,height:t})}static GetIsTrigger(e){return!!a.Call("ColliderAPI_GetIsTrigger",{entityHandle:e})}static SetIsTrigger(e,t){return!!a.Call("ColliderAPI_SetIsTrigger",{colliderHandle:e,isTrigger:t})}static AddTriggerEnterCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerEnterCallback",{entityHandle:e,onTriggerEnter:t})}static AddTriggerExitCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerExitCallback",{entityHandle:e,onTriggerExit:t})}static AddTriggerStayCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerStayCallback",{entityHandle:e,onTriggerStay:t})}};var T=class{static Create(e){return!!a.Call("RidigbodyAPI_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("RidigbodyAPI_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("RidigbodyAPI_HasComponent",{entityHandle:e})}static GetIsKinematic(e){return!!a.Call("RidigbodyAPI_GetIsKinematic",{entityHandle:e})}static SetIsKinematic(e,t){return!!a.Call("RidigbodyAPI_SetIsKinematic",{entityHandle:e,isKinematic:t})}static GetUseGravity(e){return!!a.Call("RidigbodyAPI_GetUseGravity",{entityHandle:e})}static SetUseGravity(e,t){return!!a.Call("RidigbodyAPI_SetUseGravity",{entityHandle:e,useGravity:t})}static GetMass(e){return Number(a.Call("RidigbodyAPI_GetMass",{entityHandle:e}))}static SetMass(e,t){return!!a.Call("RidigbodyAPI_SetMass",{entityHandle:e,mass:t})}static GetLinearDamping(e){return Number(a.Call("RidigbodyAPI_GetLinearDamping",{entityHandle:e}))}static SetLinearDamping(e,t){return!!a.Call("RidigbodyAPI_SetLinearDamping",{entityHandle:e,linearDamping:t})}static GetAngularDamping(e){return Number(a.Call("RidigbodyAPI_GetAngularDamping",{entityHandle:e}))}static SetAngularDamping(e,t){return!!a.Call("RidigbodyAPI_SetAngularDamping",{entityHandle:e,angularDamping:t})}};var A=class{static Create(e){return!!a.Call("Camera_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("Camera_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Camera_HasComponent",{entityHandle:e})}static SetProjection(e,t,n,r,l,o){return!!a.Call("Camera_SetProjection",{entityHandle:e,projectionType:t,fov:n,aspect:r,near:l,far:o})}static SetOrthographic(e,t,n,r,l,o,u){return!!a.Call("Camera_SetOrthographic",{entityHandle:e,left:t,right:n,bottom:r,top:l,near:o,far:u})}static LookAt(e,t,n,r,l,o,u,g,c,f){return!!a.Call("Camera_LookAt",{entityHandle:e,targetX:t,targetY:n,targetZ:r,upX:l,upY:o,upZ:u,worldUpX:g,worldUpY:c,worldUpZ:f})}static SetCullingMask(e,t){return!!a.Call("Camera_SetCullingMask",{entityHandle:e,mask:t})}static SetRenderTexture(e,t){return!!a.Call("Camera_SetRenderTexture",{entityHandle:e,renderTextureHandle:t})}};var _=class{static Create(e,t){return!!a.Call("Light_Create",{entityHandle:e,lightType:t})}static Destroy(e){return!!a.Call("Light_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Light_HasComponent",{entityHandle:e})}static SetType(e,t){return!!a.Call("Light_SetType",{entityHandle:e,lightType:t})}static SetColor(e,t){return!!a.Call("Light_SetColor",{entityHandle:e,r:t[0],g:t[1],b:t[2]})}static SetIntensity(e,t){return!!a.Call("Light_SetIntensity",{entityHandle:e,intensity:t})}static SetRange(e,t){return!!a.Call("Light_SetRange",{entityHandle:e,range:t})}static SetSpotAngle(e,t,n=!0){return!!a.Call("Light_SetSpotAngle",{entityHandle:e,angle:t,value:n})}static SetShadows(e,t){return!!a.Call("Light_SetShadows",{entityHandle:e,shadowType:t})}static SetCullingMask(e,t){return!!a.Call("Light_SetCullingMask",{entityHandle:e,mask:t})}},ee=(n=>(n[n.NoShadows=0]="NoShadows",n[n.Hard=1]="Hard",n[n.Soft=2]="Soft",n))(ee||{}),q=(r=>(r[r.Spot=0]="Spot",r[r.Directional=1]="Directional",r[r.Point=2]="Point",r[r.Area=3]="Area",r))(q||{});var te=(e=>(e.URP_LIT="Universal Render Pipeline/Lit",e))(te||{}),ae=(m=>(m.BaseMap="_BaseMap",m.BaseColor="_BaseColor",m.Cutoff="_Cutoff",m.Smoothness="_Smoothness",m.SmoothnessTextureChannel="_SmoothnessTextureChannel",m.Metallic="_Metallic",m.MetallicGlossMap="_MetallicGlossMap",m.SpecColor="_SpecColor",m.SpecGlossMap="_SpecGlossMap",m.SpecularHighlights="_SpecularHighlights",m.EnvironmentReflections="_EnvironmentReflections",m.BumpScale="_BumpScale",m.BumpMap="_BumpMap",m.Parallax="_Parallax",m.ParallaxMap="_ParallaxMap",m.OcclusionStrength="_OcclusionStrength",m.OcclusionMap="_OcclusionMap",m.EmissionColor="_EmissionColor",m.EmissionMap="_EmissionMap",m.DetailMask="_DetailMask",m.DetailAlbedoMapScale="_DetailAlbedoMapScale",m.DetailAlbedoMap="_DetailAlbedoMap",m.DetailNormalMapScale="_DetailNormalMapScale",m.DetailNormalMap="_DetailNormalMap",m))(ae||{}),x=class{static Create(e="Universal Render Pipeline/Lit",t,n=0){let r=Number(a.Call("Material_Create",{shaderName:e,clientId:a.GetClientId()}));return t!==void 0&&a.Call("Renderable_SetMaterial",{entityHandle:t,materialHandle:r,index:n}),r}static Destroy(e){return!!a.Call("Material_Destroy",{materialHandle:e})}static CreateInstance(e){return Number(a.Call("Material_CreateInstance",{materialHandle:e,clientId:a.GetClientId()}))}static SetFloat(e,t,n){return!!a.Call("Material_SetFloat",{materialHandle:e,propertyName:t,value:n})}static SetVector(e,t,n){return!!a.Call("Material_SetVector",{materialHandle:e,propertyName:t,x:n[0],y:n[1],z:n[2],w:n[3]})}static SetColor(e,t,n){return!!a.Call("Material_SetColor",{materialHandle:e,propertyName:t,r:n[0],g:n[1],b:n[2],a:n[3]})}static SetTexture(e,t,n){return!!a.Call("Material_SetTexture",{materialHandle:e,propertyName:t,textureHandle:n})}static GetFloat(e,t){return Number(a.Call("Material_GetFloat",{materialHandle:e,propertyName:t}))}static GetColor(e,t){return a.Call("Material_GetColor",{materialHandle:e,propertyName:t})}};var P="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<P.length;i++)v[P.charCodeAt(i)]=i;var I=i=>{let e=new Uint8Array(i),t,n=e.length,r="";for(t=0;t<n;t+=3)r+=P[e[t]>>2],r+=P[(e[t]&3)<<4|e[t+1]>>4],r+=P[(e[t+1]&15)<<2|e[t+2]>>6],r+=P[e[t+2]&63];return n%3===2?r=r.substring(0,r.length-1)+"=":n%3===1&&(r=r.substring(0,r.length-2)+"=="),r},Ne=i=>{let e=i.length*.75,t=i.length,n,r=0,l,o,u,g;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);let c=new ArrayBuffer(e),f=new Uint8Array(c);for(n=0;n<t;n+=4)l=v[i.charCodeAt(n)],o=v[i.charCodeAt(n+1)],u=v[i.charCodeAt(n+2)],g=v[i.charCodeAt(n+3)],f[r++]=l<<2|o>>4,f[r++]=(o&15)<<4|u>>2,f[r++]=(u&3)<<6|g&63;return c};var b=class{static Create(e){let t=Number(a.Call("Mesh_Create",{clientId:a.GetClientId()}));return e!==void 0&&a.Call("Renderable_SetMesh",{entityHandle:e,meshHandle:t}),t}static Destroy(e){return!!a.Call("Mesh_Destroy",{meshHandle:e})}static SetVertices(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let l=0;l<t.length;l++){let o=t[l];r[l*3]=o[0],r[l*3+1]=o[1],r[l*3+2]=o[2]}n=I(r.buffer)}return!!a.Call("Mesh_SetVertices",{meshHandle:e,base64Vertices:n})}static SetTriangles(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let l=0;l<t.length;l++){let o=t[l];r[l*3]=o[0],r[l*3+1]=o[1],r[l*3+2]=o[2]}n=I(r.buffer)}return!!a.Call("Mesh_SetTriangles",{meshHandle:e,base64Triangles:n})}static SetUVs(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*2);for(let l=0;l<t.length;l++){let o=t[l];r[l*2]=o[0],r[l*2+1]=o[1]}n=I(r.buffer)}return!!a.Call("Mesh_SetUVs",{meshHandle:e,base64Uvs:n})}static SetNormals(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let l=0;l<t.length;l++){let o=t[l];r[l*3]=o[0],r[l*3+1]=o[1],r[l*3+2]=o[2]}n=I(r.buffer)}return!!a.Call("Mesh_SetNormals",{meshHandle:e,base64Normals:n})}static RecalcNormals(e){return!!a.Call("Mesh_RecalculateNormals",{meshHandle:e})}static RecalcBounds(e){return!!a.Call("Mesh_RecalculateBounds",{meshHandle:e})}};function Oe(){let i=[[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5],[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5]],e=[[0,2,1],[0,3,2],[4,5,6],[4,6,7],[0,1,5],[0,5,4],[3,7,6],[3,6,2],[0,4,7],[0,7,3],[1,2,6],[1,6,5]],t=b.Create();return b.SetVertices(t,i),b.SetTriangles(t,e),b.RecalcNormals(t),b.RecalcBounds(t),t}function Ue(){let i=[[-.5,-.5,0],[.5,-.5,0],[.5,.5,0],[-.5,.5,0]],e=[[0,1],[1,1],[1,0],[0,0]],t=[[0,2,1],[0,3,2]],n=b.Create();return b.SetVertices(n,i),b.SetUVs(n,e),b.SetTriangles(n,t),b.RecalcNormals(n),b.RecalcBounds(n),n}var k=class i{static Create(e){return!!a.Call("Renderable_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("Renderable_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Renderable_HasComponent",{entityHandle:e})}static SetMesh(e,t){return i.HasComponent(e)?!!a.Call("Renderable_SetMesh",{entityHandle:e,meshHandle:t}):!1}static SetMaterial(e,t,n=0){return!!a.Call("Renderable_SetMaterial",{entityHandle:e,materialHandle:t,index:n})}static SetLayerMask(e,t){return!!a.Call("Renderable_SetLayerMask",{entityHandle:e,layerMask:t})}static SetReceiveShadows(e,t){return!!a.Call("Renderable_SetReceiveShadows",{entityHandle:e,receive:t})}static SetCastShadows(e,t){return!!a.Call("Renderable_SetCastShadows",{entityHandle:e,shadowMode:t})}static SetCulling(e,t){return!!a.Call("Renderable_SetCulling",{entityHandle:e,enabled:t})}};var ne=(c=>(c[c.Alpha8=1]="Alpha8",c[c.ARGB4444=2]="ARGB4444",c[c.RGB24=3]="RGB24",c[c.RGBA32=4]="RGBA32",c[c.ARGB32=5]="ARGB32",c[c.RGB565=7]="RGB565",c[c.R16=9]="R16",c[c.DXT1=10]="DXT1",c[c.DXT5=12]="DXT5",c))(ne||{}),w=class{static Create2D(e,t,n){return Number(a.Call("Texture_Create2D",{width:e,height:t,format:n,clientId:a.GetClientId()}))}static Create2DForMaterial(e,t,n,r,l){let o=Number(a.Call("Texture_Create2D",{width:e,height:t,format:n,clientId:a.GetClientId()}));return a.Call("Material_SetTexture",{materialHandle:r,propertyName:l,textureHandle:o}),o}static CreateRenderTexture(e,t,n,r){return Number(a.Call("Texture_CreateRenderTexture",{width:e,height:t,depth:n,format:r,clientId:a.GetClientId()}))}static Destroy(e){return!!a.Call("Texture_Destroy",{textureHandle:e})}static LoadRawTextureData(e,t,n,r){let l=I(t);return!!a.Call("Texture_LoadRawTextureData",{textureHandle:e,base64Rgba:l,width:n,height:r})}static LoadImage(e,t){let n=I(t);return!!a.Call("Texture_LoadImage",{textureHandle:e,base64Image:n})}static LoadImageBase64(e,t){return!!a.Call("Texture_LoadImage",{textureHandle:e,base64Image:t})}static SetFilterMode(e,t){return!!a.Call("Texture_SetFilterMode",{textureHandle:e,filterMode:t})}static SetWrapMode(e,t){return!!a.Call("Texture_SetWrapMode",{textureHandle:e,wrapMode:t})}},re=(o=>(o[o.NEAREST=0]="NEAREST",o[o.LINEAR=1]="LINEAR",o[o.NEAREST_MIPMAP_NEAREST=2]="NEAREST_MIPMAP_NEAREST",o[o.LINEAR_MIPMAP_NEAREST=3]="LINEAR_MIPMAP_NEAREST",o[o.NEAREST_MIPMAP_LINEAR=4]="NEAREST_MIPMAP_LINEAR",o[o.LINEAR_MIPMAP_LINEAR=5]="LINEAR_MIPMAP_LINEAR",o))(re||{}),le=(n=>(n[n.CLAMP_TO_EDGE=0]="CLAMP_TO_EDGE",n[n.REPEAT=1]="REPEAT",n[n.MIRRORED_REPEAT=2]="MIRRORED_REPEAT",n))(le||{});var N=class{static GetDefault(){return Number(a.Call("Scene_GetDefault",{}))}static SetSkybox(e,t){return!!a.Call("Scene_SetSkybox",{sceneHandle:e,skyboxHandle:t})}static SetAmbientLight(e,t,n,r,l){return!!a.Call("Scene_SetAmbientLight",{sceneHandle:e,r:t,g:n,b:r,intensity:l})}static SetFog(e,t,n,r,l,o){return!!a.Call("Scene_SetFog",{sceneHandle:e,enabled:t,mode:n,density:r,start:l,end:o})}};var Q=class{static GetDefaultCameraEntity(){return console.warn("GetDefaultCameraEntity(): Unity RPC not available"),-1}static GetXRCameras(){return console.warn("GetXRCameras(): Unity RPC not available"),[]}static DestroyMaterialInstance(e){return x.Destroy(e)}static DestroyRenderTarget(e){return w.Destroy(e)}static DestroySkybox(e){return x.Destroy(e)}static DestroyIndirectLight(e){return console.warn("DestroyIndirectLight(): no Unity RPC equivalent"),!1}static SetSkybox(e,t){return N.SetSkybox(e,t)}static SetAmbientLight(e,t,n,r,l){return N.SetAmbientLight(e,t,n,r,l)}static SetFog(e,t,n,r,l,o){return N.SetFog(e,t,n,r,l,o)}};import{mat4 as oe,quat as Z,vec3 as K}from"gl-matrix";var G=class{static HasComponent(e){return!!a.Call("Transform_HasComponent",{entityHandle:e})}static SetTransform(e,t){let n=new Array(16);for(let l=0;l<4;l++)for(let o=0;o<4;o++){let u=t[l*4+o];o===2&&(u=-u),n[o*4+l]=u}let r=n.join(",");return!!a.Call("Transform_SetTransform",{entityHandle:e,matrixJson:r})}static GetTransform(e){let n=a.Call("Transform_GetTransform",{entityHandle:e}).split(",").map(r=>parseFloat(r));if(n.length!==16)throw new Error(`Invalid transform data (${n.length} elements)`);return oe.fromValues(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}static SetParent(e,t){return!!a.Call("Transform_SetParent",{entityHandle:e,parentHandle:t})}static GetParent(e){return Number(a.Call("Transform_GetParent",{entityHandle:e}))}static SetWorldPosition(e,t){return!!a.Call("Transform_SetWorldPosition",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static SetLocalPosition(e,t){return!!a.Call("Transform_SetLocalPosition",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static GetWorldPosition(e){let t=a.Call("Transform_GetWorldPosition",{entityHandle:e}),[n,r,l]=t.split(",").map(o=>parseFloat(o));return K.fromValues(n,r,l)}static GetLocalPosition(e){let t=a.Call("Transform_GetLocalPosition",{entityHandle:e}),[n,r,l]=t.split(",").map(o=>parseFloat(o));return K.fromValues(n,r,l)}static SetWorldRotation(e,t){return!!a.Call("Transform_SetWorldRotation",{entityHandle:e,x:t[0],y:t[1],z:t[2],w:t[3]})}static SetLocalRotation(e,t){return!!a.Call("Transform_SetLocalRotation",{entityHandle:e,x:t[0],y:t[1],z:t[2],w:t[3]})}static GetWorldRotation(e){let t=a.Call("Transform_GetWorldRotation",{entityHandle:e}),[n,r,l,o]=t.split(",").map(u=>parseFloat(u));return Z.fromValues(n,r,l,o)}static GetLocalRotation(e){let t=a.Call("Transform_GetLocalRotation",{entityHandle:e}),[n,r,l,o]=t.split(",").map(u=>parseFloat(u));return Z.fromValues(n,r,l,o)}static SetLocalScale(e,t){return!!a.Call("Transform_SetLocalScale",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static GetLocalScale(e){let t=a.Call("Transform_GetLocalScale",{entityHandle:e}),[n,r,l]=t.split(",").map(o=>parseFloat(o));return K.fromValues(n,r,l)}};import{quat as ie,vec3 as M}from"gl-matrix";var bt=async i=>{let e=i.scene,t=new Map(e.properties.value),n=new Map(e.transforms.value),r=new Map(e.renderables.value),l=new Map(e.lights.value),o=new Map(e.cameras.value),u=new Map(e.colliders.value),g=new Map(e.rigidbodies.value),c=new Map(e.grabbles.value),f=new Map;for(let E of e.entities.value){let s=t.get(E),y=O.Create(s.name);f.set(E,y)}for(let E of e.entities.value){let s=f.get(E),y=n.get(E);if(y)y.parent!=="00000000-0000-0000-0000-000000000000"&&G.SetParent(s,f.get(y.parent)),G.SetLocalPosition(s,M.fromValues(y.localPosition.value[0],y.localPosition.value[1],y.localPosition.value[2])),G.SetLocalScale(s,M.fromValues(y.localScale.value[0],y.localScale.value[1],y.localScale.value[2])),G.SetLocalRotation(s,ie.fromEuler([0,0,0,0],y.localRotation.value.x,y.localRotation.value.y,y.localRotation.value.z,"xyz"));else throw Error(`Data corrupted. Entity ${E} has no transform`);let D=r.get(E);if(D&&D.mesh&&D.material){k.Create(s);let{default:C}=await import(`adamas-uuid:${D.mesh}`);if(C)for(let d of C.meshPrimitives){let B=b.Create();b.SetVertices(B,d.base64Vertices),b.SetTriangles(B,d.base64Indices),d.base64Uvs&&b.SetUVs(B,C.base64Uvs),d.base64Normals&&b.SetNormals(B,d.base64Normals),k.SetMesh(s,B)}}let R=l.get(E);R&&(_.Create(s,R.lightType),_.SetColor(s,M.fromValues(R.color.x,R.color.y,R.color.z)),_.SetCullingMask(s,R.cullingMask),_.SetIntensity(s,R.intensity),_.SetRange(s,R.range),_.SetShadows(s,R.shadows),R.lightType==0&&_.SetSpotAngle(s,R.spotAngle));let p=o.get(E);p&&(A.Create(s),A.SetCullingMask(s,p.cullingMask),p.projectionType==0?A.SetProjection(s,0,p.projectionFov,p.projectionAspectRatio,p.projectionNear,p.projectionFar):A.SetOrthographic(s,p.orthoLeft,p.orthoRight,p.orthoBottom,p.orthoTop,p.orthoNear,p.orthoFar));let V=u.get(E);V&&V.colliders.forEach(C=>{switch(C.colliderType){case"Box":{let d=S.CreateBox(s);S.SetBoxColliderCenter(d,M.fromValues(C.center.x,C.center.y,C.center.z)),S.SetBoxColliderSize(d,M.fromValues(C.size.x,C.size.y,C.size.z));break}case"Sphere":{let d=S.CreateSphere(s);S.SetSphereColliderCenter(d,M.fromValues(C.center.x,C.center.y,C.center.z)),S.SetSphereColliderRadius(d,C.radius);break}case"Capsule":{let d=S.CreateCapsule(s);S.SetCapsuleColliderCenter(d,M.fromValues(C.center.x,C.center.y,C.center.z)),S.SetCapsuleColliderRadius(d,C.radius),S.SetCapsuleColliderHeight(d,C.height);break}}});let L=g.get(E);L&&(T.Create(s),T.SetAngularDamping(s,L.angularDamping),T.SetIsKinematic(s,L.isKinematic),T.SetLinearDamping(s,L.linearDamping),T.SetMass(s,L.mass),T.SetUseGravity(s,L.useGravity));let H=c.get(E);H&&(h.Create(s),h.SetThrowOnDetach(s,H.throwOnDetach),h.SetTrackPosition(s,H.trackPosition),h.SetTrackRotation(s,H.trackRotation),h.SetTrackScale(s,H.trackScale),H.attachEntity&&h.SetAttachEntity(s,f.get(H.attachEntity)))}};export{A as CameraManager,S as ColliderManager,J as Debug,X as Device,O as EntityManager,h as GrabInteractableManager,W as Keyboard,_ as LightManager,ee as LightShadowMode,q as LightType,bt as LoadProject,x as MaterialManager,b as MeshManager,Oe as NewCubeMesh,Ue as NewQuadMesh,k as RenderableManager,Q as RendererManager,T as RigidbodyManager,a as RpcClient,N as SceneManager,ae as ShaderProperties,te as ShaderType,Y as StateSync,re as TextureFilterMode,ne as TextureFormat,w as TextureManager,le as TextureWrapMode,G as TransformManager,j as XRSystem,Ne as base64Decode,I as base64Encode};
1
+ var J=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});import{platform as ee}from"node:os";var K=ee()==="darwin"?J("./native-bindings-osx.node"):J("./native-bindings-win.node"),a=class i{static Init(){K.Rpc_RegisterCbHandler((e,t)=>{let n=JSON.parse(t),r=i.keyValueToObject(n.keys,n.values);try{i.callbackRegistry[e](r)}catch(l){console.error(`${l}`)}})}static RegisterCallback(e){let t=Number(i.Call("_RPC::AllocateCallback",{clientId:i.GetClientId()}));return i.callbackRegistry[t]=e,t}static Call(e,t){this.initialized||(this.initialized=!0,i.Init());let n={};for(let[r,l]of Object.entries(t))typeof l=="function"?n[r]=i.RegisterCallback(l):n[r]=l;return JSON.parse(K.Rpc_Call(e,JSON.stringify(this.objectToKeyValue(n)))).result}static GetClientId(){return Number(K.Rpc_GetClientId())}static objectToKeyValue(e){let t=Object.keys(e),n=t.map(r=>e[r]);return{keys:t,values:n}}static keyValueToObject(e,t){let n={};return e.forEach((r,l)=>{n[r]=t[l]}),n}static{this.callbackRegistry={}}static{this.initialized=!1}};var X=class{static OnCmdCallback(e){return a.Call("DebugWindow::GetCommand",{callback:e})}};var j=class{static GetLeftPosition(){return JSON.parse(a.Call("XRI Left/Position",{}))}static GetLeftRotation(){return JSON.parse(a.Call("XRI Left/Rotation",{}))}static GetLeftThumbstick(){return JSON.parse(a.Call("XRI Left/Thumbstick",{}))}static GetLeftSelect(){return JSON.parse(a.Call("XRI Left Interaction/Select Value",{}))}static GetLeftActivate(){return JSON.parse(a.Call("XRI Left Interaction/Activate Value",{}))}static GetLeftTurn(){return JSON.parse(a.Call("XRI Left Locomotion/Turn",{}))}static GetLeftSnapTurn(){return JSON.parse(a.Call("XRI Left Locomotion/Snap Turn",{}))}static GetLeftMove(){return JSON.parse(a.Call("XRI Left Locomotion/Move",{}))}static GetLeftGrabMove(){return JSON.parse(a.Call("XRI Left Locomotion/Grab Move",{}))}static GetRightPosition(){return JSON.parse(a.Call("XRI Right/Position",{}))}static GetRightRotation(){return JSON.parse(a.Call("XRI Right/Rotation",{}))}static GetRightThumbstick(){return JSON.parse(a.Call("XRI Right/Thumbstick",{}))}static GetRightSelect(){return JSON.parse(a.Call("XRI Right Interaction/Select Value",{}))}static GetRightActivate(){return JSON.parse(a.Call("XRI Right Interaction/Activate Value",{}))}static GetRightTurn(){return JSON.parse(a.Call("XRI Right Locomotion/Turn",{}))}static GetRightSnapTurn(){return JSON.parse(a.Call("XRI Right Locomotion/Snap Turn",{}))}static GetRightMove(){return JSON.parse(a.Call("XRI Right Locomotion/Move",{}))}static GetRightGrabMove(){return JSON.parse(a.Call("XRI Right Locomotion/Grab Move",{}))}static GetHeadPosition(){return JSON.parse(a.Call("XRI Head/Position",{}))}static GetHeadRotation(){return JSON.parse(a.Call("XRI Head/Rotation",{}))}static GetLeftWorldPosition(){return JSON.parse(a.Call("XRI Left/WorldPosition",{}))}static GetLeftWorldRotation(){return JSON.parse(a.Call("XRI Left/WorldRotation",{}))}static GetRightWorldPosition(){return JSON.parse(a.Call("XRI Right/WorldPosition",{}))}static GetRightWorldRotation(){return JSON.parse(a.Call("XRI Right/WorldRotation",{}))}static GetHeadWorldPosition(){return JSON.parse(a.Call("XRI Head/WorldPosition",{}))}static GetHeadWorldRotation(){return JSON.parse(a.Call("XRI Head/WorldRotation",{}))}},W=class{static{this.KEYCODE=Object.freeze({LEFT_EYE:"Left Eye",RIGHT_EYE:"Right Eye",LEFT_AIM:"Left Aim",RIGHT_AIM:"Right Aim",LEFT_GRIP:"Left Grip",RIGHT_GRIP:"Right Grip",LEFT_SQUEEZE:"Left Squeeze",RIGHT_SQUEEZE:"Right Squeeze",LEFT_TRIGGER:"Left Trigger",RIGHT_TRIGGER:"Right Trigger",LEFT_THUMBSTICK_X:"Left Thumbstick X",RIGHT_THUMBSTICK_X:"Right Thumbstick X",LEFT_THUMBSTICK_Y:"Left Thumbstick Y",RIGHT_THUMBSTICK_Y:"Right Thumbstick Y",LEFT_TRIGGER_TOUCH:"Left Trigger Touch",RIGHT_TRIGGER_TOUCH:"Right Trigger Touch",LEFT_THUMBSTICK_CLICK:"Left Thumbstick Click",RIGHT_THUMBSTICK_CLICK:"Right Thumbstick Click",LEFT_THUMBSTICK_TOUCH:"Left Thumbstick Touch",RIGHT_THUMBSTICK_TOUCH:"Right Thumbstick Touch",LEFT_X_CLICK:"Left X Click",LEFT_X_TOUCH:"Left X Touch",LEFT_Y_CLICK:"Left Y Click",LEFT_Y_TOUCH:"Left Y Touch",LEFT_MENU_CLICK:"Left Menu Click",RIGHT_A_CLICK:"Right A Click",RIGHT_A_TOUCH:"Right A Touch",RIGHT_B_CLIKC:"Right B Click",RIGHT_B_TOUCH:"Right B Touch",RIGHT_SYSTEM_CLICK:"Right System Click"})}},Y=class{static{this.MOUSE=Object.freeze({BUTTON_LEFT:0,BUTTON_RIGHT:1,BUTTON_MIDDLE:2})}static{this.KEYCODE=Object.freeze({SPACE:32,APOSTROPHE:39,COMMA:44,MINUS:45,PERIOD:46,SLASH:47,NUM_0:48,NUM_1:49,NUM_2:50,NUM_3:51,NUM_4:52,NUM_5:53,NUM_6:54,NUM_7:55,NUM_8:56,NUM_9:57,SEMICOLON:59,EQUAL:61,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,LEFT_BRACKET:91,BACKSLASH:92,RIGHT_BRACKET:93,GRAVE_ACCENT:96,WORLD_1:161,WORLD_2:162,ESCAPE:256,ENTER:257,TAB:258,BACKSPACE:259,INSERT:260,DELETE:261,RIGHT:262,LEFT:263,DOWN:264,UP:265,PAGE_UP:266,PAGE_DOWN:267,HOME:268,END:269,CAPS_LOCK:280,SCROLL_LOCK:281,NUM_LOCK:282,PRINT_SCREEN:283,PAUSE:284,F1:290,F2:291,F3:292,F4:293,F5:294,F6:295,F7:296,F8:297,F9:298,F10:299,F11:300,F12:301,F13:302,F14:303,F15:304,F16:305,F17:306,F18:307,F19:308,F20:309,F21:310,F22:311,F23:312,F24:313,F25:314,KP_0:320,KP_1:321,KP_2:322,KP_3:323,KP_4:324,KP_5:325,KP_6:326,KP_7:327,KP_8:328,KP_9:329,KP_DECIMAL:330,KP_DIVIDE:331,KP_MULTIPLY:332,KP_SUBTRACT:333,KP_ADD:334,KP_ENTER:335,KP_EQUAL:336,LEFT_SHIFT:340,LEFT_CONTROL:341,LEFT_ALT:342,LEFT_SUPER:343,RIGHT_SHIFT:344,RIGHT_CONTROL:345,RIGHT_ALT:346,RIGHT_SUPER:347,MENU:348})}static{this.ACTION=Object.freeze({RELEASE:0,PRESS:1,REPEAT:2})}static{this.MODIFIER=Object.freeze({SHIFT:1,CONTROL:2,ALT:4,SUPER:8,CAPS_LOCK:16,NUM_LOCK:32})}};var U=class{static Create(e){return Number(a.Call("Entity_Create",{name:e,clientId:a.GetClientId()}))}static Destroy(e){return!!a.Call("Entity_Destroy",{entityHandle:e})}static SetName(e,t){return!!a.Call("Entity_SetName",{entityHandle:e,name:t})}static GetName(e){return a.Call("Entity_GetName",{entityHandle:e})}};var _=class{static Create(e){return!!a.Call("GrabInteractableAPI_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("GrabInteractableAPI_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("GrabInteractableAPI_HasComponent",{entityHandle:e})}static GetTrackPosition(e){return!!a.Call("GrabInteractableAPI_GetTrackPosition",{entityHandle:e})}static SetTrackPosition(e,t){return!!a.Call("GrabInteractableAPI_SetTrackPosition",{entityHandle:e,isTracking:t})}static GetTrackRotation(e){return JSON.parse(a.Call("GrabInteractableAPI_GetTrackRotation",{entityHandle:e}))}static SetTrackRotation(e,t){return JSON.parse(a.Call("GrabInteractableAPI_SetTrackRotation",{entityHandle:e,isTracking:t}))}static GetTrackScale(e){return!!a.Call("GrabInteractableAPI_GetTrackScale",{entityHandle:e})}static SetTrackScale(e,t){return!!a.Call("GrabInteractableAPI_SetTrackScale",{entityHandle:e,isTracking:t})}static GetThrowOnDetach(e){return!!a.Call("GrabInteractableAPI_GetThrowOnDetach",{entityHandle:e})}static SetThrowOnDetach(e,t){return!!a.Call("GrabInteractableAPI_SetThrowOnDetach",{entityHandle:e,enable:t})}static GetAttachEntity(e){return!!a.Call("GrabInteractableAPI_GetAttachEntity",{entityHandle:e})}static SetAttachEntity(e,t){return!!a.Call("GrabInteractableAPI_SetAttachEntity",{entityHandle:e,attachEntityHandle:t})}static AddSelectEnteredCallback(e,t){return!!a.Call("GrabInteractableAPI_AddSelectEnteredCallback",{entityHandle:e,onSelectEntered:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddSelectExitedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddSelectExitedCallback",{entityHandle:e,onSelectExited:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddActivatedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddActivatedCallback",{entityHandle:e,onActivated:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddDeactivatedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddDeactivatedCallback",{entityHandle:e,onDeactivated:n=>{t(n.interactableEntity,n.interactorEntity)}})}};var q=class i{static{this.stateMap=new Map}static GetNetworkID(){return a.Call("_Main::GetNetworkPrefabIdByPid",{pid:process.pid})}static CreateNetworkState(e,t,n=()=>{}){let r=structuredClone(t);i.stateMap.set(e,r);let l=new Proxy(r,{get(o,u){return Reflect.get(o,u)},set(o,u,g){return Reflect.set(o,u,g),a.Call("_RPC::BroadcastState",{networkId:i.GetNetworkID(),key:e,payload:JSON.stringify({prop:u,value:g})}),!0}});return a.Call("_RPC::AddNewState",{networkId:i.GetNetworkID(),key:e,onReceived:o=>{console.log("onReceived: "+o.data);let u=i.stateMap.get(e);if(!u)return;let{prop:g,value:c}=JSON.parse(o.data);u[g]=c,n(g,c)}}),l}static IsStateAuthority(){return a.Call("_RPC:IsStateAuthority",{networkId:i.GetNetworkID()})}static GetPlayerId(){return a.Call("Multiplayer_GetPlayerId",{})}};import{vec3 as w}from"gl-matrix";var S=class{static CreateBox(e){return Number(a.Call("ColliderAPI_CreateBox",{entityHandle:e}))}static CreateSphere(e){return Number(a.Call("ColliderAPI_CreateSphere",{entityHandle:e}))}static CreateCapsule(e){return Number(a.Call("ColliderAPI_CreateCapsule",{entityHandle:e}))}static Destroy(e,t){return!!a.Call("ColliderAPI_Destroy",{entityHandle:e,colliderHandle:t})}static HasComponent(e,t){return!!a.Call("ColliderAPI_HasComponent",{entityHandle:e,colliderHandle:t})}static GetGameObject(e){return Number(a.Call("ColliderAPI_GetGameObject",{entityHandle:e}))}static GetBoxColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetBoxColliderCenter",{colliderHandle:e}));return w.fromValues(t[0],t[1],t[2])}static SetBoxColliderCenter(e,t){return a.Call("ColliderAPI_SetBoxColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetBoxColliderSize(e){let t=JSON.parse(a.Call("ColliderAPI_GetBoxColliderSize",{colliderHandle:e}));return w.fromValues(t[0],t[1],t[2])}static SetBoxColliderSize(e,t){return a.Call("ColliderAPI_SetBoxColliderSize",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetSphereColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetSphereColliderCenter",{colliderHandle:e}));return w.fromValues(t[0],t[1],t[2])}static SetSphereColliderCenter(e,t){return a.Call("ColliderAPI_SetSphereColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetSphereColliderRadius(e){return a.Call("ColliderAPI_GetSphereColliderRadius",{colliderHandle:e})}static SetSphereColliderRadius(e,t){return a.Call("ColliderAPI_SetSphereColliderRadius",{colliderHandle:e,radius:t})}static GetCapsuleColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetCapsuleColliderCenter",{colliderHandle:e}));return w.fromValues(t[0],t[1],t[2])}static SetCapsuleColliderCenter(e,t){return a.Call("ColliderAPI_SetCapsuleColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetCapsuleColliderRadius(e){return a.Call("ColliderAPI_GetCapsuleColliderRadius",{colliderHandle:e})}static SetCapsuleColliderRadius(e,t){return a.Call("ColliderAPI_SetCapsuleColliderRadius",{colliderHandle:e,radius:t})}static GetCapsuleColliderHeight(e){return a.Call("ColliderAPI_GetCapsuleColliderHeight",{colliderHandle:e})}static SetCapsuleColliderHeight(e,t){return a.Call("ColliderAPI_SetCapsuleColliderHeight",{colliderHandle:e,height:t})}static GetIsTrigger(e){return!!a.Call("ColliderAPI_GetIsTrigger",{entityHandle:e})}static SetIsTrigger(e,t){return!!a.Call("ColliderAPI_SetIsTrigger",{colliderHandle:e,isTrigger:t})}static AddTriggerEnterCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerEnterCallback",{entityHandle:e,onTriggerEnter:t})}static AddTriggerExitCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerExitCallback",{entityHandle:e,onTriggerExit:t})}static AddTriggerStayCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerStayCallback",{entityHandle:e,onTriggerStay:t})}};var h=class{static Create(e){return!!a.Call("RidigbodyAPI_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("RidigbodyAPI_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("RidigbodyAPI_HasComponent",{entityHandle:e})}static GetIsKinematic(e){return!!a.Call("RidigbodyAPI_GetIsKinematic",{entityHandle:e})}static SetIsKinematic(e,t){return!!a.Call("RidigbodyAPI_SetIsKinematic",{entityHandle:e,isKinematic:t})}static GetUseGravity(e){return!!a.Call("RidigbodyAPI_GetUseGravity",{entityHandle:e})}static SetUseGravity(e,t){return!!a.Call("RidigbodyAPI_SetUseGravity",{entityHandle:e,useGravity:t})}static GetMass(e){return Number(a.Call("RidigbodyAPI_GetMass",{entityHandle:e}))}static SetMass(e,t){return!!a.Call("RidigbodyAPI_SetMass",{entityHandle:e,mass:t})}static GetLinearDamping(e){return Number(a.Call("RidigbodyAPI_GetLinearDamping",{entityHandle:e}))}static SetLinearDamping(e,t){return!!a.Call("RidigbodyAPI_SetLinearDamping",{entityHandle:e,linearDamping:t})}static GetAngularDamping(e){return Number(a.Call("RidigbodyAPI_GetAngularDamping",{entityHandle:e}))}static SetAngularDamping(e,t){return!!a.Call("RidigbodyAPI_SetAngularDamping",{entityHandle:e,angularDamping:t})}};var A=class{static Create(e){return!!a.Call("Camera_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("Camera_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Camera_HasComponent",{entityHandle:e})}static SetProjection(e,t,n,r,l,o){return!!a.Call("Camera_SetProjection",{entityHandle:e,projectionType:t,fov:n,aspect:r,near:l,far:o})}static SetOrthographic(e,t,n,r,l,o,u){return!!a.Call("Camera_SetOrthographic",{entityHandle:e,left:t,right:n,bottom:r,top:l,near:o,far:u})}static LookAt(e,t,n,r,l,o,u,g,c,I){return!!a.Call("Camera_LookAt",{entityHandle:e,targetX:t,targetY:n,targetZ:r,upX:l,upY:o,upZ:u,worldUpX:g,worldUpY:c,worldUpZ:I})}static SetCullingMask(e,t){return!!a.Call("Camera_SetCullingMask",{entityHandle:e,mask:t})}static SetRenderTexture(e,t){return!!a.Call("Camera_SetRenderTexture",{entityHandle:e,renderTextureHandle:t})}};var f=class{static Create(e,t){return!!a.Call("Light_Create",{entityHandle:e,lightType:t})}static Destroy(e){return!!a.Call("Light_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Light_HasComponent",{entityHandle:e})}static SetType(e,t){return!!a.Call("Light_SetType",{entityHandle:e,lightType:t})}static SetColor(e,t){return!!a.Call("Light_SetColor",{entityHandle:e,r:t[0],g:t[1],b:t[2]})}static SetIntensity(e,t){return!!a.Call("Light_SetIntensity",{entityHandle:e,intensity:t})}static SetRange(e,t){return!!a.Call("Light_SetRange",{entityHandle:e,range:t})}static SetSpotAngle(e,t,n=!0){return!!a.Call("Light_SetSpotAngle",{entityHandle:e,angle:t,value:n})}static SetShadows(e,t){return!!a.Call("Light_SetShadows",{entityHandle:e,shadowType:t})}static SetCullingMask(e,t){return!!a.Call("Light_SetCullingMask",{entityHandle:e,mask:t})}},te=(n=>(n[n.NoShadows=0]="NoShadows",n[n.Hard=1]="Hard",n[n.Soft=2]="Soft",n))(te||{}),Q=(r=>(r[r.Spot=0]="Spot",r[r.Directional=1]="Directional",r[r.Point=2]="Point",r[r.Area=3]="Area",r))(Q||{});var ae=(e=>(e.URP_LIT="Universal Render Pipeline/Lit",e))(ae||{}),ne=(m=>(m.BaseMap="_BaseMap",m.BaseColor="_BaseColor",m.Cutoff="_Cutoff",m.Smoothness="_Smoothness",m.SmoothnessTextureChannel="_SmoothnessTextureChannel",m.Metallic="_Metallic",m.MetallicGlossMap="_MetallicGlossMap",m.SpecColor="_SpecColor",m.SpecGlossMap="_SpecGlossMap",m.SpecularHighlights="_SpecularHighlights",m.EnvironmentReflections="_EnvironmentReflections",m.BumpScale="_BumpScale",m.BumpMap="_BumpMap",m.Parallax="_Parallax",m.ParallaxMap="_ParallaxMap",m.OcclusionStrength="_OcclusionStrength",m.OcclusionMap="_OcclusionMap",m.EmissionColor="_EmissionColor",m.EmissionMap="_EmissionMap",m.DetailMask="_DetailMask",m.DetailAlbedoMapScale="_DetailAlbedoMapScale",m.DetailAlbedoMap="_DetailAlbedoMap",m.DetailNormalMapScale="_DetailNormalMapScale",m.DetailNormalMap="_DetailNormalMap",m))(ne||{}),x=class{static Create(e="Universal Render Pipeline/Lit",t,n=0){let r=Number(a.Call("Material_Create",{shaderName:e,clientId:a.GetClientId()}));return t!==void 0&&a.Call("Renderable_SetMaterial",{entityHandle:t,materialHandle:r,index:n}),r}static Destroy(e){return!!a.Call("Material_Destroy",{materialHandle:e})}static CreateInstance(e){return Number(a.Call("Material_CreateInstance",{materialHandle:e,clientId:a.GetClientId()}))}static SetFloat(e,t,n){return!!a.Call("Material_SetFloat",{materialHandle:e,propertyName:t,value:n})}static SetVector(e,t,n){return!!a.Call("Material_SetVector",{materialHandle:e,propertyName:t,x:n[0],y:n[1],z:n[2],w:n[3]})}static SetColor(e,t,n){return!!a.Call("Material_SetColor",{materialHandle:e,propertyName:t,r:n[0],g:n[1],b:n[2],a:n[3]})}static SetTexture(e,t,n){return!!a.Call("Material_SetTexture",{materialHandle:e,propertyName:t,textureHandle:n})}static GetFloat(e,t){return Number(a.Call("Material_GetFloat",{materialHandle:e,propertyName:t}))}static GetColor(e,t){return a.Call("Material_GetColor",{materialHandle:e,propertyName:t})}};var P="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<P.length;i++)v[P.charCodeAt(i)]=i;var T=i=>{let e=new Uint8Array(i),t,n=e.length,r="";for(t=0;t<n;t+=3)r+=P[e[t]>>2],r+=P[(e[t]&3)<<4|e[t+1]>>4],r+=P[(e[t+1]&15)<<2|e[t+2]>>6],r+=P[e[t+2]&63];return n%3===2?r=r.substring(0,r.length-1)+"=":n%3===1&&(r=r.substring(0,r.length-2)+"=="),r},Be=i=>{let e=i.length*.75,t=i.length,n,r=0,l,o,u,g;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);let c=new ArrayBuffer(e),I=new Uint8Array(c);for(n=0;n<t;n+=4)l=v[i.charCodeAt(n)],o=v[i.charCodeAt(n+1)],u=v[i.charCodeAt(n+2)],g=v[i.charCodeAt(n+3)],I[r++]=l<<2|o>>4,I[r++]=(o&15)<<4|u>>2,I[r++]=(u&3)<<6|g&63;return c};var b=class{static Create(e){let t=Number(a.Call("Mesh_Create",{clientId:a.GetClientId()}));return e!==void 0&&a.Call("Renderable_SetMesh",{entityHandle:e,meshHandle:t}),t}static Destroy(e){return!!a.Call("Mesh_Destroy",{meshHandle:e})}static SetVertices(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let l=0;l<t.length;l++){let o=t[l];r[l*3]=o[0],r[l*3+1]=o[1],r[l*3+2]=o[2]}n=T(r.buffer)}return!!a.Call("Mesh_SetVertices",{meshHandle:e,base64Vertices:n})}static SetTriangles(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let l=0;l<t.length;l++){let o=t[l];r[l*3]=o[0],r[l*3+1]=o[1],r[l*3+2]=o[2]}n=T(r.buffer)}return!!a.Call("Mesh_SetTriangles",{meshHandle:e,base64Triangles:n})}static SetUVs(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*2);for(let l=0;l<t.length;l++){let o=t[l];r[l*2]=o[0],r[l*2+1]=o[1]}n=T(r.buffer)}return!!a.Call("Mesh_SetUVs",{meshHandle:e,base64Uvs:n})}static SetNormals(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let l=0;l<t.length;l++){let o=t[l];r[l*3]=o[0],r[l*3+1]=o[1],r[l*3+2]=o[2]}n=T(r.buffer)}return!!a.Call("Mesh_SetNormals",{meshHandle:e,base64Normals:n})}static RecalcNormals(e){return!!a.Call("Mesh_RecalculateNormals",{meshHandle:e})}static RecalcBounds(e){return!!a.Call("Mesh_RecalculateBounds",{meshHandle:e})}};function Ue(){let i=[[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5],[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5]],e=[[0,2,1],[0,3,2],[4,5,6],[4,6,7],[0,1,5],[0,5,4],[3,7,6],[3,6,2],[0,4,7],[0,7,3],[1,2,6],[1,6,5]],t=b.Create();return b.SetVertices(t,i),b.SetTriangles(t,e),b.RecalcNormals(t),b.RecalcBounds(t),t}function we(){let i=[[-.5,-.5,0],[.5,-.5,0],[.5,.5,0],[-.5,.5,0]],e=[[0,1],[1,1],[1,0],[0,0]],t=[[0,2,1],[0,3,2]],n=b.Create();return b.SetVertices(n,i),b.SetUVs(n,e),b.SetTriangles(n,t),b.RecalcNormals(n),b.RecalcBounds(n),n}var k=class i{static Create(e){return!!a.Call("Renderable_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("Renderable_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Renderable_HasComponent",{entityHandle:e})}static SetMesh(e,t){return i.HasComponent(e)?!!a.Call("Renderable_SetMesh",{entityHandle:e,meshHandle:t}):!1}static SetMaterial(e,t,n=0){return!!a.Call("Renderable_SetMaterial",{entityHandle:e,materialHandle:t,index:n})}static SetLayerMask(e,t){return!!a.Call("Renderable_SetLayerMask",{entityHandle:e,layerMask:t})}static SetReceiveShadows(e,t){return!!a.Call("Renderable_SetReceiveShadows",{entityHandle:e,receive:t})}static SetCastShadows(e,t){return!!a.Call("Renderable_SetCastShadows",{entityHandle:e,shadowMode:t})}static SetCulling(e,t){return!!a.Call("Renderable_SetCulling",{entityHandle:e,enabled:t})}};var re=(c=>(c[c.Alpha8=1]="Alpha8",c[c.ARGB4444=2]="ARGB4444",c[c.RGB24=3]="RGB24",c[c.RGBA32=4]="RGBA32",c[c.ARGB32=5]="ARGB32",c[c.RGB565=7]="RGB565",c[c.R16=9]="R16",c[c.DXT1=10]="DXT1",c[c.DXT5=12]="DXT5",c))(re||{}),F=class{static Create2D(e,t,n){return Number(a.Call("Texture_Create2D",{width:e,height:t,format:n,clientId:a.GetClientId()}))}static Create2DForMaterial(e,t,n,r,l){let o=Number(a.Call("Texture_Create2D",{width:e,height:t,format:n,clientId:a.GetClientId()}));return a.Call("Material_SetTexture",{materialHandle:r,propertyName:l,textureHandle:o}),o}static CreateRenderTexture(e,t,n,r){return Number(a.Call("Texture_CreateRenderTexture",{width:e,height:t,depth:n,format:r,clientId:a.GetClientId()}))}static Destroy(e){return!!a.Call("Texture_Destroy",{textureHandle:e})}static LoadRawTextureData(e,t,n,r){let l=T(t);return!!a.Call("Texture_LoadRawTextureData",{textureHandle:e,base64Rgba:l,width:n,height:r})}static LoadImage(e,t){let n=T(t);return!!a.Call("Texture_LoadImage",{textureHandle:e,base64Image:n})}static LoadImageBase64(e,t){return!!a.Call("Texture_LoadImage",{textureHandle:e,base64Image:t})}static SetFilterMode(e,t){return!!a.Call("Texture_SetFilterMode",{textureHandle:e,filterMode:t})}static SetWrapMode(e,t){return!!a.Call("Texture_SetWrapMode",{textureHandle:e,wrapMode:t})}},le=(o=>(o[o.NEAREST=0]="NEAREST",o[o.LINEAR=1]="LINEAR",o[o.NEAREST_MIPMAP_NEAREST=2]="NEAREST_MIPMAP_NEAREST",o[o.LINEAR_MIPMAP_NEAREST=3]="LINEAR_MIPMAP_NEAREST",o[o.NEAREST_MIPMAP_LINEAR=4]="NEAREST_MIPMAP_LINEAR",o[o.LINEAR_MIPMAP_LINEAR=5]="LINEAR_MIPMAP_LINEAR",o))(le||{}),oe=(n=>(n[n.CLAMP_TO_EDGE=0]="CLAMP_TO_EDGE",n[n.REPEAT=1]="REPEAT",n[n.MIRRORED_REPEAT=2]="MIRRORED_REPEAT",n))(oe||{});var N=class{static GetDefault(){return Number(a.Call("Scene_GetDefault",{}))}static SetSkybox(e,t){return!!a.Call("Scene_SetSkybox",{sceneHandle:e,skyboxHandle:t})}static SetAmbientLight(e,t,n,r,l){return!!a.Call("Scene_SetAmbientLight",{sceneHandle:e,r:t,g:n,b:r,intensity:l})}static SetFog(e,t,n,r,l,o){return!!a.Call("Scene_SetFog",{sceneHandle:e,enabled:t,mode:n,density:r,start:l,end:o})}};var Z=class{static GetDefaultCameraEntity(){return console.warn("GetDefaultCameraEntity(): Unity RPC not available"),-1}static GetXRCameras(){return console.warn("GetXRCameras(): Unity RPC not available"),[]}static DestroyMaterialInstance(e){return x.Destroy(e)}static DestroyRenderTarget(e){return F.Destroy(e)}static DestroySkybox(e){return x.Destroy(e)}static DestroyIndirectLight(e){return console.warn("DestroyIndirectLight(): no Unity RPC equivalent"),!1}static SetSkybox(e,t){return N.SetSkybox(e,t)}static SetAmbientLight(e,t,n,r,l){return N.SetAmbientLight(e,t,n,r,l)}static SetFog(e,t,n,r,l,o){return N.SetFog(e,t,n,r,l,o)}};import{mat4 as ie,quat as $,vec3 as V}from"gl-matrix";var G=class{static HasComponent(e){return!!a.Call("Transform_HasComponent",{entityHandle:e})}static SetTransform(e,t){let n=new Array(16);for(let l=0;l<4;l++)for(let o=0;o<4;o++){let u=t[l*4+o];o===2&&(u=-u),n[o*4+l]=u}let r=n.join(",");return!!a.Call("Transform_SetTransform",{entityHandle:e,matrixJson:r})}static GetTransform(e){let n=a.Call("Transform_GetTransform",{entityHandle:e}).split(",").map(r=>parseFloat(r));if(n.length!==16)throw new Error(`Invalid transform data (${n.length} elements)`);return ie.fromValues(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}static SetParent(e,t){return!!a.Call("Transform_SetParent",{entityHandle:e,parentHandle:t})}static GetParent(e){return Number(a.Call("Transform_GetParent",{entityHandle:e}))}static SetWorldPosition(e,t){return!!a.Call("Transform_SetWorldPosition",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static SetLocalPosition(e,t){return!!a.Call("Transform_SetLocalPosition",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static GetWorldPosition(e){let t=a.Call("Transform_GetWorldPosition",{entityHandle:e}),[n,r,l]=t.split(",").map(o=>parseFloat(o));return V.fromValues(n,r,l)}static GetLocalPosition(e){let t=a.Call("Transform_GetLocalPosition",{entityHandle:e}),[n,r,l]=t.split(",").map(o=>parseFloat(o));return V.fromValues(n,r,l)}static SetWorldRotation(e,t){return!!a.Call("Transform_SetWorldRotation",{entityHandle:e,x:t[0],y:t[1],z:t[2],w:t[3]})}static SetLocalRotation(e,t){return!!a.Call("Transform_SetLocalRotation",{entityHandle:e,x:t[0],y:t[1],z:t[2],w:t[3]})}static GetWorldRotation(e){let t=a.Call("Transform_GetWorldRotation",{entityHandle:e}),[n,r,l,o]=t.split(",").map(u=>parseFloat(u));return $.fromValues(n,r,l,o)}static GetLocalRotation(e){let t=a.Call("Transform_GetLocalRotation",{entityHandle:e}),[n,r,l,o]=t.split(",").map(u=>parseFloat(u));return $.fromValues(n,r,l,o)}static SetLocalScale(e,t){return!!a.Call("Transform_SetLocalScale",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static GetLocalScale(e){let t=a.Call("Transform_GetLocalScale",{entityHandle:e}),[n,r,l]=t.split(",").map(o=>parseFloat(o));return V.fromValues(n,r,l)}};import{quat as se,vec3 as M}from"gl-matrix";var dt=async(i,e)=>{let t=e.scene,n=new Map(t.properties.value),r=new Map(t.transforms.value),l=new Map(t.renderables.value),o=new Map(t.lights.value),u=new Map(t.cameras.value),g=new Map(t.colliders.value),c=new Map(t.rigidbodies.value),I=new Map(t.grabbles.value),D=new Map;for(let E of t.entities.value){let s=n.get(E),y=U.Create(s.name);D.set(E,y)}for(let E of t.entities.value){let s=D.get(E),y=r.get(E);if(y)y.parent!=="00000000-0000-0000-0000-000000000000"&&G.SetParent(s,D.get(y.parent)),G.SetLocalPosition(s,M.fromValues(y.localPosition.value[0],y.localPosition.value[1],y.localPosition.value[2])),G.SetLocalScale(s,M.fromValues(y.localScale.value[0],y.localScale.value[1],y.localScale.value[2])),G.SetLocalRotation(s,se.fromEuler([0,0,0,0],y.localRotation.value.x,y.localRotation.value.y,y.localRotation.value.z,"xyz"));else throw Error(`Data corrupted. Entity ${E} has no transform`);let O=l.get(E);if(O&&O.mesh&&O.material){k.Create(s);let C=i.get(O.mesh);if(C)for(let d of C.meshPrimitives){let B=b.Create();b.SetVertices(B,d.base64Vertices),b.SetTriangles(B,d.base64Indices),d.base64Uvs&&b.SetUVs(B,C.base64Uvs),d.base64Normals&&b.SetNormals(B,d.base64Normals),k.SetMesh(s,B)}}let R=o.get(E);R&&(f.Create(s,R.lightType),f.SetColor(s,M.fromValues(R.color.x,R.color.y,R.color.z)),f.SetCullingMask(s,R.cullingMask),f.SetIntensity(s,R.intensity),f.SetRange(s,R.range),f.SetShadows(s,R.shadows),R.lightType==0&&f.SetSpotAngle(s,R.spotAngle));let p=u.get(E);p&&(A.Create(s),A.SetCullingMask(s,p.cullingMask),p.projectionType==0?A.SetProjection(s,0,p.projectionFov,p.projectionAspectRatio,p.projectionNear,p.projectionFar):A.SetOrthographic(s,p.orthoLeft,p.orthoRight,p.orthoBottom,p.orthoTop,p.orthoNear,p.orthoFar));let z=g.get(E);z&&z.colliders.forEach(C=>{switch(C.colliderType){case"Box":{let d=S.CreateBox(s);S.SetBoxColliderCenter(d,M.fromValues(C.center.x,C.center.y,C.center.z)),S.SetBoxColliderSize(d,M.fromValues(C.size.x,C.size.y,C.size.z));break}case"Sphere":{let d=S.CreateSphere(s);S.SetSphereColliderCenter(d,M.fromValues(C.center.x,C.center.y,C.center.z)),S.SetSphereColliderRadius(d,C.radius);break}case"Capsule":{let d=S.CreateCapsule(s);S.SetCapsuleColliderCenter(d,M.fromValues(C.center.x,C.center.y,C.center.z)),S.SetCapsuleColliderRadius(d,C.radius),S.SetCapsuleColliderHeight(d,C.height);break}}});let L=c.get(E);L&&(h.Create(s),h.SetAngularDamping(s,L.angularDamping),h.SetIsKinematic(s,L.isKinematic),h.SetLinearDamping(s,L.linearDamping),h.SetMass(s,L.mass),h.SetUseGravity(s,L.useGravity));let H=I.get(E);H&&(_.Create(s),_.SetThrowOnDetach(s,H.throwOnDetach),_.SetTrackPosition(s,H.trackPosition),_.SetTrackRotation(s,H.trackRotation),_.SetTrackScale(s,H.trackScale),H.attachEntity&&_.SetAttachEntity(s,D.get(H.attachEntity)))}};export{A as CameraManager,S as ColliderManager,X as Debug,j as Device,U as EntityManager,_ as GrabInteractableManager,Y as Keyboard,f as LightManager,te as LightShadowMode,Q as LightType,dt as LoadProject,x as MaterialManager,b as MeshManager,Ue as NewCubeMesh,we as NewQuadMesh,k as RenderableManager,Z as RendererManager,h as RigidbodyManager,a as RpcClient,N as SceneManager,ne as ShaderProperties,ae as ShaderType,q as StateSync,le as TextureFilterMode,re as TextureFormat,F as TextureManager,oe as TextureWrapMode,G as TransformManager,W as XRSystem,Be as base64Decode,T as base64Encode};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jack120/test",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Adamas Typescript interface",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/types/lib.d.ts CHANGED
@@ -1136,6 +1136,6 @@ export declare class TransformManager {
1136
1136
  }
1137
1137
  export declare const base64Encode: (arraybuffer: ArrayBufferLike) => string;
1138
1138
  export declare const base64Decode: (base64: string) => ArrayBufferLike;
1139
- export declare const LoadProject: (projectFile: any) => Promise<void>;
1139
+ export declare const LoadProject: (assetRecord: Map<string, object>, projectFile: any) => Promise<void>;
1140
1140
 
1141
1141
  export {};