@needle-tools/engine 4.8.6-next.7fdd4fa → 4.8.6-next.f3ce848

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.
@@ -141,7 +141,7 @@ void main(){
141
141
  #__vconsole .vc-mask {
142
142
  overflow: hidden;
143
143
  }
144
- `,sr?.prepend(i),o===!0&&ib()<=0&&Mb(),console.log("\u{1F335} Debug console has loaded")}},e.onerror=()=>{console.warn("\u{1F335} Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),Ul=!1,Ni=null},e.src="https://cdn.jsdelivr.net/npm/vconsole@3.15.1/dist/vconsole.min.js",document.body.appendChild(e)}function VP(){if(!globalThis.VConsole)return;const o=new VConsole.VConsolePlugin("needle-console","\u{1F335} Inspect glTF"),e=()=>document.querySelector("#__vc_plug_"+o._id+" iframe");return o.on("renderTab",function(t){const i=globalThis["needle:codegen_files"];if(!i||i.length===0)return;let n=globalThis["needle:codegen_files"][0];const s=n.indexOf("?");s>-1&&(n=n.substring(0,s));const r=location.protocol+"//"+location.host+location.pathname+"/"+n,a=encodeURIComponent(r);o.fullUrl="https://viewer.needle.tools?inspect&file="+a;var l='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(l)}),o.on("show",function(){const t=e();t&&t.src!==o.fullUrl&&(t.src=o.fullUrl)}),o.on("hide",function(){const t=e();t&&(t.src="")}),o.on("addTopBar",function(t){var i=new Array;i.push({name:"Open in new window \u2197",onClick:function(n){window.open(o.fullUrl,"_blank"),Ni?.hide()}}),i.push({name:"Reload",onClick:function(n){const s=e();s&&(s.src=o.fullUrl)}}),i.push({name:"Fullscreen",onClick:function(n){const s=e();s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen instanceof Function&&s.webkitRequestFullscreen()}}),t(i)}),o}function $P(){return document.querySelector("#__vconsole .vc-switch")||null}function HP(){return document.querySelector("#__vconsole")||null}const Tb=w("debugdefines");as('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";'),as('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";'),as('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";'),as('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";'),as('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.8.6";'),as('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),as('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Thu Aug 21 2025 19:35:23 GMT+0000 (Coordinated Universal Time)";'),as('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const pn="4.8.6",dd="undefined",Om="Thu Aug 21 2025 19:35:23 GMT+0000 (Coordinated Universal Time)";Tb&&console.log(`Engine version: ${pn} (generator: ${dd})
144
+ `,sr?.prepend(i),o===!0&&ib()<=0&&Mb(),console.log("\u{1F335} Debug console has loaded")}},e.onerror=()=>{console.warn("\u{1F335} Debug console failed to load."+(window.crossOriginIsolated?"This page is using cross-origin isolation, so external scripts can't be loaded.":"")),Ul=!1,Ni=null},e.src="https://cdn.jsdelivr.net/npm/vconsole@3.15.1/dist/vconsole.min.js",document.body.appendChild(e)}function VP(){if(!globalThis.VConsole)return;const o=new VConsole.VConsolePlugin("needle-console","\u{1F335} Inspect glTF"),e=()=>document.querySelector("#__vc_plug_"+o._id+" iframe");return o.on("renderTab",function(t){const i=globalThis["needle:codegen_files"];if(!i||i.length===0)return;let n=globalThis["needle:codegen_files"][0];const s=n.indexOf("?");s>-1&&(n=n.substring(0,s));const r=location.protocol+"//"+location.host+location.pathname+"/"+n,a=encodeURIComponent(r);o.fullUrl="https://viewer.needle.tools?inspect&file="+a;var l='<iframe src="" style="width: 100%; height: 99%; border: none;"></iframe>';t(l)}),o.on("show",function(){const t=e();t&&t.src!==o.fullUrl&&(t.src=o.fullUrl)}),o.on("hide",function(){const t=e();t&&(t.src="")}),o.on("addTopBar",function(t){var i=new Array;i.push({name:"Open in new window \u2197",onClick:function(n){window.open(o.fullUrl,"_blank"),Ni?.hide()}}),i.push({name:"Reload",onClick:function(n){const s=e();s&&(s.src=o.fullUrl)}}),i.push({name:"Fullscreen",onClick:function(n){const s=e();s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen instanceof Function&&s.webkitRequestFullscreen()}}),t(i)}),o}function $P(){return document.querySelector("#__vconsole .vc-switch")||null}function HP(){return document.querySelector("#__vconsole")||null}const Tb=w("debugdefines");as('if(!globalThis["NEEDLE_ENGINE_VERSION"]) globalThis["NEEDLE_ENGINE_VERSION"] = "0.0.0";'),as('if(!globalThis["NEEDLE_ENGINE_GENERATOR"]) globalThis["NEEDLE_ENGINE_GENERATOR"] = "unknown";'),as('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUILD_TIME"] = "unknown";'),as('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";'),as('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.8.6";'),as('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";'),as('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Tue Aug 26 2025 08:09:54 GMT+0000 (Coordinated Universal Time)";'),as('globalThis["__NEEDLE_PUBLIC_KEY__"] = "'+NEEDLE_PUBLIC_KEY+'";');const pn="4.8.6",dd="undefined",Om="Tue Aug 26 2025 08:09:54 GMT+0000 (Coordinated Universal Time)";Tb&&console.log(`Engine version: ${pn} (generator: ${dd})
145
145
  Project built at ${Om}`);const ma=NEEDLE_PUBLIC_KEY,fo="needle_isActiveInHierarchy",rr="builtin_components",zl="needle_editor_guid";function as(o){try{(0,eval)(o)}catch(e){Tb&&console.error(e)}}let Eb,Ab=null;function mn(){return Eb}function km(o){if(o==null){console.warn("Oh no: someone tried registering a non-existend gltf-loader. When you see this log it might mean that needle-engine is being imported multiple times. Please check your project setup.");return}Ab!==o&&(Ab=o,Eb=new o)}const _i=Symbol("shadowDomOwner"),GP=w("debugpatch");function ud(o,e,t,i){const n=GP===e;if(!t&&!i)return;const s=e+"___needle";XP(o,e,t,i);const r=Object.getOwnPropertyDescriptor(o,e),a=o[e];n&&console.log("Patch",o.constructor.name,e,r,a),r?(n&&console.log("Apply patch with existing descriptor",o.constructor.name,e,r),typeof r.value=="function"&&(o[e]=Lb(r.value,o,e))):(n&&console.log("Create patch with new property",o.constructor.name,e,r),Object.defineProperty(o,e,{set:function(l){if(typeof l=="function")this[s]=Lb(l,o,e);else{const c=this[s];jb(o,e,this,c,l),this[s]=l,Db(o,e,this,c,l)}},get:function(){const l=this[s];return typeof l=="function"&&l[s]?l[s]:l}}))}function qP(o,e,t){const i=Rm(o,e);if(i)for(let n=i.length-1;n>=0;n--){const s=i[n];s.prefix===t&&(s.prefix=null),s.postfix===t&&(s.postfix=null),!s.prefix&&!s.postfix&&i.splice(n,1)}}const Ib=Symbol("Needle:Patches:WrappedFunction");function Lb(o,e,t){if(o[Ib])return o;const i=function(...n){jb(e,t,this,...n);const s=o.apply(this,n);return Db(e,t,this,s,...n),s};return i[Ib]=!0,i}const pd="Needle:Patches";function Mm(){return globalThis[pd]||(globalThis[pd]=new WeakMap),globalThis[pd]}function Rm(o,e){const t=Mm().get(o);return t?t.get(e):null}function XP(o,e,t,i){let n=Mm().get(o);n||(n=new Map,Mm().set(o,n));let s=n.get(e);s||(s=[],n.set(e,s)),s.push({prefix:t,postfix:i})}function jb(o,e,t,...i){if(!t)return;const n=Rm(o,e);if(n)for(const s of n)s.prefix?.call(t,...i)}function Db(o,e,t,i,...n){if(!t)return;const s=Rm(o,e);if(s)for(const r of s)r.postfix?.call(t,i,...n)}const ga=[];function md(o){ga.indexOf(o)===-1&&ga.push(o)}function QP(o){const e=ga.indexOf(o);e!==-1&&ga.splice(e,1)}const fa=[];function Tm(o){fa.indexOf(o)===-1&&fa.push(o)}function YP(o){const e=fa.indexOf(o);e!==-1&&fa.splice(e,1)}function Bb(o){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-start",{detail:o}));for(let e=0;e<ga.length;e++)ga[e](o)}function Fb(o){globalThis.dispatchEvent(new CustomEvent("needle-xrsession-end",{detail:o}));for(let e=0;e<fa.length;e++)fa[e](o)}const it=w("debuginput");var gd=(o=>(o.Mouse="mouse",o.Touch="touch",o.Controller="controller",o.Hand="hand",o))(gd||{}),Ee=(o=>(o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerMove="pointermove",o.KeyDown="keydown",o.KeyUp="keyup",o.KeyPressed="keypress",o))(Ee||{});class yo extends PointerEvent{clientZ;deviceIndex;origin;source;mode;get isSpatial(){return this.mode!="screen"}get ray(){return this._ray||(this._ray=new ts(this.space.worldPosition.clone(),this.space.worldForward.clone())),this._ray}set ray(e){this._ray=e}get hasRay(){return this._ray!==void 0}_ray;space;isClick=!1;isDoubleClick=!1;get used(){return this._used}_used=!1;use(){this._used=!0}get pointerId(){return this._pointerid}_pointerid;get pointerType(){return this._pointerType}_pointerType;get type(){return this._type}_type;metadata={};intersections=new Array;constructor(e,t,i){super(e,i),this.clientZ=i.clientZ,this._pointerid=i.pointerId,this._pointerType=i.pointerType,this._type=e,this.deviceIndex=i.deviceIndex,this.origin=i.origin,this.source=t,this.mode=i.mode,this._ray=i.ray,this.space=i.device}_immediatePropagationStopped=!1;get immediatePropagationStopped(){return this._immediatePropagationStopped}_propagationStopped=!1;get propagationStopped(){return this._immediatePropagationStopped||this._propagationStopped}stopImmediatePropagation(){this._immediatePropagationStopped=!0,super.stopImmediatePropagation(),this.source?.stopImmediatePropagation()}stopPropagation(){this._propagationStopped=!0,super.stopPropagation(),this.source?.stopPropagation(),it&&console.warn("Stop propagation...",this.pointerId,this.pointerType)}}class Nl extends KeyboardEvent{source;constructor(e,t,i){super(e,i),this.source=t}stopImmediatePropagation(){super.stopImmediatePropagation(),this.source?.stopImmediatePropagation()}}class KP{key;keyType;source;constructor(e){this.key=e.key,this.keyType=e.type,this.source=e}}var Jt=(o=>(o[o.Early=-100]="Early",o[o.Default=0]="Default",o[o.Late=100]="Late",o))(Jt||{});class Ub{_eventListeners={};addEventListener(e,t,i){if(this._eventListeners[e]||(this._eventListeners[e]=[]),!t||typeof t!="function"){console.error("Invalid call to addEventListener: callback is required and must be a function!");return}i?i={...i}:i={};let n=0;i?.queue!=null&&(n=i.queue);const s=this._eventListeners[e],r=s.find(a=>a.priority===n);r?r.listeners.push({callback:t,options:i}):(s.push({priority:n,listeners:[{callback:t,options:i}]}),s.sort((a,l)=>a.priority-l.priority))}removeEventListener(e,t,i){if(!this._eventListeners[e]||!t)return;const n=this._eventListeners[e];if(i?.queue!=null){const s=n.find(a=>a.priority===i.queue);if(!s)return;const r=s.listeners.findIndex(a=>a.callback===t);r>=0&&s.listeners.splice(r,1)}else for(const s of n){const r=s.listeners.findIndex(a=>a.callback===t);r>=0&&s.listeners.splice(r,1)}}dispatchEvent(e){let t=!1;if(e instanceof Nl){const i=this._eventListeners[e.type];if(i)for(const n of i)for(let s=0;s<n.listeners.length;s++){const r=n.listeners[s];if(r.options?.signal?.aborted){n.listeners.splice(s,1),s--;continue}r.options.once&&(n.listeners.splice(s,1),s--),r.callback(e)}}if(e instanceof yo){const i=this._eventListeners[e.type];if(i)for(const n of i){if(t)break;for(let s=0;s<n.listeners.length;s++){const r=n.listeners[s];if(r.options?.signal?.aborted){n.listeners.splice(s,1),s--;continue}if(e.immediatePropagationStopped){t=!0,it&&console.log("immediatePropagationStopped",e.type);break}else e.propagationStopped&&(t=!0,it&&console.log("propagationStopped",e.type));r.options.once&&(n.listeners.splice(s,1),s--),r.callback(e)}}}}_doubleClickTimeThreshold=.2;_longPressTimeThreshold=1;get mousePosition(){return this._pointerPositions[0]}get mousePositionRC(){return this._pointerPositionsRC[0]}get mouseDown(){return this._pointerDown[0]}get mouseUp(){return this._pointerUp[0]}get mouseClick(){return this._pointerClick[0]}get mouseDoubleClick(){return this._pointerDoubleClick[0]}get mousePressed(){return this._pointerPressed[0]}get mouseWheelChanged(){return this.getMouseWheelChanged(0)}get click(){return this._pointerClick[0]}get doubleClick(){return this._pointerDoubleClick[0]}getGamepad(e=0){return typeof navigator<"u"&&"getGamepads"in navigator&&navigator.getGamepads()[e]||null}_setCursorTypes=[];setCursorPointer(){this.setCursor("pointer")}setCursorNormal(){this.unsetCursor("pointer")}setCursor(e){this._setCursorTypes.push(e),this._setCursorTypes.length>10&&this._setCursorTypes.shift(),this.updateCursor()}unsetCursor(e){for(let t=this._setCursorTypes.length-1;t>=0;t--)if(this._setCursorTypes[t]===e){this._setCursorTypes.splice(t,1),this.updateCursor();break}}updateCursor(){this._setCursorTypes?.length==0?this.context.domElement.style.cursor="default":this.context.domElement.style.cursor=this._setCursorTypes[this._setCursorTypes.length-1]}getIsPointerIdInUse(e){for(const t of this._pointerEventsPressed)if(t.pointerId===e&&t.used)return!0;return!1}getPointerPressedCount(){let e=0;for(let t=0;t<this._pointerPressed.length;t++)this._pointerPressed[t]&&e++;return e}getPointerPosition(e){return e>=this._pointerPositions.length?null:this._pointerPositions[e]}getPointerPositionLastFrame(e){return e>=this._pointerPositionsLastFrame.length?null:this._pointerPositionsLastFrame[e]}getPointerPositionDelta(e){return e>=this._pointerPositionsDelta.length?null:this._pointerPositionsDelta[e]}getPointerPositionRC(e){return e>=this._pointerPositionsRC.length?null:this._pointerPositionsRC[e]}getPointerDown(e){return e>=this._pointerDown.length?!1:this._pointerDown[e]}getPointerUp(e){return e>=this._pointerUp.length?!1:this._pointerUp[e]}getPointerPressed(e){return e>=this._pointerPressed.length?!1:this._pointerPressed[e]}getPointerClicked(e){return e>=this._pointerClick.length?!1:this._pointerClick[e]}getPointerDoubleClicked(e){return e>=this._pointerDoubleClick.length?!1:this._pointerDoubleClick[e]}getPointerDownTime(e){return e>=this._pointerDownTime.length?-1:this._pointerDownTime[e]}getPointerUpTime(e){return e>=this._pointerUpTime.length?-1:this._pointerUpTime[e]}getPointerLongPress(e){return e>=this._pointerDownTime.length?!1:this.getPointerPressed(e)&&this.context.time.time-this._pointerDownTime[e]>this._longPressTimeThreshold}getIsMouse(e){return e<0||e>=this._pointerTypes.length?!1:this._pointerTypes[e]==="mouse"}getIsTouch(e){return e<0||e>=this._pointerTypes.length?!1:this._pointerTypes[e]==="touch"}getTouchesPressedCount(){let e=0;for(let t=0;t<this._pointerPressed.length;t++)this._pointerPressed[t]&&this.getIsTouch(t)&&e++;return e}getMouseWheelChanged(e=0){return e>=this._mouseWheelChanged.length?!1:this._mouseWheelChanged[e]}getMouseWheelDeltaY(e=0){return e>=this._mouseWheelDeltaY.length?0:this._mouseWheelDeltaY[e]}getPointerEvent(e){if(!(e>=this._pointerEvent.length))return this._pointerEvent[e]??void 0}*foreachPointerId(e){for(let t=0;t<this._pointerTypes.length;t++)if(this._pointerIsActive(t)){if(e!==void 0){const i=this._pointerTypes[t];if(Array.isArray(e)){let n=!1;for(const s of e)if(i===s){n=!0;break}if(!n)continue}else if(e!==i)continue}yield t}}*foreachTouchId(){for(let e=0;e<this._pointerTypes.length;e++)this._pointerTypes[e]==="touch"&&this._pointerIsActive[e]&&(yield e)}_pointerIsActive(e){return e<0?!1:this._pointerPressed[e]||this._pointerDown[e]||this._pointerUp[e]}context;_pointerDown=[!1];_pointerUp=[!1];_pointerClick=[!1];_pointerDoubleClick=[!1];_pointerPressed=[!1];_pointerPositions=[new J];_pointerPositionsLastFrame=[new J];_pointerPositionsDelta=[new J];_pointerPositionsRC=[new J];_pointerPositionDown=[new b];_pointerDownTime=[];_pointerUpTime=[];_pointerUpTimestamp=[];_pointerIds=[];_pointerTypes=[""];_mouseWheelChanged=[!1];_mouseWheelDeltaY=[0];_pointerEvent=[];_pointerEventsPressed=[];_pointerSpace=[];_pressedStack=new Map;onDownButton(e,t){let i=this._pressedStack.get(e);i||(i=[],this._pressedStack.set(e,i)),i.push(t)}onReleaseButton(e,t){const i=this._pressedStack.get(e);if(!i)return;const n=i.indexOf(t);n>=0&&i.splice(n,1)}getFirstPressedButtonForPointer(e){const t=this._pressedStack.get(e);if(t)return t[0]}getLatestPressedButtonForPointer(e){const t=this._pressedStack.get(e);if(t)return t[t.length-1]}getKeyDown(e){if(e!==void 0)return this.isKeyDown(e);for(const t in this.keysPressed){const i=this.keysPressed[t];if(i.startFrame===this.context.time.frameCount)return i.key}return null}getKeyPressed(e){if(e!==void 0)return this.isKeyPressed(e);for(const t in this.keysPressed){const i=this.keysPressed[t];if(i.pressed)return i.key}return null}getKeyUp(e){if(e!==void 0)return this.isKeyUp(e);for(const t in this.keysPressed){const i=this.keysPressed[t];return i.pressed===!1&&i.frame===this.context.time.frameCount}return null}isKeyDown(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const n of t)if(this.isKeyDown(n))return!0;return!1}const i=this.keysPressed[e];return i?i.startFrame===this.context.time.frameCount&&i.pressed:!1}isKeyUp(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const n of t)if(this.isKeyUp(n))return!0;return!1}const i=this.keysPressed[e];return i?i.frame===this.context.time.frameCount&&i.pressed===!1:!1}isKeyPressed(e){if(!this.context.application.isVisible||!this.context.application.hasFocus)return!1;const t=this.getCodeForCommonKeyName(e);if(t!==null){for(const n of t)if(this.isKeyPressed(n))return!0;return!1}const i=this.keysPressed[e];return i&&i.pressed||!1}getCodeForCommonKeyName(e){if(e.length===1){if(e>="0"&&e<="9")return["Digit"+e];if(e>="a"&&e<="z")return["Key"+e.toUpperCase()];if(e==" ")return["Space"]}switch(e){case"shift":case"Shift":return["ShiftLeft","ShiftRight"];case"control":case"Control":return["ControlLeft","ControlRight"];case"alt":case"Alt":return["AltLeft","AltRight"]}return null}createInputEvent(e){switch(e.type){case"pointerdown":it&&Te("Create Pointer down"),this.onDownButton(e.deviceIndex,e.button),this.onDown(e);break;case"pointermove":it&&Te("Create Pointer move"),this.onMove(e);break;case"pointerup":it&&Te("Create Pointer up"),this.onUp(e),this.onReleaseButton(e.deviceIndex,e.button);break}}convertScreenspaceToRaycastSpace(e){return e.x=(e.x-this.context.domX)/this.context.domWidth*2-1,e.y=-((e.y-this.context.domY)/this.context.domHeight)*2+1,e}constructor(e){this.context=e,this.context.post_render_callbacks.push(this.onEndOfFrame)}_htmlEventSource;bindEvents(){this.unbindEvents(),this._htmlEventSource=this.context.renderer.domElement,window.addEventListener("contextmenu",this.onContextMenu),this._htmlEventSource.addEventListener("pointerdown",this.onPointerDown,{passive:!0}),window.addEventListener("pointermove",this.onPointerMove,{passive:!0,capture:!0}),window.addEventListener("pointerup",this.onPointerUp,{passive:!0}),window.addEventListener("pointercancel",this.onPointerCancel,{passive:!0}),window.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),this._htmlEventSource.addEventListener("wheel",this.onMouseWheel,{passive:!0}),window.addEventListener("wheel",this.onWheelWindow,{passive:!0}),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keypress",this.onKeyPressed,!1),window.addEventListener("keyup",this.onKeyUp,!1),window.addEventListener("blur",this.onLostFocus)}unbindEvents(){for(const e in this._eventListeners)this._eventListeners[e].length=0;window.removeEventListener("contextmenu",this.onContextMenu),this._htmlEventSource?.removeEventListener("pointerdown",this.onPointerDown),window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerCancel),window.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),this._htmlEventSource?.removeEventListener("wheel",this.onMouseWheel,!1),window.removeEventListener("wheel",this.onWheelWindow,!1),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keypress",this.onKeyPressed,!1),window.removeEventListener("keyup",this.onKeyUp,!1),window.removeEventListener("blur",this.onLostFocus)}dispose(){const e=this.context.post_render_callbacks.indexOf(this.onEndOfFrame);e>=0&&this.context.post_render_callbacks.splice(e,1),this.unbindEvents()}onLostFocus=()=>{for(const e in this.keysPressed)this.keysPressed[e].pressed=!1};_receivedPointerMoveEventsThisFrame=new Array;onEndOfFrame=()=>{this._receivedPointerMoveEventsThisFrame.length=0;for(let e=0;e<this._pointerUp.length;e++)this._pointerUp[e]=!1;for(let e=0;e<this._pointerDown.length;e++)this._pointerDown[e]=!1;for(let e=0;e<this._pointerClick.length;e++)this._pointerClick[e]=!1;for(let e=0;e<this._pointerDoubleClick.length;e++)this._pointerDoubleClick[e]=!1;for(const e of this._pointerPositionsDelta)e.set(0,0);for(let e=0;e<this._mouseWheelChanged.length;e++)this._mouseWheelChanged[e]=!1;for(let e=0;e<this._mouseWheelDeltaY.length;e++)this._mouseWheelDeltaY[e]=0};canReceiveInput(e){return e.target===this.context.renderer?.domElement||e.target===this.context.domElement||this.context.isInAR||this.context.isInAR&&e.target===document.body&&G.isMozillaXR()?!0:(it&&console.warn("CanReceiveInput:False for",e.target),!1)}onContextMenu=e=>{this.canReceiveInput(e)!==!1&&e instanceof PointerEvent&&e.pointerType};keysPressed={};onKeyDown=e=>{if(it&&console.log(`key down ${e.code}, ${this.context.application.hasFocus}`,e),!this.context.application.hasFocus)return;const t=this.keysPressed[e.code];if(t&&t.pressed)return;this.keysPressed[e.code]={pressed:!0,frame:this.context.time.frameCount+1,startFrame:this.context.time.frameCount+1,key:e.key,code:e.code};const i=new Nl("keydown",e,e);this.onDispatchEvent(i)};onKeyPressed=e=>{if(!this.context.application.hasFocus)return;const t=this.keysPressed[e.code];if(!t)return;t.pressed=!0,t.frame=this.context.time.frameCount+1;const i=new Nl("keypress",e,e);this.onDispatchEvent(i)};onKeyUp=e=>{if(!this.context.application.hasFocus)return;const t=this.keysPressed[e.code];if(!t)return;t.pressed=!1,t.frame=this.context.time.frameCount+1;const i=new Nl("keyup",e,e);this.onDispatchEvent(i)};onWheelWindow=e=>{document.pointerLockElement&&this.onMouseWheel(e)};onMouseWheel=e=>{if(this.canReceiveInput(e)===!1)return;this._mouseWheelDeltaY.length<=0&&this._mouseWheelDeltaY.push(0),this._mouseWheelChanged.length<=0&&this._mouseWheelChanged.push(!1),this._mouseWheelChanged[0]=!0;const t=this._mouseWheelDeltaY[0];this._mouseWheelDeltaY[0]=t+e.deltaY};onPointerDown=e=>{if(this.context.isInAR||this.canReceiveInput(e)===!1)return;e.target instanceof HTMLElement&&e.target.setPointerCapture(e.pointerId);const t=this.getPointerId(e);it&&Te(`pointer down #${t}, identifier:${e.pointerId}`);const i=this.getAndUpdateSpatialObjectForScreenPosition(t,e.clientX,e.clientY),n=new yo("pointerdown",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:t,button:e.button,clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,buttonName:this.getButtonName(e),device:i,pressure:e.pressure});this.onDown(n)};onPointerMove=e=>{if(this.context.isInAR||this._receivedPointerMoveEventsThisFrame.includes(e.pointerId))return;this._receivedPointerMoveEventsThisFrame.push(e.pointerId);let t=e.button;e.pointerType==="mouse"&&(t=this.getFirstPressedButtonForPointer(0)??0);const i=this.getPointerId(e,t);t===-1&&(t=i);const n=this.getAndUpdateSpatialObjectForScreenPosition(i,e.clientX,e.clientY),s=new yo("pointermove",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:i,button:t,clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,buttonName:this.getButtonName(e),device:n,pressure:e.pressure});this.onMove(s)};onPointerCancel=e=>{this.context.isInAR||(it&&console.log("Pointer cancel",e),this.onPointerUp(e))};onPointerUp=e=>{if(this.context.isInAR)return;e.target instanceof HTMLElement&&e.target.releasePointerCapture(e.pointerId);const t=this.getPointerId(e),i=new yo("pointerup",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:t,button:e.button,clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,buttonName:this.getButtonName(e),device:this.getAndUpdateSpatialObjectForScreenPosition(t,e.clientX,e.clientY),pressure:e.pressure});this.onUp(i),this._pointerIds[t]=-1,it&&console.log("ID="+t,"PointerId="+e.pointerId,"ALL:",[...this._pointerIds])};getPointerId(e,t){return e.pointerType==="mouse"?0+(t??e.button):this.getPointerIndex(e.pointerId)}getButtonName(e){const t=e.button;if(e.pointerType==="mouse")switch(t){case 0:return"left";case 1:return"middle";case 2:return"right"}return"unknown"}onTouchStart=e=>{if(this.context.isInAR)for(let t=0;t<e.changedTouches.length;t++){const i=e.changedTouches[t],n=this.getPointerIndex(i.identifier),s=this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),r=new yo("pointerdown",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:s,pressure:i.force});this.onDown(r)}};onTouchMove=e=>{if(this.context.isInAR)for(let t=0;t<e.changedTouches.length;t++){const i=e.changedTouches[t],n=this.getPointerIndex(i.identifier),s=this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),r=new yo("pointermove",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:s,pressure:i.force});this.onMove(r)}};onTouchEnd=e=>{if(this.context.isInAR)for(let t=0;t<e.changedTouches.length;t++){const i=e.changedTouches[t],n=this.getPointerIndex(i.identifier),s=new yo("pointerup",e,{origin:this,mode:"screen",deviceIndex:0,pointerId:n,button:0,clientX:i.clientX,clientY:i.clientY,pointerType:"touch",buttonName:"unknown",device:this.getAndUpdateSpatialObjectForScreenPosition(n,i.clientX,i.clientY),pressure:i.force});this.onUp(s),this._pointerIds[n]=-1}};tempNearPlaneVector=new b;tempFarPlaneVector=new b;tempLookMatrix=new te;getAndUpdateSpatialObjectForScreenPosition(e,t,i){let n=this._pointerSpace[e];n||(n=new M,this._pointerSpace[e]=n),this._pointerSpace[e]=n;const s=this.context.mainCamera;if(s){const r=this.tempNearPlaneVector.set(t,i,-1);this.convertScreenspaceToRaycastSpace(r);const a=this.tempFarPlaneVector.set(r.x,r.y,1);r.unproject(s),a.unproject(s);const l=s.worldUp||H(0,1,0).applyQuaternion(be(s));this.tempLookMatrix.lookAt(a,r,l),n.position.set(r.x,r.y,r.z),n.quaternion.setFromRotationMatrix(this.tempLookMatrix)}return n}isInRect(e){if(this.context.isInXR)return!0;const t=this.context.domElement.getBoundingClientRect(),i=e.clientX,n=e.clientY,s=i>=t.x&&i<=t.right&&n>=t.y&&n<=t.bottom;return it&&!s&&console.log("Not in rect",t,i,n),s}onDown(e){const t=e.pointerId;if(this.getPointerPressed(t)&&console.warn(`Received pointerDown for pointerId that is already pressed: ${t}`,it?e:""),it&&console.log(e.pointerType,"DOWN",t),!!this.isInRect(e)){for(this.setPointerState(t,this._pointerPressed,!0),this.setPointerState(t,this._pointerDown,!0),this.setPointerStateT(t,this._pointerEvent,e.source);t>=this._pointerTypes.length;)this._pointerTypes.push(e.pointerType);for(this._pointerTypes[t]=e.pointerType;t>=this._pointerPositionDown.length;)this._pointerPositionDown.push(new b);for(this._pointerPositionDown[t].set(e.clientX,e.clientY,e.clientZ??0);t>=this._pointerPositions.length;)this._pointerPositions.push(new J);this._pointerPositions[t].set(e.clientX,e.clientY),t>=this._pointerDownTime.length&&this._pointerDownTime.push(0),this._pointerDownTime[t]=this.context.time.realtimeSinceStartup,this.updatePointerPosition(e),this._pointerEventsPressed.push(e),this.onDispatchEvent(e)}}onMove(e){const t=e.pointerId,i=this.getPointerPressed(t);i===!1&&!this.isInRect(e)||e.pointerType==="touch"&&!i||(this.updatePointerPosition(e),this.setPointerStateT(t,this._pointerEvent,e.source),this.onDispatchEvent(e))}onUp(e){const t=e.pointerId;if(!this.getPointerPressed(t)){it&&console.log(e.pointerType,"UP",t,"was not down");return}it&&console.log(e.pointerType,"UP",t),this.setPointerState(t,this._pointerPressed,!1),this.setPointerStateT(t,this._pointerEvent,e.source),this.setPointerState(t,this._pointerUp,!0),this.updatePointerPosition(e);for(let a=this._pointerEventsPressed.length-1;a>=0;a--)if(this._pointerEventsPressed[a].pointerId===t){this._pointerEventsPressed.splice(a,1);break}if(!this._pointerPositionDown[t]){it&&pe("Received pointer up event without matching down event for button: "+t),console.warn("Received pointer up event without matching down event for button: "+t);return}const i=this._pointerUpTime[t],n=this._pointerDownTime[t],s=this.context.time.realtimeSinceStartup,r=s-n;if(t>=this._pointerUpTime.length&&this._pointerUpTime.push(-99),this._pointerUpTime[t]=s,r<1){let a=e.clientX-this._pointerPositionDown[t].x,l=e.clientY-this._pointerPositionDown[t].y,c=0;if(e.isSpatial&&e.clientZ!=null&&(c=e.clientZ-this._pointerPositionDown[t].z,a*=200,l*=200,c*=200),Math.abs(a)<5&&Math.abs(l)<5&&Math.abs(c)<5){this.setPointerState(t,this._pointerClick,!0),e.isClick=!0;const h=s-i;it&&console.log("CLICK",t,a,l,c,h),h<this._doubleClickTimeThreshold&&h>0&&(this.setPointerState(t,this._pointerDoubleClick,!0),e.isDoubleClick=!0)}}this.onDispatchEvent(e)}updatePointerPosition(e){const t=e.pointerId;for(;t>=this._pointerPositions.length;)this._pointerPositions.push(new J);for(;t>=this._pointerPositionsLastFrame.length;)this._pointerPositionsLastFrame.push(new J);for(;t>=this._pointerPositionsDelta.length;)this._pointerPositionsDelta.push(new J);const i=this._pointerPositionsLastFrame[t];i.copy(this._pointerPositions[t]);const n=this._pointerPositionsDelta[t];let s=e.clientX-i.x,r=e.clientY-i.y;if(e.source instanceof MouseEvent||e.source instanceof TouchEvent){const h=e.source;s===0&&h.movementX!==0&&(s=h.movementX||0),r===0&&h.movementY!==0&&(r=h.movementY||0)}n.x+=s,n.y+=r,this._pointerPositions[t].x=e.clientX,this._pointerPositions[t].y=e.clientY;const a=e.clientX,l=e.clientY;for(;t>=this._pointerPositionsRC.length;)this._pointerPositionsRC.push(new J);const c=this._pointerPositionsRC[t];c.set(a,l),this.convertScreenspaceToRaycastSpace(c)}getPointerIndex(e){let t=-1;for(let i=0;i<this._pointerIds.length;i++){if(this._pointerIds[i]===e)return i;t===-1&&this._pointerIds[i]===-1&&(t=i)}return t!==-1?(this._pointerIds[t]=e,t):(it&&console.log("PUSH pointerId:",e),this._pointerIds.push(e),this._pointerIds.length-1)}setPointerState(e,t,i){t[e]=i}setPointerStateT(e,t,i){return t[e]=i,i}onDispatchEvent(e){const t=U.Current;try{U.Current=this.context,this.dispatchEvent(e)}finally{U.Current=t}}}const ya=new te().makeRotationY(Math.PI),Wi=new z().setFromAxisAngle(new b(0,1,0),Math.PI),ZP=w("debugwebxr");class JP{priority=-1e5;gameObject;isXRRig(){return!0}get isActive(){return this.gameObject.visible}constructor(){if(this.gameObject=new M,this.gameObject.name="Implicit XR Rig",ZP){const e=Hm(16733661);e.position.y+=.5,this.gameObject.add(e)}}}const bo=w("debugwebxr"),fd=w("debugcustomgesture"),eO="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",tO="generic-trigger",iO=new z().setFromEuler(new Et(lo.degToRad(0),lo.degToRad(-90),lo.degToRad(-90))),nO=new b(.04,-.04,0);class Em{xr;get context(){return this.xr.context}inputSource;index=0;emitEvents=!0;get connected(){return this._connected}_connected=!0;get isTracking(){return this._isTracking}_isTracking=!1;get gamepad(){return this.__gamepad??=this.inputSource.gamepad}__gamepad;get isHand(){return this.hand!=null}get hand(){return this.__hand??=this.inputSource.hand}__hand;get handObject(){return this.context.renderer.xr.getHand(this.index)}get profiles(){return this.inputSource.profiles}get layout(){return this._layout}get targetRayMode(){return this.inputSource.targetRayMode}get targetRaySpace(){return this.inputSource.targetRaySpace}get gripSpace(){return this.inputSource.gripSpace}get side(){return this.__side??=this.inputSource.handedness}__side=void 0;get isRight(){return this.side==="right"}get isLeft(){return this.side==="left"}get isStylus(){return this._isMxInk}getHitTestSource(){return this._hitTestSource||this._requestHitTestSource(),this._hitTestSource}get hasHitTestSource(){return this._hitTestSource}cancelHitTestSource(){this._hitTestSource&&(this._hitTestSource.cancel(),this._hitTestSource=void 0)}_hitTestSource=void 0;_hasSelectEvent=!1;get hasSelectEvent(){return this._hasSelectEvent}_isMxInk=!1;_isMetaQuestTouchController=!1;getHitTest(){return this.xr.getHitTest(this)}_handJointPoses=new Map;getHandJointPose(e,t){if(t=t||this.xr.frame,!this.hand||!t?.getJointPose||!this.xr.referenceSpace)return null;let i=this._handJointPoses?.get(e);return i||(i=t.getJointPose(e,this.xr.referenceSpace),i&&this._handJointPoses.set(e,i),i)}_gripMatrix=new te;_gripPosition=new b;_gripQuaternion=new z;_linearVelocity=new b;_rayPositionRaw=new b;_rayRotationRaw=new z;_rayMatrix=new te;_rayPosition=new b;_rayQuaternion=new z;get gripPosition(){return H(this._gripPosition)}get gripQuaternion(){return un(this._gripQuaternion)}get gripMatrix(){return this._gripMatrix}get gripLinearVelocity(){return H(this._linearVelocity).applyQuaternion(Wi)}get rayPosition(){return H(this._rayPosition)}get rayQuaternion(){return un(this._rayQuaternion)}get gripWorldPosition(){return H(this._gripWorldPosition)}_gripWorldPosition=new b;get gripWorldQuaternion(){return un(this._gripWorldQuaternion)}_gripWorldQuaternion=new z;get rayWorldPosition(){return H(this._rayWorldPosition)}_rayWorldPosition=new b;updateRayWorldPosition(){const e=this.xr.context.mainCamera?.parent;this._rayWorldPosition.copy(this._rayPositionRaw),e&&this._rayWorldPosition.applyMatrix4(e.matrixWorld)}get rayWorldQuaternion(){return un(this._rayWorldQuaternion)}_rayWorldQuaternion=new z;get pinchPosition(){return H(this._pinchPosition)}_pinchPosition=new b;updateRayWorldQuaternion(){const e=this.xr.context.mainCamera?.parent,t=e?be(e):void 0;this._rayWorldQuaternion.copy(this._rayRotationRaw).multiply(Wi),t&&this._rayWorldQuaternion.premultiply(t)}get ray(){return this._ray.origin.copy(this.rayWorldPosition),this._ray.direction.copy(H(0,0,1).applyQuaternion(this.rayWorldQuaternion)),this._ray}_ray;_hand_wristDotUp=void 0;get handWristDotUp(){if(this._hand_wristDotUp!==void 0)return this._hand_wristDotUp;const e=this.handObject?.joints.wrist;if(e){const t=H(0,1,0).applyQuaternion(e.quaternion),i=H(0,1,0).dot(t);return this._hand_wristDotUp=i}}get isHandUpsideDown(){return this.handWristDotUp!==void 0?this.handWristDotUp<-.7:!1}get isTeleportGesture(){return this.isHandUpsideDown&&this.getGesture("pinch")?.isDown}get object(){return this._object}_object;_gripSpaceObject;_raySpaceObject;model=null;_debugAxesHelper=new gi(.15);_debugGripAxesHelper=new gi(.07);_debugRayAxesHelper=new gi(.07);async getModelUrl(){return this.getMotionController?.then(e=>e?.assetUrl||null)}constructor(e,t,i){this.xr=e,this.inputSource=t,this.index=i,this._object=new M,this._object.name=`NeedleXRController_${i}`,bo&&(this._object.add(this._debugAxesHelper),this._gripSpaceObject=new M,this._raySpaceObject=new M,this._gripSpaceObject.name=`NeedleXRController_${i}_gripSpace`,this._raySpaceObject.name=`NeedleXRController_${i}_raySpace`,this._gripSpaceObject.add(this._debugGripAxesHelper),this._raySpaceObject.add(this._debugRayAxesHelper),this.xr.context.scene.add(this._gripSpaceObject),this.xr.context.scene.add(this._raySpaceObject)),this.xr.context.scene.add(this._object),this._ray=new ts,this.pointerInit={origin:this,pointerType:this.hand?"hand":"controller",deviceIndex:this.index,pointerId:-1,mode:this.inputSource.targetRayMode,ray:this._ray,device:this._object,buttonName:"none"},this.initialize(),this.subscribeEvents()}_hitTestSourcePromise=null;_requestHitTestSource(){return this._hitTestSourcePromise?this._hitTestSourcePromise:this.xr.mode==="immersive-ar"&&this.inputSource.targetRayMode==="tracked-pointer"&&this.xr.session.requestHitTestSourceForTransientInput?this._hitTestSourcePromise=this.xr.session.requestHitTestSourceForTransientInput({profile:this.inputSource.profiles[0],offsetRay:new XRRay})?.then(e=>(this._hitTestSourcePromise=null,this.connected?this._hitTestSource=e:(e.cancel(),null)))??null:null}onPointerHits=e=>{};onUpdate(e){this.onUpdateFrame(e),this.updateInputEvents(),this.onUpdateMove()}onRenderDebug(){F.DrawSphere(this.rayWorldPosition,.003),F.DrawDirection(this.rayWorldPosition,H(0,0,10).applyQuaternion(this.rayWorldQuaternion));const e=(this.inputSource.gripSpace?this.gripWorldPosition:this.object.worldPosition).sub(this.object.worldForward.multiplyScalar(.1)),t=this.inputSource.profiles.join(`
146
146
  `);let i=`Controller[${this.index}] (${this.inputSource.targetRayMode}, ${this.side})
147
147
  C:${this.connected?"x":"-"} T:${this.isTracking?"x":"-"} Hand:${this.inputSource.hand?"x":"-"} Pen: ${this._isMxInk?"x":"-"}`;if(this.inputSource.hand&&(i+=`
@@ -167,7 +167,7 @@ ${s.hand?"hand":"ctrl"} ${s.inputSource.handedness}[${s.index}] con:${s.connecte
167
167
  The script will be ignored. Please make sure your component extends "Behaviour" imported from "@needle-tools/engine"
168
168
  `,t),Ae.splice(e,1),e--;continue}if(t.destroyed)continue;if(!t.gameObject){console.warn(`Component can not be initialized: no GameObject assigned.
169
169
  Did you add and remove a component in the same frame?`),Ae.splice(e,1),e--;continue}t.context=o,Ql(t.gameObject),Km(t,o)}catch(t){console.error(t),vo(Ae[e],o),Ae.splice(e,1),e--}for(let e=0;e<Ae.length;e++)try{const t=Ae[e];if(t.destroyed){vo(Ae[e],o),Ae.splice(e,1),e--;continue}if(t.registering)try{t.registering()}catch(i){console.error(i)}t.__internalAwake!==void 0&&(t.gameObject||console.error("Calling awake for a component without a GameObject",t,t.gameObject),Ql(t.gameObject),t.activeAndEnabled&&xa(t.__internalAwake.bind(t)))}catch(t){console.error(t),vo(Ae[e],o),Ae.splice(e,1),e--}for(let e=0;e<Ae.length;e++)try{const t=Ae[e];if(t.destroyed||t.enabled===!1||(Ql(t.gameObject),t.activeAndEnabled===!1))continue;t.__internalEnable!==void 0&&(t.enabled=!0,xa(t.__internalEnable.bind(t)))}catch(t){console.error(t),vo(Ae[e],o),Ae.splice(e,1),e--}for(let e=0;e<Ae.length;e++)try{const t=Ae[e];if(t.destroyed||!t.gameObject)continue;o.new_script_start.push(t)}catch(t){console.error(t),vo(Ae[e],o),Ae.splice(e,1),e--}Ae.length=0;for(const e of o.new_scripts_post_setup_callbacks)e&&e();o.new_scripts_post_setup_callbacks.length=0}}function AO(o){o&&(o.__internalDisable(!0),vo(o,o.context))}function S_(o,e){for(let t=0;t<o.new_script_start.length;t++)try{const i=o.new_script_start[t];if(e!==void 0&&i.gameObject!==e||i.destroyed||i.activeAndEnabled===!1)continue;xa(i.__internalAwake.bind(i)),i.enabled&&(xa(i.__internalEnable.bind(i)),xa(i.__internalStart.bind(i)),o.new_script_start.splice(t,1),t--)}catch(i){console.error(i),vo(o.new_script_start[t],o),o.new_script_start.splice(t,1),t--}}function Km(o,e){e.scripts.indexOf(o)===-1&&(e.scripts.push(o),o.earlyUpdate&&e.scripts_earlyUpdate.push(o),o.update&&e.scripts_update.push(o),o.lateUpdate&&e.scripts_lateUpdate.push(o),o.onBeforeRender&&e.scripts_onBeforeRender.push(o),o.onAfterRender&&e.scripts_onAfterRender.push(o),o.onPausedChanged&&e.scripts_pausedChanged.push(o),Zm(o,null)&&e.new_scripts_xr.push(o),Zm(o,"immersive-vr")&&e.scripts_immersive_vr.push(o),Zm(o,"immersive-ar")&&e.scripts_immersive_ar.push(o))}function vo(o,e){Hi(o,e.new_scripts),Hi(o,e.new_script_start),Hi(o,e.scripts),Hi(o,e.scripts_earlyUpdate),Hi(o,e.scripts_update),Hi(o,e.scripts_lateUpdate),Hi(o,e.scripts_onBeforeRender),Hi(o,e.scripts_onAfterRender),Hi(o,e.scripts_pausedChanged),Hi(o,e.new_scripts_xr),Hi(o,e.scripts_immersive_vr),Hi(o,e.scripts_immersive_ar),e.stopAllCoroutinesFrom(o)}function Hi(o,e){const t=e.indexOf(o);t>=0&&e.splice(t,1)}function Zm(o,e){if(o){const t=o;if(t.onBeforeXR||t.onEnterXR||t.onUpdateXR||t.onLeaveXR||t.onXRControllerAdded||t.onXRControllerRemoved)return!(e!=null&&t.supportsXR?.(e)===!1)}return!1}function kd(o){if(o||(o=he.Current.scene),!o){console.trace("Invalid call - no current context.");return}const e=Oa(o);C_(o,e,!0)||(Ym||A()?console.error(`Error updating hierarchy
170
- Do you have circular references in your project? <a target="_blank" href="https://docs.needle.tools/circular-reference"> Click here for more information.`,o):console.error('Failed to update active state in hierarchy of "'+o.name+'"',o),console.warn(" \u2191 this error might be caused by circular references. Please make sure you don't have files with circular references (e.g. one GLB 1 is loading GLB 2 which is then loading GLB 1 again)."))}function C_(o,e,t,i=0){if(i>1e3)return console.warn("Hierarchy is too deep (> 1000 level) - will abort updating active state"),!1;const n=Oa(o);if(e&&(e=n,e&&o.parent)){const a=o.parent;e=a[fo],e===void 0&&(a instanceof pi||(e=!0))}const s=o[fo]!==e;o[fo]=e,s&&(TO&&console.warn("ACTIVE CHANGE",o.name,n,o.visible,e,"changed?"+s,o),IO(o,a=>{e?a.enabled&&(xa(a.__internalAwake.bind(a)),a.enabled&&a.__internalEnable()):a.__didAwake&&a.enabled&&(a.__didEnable=!1,a.onDisable())}));let r=!0;if(o.children)for(const a of o.children)C_(a,e,t,i+1)===!1&&(r=!1);return r}function Ql(o){let e=!0,t=o,i=!1;for(;t&&t;){if(t.type==="Scene"&&(i=!0),!Oa(t)){e=!1;break}t=t.parent}if(!o){console.error("GO is null");return}o[fo]=e&&i}function IO(o,e){if(o.userData?.components)for(const t of o.userData.components)e(t)}const Md=new Map,P_=Symbol("prewarmFlag"),Jm=Symbol("waitingForPrewarm"),eg=w("debugprewarm");function LO(o,e){!o||o[P_]===!0||o[Jm]===!0||(Md.has(e)||Md.set(e,[]),o[Jm]=!0,Md.get(e).push(o),eg&&console.debug("register prewarm",o.name))}let O_=null,k_=null;function jO(o){if(!o)return;const e=Md.get(o);if(!e?.length)return;const t=o.mainCamera;if(t){eg&&console.log("prewarm",e.length,"objects",[...e]);const i=o.renderer;if(i.compile){const n=o.scene;i.compile(n,t),O_??=new U1(64),k_??=new z1(.001,9999999,O_),k_.update(i,n);for(const s of e)s[P_]=!0,s[Jm]=!1;e.length=0,eg&&console.log("prewarm done")}}}he.registerCallback(ce.ContextCreated,o=>{const e=o.context;I_(e),T_(e)});const Rd=w("debugcomponents"),M_="eff8ba80-635d-11ec-90d6-0242ac120003";class Tt{get seed(){return this._seed}set seed(e){this._seed=e}_originalSeed;_seed;constructor(e){typeof e=="string"&&(e=Tt.hash(e)),this._originalSeed=e,this._seed=e}reset(){this._seed=this._originalSeed}generateUUID(e){if(typeof e=="string")return j0(e,M_);const t=this._seed;return this._seed-=1,j0(t.toString(),M_)}initialize(e){typeof e=="string"?this._seed=Tt.hash(e):this._seed=e}static createFromString(e){return new Tt(this.hash(e))}static hash(e){let t=0;for(let i=0;i<e.length;i++)t=e.charCodeAt(i)+((t<<5)-t);return t}}var R_=(o=>(o.NewInstanceCreated="new-instance-created",o.InstanceDestroyed="instance-destroyed",o))(R_||{});class DO{guid;dontSave;constructor(e){this.guid=e}}function Yl(o,e,t=!0,i){if(!o)return;const n=o;if(wi(o,t),!e){console.warn("Can not send destroy: No networking connection provided",o.guid);return}if(!e.isConnected){A()&&console.debug("Can not send destroy: not connected",o.guid);return}let s=o.guid;if(!s&&n.uuid&&(s=n.uuid),!s){console.warn("Can not send destroy: failed to find guid",o);return}tg(s,e,i)}function tg(o,e,t){const i=new DO(o);t?.saveInRoom===!1&&(i.dontSave=!0),e.send("instance-destroyed",i,gn.Queued)}function T_(o){o.connection.beginListen("instance-destroyed",e=>{Rd&&console.log("[Remote] Destroyed",o.scene,e);const t=ug(e.guid,o.scene);t&&wi(t)})}class BO{filename;hash;size;constructor(e,t,i){this.filename=e,this.hash=t,this.size=i}}class E_{guid;originalGuid;seed;visible;hostData;dontSave;parent;position;rotation;scale;preventCreation=void 0;deleteStateOnDisconnect;constructor(e,t){this.originalGuid=e,this.guid=t}}function ig(o,e,t,i){const n=o;if(!n.guid)return console.warn("Can not instantiate: No guid",n),null;if(e.context||(e.context=U.Current),!e.context)return console.error("Missing network instantiate options / reference to network connection in sync instantiate"),null;const s=e?{...e}:null,{instance:r,seed:a}=FO(n,e);if(r){const l=r;if(l.guid){Rd&&console.log("[Local] new instance","gameobject:",r?.guid);const c=new E_(n.guid,l.guid);c.seed=a,e.deleteOnDisconnect===!0&&(c.deleteStateOnDisconnect=!0),s&&(s.position&&(c.position={x:s.position.x,y:s.position.y,z:s.position.z}),s.rotation&&(c.rotation={x:s.rotation.x,y:s.rotation.y,z:s.rotation.z,w:s.rotation.w}),s.scale&&(c.scale={x:s.scale.x,y:s.scale.y,z:s.scale.z})),c.position||(c.position={x:l.position.x,y:l.position.y,z:l.position.z}),c.rotation||(c.rotation={x:l.quaternion.x,y:l.quaternion.y,z:l.quaternion.z,w:l.quaternion.w}),c.scale||(c.scale={x:l.scale.x,y:l.scale.y,z:l.scale.z}),c.visible=n.visible,s?.parent&&(typeof s.parent=="string"?c.parent=s.parent:c.parent=s.parent.guid),c.hostData=t,i===!1&&(c.dontSave=!0),!e?.context?.connection&&A()&&console.debug("Object will be instantiated but it will not be synced: not connected",n.guid),e.context.connection.isInRoom&&Sa.push(new WeakRef(l)),e?.context?.connection.send("new-instance-created",c)}else console.warn("Missing guid, can not send new instance event",l)}return r}function A_(){return Math.random()*9999999}const Sa=new Array;function I_(o){o.connection.beginListen("new-instance-created",async e=>{const t=await UO(e.originalGuid,o.scene);if(e.preventCreation===!0)return;if(!t){console.warn("could not find object that was instantiated: "+e.guid);return}const i=new Mn;e.position&&(i.position=new b(e.position.x,e.position.y,e.position.z)),e.rotation&&(i.rotation=new z(e.rotation.x,e.rotation.y,e.rotation.z,e.rotation.w)),e.scale&&(i.scale=new b(e.scale.x,e.scale.y,e.scale.z)),i.parent=e.parent,e.seed&&(i.idProvider=new Tt(e.seed)),i.visible=e.visible,i.context=o,Rd&&o.alias&&console.log("[Remote] instantiate in: "+o.alias);const n=Ma(t,i);Sa.push(new WeakRef(n)),n&&(e.parent==="scene"&&o.scene.add(n),Rd&&console.log("[Remote] new instance","gameobject:",n?.guid,t))}),o.connection.beginListen("left-room",()=>{Sa.length>0&&console.debug(`Left networking room, cleaning up ${Sa.length} instantiated objects`);for(const e of Sa){const t=e.deref();t&&t.destroy()}Sa.length=0})}function FO(o,e){const t=A_(),i=e??new Mn;i.idProvider=new Tt(t);const n=Ma(o,i);return{seed:t,instance:n}}const L_={};function j_(o,e){L_[o]=e}async function UO(o,e){const t=L_[o];if(t!=null){const i=await t(o);if(i)return i}return D_(o,e)}function D_(o,e){if(e===null||!o)return null;if(e.guid===o)return e;if(e.children)for(const t of e.children){const i=D_(o,t);if(i)return i}return null}const Kl=w("gizmos"),pt=w("debugextension"),ng=w("debugtypes");class zO{_types=new Map;constructor(){ng&&console.warn("TypeStore: Created",this)}add(e,t){ng&&console.warn("ADD TYPE",e);const i=this._types.get(e);i?ng&&i!==t&&console.warn("Type name exists multiple times in your project and may lead to runtime errors:",e):this._types.set(e,t)}get(e){return this._types.get(e)||null}getKey(e){for(const[t,i]of this._types)if(i===e)return t;return null}}const NO=Symbol("BuiltInType"),C=new zO,WO=function(o){C.get(o.name)||C.add(o.name,o)},og=w("debugresolvedependencies"),VO=["/extensions/","extensions/"],$O=[{prefix:"/nodes/",dependencyName:"node"},{prefix:"/meshes/",dependencyName:"mesh"},{prefix:"/materials/",dependencyName:"material"},{prefix:"/textures/",dependencyName:"texture"},{prefix:"/animations/",dependencyName:"animation"},{prefix:"nodes/",dependencyName:"node"},{prefix:"meshes/",dependencyName:"mesh"},{prefix:"materials/",dependencyName:"material"},{prefix:"textures/",dependencyName:"texture"},{prefix:"animations/",dependencyName:"animation"}];async function sg(o,e){og&&console.log(o,e);const t=[];rg($O,o,e,t);const i=await Promise.all(t);return typeof e=="string"&&i.length===1?i[0]:i}function B_(o,e){return!o||!e?!1:o["needle:identifier"]!=null&&e["needle:identifier"]!=null?o["needle:identifier"]===e["needle:identifier"]:!1}function HO(o,e){o["needle:identifier"]=e}function rg(o,e,t,i){if(typeof t=="object"&&t!==void 0&&t!==null)for(const n of Object.keys(t)){const s=t[n];if(typeof s=="string"){const r=F_(e,s);if(r!=null)typeof r.then=="function"?i.push(r.then(a=>t[n]=a)):t[n]=r;else{const a=U_(o,e,s);if(a){i.push(a.then(l=>(t[n]=l,l)));continue}}}else if(Array.isArray(s))for(let r=0;r<s.length;r++){const a=s[r],l=F_(e,a);if(l!==null){typeof l.then=="function"?i.push(l.then(c=>s[r]=c)):s[r]=l;continue}for(const c of o){const h=z_(c.prefix,a);if(h>=0){og&&console.log(c,h,c.dependencyName),i.push(e.getDependency(c.dependencyName,h).then(d=>s[r]=d));break}}typeof a=="object"&&rg(o,e,a,i)}else typeof s=="object"&&rg(o,e,s,i)}else if(typeof t=="string"){const n=U_(o,e,t);n&&i.push(n)}}function F_(o,e){if(o&&o.plugins&&typeof e=="string"){for(const t of VO)if(e.startsWith(t)){let i=e.substring(t.length);const n=i.indexOf("/");n>=0&&(i=i.substring(0,n));const s=o.plugins[i];if(pt&&console.log(i,s),typeof s?.resolve=="function"){const r=e.substring(t.length+i.length+1);return s.resolve(o,r)}break}}return null}function U_(o,e,t){for(const i of o){const n=z_(i.prefix,t);if(n>=0)return og&&console.warn("GET DEPENDENCY",i,n,i.dependencyName),e.getDependency(i.dependencyName,n)}return null}function z_(o,e){if(typeof e=="string"&&e.startsWith(o)){const t=e.substring(o.length),i=Number.parseInt(t);if(i>=0)return i}return-1}const ag="NEEDLE_persistent_assets";function GO(o){return o?.___persistentAsset===!0}class qO{get name(){return ag}parser;constructor(e){this.parser=e}async afterRoot(e){if(!this.parser?.json?.extensions)return;const t=this.parser.json.extensions[ag];if(!t)return;pt&&console.log(t);const i=new Array;for(const n of t?.assets){const s=sg(this.parser,n);s&&i.push(s)}await Promise.all(i)}resolve(e,t){const i=Number.parseInt(t);if(i>=0){pt&&console.log(t);const n=e.json.extensions[ag];if(n){const s=n?.assets[i];if(s&&typeof s=="object"){s.___persistentAsset=!0;const r=s.__type;r&&C.get(r)}return s}}return null}}const Bn=w("debugserializer");class XO{register(e,t){if(this.typeMap.has(e)){const i=this.typeMap.get(e);if(i===t)return;Bn&&console.warn("Type: "+e+" is already registered",t,i)}Bn&&console.log("Register type serializer",t.name,t,e),this.typeMap.set(e,t)}typeMap=new Map;getSerializer(e){if(e)return this.typeMap.get(e)}getSerializerForConstructor(e,t=0){if(t>20)return;if(!e||!e.constructor){Bn&&console.log("invalid type");return}const i=e.name,n=this.getSerializer(e);if(n!==void 0)return Bn&&console.log("FOUND SERIALIZER",n?.name,e.name,e.constructor.name,"for type: "+i,n,e,this.typeMap),n;const s=Object.getPrototypeOf(e);if(s&&s!==e){const r=this.getSerializerForConstructor(s,++t);if(r){const a=s.constructor||s.prototype;Bn&&console.log("FOUND SERIALIZER(in constructor) "+a.constructor.name,a.name,a,r),this.register(a,r)}return r}Bn&&console.warn("No serializer found for "+i,e,e.name,e.constructor.name)}}const Td=new XO;class Gi{name;constructor(e,t){if(this.name=t,Array.isArray(e))for(const i of e)Td.register(i,this);else Td.register(e,this)}}class QO{isDevMode=Ui();cache={};registerDefinedKeys(e,t){if(this.isDevMode&&this.cache[e]===void 0){this.cache[e]=Object.keys(t);const i=t;i.$serializedTypes&&Object.keys(i.$serializedTypes)&&this.cache[e].push(...Object.keys(i.$serializedTypes)),Bn&&console.log("registerDefinedKeys for "+e,this.cache[e],t)}}getDefinedKey(e,t){return this.cache[e]===void 0?!1:this.cache[e].includes(t)}}class lg{root;gltf;gltfId;object;target;nodeId;nodeToObject;objectToNode;context;path;type;serializable;implementationInformation;constructor(e){this.root=e}}function N_(o,e){const t=o.$serializedTypes;if(t===void 0)return null;const i={};for(const s in t){const r=o[s];if(r!=null&&typeof r=="object"){const a=Td.getSerializerForConstructor(r);if(a){i[s]=a.onSerialize(r,e);continue}}i[s]=r}function n(s){const r=C._types;for(const[a,l]of r)if(l===o.constructor)return a;return s.__name||s.constructor.name}return i.name=n(o),typeof o.guid=="string"&&(i.guid=o.guid),i}const Ed=[];function W_(o,e){if(!o)return e;typeof o.$serializedTypes=="object"&&(e||(e={}),Object.assign(e,o.$serializedTypes));const t=Object.getPrototypeOf(o);return W_(t,e)}function Ad(o,e,t){if(!o)return!1;if(t.target=o,o.onBeforeDeserialize!==void 0){const n=o.onBeforeDeserialize(e,t);if(typeof n=="boolean")return n}const i=W_(o);if(e){if(typeof e.guid=="string"&&(o.guid=e.guid),i)for(const n in i){let s=function(l){const c=l.type;return c?cg(a,c,t,void 0,o[n]):cg(a,l,t,void 0,o[n])};const r=i[n],a=e[n];if(Bn&&console.log(n,a,o,r),!(o[n]!==void 0&&a===void 0)&&(t.type=void 0,t.path=n,t.serializable=r,!(o.onBeforeDeserializeMember!==void 0&&o.onBeforeDeserializeMember(n,a,t)===!0))){if(r===null)o[n]=a;else{if(Array.isArray(r))for(let l=0;l<r.length;l++){const c=r[l],h=s(c);if(h!==void 0||l===r.length-1){o[n]=h;break}}else o[n]=s(r);Ed.length=0}o.onAfterDeserializeMember!==void 0&&o.onAfterDeserializeMember(n,a,t)}}ZO(o,e)}return KO(o,e,t.implementationInformation),o.onAfterDeserialize!==void 0&&o.onAfterDeserialize(e,t),!0}const YO=w("noerrors");function KO(o,e,t){if(YO||!e||!Ui()||!o||o.constructor&&o.constructor[NO]===!0)return;const i=o.constructor?.name,n=Object.getOwnPropertyNames(e);for(const s of n){if(s==="sourceId")continue;const r=o[s];if(r==null)continue;const a=e[s];if(t?.getDefinedKey(i,s)===!1){const l=s.charAt(0).toUpperCase()+s.slice(1);t.getDefinedKey(i,l)&&(er(bi.Warn,'<strong>Please rename</strong> "'+l+'" to "'+s+'" in '+i),console.warn('Please use lowercase for field: "'+l+'" in '+i,a,o));continue}if(a!=null){if(typeof a=="object"&&(r===void 0||!r.isObject3D)){if(typeof a.node=="number"||typeof a.guid=="string"){if(a.could_not_resolve)continue;if(!(r!==void 0&&Object.keys(r).length>1)){er(bi.Warn,`<strong>Missing serialization for object reference!</strong>
170
+ Do you have circular references in your project? <a target="_blank" href="https://docs.needle.tools/circular-reference"> Click here for more information.`,o):console.error('Failed to update active state in hierarchy of "'+o.name+'"',o),console.warn(" \u2191 this error might be caused by circular references. Please make sure you don't have files with circular references (e.g. one GLB 1 is loading GLB 2 which is then loading GLB 1 again)."))}function C_(o,e,t,i=0){if(i>1e3)return console.warn("Hierarchy is too deep (> 1000 level) - will abort updating active state"),!1;const n=Oa(o);if(e&&(e=n,e&&o.parent&&i===0)){const a=o.parent;e=a[fo],e===void 0&&(a instanceof pi||(e=!0))}const s=o[fo]!==e;s&&(o[fo]=e,TO&&console.warn("ACTIVE CHANGE",o.name,n,o.visible,e,"changed?"+s,o),IO(o,a=>{e?a.enabled&&(xa(a.__internalAwake.bind(a)),a.enabled&&a.__internalEnable()):a.__didAwake&&a.enabled&&(a.__didEnable=!1,a.onDisable())}));let r=!0;if(o.children)for(const a of o.children)C_(a,e,t,i+1)===!1&&(r=!1);return r}function Ql(o){let e=!0,t=o,i=!1;for(;t&&t;){if(t.type==="Scene"&&(i=!0),!Oa(t)){e=!1;break}t=t.parent}if(!o){console.error("GO is null");return}o[fo]=e&&i}function IO(o,e){if(o.userData?.components)for(const t of o.userData.components)e(t)}const Md=new Map,P_=Symbol("prewarmFlag"),Jm=Symbol("waitingForPrewarm"),eg=w("debugprewarm");function LO(o,e){!o||o[P_]===!0||o[Jm]===!0||(Md.has(e)||Md.set(e,[]),o[Jm]=!0,Md.get(e).push(o),eg&&console.debug("register prewarm",o.name))}let O_=null,k_=null;function jO(o){if(!o)return;const e=Md.get(o);if(!e?.length)return;const t=o.mainCamera;if(t){eg&&console.log("prewarm",e.length,"objects",[...e]);const i=o.renderer;if(i.compile){const n=o.scene;i.compile(n,t),O_??=new U1(64),k_??=new z1(.001,9999999,O_),k_.update(i,n);for(const s of e)s[P_]=!0,s[Jm]=!1;e.length=0,eg&&console.log("prewarm done")}}}he.registerCallback(ce.ContextCreated,o=>{const e=o.context;I_(e),T_(e)});const Rd=w("debugcomponents"),M_="eff8ba80-635d-11ec-90d6-0242ac120003";class Tt{get seed(){return this._seed}set seed(e){this._seed=e}_originalSeed;_seed;constructor(e){typeof e=="string"&&(e=Tt.hash(e)),this._originalSeed=e,this._seed=e}reset(){this._seed=this._originalSeed}generateUUID(e){if(typeof e=="string")return j0(e,M_);const t=this._seed;return this._seed-=1,j0(t.toString(),M_)}initialize(e){typeof e=="string"?this._seed=Tt.hash(e):this._seed=e}static createFromString(e){return new Tt(this.hash(e))}static hash(e){let t=0;for(let i=0;i<e.length;i++)t=e.charCodeAt(i)+((t<<5)-t);return t}}var R_=(o=>(o.NewInstanceCreated="new-instance-created",o.InstanceDestroyed="instance-destroyed",o))(R_||{});class DO{guid;dontSave;constructor(e){this.guid=e}}function Yl(o,e,t=!0,i){if(!o)return;const n=o;if(wi(o,t),!e){console.warn("Can not send destroy: No networking connection provided",o.guid);return}if(!e.isConnected){A()&&console.debug("Can not send destroy: not connected",o.guid);return}let s=o.guid;if(!s&&n.uuid&&(s=n.uuid),!s){console.warn("Can not send destroy: failed to find guid",o);return}tg(s,e,i)}function tg(o,e,t){const i=new DO(o);t?.saveInRoom===!1&&(i.dontSave=!0),e.send("instance-destroyed",i,gn.Queued)}function T_(o){o.connection.beginListen("instance-destroyed",e=>{Rd&&console.log("[Remote] Destroyed",o.scene,e);const t=ug(e.guid,o.scene);t&&wi(t)})}class BO{filename;hash;size;constructor(e,t,i){this.filename=e,this.hash=t,this.size=i}}class E_{guid;originalGuid;seed;visible;hostData;dontSave;parent;position;rotation;scale;preventCreation=void 0;deleteStateOnDisconnect;constructor(e,t){this.originalGuid=e,this.guid=t}}function ig(o,e,t,i){const n=o;if(!n.guid)return console.warn("Can not instantiate: No guid",n),null;if(e.context||(e.context=U.Current),!e.context)return console.error("Missing network instantiate options / reference to network connection in sync instantiate"),null;const s=e?{...e}:null,{instance:r,seed:a}=FO(n,e);if(r){const l=r;if(l.guid){Rd&&console.log("[Local] new instance","gameobject:",r?.guid);const c=new E_(n.guid,l.guid);c.seed=a,e.deleteOnDisconnect===!0&&(c.deleteStateOnDisconnect=!0),s&&(s.position&&(c.position={x:s.position.x,y:s.position.y,z:s.position.z}),s.rotation&&(c.rotation={x:s.rotation.x,y:s.rotation.y,z:s.rotation.z,w:s.rotation.w}),s.scale&&(c.scale={x:s.scale.x,y:s.scale.y,z:s.scale.z})),c.position||(c.position={x:l.position.x,y:l.position.y,z:l.position.z}),c.rotation||(c.rotation={x:l.quaternion.x,y:l.quaternion.y,z:l.quaternion.z,w:l.quaternion.w}),c.scale||(c.scale={x:l.scale.x,y:l.scale.y,z:l.scale.z}),c.visible=n.visible,s?.parent&&(typeof s.parent=="string"?c.parent=s.parent:c.parent=s.parent.guid),c.hostData=t,i===!1&&(c.dontSave=!0),!e?.context?.connection&&A()&&console.debug("Object will be instantiated but it will not be synced: not connected",n.guid),e.context.connection.isInRoom&&Sa.push(new WeakRef(l)),e?.context?.connection.send("new-instance-created",c)}else console.warn("Missing guid, can not send new instance event",l)}return r}function A_(){return Math.random()*9999999}const Sa=new Array;function I_(o){o.connection.beginListen("new-instance-created",async e=>{const t=await UO(e.originalGuid,o.scene);if(e.preventCreation===!0)return;if(!t){console.warn("could not find object that was instantiated: "+e.guid);return}const i=new Mn;e.position&&(i.position=new b(e.position.x,e.position.y,e.position.z)),e.rotation&&(i.rotation=new z(e.rotation.x,e.rotation.y,e.rotation.z,e.rotation.w)),e.scale&&(i.scale=new b(e.scale.x,e.scale.y,e.scale.z)),i.parent=e.parent,e.seed&&(i.idProvider=new Tt(e.seed)),i.visible=e.visible,i.context=o,Rd&&o.alias&&console.log("[Remote] instantiate in: "+o.alias);const n=Ma(t,i);Sa.push(new WeakRef(n)),n&&(e.parent==="scene"&&o.scene.add(n),Rd&&console.log("[Remote] new instance","gameobject:",n?.guid,t))}),o.connection.beginListen("left-room",()=>{Sa.length>0&&console.debug(`Left networking room, cleaning up ${Sa.length} instantiated objects`);for(const e of Sa){const t=e.deref();t&&t.destroy()}Sa.length=0})}function FO(o,e){const t=A_(),i=e??new Mn;i.idProvider=new Tt(t);const n=Ma(o,i);return{seed:t,instance:n}}const L_={};function j_(o,e){L_[o]=e}async function UO(o,e){const t=L_[o];if(t!=null){const i=await t(o);if(i)return i}return D_(o,e)}function D_(o,e){if(e===null||!o)return null;if(e.guid===o)return e;if(e.children)for(const t of e.children){const i=D_(o,t);if(i)return i}return null}const Kl=w("gizmos"),pt=w("debugextension"),ng=w("debugtypes");class zO{_types=new Map;constructor(){ng&&console.warn("TypeStore: Created",this)}add(e,t){ng&&console.warn("ADD TYPE",e);const i=this._types.get(e);i?ng&&i!==t&&console.warn("Type name exists multiple times in your project and may lead to runtime errors:",e):this._types.set(e,t)}get(e){return this._types.get(e)||null}getKey(e){for(const[t,i]of this._types)if(i===e)return t;return null}}const NO=Symbol("BuiltInType"),C=new zO,WO=function(o){C.get(o.name)||C.add(o.name,o)},og=w("debugresolvedependencies"),VO=["/extensions/","extensions/"],$O=[{prefix:"/nodes/",dependencyName:"node"},{prefix:"/meshes/",dependencyName:"mesh"},{prefix:"/materials/",dependencyName:"material"},{prefix:"/textures/",dependencyName:"texture"},{prefix:"/animations/",dependencyName:"animation"},{prefix:"nodes/",dependencyName:"node"},{prefix:"meshes/",dependencyName:"mesh"},{prefix:"materials/",dependencyName:"material"},{prefix:"textures/",dependencyName:"texture"},{prefix:"animations/",dependencyName:"animation"}];async function sg(o,e){og&&console.log(o,e);const t=[];rg($O,o,e,t);const i=await Promise.all(t);return typeof e=="string"&&i.length===1?i[0]:i}function B_(o,e){return!o||!e?!1:o["needle:identifier"]!=null&&e["needle:identifier"]!=null?o["needle:identifier"]===e["needle:identifier"]:!1}function HO(o,e){o["needle:identifier"]=e}function rg(o,e,t,i){if(typeof t=="object"&&t!==void 0&&t!==null)for(const n of Object.keys(t)){const s=t[n];if(typeof s=="string"){const r=F_(e,s);if(r!=null)typeof r.then=="function"?i.push(r.then(a=>t[n]=a)):t[n]=r;else{const a=U_(o,e,s);if(a){i.push(a.then(l=>(t[n]=l,l)));continue}}}else if(Array.isArray(s))for(let r=0;r<s.length;r++){const a=s[r],l=F_(e,a);if(l!==null){typeof l.then=="function"?i.push(l.then(c=>s[r]=c)):s[r]=l;continue}for(const c of o){const h=z_(c.prefix,a);if(h>=0){og&&console.log(c,h,c.dependencyName),i.push(e.getDependency(c.dependencyName,h).then(d=>s[r]=d));break}}typeof a=="object"&&rg(o,e,a,i)}else typeof s=="object"&&rg(o,e,s,i)}else if(typeof t=="string"){const n=U_(o,e,t);n&&i.push(n)}}function F_(o,e){if(o&&o.plugins&&typeof e=="string"){for(const t of VO)if(e.startsWith(t)){let i=e.substring(t.length);const n=i.indexOf("/");n>=0&&(i=i.substring(0,n));const s=o.plugins[i];if(pt&&console.log(i,s),typeof s?.resolve=="function"){const r=e.substring(t.length+i.length+1);return s.resolve(o,r)}break}}return null}function U_(o,e,t){for(const i of o){const n=z_(i.prefix,t);if(n>=0)return og&&console.warn("GET DEPENDENCY",i,n,i.dependencyName),e.getDependency(i.dependencyName,n)}return null}function z_(o,e){if(typeof e=="string"&&e.startsWith(o)){const t=e.substring(o.length),i=Number.parseInt(t);if(i>=0)return i}return-1}const ag="NEEDLE_persistent_assets";function GO(o){return o?.___persistentAsset===!0}class qO{get name(){return ag}parser;constructor(e){this.parser=e}async afterRoot(e){if(!this.parser?.json?.extensions)return;const t=this.parser.json.extensions[ag];if(!t)return;pt&&console.log(t);const i=new Array;for(const n of t?.assets){const s=sg(this.parser,n);s&&i.push(s)}await Promise.all(i)}resolve(e,t){const i=Number.parseInt(t);if(i>=0){pt&&console.log(t);const n=e.json.extensions[ag];if(n){const s=n?.assets[i];if(s&&typeof s=="object"){s.___persistentAsset=!0;const r=s.__type;r&&C.get(r)}return s}}return null}}const Bn=w("debugserializer");class XO{register(e,t){if(this.typeMap.has(e)){const i=this.typeMap.get(e);if(i===t)return;Bn&&console.warn("Type: "+e+" is already registered",t,i)}Bn&&console.log("Register type serializer",t.name,t,e),this.typeMap.set(e,t)}typeMap=new Map;getSerializer(e){if(e)return this.typeMap.get(e)}getSerializerForConstructor(e,t=0){if(t>20)return;if(!e||!e.constructor){Bn&&console.log("invalid type");return}const i=e.name,n=this.getSerializer(e);if(n!==void 0)return Bn&&console.log("FOUND SERIALIZER",n?.name,e.name,e.constructor.name,"for type: "+i,n,e,this.typeMap),n;const s=Object.getPrototypeOf(e);if(s&&s!==e){const r=this.getSerializerForConstructor(s,++t);if(r){const a=s.constructor||s.prototype;Bn&&console.log("FOUND SERIALIZER(in constructor) "+a.constructor.name,a.name,a,r),this.register(a,r)}return r}Bn&&console.warn("No serializer found for "+i,e,e.name,e.constructor.name)}}const Td=new XO;class Gi{name;constructor(e,t){if(this.name=t,Array.isArray(e))for(const i of e)Td.register(i,this);else Td.register(e,this)}}class QO{isDevMode=Ui();cache={};registerDefinedKeys(e,t){if(this.isDevMode&&this.cache[e]===void 0){this.cache[e]=Object.keys(t);const i=t;i.$serializedTypes&&Object.keys(i.$serializedTypes)&&this.cache[e].push(...Object.keys(i.$serializedTypes)),Bn&&console.log("registerDefinedKeys for "+e,this.cache[e],t)}}getDefinedKey(e,t){return this.cache[e]===void 0?!1:this.cache[e].includes(t)}}class lg{root;gltf;gltfId;object;target;nodeId;nodeToObject;objectToNode;context;path;type;serializable;implementationInformation;constructor(e){this.root=e}}function N_(o,e){const t=o.$serializedTypes;if(t===void 0)return null;const i={};for(const s in t){const r=o[s];if(r!=null&&typeof r=="object"){const a=Td.getSerializerForConstructor(r);if(a){i[s]=a.onSerialize(r,e);continue}}i[s]=r}function n(s){const r=C._types;for(const[a,l]of r)if(l===o.constructor)return a;return s.__name||s.constructor.name}return i.name=n(o),typeof o.guid=="string"&&(i.guid=o.guid),i}const Ed=[];function W_(o,e){if(!o)return e;typeof o.$serializedTypes=="object"&&(e||(e={}),Object.assign(e,o.$serializedTypes));const t=Object.getPrototypeOf(o);return W_(t,e)}function Ad(o,e,t){if(!o)return!1;if(t.target=o,o.onBeforeDeserialize!==void 0){const n=o.onBeforeDeserialize(e,t);if(typeof n=="boolean")return n}const i=W_(o);if(e){if(typeof e.guid=="string"&&(o.guid=e.guid),i)for(const n in i){let s=function(l){const c=l.type;return c?cg(a,c,t,void 0,o[n]):cg(a,l,t,void 0,o[n])};const r=i[n],a=e[n];if(Bn&&console.log(n,a,o,r),!(o[n]!==void 0&&a===void 0)&&(t.type=void 0,t.path=n,t.serializable=r,!(o.onBeforeDeserializeMember!==void 0&&o.onBeforeDeserializeMember(n,a,t)===!0))){if(r===null)o[n]=a;else{if(Array.isArray(r))for(let l=0;l<r.length;l++){const c=r[l],h=s(c);if(h!==void 0||l===r.length-1){o[n]=h;break}}else o[n]=s(r);Ed.length=0}o.onAfterDeserializeMember!==void 0&&o.onAfterDeserializeMember(n,a,t)}}ZO(o,e)}return KO(o,e,t.implementationInformation),o.onAfterDeserialize!==void 0&&o.onAfterDeserialize(e,t),!0}const YO=w("noerrors");function KO(o,e,t){if(YO||!e||!Ui()||!o||o.constructor&&o.constructor[NO]===!0)return;const i=o.constructor?.name,n=Object.getOwnPropertyNames(e);for(const s of n){if(s==="sourceId")continue;const r=o[s];if(r==null)continue;const a=e[s];if(t?.getDefinedKey(i,s)===!1){const l=s.charAt(0).toUpperCase()+s.slice(1);t.getDefinedKey(i,l)&&(er(bi.Warn,'<strong>Please rename</strong> "'+l+'" to "'+s+'" in '+i),console.warn('Please use lowercase for field: "'+l+'" in '+i,a,o));continue}if(a!=null){if(typeof a=="object"&&(r===void 0||!r.isObject3D)){if(typeof a.node=="number"||typeof a.guid=="string"){if(a.could_not_resolve)continue;if(!(r!==void 0&&Object.keys(r).length>1)){er(bi.Warn,`<strong>Missing serialization for object reference!</strong>
171
171
 
172
172
  Please change to:
173
173
  @serializable(Object3D)
@@ -1395,7 +1395,7 @@ If you need multisampling consider changing 'auto' to a fixed value (e.g. 4).`))
1395
1395
  // be blended onto the scene.
1396
1396
  gl_FragColor = vec4(direct, max);
1397
1397
  return;
1398
- `)},e.userData.isLightBlendMaterial=!0}applyShadowMaterial(){if(this.targetMesh)if(this.targetMesh.material.type!=="ShadowMaterial"){const e=new d0;e.color=this.shadowColor,e.opacity=this.shadowColor.alpha,this.applyMaterialOptions(e),this.targetMesh.material=e,e.userData.isShadowCatcherMaterial=!0}else{const e=this.targetMesh.material;e.color=this.shadowColor,e.opacity=this.shadowColor.alpha,this.applyMaterialOptions(e),e.userData.isShadowCatcherMaterial=!0}}applyOccluderMaterial(){if(this.targetMesh){let e=this.targetMesh.material;if(!e){const t=new xe;this.targetMesh.material=t,e=t}e.depthWrite=!0,e.stencilWrite=!0,e.colorWrite=!1,this.gameObject.renderOrder=-100}}applyMaterialOptions(e){e&&(e.depthWrite=!1,e.stencilWrite=!1)}}Dx([u()],ah.prototype,"mode"),Dx([u(se)],ah.prototype,"shadowColor");const ap=new Map;function Bx(o,e){if(ap.has(o))return ap.get(o);const t=new URL(o,window.location.href),i=xA(t,e);return ap.set(o,i),i.finally(()=>{ap.delete(o)}),i}async function xA(o,e){if(!o)return Promise.resolve(null);const t=o.pathname,i=o.toString().toLowerCase().includes("pmrem")||o.searchParams.get("pmrem")!=null,n=t.endsWith(".exr"),s=t.endsWith(".hdr"),r=t.endsWith(".ktx2");let a;if(n)a=new Yp;else if(s)a=new R0;else if(r){const{ktx2Loader:c}=Qp(e);a=c}else a=new Ml;const l=o.toString();return await a.loadAsync(l).then(c=>{if(c){const h=t.lastIndexOf("/");c.name=t.substring(h>=0?h+1:0),i&&(c.mapping=C0),a instanceof Ml&&(c.colorSpace=po)}return c}).catch(c=>(console.warn("Failed to load texture from url:",o),null))}var SA=Object.defineProperty,lh=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&SA(e,t,n),n};const hi=w("debugskybox");Ly("background-image"),Ly("environment-image");function Fx(o,e,t,i,n){if(e==="transparent"||e?.startsWith("rgb")||e?.startsWith("#"))return console.warn(`Needle Engine: Invalid ${n} value (${e}). Did you mean to set background-color instead?`),null;const s=new cp;s.allowDrop=!1,s.allowNetworking=!1,s.background=t,s.environment=i,x.addComponent(o.scene,s);const r=a=>{typeof a=="string"&&(hi&&console.log(n,"CHANGED TO",a),s.setSkybox(a))};return J0(o.domElement,n,r),s.addEventListener("destroy",()=>{hi&&console.log("Destroyed attribute remote skybox",n),eb(o.domElement,n,r)}),s.setSkybox(e)}const lp=new Array;he.registerCallback(ce.ContextCreationStart,o=>{const e=o.context,t=e.domElement.getAttribute("background-image"),i=e.domElement.getAttribute("environment-image"),n=t===i;if(t&&!n){hi&&console.log("Creating remote skybox to load "+t);const s=Fx(e,t,!0,!1,"background-image");s&&lp.push(s)}if(i){hi&&console.log("Creating remote environment to load "+i);const s=Fx(e,i,n,!0,"environment-image");s&&lp.push(s)}}),he.registerCallback(ce.ContextCreationStart,()=>Promise.all(lp).finally(()=>{lp.length=0}));const Xr=class extends T{url;allowDrop=!0;background=!0;environment=!0;allowNetworking=!0;_prevUrl;_prevLoadedEnvironment;_prevEnvironment=null;_prevBackground=null;onEnable(){this.setSkybox(this.url),this.registerDropEvents()}onDisable(){this.context.scene.environment===this._prevLoadedEnvironment&&(this.context.scene.environment=this._prevEnvironment,ii.backgroundShouldBeTransparent(this.context)||(this.context.scene.background=this._prevBackground),this._prevLoadedEnvironment=void 0),this.unregisterDropEvents(),this.context.mainCameraComponent?.applyClearFlags()}urlChangedSyncField(){this.allowNetworking&&this.url&&(this.isRemoteTexture(this.url)?this.setSkybox(this.url):hi&&console.warn(`RemoteSkybox: Not setting skybox: ${this.url} is not a remote texture. If you want to set a local texture, set allowNetworking to false.`))}async setSkybox(o,e){if(!this.activeAndEnabled||(o=CA(o,this.environment,this.background),!o))return!1;if(e??=o,this.isValidTextureType(e)||console.warn('Potentially invalid skybox URL: "'+e+'" on '+(this.name||this.gameObject?.name||"context")),hi&&console.log("Set remote skybox url: "+o),this._prevUrl===o&&this._prevLoadedEnvironment)return this.apply(),!0;this._prevLoadedEnvironment?.dispose(),this._prevLoadedEnvironment=void 0,this._prevUrl=o;const t=await Bx(o,this.context.renderer);return t?this.enabled?this._prevUrl!==o?(hi&&console.warn("RemoteSkybox: URL changed while loading texture, aborting setSkybox"),!1):(this.url=o,this._prevLoadedEnvironment=t,this.apply(),!0):(hi&&console.warn("RemoteSkybox: Component is not enabled, aborting setSkybox"),!1):(hi&&console.warn("RemoteSkybox: Failed to load texture from url",o),!1)}apply(){const o=this._prevLoadedEnvironment;o&&(o instanceof jS||o instanceof DS||o.mapping==C0||(o.mapping=BS,o.needsUpdate=!0),this.context.scene.background!==o&&(this._prevBackground=this.context.scene.background),this.context.scene.environment!==o&&(this._prevEnvironment=this.context.scene.environment),hi&&console.log("Set remote skybox",this.url,!ii.backgroundShouldBeTransparent(this.context)),this.environment&&(this.context.scene.environment=o),this.background&&!ii.backgroundShouldBeTransparent(this.context)&&(this.context.scene.background=o),this.context.mainCameraComponent?.backgroundBlurriness!==void 0&&(this.context.scene.backgroundBlurriness=this.context.mainCameraComponent.backgroundBlurriness))}validProtocols=["file:","blob:","data:"];validTextureTypes=[".ktx2",".hdr",".exr",".jpg",".jpeg",".png"];isRemoteTexture(o){return o.startsWith("http://")||o.startsWith("https://")}isValidTextureType(o){for(const e of this.validTextureTypes)if(o.includes(e))return!0;for(const e of this.validProtocols)if(o.startsWith(e))return!0;return!1}registerDropEvents(){this.unregisterDropEvents(),this.context.domElement.addEventListener("dragover",this.onDragOverEvent),this.context.domElement.addEventListener("drop",this.onDrop)}unregisterDropEvents(){this.context.domElement.removeEventListener("dragover",this.onDragOverEvent),this.context.domElement.removeEventListener("drop",this.onDrop)}onDragOverEvent=o=>{if(this.allowDrop&&o.dataTransfer)for(const e of o.dataTransfer.types)(e==="text/uri-list"||e==="Files")&&o.preventDefault()};onDrop=o=>{if(this.allowDrop&&o.dataTransfer){for(const e of o.dataTransfer.types)if(hi&&console.log(e),e==="text/uri-list"){const t=o.dataTransfer.getData(e);hi&&console.log(e,t);let i=new RegExp(/polyhaven.com\/asset_img\/.+?\/(?<name>.+)\.png/).exec(t)?.groups?.name;if(i||(i=new RegExp(/polyhaven\.com\/a\/(?<name>.+)/).exec(t)?.groups?.name),hi&&console.log(i),i){const n="https://dl.polyhaven.org/file/ph-assets/HDRIs/exr/1k/"+i+"_1k.exr";console.log(`[Remote Skybox] Setting skybox from url: ${n}`),o.preventDefault(),this.setSkybox(n);break}else if(this.isValidTextureType(t)){console.log("[Remote Skybox] Setting skybox from url: "+t),o.preventDefault(),this.setSkybox(t);break}else{console.warn(`[RemoteSkybox] Unknown url ${t}. If you want to load a skybox from a url, make sure it is a valid image url. Url must end with${this.validTextureTypes.join(", ")}.`);const n=new CustomEvent("dropped-unknown-url",{detail:{sender:this,event:o,url:t,apply:s=>{o.preventDefault(),this.setSkybox(s)}}});this.dispatchEvent(n)}}else if(e=="Files"){const t=o.dataTransfer.files.item(0);if(hi&&console.log(e,t),!t)continue;if(!this.isValidTextureType(t.name)){console.warn(`[RemoteSkybox]: File "${t.name}" is not supported. Supported files are ${this.validTextureTypes.join(", ")}`);return}o.preventDefault(),this.setSkybox(t.name);break}}}};lh([zf(Xr.prototype.urlChangedSyncField),u(URL)],Xr.prototype,"url"),lh([u()],Xr.prototype,"allowDrop"),lh([u()],Xr.prototype,"background"),lh([u()],Xr.prototype,"environment"),lh([u()],Xr.prototype,"allowNetworking");let cp=Xr;function CA(o,e,t){if(o==null)return null;const i=e&&!t;switch(o.toLowerCase()){case"studio":return i?"https://cdn.needle.tools/static/skybox/modelviewer-Neutral-small.pmrem4x4.ktx2?pmrem":"https://cdn.needle.tools/static/skybox/modelviewer-Neutral.pmrem4x4.ktx2?pmrem";case"blurred-skybox":return i?"https://cdn.needle.tools/static/skybox/blurred-skybox-small.pmrem4x4.ktx2?pmrem":"https://cdn.needle.tools/static/skybox/blurred-skybox.pmrem4x4.ktx2?pmrem";case"quicklook-ar":return i?"https://cdn.needle.tools/static/skybox/QuickLook-ARMode-small.pmrem4x4.ktx2?pmrem":"https://cdn.needle.tools/static/skybox/QuickLook-ARMode.pmrem4x4.ktx2?pmrem";case"quicklook":return i?"https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode-small.pmrem4x4.ktx2?pmrem":"https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode.pmrem4x4.ktx2?pmrem"}return o}var PA=Object.defineProperty,hp=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&PA(e,t,n),n};const ch=class k1 extends T{target=null;followFactor=.1;rotateFactor=.1;positionAxes=Ia.All;flipForward=!1;static _invertForward=new z().setFromAxisAngle(new b(0,1,0),Math.PI);_firstUpdate=!0;onBeforeRender(){this.updateNow(!1)}updateNow(e){if(!(!this.target||this.target===this.gameObject)){if(this.followFactor>0){const t=Z(this.target),i=this._firstUpdate||e?1:B.clamp01(this.context.time.deltaTime*this.followFactor),n=this.worldPosition;this.positionAxes&Ia.X&&(n.x=B.lerp(n.x,t.x,i)),this.positionAxes&Ia.Y&&(n.y=B.lerp(n.y,t.y,i)),this.positionAxes&Ia.Z&&(n.z=B.lerp(n.z,t.z,i)),this.worldPosition=n}if(this.rotateFactor>0){const t=be(this.target);this.flipForward&&t.premultiply(k1._invertForward);const i=this._firstUpdate||e?1:B.clamp01(this.context.time.deltaTime*this.rotateFactor);this.worldQuaternion=this.worldQuaternion.slerp(t,i)}this._firstUpdate=!1}}};hp([u(M)],ch.prototype,"target"),hp([u()],ch.prototype,"followFactor"),hp([u()],ch.prototype,"rotateFactor"),hp([u()],ch.prototype,"positionAxes");let dp=ch;var OA=Object.defineProperty,hh=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&OA(e,t,n),n};const dh=w("debugspatialtrigger"),Ux=new es,zx=new es;function kA(o,e){return Ux.mask=o,zx.mask=e,Ux.test(zx)}class io extends T{triggerMask=0;onEnter;onStay;onExit;start(){dh&&console.log(this.name,this.triggerMask,this)}update(){this.currentIntersected.length=0;for(const e of up.triggers)kA(e.triggerMask,this.triggerMask)&&e.test(this.gameObject)&&this.currentIntersected.push(e);for(let e=this.lastIntersected.length-1;e>=0;e--){const t=this.lastIntersected[e];this.currentIntersected.indexOf(t)<0&&(this.onExitTrigger(t),this.lastIntersected.splice(e,1))}for(const e of this.currentIntersected)this.lastIntersected.indexOf(e)<0&&this.onEnterTrigger(e),this.onStayTrigger(e);this.lastIntersected.length=0,this.lastIntersected.push(...this.currentIntersected)}currentIntersected=[];lastIntersected=[];onEnterTrigger(e){dh&&console.log("ENTER TRIGGER",this.name,e.name,this,e),e.raiseOnEnterEvent(this),this.onEnter?.invoke()}onExitTrigger(e){dh&&console.log("EXIT TRIGGER",this.name,e.name),e.raiseOnExitEvent(this),this.onExit?.invoke()}onStayTrigger(e){e.raiseOnStayEvent(this),this.onStay?.invoke()}}hh([u()],io.prototype,"triggerMask"),hh([u(ye)],io.prototype,"onEnter"),hh([u(ye)],io.prototype,"onStay"),hh([u(ye)],io.prototype,"onExit");const Nx=class Ep extends T{static triggers=[];triggerMask;boxHelper;start(){dh&&console.log(this.name,this.triggerMask,this)}onEnable(){Ep.triggers.push(this),this.boxHelper||(this.boxHelper=x.addComponent(this.gameObject,_t),this.boxHelper?.showHelper(null,dh))}onDisable(){Ep.triggers.splice(Ep.triggers.indexOf(this),1)}test(e){return this.boxHelper?this.boxHelper.isInBox(e)??!1:!1}raiseOnEnterEvent(e){x.foreachComponent(this.gameObject,t=>{t!==e&&t instanceof io&&t.onEnterTrigger(this)},!1)}raiseOnStayEvent(e){x.foreachComponent(this.gameObject,t=>{t!==e&&t instanceof io&&t.onStayTrigger(this)},!1)}raiseOnExitEvent(e){x.foreachComponent(this.gameObject,t=>{t!==e&&t instanceof io&&t.onExitTrigger(this)},!1)}};hh([u()],Nx.prototype,"triggerMask");let up=Nx;var MA=Object.defineProperty,RA=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&MA(e,t,n),n};const Ai=w("debugspectator");class pp extends T{cam=null;useKeys=!0;_mode=0;get mode(){return this._mode}set mode(e){this._mode=e}get isSpectating(){return this._handler?.currentTarget!==void 0}isSpectatingUser(e){return this.target?.userId===e}isFollowedBy(e){return this.followers?.includes(e)}get followers(){return this._networking.followers}stopSpectating(){if(this.context.isInXR){this.followSelf();return}this.target=void 0}get localId(){return this.context.connection.connectionId??"local"}set target(e){if(this._handler){const t=this._handler.currentTarget?.userId,i=this.context.players.getPlayerView(this.localId);e===void 0||this.context.isInXR===!1&&i?.currentObject===e.currentObject?this._handler.currentTarget!==void 0&&(this._handler.disable(),x.setActive(this.gameObject,!1),this.orbit&&(this.orbit.enabled=!0),this._networking.onSpectatedObjectChanged(e,t)):this._handler.currentTarget!==e&&(this._handler.set(e),x.setActive(this.gameObject,!0),this.orbit&&(this.orbit.enabled=!1),this._networking.onSpectatedObjectChanged(e,t))}}get target(){return this._handler?.currentTarget}requestAllFollowMe(){this._networking.onRequestFollowMe()}get isSpectatingSelf(){return this.isSpectating&&this.target?.currentObject===this.context.players.getPlayerView(this.localId)?.currentObject}orbit=null;_handler;eventSub_WebXRRequestStartEvent=null;eventSub_WebXRStartEvent=null;eventSub_WebXREndEvent=null;_debug;_networking;awake(){if(this._debug=new AA(this.context,this),this._networking=new jA(this.context,this),this._networking.awake(),x.setActive(this.gameObject,!1),this.cam=x.getComponent(this.gameObject,ii),!this.cam){console.warn("SpectatorCamera: Spectator camera needs camera component on the same object.",this);return}!this._handler&&this.cam&&(this._handler=new TA(this.context,this.cam,this)),this.orbit=x.getComponent(this.context.mainCamera,me)}onDestroy(){this.stopSpectating(),this._handler?.destroy(),this._networking?.destroy()}isSupportedPlatform(){const e=window.navigator.userAgent,t=/Windows|MacOS/.test(e),i=/Windows NT/.test(e)&&/Edg/.test(e)&&!/Win64/.test(e);return t&&!i}onBeforeXR(e){this.isSupportedPlatform()&&x.setActive(this.gameObject,!0)}onEnterXR(e){this.isSupportedPlatform()&&(Ai&&console.log(this.context.mainCamera),this.context.mainCamera&&this.followSelf())}onLeaveXR(e){this.context.removeCamera(this.cam),x.setActive(this.gameObject,!1),this.orbit&&(this.orbit.enabled=!0),this._handler?.set(void 0),this._handler?.disable(),this.isSpectatingSelf&&this.stopSpectating()}followSelf(){this.target=this.context.players.getPlayerView(this.context.connection.connectionId),this.target||(this.context.players.setPlayerView(this.localId,this.context.mainCamera,ds.Headset),this.target=this.context.players.getPlayerView(this.localId)),Ai&&console.log("Follow self",this.target)}onAfterRender(){if(!this.cam)return;const e=this.context.renderer,t=e.xr.enabled;if(!e.xr.isPresenting&&!this._handler?.currentTarget)return;this._handler?.update(this._mode);const i=e.getRenderTarget();let n=null;const s=e.state;if(!i){if(!e.state.bindFramebuffer||!s.bindXRFramebuffer)return;n=e._framebuffer,s.bindXRFramebuffer(null)}this.setAvatarFlagsBeforeRender();const r=this.context.mainCameraComponent;if(r){const c=r.backgroundColor;c&&e.setClearColor(c,c.alpha),this.cam.backgroundColor=c,this.cam.clearFlags=r.clearFlags,this.cam.nearClipPlane=r.nearClipPlane,this.cam.farClipPlane=r.farClipPlane}else e.setClearColor(new ne(1,1,1));e.setRenderTarget(null),e.xr.enabled=!1;const a=this.cam?.threeCamera;this.context.updateAspect(a);const l=e.xr.isPresenting;e.xr.isPresenting=!1,e.setSize(this.context.domWidth,this.context.domHeight),e.render(this.context.scene,a),e.xr.isPresenting=l,e.xr.enabled=t,i?e.setRenderTarget(i):s.bindXRFramebuffer&&s.bindXRFramebuffer(n),this.resetAvatarFlags()}setAvatarFlagsBeforeRender(){const e=this._mode===0;for(const t of Le.instances)if(t.avatar&&"isLocalAvatar"in t.avatar&&"flags"in t.avatar){let i=Gn.All;this.isSpectatingSelf&&(i=e&&t.avatar.isLocalAvatar?Gn.FirstPerson:Gn.ThirdPerson);const n=t.avatar.flags;if(!n)continue;for(const s of n)s.UpdateVisible(i)}}resetAvatarFlags(){for(const e of Le.instances)if(e.avatar&&"flags"in e.avatar){const t=e.avatar.flags;if(!t)continue;for(const i of t)"isLocalAvatar"in e.avatar&&e.avatar?.isLocalAvatar?i.UpdateVisible(Gn.FirstPerson):i.UpdateVisible(Gn.ThirdPerson)}}}RA([u()],pp.prototype,"useKeys");class TA{context;cam;spectator;follow;target;view;currentObject;get currentTarget(){return this.view}constructor(e,t,i){this.context=e,this.cam=t,this.spectator=i}set(e){const t=e?.currentObject;if(!t){this.spectator.stopSpectating();return}t!==this.currentObject&&(this.currentObject=t,this.view=e,this.follow||(this.follow=x.addComponent(this.cam.gameObject,dp)),this.target||(this.target=new M),t.add(this.target),this.follow.enabled=!0,this.follow.target=this.target,Ai&&console.log("FOLLOW",t),this.context.isInXR?this.context.removeCamera(this.cam):this.context.setCurrentCamera(this.cam))}disable(){Ai&&console.log("STOP FOLLOW",this.currentObject),this.view=void 0,this.currentObject=void 0,this.context.removeCamera(this.cam),this.follow&&(this.follow.enabled=!1)}destroy(){this.target?.removeFromParent(),this.follow&&x.destroy(this.follow)}update(e){if(this.currentTarget?.isConnected===!1||this.currentTarget?.removed===!0){Ai&&console.log("Target disconnected or timeout",this.currentTarget),this.spectator.stopSpectating();return}this.currentTarget&&this.currentTarget?.currentObject!==this.currentObject&&(Ai&&console.log("Target changed",this.currentObject,"to",this.currentTarget.currentObject),this.set(this.currentTarget));const t=this.context.mainCamera;if(t){const n=this.cam.threeCamera;(n.near!==t.near||n.far!==t.far)&&(n.near=t.near,n.far=t.far,n.updateProjectionMatrix())}const i=this.follow?.target;if(!(!i||!this.follow)){switch(e){case 0:this.view?.viewDevice!==ds.Browser?(this.follow.followFactor=5,this.follow.rotateFactor=5):(this.follow.followFactor=50,this.follow.rotateFactor=50),i.position.set(0,0,0);break;case 1:this.follow.followFactor=3,this.follow.rotateFactor=2,i.position.set(0,.5,1.5);break}this.follow.flipForward=!1,this.view?.viewDevice!==ds.Browser?i.quaternion.copy(EA):i.quaternion.identity()}}}const EA=new z().setFromAxisAngle(new b(0,1,0),Math.PI);class AA{context;spectator;constructor(e,t){this.context=e,this.spectator=t,console.log("[Spectator Camera] Click other avatars or cameras to follow them. Press ESC to exit spectator mode."),this.context.domElement.addEventListener("keydown",n=>{!this.spectator.useKeys||n.key==="Escape"&&this.spectator.stopSpectating()});let i=0;this.context.input.addEventListener(Ee.PointerDown,n=>{i=this.context.time.time}),this.context.input.addEventListener(Ee.PointerUp,n=>{const s=this.context.time.time-i;s>1?this.spectator.stopSpectating():this.context.input.getPointerClicked(0)&&s<.3&&this.trySelectObject()})}trySelectObject(){const e=new cs;e.setMask(16777215);const t=this.context.physics.raycast(e);if(Ai&&console.log(...t),t?.length)for(const i of t){if(i.distance<.2)continue;const n=i.object,s=x.getComponentInParent(n,Le),r=s?.connectionId;if(r){const a=this.context.players.getPlayerView(r);this.spectator.target=a,Ai&&console.log("spectate",r,s);break}}}}class IA{guid;dontSave=!0;targetUserId;stoppedFollowing;constructor(e,t,i){this.guid=e,this.targetUserId=t,this.stoppedFollowing=i}}class LA{guid;userId;constructor(e,t){this.guid=e.guid,this.userId=t}}class jA{followers=[];context;spectator;_followerEventMethod;_requestFollowMethod;_joinedRoomMethod;constructor(e,t){this.context=e,this.spectator=t,this._followerEventMethod=this.onFollowerEvent.bind(this),this._requestFollowMethod=this.onRequestFollowEvent.bind(this),this._joinedRoomMethod=this.onUserJoinedRoom.bind(this)}awake(){this.context.connection.beginListen("spectator-follower-changed",this._followerEventMethod),this.context.connection.beginListen("spectator-request-follow",this._requestFollowMethod),this.context.connection.beginListen(ee.JoinedRoom,this._joinedRoomMethod),this.context.domElement.addEventListener("keydown",e=>{this.spectator.useKeys&&(e.key==="f"?this.onRequestFollowMe():e.key==="Escape"&&this.onRequestFollowMe(!0))})}destroy(){this.context.connection.stopListen("spectator-follower-changed",this._followerEventMethod),this.context.connection.stopListen("spectator-request-follow",this._requestFollowMethod),this.context.connection.stopListen(ee.JoinedRoom,this._joinedRoomMethod)}onSpectatedObjectChanged(e,t){if(Ai&&console.log(this.context.connection.connectionId,"onSpectatedObjectChanged",e,t),this.context.connection.connectionId){const i=e?.userId===void 0,n=i?t:e?.userId,s=new IA(this.context.connection.connectionId,n,i);this.context.connection.send("spectator-follower-changed",s)}}onRequestFollowMe(e=!1){if(Ai&&console.log("Request follow",this.context.connection.connectionId),this.context.connection.connectionId){this.spectator.stopSpectating();const t=e?void 0:this.context.connection.connectionId,i=new LA(this.spectator,t);this.context.connection.send("spectator-request-follow",i)}}onUserJoinedRoom(){w("followme")&&this.onRequestFollowMe()}onFollowerEvent(e){const t=e.targetUserId,i=e.guid;if(Ai&&console.log(e),t===this.context.connection.connectionId)if(e.stoppedFollowing){const n=this.followers.indexOf(i);n!==-1&&(this.followers.splice(n,1),this.removeDisconnectedFollowers(),console.log(i,"unfollows you",this.followers.length))}else this.followers.includes(i)||(this.followers.push(i),this.removeDisconnectedFollowers(),console.log(i,"follows you",this.followers.length))}removeDisconnectedFollowers(){for(let e=this.followers.length-1;e>=0;e--){const t=this.followers[e];this.context.connection.userIsInRoom(t)===!1&&this.followers.splice(e,1)}}_lastRequestFollowUser;onRequestFollowEvent(e){if(this._lastRequestFollowUser=e,e.userId===this.context.connection.connectionId)this.spectator.stopSpectating();else if(e.userId===void 0)this.spectator.stopSpectating();else{const t=this.context.players.getPlayerView(e.userId);if(t)this.spectator.target=t;else return Ai&&console.warn("Could not find view",e.userId),this.enforceFollow(),!1}return!0}_enforceFollowInterval;enforceFollow(){this._enforceFollowInterval||(this._enforceFollowInterval=setInterval(()=>{this._lastRequestFollowUser===void 0||this._lastRequestFollowUser.userId&&this.spectator.isFollowedBy(this._lastRequestFollowUser.userId)?(clearInterval(this._enforceFollowInterval),this._enforceFollowInterval=void 0):(Ai&&console.log("REQUEST FOLLOW AGAIN",this._lastRequestFollowUser.userId),this.onRequestFollowEvent(this._lastRequestFollowUser))},1e3))}}class ro{bb=null;bb_pos=0;__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSyncedCameraModel(e,t){return(t||new ro).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSyncedCameraModel(e,t){return e.setPosition(e.position()+B0),(t||new ro).__init(e.readInt32(e.position())+e.position(),e)}userId(e){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}guid(e){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}dontSave(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}pos(e){const t=this.bb.__offset(this.bb_pos,10);return t?(e||new Sr).__init(this.bb_pos+t,this.bb):null}rot(e){const t=this.bb.__offset(this.bb_pos,12);return t?(e||new Sr).__init(this.bb_pos+t,this.bb):null}static startSyncedCameraModel(e){e.startObject(5)}static addUserId(e,t){e.addFieldOffset(0,t,0)}static addGuid(e,t){e.addFieldOffset(1,t,0)}static addDontSave(e,t){e.addFieldInt8(2,+t,0)}static addPos(e,t){e.addFieldStruct(3,t,0)}static addRot(e,t){e.addFieldStruct(4,t,0)}static endSyncedCameraModel(e){return e.endObject()}static finishSyncedCameraModelBuffer(e,t){e.finish(t)}static finishSizePrefixedSyncedCameraModelBuffer(e,t){e.finish(t,void 0,!0)}}var DA=Object.defineProperty,BA=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&DA(e,t,n),n};const mp="SCAM";jm(mp,ro.getRootAsSyncedCameraModel);const Ii=new Zp;class FA{userId;guid;constructor(e,t){this.guid=t,this.userId=e}send(e,t){if(e){Ii.clear();const i=Ii.createString(this.guid),n=Ii.createString(this.userId);ro.startSyncedCameraModel(Ii),ro.addGuid(Ii,i),ro.addUserId(Ii,n);const s=Z(e),r=ld(e);ro.addPos(Ii,Sr.createVec3(Ii,s.x,s.y,s.z)),ro.addRot(Ii,Sr.createVec3(Ii,r.x,r.y,r.z));const a=ro.endSyncedCameraModel(Ii);Ii.finish(a,mp),t.sendBinary(Ii.asUint8Array())}}}const Wx=class c0 extends T{static instances=[];getCameraObject(e){const t=this.userToCamMap[e];return t?this.remoteCams[t].obj:null}cameraPrefab=null;_lastWorldPosition;_lastWorldQuaternion;_model=null;_needsUpdate=!0;_lastUpdateTime=0;remoteCams={};userToCamMap={};_camTimeoutInSeconds=10;_receiveCallback=null;async awake(){this._lastWorldPosition=this.worldPosition.clone(),this._lastWorldQuaternion=this.worldQuaternion.clone(),this.cameraPrefab&&("uri"in this.cameraPrefab&&(this.cameraPrefab=await this.cameraPrefab.instantiate(this.gameObject)),this.cameraPrefab&&"isObject3D"in this.cameraPrefab&&(this.cameraPrefab.visible=!1))}onEnable(){this._receiveCallback=this.context.connection.beginListenBinary(mp,this.onReceivedRemoteCameraInfoBin.bind(this))}onDisable(){this.context.connection.stopListenBinary(mp,this._receiveCallback)}update(){for(const n in this.remoteCams){const s=this.remoteCams[n],r=this.context.time.realtimeSinceStartup-s.lastUpdate;if(!s||r>this._camTimeoutInSeconds){A()&&console.log("Remote cam timeout",n),s?.obj&&x.destroy(s.obj),delete this.remoteCams[n],s&&delete this.userToCamMap[s.userId],c0.instances.push(s),this.context.players.removePlayerView(s.userId,ds.Browser);continue}}if(this.context.isInXR)return;const e=this.context.mainCamera;if(e===null){this.enabled=!1;return}if(!this.context.connection.isConnected||this.context.connection.connectionId===null)return;this._model===null&&(this._model=new FA(this.context.connection.connectionId,this.context.connection.connectionId+"_camera"));const t=Z(e),i=be(e);(t.distanceTo(this._lastWorldPosition)>.001||i.angleTo(this._lastWorldQuaternion)>.01)&&(this._needsUpdate=!0),this._lastWorldPosition.copy(t),this._lastWorldQuaternion.copy(i),!((!this._needsUpdate||this.context.time.frameCount%2!==0)&&!(this.context.time.realtimeSinceStartup-this._lastUpdateTime>this._camTimeoutInSeconds*.5))&&(this._lastUpdateTime=this.context.time.realtimeSinceStartup,this._needsUpdate=!1,this._model.send(e,this.context.connection),this.context.isInXR||this.context.players.setPlayerView(this.context.connection.connectionId,e,ds.Browser))}onReceivedRemoteCameraInfoBin(e){const t=e.guid();if(!t)return;const i=e.userId();if(!i||!this.context.connection.userIsInRoom(i)||!this.cameraPrefab)return;let n=this.remoteCams[t];if(!n)if("isObject3D"in this.cameraPrefab){const l=new Mn;l.context=this.context;const c=x.instantiate(this.cameraPrefab,l);n=this.remoteCams[t]={obj:c,lastUpdate:this.context.time.realtimeSinceStartup,userId:i},n.obj.visible=!0,this.gameObject.add(c),this.userToCamMap[i]=t,c0.instances.push(n);const h=x.getOrAddComponent(c,Le);h.connectionId=i,h.avatar=c}else return;const s=n.obj;this.context.players.setPlayerView(i,s,ds.Browser),n.lastUpdate=this.context.time.realtimeSinceStartup,an.markDirty(s);const r=e.pos();r&&tr(s,r.x(),r.y(),r.z());const a=e.rot();a&&jl(s,a.x(),a.y(),a.z())}};BA([u([M,ie])],Wx.prototype,"cameraPrefab");let jy=Wx;var UA=Object.defineProperty,zA=Object.getOwnPropertyDescriptor,Us=(o,e,t,i)=>{for(var n=i>1?void 0:i?zA(e,t):e,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(i?r(e,t,n):r(n))||n);return i&&n&&UA(e,t,n),n};const Dy="view",By=w("debugsyncedroom");class On extends T{roomName="";urlParameterName="room";joinRandomRoom;requireRoomParameter=!1;autoRejoin=!0;createJoinButton=!0;createViewOnlyButton=!1;get currentRoomName(){return w(Dy)||w(this.urlParameterName)}_lastJoinedRoom;set roomPrefix(e){this._roomPrefix=e}get roomPrefix(){return this._roomPrefix}_roomPrefix="";awake(){this.joinRandomRoom===void 0&&this.roomName?.length<=0&&(this.joinRandomRoom=!0),By&&console.log(`SyncedRoom roomName:${this.roomName}, urlParamName:${this.urlParameterName}, joinRandomRoom:${this.joinRandomRoom}`)}onEnable(){const e=w(Dy);if(e&&typeof e=="string"&&e.length>0){console.log("Join as viewer"),this.context.connection.joinRoom(e,!0);return}if(this.tryJoinRoom(),this.createJoinButton){const t=this.createRoomButton();this.context.menu.appendChild(t)}this.createViewOnlyButton&&this.onEnableViewOnlyButton()}onDisable(){this._roomButton?.remove(),this.onDisableViewOnlyButton(),this.roomName&&this.roomName.length>0&&this.context.connection.leaveRoom(this.roomName)}onDestroy(){this.destroyRoomButton()}tryJoinRandomRoom(){this.setRandomRoomUrlParameter(),this.tryJoinRoom()}tryJoinRoom(e=0){e===void 0&&(e=0);let t=!1;if(this.urlParameterName?.length>0){const i=w(this.urlParameterName);if(i&&(typeof i=="string"||typeof i=="number")){t=!0;const n=K0(i.toString());this.roomName=n}else if(this.joinRandomRoom&&(console.log("No room name found in url, generating random one"),this.setRandomRoomUrlParameter(),e<1))return this.tryJoinRoom(e+1)}else this.joinRandomRoom&&(this.roomName===null||this.roomName===void 0||this.roomName.length<=0)&&(this.roomName=this.generateRoomName());return this.requireRoomParameter&&!t?((By||A())&&console.warn('[SyncedRoom] Missing required room parameter "'+this.urlParameterName+`" in url - will not connect.
1398
+ `)},e.userData.isLightBlendMaterial=!0}applyShadowMaterial(){if(this.targetMesh)if(this.targetMesh.material.type!=="ShadowMaterial"){const e=new d0;e.color=this.shadowColor,e.opacity=this.shadowColor.alpha,this.applyMaterialOptions(e),this.targetMesh.material=e,e.userData.isShadowCatcherMaterial=!0}else{const e=this.targetMesh.material;e.color=this.shadowColor,e.opacity=this.shadowColor.alpha,this.applyMaterialOptions(e),e.userData.isShadowCatcherMaterial=!0}}applyOccluderMaterial(){if(this.targetMesh){let e=this.targetMesh.material;if(!e){const t=new xe;this.targetMesh.material=t,e=t}e.depthWrite=!0,e.stencilWrite=!0,e.colorWrite=!1,this.gameObject.renderOrder=-100}}applyMaterialOptions(e){e&&(e.depthWrite=!1,e.stencilWrite=!1)}}Dx([u()],ah.prototype,"mode"),Dx([u(se)],ah.prototype,"shadowColor");const ap=new Map;function Bx(o,e){if(ap.has(o))return ap.get(o);const t=new URL(o,window.location.href),i=xA(t,e);return ap.set(o,i),i.finally(()=>{ap.delete(o)}),i}async function xA(o,e){if(!o)return Promise.resolve(null);const t=o.pathname,i=o.toString().toLowerCase().includes("pmrem")||o.searchParams.get("pmrem")!=null,n=t.endsWith(".exr"),s=t.endsWith(".hdr"),r=t.endsWith(".ktx2");let a;if(n)a=new Yp;else if(s)a=new R0;else if(r){const{ktx2Loader:c}=Qp(e);a=c}else a=new Ml;const l=o.toString();return await a.loadAsync(l).then(c=>{if(c){const h=t.lastIndexOf("/");c.name=t.substring(h>=0?h+1:0),i&&(c.mapping=C0),a instanceof Ml&&(c.colorSpace=po)}return c}).catch(c=>(console.warn("Failed to load texture from url:",o),null))}var SA=Object.defineProperty,lh=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&SA(e,t,n),n};const hi=w("debugskybox");Ly("background-image"),Ly("environment-image");function Fx(o,e,t,i,n){if(e==="transparent"||e?.startsWith("rgb")||e?.startsWith("#"))return console.warn(`Needle Engine: Invalid ${n} value (${e}). Did you mean to set background-color instead?`),null;const s=new cp;s.allowDrop=!1,s.allowNetworking=!1,s.background=t,s.environment=i,x.addComponent(o.scene,s);const r=a=>{typeof a=="string"&&(hi&&console.log(n,"CHANGED TO",a),s.setSkybox(a))};return J0(o.domElement,n,r),s.addEventListener("destroy",()=>{hi&&console.log("Destroyed attribute remote skybox",n),eb(o.domElement,n,r)}),s.setSkybox(e)}const lp=new Array;he.registerCallback(ce.ContextCreationStart,o=>{const e=o.context,t=e.domElement.getAttribute("background-image"),i=e.domElement.getAttribute("environment-image"),n=t===i;if(t&&!n){hi&&console.log("Creating remote skybox to load "+t);const s=Fx(e,t,!0,!1,"background-image");s&&lp.push(s)}if(i){hi&&console.log("Creating remote environment to load "+i);const s=Fx(e,i,n,!0,"environment-image");s&&lp.push(s)}}),he.registerCallback(ce.ContextCreationStart,()=>Promise.all(lp).finally(()=>{lp.length=0}));const Xr=class extends T{url;allowDrop=!0;background=!0;environment=!0;allowNetworking=!0;_prevUrl;_prevLoadedEnvironment;_prevEnvironment=null;_prevBackground=null;onEnable(){this.setSkybox(this.url),this.registerDropEvents()}onDisable(){this.context.scene.environment===this._prevLoadedEnvironment&&(this.context.scene.environment=this._prevEnvironment,ii.backgroundShouldBeTransparent(this.context)||(this.context.scene.background=this._prevBackground),this._prevLoadedEnvironment=void 0),this.unregisterDropEvents(),this.context.mainCameraComponent?.applyClearFlags()}urlChangedSyncField(){this.allowNetworking&&this.url&&(this.isRemoteTexture(this.url)?this.setSkybox(this.url):hi&&console.warn(`RemoteSkybox: Not setting skybox: ${this.url} is not a remote texture. If you want to set a local texture, set allowNetworking to false.`))}async setSkybox(o,e){if(!this.activeAndEnabled||(o=CA(o,this.environment,this.background),!o))return!1;if(e??=o,this.isValidTextureType(e)||console.warn('Potentially invalid skybox URL: "'+e+'" on '+(this.name||this.gameObject?.name||"context")),hi&&console.log("Set remote skybox url: "+o),this._prevUrl===o&&this._prevLoadedEnvironment)return this.apply(),!0;this._prevLoadedEnvironment?.dispose(),this._prevLoadedEnvironment=void 0,this._prevUrl=o;const t=await Bx(o,this.context.renderer);return t?!this.enabled||this.destroyed?(hi&&console.warn("RemoteSkybox: Component is disabled or destroyed"),!1):this._prevUrl!==o?(hi&&console.warn("RemoteSkybox: URL changed while loading texture, aborting setSkybox"),!1):(this.url=o,this._prevLoadedEnvironment=t,this.apply(),!0):(hi&&console.warn("RemoteSkybox: Failed to load texture from url",o),!1)}apply(){const o=this._prevLoadedEnvironment;if(o&&(o instanceof jS||o instanceof DS||o.mapping==C0||(o.mapping=BS,o.needsUpdate=!0),!this.destroyed)){if(!this.context){console.warn("RemoteSkybox: Context is not available - can not apply skybox.");return}this.context.scene.background!==o&&(this._prevBackground=this.context.scene.background),this.context.scene.environment!==o&&(this._prevEnvironment=this.context.scene.environment),hi&&console.log("Set remote skybox",this.url,!ii.backgroundShouldBeTransparent(this.context)),this.environment&&(this.context.scene.environment=o),this.background&&!ii.backgroundShouldBeTransparent(this.context)&&(this.context.scene.background=o),this.context.mainCameraComponent?.backgroundBlurriness!==void 0&&(this.context.scene.backgroundBlurriness=this.context.mainCameraComponent.backgroundBlurriness)}}validProtocols=["file:","blob:","data:"];validTextureTypes=[".ktx2",".hdr",".exr",".jpg",".jpeg",".png"];isRemoteTexture(o){return o.startsWith("http://")||o.startsWith("https://")}isValidTextureType(o){for(const e of this.validTextureTypes)if(o.includes(e))return!0;for(const e of this.validProtocols)if(o.startsWith(e))return!0;return!1}registerDropEvents(){this.unregisterDropEvents(),this.context.domElement.addEventListener("dragover",this.onDragOverEvent),this.context.domElement.addEventListener("drop",this.onDrop)}unregisterDropEvents(){this.context.domElement.removeEventListener("dragover",this.onDragOverEvent),this.context.domElement.removeEventListener("drop",this.onDrop)}onDragOverEvent=o=>{if(this.allowDrop&&o.dataTransfer)for(const e of o.dataTransfer.types)(e==="text/uri-list"||e==="Files")&&o.preventDefault()};onDrop=o=>{if(this.allowDrop&&o.dataTransfer){for(const e of o.dataTransfer.types)if(hi&&console.log(e),e==="text/uri-list"){const t=o.dataTransfer.getData(e);hi&&console.log(e,t);let i=new RegExp(/polyhaven.com\/asset_img\/.+?\/(?<name>.+)\.png/).exec(t)?.groups?.name;if(i||(i=new RegExp(/polyhaven\.com\/a\/(?<name>.+)/).exec(t)?.groups?.name),hi&&console.log(i),i){const n="https://dl.polyhaven.org/file/ph-assets/HDRIs/exr/1k/"+i+"_1k.exr";console.log(`[Remote Skybox] Setting skybox from url: ${n}`),o.preventDefault(),this.setSkybox(n);break}else if(this.isValidTextureType(t)){console.log("[Remote Skybox] Setting skybox from url: "+t),o.preventDefault(),this.setSkybox(t);break}else{console.warn(`[RemoteSkybox] Unknown url ${t}. If you want to load a skybox from a url, make sure it is a valid image url. Url must end with${this.validTextureTypes.join(", ")}.`);const n=new CustomEvent("dropped-unknown-url",{detail:{sender:this,event:o,url:t,apply:s=>{o.preventDefault(),this.setSkybox(s)}}});this.dispatchEvent(n)}}else if(e=="Files"){const t=o.dataTransfer.files.item(0);if(hi&&console.log(e,t),!t)continue;if(!this.isValidTextureType(t.name)){console.warn(`[RemoteSkybox]: File "${t.name}" is not supported. Supported files are ${this.validTextureTypes.join(", ")}`);return}o.preventDefault(),this.setSkybox(t.name);break}}}};lh([zf(Xr.prototype.urlChangedSyncField),u(URL)],Xr.prototype,"url"),lh([u()],Xr.prototype,"allowDrop"),lh([u()],Xr.prototype,"background"),lh([u()],Xr.prototype,"environment"),lh([u()],Xr.prototype,"allowNetworking");let cp=Xr;function CA(o,e,t){if(o==null)return null;const i=e&&!t;switch(o.toLowerCase()){case"studio":return i?"https://cdn.needle.tools/static/skybox/modelviewer-Neutral-small.pmrem4x4.ktx2?pmrem":"https://cdn.needle.tools/static/skybox/modelviewer-Neutral.pmrem4x4.ktx2?pmrem";case"blurred-skybox":return i?"https://cdn.needle.tools/static/skybox/blurred-skybox-small.pmrem4x4.ktx2?pmrem":"https://cdn.needle.tools/static/skybox/blurred-skybox.pmrem4x4.ktx2?pmrem";case"quicklook-ar":return i?"https://cdn.needle.tools/static/skybox/QuickLook-ARMode-small.pmrem4x4.ktx2?pmrem":"https://cdn.needle.tools/static/skybox/QuickLook-ARMode.pmrem4x4.ktx2?pmrem";case"quicklook":return i?"https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode-small.pmrem4x4.ktx2?pmrem":"https://cdn.needle.tools/static/skybox/QuickLook-ObjectMode.pmrem4x4.ktx2?pmrem"}return o}var PA=Object.defineProperty,hp=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&PA(e,t,n),n};const ch=class k1 extends T{target=null;followFactor=.1;rotateFactor=.1;positionAxes=Ia.All;flipForward=!1;static _invertForward=new z().setFromAxisAngle(new b(0,1,0),Math.PI);_firstUpdate=!0;onBeforeRender(){this.updateNow(!1)}updateNow(e){if(!(!this.target||this.target===this.gameObject)){if(this.followFactor>0){const t=Z(this.target),i=this._firstUpdate||e?1:B.clamp01(this.context.time.deltaTime*this.followFactor),n=this.worldPosition;this.positionAxes&Ia.X&&(n.x=B.lerp(n.x,t.x,i)),this.positionAxes&Ia.Y&&(n.y=B.lerp(n.y,t.y,i)),this.positionAxes&Ia.Z&&(n.z=B.lerp(n.z,t.z,i)),this.worldPosition=n}if(this.rotateFactor>0){const t=be(this.target);this.flipForward&&t.premultiply(k1._invertForward);const i=this._firstUpdate||e?1:B.clamp01(this.context.time.deltaTime*this.rotateFactor);this.worldQuaternion=this.worldQuaternion.slerp(t,i)}this._firstUpdate=!1}}};hp([u(M)],ch.prototype,"target"),hp([u()],ch.prototype,"followFactor"),hp([u()],ch.prototype,"rotateFactor"),hp([u()],ch.prototype,"positionAxes");let dp=ch;var OA=Object.defineProperty,hh=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&OA(e,t,n),n};const dh=w("debugspatialtrigger"),Ux=new es,zx=new es;function kA(o,e){return Ux.mask=o,zx.mask=e,Ux.test(zx)}class io extends T{triggerMask=0;onEnter;onStay;onExit;start(){dh&&console.log(this.name,this.triggerMask,this)}update(){this.currentIntersected.length=0;for(const e of up.triggers)kA(e.triggerMask,this.triggerMask)&&e.test(this.gameObject)&&this.currentIntersected.push(e);for(let e=this.lastIntersected.length-1;e>=0;e--){const t=this.lastIntersected[e];this.currentIntersected.indexOf(t)<0&&(this.onExitTrigger(t),this.lastIntersected.splice(e,1))}for(const e of this.currentIntersected)this.lastIntersected.indexOf(e)<0&&this.onEnterTrigger(e),this.onStayTrigger(e);this.lastIntersected.length=0,this.lastIntersected.push(...this.currentIntersected)}currentIntersected=[];lastIntersected=[];onEnterTrigger(e){dh&&console.log("ENTER TRIGGER",this.name,e.name,this,e),e.raiseOnEnterEvent(this),this.onEnter?.invoke()}onExitTrigger(e){dh&&console.log("EXIT TRIGGER",this.name,e.name),e.raiseOnExitEvent(this),this.onExit?.invoke()}onStayTrigger(e){e.raiseOnStayEvent(this),this.onStay?.invoke()}}hh([u()],io.prototype,"triggerMask"),hh([u(ye)],io.prototype,"onEnter"),hh([u(ye)],io.prototype,"onStay"),hh([u(ye)],io.prototype,"onExit");const Nx=class Ep extends T{static triggers=[];triggerMask;boxHelper;start(){dh&&console.log(this.name,this.triggerMask,this)}onEnable(){Ep.triggers.push(this),this.boxHelper||(this.boxHelper=x.addComponent(this.gameObject,_t),this.boxHelper?.showHelper(null,dh))}onDisable(){Ep.triggers.splice(Ep.triggers.indexOf(this),1)}test(e){return this.boxHelper?this.boxHelper.isInBox(e)??!1:!1}raiseOnEnterEvent(e){x.foreachComponent(this.gameObject,t=>{t!==e&&t instanceof io&&t.onEnterTrigger(this)},!1)}raiseOnStayEvent(e){x.foreachComponent(this.gameObject,t=>{t!==e&&t instanceof io&&t.onStayTrigger(this)},!1)}raiseOnExitEvent(e){x.foreachComponent(this.gameObject,t=>{t!==e&&t instanceof io&&t.onExitTrigger(this)},!1)}};hh([u()],Nx.prototype,"triggerMask");let up=Nx;var MA=Object.defineProperty,RA=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&MA(e,t,n),n};const Ai=w("debugspectator");class pp extends T{cam=null;useKeys=!0;_mode=0;get mode(){return this._mode}set mode(e){this._mode=e}get isSpectating(){return this._handler?.currentTarget!==void 0}isSpectatingUser(e){return this.target?.userId===e}isFollowedBy(e){return this.followers?.includes(e)}get followers(){return this._networking.followers}stopSpectating(){if(this.context.isInXR){this.followSelf();return}this.target=void 0}get localId(){return this.context.connection.connectionId??"local"}set target(e){if(this._handler){const t=this._handler.currentTarget?.userId,i=this.context.players.getPlayerView(this.localId);e===void 0||this.context.isInXR===!1&&i?.currentObject===e.currentObject?this._handler.currentTarget!==void 0&&(this._handler.disable(),x.setActive(this.gameObject,!1),this.orbit&&(this.orbit.enabled=!0),this._networking.onSpectatedObjectChanged(e,t)):this._handler.currentTarget!==e&&(this._handler.set(e),x.setActive(this.gameObject,!0),this.orbit&&(this.orbit.enabled=!1),this._networking.onSpectatedObjectChanged(e,t))}}get target(){return this._handler?.currentTarget}requestAllFollowMe(){this._networking.onRequestFollowMe()}get isSpectatingSelf(){return this.isSpectating&&this.target?.currentObject===this.context.players.getPlayerView(this.localId)?.currentObject}orbit=null;_handler;eventSub_WebXRRequestStartEvent=null;eventSub_WebXRStartEvent=null;eventSub_WebXREndEvent=null;_debug;_networking;awake(){if(this._debug=new AA(this.context,this),this._networking=new jA(this.context,this),this._networking.awake(),x.setActive(this.gameObject,!1),this.cam=x.getComponent(this.gameObject,ii),!this.cam){console.warn("SpectatorCamera: Spectator camera needs camera component on the same object.",this);return}!this._handler&&this.cam&&(this._handler=new TA(this.context,this.cam,this)),this.orbit=x.getComponent(this.context.mainCamera,me)}onDestroy(){this.stopSpectating(),this._handler?.destroy(),this._networking?.destroy()}isSupportedPlatform(){const e=window.navigator.userAgent,t=/Windows|MacOS/.test(e),i=/Windows NT/.test(e)&&/Edg/.test(e)&&!/Win64/.test(e);return t&&!i}onBeforeXR(e){this.isSupportedPlatform()&&x.setActive(this.gameObject,!0)}onEnterXR(e){this.isSupportedPlatform()&&(Ai&&console.log(this.context.mainCamera),this.context.mainCamera&&this.followSelf())}onLeaveXR(e){this.context.removeCamera(this.cam),x.setActive(this.gameObject,!1),this.orbit&&(this.orbit.enabled=!0),this._handler?.set(void 0),this._handler?.disable(),this.isSpectatingSelf&&this.stopSpectating()}followSelf(){this.target=this.context.players.getPlayerView(this.context.connection.connectionId),this.target||(this.context.players.setPlayerView(this.localId,this.context.mainCamera,ds.Headset),this.target=this.context.players.getPlayerView(this.localId)),Ai&&console.log("Follow self",this.target)}onAfterRender(){if(!this.cam)return;const e=this.context.renderer,t=e.xr.enabled;if(!e.xr.isPresenting&&!this._handler?.currentTarget)return;this._handler?.update(this._mode);const i=e.getRenderTarget();let n=null;const s=e.state;if(!i){if(!e.state.bindFramebuffer||!s.bindXRFramebuffer)return;n=e._framebuffer,s.bindXRFramebuffer(null)}this.setAvatarFlagsBeforeRender();const r=this.context.mainCameraComponent;if(r){const c=r.backgroundColor;c&&e.setClearColor(c,c.alpha),this.cam.backgroundColor=c,this.cam.clearFlags=r.clearFlags,this.cam.nearClipPlane=r.nearClipPlane,this.cam.farClipPlane=r.farClipPlane}else e.setClearColor(new ne(1,1,1));e.setRenderTarget(null),e.xr.enabled=!1;const a=this.cam?.threeCamera;this.context.updateAspect(a);const l=e.xr.isPresenting;e.xr.isPresenting=!1,e.setSize(this.context.domWidth,this.context.domHeight),e.render(this.context.scene,a),e.xr.isPresenting=l,e.xr.enabled=t,i?e.setRenderTarget(i):s.bindXRFramebuffer&&s.bindXRFramebuffer(n),this.resetAvatarFlags()}setAvatarFlagsBeforeRender(){const e=this._mode===0;for(const t of Le.instances)if(t.avatar&&"isLocalAvatar"in t.avatar&&"flags"in t.avatar){let i=Gn.All;this.isSpectatingSelf&&(i=e&&t.avatar.isLocalAvatar?Gn.FirstPerson:Gn.ThirdPerson);const n=t.avatar.flags;if(!n)continue;for(const s of n)s.UpdateVisible(i)}}resetAvatarFlags(){for(const e of Le.instances)if(e.avatar&&"flags"in e.avatar){const t=e.avatar.flags;if(!t)continue;for(const i of t)"isLocalAvatar"in e.avatar&&e.avatar?.isLocalAvatar?i.UpdateVisible(Gn.FirstPerson):i.UpdateVisible(Gn.ThirdPerson)}}}RA([u()],pp.prototype,"useKeys");class TA{context;cam;spectator;follow;target;view;currentObject;get currentTarget(){return this.view}constructor(e,t,i){this.context=e,this.cam=t,this.spectator=i}set(e){const t=e?.currentObject;if(!t){this.spectator.stopSpectating();return}t!==this.currentObject&&(this.currentObject=t,this.view=e,this.follow||(this.follow=x.addComponent(this.cam.gameObject,dp)),this.target||(this.target=new M),t.add(this.target),this.follow.enabled=!0,this.follow.target=this.target,Ai&&console.log("FOLLOW",t),this.context.isInXR?this.context.removeCamera(this.cam):this.context.setCurrentCamera(this.cam))}disable(){Ai&&console.log("STOP FOLLOW",this.currentObject),this.view=void 0,this.currentObject=void 0,this.context.removeCamera(this.cam),this.follow&&(this.follow.enabled=!1)}destroy(){this.target?.removeFromParent(),this.follow&&x.destroy(this.follow)}update(e){if(this.currentTarget?.isConnected===!1||this.currentTarget?.removed===!0){Ai&&console.log("Target disconnected or timeout",this.currentTarget),this.spectator.stopSpectating();return}this.currentTarget&&this.currentTarget?.currentObject!==this.currentObject&&(Ai&&console.log("Target changed",this.currentObject,"to",this.currentTarget.currentObject),this.set(this.currentTarget));const t=this.context.mainCamera;if(t){const n=this.cam.threeCamera;(n.near!==t.near||n.far!==t.far)&&(n.near=t.near,n.far=t.far,n.updateProjectionMatrix())}const i=this.follow?.target;if(!(!i||!this.follow)){switch(e){case 0:this.view?.viewDevice!==ds.Browser?(this.follow.followFactor=5,this.follow.rotateFactor=5):(this.follow.followFactor=50,this.follow.rotateFactor=50),i.position.set(0,0,0);break;case 1:this.follow.followFactor=3,this.follow.rotateFactor=2,i.position.set(0,.5,1.5);break}this.follow.flipForward=!1,this.view?.viewDevice!==ds.Browser?i.quaternion.copy(EA):i.quaternion.identity()}}}const EA=new z().setFromAxisAngle(new b(0,1,0),Math.PI);class AA{context;spectator;constructor(e,t){this.context=e,this.spectator=t,console.log("[Spectator Camera] Click other avatars or cameras to follow them. Press ESC to exit spectator mode."),this.context.domElement.addEventListener("keydown",n=>{!this.spectator.useKeys||n.key==="Escape"&&this.spectator.stopSpectating()});let i=0;this.context.input.addEventListener(Ee.PointerDown,n=>{i=this.context.time.time}),this.context.input.addEventListener(Ee.PointerUp,n=>{const s=this.context.time.time-i;s>1?this.spectator.stopSpectating():this.context.input.getPointerClicked(0)&&s<.3&&this.trySelectObject()})}trySelectObject(){const e=new cs;e.setMask(16777215);const t=this.context.physics.raycast(e);if(Ai&&console.log(...t),t?.length)for(const i of t){if(i.distance<.2)continue;const n=i.object,s=x.getComponentInParent(n,Le),r=s?.connectionId;if(r){const a=this.context.players.getPlayerView(r);this.spectator.target=a,Ai&&console.log("spectate",r,s);break}}}}class IA{guid;dontSave=!0;targetUserId;stoppedFollowing;constructor(e,t,i){this.guid=e,this.targetUserId=t,this.stoppedFollowing=i}}class LA{guid;userId;constructor(e,t){this.guid=e.guid,this.userId=t}}class jA{followers=[];context;spectator;_followerEventMethod;_requestFollowMethod;_joinedRoomMethod;constructor(e,t){this.context=e,this.spectator=t,this._followerEventMethod=this.onFollowerEvent.bind(this),this._requestFollowMethod=this.onRequestFollowEvent.bind(this),this._joinedRoomMethod=this.onUserJoinedRoom.bind(this)}awake(){this.context.connection.beginListen("spectator-follower-changed",this._followerEventMethod),this.context.connection.beginListen("spectator-request-follow",this._requestFollowMethod),this.context.connection.beginListen(ee.JoinedRoom,this._joinedRoomMethod),this.context.domElement.addEventListener("keydown",e=>{this.spectator.useKeys&&(e.key==="f"?this.onRequestFollowMe():e.key==="Escape"&&this.onRequestFollowMe(!0))})}destroy(){this.context.connection.stopListen("spectator-follower-changed",this._followerEventMethod),this.context.connection.stopListen("spectator-request-follow",this._requestFollowMethod),this.context.connection.stopListen(ee.JoinedRoom,this._joinedRoomMethod)}onSpectatedObjectChanged(e,t){if(Ai&&console.log(this.context.connection.connectionId,"onSpectatedObjectChanged",e,t),this.context.connection.connectionId){const i=e?.userId===void 0,n=i?t:e?.userId,s=new IA(this.context.connection.connectionId,n,i);this.context.connection.send("spectator-follower-changed",s)}}onRequestFollowMe(e=!1){if(Ai&&console.log("Request follow",this.context.connection.connectionId),this.context.connection.connectionId){this.spectator.stopSpectating();const t=e?void 0:this.context.connection.connectionId,i=new LA(this.spectator,t);this.context.connection.send("spectator-request-follow",i)}}onUserJoinedRoom(){w("followme")&&this.onRequestFollowMe()}onFollowerEvent(e){const t=e.targetUserId,i=e.guid;if(Ai&&console.log(e),t===this.context.connection.connectionId)if(e.stoppedFollowing){const n=this.followers.indexOf(i);n!==-1&&(this.followers.splice(n,1),this.removeDisconnectedFollowers(),console.log(i,"unfollows you",this.followers.length))}else this.followers.includes(i)||(this.followers.push(i),this.removeDisconnectedFollowers(),console.log(i,"follows you",this.followers.length))}removeDisconnectedFollowers(){for(let e=this.followers.length-1;e>=0;e--){const t=this.followers[e];this.context.connection.userIsInRoom(t)===!1&&this.followers.splice(e,1)}}_lastRequestFollowUser;onRequestFollowEvent(e){if(this._lastRequestFollowUser=e,e.userId===this.context.connection.connectionId)this.spectator.stopSpectating();else if(e.userId===void 0)this.spectator.stopSpectating();else{const t=this.context.players.getPlayerView(e.userId);if(t)this.spectator.target=t;else return Ai&&console.warn("Could not find view",e.userId),this.enforceFollow(),!1}return!0}_enforceFollowInterval;enforceFollow(){this._enforceFollowInterval||(this._enforceFollowInterval=setInterval(()=>{this._lastRequestFollowUser===void 0||this._lastRequestFollowUser.userId&&this.spectator.isFollowedBy(this._lastRequestFollowUser.userId)?(clearInterval(this._enforceFollowInterval),this._enforceFollowInterval=void 0):(Ai&&console.log("REQUEST FOLLOW AGAIN",this._lastRequestFollowUser.userId),this.onRequestFollowEvent(this._lastRequestFollowUser))},1e3))}}class ro{bb=null;bb_pos=0;__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSyncedCameraModel(e,t){return(t||new ro).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSyncedCameraModel(e,t){return e.setPosition(e.position()+B0),(t||new ro).__init(e.readInt32(e.position())+e.position(),e)}userId(e){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}guid(e){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}dontSave(){const e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}pos(e){const t=this.bb.__offset(this.bb_pos,10);return t?(e||new Sr).__init(this.bb_pos+t,this.bb):null}rot(e){const t=this.bb.__offset(this.bb_pos,12);return t?(e||new Sr).__init(this.bb_pos+t,this.bb):null}static startSyncedCameraModel(e){e.startObject(5)}static addUserId(e,t){e.addFieldOffset(0,t,0)}static addGuid(e,t){e.addFieldOffset(1,t,0)}static addDontSave(e,t){e.addFieldInt8(2,+t,0)}static addPos(e,t){e.addFieldStruct(3,t,0)}static addRot(e,t){e.addFieldStruct(4,t,0)}static endSyncedCameraModel(e){return e.endObject()}static finishSyncedCameraModelBuffer(e,t){e.finish(t)}static finishSizePrefixedSyncedCameraModelBuffer(e,t){e.finish(t,void 0,!0)}}var DA=Object.defineProperty,BA=(o,e,t,i)=>{for(var n=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=r(e,t,n)||n);return n&&DA(e,t,n),n};const mp="SCAM";jm(mp,ro.getRootAsSyncedCameraModel);const Ii=new Zp;class FA{userId;guid;constructor(e,t){this.guid=t,this.userId=e}send(e,t){if(e){Ii.clear();const i=Ii.createString(this.guid),n=Ii.createString(this.userId);ro.startSyncedCameraModel(Ii),ro.addGuid(Ii,i),ro.addUserId(Ii,n);const s=Z(e),r=ld(e);ro.addPos(Ii,Sr.createVec3(Ii,s.x,s.y,s.z)),ro.addRot(Ii,Sr.createVec3(Ii,r.x,r.y,r.z));const a=ro.endSyncedCameraModel(Ii);Ii.finish(a,mp),t.sendBinary(Ii.asUint8Array())}}}const Wx=class c0 extends T{static instances=[];getCameraObject(e){const t=this.userToCamMap[e];return t?this.remoteCams[t].obj:null}cameraPrefab=null;_lastWorldPosition;_lastWorldQuaternion;_model=null;_needsUpdate=!0;_lastUpdateTime=0;remoteCams={};userToCamMap={};_camTimeoutInSeconds=10;_receiveCallback=null;async awake(){this._lastWorldPosition=this.worldPosition.clone(),this._lastWorldQuaternion=this.worldQuaternion.clone(),this.cameraPrefab&&("uri"in this.cameraPrefab&&(this.cameraPrefab=await this.cameraPrefab.instantiate(this.gameObject)),this.cameraPrefab&&"isObject3D"in this.cameraPrefab&&(this.cameraPrefab.visible=!1))}onEnable(){this._receiveCallback=this.context.connection.beginListenBinary(mp,this.onReceivedRemoteCameraInfoBin.bind(this))}onDisable(){this.context.connection.stopListenBinary(mp,this._receiveCallback)}update(){for(const n in this.remoteCams){const s=this.remoteCams[n],r=this.context.time.realtimeSinceStartup-s.lastUpdate;if(!s||r>this._camTimeoutInSeconds){A()&&console.log("Remote cam timeout",n),s?.obj&&x.destroy(s.obj),delete this.remoteCams[n],s&&delete this.userToCamMap[s.userId],c0.instances.push(s),this.context.players.removePlayerView(s.userId,ds.Browser);continue}}if(this.context.isInXR)return;const e=this.context.mainCamera;if(e===null){this.enabled=!1;return}if(!this.context.connection.isConnected||this.context.connection.connectionId===null)return;this._model===null&&(this._model=new FA(this.context.connection.connectionId,this.context.connection.connectionId+"_camera"));const t=Z(e),i=be(e);(t.distanceTo(this._lastWorldPosition)>.001||i.angleTo(this._lastWorldQuaternion)>.01)&&(this._needsUpdate=!0),this._lastWorldPosition.copy(t),this._lastWorldQuaternion.copy(i),!((!this._needsUpdate||this.context.time.frameCount%2!==0)&&!(this.context.time.realtimeSinceStartup-this._lastUpdateTime>this._camTimeoutInSeconds*.5))&&(this._lastUpdateTime=this.context.time.realtimeSinceStartup,this._needsUpdate=!1,this._model.send(e,this.context.connection),this.context.isInXR||this.context.players.setPlayerView(this.context.connection.connectionId,e,ds.Browser))}onReceivedRemoteCameraInfoBin(e){const t=e.guid();if(!t)return;const i=e.userId();if(!i||!this.context.connection.userIsInRoom(i)||!this.cameraPrefab)return;let n=this.remoteCams[t];if(!n)if("isObject3D"in this.cameraPrefab){const l=new Mn;l.context=this.context;const c=x.instantiate(this.cameraPrefab,l);n=this.remoteCams[t]={obj:c,lastUpdate:this.context.time.realtimeSinceStartup,userId:i},n.obj.visible=!0,this.gameObject.add(c),this.userToCamMap[i]=t,c0.instances.push(n);const h=x.getOrAddComponent(c,Le);h.connectionId=i,h.avatar=c}else return;const s=n.obj;this.context.players.setPlayerView(i,s,ds.Browser),n.lastUpdate=this.context.time.realtimeSinceStartup,an.markDirty(s);const r=e.pos();r&&tr(s,r.x(),r.y(),r.z());const a=e.rot();a&&jl(s,a.x(),a.y(),a.z())}};BA([u([M,ie])],Wx.prototype,"cameraPrefab");let jy=Wx;var UA=Object.defineProperty,zA=Object.getOwnPropertyDescriptor,Us=(o,e,t,i)=>{for(var n=i>1?void 0:i?zA(e,t):e,s=o.length-1,r;s>=0;s--)(r=o[s])&&(n=(i?r(e,t,n):r(n))||n);return i&&n&&UA(e,t,n),n};const Dy="view",By=w("debugsyncedroom");class On extends T{roomName="";urlParameterName="room";joinRandomRoom;requireRoomParameter=!1;autoRejoin=!0;createJoinButton=!0;createViewOnlyButton=!1;get currentRoomName(){return w(Dy)||w(this.urlParameterName)}_lastJoinedRoom;set roomPrefix(e){this._roomPrefix=e}get roomPrefix(){return this._roomPrefix}_roomPrefix="";awake(){this.joinRandomRoom===void 0&&this.roomName?.length<=0&&(this.joinRandomRoom=!0),By&&console.log(`SyncedRoom roomName:${this.roomName}, urlParamName:${this.urlParameterName}, joinRandomRoom:${this.joinRandomRoom}`)}onEnable(){const e=w(Dy);if(e&&typeof e=="string"&&e.length>0){console.log("Join as viewer"),this.context.connection.joinRoom(e,!0);return}if(this.tryJoinRoom(),this.createJoinButton){const t=this.createRoomButton();this.context.menu.appendChild(t)}this.createViewOnlyButton&&this.onEnableViewOnlyButton()}onDisable(){this._roomButton?.remove(),this.onDisableViewOnlyButton(),this.roomName&&this.roomName.length>0&&this.context.connection.leaveRoom(this.roomName)}onDestroy(){this.destroyRoomButton()}tryJoinRandomRoom(){this.setRandomRoomUrlParameter(),this.tryJoinRoom()}tryJoinRoom(e=0){e===void 0&&(e=0);let t=!1;if(this.urlParameterName?.length>0){const i=w(this.urlParameterName);if(i&&(typeof i=="string"||typeof i=="number")){t=!0;const n=K0(i.toString());this.roomName=n}else if(this.joinRandomRoom&&(console.log("No room name found in url, generating random one"),this.setRandomRoomUrlParameter(),e<1))return this.tryJoinRoom(e+1)}else this.joinRandomRoom&&(this.roomName===null||this.roomName===void 0||this.roomName.length<=0)&&(this.roomName=this.generateRoomName());return this.requireRoomParameter&&!t?((By||A())&&console.warn('[SyncedRoom] Missing required room parameter "'+this.urlParameterName+`" in url - will not connect.
1399
1399
  To allow joining a room without a query parameter you can set "requireRoomParameter" to false.`),!1):(this.context.connection.isConnected||this.context.connection.connect(),this._lastJoinedRoom=this.roomName,this._roomPrefix&&(this.roomName=this._roomPrefix+this.roomName),this.roomName.length<=0?(console.warn(`[SyncedRoom] Room name is not set so we can not join a networked room.
1400
1400
  Please choose one of the following options to fix this:
1401
1401
  A) Set a room name in the SyncedRoom component
@@ -1755,9 +1755,9 @@ uo('if(!globalThis["NEEDLE_PROJECT_BUILD_TIME"]) globalThis["NEEDLE_PROJECT_BUIL
1755
1755
  uo('if(!globalThis["NEEDLE_PUBLIC_KEY"]) globalThis["NEEDLE_PUBLIC_KEY"] = "unknown";');
1756
1756
  uo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.8.6";');
1757
1757
  uo('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
1758
- uo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Thu Aug 21 2025 19:35:23 GMT+0000 (Coordinated Universal Time)";');
1758
+ uo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Tue Aug 26 2025 08:09:54 GMT+0000 (Coordinated Universal Time)";');
1759
1759
  uo('globalThis["__NEEDLE_PUBLIC_KEY__"] = "' + NEEDLE_PUBLIC_KEY + '";');
1760
- const An = "4.8.6", ym = "undefined", $b = "Thu Aug 21 2025 19:35:23 GMT+0000 (Coordinated Universal Time)";
1760
+ const An = "4.8.6", ym = "undefined", $b = "Tue Aug 26 2025 08:09:54 GMT+0000 (Coordinated Universal Time)";
1761
1761
  Nb && console.log(`Engine version: ${An} (generator: ${ym})
1762
1762
  Project built at ${$b}`);
1763
1763
  const _l = NEEDLE_PUBLIC_KEY, so = "needle_isActiveInHierarchy", jr = "builtin_components", Ph = "needle_editor_guid";
@@ -6351,12 +6351,12 @@ function l0(s, e, t, i = 0) {
6351
6351
  if (i > 1e3)
6352
6352
  return console.warn("Hierarchy is too deep (> 1000 level) - will abort updating active state"), !1;
6353
6353
  const n = mc(s);
6354
- if (e && (e = n, e && s.parent)) {
6354
+ if (e && (e = n, e && s.parent && i === 0)) {
6355
6355
  const l = s.parent;
6356
6356
  e = l[so], e === void 0 && (l instanceof yi || (e = !0));
6357
6357
  }
6358
6358
  const r = s[so] !== e;
6359
- s[so] = e, r && (z1 && console.warn("ACTIVE CHANGE", s.name, n, s.visible, e, "changed?" + r, s), $1(s, (l) => {
6359
+ r && (s[so] = e, z1 && console.warn("ACTIVE CHANGE", s.name, n, s.visible, e, "changed?" + r, s), $1(s, (l) => {
6360
6360
  e ? l.enabled && (Jr(l.__internalAwake.bind(l)), l.enabled && l.__internalEnable()) : l.__didAwake && l.enabled && (l.__didEnable = !1, l.onDisable());
6361
6361
  }));
6362
6362
  let a = !0;
@@ -35357,11 +35357,17 @@ const hr = class extends T {
35357
35357
  return this.apply(), !0;
35358
35358
  this._prevLoadedEnvironment?.dispose(), this._prevLoadedEnvironment = void 0, this._prevUrl = e;
35359
35359
  const i = await dE(e, this.context.renderer);
35360
- return i ? this.enabled ? this._prevUrl !== e ? (Zt && console.warn("RemoteSkybox: URL changed while loading texture, aborting setSkybox"), !1) : (this.url = e, this._prevLoadedEnvironment = i, this.apply(), !0) : (Zt && console.warn("RemoteSkybox: Component is not enabled, aborting setSkybox"), !1) : (Zt && console.warn("RemoteSkybox: Failed to load texture from url", e), !1);
35360
+ return i ? !this.enabled || this.destroyed ? (Zt && console.warn("RemoteSkybox: Component is disabled or destroyed"), !1) : this._prevUrl !== e ? (Zt && console.warn("RemoteSkybox: URL changed while loading texture, aborting setSkybox"), !1) : (this.url = e, this._prevLoadedEnvironment = i, this.apply(), !0) : (Zt && console.warn("RemoteSkybox: Failed to load texture from url", e), !1);
35361
35361
  }
35362
35362
  apply() {
35363
35363
  const e = this._prevLoadedEnvironment;
35364
- e && (e instanceof Hx || e instanceof Gx || e.mapping == db || (e.mapping = qx, e.needsUpdate = !0), this.context.scene.background !== e && (this._prevBackground = this.context.scene.background), this.context.scene.environment !== e && (this._prevEnvironment = this.context.scene.environment), Zt && console.log("Set remote skybox", this.url, !fi.backgroundShouldBeTransparent(this.context)), this.environment && (this.context.scene.environment = e), this.background && !fi.backgroundShouldBeTransparent(this.context) && (this.context.scene.background = e), this.context.mainCameraComponent?.backgroundBlurriness !== void 0 && (this.context.scene.backgroundBlurriness = this.context.mainCameraComponent.backgroundBlurriness));
35364
+ if (e && (e instanceof Hx || e instanceof Gx || e.mapping == db || (e.mapping = qx, e.needsUpdate = !0), !this.destroyed)) {
35365
+ if (!this.context) {
35366
+ console.warn("RemoteSkybox: Context is not available - can not apply skybox.");
35367
+ return;
35368
+ }
35369
+ this.context.scene.background !== e && (this._prevBackground = this.context.scene.background), this.context.scene.environment !== e && (this._prevEnvironment = this.context.scene.environment), Zt && console.log("Set remote skybox", this.url, !fi.backgroundShouldBeTransparent(this.context)), this.environment && (this.context.scene.environment = e), this.background && !fi.backgroundShouldBeTransparent(this.context) && (this.context.scene.background = e), this.context.mainCameraComponent?.backgroundBlurriness !== void 0 && (this.context.scene.backgroundBlurriness = this.context.mainCameraComponent.backgroundBlurriness);
35370
+ }
35365
35371
  }
35366
35372
  validProtocols = ["file:", "blob:", "data:"];
35367
35373
  validTextureTypes = [".ktx2", ".hdr", ".exr", ".jpg", ".jpeg", ".png"];
@@ -1,5 +1,5 @@
1
- import { GameObject as r, onClear as i, onDestroy as a, onInitialized as s, onAfterRender as l, onBeforeRender as d, onUpdate as c, onStart as m, loadAsset as g, NeedleXRSession as p, Context as u, VERSION as S, Component as C, Components as y } from "./needle-engine.bundle-C6TN-zhq.js";
2
- import { $physicsKey as P, ActionBuilder as T, ActionCollection as b, ActionModel as A, Addressables as M, AlignmentConstraint as I, AmbientMode as O, Animation as D, AnimationCurve as x, AnimationExtension as k, AnimationTrackHandler as L, AnimationUtils as N, Animator as B, AnimatorConditionMode as F, AnimatorController as U, AnimatorControllerParameterType as w, AnimatorStateInfo as G, Antialiasing as W, Application as H, AssetDatabase as X, AssetReference as z, AudioExtension as V, AudioListener as _, AudioSource as j, AudioTrackHandler as K, Avatar as Z, AvatarBlink_Simple as Q, AvatarEyeLook_Rotation as Y, AvatarLoader as $, AvatarMarker as J, AvatarModel as q, Avatar_Brain_LookAt as ee, Avatar_MouthShapes as te, Avatar_MustacheShake as oe, Avatar_POI as re, Axes as ne, AxesHelper as ie, BUILD_TIME as ae, BaseUIComponent as se, BasicIKConstraint as le, BehaviorExtension as de, BehaviorModel as ce, Component$1 as me, BlobStorage as ge, BloomEffect as pe, BoxCollider as ue, BoxGizmo as Se, BoxHelperComponent as Ce, Button as ye, ButtonsFactory as Ee, CallDirection as Re, CallInfo as he, Camera as fe, CameraTargetReachedEvent as ve, Canvas as Pe, CanvasGroup as Te, CapsuleCollider as be, ChangeMaterialOnClick as Ae, ChangeTransformOnClick as Me, CharacterController as Ie, CharacterControllerInput as Oe, ChromaticAberration as De, CircularBuffer as xe, ClearFlags as ke, ClipExtrapolation as Le, Collider as Ne, Collision as Be, CollisionDetectionMode as Fe, ColorAdjustments as Ue, ColorBySpeedModule as we, ColorOverLifetimeModule as Ge, Component$1 as We, ComponentLifecycleEvents as He, ConnectionEvents as Xe, ContactPoint as ze, ContactShadows as Ve, ContextArgs as _e, ContextEvent as je, ContextRegistry as Ke, ControlTrackHandler as Ze, CustomBranding as Qe, CustomShader as Ye, DefaultReflectionMode as $e, Deletable as Je, DeleteBox as qe, DepthOfField as et, DeviceFlag as tt, DeviceUtilities as ot, DocumentExtension as rt, DragControls as nt, DragMode as it, DropListener as at, Duplicatable as st, EffectWrapper as lt, EmissionModule as dt, EmphasizeOnClick as ct, EngineLoadingView as mt, EnvironmentScene as gt, EventList as pt, EventListEvent as ut, EventSystem as St, EventTrigger as Ct, FieldWithDefault as yt, FileReference as Et, FileReferenceSerializer as Rt, FileSpawnModel as ht, File_Event as ft, FixedJoint as vt, Fog as Pt, FrameEvent as Tt, GENERATOR as bt, Gizmos as At, GltfExport as Mt, GltfExportBox as It, Gradient as Ot, Graphic as Dt, GraphicRaycaster as xt, Graphics as kt, GridHelper as Lt, GridLayoutGroup as Nt, GroundProjectedEnv as Bt, GroupActionModel as Ft, HideFlags as Ut, HideOnStart as wt, HingeJoint as Gt, HorizontalLayoutGroup as Wt, HostData as Ht, Image as Xt, ImageReference as zt, ImageReferenceSerializer as Vt, InheritVelocityModule as _t, Input as jt, InputEventQueue as Kt, InputEvents as Zt, InputField as Qt, InstanceHandle as Yt, InstancingHandler as $t, InstancingUtil as Jt, InstantiateEvent as qt, InstantiateIdProvider as eo, InstantiateOptions as to, Interactable as oo, InternalScreenshotUtils as ro, JoinedRoomResponse as no, KeyEventArgs as io, Keyframe as ao, LODGroup as so, LODModel as lo, LeftRoomResponse as co, Light as mo, LightData as go, LimitVelocityOverLifetimeModule as po, LoadingElementOptions as uo, LogStats as So, LogType as Co, LookAt as yo, LookAtConstraint as Eo, MainModule as Ro, MarkerType as ho, MaskableGraphic as fo, Mathf as vo, MeshCollider as Po, MeshRenderer as To, MinMaxCurve as bo, MinMaxGradient as Ao, MODULES as Mo, NEKeyboardEvent as Io, NEPointerEvent as Oo, NeedleButtonElement as Do, ContextRegistry as xo, NeedleEngineModelLoader as ko, NeedleEngineWebComponent as Lo, NeedleMenu as No, NeedlePatchesKey as Bo, USDZExporter$1 as Fo, NeedleXRController as Uo, NeedleXRSync as wo, NeedleXRUtils as Go, NestedGltf as Wo, NetworkConnection as Ho, NetworkedStreamEvents as Xo, NetworkedStreams as zo, Networking as Vo, NewInstanceModel as _o, NoiseModule as jo, ObjectRaycaster as Ko, ObjectUtils as Zo, OffsetConstraint as Qo, OneEuroFilter as Yo, OneEuroFilterXYZ as $o, OpenURL as Jo, OrbitControls as qo, Outline as er, OwnershipEvent as tr, OwnershipModel as or, PUBLIC_KEY as rr, Padding as nr, ParticleBurst as ir, ParticleSubEmitter as ar, ParticleSystem as sr, ParticleSystemBaseBehaviour as lr, ParticleSystemRenderer as dr, ParticleSystemShapeType as cr, PeerHandle as mr, PeerNetworking as gr, Physics as pr, PhysicsExtension as ur, PhysicsMaterialCombine as Sr, PixelationEffect as Cr, PlayAnimationOnClick as yr, PlayAudioOnClick as Er, PlayableDirector as Rr, PlayerColor as hr, PlayerState as fr, PlayerStateEvent as vr, PlayerSync as Pr, PlayerView as Tr, PlayerViewManager as br, PointerEventData as Ar, PointerType as Mr, PostProcessingEffect as Ir, PostProcessingEffectOrder as Or, PostProcessingHandler as Dr, Volume as xr, PreliminaryAction as kr, PreliminaryTrigger as Lr, PreviewHelper as Nr, PrimitiveType as Br, Progress as Fr, PromiseAllWithErrors as Ur, PromiseErrorResult as wr, RGBAColor as Gr, RapierPhysics as Wr, RawImage as Hr, RaycastOptions as Xr, Rect as zr, RectTransform as Vr, ReflectionProbe as _r, RegisteredAnimationInfo as jr, RemoteSkybox as Kr, RenderTexture as Zr, RenderTextureSerializer as Qr, Renderer as Yr, RendererData as $r, RendererLightmap as Jr, Rigidbody as qr, RigidbodyConstraints as en, RoomEvents as tn, RotationBySpeedModule as on, RotationOverLifetimeModule as rn, SceneLightSettings as nn, SceneSwitcher as an, ScreenCapture as sn, ScreenSpaceAmbientOcclusion as ln, ScreenSpaceAmbientOcclusionN8 as dn, SendQueue as cn, SerializationContext as mn, SetActiveOnClick as gn, ShadowCatcher as pn, ShapeModule as un, ShapeOverlapResult as Sn, SharpeningEffect as Cn, SignalAsset as yn, SignalReceiver as En, SignalReceiverEvent as Rn, SignalTrackHandler as hn, Size as fn, SizeBySpeedModule as vn, SizeOverLifetimeModule as Pn, SkinnedMeshRenderer as Tn, SmoothFollow as bn, SpatialGrabRaycaster as An, SpatialHtml as Mn, SpatialTrigger as In, SpatialTriggerReceiver as On, SpectatorCamera as Dn, SphereCollider as xn, SphereIntersection as kn, Sprite as Ln, SpriteData as Nn, SpriteRenderer as Bn, SpriteSheet as Fn, StateMachineBehaviour as Un, StreamEndedEvent as wn, StreamReceivedEvent as Gn, SubEmitterSystem as Wn, SyncedCamera as Hn, SyncedRoom as Xn, SyncedTransform as zn, TapGestureTrigger as Vn, TeleportTarget as _n, TestRunner as jn, TestSceneUtils as Kn, TestSimulateUserData as Zn, Text as Qn, TextBuilder as Yn, TextExtension as $n, TextureSheetAnimationModule as Jn, TiltShiftEffect as qn, Time as ei, ToneMappingEffect as ti, TrackHandler as oi, TrackType as ri, TrailModule as ni, TransformData as ii, TransformGizmo as ai, TriggerBuilder as si, TriggerModel as li, TypeStore as di, UIRaycastUtils as ci, UIRootComponent as mi, USDDocument as gi, USDObject as pi, USDWriter as ui, USDZExporter as Si, USDZText as Ci, USDZUIExtension as yi, UriSerializer as Ei, UsageMarker as Ri, UserJoinedOrLeftRoomModel as hi, VariantAction as fi, VelocityOverLifetimeModule as vi, VerticalLayoutGroup as Pi, VideoPlayer as Ti, ViewDevice as bi, Vignette as Ai, VisibilityAction as Mi, Voip as Ii, Volume as Oi, VolumeParameter as Di, VolumeProfile as xi, WaitForFrames as ki, WaitForPromise as Li, WaitForSeconds as Ni, Watch as Bi, WebARCameraBackground as Fi, WebARSessionRoot as Ui, WebXR as wi, WebXRButtonFactory as Gi, WebXRImageTracking as Wi, WebXRImageTrackingModel as Hi, WebXRPlaneTracking as Xi, WebXRTrackedImage as zi, XRControllerFollow as Vi, XRControllerModel as _i, XRControllerMovement as ji, XRFlag as Ki, XRRig as Zi, XRState as Qi, XRStateFlag as Yi, __Ignore as $i, __internalNotifyObjectDestroyed as Ji, activeInHierarchyFieldName as qi, addAttributeChangeCallback as ea, addComponent as ta, addCustomExtensionPlugin as oa, addNewComponent as ra, addPatch as na, apply as ia, applyHMRChanges as aa, applyPrototypeExtensions as sa, beginListenDestroy as la, beginListenInstantiate as da, binaryIdentifierCasts as ca, build_scene_functions as ma, builtinComponentKeyName as ga, calculateProgress01 as pa, clearMessages as ua, clearMessages as Sa, colorSerializer as Ca, compareAssociation as ya, componentSerializer as Ea, copyTexture as Ra, createMotion as ha, debugNet as fa, debugOwner as va, decompressGpuTexture as Pa, deepClone as Ta, delay as ba, delayForFrames as Aa, deserializeObject as Ma, destroy as Ia, destroyComponentInstance as Oa, determineMimeTypeFromExtension as Da, disposeObjectResources as xa, disposeStream as ka, editorGuidKeyName as La, enableSpatialConsole as Na, euler as Ba, eventListSerializer as Fa, exportAsGLTF as Ua, findByGuid as wa, findObjectOfType as Ga, findObjectsOfType as Wa, findResourceUsers as Ha, fitObjectIntoVolume as Xa, foreachComponent as za, foreachComponentEnumerator as Va, forward as _a, generateQRCode as ja, generateSeed as Ka, getBoundingBox as Za, getCameraController as Qa, getComponent as Ya, getComponentInChildren as $a, getComponentInParent as Ja, getComponents as qa, getComponentsInChildren as es, getComponentsInParent as ts, getFormattedDate as os, getIconElement as rs, getIconTexture as ns, getLoader as is, getOrAddComponent as as, getParam as ss, getParentHierarchyPath as ls, getPath as ds, getPeerOptions as cs, getPeerjsInstance as ms, getResourceUserCount as gs, getTempColor as ps, getTempQuaternion as us, getTempVector as Ss, getUrlParams as Cs, getVisibleInCustomShadowRendering as ys, getWorldDirection as Es, getWorldEuler as Rs, getWorldPosition as hs, getWorldQuaternion as fs, getWorldRotation as vs, getWorldScale as Ps, hasCommercialLicense as Ts, hasIndieLicense as bs, hasPointerEventComponent as As, hasProLicense as Ms, hideDebugConsole as Is, imageToCanvas as Os, instantiate as Ds, invokeLoadedImportPluginHooks as xs, invokeXRSessionEnd as ks, invokeXRSessionStart as Ls, isActiveInHierarchy as Ns, isActiveSelf as Bs, isAndroidDevice as Fs, isAnimationAction as Us, isComponent as ws, isDebugMode as Gs, isDesktop as Ws, isDestroyed as Hs, isDevEnvironment as Xs, isDisposed as zs, isExporting as Vs, isGLTFModel as _s, isHostedOnGlitch as js, isHotReloadEnabled as Ks, isHotReloading as Zs, isIPad as Qs, isIconElement as Ys, isLocalNetwork as $s, isMacOS as Js, isMobileDevice as qs, isMozillaXR as el, isQuest as tl, isResourceTrackingEnabled as ol, isSafari as rl, isUsingInstancing as nl, isiOS as il, isiPad as al, loadPMREM as sl, loadSync as ll, logHierarchy as dl, lookAtInverse as cl, lookAtObject as ml, lookAtScreenPoint as gl, makeId as pl, makeIdFromRandomWords as ul, makeNameSafe as Sl, markAsInstancedRendered as Cl, microphonePermissionsGranted as yl, nameof as El, nameofFactory as Rl, objectSerializer as hl, offXRSessionEnd as fl, offXRSessionStart as vl, onXRSessionEnd as Pl, onXRSessionStart as Tl, parseSync as bl, placeOnSurface as Al, postprocessFBXMaterials as Ml, prefix as Il, pushState as Ol, randomNumber as Dl, registerBinaryType as xl, registerComponent as kl, registerComponentExtension as Ll, registerCustomEffectType as Nl, registerExportExtensions as Bl, registerExtensions as Fl, registerHotReloadType as Ul, registerLoader as wl, registerPrefabProvider as Gl, registerPrototypeExtensions as Wl, registerType as Hl, relativePathPrefix as Xl, removeAttributeChangeCallback as zl, removeComponent as Vl, removeCustomImportExtensionType as _l, removePatch as jl, resolveUrl as Kl, sanitizeString as Zl, saveImage as Ql, screenshot as Yl, screenshot2 as $l, sendDestroyed as Jl, serializable as ql, serializeObject as ed, serializeable as td, setActive as od, setAllowBalloonMessages as rd, setAllowOverlayMessages as nd, setAutoFitEnabled as id, setCameraController as ad, setDestroyed as sd, setDevEnvironment as ld, setDisposable as dd, setDontDestroy as cd, setOrAddParamsToUrl as md, setParam as gd, setParamWithoutReload as pd, setPeerOptions as ud, setResourceTrackingEnabled as Sd, setState as Cd, setVisibleInCustomShadowRendering as yd, setWorldEuler as Ed, setWorldPosition as Rd, setWorldPositionXYZ as hd, setWorldQuaternion as fd, setWorldQuaternionXYZW as vd, setWorldRotation as Pd, setWorldRotationXYZ as Td, setWorldScale as bd, showBalloonError as Ad, showBalloonMessage as Md, showBalloonWarning as Id, showDebugConsole as Od, slerp as Dd, syncDestroy as xd, syncField as kd, syncInstantiate as Ld, textureToCanvas as Nd, tryCastBinary as Bd, tryDetermineMimetypeFromBinary as Fd, tryDetermineMimetypeFromURL as Ud, tryFindObject as wd, tryGetGuid as Gd, unregisterHotReloadType as Wd, unwatchWrite as Hd, useForAutoFit as Xd, validate as zd, watchWrite as Vd } from "./needle-engine.bundle-C6TN-zhq.js";
1
+ import { GameObject as r, onClear as i, onDestroy as a, onInitialized as s, onAfterRender as l, onBeforeRender as d, onUpdate as c, onStart as m, loadAsset as g, NeedleXRSession as p, Context as u, VERSION as S, Component as C, Components as y } from "./needle-engine.bundle-fXDFH_oR.js";
2
+ import { $physicsKey as P, ActionBuilder as T, ActionCollection as b, ActionModel as A, Addressables as M, AlignmentConstraint as I, AmbientMode as O, Animation as D, AnimationCurve as x, AnimationExtension as k, AnimationTrackHandler as L, AnimationUtils as N, Animator as B, AnimatorConditionMode as F, AnimatorController as U, AnimatorControllerParameterType as w, AnimatorStateInfo as G, Antialiasing as W, Application as H, AssetDatabase as X, AssetReference as z, AudioExtension as V, AudioListener as _, AudioSource as j, AudioTrackHandler as K, Avatar as Z, AvatarBlink_Simple as Q, AvatarEyeLook_Rotation as Y, AvatarLoader as $, AvatarMarker as J, AvatarModel as q, Avatar_Brain_LookAt as ee, Avatar_MouthShapes as te, Avatar_MustacheShake as oe, Avatar_POI as re, Axes as ne, AxesHelper as ie, BUILD_TIME as ae, BaseUIComponent as se, BasicIKConstraint as le, BehaviorExtension as de, BehaviorModel as ce, Component$1 as me, BlobStorage as ge, BloomEffect as pe, BoxCollider as ue, BoxGizmo as Se, BoxHelperComponent as Ce, Button as ye, ButtonsFactory as Ee, CallDirection as Re, CallInfo as he, Camera as fe, CameraTargetReachedEvent as ve, Canvas as Pe, CanvasGroup as Te, CapsuleCollider as be, ChangeMaterialOnClick as Ae, ChangeTransformOnClick as Me, CharacterController as Ie, CharacterControllerInput as Oe, ChromaticAberration as De, CircularBuffer as xe, ClearFlags as ke, ClipExtrapolation as Le, Collider as Ne, Collision as Be, CollisionDetectionMode as Fe, ColorAdjustments as Ue, ColorBySpeedModule as we, ColorOverLifetimeModule as Ge, Component$1 as We, ComponentLifecycleEvents as He, ConnectionEvents as Xe, ContactPoint as ze, ContactShadows as Ve, ContextArgs as _e, ContextEvent as je, ContextRegistry as Ke, ControlTrackHandler as Ze, CustomBranding as Qe, CustomShader as Ye, DefaultReflectionMode as $e, Deletable as Je, DeleteBox as qe, DepthOfField as et, DeviceFlag as tt, DeviceUtilities as ot, DocumentExtension as rt, DragControls as nt, DragMode as it, DropListener as at, Duplicatable as st, EffectWrapper as lt, EmissionModule as dt, EmphasizeOnClick as ct, EngineLoadingView as mt, EnvironmentScene as gt, EventList as pt, EventListEvent as ut, EventSystem as St, EventTrigger as Ct, FieldWithDefault as yt, FileReference as Et, FileReferenceSerializer as Rt, FileSpawnModel as ht, File_Event as ft, FixedJoint as vt, Fog as Pt, FrameEvent as Tt, GENERATOR as bt, Gizmos as At, GltfExport as Mt, GltfExportBox as It, Gradient as Ot, Graphic as Dt, GraphicRaycaster as xt, Graphics as kt, GridHelper as Lt, GridLayoutGroup as Nt, GroundProjectedEnv as Bt, GroupActionModel as Ft, HideFlags as Ut, HideOnStart as wt, HingeJoint as Gt, HorizontalLayoutGroup as Wt, HostData as Ht, Image as Xt, ImageReference as zt, ImageReferenceSerializer as Vt, InheritVelocityModule as _t, Input as jt, InputEventQueue as Kt, InputEvents as Zt, InputField as Qt, InstanceHandle as Yt, InstancingHandler as $t, InstancingUtil as Jt, InstantiateEvent as qt, InstantiateIdProvider as eo, InstantiateOptions as to, Interactable as oo, InternalScreenshotUtils as ro, JoinedRoomResponse as no, KeyEventArgs as io, Keyframe as ao, LODGroup as so, LODModel as lo, LeftRoomResponse as co, Light as mo, LightData as go, LimitVelocityOverLifetimeModule as po, LoadingElementOptions as uo, LogStats as So, LogType as Co, LookAt as yo, LookAtConstraint as Eo, MainModule as Ro, MarkerType as ho, MaskableGraphic as fo, Mathf as vo, MeshCollider as Po, MeshRenderer as To, MinMaxCurve as bo, MinMaxGradient as Ao, MODULES as Mo, NEKeyboardEvent as Io, NEPointerEvent as Oo, NeedleButtonElement as Do, ContextRegistry as xo, NeedleEngineModelLoader as ko, NeedleEngineWebComponent as Lo, NeedleMenu as No, NeedlePatchesKey as Bo, USDZExporter$1 as Fo, NeedleXRController as Uo, NeedleXRSync as wo, NeedleXRUtils as Go, NestedGltf as Wo, NetworkConnection as Ho, NetworkedStreamEvents as Xo, NetworkedStreams as zo, Networking as Vo, NewInstanceModel as _o, NoiseModule as jo, ObjectRaycaster as Ko, ObjectUtils as Zo, OffsetConstraint as Qo, OneEuroFilter as Yo, OneEuroFilterXYZ as $o, OpenURL as Jo, OrbitControls as qo, Outline as er, OwnershipEvent as tr, OwnershipModel as or, PUBLIC_KEY as rr, Padding as nr, ParticleBurst as ir, ParticleSubEmitter as ar, ParticleSystem as sr, ParticleSystemBaseBehaviour as lr, ParticleSystemRenderer as dr, ParticleSystemShapeType as cr, PeerHandle as mr, PeerNetworking as gr, Physics as pr, PhysicsExtension as ur, PhysicsMaterialCombine as Sr, PixelationEffect as Cr, PlayAnimationOnClick as yr, PlayAudioOnClick as Er, PlayableDirector as Rr, PlayerColor as hr, PlayerState as fr, PlayerStateEvent as vr, PlayerSync as Pr, PlayerView as Tr, PlayerViewManager as br, PointerEventData as Ar, PointerType as Mr, PostProcessingEffect as Ir, PostProcessingEffectOrder as Or, PostProcessingHandler as Dr, Volume as xr, PreliminaryAction as kr, PreliminaryTrigger as Lr, PreviewHelper as Nr, PrimitiveType as Br, Progress as Fr, PromiseAllWithErrors as Ur, PromiseErrorResult as wr, RGBAColor as Gr, RapierPhysics as Wr, RawImage as Hr, RaycastOptions as Xr, Rect as zr, RectTransform as Vr, ReflectionProbe as _r, RegisteredAnimationInfo as jr, RemoteSkybox as Kr, RenderTexture as Zr, RenderTextureSerializer as Qr, Renderer as Yr, RendererData as $r, RendererLightmap as Jr, Rigidbody as qr, RigidbodyConstraints as en, RoomEvents as tn, RotationBySpeedModule as on, RotationOverLifetimeModule as rn, SceneLightSettings as nn, SceneSwitcher as an, ScreenCapture as sn, ScreenSpaceAmbientOcclusion as ln, ScreenSpaceAmbientOcclusionN8 as dn, SendQueue as cn, SerializationContext as mn, SetActiveOnClick as gn, ShadowCatcher as pn, ShapeModule as un, ShapeOverlapResult as Sn, SharpeningEffect as Cn, SignalAsset as yn, SignalReceiver as En, SignalReceiverEvent as Rn, SignalTrackHandler as hn, Size as fn, SizeBySpeedModule as vn, SizeOverLifetimeModule as Pn, SkinnedMeshRenderer as Tn, SmoothFollow as bn, SpatialGrabRaycaster as An, SpatialHtml as Mn, SpatialTrigger as In, SpatialTriggerReceiver as On, SpectatorCamera as Dn, SphereCollider as xn, SphereIntersection as kn, Sprite as Ln, SpriteData as Nn, SpriteRenderer as Bn, SpriteSheet as Fn, StateMachineBehaviour as Un, StreamEndedEvent as wn, StreamReceivedEvent as Gn, SubEmitterSystem as Wn, SyncedCamera as Hn, SyncedRoom as Xn, SyncedTransform as zn, TapGestureTrigger as Vn, TeleportTarget as _n, TestRunner as jn, TestSceneUtils as Kn, TestSimulateUserData as Zn, Text as Qn, TextBuilder as Yn, TextExtension as $n, TextureSheetAnimationModule as Jn, TiltShiftEffect as qn, Time as ei, ToneMappingEffect as ti, TrackHandler as oi, TrackType as ri, TrailModule as ni, TransformData as ii, TransformGizmo as ai, TriggerBuilder as si, TriggerModel as li, TypeStore as di, UIRaycastUtils as ci, UIRootComponent as mi, USDDocument as gi, USDObject as pi, USDWriter as ui, USDZExporter as Si, USDZText as Ci, USDZUIExtension as yi, UriSerializer as Ei, UsageMarker as Ri, UserJoinedOrLeftRoomModel as hi, VariantAction as fi, VelocityOverLifetimeModule as vi, VerticalLayoutGroup as Pi, VideoPlayer as Ti, ViewDevice as bi, Vignette as Ai, VisibilityAction as Mi, Voip as Ii, Volume as Oi, VolumeParameter as Di, VolumeProfile as xi, WaitForFrames as ki, WaitForPromise as Li, WaitForSeconds as Ni, Watch as Bi, WebARCameraBackground as Fi, WebARSessionRoot as Ui, WebXR as wi, WebXRButtonFactory as Gi, WebXRImageTracking as Wi, WebXRImageTrackingModel as Hi, WebXRPlaneTracking as Xi, WebXRTrackedImage as zi, XRControllerFollow as Vi, XRControllerModel as _i, XRControllerMovement as ji, XRFlag as Ki, XRRig as Zi, XRState as Qi, XRStateFlag as Yi, __Ignore as $i, __internalNotifyObjectDestroyed as Ji, activeInHierarchyFieldName as qi, addAttributeChangeCallback as ea, addComponent as ta, addCustomExtensionPlugin as oa, addNewComponent as ra, addPatch as na, apply as ia, applyHMRChanges as aa, applyPrototypeExtensions as sa, beginListenDestroy as la, beginListenInstantiate as da, binaryIdentifierCasts as ca, build_scene_functions as ma, builtinComponentKeyName as ga, calculateProgress01 as pa, clearMessages as ua, clearMessages as Sa, colorSerializer as Ca, compareAssociation as ya, componentSerializer as Ea, copyTexture as Ra, createMotion as ha, debugNet as fa, debugOwner as va, decompressGpuTexture as Pa, deepClone as Ta, delay as ba, delayForFrames as Aa, deserializeObject as Ma, destroy as Ia, destroyComponentInstance as Oa, determineMimeTypeFromExtension as Da, disposeObjectResources as xa, disposeStream as ka, editorGuidKeyName as La, enableSpatialConsole as Na, euler as Ba, eventListSerializer as Fa, exportAsGLTF as Ua, findByGuid as wa, findObjectOfType as Ga, findObjectsOfType as Wa, findResourceUsers as Ha, fitObjectIntoVolume as Xa, foreachComponent as za, foreachComponentEnumerator as Va, forward as _a, generateQRCode as ja, generateSeed as Ka, getBoundingBox as Za, getCameraController as Qa, getComponent as Ya, getComponentInChildren as $a, getComponentInParent as Ja, getComponents as qa, getComponentsInChildren as es, getComponentsInParent as ts, getFormattedDate as os, getIconElement as rs, getIconTexture as ns, getLoader as is, getOrAddComponent as as, getParam as ss, getParentHierarchyPath as ls, getPath as ds, getPeerOptions as cs, getPeerjsInstance as ms, getResourceUserCount as gs, getTempColor as ps, getTempQuaternion as us, getTempVector as Ss, getUrlParams as Cs, getVisibleInCustomShadowRendering as ys, getWorldDirection as Es, getWorldEuler as Rs, getWorldPosition as hs, getWorldQuaternion as fs, getWorldRotation as vs, getWorldScale as Ps, hasCommercialLicense as Ts, hasIndieLicense as bs, hasPointerEventComponent as As, hasProLicense as Ms, hideDebugConsole as Is, imageToCanvas as Os, instantiate as Ds, invokeLoadedImportPluginHooks as xs, invokeXRSessionEnd as ks, invokeXRSessionStart as Ls, isActiveInHierarchy as Ns, isActiveSelf as Bs, isAndroidDevice as Fs, isAnimationAction as Us, isComponent as ws, isDebugMode as Gs, isDesktop as Ws, isDestroyed as Hs, isDevEnvironment as Xs, isDisposed as zs, isExporting as Vs, isGLTFModel as _s, isHostedOnGlitch as js, isHotReloadEnabled as Ks, isHotReloading as Zs, isIPad as Qs, isIconElement as Ys, isLocalNetwork as $s, isMacOS as Js, isMobileDevice as qs, isMozillaXR as el, isQuest as tl, isResourceTrackingEnabled as ol, isSafari as rl, isUsingInstancing as nl, isiOS as il, isiPad as al, loadPMREM as sl, loadSync as ll, logHierarchy as dl, lookAtInverse as cl, lookAtObject as ml, lookAtScreenPoint as gl, makeId as pl, makeIdFromRandomWords as ul, makeNameSafe as Sl, markAsInstancedRendered as Cl, microphonePermissionsGranted as yl, nameof as El, nameofFactory as Rl, objectSerializer as hl, offXRSessionEnd as fl, offXRSessionStart as vl, onXRSessionEnd as Pl, onXRSessionStart as Tl, parseSync as bl, placeOnSurface as Al, postprocessFBXMaterials as Ml, prefix as Il, pushState as Ol, randomNumber as Dl, registerBinaryType as xl, registerComponent as kl, registerComponentExtension as Ll, registerCustomEffectType as Nl, registerExportExtensions as Bl, registerExtensions as Fl, registerHotReloadType as Ul, registerLoader as wl, registerPrefabProvider as Gl, registerPrototypeExtensions as Wl, registerType as Hl, relativePathPrefix as Xl, removeAttributeChangeCallback as zl, removeComponent as Vl, removeCustomImportExtensionType as _l, removePatch as jl, resolveUrl as Kl, sanitizeString as Zl, saveImage as Ql, screenshot as Yl, screenshot2 as $l, sendDestroyed as Jl, serializable as ql, serializeObject as ed, serializeable as td, setActive as od, setAllowBalloonMessages as rd, setAllowOverlayMessages as nd, setAutoFitEnabled as id, setCameraController as ad, setDestroyed as sd, setDevEnvironment as ld, setDisposable as dd, setDontDestroy as cd, setOrAddParamsToUrl as md, setParam as gd, setParamWithoutReload as pd, setPeerOptions as ud, setResourceTrackingEnabled as Sd, setState as Cd, setVisibleInCustomShadowRendering as yd, setWorldEuler as Ed, setWorldPosition as Rd, setWorldPositionXYZ as hd, setWorldQuaternion as fd, setWorldQuaternionXYZW as vd, setWorldRotation as Pd, setWorldRotationXYZ as Td, setWorldScale as bd, showBalloonError as Ad, showBalloonMessage as Md, showBalloonWarning as Id, showDebugConsole as Od, slerp as Dd, syncDestroy as xd, syncField as kd, syncInstantiate as Ld, textureToCanvas as Nd, tryCastBinary as Bd, tryDetermineMimetypeFromBinary as Fd, tryDetermineMimetypeFromURL as Ud, tryFindObject as wd, tryGetGuid as Gd, unregisterHotReloadType as Wd, unwatchWrite as Hd, useForAutoFit as Xd, validate as zd, watchWrite as Vd } from "./needle-engine.bundle-fXDFH_oR.js";
3
3
  import { NEEDLE_progressive as jd } from "./gltf-progressive-DXRy9EQz.js";
4
4
  import { THREE as E } from "./three-BRSLmpyi.js";
5
5
  const t = {
@@ -1 +1 @@
1
- import{GameObject as s,onClear as o,onDestroy as r,onInitialized as n,onAfterRender as i,onBeforeRender as l,onUpdate as d,onStart as c,loadAsset as m,NeedleXRSession as p,Context as g,VERSION as u,Component as C,Components as y}from"./needle-engine.bundle-D6OHYyGz.min.js";import{$physicsKey as R,ActionBuilder as E,ActionCollection as h,ActionModel as v,Addressables as f,AlignmentConstraint as P,AmbientMode as A,Animation as b,AnimationCurve as T,AnimationExtension as M,AnimationTrackHandler as I,AnimationUtils as O,Animator as D,AnimatorConditionMode as x,AnimatorController as k,AnimatorControllerParameterType as L,AnimatorStateInfo as B,Antialiasing as F,Application as N,AssetDatabase as W,AssetReference as U,AudioExtension as w,AudioListener as G,AudioSource as H,AudioTrackHandler as X,Avatar as z,AvatarBlink_Simple as V,AvatarEyeLook_Rotation as j,AvatarLoader as _,AvatarMarker as K,AvatarModel as Q,Avatar_Brain_LookAt as Z,Avatar_MouthShapes as Y,Avatar_MustacheShake as J,Avatar_POI as $,Axes as q,AxesHelper as ee,BUILD_TIME as ae,BaseUIComponent as se,BasicIKConstraint as te,BehaviorExtension as oe,BehaviorModel as re,Component$1 as ne,BlobStorage as ie,BloomEffect as le,BoxCollider as de,BoxGizmo as ce,BoxHelperComponent as me,Button as pe,ButtonsFactory as ge,CallDirection as ue,CallInfo as Se,Camera as Ce,CameraTargetReachedEvent as ye,Canvas as Re,CanvasGroup as Ee,CapsuleCollider as he,ChangeMaterialOnClick as ve,ChangeTransformOnClick as fe,CharacterController as Pe,CharacterControllerInput as Ae,ChromaticAberration as be,CircularBuffer as Te,ClearFlags as Me,ClipExtrapolation as Ie,Collider as Oe,Collision as De,CollisionDetectionMode as xe,ColorAdjustments as ke,ColorBySpeedModule as Le,ColorOverLifetimeModule as Be,Component$1 as Fe,ComponentLifecycleEvents as Ne,ConnectionEvents as We,ContactPoint as Ue,ContactShadows as we,ContextArgs as Ge,ContextEvent as He,ContextRegistry as Xe,ControlTrackHandler as ze,CustomBranding as Ve,CustomShader as je,DefaultReflectionMode as _e,Deletable as Ke,DeleteBox as Qe,DepthOfField as Ze,DeviceFlag as Ye,DeviceUtilities as Je,DocumentExtension as $e,DragControls as qe,DragMode as ea,DropListener as aa,Duplicatable as sa,EffectWrapper as ta,EmissionModule as oa,EmphasizeOnClick as ra,EngineLoadingView as na,EnvironmentScene as ia,EventList as la,EventListEvent as da,EventSystem as ca,EventTrigger as ma,FieldWithDefault as pa,FileReference as ga,FileReferenceSerializer as ua,FileSpawnModel as Sa,File_Event as Ca,FixedJoint as ya,Fog as Ra,FrameEvent as Ea,GENERATOR as ha,Gizmos as va,GltfExport as fa,GltfExportBox as Pa,Gradient as Aa,Graphic as ba,GraphicRaycaster as Ta,Graphics as Ma,GridHelper as Ia,GridLayoutGroup as Oa,GroundProjectedEnv as Da,GroupActionModel as xa,HideFlags as ka,HideOnStart as La,HingeJoint as Ba,HorizontalLayoutGroup as Fa,HostData as Na,Image as Wa,ImageReference as Ua,ImageReferenceSerializer as wa,InheritVelocityModule as Ga,Input as Ha,InputEventQueue as Xa,InputEvents as za,InputField as Va,InstanceHandle as ja,InstancingHandler as _a,InstancingUtil as Ka,InstantiateEvent as Qa,InstantiateIdProvider as Za,InstantiateOptions as Ya,Interactable as Ja,InternalScreenshotUtils as $a,JoinedRoomResponse as qa,KeyEventArgs as es,Keyframe as as,LODGroup as ss,LODModel as ts,LeftRoomResponse as os,Light as rs,LightData as ns,LimitVelocityOverLifetimeModule as is,LoadingElementOptions as ls,LogStats as ds,LogType as cs,LookAt as ms,LookAtConstraint as ps,MainModule as gs,MarkerType as us,MaskableGraphic as Ss,Mathf as Cs,MeshCollider as ys,MeshRenderer as Rs,MinMaxCurve as Es,MinMaxGradient as hs,MODULES as vs,NEKeyboardEvent as fs,NEPointerEvent as Ps,NeedleButtonElement as As,ContextRegistry as bs,NeedleEngineModelLoader as Ts,NeedleEngineWebComponent as Ms,NeedleMenu as Is,NeedlePatchesKey as Os,USDZExporter$1 as Ds,NeedleXRController as xs,NeedleXRSync as ks,NeedleXRUtils as Ls,NestedGltf as Bs,NetworkConnection as Fs,NetworkedStreamEvents as Ns,NetworkedStreams as Ws,Networking as Us,NewInstanceModel as ws,NoiseModule as Gs,ObjectRaycaster as Hs,ObjectUtils as Xs,OffsetConstraint as zs,OneEuroFilter as Vs,OneEuroFilterXYZ as js,OpenURL as _s,OrbitControls as Ks,Outline as Qs,OwnershipEvent as Zs,OwnershipModel as Ys,PUBLIC_KEY as Js,Padding as $s,ParticleBurst as qs,ParticleSubEmitter as et,ParticleSystem as at,ParticleSystemBaseBehaviour as st,ParticleSystemRenderer as tt,ParticleSystemShapeType as ot,PeerHandle as rt,PeerNetworking as nt,Physics as it,PhysicsExtension as lt,PhysicsMaterialCombine as dt,PixelationEffect as ct,PlayAnimationOnClick as mt,PlayAudioOnClick as pt,PlayableDirector as gt,PlayerColor as ut,PlayerState as St,PlayerStateEvent as Ct,PlayerSync as yt,PlayerView as Rt,PlayerViewManager as Et,PointerEventData as ht,PointerType as vt,PostProcessingEffect as ft,PostProcessingEffectOrder as Pt,PostProcessingHandler as At,Volume as bt,PreliminaryAction as Tt,PreliminaryTrigger as Mt,PreviewHelper as It,PrimitiveType as Ot,Progress as Dt,PromiseAllWithErrors as xt,PromiseErrorResult as kt,RGBAColor as Lt,RapierPhysics as Bt,RawImage as Ft,RaycastOptions as Nt,Rect as Wt,RectTransform as Ut,ReflectionProbe as wt,RegisteredAnimationInfo as Gt,RemoteSkybox as Ht,RenderTexture as Xt,RenderTextureSerializer as zt,Renderer as Vt,RendererData as jt,RendererLightmap as _t,Rigidbody as Kt,RigidbodyConstraints as Qt,RoomEvents as Zt,RotationBySpeedModule as Yt,RotationOverLifetimeModule as Jt,SceneLightSettings as $t,SceneSwitcher as qt,ScreenCapture as eo,ScreenSpaceAmbientOcclusion as ao,ScreenSpaceAmbientOcclusionN8 as so,SendQueue as to,SerializationContext as oo,SetActiveOnClick as ro,ShadowCatcher as no,ShapeModule as io,ShapeOverlapResult as lo,SharpeningEffect as co,SignalAsset as mo,SignalReceiver as po,SignalReceiverEvent as go,SignalTrackHandler as uo,Size as So,SizeBySpeedModule as Co,SizeOverLifetimeModule as yo,SkinnedMeshRenderer as Ro,SmoothFollow as Eo,SpatialGrabRaycaster as ho,SpatialHtml as vo,SpatialTrigger as fo,SpatialTriggerReceiver as Po,SpectatorCamera as Ao,SphereCollider as bo,SphereIntersection as To,Sprite as Mo,SpriteData as Io,SpriteRenderer as Oo,SpriteSheet as Do,StateMachineBehaviour as xo,StreamEndedEvent as ko,StreamReceivedEvent as Lo,SubEmitterSystem as Bo,SyncedCamera as Fo,SyncedRoom as No,SyncedTransform as Wo,TapGestureTrigger as Uo,TeleportTarget as wo,TestRunner as Go,TestSceneUtils as Ho,TestSimulateUserData as Xo,Text as zo,TextBuilder as Vo,TextExtension as jo,TextureSheetAnimationModule as _o,TiltShiftEffect as Ko,Time as Qo,ToneMappingEffect as Zo,TrackHandler as Yo,TrackType as Jo,TrailModule as $o,TransformData as qo,TransformGizmo as er,TriggerBuilder as ar,TriggerModel as sr,TypeStore as tr,UIRaycastUtils as or,UIRootComponent as rr,USDDocument as nr,USDObject as ir,USDWriter as lr,USDZExporter as dr,USDZText as cr,USDZUIExtension as mr,UriSerializer as pr,UsageMarker as gr,UserJoinedOrLeftRoomModel as ur,VariantAction as Sr,VelocityOverLifetimeModule as Cr,VerticalLayoutGroup as yr,VideoPlayer as Rr,ViewDevice as Er,Vignette as hr,VisibilityAction as vr,Voip as fr,Volume as Pr,VolumeParameter as Ar,VolumeProfile as br,WaitForFrames as Tr,WaitForPromise as Mr,WaitForSeconds as Ir,Watch as Or,WebARCameraBackground as Dr,WebARSessionRoot as xr,WebXR as kr,WebXRButtonFactory as Lr,WebXRImageTracking as Br,WebXRImageTrackingModel as Fr,WebXRPlaneTracking as Nr,WebXRTrackedImage as Wr,XRControllerFollow as Ur,XRControllerModel as wr,XRControllerMovement as Gr,XRFlag as Hr,XRRig as Xr,XRState as zr,XRStateFlag as Vr,__Ignore as jr,__internalNotifyObjectDestroyed as _r,activeInHierarchyFieldName as Kr,addAttributeChangeCallback as Qr,addComponent as Zr,addCustomExtensionPlugin as Yr,addNewComponent as Jr,addPatch as $r,apply as qr,applyHMRChanges as en,applyPrototypeExtensions as an,beginListenDestroy as sn,beginListenInstantiate as tn,binaryIdentifierCasts as on,build_scene_functions as rn,builtinComponentKeyName as nn,calculateProgress01 as ln,clearMessages as dn,clearMessages as cn,colorSerializer as mn,compareAssociation as pn,componentSerializer as gn,copyTexture as un,createMotion as Sn,debugNet as Cn,debugOwner as yn,decompressGpuTexture as Rn,deepClone as En,delay as hn,delayForFrames as vn,deserializeObject as fn,destroy as Pn,destroyComponentInstance as An,determineMimeTypeFromExtension as bn,disposeObjectResources as Tn,disposeStream as Mn,editorGuidKeyName as In,enableSpatialConsole as On,euler as Dn,eventListSerializer as xn,exportAsGLTF as kn,findByGuid as Ln,findObjectOfType as Bn,findObjectsOfType as Fn,findResourceUsers as Nn,fitObjectIntoVolume as Wn,foreachComponent as Un,foreachComponentEnumerator as wn,forward as Gn,generateQRCode as Hn,generateSeed as Xn,getBoundingBox as zn,getCameraController as Vn,getComponent as jn,getComponentInChildren as _n,getComponentInParent as Kn,getComponents as Qn,getComponentsInChildren as Zn,getComponentsInParent as Yn,getFormattedDate as Jn,getIconElement as $n,getIconTexture as qn,getLoader as ei,getOrAddComponent as ai,getParam as si,getParentHierarchyPath as ti,getPath as oi,getPeerOptions as ri,getPeerjsInstance as ni,getResourceUserCount as ii,getTempColor as li,getTempQuaternion as di,getTempVector as ci,getUrlParams as mi,getVisibleInCustomShadowRendering as pi,getWorldDirection as gi,getWorldEuler as ui,getWorldPosition as Si,getWorldQuaternion as Ci,getWorldRotation as yi,getWorldScale as Ri,hasCommercialLicense as Ei,hasIndieLicense as hi,hasPointerEventComponent as vi,hasProLicense as fi,hideDebugConsole as Pi,imageToCanvas as Ai,instantiate as bi,invokeLoadedImportPluginHooks as Ti,invokeXRSessionEnd as Mi,invokeXRSessionStart as Ii,isActiveInHierarchy as Oi,isActiveSelf as Di,isAndroidDevice as xi,isAnimationAction as ki,isComponent as Li,isDebugMode as Bi,isDesktop as Fi,isDestroyed as Ni,isDevEnvironment as Wi,isDisposed as Ui,isExporting as wi,isGLTFModel as Gi,isHostedOnGlitch as Hi,isHotReloadEnabled as Xi,isHotReloading as zi,isIPad as Vi,isIconElement as ji,isLocalNetwork as _i,isMacOS as Ki,isMobileDevice as Qi,isMozillaXR as Zi,isQuest as Yi,isResourceTrackingEnabled as Ji,isSafari as $i,isUsingInstancing as qi,isiOS as el,isiPad as al,loadPMREM as sl,loadSync as tl,logHierarchy as ol,lookAtInverse as rl,lookAtObject as nl,lookAtScreenPoint as il,makeId as ll,makeIdFromRandomWords as dl,makeNameSafe as cl,markAsInstancedRendered as ml,microphonePermissionsGranted as pl,nameof as gl,nameofFactory as ul,objectSerializer as Sl,offXRSessionEnd as Cl,offXRSessionStart as yl,onXRSessionEnd as Rl,onXRSessionStart as El,parseSync as hl,placeOnSurface as vl,postprocessFBXMaterials as fl,prefix as Pl,pushState as Al,randomNumber as bl,registerBinaryType as Tl,registerComponent as Ml,registerComponentExtension as Il,registerCustomEffectType as Ol,registerExportExtensions as Dl,registerExtensions as xl,registerHotReloadType as kl,registerLoader as Ll,registerPrefabProvider as Bl,registerPrototypeExtensions as Fl,registerType as Nl,relativePathPrefix as Wl,removeAttributeChangeCallback as Ul,removeComponent as wl,removeCustomImportExtensionType as Gl,removePatch as Hl,resolveUrl as Xl,sanitizeString as zl,saveImage as Vl,screenshot as jl,screenshot2 as _l,sendDestroyed as Kl,serializable as Ql,serializeObject as Zl,serializeable as Yl,setActive as Jl,setAllowBalloonMessages as $l,setAllowOverlayMessages as ql,setAutoFitEnabled as ed,setCameraController as ad,setDestroyed as sd,setDevEnvironment as td,setDisposable as od,setDontDestroy as rd,setOrAddParamsToUrl as nd,setParam as id,setParamWithoutReload as ld,setPeerOptions as dd,setResourceTrackingEnabled as cd,setState as md,setVisibleInCustomShadowRendering as pd,setWorldEuler as gd,setWorldPosition as ud,setWorldPositionXYZ as Sd,setWorldQuaternion as Cd,setWorldQuaternionXYZW as yd,setWorldRotation as Rd,setWorldRotationXYZ as Ed,setWorldScale as hd,showBalloonError as vd,showBalloonMessage as fd,showBalloonWarning as Pd,showDebugConsole as Ad,slerp as bd,syncDestroy as Td,syncField as Md,syncInstantiate as Id,textureToCanvas as Od,tryCastBinary as Dd,tryDetermineMimetypeFromBinary as xd,tryDetermineMimetypeFromURL as kd,tryFindObject as Ld,tryGetGuid as Bd,unregisterHotReloadType as Fd,unwatchWrite as Nd,useForAutoFit as Wd,validate as Ud,watchWrite as wd}from"./needle-engine.bundle-D6OHYyGz.min.js";import{NEEDLE_progressive as Gd}from"./gltf-progressive-DViD_J_l.min.js";import{THREE as Hd}from"./three-CsmWHVn7.min.js";const a={VERSION:u,Context:g,NeedleXRSession:p,assets:{loadFromURL:m},onStart:c,onUpdate:d,onBeforeRender:l,onAfterRender:i,onInitializedContext:n,onDestroyContext:r,onClearContext:o};globalThis.Needle?.VERSION!==void 0&&console.warn(`Needle Engine is already imported: ${globalThis.Needle.VERSION}`);function S(e){for(const t in e)a[t]=e[t]}S(C),S(y);for(const e of Object.getOwnPropertyNames(s))switch(e){case"prototype":case"constructor":case"length":case"name":continue;default:a[e]=s[e];break}if(!globalThis.Needle)globalThis.Needle=a;else for(const e in a)globalThis.Needle[e]=a[e];globalThis.THREE?console.warn("Three.js is already imported"):globalThis.THREE=Hd;export{R as $physicsKey,E as ActionBuilder,h as ActionCollection,v as ActionModel,f as Addressables,P as AlignmentConstraint,A as AmbientMode,b as Animation,T as AnimationCurve,M as AnimationExtension,I as AnimationTrackHandler,O as AnimationUtils,D as Animator,x as AnimatorConditionMode,k as AnimatorController,L as AnimatorControllerParameterType,B as AnimatorStateInfo,F as Antialiasing,N as Application,W as AssetDatabase,U as AssetReference,w as AudioExtension,G as AudioListener,H as AudioSource,X as AudioTrackHandler,z as Avatar,V as AvatarBlink_Simple,j as AvatarEyeLook_Rotation,_ as AvatarLoader,K as AvatarMarker,Q as AvatarModel,Z as Avatar_Brain_LookAt,Y as Avatar_MouthShapes,J as Avatar_MustacheShake,$ as Avatar_POI,q as Axes,ee as AxesHelper,ae as BUILD_TIME,se as BaseUIComponent,te as BasicIKConstraint,oe as BehaviorExtension,re as BehaviorModel,ne as Behaviour,ie as BlobStorage,le as BloomEffect,de as BoxCollider,ce as BoxGizmo,me as BoxHelperComponent,pe as Button,ge as ButtonsFactory,ue as CallDirection,Se as CallInfo,Ce as Camera,ye as CameraTargetReachedEvent,Re as Canvas,Ee as CanvasGroup,he as CapsuleCollider,ve as ChangeMaterialOnClick,fe as ChangeTransformOnClick,Pe as CharacterController,Ae as CharacterControllerInput,be as ChromaticAberration,Te as CircularBuffer,Me as ClearFlags,Ie as ClipExtrapolation,Oe as Collider,De as Collision,xe as CollisionDetectionMode,ke as ColorAdjustments,Le as ColorBySpeedModule,Be as ColorOverLifetimeModule,Fe as Component,Ne as ComponentLifecycleEvents,We as ConnectionEvents,Ue as ContactPoint,we as ContactShadows,g as Context,Ge as ContextArgs,He as ContextEvent,Xe as ContextRegistry,ze as ControlTrackHandler,Ve as CustomBranding,je as CustomShader,_e as DefaultReflectionMode,Ke as Deletable,Qe as DeleteBox,Ze as DepthOfField,Ye as DeviceFlag,Je as DeviceUtilities,$e as DocumentExtension,qe as DragControls,ea as DragMode,aa as DropListener,sa as Duplicatable,ta as EffectWrapper,oa as EmissionModule,ra as EmphasizeOnClick,na as EngineLoadingView,ia as EnvironmentScene,la as EventList,da as EventListEvent,ca as EventSystem,ma as EventTrigger,pa as FieldWithDefault,ga as FileReference,ua as FileReferenceSerializer,Sa as FileSpawnModel,Ca as File_Event,ya as FixedJoint,Ra as Fog,Ea as FrameEvent,ha as GENERATOR,s as GameObject,va as Gizmos,fa as GltfExport,Pa as GltfExportBox,Aa as Gradient,ba as Graphic,Ta as GraphicRaycaster,Ma as Graphics,Ia as GridHelper,Oa as GridLayoutGroup,Da as GroundProjectedEnv,xa as GroupActionModel,ka as HideFlags,La as HideOnStart,Ba as HingeJoint,Fa as HorizontalLayoutGroup,Na as HostData,Wa as Image,Ua as ImageReference,wa as ImageReferenceSerializer,Ga as InheritVelocityModule,Ha as Input,Xa as InputEventQueue,za as InputEvents,Va as InputField,ja as InstanceHandle,_a as InstancingHandler,Ka as InstancingUtil,Qa as InstantiateEvent,Za as InstantiateIdProvider,Ya as InstantiateOptions,Ja as Interactable,$a as InternalScreenshotUtils,qa as JoinedRoomResponse,es as KeyEventArgs,as as Keyframe,ss as LODGroup,ts as LODModel,os as LeftRoomResponse,rs as Light,ns as LightData,is as LimitVelocityOverLifetimeModule,ls as LoadingElementOptions,ds as LogStats,cs as LogType,ms as LookAt,ps as LookAtConstraint,gs as MainModule,us as MarkerType,Ss as MaskableGraphic,Cs as Mathf,ys as MeshCollider,Rs as MeshRenderer,Es as MinMaxCurve,hs as MinMaxGradient,vs as NEEDLE_ENGINE_MODULES,Gd as NEEDLE_progressive,fs as NEKeyboardEvent,Ps as NEPointerEvent,As as NeedleButtonElement,bs as NeedleEngine,Ts as NeedleEngineModelLoader,Ms as NeedleEngineWebComponent,Is as NeedleMenu,Os as NeedlePatchesKey,Ds as NeedleUSDZExporter,xs as NeedleXRController,p as NeedleXRSession,ks as NeedleXRSync,Ls as NeedleXRUtils,Bs as NestedGltf,Fs as NetworkConnection,Ns as NetworkedStreamEvents,Ws as NetworkedStreams,Us as Networking,ws as NewInstanceModel,Gs as NoiseModule,Hs as ObjectRaycaster,Xs as ObjectUtils,zs as OffsetConstraint,Vs as OneEuroFilter,js as OneEuroFilterXYZ,_s as OpenURL,Ks as OrbitControls,Qs as Outline,Zs as OwnershipEvent,Ys as OwnershipModel,Js as PUBLIC_KEY,$s as Padding,qs as ParticleBurst,et as ParticleSubEmitter,at as ParticleSystem,st as ParticleSystemBaseBehaviour,tt as ParticleSystemRenderer,ot as ParticleSystemShapeType,rt as PeerHandle,nt as PeerNetworking,it as Physics,lt as PhysicsExtension,dt as PhysicsMaterialCombine,ct as PixelationEffect,mt as PlayAnimationOnClick,pt as PlayAudioOnClick,gt as PlayableDirector,ut as PlayerColor,St as PlayerState,Ct as PlayerStateEvent,yt as PlayerSync,Rt as PlayerView,Et as PlayerViewManager,ht as PointerEventData,vt as PointerType,ft as PostProcessingEffect,Pt as PostProcessingEffectOrder,At as PostProcessingHandler,bt as PostProcessingManager,Tt as PreliminaryAction,Mt as PreliminaryTrigger,It as PreviewHelper,Ot as PrimitiveType,Dt as Progress,xt as PromiseAllWithErrors,kt as PromiseErrorResult,Lt as RGBAColor,Bt as RapierPhysics,Ft as RawImage,Nt as RaycastOptions,Wt as Rect,Ut as RectTransform,wt as ReflectionProbe,Gt as RegisteredAnimationInfo,Ht as RemoteSkybox,Xt as RenderTexture,zt as RenderTextureSerializer,Vt as Renderer,jt as RendererData,_t as RendererLightmap,Kt as Rigidbody,Qt as RigidbodyConstraints,Zt as RoomEvents,Yt as RotationBySpeedModule,Jt as RotationOverLifetimeModule,$t as SceneLightSettings,qt as SceneSwitcher,eo as ScreenCapture,ao as ScreenSpaceAmbientOcclusion,so as ScreenSpaceAmbientOcclusionN8,to as SendQueue,oo as SerializationContext,ro as SetActiveOnClick,no as ShadowCatcher,io as ShapeModule,lo as ShapeOverlapResult,co as SharpeningEffect,mo as SignalAsset,po as SignalReceiver,go as SignalReceiverEvent,uo as SignalTrackHandler,So as Size,Co as SizeBySpeedModule,yo as SizeOverLifetimeModule,Ro as SkinnedMeshRenderer,Eo as SmoothFollow,ho as SpatialGrabRaycaster,vo as SpatialHtml,fo as SpatialTrigger,Po as SpatialTriggerReceiver,Ao as SpectatorCamera,bo as SphereCollider,To as SphereIntersection,Mo as Sprite,Io as SpriteData,Oo as SpriteRenderer,Do as SpriteSheet,xo as StateMachineBehaviour,ko as StreamEndedEvent,Lo as StreamReceivedEvent,Bo as SubEmitterSystem,Fo as SyncedCamera,No as SyncedRoom,Wo as SyncedTransform,Uo as TapGestureTrigger,wo as TeleportTarget,Go as TestRunner,Ho as TestSceneUtils,Xo as TestSimulateUserData,zo as Text,Vo as TextBuilder,jo as TextExtension,_o as TextureSheetAnimationModule,Ko as TiltShiftEffect,Qo as Time,Zo as ToneMappingEffect,Yo as TrackHandler,Jo as TrackType,$o as TrailModule,qo as TransformData,er as TransformGizmo,ar as TriggerBuilder,sr as TriggerModel,tr as TypeStore,or as UIRaycastUtils,rr as UIRootComponent,nr as USDDocument,ir as USDObject,lr as USDWriter,dr as USDZExporter,cr as USDZText,mr as USDZUIExtension,pr as UriSerializer,gr as UsageMarker,ur as UserJoinedOrLeftRoomModel,u as VERSION,Sr as VariantAction,Cr as VelocityOverLifetimeModule,yr as VerticalLayoutGroup,Rr as VideoPlayer,Er as ViewDevice,hr as Vignette,vr as VisibilityAction,fr as Voip,Pr as Volume,Ar as VolumeParameter,br as VolumeProfile,Tr as WaitForFrames,Mr as WaitForPromise,Ir as WaitForSeconds,Or as Watch,Dr as WebARCameraBackground,xr as WebARSessionRoot,kr as WebXR,Lr as WebXRButtonFactory,Br as WebXRImageTracking,Fr as WebXRImageTrackingModel,Nr as WebXRPlaneTracking,Wr as WebXRTrackedImage,Ur as XRControllerFollow,wr as XRControllerModel,Gr as XRControllerMovement,Hr as XRFlag,Xr as XRRig,zr as XRState,Vr as XRStateFlag,jr as __Ignore,_r as __internalNotifyObjectDestroyed,Kr as activeInHierarchyFieldName,Qr as addAttributeChangeCallback,Zr as addComponent,Yr as addCustomExtensionPlugin,Jr as addNewComponent,$r as addPatch,qr as apply,en as applyHMRChanges,an as applyPrototypeExtensions,sn as beginListenDestroy,tn as beginListenInstantiate,on as binaryIdentifierCasts,rn as build_scene_functions,nn as builtinComponentKeyName,ln as calculateProgress01,dn as clearBalloonMessages,cn as clearOverlayMessages,mn as colorSerializer,pn as compareAssociation,gn as componentSerializer,un as copyTexture,Sn as createMotion,Cn as debugNet,yn as debugOwner,Rn as decompressGpuTexture,En as deepClone,hn as delay,vn as delayForFrames,fn as deserializeObject,Pn as destroy,An as destroyComponentInstance,bn as determineMimeTypeFromExtension,Tn as disposeObjectResources,Mn as disposeStream,In as editorGuidKeyName,On as enableSpatialConsole,Dn as euler,xn as eventListSerializer,kn as exportAsGLTF,Ln as findByGuid,Bn as findObjectOfType,Fn as findObjectsOfType,Nn as findResourceUsers,Wn as fitObjectIntoVolume,Un as foreachComponent,wn as foreachComponentEnumerator,Gn as forward,Hn as generateQRCode,Xn as generateSeed,zn as getBoundingBox,Vn as getCameraController,jn as getComponent,_n as getComponentInChildren,Kn as getComponentInParent,Qn as getComponents,Zn as getComponentsInChildren,Yn as getComponentsInParent,Jn as getFormattedDate,$n as getIconElement,qn as getIconTexture,ei as getLoader,ai as getOrAddComponent,si as getParam,ti as getParentHierarchyPath,oi as getPath,ri as getPeerOptions,ni as getPeerjsInstance,ii as getResourceUserCount,li as getTempColor,di as getTempQuaternion,ci as getTempVector,mi as getUrlParams,pi as getVisibleInCustomShadowRendering,gi as getWorldDirection,ui as getWorldEuler,Si as getWorldPosition,Ci as getWorldQuaternion,yi as getWorldRotation,Ri as getWorldScale,Ei as hasCommercialLicense,hi as hasIndieLicense,vi as hasPointerEventComponent,fi as hasProLicense,Pi as hideDebugConsole,Ai as imageToCanvas,bi as instantiate,Ti as invokeLoadedImportPluginHooks,Mi as invokeXRSessionEnd,Ii as invokeXRSessionStart,Oi as isActiveInHierarchy,Di as isActiveSelf,xi as isAndroidDevice,ki as isAnimationAction,Li as isComponent,Bi as isDebugMode,Fi as isDesktop,Ni as isDestroyed,Wi as isDevEnvironment,Ui as isDisposed,wi as isExporting,Gi as isGLTFModel,Hi as isHostedOnGlitch,Xi as isHotReloadEnabled,zi as isHotReloading,Vi as isIPad,ji as isIconElement,_i as isLocalNetwork,Ki as isMacOS,Qi as isMobileDevice,Zi as isMozillaXR,Yi as isQuest,Ji as isResourceTrackingEnabled,$i as isSafari,qi as isUsingInstancing,el as isiOS,al as isiPad,m as loadAsset,sl as loadPMREM,tl as loadSync,ol as logHierarchy,rl as lookAtInverse,nl as lookAtObject,il as lookAtScreenPoint,ll as makeId,dl as makeIdFromRandomWords,cl as makeNameSafeForUSD,ml as markAsInstancedRendered,pl as microphonePermissionsGranted,gl as nameof,ul as nameofFactory,Sl as objectSerializer,Cl as offXRSessionEnd,yl as offXRSessionStart,i as onAfterRender,l as onBeforeRender,o as onClear,r as onDestroy,n as onInitialized,c as onStart,d as onUpdate,Rl as onXRSessionEnd,El as onXRSessionStart,hl as parseSync,vl as placeOnSurface,fl as postprocessFBXMaterials,Pl as prefix,Al as pushState,bl as randomNumber,Tl as registerBinaryType,Ml as registerComponent,Il as registerComponentExtension,Ol as registerCustomEffectType,Dl as registerExportExtensions,xl as registerExtensions,kl as registerHotReloadType,Ll as registerLoader,Bl as registerPrefabProvider,Fl as registerPrototypeExtensions,Nl as registerType,Wl as relativePathPrefix,Ul as removeAttributeChangeCallback,wl as removeComponent,Gl as removeCustomImportExtensionType,Hl as removePatch,Xl as resolveUrl,zl as sanitizeString,Vl as saveImage,jl as screenshot,_l as screenshot2,Kl as sendDestroyed,Ql as serializable,Zl as serializeObject,Yl as serializeable,Jl as setActive,$l as setAllowBalloonMessages,ql as setAllowOverlayMessages,ed as setAutoFitEnabled,ad as setCameraController,sd as setDestroyed,td as setDevEnvironment,od as setDisposable,rd as setDontDestroy,nd as setOrAddParamsToUrl,id as setParam,ld as setParamWithoutReload,dd as setPeerOptions,cd as setResourceTrackingEnabled,md as setState,pd as setVisibleInCustomShadowRendering,gd as setWorldEuler,ud as setWorldPosition,Sd as setWorldPositionXYZ,Cd as setWorldQuaternion,yd as setWorldQuaternionXYZW,Rd as setWorldRotation,Ed as setWorldRotationXYZ,hd as setWorldScale,vd as showBalloonError,fd as showBalloonMessage,Pd as showBalloonWarning,Ad as showDebugConsole,bd as slerp,Td as syncDestroy,Md as syncField,Id as syncInstantiate,Od as textureToCanvas,Dd as tryCastBinary,xd as tryDetermineMimetypeFromBinary,kd as tryDetermineMimetypeFromURL,Ld as tryFindObject,Bd as tryGetGuid,Fd as unregisterHotReloadType,Nd as unwatchWrite,Wd as useForAutoFit,Ud as validate,wd as watchWrite};
1
+ import{GameObject as s,onClear as o,onDestroy as r,onInitialized as n,onAfterRender as i,onBeforeRender as l,onUpdate as d,onStart as c,loadAsset as m,NeedleXRSession as p,Context as g,VERSION as u,Component as C,Components as y}from"./needle-engine.bundle-CJSl-mXb.min.js";import{$physicsKey as R,ActionBuilder as E,ActionCollection as h,ActionModel as v,Addressables as f,AlignmentConstraint as P,AmbientMode as A,Animation as b,AnimationCurve as T,AnimationExtension as M,AnimationTrackHandler as I,AnimationUtils as O,Animator as D,AnimatorConditionMode as x,AnimatorController as k,AnimatorControllerParameterType as L,AnimatorStateInfo as B,Antialiasing as F,Application as N,AssetDatabase as W,AssetReference as U,AudioExtension as w,AudioListener as G,AudioSource as H,AudioTrackHandler as X,Avatar as z,AvatarBlink_Simple as V,AvatarEyeLook_Rotation as j,AvatarLoader as _,AvatarMarker as K,AvatarModel as Q,Avatar_Brain_LookAt as Z,Avatar_MouthShapes as Y,Avatar_MustacheShake as J,Avatar_POI as $,Axes as q,AxesHelper as ee,BUILD_TIME as ae,BaseUIComponent as se,BasicIKConstraint as te,BehaviorExtension as oe,BehaviorModel as re,Component$1 as ne,BlobStorage as ie,BloomEffect as le,BoxCollider as de,BoxGizmo as ce,BoxHelperComponent as me,Button as pe,ButtonsFactory as ge,CallDirection as ue,CallInfo as Se,Camera as Ce,CameraTargetReachedEvent as ye,Canvas as Re,CanvasGroup as Ee,CapsuleCollider as he,ChangeMaterialOnClick as ve,ChangeTransformOnClick as fe,CharacterController as Pe,CharacterControllerInput as Ae,ChromaticAberration as be,CircularBuffer as Te,ClearFlags as Me,ClipExtrapolation as Ie,Collider as Oe,Collision as De,CollisionDetectionMode as xe,ColorAdjustments as ke,ColorBySpeedModule as Le,ColorOverLifetimeModule as Be,Component$1 as Fe,ComponentLifecycleEvents as Ne,ConnectionEvents as We,ContactPoint as Ue,ContactShadows as we,ContextArgs as Ge,ContextEvent as He,ContextRegistry as Xe,ControlTrackHandler as ze,CustomBranding as Ve,CustomShader as je,DefaultReflectionMode as _e,Deletable as Ke,DeleteBox as Qe,DepthOfField as Ze,DeviceFlag as Ye,DeviceUtilities as Je,DocumentExtension as $e,DragControls as qe,DragMode as ea,DropListener as aa,Duplicatable as sa,EffectWrapper as ta,EmissionModule as oa,EmphasizeOnClick as ra,EngineLoadingView as na,EnvironmentScene as ia,EventList as la,EventListEvent as da,EventSystem as ca,EventTrigger as ma,FieldWithDefault as pa,FileReference as ga,FileReferenceSerializer as ua,FileSpawnModel as Sa,File_Event as Ca,FixedJoint as ya,Fog as Ra,FrameEvent as Ea,GENERATOR as ha,Gizmos as va,GltfExport as fa,GltfExportBox as Pa,Gradient as Aa,Graphic as ba,GraphicRaycaster as Ta,Graphics as Ma,GridHelper as Ia,GridLayoutGroup as Oa,GroundProjectedEnv as Da,GroupActionModel as xa,HideFlags as ka,HideOnStart as La,HingeJoint as Ba,HorizontalLayoutGroup as Fa,HostData as Na,Image as Wa,ImageReference as Ua,ImageReferenceSerializer as wa,InheritVelocityModule as Ga,Input as Ha,InputEventQueue as Xa,InputEvents as za,InputField as Va,InstanceHandle as ja,InstancingHandler as _a,InstancingUtil as Ka,InstantiateEvent as Qa,InstantiateIdProvider as Za,InstantiateOptions as Ya,Interactable as Ja,InternalScreenshotUtils as $a,JoinedRoomResponse as qa,KeyEventArgs as es,Keyframe as as,LODGroup as ss,LODModel as ts,LeftRoomResponse as os,Light as rs,LightData as ns,LimitVelocityOverLifetimeModule as is,LoadingElementOptions as ls,LogStats as ds,LogType as cs,LookAt as ms,LookAtConstraint as ps,MainModule as gs,MarkerType as us,MaskableGraphic as Ss,Mathf as Cs,MeshCollider as ys,MeshRenderer as Rs,MinMaxCurve as Es,MinMaxGradient as hs,MODULES as vs,NEKeyboardEvent as fs,NEPointerEvent as Ps,NeedleButtonElement as As,ContextRegistry as bs,NeedleEngineModelLoader as Ts,NeedleEngineWebComponent as Ms,NeedleMenu as Is,NeedlePatchesKey as Os,USDZExporter$1 as Ds,NeedleXRController as xs,NeedleXRSync as ks,NeedleXRUtils as Ls,NestedGltf as Bs,NetworkConnection as Fs,NetworkedStreamEvents as Ns,NetworkedStreams as Ws,Networking as Us,NewInstanceModel as ws,NoiseModule as Gs,ObjectRaycaster as Hs,ObjectUtils as Xs,OffsetConstraint as zs,OneEuroFilter as Vs,OneEuroFilterXYZ as js,OpenURL as _s,OrbitControls as Ks,Outline as Qs,OwnershipEvent as Zs,OwnershipModel as Ys,PUBLIC_KEY as Js,Padding as $s,ParticleBurst as qs,ParticleSubEmitter as et,ParticleSystem as at,ParticleSystemBaseBehaviour as st,ParticleSystemRenderer as tt,ParticleSystemShapeType as ot,PeerHandle as rt,PeerNetworking as nt,Physics as it,PhysicsExtension as lt,PhysicsMaterialCombine as dt,PixelationEffect as ct,PlayAnimationOnClick as mt,PlayAudioOnClick as pt,PlayableDirector as gt,PlayerColor as ut,PlayerState as St,PlayerStateEvent as Ct,PlayerSync as yt,PlayerView as Rt,PlayerViewManager as Et,PointerEventData as ht,PointerType as vt,PostProcessingEffect as ft,PostProcessingEffectOrder as Pt,PostProcessingHandler as At,Volume as bt,PreliminaryAction as Tt,PreliminaryTrigger as Mt,PreviewHelper as It,PrimitiveType as Ot,Progress as Dt,PromiseAllWithErrors as xt,PromiseErrorResult as kt,RGBAColor as Lt,RapierPhysics as Bt,RawImage as Ft,RaycastOptions as Nt,Rect as Wt,RectTransform as Ut,ReflectionProbe as wt,RegisteredAnimationInfo as Gt,RemoteSkybox as Ht,RenderTexture as Xt,RenderTextureSerializer as zt,Renderer as Vt,RendererData as jt,RendererLightmap as _t,Rigidbody as Kt,RigidbodyConstraints as Qt,RoomEvents as Zt,RotationBySpeedModule as Yt,RotationOverLifetimeModule as Jt,SceneLightSettings as $t,SceneSwitcher as qt,ScreenCapture as eo,ScreenSpaceAmbientOcclusion as ao,ScreenSpaceAmbientOcclusionN8 as so,SendQueue as to,SerializationContext as oo,SetActiveOnClick as ro,ShadowCatcher as no,ShapeModule as io,ShapeOverlapResult as lo,SharpeningEffect as co,SignalAsset as mo,SignalReceiver as po,SignalReceiverEvent as go,SignalTrackHandler as uo,Size as So,SizeBySpeedModule as Co,SizeOverLifetimeModule as yo,SkinnedMeshRenderer as Ro,SmoothFollow as Eo,SpatialGrabRaycaster as ho,SpatialHtml as vo,SpatialTrigger as fo,SpatialTriggerReceiver as Po,SpectatorCamera as Ao,SphereCollider as bo,SphereIntersection as To,Sprite as Mo,SpriteData as Io,SpriteRenderer as Oo,SpriteSheet as Do,StateMachineBehaviour as xo,StreamEndedEvent as ko,StreamReceivedEvent as Lo,SubEmitterSystem as Bo,SyncedCamera as Fo,SyncedRoom as No,SyncedTransform as Wo,TapGestureTrigger as Uo,TeleportTarget as wo,TestRunner as Go,TestSceneUtils as Ho,TestSimulateUserData as Xo,Text as zo,TextBuilder as Vo,TextExtension as jo,TextureSheetAnimationModule as _o,TiltShiftEffect as Ko,Time as Qo,ToneMappingEffect as Zo,TrackHandler as Yo,TrackType as Jo,TrailModule as $o,TransformData as qo,TransformGizmo as er,TriggerBuilder as ar,TriggerModel as sr,TypeStore as tr,UIRaycastUtils as or,UIRootComponent as rr,USDDocument as nr,USDObject as ir,USDWriter as lr,USDZExporter as dr,USDZText as cr,USDZUIExtension as mr,UriSerializer as pr,UsageMarker as gr,UserJoinedOrLeftRoomModel as ur,VariantAction as Sr,VelocityOverLifetimeModule as Cr,VerticalLayoutGroup as yr,VideoPlayer as Rr,ViewDevice as Er,Vignette as hr,VisibilityAction as vr,Voip as fr,Volume as Pr,VolumeParameter as Ar,VolumeProfile as br,WaitForFrames as Tr,WaitForPromise as Mr,WaitForSeconds as Ir,Watch as Or,WebARCameraBackground as Dr,WebARSessionRoot as xr,WebXR as kr,WebXRButtonFactory as Lr,WebXRImageTracking as Br,WebXRImageTrackingModel as Fr,WebXRPlaneTracking as Nr,WebXRTrackedImage as Wr,XRControllerFollow as Ur,XRControllerModel as wr,XRControllerMovement as Gr,XRFlag as Hr,XRRig as Xr,XRState as zr,XRStateFlag as Vr,__Ignore as jr,__internalNotifyObjectDestroyed as _r,activeInHierarchyFieldName as Kr,addAttributeChangeCallback as Qr,addComponent as Zr,addCustomExtensionPlugin as Yr,addNewComponent as Jr,addPatch as $r,apply as qr,applyHMRChanges as en,applyPrototypeExtensions as an,beginListenDestroy as sn,beginListenInstantiate as tn,binaryIdentifierCasts as on,build_scene_functions as rn,builtinComponentKeyName as nn,calculateProgress01 as ln,clearMessages as dn,clearMessages as cn,colorSerializer as mn,compareAssociation as pn,componentSerializer as gn,copyTexture as un,createMotion as Sn,debugNet as Cn,debugOwner as yn,decompressGpuTexture as Rn,deepClone as En,delay as hn,delayForFrames as vn,deserializeObject as fn,destroy as Pn,destroyComponentInstance as An,determineMimeTypeFromExtension as bn,disposeObjectResources as Tn,disposeStream as Mn,editorGuidKeyName as In,enableSpatialConsole as On,euler as Dn,eventListSerializer as xn,exportAsGLTF as kn,findByGuid as Ln,findObjectOfType as Bn,findObjectsOfType as Fn,findResourceUsers as Nn,fitObjectIntoVolume as Wn,foreachComponent as Un,foreachComponentEnumerator as wn,forward as Gn,generateQRCode as Hn,generateSeed as Xn,getBoundingBox as zn,getCameraController as Vn,getComponent as jn,getComponentInChildren as _n,getComponentInParent as Kn,getComponents as Qn,getComponentsInChildren as Zn,getComponentsInParent as Yn,getFormattedDate as Jn,getIconElement as $n,getIconTexture as qn,getLoader as ei,getOrAddComponent as ai,getParam as si,getParentHierarchyPath as ti,getPath as oi,getPeerOptions as ri,getPeerjsInstance as ni,getResourceUserCount as ii,getTempColor as li,getTempQuaternion as di,getTempVector as ci,getUrlParams as mi,getVisibleInCustomShadowRendering as pi,getWorldDirection as gi,getWorldEuler as ui,getWorldPosition as Si,getWorldQuaternion as Ci,getWorldRotation as yi,getWorldScale as Ri,hasCommercialLicense as Ei,hasIndieLicense as hi,hasPointerEventComponent as vi,hasProLicense as fi,hideDebugConsole as Pi,imageToCanvas as Ai,instantiate as bi,invokeLoadedImportPluginHooks as Ti,invokeXRSessionEnd as Mi,invokeXRSessionStart as Ii,isActiveInHierarchy as Oi,isActiveSelf as Di,isAndroidDevice as xi,isAnimationAction as ki,isComponent as Li,isDebugMode as Bi,isDesktop as Fi,isDestroyed as Ni,isDevEnvironment as Wi,isDisposed as Ui,isExporting as wi,isGLTFModel as Gi,isHostedOnGlitch as Hi,isHotReloadEnabled as Xi,isHotReloading as zi,isIPad as Vi,isIconElement as ji,isLocalNetwork as _i,isMacOS as Ki,isMobileDevice as Qi,isMozillaXR as Zi,isQuest as Yi,isResourceTrackingEnabled as Ji,isSafari as $i,isUsingInstancing as qi,isiOS as el,isiPad as al,loadPMREM as sl,loadSync as tl,logHierarchy as ol,lookAtInverse as rl,lookAtObject as nl,lookAtScreenPoint as il,makeId as ll,makeIdFromRandomWords as dl,makeNameSafe as cl,markAsInstancedRendered as ml,microphonePermissionsGranted as pl,nameof as gl,nameofFactory as ul,objectSerializer as Sl,offXRSessionEnd as Cl,offXRSessionStart as yl,onXRSessionEnd as Rl,onXRSessionStart as El,parseSync as hl,placeOnSurface as vl,postprocessFBXMaterials as fl,prefix as Pl,pushState as Al,randomNumber as bl,registerBinaryType as Tl,registerComponent as Ml,registerComponentExtension as Il,registerCustomEffectType as Ol,registerExportExtensions as Dl,registerExtensions as xl,registerHotReloadType as kl,registerLoader as Ll,registerPrefabProvider as Bl,registerPrototypeExtensions as Fl,registerType as Nl,relativePathPrefix as Wl,removeAttributeChangeCallback as Ul,removeComponent as wl,removeCustomImportExtensionType as Gl,removePatch as Hl,resolveUrl as Xl,sanitizeString as zl,saveImage as Vl,screenshot as jl,screenshot2 as _l,sendDestroyed as Kl,serializable as Ql,serializeObject as Zl,serializeable as Yl,setActive as Jl,setAllowBalloonMessages as $l,setAllowOverlayMessages as ql,setAutoFitEnabled as ed,setCameraController as ad,setDestroyed as sd,setDevEnvironment as td,setDisposable as od,setDontDestroy as rd,setOrAddParamsToUrl as nd,setParam as id,setParamWithoutReload as ld,setPeerOptions as dd,setResourceTrackingEnabled as cd,setState as md,setVisibleInCustomShadowRendering as pd,setWorldEuler as gd,setWorldPosition as ud,setWorldPositionXYZ as Sd,setWorldQuaternion as Cd,setWorldQuaternionXYZW as yd,setWorldRotation as Rd,setWorldRotationXYZ as Ed,setWorldScale as hd,showBalloonError as vd,showBalloonMessage as fd,showBalloonWarning as Pd,showDebugConsole as Ad,slerp as bd,syncDestroy as Td,syncField as Md,syncInstantiate as Id,textureToCanvas as Od,tryCastBinary as Dd,tryDetermineMimetypeFromBinary as xd,tryDetermineMimetypeFromURL as kd,tryFindObject as Ld,tryGetGuid as Bd,unregisterHotReloadType as Fd,unwatchWrite as Nd,useForAutoFit as Wd,validate as Ud,watchWrite as wd}from"./needle-engine.bundle-CJSl-mXb.min.js";import{NEEDLE_progressive as Gd}from"./gltf-progressive-DViD_J_l.min.js";import{THREE as Hd}from"./three-CsmWHVn7.min.js";const a={VERSION:u,Context:g,NeedleXRSession:p,assets:{loadFromURL:m},onStart:c,onUpdate:d,onBeforeRender:l,onAfterRender:i,onInitializedContext:n,onDestroyContext:r,onClearContext:o};globalThis.Needle?.VERSION!==void 0&&console.warn(`Needle Engine is already imported: ${globalThis.Needle.VERSION}`);function S(e){for(const t in e)a[t]=e[t]}S(C),S(y);for(const e of Object.getOwnPropertyNames(s))switch(e){case"prototype":case"constructor":case"length":case"name":continue;default:a[e]=s[e];break}if(!globalThis.Needle)globalThis.Needle=a;else for(const e in a)globalThis.Needle[e]=a[e];globalThis.THREE?console.warn("Three.js is already imported"):globalThis.THREE=Hd;export{R as $physicsKey,E as ActionBuilder,h as ActionCollection,v as ActionModel,f as Addressables,P as AlignmentConstraint,A as AmbientMode,b as Animation,T as AnimationCurve,M as AnimationExtension,I as AnimationTrackHandler,O as AnimationUtils,D as Animator,x as AnimatorConditionMode,k as AnimatorController,L as AnimatorControllerParameterType,B as AnimatorStateInfo,F as Antialiasing,N as Application,W as AssetDatabase,U as AssetReference,w as AudioExtension,G as AudioListener,H as AudioSource,X as AudioTrackHandler,z as Avatar,V as AvatarBlink_Simple,j as AvatarEyeLook_Rotation,_ as AvatarLoader,K as AvatarMarker,Q as AvatarModel,Z as Avatar_Brain_LookAt,Y as Avatar_MouthShapes,J as Avatar_MustacheShake,$ as Avatar_POI,q as Axes,ee as AxesHelper,ae as BUILD_TIME,se as BaseUIComponent,te as BasicIKConstraint,oe as BehaviorExtension,re as BehaviorModel,ne as Behaviour,ie as BlobStorage,le as BloomEffect,de as BoxCollider,ce as BoxGizmo,me as BoxHelperComponent,pe as Button,ge as ButtonsFactory,ue as CallDirection,Se as CallInfo,Ce as Camera,ye as CameraTargetReachedEvent,Re as Canvas,Ee as CanvasGroup,he as CapsuleCollider,ve as ChangeMaterialOnClick,fe as ChangeTransformOnClick,Pe as CharacterController,Ae as CharacterControllerInput,be as ChromaticAberration,Te as CircularBuffer,Me as ClearFlags,Ie as ClipExtrapolation,Oe as Collider,De as Collision,xe as CollisionDetectionMode,ke as ColorAdjustments,Le as ColorBySpeedModule,Be as ColorOverLifetimeModule,Fe as Component,Ne as ComponentLifecycleEvents,We as ConnectionEvents,Ue as ContactPoint,we as ContactShadows,g as Context,Ge as ContextArgs,He as ContextEvent,Xe as ContextRegistry,ze as ControlTrackHandler,Ve as CustomBranding,je as CustomShader,_e as DefaultReflectionMode,Ke as Deletable,Qe as DeleteBox,Ze as DepthOfField,Ye as DeviceFlag,Je as DeviceUtilities,$e as DocumentExtension,qe as DragControls,ea as DragMode,aa as DropListener,sa as Duplicatable,ta as EffectWrapper,oa as EmissionModule,ra as EmphasizeOnClick,na as EngineLoadingView,ia as EnvironmentScene,la as EventList,da as EventListEvent,ca as EventSystem,ma as EventTrigger,pa as FieldWithDefault,ga as FileReference,ua as FileReferenceSerializer,Sa as FileSpawnModel,Ca as File_Event,ya as FixedJoint,Ra as Fog,Ea as FrameEvent,ha as GENERATOR,s as GameObject,va as Gizmos,fa as GltfExport,Pa as GltfExportBox,Aa as Gradient,ba as Graphic,Ta as GraphicRaycaster,Ma as Graphics,Ia as GridHelper,Oa as GridLayoutGroup,Da as GroundProjectedEnv,xa as GroupActionModel,ka as HideFlags,La as HideOnStart,Ba as HingeJoint,Fa as HorizontalLayoutGroup,Na as HostData,Wa as Image,Ua as ImageReference,wa as ImageReferenceSerializer,Ga as InheritVelocityModule,Ha as Input,Xa as InputEventQueue,za as InputEvents,Va as InputField,ja as InstanceHandle,_a as InstancingHandler,Ka as InstancingUtil,Qa as InstantiateEvent,Za as InstantiateIdProvider,Ya as InstantiateOptions,Ja as Interactable,$a as InternalScreenshotUtils,qa as JoinedRoomResponse,es as KeyEventArgs,as as Keyframe,ss as LODGroup,ts as LODModel,os as LeftRoomResponse,rs as Light,ns as LightData,is as LimitVelocityOverLifetimeModule,ls as LoadingElementOptions,ds as LogStats,cs as LogType,ms as LookAt,ps as LookAtConstraint,gs as MainModule,us as MarkerType,Ss as MaskableGraphic,Cs as Mathf,ys as MeshCollider,Rs as MeshRenderer,Es as MinMaxCurve,hs as MinMaxGradient,vs as NEEDLE_ENGINE_MODULES,Gd as NEEDLE_progressive,fs as NEKeyboardEvent,Ps as NEPointerEvent,As as NeedleButtonElement,bs as NeedleEngine,Ts as NeedleEngineModelLoader,Ms as NeedleEngineWebComponent,Is as NeedleMenu,Os as NeedlePatchesKey,Ds as NeedleUSDZExporter,xs as NeedleXRController,p as NeedleXRSession,ks as NeedleXRSync,Ls as NeedleXRUtils,Bs as NestedGltf,Fs as NetworkConnection,Ns as NetworkedStreamEvents,Ws as NetworkedStreams,Us as Networking,ws as NewInstanceModel,Gs as NoiseModule,Hs as ObjectRaycaster,Xs as ObjectUtils,zs as OffsetConstraint,Vs as OneEuroFilter,js as OneEuroFilterXYZ,_s as OpenURL,Ks as OrbitControls,Qs as Outline,Zs as OwnershipEvent,Ys as OwnershipModel,Js as PUBLIC_KEY,$s as Padding,qs as ParticleBurst,et as ParticleSubEmitter,at as ParticleSystem,st as ParticleSystemBaseBehaviour,tt as ParticleSystemRenderer,ot as ParticleSystemShapeType,rt as PeerHandle,nt as PeerNetworking,it as Physics,lt as PhysicsExtension,dt as PhysicsMaterialCombine,ct as PixelationEffect,mt as PlayAnimationOnClick,pt as PlayAudioOnClick,gt as PlayableDirector,ut as PlayerColor,St as PlayerState,Ct as PlayerStateEvent,yt as PlayerSync,Rt as PlayerView,Et as PlayerViewManager,ht as PointerEventData,vt as PointerType,ft as PostProcessingEffect,Pt as PostProcessingEffectOrder,At as PostProcessingHandler,bt as PostProcessingManager,Tt as PreliminaryAction,Mt as PreliminaryTrigger,It as PreviewHelper,Ot as PrimitiveType,Dt as Progress,xt as PromiseAllWithErrors,kt as PromiseErrorResult,Lt as RGBAColor,Bt as RapierPhysics,Ft as RawImage,Nt as RaycastOptions,Wt as Rect,Ut as RectTransform,wt as ReflectionProbe,Gt as RegisteredAnimationInfo,Ht as RemoteSkybox,Xt as RenderTexture,zt as RenderTextureSerializer,Vt as Renderer,jt as RendererData,_t as RendererLightmap,Kt as Rigidbody,Qt as RigidbodyConstraints,Zt as RoomEvents,Yt as RotationBySpeedModule,Jt as RotationOverLifetimeModule,$t as SceneLightSettings,qt as SceneSwitcher,eo as ScreenCapture,ao as ScreenSpaceAmbientOcclusion,so as ScreenSpaceAmbientOcclusionN8,to as SendQueue,oo as SerializationContext,ro as SetActiveOnClick,no as ShadowCatcher,io as ShapeModule,lo as ShapeOverlapResult,co as SharpeningEffect,mo as SignalAsset,po as SignalReceiver,go as SignalReceiverEvent,uo as SignalTrackHandler,So as Size,Co as SizeBySpeedModule,yo as SizeOverLifetimeModule,Ro as SkinnedMeshRenderer,Eo as SmoothFollow,ho as SpatialGrabRaycaster,vo as SpatialHtml,fo as SpatialTrigger,Po as SpatialTriggerReceiver,Ao as SpectatorCamera,bo as SphereCollider,To as SphereIntersection,Mo as Sprite,Io as SpriteData,Oo as SpriteRenderer,Do as SpriteSheet,xo as StateMachineBehaviour,ko as StreamEndedEvent,Lo as StreamReceivedEvent,Bo as SubEmitterSystem,Fo as SyncedCamera,No as SyncedRoom,Wo as SyncedTransform,Uo as TapGestureTrigger,wo as TeleportTarget,Go as TestRunner,Ho as TestSceneUtils,Xo as TestSimulateUserData,zo as Text,Vo as TextBuilder,jo as TextExtension,_o as TextureSheetAnimationModule,Ko as TiltShiftEffect,Qo as Time,Zo as ToneMappingEffect,Yo as TrackHandler,Jo as TrackType,$o as TrailModule,qo as TransformData,er as TransformGizmo,ar as TriggerBuilder,sr as TriggerModel,tr as TypeStore,or as UIRaycastUtils,rr as UIRootComponent,nr as USDDocument,ir as USDObject,lr as USDWriter,dr as USDZExporter,cr as USDZText,mr as USDZUIExtension,pr as UriSerializer,gr as UsageMarker,ur as UserJoinedOrLeftRoomModel,u as VERSION,Sr as VariantAction,Cr as VelocityOverLifetimeModule,yr as VerticalLayoutGroup,Rr as VideoPlayer,Er as ViewDevice,hr as Vignette,vr as VisibilityAction,fr as Voip,Pr as Volume,Ar as VolumeParameter,br as VolumeProfile,Tr as WaitForFrames,Mr as WaitForPromise,Ir as WaitForSeconds,Or as Watch,Dr as WebARCameraBackground,xr as WebARSessionRoot,kr as WebXR,Lr as WebXRButtonFactory,Br as WebXRImageTracking,Fr as WebXRImageTrackingModel,Nr as WebXRPlaneTracking,Wr as WebXRTrackedImage,Ur as XRControllerFollow,wr as XRControllerModel,Gr as XRControllerMovement,Hr as XRFlag,Xr as XRRig,zr as XRState,Vr as XRStateFlag,jr as __Ignore,_r as __internalNotifyObjectDestroyed,Kr as activeInHierarchyFieldName,Qr as addAttributeChangeCallback,Zr as addComponent,Yr as addCustomExtensionPlugin,Jr as addNewComponent,$r as addPatch,qr as apply,en as applyHMRChanges,an as applyPrototypeExtensions,sn as beginListenDestroy,tn as beginListenInstantiate,on as binaryIdentifierCasts,rn as build_scene_functions,nn as builtinComponentKeyName,ln as calculateProgress01,dn as clearBalloonMessages,cn as clearOverlayMessages,mn as colorSerializer,pn as compareAssociation,gn as componentSerializer,un as copyTexture,Sn as createMotion,Cn as debugNet,yn as debugOwner,Rn as decompressGpuTexture,En as deepClone,hn as delay,vn as delayForFrames,fn as deserializeObject,Pn as destroy,An as destroyComponentInstance,bn as determineMimeTypeFromExtension,Tn as disposeObjectResources,Mn as disposeStream,In as editorGuidKeyName,On as enableSpatialConsole,Dn as euler,xn as eventListSerializer,kn as exportAsGLTF,Ln as findByGuid,Bn as findObjectOfType,Fn as findObjectsOfType,Nn as findResourceUsers,Wn as fitObjectIntoVolume,Un as foreachComponent,wn as foreachComponentEnumerator,Gn as forward,Hn as generateQRCode,Xn as generateSeed,zn as getBoundingBox,Vn as getCameraController,jn as getComponent,_n as getComponentInChildren,Kn as getComponentInParent,Qn as getComponents,Zn as getComponentsInChildren,Yn as getComponentsInParent,Jn as getFormattedDate,$n as getIconElement,qn as getIconTexture,ei as getLoader,ai as getOrAddComponent,si as getParam,ti as getParentHierarchyPath,oi as getPath,ri as getPeerOptions,ni as getPeerjsInstance,ii as getResourceUserCount,li as getTempColor,di as getTempQuaternion,ci as getTempVector,mi as getUrlParams,pi as getVisibleInCustomShadowRendering,gi as getWorldDirection,ui as getWorldEuler,Si as getWorldPosition,Ci as getWorldQuaternion,yi as getWorldRotation,Ri as getWorldScale,Ei as hasCommercialLicense,hi as hasIndieLicense,vi as hasPointerEventComponent,fi as hasProLicense,Pi as hideDebugConsole,Ai as imageToCanvas,bi as instantiate,Ti as invokeLoadedImportPluginHooks,Mi as invokeXRSessionEnd,Ii as invokeXRSessionStart,Oi as isActiveInHierarchy,Di as isActiveSelf,xi as isAndroidDevice,ki as isAnimationAction,Li as isComponent,Bi as isDebugMode,Fi as isDesktop,Ni as isDestroyed,Wi as isDevEnvironment,Ui as isDisposed,wi as isExporting,Gi as isGLTFModel,Hi as isHostedOnGlitch,Xi as isHotReloadEnabled,zi as isHotReloading,Vi as isIPad,ji as isIconElement,_i as isLocalNetwork,Ki as isMacOS,Qi as isMobileDevice,Zi as isMozillaXR,Yi as isQuest,Ji as isResourceTrackingEnabled,$i as isSafari,qi as isUsingInstancing,el as isiOS,al as isiPad,m as loadAsset,sl as loadPMREM,tl as loadSync,ol as logHierarchy,rl as lookAtInverse,nl as lookAtObject,il as lookAtScreenPoint,ll as makeId,dl as makeIdFromRandomWords,cl as makeNameSafeForUSD,ml as markAsInstancedRendered,pl as microphonePermissionsGranted,gl as nameof,ul as nameofFactory,Sl as objectSerializer,Cl as offXRSessionEnd,yl as offXRSessionStart,i as onAfterRender,l as onBeforeRender,o as onClear,r as onDestroy,n as onInitialized,c as onStart,d as onUpdate,Rl as onXRSessionEnd,El as onXRSessionStart,hl as parseSync,vl as placeOnSurface,fl as postprocessFBXMaterials,Pl as prefix,Al as pushState,bl as randomNumber,Tl as registerBinaryType,Ml as registerComponent,Il as registerComponentExtension,Ol as registerCustomEffectType,Dl as registerExportExtensions,xl as registerExtensions,kl as registerHotReloadType,Ll as registerLoader,Bl as registerPrefabProvider,Fl as registerPrototypeExtensions,Nl as registerType,Wl as relativePathPrefix,Ul as removeAttributeChangeCallback,wl as removeComponent,Gl as removeCustomImportExtensionType,Hl as removePatch,Xl as resolveUrl,zl as sanitizeString,Vl as saveImage,jl as screenshot,_l as screenshot2,Kl as sendDestroyed,Ql as serializable,Zl as serializeObject,Yl as serializeable,Jl as setActive,$l as setAllowBalloonMessages,ql as setAllowOverlayMessages,ed as setAutoFitEnabled,ad as setCameraController,sd as setDestroyed,td as setDevEnvironment,od as setDisposable,rd as setDontDestroy,nd as setOrAddParamsToUrl,id as setParam,ld as setParamWithoutReload,dd as setPeerOptions,cd as setResourceTrackingEnabled,md as setState,pd as setVisibleInCustomShadowRendering,gd as setWorldEuler,ud as setWorldPosition,Sd as setWorldPositionXYZ,Cd as setWorldQuaternion,yd as setWorldQuaternionXYZW,Rd as setWorldRotation,Ed as setWorldRotationXYZ,hd as setWorldScale,vd as showBalloonError,fd as showBalloonMessage,Pd as showBalloonWarning,Ad as showDebugConsole,bd as slerp,Td as syncDestroy,Md as syncField,Id as syncInstantiate,Od as textureToCanvas,Dd as tryCastBinary,xd as tryDetermineMimetypeFromBinary,kd as tryDetermineMimetypeFromURL,Ld as tryFindObject,Bd as tryGetGuid,Fd as unregisterHotReloadType,Nd as unwatchWrite,Wd as useForAutoFit,Ud as validate,wd as watchWrite};