angular-three 4.0.7 → 4.0.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"angular-three.mjs","sources":["../../../../libs/core/src/lib/renderer/constants.ts","../../../../libs/core/src/lib/utils/is.ts","../../../../libs/core/src/lib/directives/common.ts","../../../../libs/core/src/lib/directives/args.ts","../../../../libs/core/src/lib/loop.ts","../../../../libs/core/src/lib/utils/signal-state.ts","../../../../libs/core/src/lib/utils/update.ts","../../../../libs/core/src/lib/instance.ts","../../../../libs/core/src/lib/utils/apply-props.ts","../../../../libs/core/src/lib/renderer/catalogue.ts","../../../../libs/core/src/lib/renderer/state.ts","../../../../libs/core/src/lib/utils/make.ts","../../../../libs/core/src/lib/events.ts","../../../../libs/core/src/lib/utils/attach.ts","../../../../libs/core/src/lib/renderer/utils.ts","../../../../libs/core/src/lib/renderer/renderer.ts","../../../../libs/core/src/lib/store.ts","../../../../libs/core/src/lib/utils/resolve-ref.ts","../../../../libs/core/src/lib/directives/parent.ts","../../../../libs/core/src/lib/directives/selection.ts","../../../../libs/core/src/lib/html.ts","../../../../libs/core/src/lib/loader.ts","../../../../libs/core/src/lib/loader-resource.ts","../../../../libs/core/src/lib/pipes/hexify.ts","../../../../libs/core/src/lib/utils/parameters.ts","../../../../libs/core/src/lib/portal.ts","../../../../libs/core/src/lib/roots.ts","../../../../libs/core/src/lib/routed-scene.ts","../../../../libs/core/src/lib/utils/before-render.ts","../../../../libs/core/src/lib/utils/element-events.ts","../../../../libs/core/src/lib/utils/object-events.ts","../../../../libs/core/src/lib/utils/output-ref.ts","../../../../libs/core/src/angular-three.ts"],"sourcesContent":["/**\n * @fileoverview Internal constants used by the Angular Three renderer.\n *\n * These flags are used to mark DOM nodes and track renderer state.\n * @internal\n */\n\n/** Flag indicating a node is managed by the Angular Three renderer */\nexport const NGT_RENDERER_NODE_FLAG = '__ngt_renderer__';\n/** Flag for canvas content template comments */\nexport const NGT_CANVAS_CONTENT_FLAG = '__ngt_renderer_canvas_content__';\n/** Flag for portal content template comments */\nexport const NGT_PORTAL_CONTENT_FLAG = '__ngt_renderer_portal_content__';\n/** Flag for args directive comments */\nexport const NGT_ARGS_FLAG = '__ngt_renderer_args__';\n/** Flag for parent directive comments */\nexport const NGT_PARENT_FLAG = '__ngt_renderer_parent__';\n/** Internal flag for adding comment nodes */\nexport const NGT_INTERNAL_ADD_COMMENT_FLAG = '__ngt_renderer_add_comment__';\n/** Internal flag for setting parent on comment nodes */\nexport const NGT_INTERNAL_SET_PARENT_COMMENT_FLAG = '__ngt_renderer_set_parent_comment__';\n/** Flag for getting node attributes */\nexport const NGT_GET_NODE_ATTRIBUTE_FLAG = '__ngt_get_node_attribute__';\n/** Flag for DOM parent element reference */\nexport const NGT_DOM_PARENT_FLAG = '__ngt_dom_parent__';\n/** Flag indicating the delegate renderer's destroyNode has been patched */\nexport const NGT_DELEGATE_RENDERER_DESTROY_NODE_PATCHED_FLAG = '__ngt_delegate_renderer_destroy_node_patched__';\n/** Flag for HTML directive classes */\nexport const NGT_HTML_FLAG = '__ngt_html__';\n\n/** Native Three.js EventDispatcher events */\nexport const THREE_NATIVE_EVENTS = ['added', 'removed', 'childadded', 'childremoved', 'change', 'disposed'];\n","import type { ElementRef } from '@angular/core';\nimport type * as THREE from 'three';\nimport type { NgtAnyRecord, NgtEquConfig, NgtInstanceNode, NgtRendererLike } from '../types';\n\n/**\n * Collection of type checking and comparison utilities for Angular Three.\n *\n * These utilities help with runtime type checking of Three.js objects,\n * Angular references, and general equality comparisons.\n *\n * @example\n * ```typescript\n * // Check if something is a Three.js mesh\n * if (is.three<THREE.Mesh>(obj, 'isMesh')) {\n * // obj is typed as THREE.Mesh\n * }\n *\n * // Check if two values are equal\n * if (is.equ(a, b, { objects: 'shallow' })) {\n * // values are considered equal\n * }\n * ```\n */\nexport const is = {\n\t/** Checks if value is a plain object (not array or function) */\n\tobj: (a: unknown): a is object => a === Object(a) && !Array.isArray(a) && typeof a !== 'function',\n\t/** Checks if value is a Three.js Material */\n\tmaterial: (a: unknown): a is THREE.Material => !!a && (a as THREE.Material).isMaterial,\n\t/** Checks if value is a Three.js BufferGeometry */\n\tgeometry: (a: unknown): a is THREE.BufferGeometry => !!a && (a as THREE.BufferGeometry).isBufferGeometry,\n\t/** Checks if value is a Three.js OrthographicCamera */\n\torthographicCamera: (a: unknown): a is THREE.OrthographicCamera =>\n\t\t!!a && (a as THREE.OrthographicCamera).isOrthographicCamera,\n\t/** Checks if value is a Three.js PerspectiveCamera */\n\tperspectiveCamera: (a: unknown): a is THREE.PerspectiveCamera =>\n\t\t!!a && (a as THREE.PerspectiveCamera).isPerspectiveCamera,\n\t/** Checks if value is a Three.js Camera */\n\tcamera: (a: unknown): a is THREE.Camera => !!a && (a as THREE.Camera).isCamera,\n\t/** Checks if value is a renderer-like object with a render method */\n\trenderer: (a: unknown) => !!a && typeof a === 'object' && 'render' in a && typeof a['render'] === 'function',\n\t/** Checks if value is a Three.js Scene */\n\tscene: (a: unknown): a is THREE.Scene => !!a && (a as THREE.Scene).isScene,\n\t/** Checks if value is an Angular ElementRef */\n\tref: (a: unknown): a is ElementRef => !!a && typeof a === 'object' && 'nativeElement' in a,\n\t/** Checks if value is an Angular Three instance node (prepared object) */\n\tinstance: (a: unknown): a is NgtInstanceNode => !!a && !!(a as NgtAnyRecord)['__ngt__'],\n\t/** Checks if value is a Three.js Object3D */\n\tobject3D: (a: unknown): a is THREE.Object3D => !!a && (a as THREE.Object3D).isObject3D,\n\t/**\n\t * Generic Three.js type check using the is* pattern.\n\t * @example is.three<THREE.Mesh>(obj, 'isMesh')\n\t */\n\tthree: <TThreeEntity extends object, TKey extends keyof TThreeEntity = keyof TThreeEntity>(\n\t\ta: unknown,\n\t\tisKey: TKey extends `is${infer K}` ? TKey : never,\n\t): a is TThreeEntity => !!a && (a as any)[isKey],\n\t/** Checks if value is a valid Three.js ColorRepresentation */\n\tcolorRepresentation: (a: unknown): a is THREE.ColorRepresentation =>\n\t\ta != null && (typeof a === 'string' || typeof a === 'number' || is.three<THREE.Color>(a, 'isColor')),\n\t/** Checks if object has colorSpace or outputColorSpace property */\n\tcolorSpaceExist: <\n\t\tT extends NgtRendererLike | THREE.Texture | object,\n\t\tP = T extends NgtRendererLike ? { outputColorSpace: string } : { colorSpace: string },\n\t>(\n\t\tobject: T,\n\t): object is T & P => 'colorSpace' in object || 'outputColorSpace' in object,\n\t/**\n\t * Deep equality comparison with configurable behavior for arrays and objects.\n\t * @param a - First value to compare\n\t * @param b - Second value to compare\n\t * @param config - Comparison configuration\n\t */\n\tequ(a: any, b: any, { arrays = 'shallow', objects = 'reference', strict = true }: NgtEquConfig = {}) {\n\t\t// Wrong type or one of the two undefined, doesn't match\n\t\tif (typeof a !== typeof b || !!a !== !!b) return false;\n\t\t// Atomic, just compare a against b\n\t\tif (typeof a === 'string' || typeof a === 'number') return a === b;\n\t\tconst isObj = is.obj(a);\n\t\tif (isObj && objects === 'reference') return a === b;\n\t\tconst isArr = Array.isArray(a);\n\t\tif (isArr && arrays === 'reference') return a === b;\n\t\t// Array or Object, shallow compare first to see if it's a match\n\t\tif ((isArr || isObj) && a === b) return true;\n\t\t// Last resort, go through keys\n\t\tlet i;\n\t\tfor (i in a) if (!(i in b)) return false;\n\t\tfor (i in strict ? b : a) if (a[i] !== b[i]) return false;\n\t\tif (i === void 0) {\n\t\t\tif (isArr && a.length === 0 && b.length === 0) return true;\n\t\t\tif (isObj && Object.keys(a).length === 0 && Object.keys(b).length === 0) return true;\n\t\t\tif (a !== b) return false;\n\t\t}\n\t\treturn true;\n\t},\n};\n","import {\n\tDestroyRef,\n\tDirective,\n\teffect,\n\tEmbeddedViewRef,\n\tinject,\n\tInjector,\n\tSignal,\n\tTemplateRef,\n\tViewContainerRef,\n} from '@angular/core';\nimport { is } from '../utils/is';\n\n/**\n * Abstract base class for Angular Three structural directives.\n *\n * This class provides common functionality for structural directives like `NgtArgs` and `NgtParent`,\n * including view management, value injection, and change detection.\n *\n * Subclasses must implement:\n * - `validate()`: Returns true if the directive has a valid value to inject\n * - `linkedValue`: A signal containing the current value\n * - `shouldSkipRender`: A signal indicating whether rendering should be skipped\n *\n * @typeParam TValue - The type of value this directive manages\n */\n@Directive()\nexport abstract class NgtCommonDirective<TValue> {\n\tprivate vcr = inject(ViewContainerRef);\n\tprivate template = inject(TemplateRef);\n\tprotected injector = inject(Injector);\n\n\tprotected injected = false;\n\tprotected injectedValue: TValue | null = null;\n\tprivate view?: EmbeddedViewRef<unknown>;\n\n\tprotected get commentNode() {\n\t\treturn this.vcr.element.nativeElement;\n\t}\n\n\tabstract validate(): boolean;\n\tprotected abstract linkedValue: Signal<TValue | null>;\n\tprotected abstract shouldSkipRender: Signal<boolean>;\n\n\tprotected constructor() {\n\t\teffect(() => {\n\t\t\tif (this.shouldSkipRender()) return;\n\n\t\t\tconst value = this.linkedValue();\n\n\t\t\tif (is.equ(value, this.injectedValue)) {\n\t\t\t\t// we have the same value as before, no need to update\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.injected = false;\n\t\t\tthis.injectedValue = value;\n\t\t\tthis.createView();\n\t\t});\n\n\t\tinject(DestroyRef).onDestroy(() => {\n\t\t\tthis.view?.destroy();\n\t\t});\n\t}\n\n\tget value() {\n\t\tif (this.validate()) {\n\t\t\tthis.injected = true;\n\t\t\treturn this.injectedValue;\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected beforeCreateView() {\n\t\t/* noop */\n\t}\n\n\tprivate createView() {\n\t\tif (this.view && !this.view.destroyed) this.view.destroy();\n\n\t\tthis.beforeCreateView();\n\n\t\tthis.view = this.vcr.createEmbeddedView(this.template);\n\t\tthis.view.detectChanges();\n\t}\n}\n","import { computed, Directive, input, linkedSignal } from '@angular/core';\nimport { NGT_ARGS_FLAG, NGT_INTERNAL_ADD_COMMENT_FLAG } from '../renderer/constants';\nimport { NgtCommonDirective } from './common';\n\n/**\n * Structural directive for passing constructor arguments to Three.js elements.\n *\n * The `NgtArgs` directive allows you to pass constructor arguments to Three.js objects\n * when they are created. This is essential for objects that require constructor arguments\n * like geometries, materials, and custom objects.\n *\n * @example\n * ```html\n * <!-- Pass arguments to BoxGeometry constructor -->\n * <ngt-mesh>\n * <ngt-box-geometry *args=\"[1, 2, 3]\" />\n * </ngt-mesh>\n *\n * <!-- Use with primitive for external objects -->\n * <ngt-primitive *args=\"[myObject]\" />\n * ```\n */\n@Directive({ selector: 'ng-template[args]' })\nexport class NgtArgs extends NgtCommonDirective<any[]> {\n\targs = input.required<any[] | null>();\n\n\tprotected linkedValue = linkedSignal(this.args);\n\tprotected shouldSkipRender = computed(() => {\n\t\tconst args = this.args();\n\t\treturn args == null || !Array.isArray(args) || (args.length === 1 && args[0] === null);\n\t});\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tconst commentNode = this.commentNode;\n\t\tcommentNode.data = NGT_ARGS_FLAG;\n\t\tcommentNode[NGT_ARGS_FLAG] = true;\n\n\t\tif (commentNode[NGT_INTERNAL_ADD_COMMENT_FLAG]) {\n\t\t\tcommentNode[NGT_INTERNAL_ADD_COMMENT_FLAG]('args', this.injector);\n\t\t\tdelete commentNode[NGT_INTERNAL_ADD_COMMENT_FLAG];\n\t\t}\n\t}\n\n\tvalidate() {\n\t\treturn !this.injected && !!this.injectedValue?.length;\n\t}\n}\n","import { inject, InjectionToken } from '@angular/core';\nimport type { NgtCanvasElement, NgtGlobalRenderCallback, NgtState } from './types';\nimport type { SignalState } from './utils/signal-state';\n\n/**\n * Global map of canvas elements to their associated stores.\n *\n * This map maintains references to all active Angular Three canvas roots,\n * allowing the render loop to iterate over and render all active scenes.\n */\nexport const roots = new Map<NgtCanvasElement, SignalState<NgtState>>();\n\ntype SubItem = { callback: NgtGlobalRenderCallback };\n\nfunction createSubs(callback: NgtGlobalRenderCallback, subs: Set<SubItem>): () => void {\n\tconst sub = { callback };\n\tsubs.add(sub);\n\treturn () => void subs.delete(sub);\n}\n\nconst globalEffects: Set<SubItem> = new Set();\nconst globalAfterEffects: Set<SubItem> = new Set();\nconst globalTailEffects: Set<SubItem> = new Set();\n\n/**\n * Adds a global render callback which is called each frame.\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect\n */\nexport const addEffect = (callback: NgtGlobalRenderCallback) => createSubs(callback, globalEffects);\n\n/**\n * Adds a global after-render callback which is called each frame.\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect\n */\nexport const addAfterEffect = (callback: NgtGlobalRenderCallback) => createSubs(callback, globalAfterEffects);\n\n/**\n * Adds a global callback which is called when rendering stops.\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail\n */\nexport const addTail = (callback: NgtGlobalRenderCallback) => createSubs(callback, globalTailEffects);\n\nfunction run(effects: Set<SubItem>, timestamp: number) {\n\tif (!effects.size) return;\n\tfor (const { callback } of effects.values()) {\n\t\tcallback(timestamp);\n\t}\n}\n\n/**\n * Type of global effect in the render loop.\n * - 'before': Runs before the main render\n * - 'after': Runs after the main render\n * - 'tail': Runs when rendering stops\n */\nexport type NgtGlobalEffectType = 'before' | 'after' | 'tail';\n\n/**\n * Executes all global effects of the specified type.\n *\n * @param type - The type of global effects to flush ('before', 'after', or 'tail')\n * @param timestamp - The current timestamp from requestAnimationFrame\n */\nexport function flushGlobalEffects(type: NgtGlobalEffectType, timestamp: number): void {\n\tswitch (type) {\n\t\tcase 'before':\n\t\t\treturn run(globalEffects, timestamp);\n\t\tcase 'after':\n\t\t\treturn run(globalAfterEffects, timestamp);\n\t\tcase 'tail':\n\t\t\treturn run(globalTailEffects, timestamp);\n\t}\n}\n\nfunction update(timestamp: number, store: SignalState<NgtState>, frame?: XRFrame) {\n\tconst state = store.snapshot;\n\t// Run local effects\n\tlet delta = state.clock.getDelta();\n\t// In frameloop='never' mode, clock times are updated using the provided timestamp\n\tif (state.frameloop === 'never' && typeof timestamp === 'number') {\n\t\tdelta = timestamp - state.clock.elapsedTime;\n\t\tstate.clock.oldTime = state.clock.elapsedTime;\n\t\tstate.clock.elapsedTime = timestamp;\n\t}\n\t// Call subscribers (beforeRender)\n\tconst subscribers = state.internal.subscribers;\n\tfor (let i = 0; i < subscribers.length; i++) {\n\t\tconst subscription = subscribers[i];\n\t\tsubscription.callback({ ...subscription.store.snapshot, delta, frame });\n\t}\n\t// Render content\n\tif (!state.internal.priority && state.gl.render) state.gl.render(state.scene, state.camera);\n\t// Decrease frame count\n\tstate.internal.frames = Math.max(0, state.internal.frames - 1);\n\treturn state.frameloop === 'always' ? 1 : state.internal.frames;\n}\n\nfunction createLoop<TCanvas>(roots: Map<TCanvas, SignalState<NgtState>>) {\n\tlet running = false;\n\tlet repeat: number;\n\tlet frame: number;\n\tlet beforeRenderInProgress = false;\n\n\tfunction loop(timestamp: number): void {\n\t\tframe = requestAnimationFrame(loop);\n\t\trunning = true;\n\t\trepeat = 0;\n\n\t\t// Run effects\n\t\tflushGlobalEffects('before', timestamp);\n\n\t\t// Render all roots\n\t\tbeforeRenderInProgress = true;\n\t\tfor (const root of roots.values()) {\n\t\t\tconst state = root.snapshot;\n\t\t\t// If the frameloop is invalidated, do not run another frame\n\t\t\tif (\n\t\t\t\tstate.internal.active &&\n\t\t\t\t(state.frameloop === 'always' || state.internal.frames > 0) &&\n\t\t\t\t!state.gl.xr?.isPresenting\n\t\t\t) {\n\t\t\t\trepeat += update(timestamp, root);\n\t\t\t}\n\t\t}\n\t\tbeforeRenderInProgress = false;\n\n\t\t// Run after-effects\n\t\tflushGlobalEffects('after', timestamp);\n\n\t\t// Stop the loop if nothing invalidates it\n\t\tif (repeat === 0) {\n\t\t\t// Tail call effects, they are called when rendering stops\n\t\t\tflushGlobalEffects('tail', timestamp);\n\n\t\t\t// Flag end of operation\n\t\t\trunning = false;\n\t\t\treturn cancelAnimationFrame(frame);\n\t\t}\n\t}\n\n\tfunction invalidate(store?: SignalState<NgtState>, frames = 1): void {\n\t\tconst state = store?.snapshot;\n\t\tif (!state) return roots.forEach((root) => invalidate(root, frames));\n\t\tif (state.gl.xr?.isPresenting || !state.internal.active || state.frameloop === 'never') return;\n\t\tif (frames > 1) {\n\t\t\t// legacy support for people using frames parameters\n\t\t\t// Increase frames, do not go higher than 60\n\t\t\tstate.internal.frames = Math.min(60, state.internal.frames + frames);\n\t\t} else {\n\t\t\tif (beforeRenderInProgress) {\n\t\t\t\t//called from within a beforeRender, it means the user wants an additional frame\n\t\t\t\tstate.internal.frames = 2;\n\t\t\t} else {\n\t\t\t\t//the user need a new frame, no need to increment further than 1\n\t\t\t\tstate.internal.frames = 1;\n\t\t\t}\n\t\t}\n\n\t\t// If the render-loop isn't active, start it\n\t\tif (!running) {\n\t\t\trunning = true;\n\t\t\trequestAnimationFrame(loop);\n\t\t}\n\t}\n\n\tfunction advance(timestamp: number, runGlobalEffects = true, store?: SignalState<NgtState>, frame?: XRFrame): void {\n\t\tif (runGlobalEffects) flushGlobalEffects('before', timestamp);\n\t\tif (!store) for (const root of roots.values()) update(timestamp, root);\n\t\telse update(timestamp, store, frame);\n\t\tif (runGlobalEffects) flushGlobalEffects('after', timestamp);\n\t}\n\n\treturn { loop, invalidate, advance };\n}\n\n/**\n * Injection token for the Angular Three render loop.\n *\n * Provides access to the render loop controls including invalidate and advance functions.\n */\nexport const NGT_LOOP = new InjectionToken<ReturnType<typeof createLoop>>('NGT_LOOP', {\n\tfactory: () => createLoop(roots),\n});\n\n/**\n * Injects the Angular Three render loop controller.\n *\n * The loop controller provides methods to control the render loop:\n * - `invalidate`: Marks the scene as needing a re-render\n * - `advance`: Manually advances the render loop by one frame\n * - `loop`: The main animation loop function\n *\n * @returns The render loop controller\n *\n * @example\n * ```typescript\n * const loop = injectLoop();\n * // Trigger a re-render\n * loop.invalidate();\n * // Manually advance one frame\n * loop.advance(performance.now());\n * ```\n */\nexport function injectLoop() {\n\treturn inject(NGT_LOOP);\n}\n","/**\n * @fileoverview Signal-based state management ported from ngrx/signals.\n *\n * This module provides a reactive state management solution using Angular signals.\n * It supports deep signal access for nested state properties and efficient state updates.\n *\n * Ported from ngrx/signals. Last synced: 08/16/2025\n */\nimport { computed, isSignal, type Signal, signal, untracked, type WritableSignal } from '@angular/core';\n\ntype NonRecord =\n\t| Iterable<any>\n\t| WeakSet<any>\n\t| WeakMap<any, any>\n\t| Promise<any>\n\t| Date\n\t| Error\n\t| RegExp\n\t| ArrayBuffer\n\t| DataView\n\t| Function;\n\ntype Prettify<T> = { [K in keyof T]: T[K] } & {};\ntype IsRecord<T> = T extends object ? (T extends NonRecord ? false : true) : false;\ntype IsUnknownRecord<T> = string extends keyof T ? true : number extends keyof T ? true : false;\ntype IsKnownRecord<T> = IsRecord<T> extends true ? (IsUnknownRecord<T> extends true ? false : true) : false;\n\nconst STATE_SOURCE = Symbol('STATE_SOURCE');\n\n/**\n * Type representing a writable state source with signals for each property.\n */\nexport type WritableStateSource<State extends object> = {\n\t[STATE_SOURCE]: { [K in keyof State]: WritableSignal<State[K]> };\n};\n\n/**\n * Type representing a readonly state source with signals for each property.\n */\nexport type StateSource<State extends object> = {\n\t[STATE_SOURCE]: { [K in keyof State]: Signal<State[K]> };\n};\n\n/**\n * Function type for partial state updates.\n */\nexport type PartialStateUpdater<State extends object> = (state: State) => Partial<State>;\n\nfunction getState<State extends object>(stateSource: StateSource<State>): State {\n\tconst signals: Record<string | symbol, Signal<unknown>> = stateSource[STATE_SOURCE];\n\treturn Reflect.ownKeys(stateSource[STATE_SOURCE]).reduce((state, key) => {\n\t\tconst value = signals[key]();\n\t\treturn Object.assign(state, { [key]: value });\n\t}, {} as State);\n}\n\nfunction patchState<State extends object>(\n\tstateSource: WritableStateSource<State>,\n\t...updaters: Array<Partial<NoInfer<State>> | PartialStateUpdater<NoInfer<State>>>\n): void {\n\tconst currentState = untracked(() => getState(stateSource));\n\tconst newState = updaters.reduce(\n\t\t(nextState: State, updater) => ({\n\t\t\t...nextState,\n\t\t\t...(typeof updater === 'function' ? updater(nextState) : updater),\n\t\t}),\n\t\tcurrentState,\n\t);\n\n\tconst signals = stateSource[STATE_SOURCE];\n\n\tfor (const key of Reflect.ownKeys(newState)) {\n\t\tconst signalKey = key as keyof State;\n\n\t\tif (currentState[signalKey] !== newState[signalKey]) {\n\t\t\tsignals[signalKey].set(newState[signalKey]);\n\t\t}\n\t}\n}\n\nconst DEEP_SIGNAL = Symbol('DEEP_SIGNAL');\n\n/**\n * A signal that provides deep access to nested properties as signals.\n *\n * Allows accessing nested properties directly on the signal, e.g., `state.user.name()`\n * instead of `state().user.name`.\n */\nexport type DeepSignal<T> = Signal<T> &\n\t(IsKnownRecord<T> extends true\n\t\t? Readonly<{\n\t\t\t\t[K in keyof T]: IsKnownRecord<T[K]> extends true ? DeepSignal<T[K]> : Signal<T[K]>;\n\t\t\t}>\n\t\t: unknown);\n\n/**\n * Converts a regular signal to a deep signal that allows nested property access.\n *\n * @typeParam T - The type of the signal's value\n * @param signal - The signal to convert\n * @returns A DeepSignal with nested property access\n */\nexport function toDeepSignal<T>(signal: Signal<T>): DeepSignal<T> {\n\treturn new Proxy(signal, {\n\t\thas(target: any, prop) {\n\t\t\treturn !!this.get!(target, prop, undefined);\n\t\t},\n\t\tget(target: any, prop) {\n\t\t\tconst value = untracked(target);\n\t\t\tif (!isRecord(value) || !(prop in value)) {\n\t\t\t\tif (isSignal(target[prop]) && (target[prop] as any)[DEEP_SIGNAL]) {\n\t\t\t\t\tdelete target[prop];\n\t\t\t\t}\n\n\t\t\t\treturn target[prop];\n\t\t\t}\n\n\t\t\tif (!isSignal(target[prop])) {\n\t\t\t\tObject.defineProperty(target, prop, {\n\t\t\t\t\tvalue: computed(() => target()[prop]),\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t});\n\t\t\t\ttarget[prop][DEEP_SIGNAL] = true;\n\t\t\t}\n\n\t\t\treturn toDeepSignal(target[prop]);\n\t\t},\n\t});\n}\n\nconst nonRecords = [WeakSet, WeakMap, Promise, Date, Error, RegExp, ArrayBuffer, DataView, Function];\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\tif (value === null || typeof value !== 'object' || isIterable(value)) {\n\t\treturn false;\n\t}\n\n\tlet proto = Object.getPrototypeOf(value);\n\tif (proto === Object.prototype) {\n\t\treturn true;\n\t}\n\n\twhile (proto && proto !== Object.prototype) {\n\t\tif (nonRecords.includes(proto.constructor)) {\n\t\t\treturn false;\n\t\t}\n\t\tproto = Object.getPrototypeOf(proto);\n\t}\n\n\treturn proto === Object.prototype;\n}\n\nfunction isIterable(value: any): value is Iterable<any> {\n\treturn typeof value?.[Symbol.iterator] === 'function';\n}\n\n/**\n * A reactive state container built on Angular signals.\n *\n * Provides deep signal access to nested properties, an update method for\n * modifying state, and a snapshot getter for non-reactive access.\n */\nexport type SignalState<State extends object> = DeepSignal<State> &\n\tWritableStateSource<State> & {\n\t\t/** Updates the state with partial updates or updater functions */\n\t\tupdate: (...updaters: Array<Partial<Prettify<State>> | PartialStateUpdater<Prettify<State>>>) => void;\n\t\t/** Gets the current state value without triggering reactivity */\n\t\tget snapshot(): State;\n\t};\n\n/**\n * Creates a reactive state container from an initial state object.\n *\n * The returned SignalState provides:\n * - Deep signal access to nested properties (e.g., `state.camera()`)\n * - An `update` method for modifying state\n * - A `snapshot` getter for non-reactive access\n *\n * @typeParam State - The shape of the state object\n * @param initialState - The initial state values\n * @returns A SignalState instance\n *\n * @example\n * ```typescript\n * const store = signalState({\n * camera: null,\n * scene: null,\n * size: { width: 0, height: 0 }\n * });\n *\n * // Access reactively\n * const width = store.size.width();\n *\n * // Update state\n * store.update({ camera: new THREE.PerspectiveCamera() });\n *\n * // Access snapshot\n * const { scene } = store.snapshot;\n * ```\n */\nexport function signalState<State extends object>(initialState: State): SignalState<State> {\n\tconst stateKeys = Reflect.ownKeys(initialState);\n\n\tconst stateSource = stateKeys.reduce(\n\t\t(signalsDict, key) =>\n\t\t\tObject.assign(signalsDict, {\n\t\t\t\t[key]: signal((initialState as Record<string | symbol, unknown>)[key]),\n\t\t\t}),\n\t\t{} as Record<string | symbol, any>,\n\t);\n\n\tconst signalState = computed(() => stateKeys.reduce((state, key) => ({ ...state, [key]: stateSource[key]() }), {}));\n\n\tObject.defineProperties(signalState, {\n\t\t[STATE_SOURCE]: { value: stateSource },\n\t\tupdate: { value: patchState.bind(null, signalState as SignalState<State>) },\n\t\tsnapshot: { get: () => untracked(signalState) },\n\t});\n\n\tfor (const key of stateKeys) {\n\t\tObject.defineProperty(signalState, key, {\n\t\t\tvalue: toDeepSignal(stateSource[key]),\n\t\t});\n\t}\n\n\treturn signalState as SignalState<State>;\n}\n","import type * as THREE from 'three';\nimport type { NgtCamera, NgtSize } from '../types';\nimport { is } from './is';\n\n/**\n * Sets the needsUpdate flag on an object if it has one.\n *\n * Also sets uniformsNeedUpdate for shader materials.\n *\n * @param value - The object to update\n */\nexport function checkNeedsUpdate(value: unknown) {\n\tif (value !== null && is.obj(value) && 'needsUpdate' in value) {\n\t\tvalue['needsUpdate'] = true;\n\t\tif ('uniformsNeedUpdate' in value) value['uniformsNeedUpdate'] = true;\n\t}\n}\n\n/**\n * Performs necessary updates on a Three.js object after property changes.\n *\n * For cameras, updates projection matrix and world matrix.\n * For other objects, sets the needsUpdate flag.\n *\n * @param value - The object to update\n */\nexport function checkUpdate(value: unknown) {\n\t// TODO (chau): this is messing with PivotControls. Re-evaluate later\n\t// if (is.object3D(value)) value.updateMatrix();\n\n\tif (is.three<THREE.Camera>(value, 'isCamera')) {\n\t\tif (\n\t\t\tis.three<THREE.PerspectiveCamera>(value, 'isPerspectiveCamera') ||\n\t\t\tis.three<THREE.OrthographicCamera>(value, 'isOrthographicCamera')\n\t\t)\n\t\t\tvalue.updateProjectionMatrix();\n\t\tvalue.updateMatrixWorld();\n\t}\n\n\t// NOTE: skip checkNeedsUpdate for CubeTexture\n\tif (is.three<THREE.CubeTexture>(value, 'isCubeTexture')) return;\n\n\tcheckNeedsUpdate(value);\n}\n\n/**\n * Updates a camera's projection based on the viewport size.\n *\n * For orthographic cameras, updates the frustum bounds.\n * For perspective cameras, updates the aspect ratio.\n * Skips update if the camera is marked as manual.\n *\n * @param camera - The camera to update\n * @param size - The current viewport size\n */\nexport function updateCamera(camera: NgtCamera, size: NgtSize) {\n\tif (!camera.manual) {\n\t\tif (is.three<THREE.OrthographicCamera>(camera, 'isOrthographicCamera')) {\n\t\t\tcamera.left = size.width / -2;\n\t\t\tcamera.right = size.width / 2;\n\t\t\tcamera.top = size.height / 2;\n\t\t\tcamera.bottom = size.height / -2;\n\t\t} else {\n\t\t\tcamera.aspect = size.width / size.height;\n\t\t}\n\n\t\tcamera.updateProjectionMatrix();\n\t\tcamera.updateMatrixWorld();\n\t}\n}\n","import { computed } from '@angular/core';\nimport type * as THREE from 'three';\nimport type {\n\tNgtAnyRecord,\n\tNgtEventHandlers,\n\tNgtInstanceHierarchyState,\n\tNgtInstanceNode,\n\tNgtInstanceState,\n\tNgtState,\n} from './types';\nimport { SignalState, signalState } from './utils/signal-state';\nimport { checkUpdate } from './utils/update';\n\n/**\n * @deprecated Use `getInstanceState` instead. Will be removed in 5.0.0\n * @param obj - The object to get local state from\n * @returns The instance state if the object has been prepared, undefined otherwise\n */\nexport function getLocalState<TInstance extends object>(obj: TInstance | undefined): NgtInstanceState | undefined {\n\treturn getInstanceState(obj);\n}\n\n/**\n * Retrieves the Angular Three instance state from a Three.js object.\n *\n * Every Three.js object managed by Angular Three has an associated instance state\n * that contains metadata such as the store reference, parent/child relationships,\n * event handlers, and attach information.\n *\n * @typeParam TInstance - The type of the Three.js object\n * @param obj - The Three.js object to get instance state from\n * @returns The instance state if the object has been prepared, undefined otherwise\n *\n * @example\n * ```typescript\n * const mesh = new THREE.Mesh();\n * prepare(mesh, 'ngt-mesh');\n * const state = getInstanceState(mesh);\n * console.log(state?.type); // 'ngt-mesh'\n * ```\n */\nexport function getInstanceState<TInstance extends NgtAnyRecord>(\n\tobj: TInstance | undefined,\n): NgtInstanceState<TInstance> | undefined {\n\tif (!obj) return undefined;\n\treturn (obj as NgtInstanceNode<TInstance>).__ngt__ || undefined;\n}\n\n/**\n * Invalidates an instance, triggering a re-render of the scene.\n *\n * This function marks the instance as needing an update and triggers the render loop\n * to re-render the scene. It traverses up to the root store to ensure proper invalidation\n * even for objects in portals.\n *\n * @typeParam TInstance - The type of the Three.js object\n * @param instance - The instance node to invalidate\n *\n * @example\n * ```typescript\n * // After modifying a mesh's properties\n * mesh.position.x = 10;\n * invalidateInstance(mesh);\n * ```\n */\nexport function invalidateInstance<TInstance extends NgtAnyRecord>(instance: NgtInstanceNode<TInstance>) {\n\tlet store = getInstanceState(instance)?.store;\n\n\tif (store) {\n\t\twhile (store.snapshot.previousRoot) {\n\t\t\tstore = store.snapshot.previousRoot;\n\t\t}\n\n\t\tif (store.snapshot.internal.frames === 0) {\n\t\t\tstore.snapshot.invalidate();\n\t\t}\n\t}\n\n\tcheckUpdate(instance);\n}\n\n/**\n * Prepares a Three.js object for use with Angular Three.\n *\n * This function attaches the Angular Three instance state to a Three.js object,\n * enabling it to be managed by the Angular Three renderer. The instance state\n * includes parent/child relationships, event handlers, and store references.\n *\n * @typeParam TInstance - The type of the Three.js object\n * @param object - The Three.js object to prepare\n * @param type - The element type name (e.g., 'ngt-mesh', 'ngt-primitive')\n * @param instanceState - Optional partial instance state to merge with defaults\n * @returns The prepared instance node\n *\n * @example\n * ```typescript\n * // Prepare a mesh for Angular Three\n * const mesh = new THREE.Mesh(geometry, material);\n * const prepared = prepare(mesh, 'ngt-mesh', { store });\n * ```\n */\nexport function prepare<TInstance extends NgtAnyRecord = NgtAnyRecord>(\n\tobject: TInstance,\n\ttype: string,\n\tinstanceState?: Partial<NgtInstanceState>,\n) {\n\tconst instance = object as NgtInstanceNode<TInstance>;\n\n\tif (instanceState?.type === 'ngt-primitive' || !instance.__ngt__) {\n\t\tconst {\n\t\t\thierarchyStore = signalState<NgtInstanceHierarchyState>({\n\t\t\t\tparent: null,\n\t\t\t\tobjects: [],\n\t\t\t\tnonObjects: [],\n\t\t\t\tgeometryStamp: Date.now(),\n\t\t\t}),\n\t\t\tstore = null,\n\t\t\t...rest\n\t\t} = instanceState || {};\n\n\t\tconst nonObjects = hierarchyStore.nonObjects;\n\t\tconst geometryStamp = hierarchyStore.geometryStamp;\n\n\t\tconst nonObjectsChanged = computed(() => {\n\t\t\tconst [_nonObjects] = [nonObjects(), geometryStamp()];\n\t\t\treturn _nonObjects;\n\t\t});\n\n\t\tinstance.__ngt_id__ = crypto.randomUUID();\n\t\tinstance.__ngt__ = {\n\t\t\tpreviousAttach: null,\n\t\t\ttype,\n\t\t\teventCount: 0,\n\t\t\thandlers: {},\n\t\t\thierarchyStore,\n\t\t\tobject: instance as any,\n\t\t\tparent: hierarchyStore.parent,\n\t\t\tobjects: hierarchyStore.objects,\n\t\t\tnonObjects: nonObjectsChanged,\n\t\t\tadd(object, type) {\n\t\t\t\tconst current = instance.__ngt__.hierarchyStore.snapshot[type];\n\t\t\t\tconst foundIndex = current.findIndex(\n\t\t\t\t\t(node) =>\n\t\t\t\t\t\tobject === node || (!!object['uuid'] && !!node['uuid'] && object['uuid'] === node['uuid']),\n\t\t\t\t);\n\n\t\t\t\tif (foundIndex > -1) {\n\t\t\t\t\tcurrent.splice(foundIndex, 1, object);\n\t\t\t\t\tinstance.__ngt__.hierarchyStore.update({ [type]: current });\n\t\t\t\t} else {\n\t\t\t\t\tinstance.__ngt__.hierarchyStore.update((prev) => ({ [type]: [...prev[type], object] }));\n\t\t\t\t}\n\n\t\t\t\tnotifyAncestors(instance.__ngt__.hierarchyStore.snapshot.parent, type);\n\t\t\t},\n\t\t\tremove(object, type) {\n\t\t\t\tinstance.__ngt__.hierarchyStore.update((prev) => ({\n\t\t\t\t\t[type]: prev[type].filter((node) => node !== object),\n\t\t\t\t}));\n\t\t\t\tnotifyAncestors(instance.__ngt__.hierarchyStore.snapshot.parent, type);\n\t\t\t},\n\t\t\tsetParent(parent) {\n\t\t\t\tinstance.__ngt__.hierarchyStore.update({ parent });\n\t\t\t},\n\t\t\tupdateGeometryStamp() {\n\t\t\t\tinstance.__ngt__.hierarchyStore.update({ geometryStamp: Date.now() });\n\t\t\t},\n\t\t\tstore,\n\t\t\t...rest,\n\t\t};\n\t}\n\n\tObject.defineProperties(instance.__ngt__, {\n\t\tsetPointerEvent: {\n\t\t\tvalue: <TEvent extends keyof NgtEventHandlers>(\n\t\t\t\teventName: TEvent,\n\t\t\t\tcallback: NonNullable<NgtEventHandlers[TEvent]>,\n\t\t\t) => {\n\t\t\t\tconst iS = getInstanceState(instance) as NgtInstanceState;\n\t\t\t\tif (!iS.handlers) iS.handlers = {};\n\n\t\t\t\t// try to get the previous handler. compound might have one, the THREE object might also have one with the same name\n\t\t\t\tconst previousHandler = iS.handlers[eventName];\n\t\t\t\t// readjust the callback\n\t\t\t\tconst updatedCallback: typeof callback = (event: any) => {\n\t\t\t\t\tif (previousHandler) previousHandler(event);\n\t\t\t\t\tcallback(event);\n\t\t\t\t};\n\n\t\t\t\tObject.assign(iS.handlers, { [eventName]: updatedCallback });\n\n\t\t\t\t// increment the count everytime\n\t\t\t\tiS.eventCount += 1;\n\n\t\t\t\t// clean up the event listener by removing the target from the interaction array\n\t\t\t\treturn () => {\n\t\t\t\t\tconst iS = getInstanceState(instance) as NgtInstanceState;\n\t\t\t\t\tif (iS) {\n\t\t\t\t\t\tiS.handlers && delete iS.handlers[eventName];\n\t\t\t\t\t\tiS.eventCount -= 1;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t\tconfigurable: true,\n\t\t},\n\t\taddInteraction: {\n\t\t\tvalue: (store?: SignalState<NgtState>) => {\n\t\t\t\tif (!store) return;\n\n\t\t\t\tconst iS = getInstanceState(instance) as NgtInstanceState;\n\n\t\t\t\tif (iS.eventCount < 1 || !('raycast' in instance) || !instance['raycast']) return;\n\n\t\t\t\tlet root = store;\n\t\t\t\twhile (root.snapshot.previousRoot) {\n\t\t\t\t\troot = root.snapshot.previousRoot;\n\t\t\t\t}\n\n\t\t\t\tif (root.snapshot.internal) {\n\t\t\t\t\tconst interactions = root.snapshot.internal.interaction;\n\t\t\t\t\tconst index = interactions.findIndex(\n\t\t\t\t\t\t(obj) => obj.uuid === (instance as unknown as THREE.Object3D).uuid,\n\t\t\t\t\t);\n\t\t\t\t\t// if already exists, do not add to interactions\n\t\t\t\t\tif (index < 0) {\n\t\t\t\t\t\troot.snapshot.internal.interaction.push(instance as unknown as THREE.Object3D);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tconfigurable: true,\n\t\t},\n\t\tremoveInteraction: {\n\t\t\tvalue: (store?: SignalState<NgtState>) => {\n\t\t\t\tif (!store) return;\n\n\t\t\t\tlet root = store;\n\t\t\t\twhile (root.snapshot.previousRoot) {\n\t\t\t\t\troot = root.snapshot.previousRoot;\n\t\t\t\t}\n\n\t\t\t\tif (root.snapshot.internal) {\n\t\t\t\t\tconst interactions = root.snapshot.internal.interaction;\n\t\t\t\t\tconst index = interactions.findIndex(\n\t\t\t\t\t\t(obj) => obj.uuid === (instance as unknown as THREE.Object3D).uuid,\n\t\t\t\t\t);\n\t\t\t\t\tif (index >= 0) interactions.splice(index, 1);\n\t\t\t\t}\n\t\t\t},\n\t\t\tconfigurable: true,\n\t\t},\n\t});\n\n\treturn instance;\n}\n\ninterface NotificationCacheState {\n\tskipCount: number;\n\tlastType: 'objects' | 'nonObjects';\n}\n\nconst notificationCache = new Map<string, NotificationCacheState>();\n\n/**\n * Notify ancestors about changes to a THREE.js objects' children\n *\n * For example: `NgtsCenter` might have a child that asynchronously loads a 3D model\n * in which case the model matrices will be settled later. `NgtsCenter` needs to know about this\n * matrices change to re-center everything inside of it.\n *\n * The implementation here uses a naive approach to reduce the number of notifications; we cache\n * the notifications by the instance ID and the type of the notification.\n *\n * 1. If there's no cache or\n * 2. If the type is different for the same instance or\n * 3. We've skipped the notifications for this instance more than a certain amount\n *\n * then we'll proceed with notification\n */\nfunction notifyAncestors(instance: NgtInstanceNode | null, type: 'objects' | 'nonObjects') {\n\tif (!instance) return;\n\n\tconst localState = getInstanceState(instance);\n\tif (!localState) return;\n\n\tconst id = instance.__ngt_id__ || instance['uuid'];\n\tif (!id) return;\n\n\tconst maxNotificationSkipCount = localState.store?.snapshot.maxNotificationSkipCount || 5;\n\tconst cached = notificationCache.get(id);\n\n\tif (!cached || cached.lastType !== type || cached.skipCount > maxNotificationSkipCount) {\n\t\tnotificationCache.set(id, { skipCount: 0, lastType: type });\n\n\t\tif (notificationCache.size === 1) {\n\t\t\tqueueMicrotask(() => notificationCache.clear());\n\t\t}\n\n\t\tconst { parent } = localState.hierarchyStore.snapshot;\n\t\tlocalState.hierarchyStore.update({ [type]: (localState.hierarchyStore.snapshot[type] || []).slice() });\n\t\tnotifyAncestors(parent, type);\n\t\treturn;\n\t}\n\n\tnotificationCache.set(id, { ...cached, skipCount: cached.skipCount + 1 });\n}\n","import * as THREE from 'three';\nimport { getInstanceState, invalidateInstance } from '../instance';\nimport type { NgtAnyRecord, NgtInstanceNode, NgtInstanceState, NgtState } from '../types';\nimport { is } from './is';\nimport { checkUpdate } from './update';\n\n/**\n * Prepares a set of changes to be applied to the instance by comparing props.\n *\n * @param instance - The Three.js instance to compare against\n * @param props - The props to diff\n * @returns An array of [key, value] tuples representing changed properties\n */\nfunction diffProps(instance: NgtAnyRecord, props: NgtAnyRecord) {\n\tconst changes: [key: string, value: unknown][] = [];\n\n\tfor (const propKey in props) {\n\t\tconst propValue = props[propKey];\n\t\tlet key = propKey;\n\t\tif (is.colorSpaceExist(instance)) {\n\t\t\tif (propKey === 'encoding') {\n\t\t\t\tkey = 'colorSpace';\n\t\t\t} else if (propKey === 'outputEncoding') {\n\t\t\t\tkey = 'outputColorSpace';\n\t\t\t}\n\t\t}\n\t\tif (is.equ(propValue, instance[key])) continue;\n\t\tchanges.push([propKey, propValue]);\n\t}\n\n\treturn changes;\n}\n\n/**\n * Internal symbol used to temporarily store the parent's store on an instance.\n * This is a workaround to give the instance access to the store from its parent\n * during property application. The property is cleared after applyProps completes.\n * @internal\n */\nexport const NGT_APPLY_PROPS = '__ngt_apply_props__';\n\n// https://github.com/mrdoob/three.js/pull/27042\n// https://github.com/mrdoob/three.js/pull/22748\nconst colorMaps = ['map', 'emissiveMap', 'sheenColorMap', 'specularColorMap', 'envMap'];\n\ntype ClassConstructor = { new (): void };\n\n/**\n * Resolves a property key that may contain dot notation (pierced props).\n *\n * This function handles nested property access like 'position.x' by traversing\n * the object hierarchy and returning the final target object and key.\n *\n * @param instance - The root instance to start from\n * @param key - The property key, potentially with dot notation\n * @returns An object containing the root object, target key, and target property value\n *\n * @example\n * ```typescript\n * const mesh = new THREE.Mesh();\n * const result = resolveInstanceKey(mesh, 'position.x');\n * // result.root = mesh.position\n * // result.targetKey = 'x'\n * // result.targetProp = mesh.position.x\n * ```\n */\nexport function resolveInstanceKey(instance: any, key: string): { root: any; targetKey: string; targetProp: any } {\n\tlet targetProp = instance[key];\n\tif (!key.includes('.')) return { root: instance, targetKey: key, targetProp };\n\n\t// Resolve pierced target\n\ttargetProp = instance;\n\tfor (const part of key.split('.')) {\n\t\tkey = part;\n\t\tinstance = targetProp;\n\t\ttargetProp = targetProp[key];\n\t}\n\t// const chain = key.split('.');\n\t// targetProp = chain.reduce((acc, part) => acc[part], instance);\n\t// const targetKey = chain.pop()!;\n\t//\n\t// // Switch root if atomic\n\t// if (!targetProp?.set) instance = chain.reduce((acc, part) => acc[part], instance);\n\n\treturn { root: instance, targetKey: key, targetProp };\n}\n\n/**\n * Applies a set of properties to a Three.js instance.\n *\n * This is the core function for updating Three.js objects with new property values.\n * It handles various property types including:\n * - Math types (Vector3, Color, Euler, etc.) with automatic conversion\n * - Pierced props (dot notation like 'position.x')\n * - Arrays (converted to set/fromArray calls)\n * - Layers (mask copying)\n * - Textures (automatic color space management)\n *\n * After applying props, the function triggers necessary updates like\n * camera projection matrix updates and texture needsUpdate flags.\n *\n * @typeParam T - The type of the Three.js instance\n * @param instance - The Three.js instance to update\n * @param props - An object containing the properties to apply\n * @returns The updated instance\n *\n * @example\n * ```typescript\n * const mesh = new THREE.Mesh();\n * applyProps(mesh, {\n * position: [1, 2, 3],\n * 'rotation.x': Math.PI / 2,\n * visible: true\n * });\n * ```\n */\nexport function applyProps<T extends NgtAnyRecord>(instance: NgtInstanceState<T>['object'], props: NgtAnyRecord) {\n\t// if props is empty\n\tif (!Object.keys(props).length) return instance;\n\n\tconst localState = getInstanceState(instance);\n\tconst rootState =\n\t\tlocalState?.store?.snapshot ?? (instance as NgtAnyRecord)[NGT_APPLY_PROPS]?.snapshot ?? ({} as NgtState);\n\tconst changes = diffProps(instance, props);\n\n\tfor (let i = 0; i < changes.length; i++) {\n\t\tlet [key, value] = changes[i];\n\n\t\t// Ignore setting undefined props\n\t\t// https://github.com/pmndrs/react-three-fiber/issues/274\n\t\tif (value === undefined) continue;\n\n\t\t// Alias (output)encoding => (output)colorSpace (since r152)\n\t\t// https://github.com/pmndrs/react-three-fiber/pull/2829\n\t\t// if (is.colorSpaceExist(instance)) {\n\t\t// \tconst sRGBEncoding = 3001;\n\t\t// \tconst SRGBColorSpace = 'srgb';\n\t\t// \tconst LinearSRGBColorSpace = 'srgb-linear';\n\t\t//\n\t\t// \tif (key === 'encoding') {\n\t\t// \t\tkey = 'colorSpace';\n\t\t// \t\tvalue = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n\t\t// \t} else if (key === 'outputEncoding') {\n\t\t// \t\tkey = 'outputColorSpace';\n\t\t// \t\tvalue = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n\t\t// \t}\n\t\t// }\n\n\t\tconst { root, targetKey, targetProp } = resolveInstanceKey(instance, key);\n\n\t\t// we have switched due to pierced props\n\t\tif (root !== instance) {\n\t\t\treturn applyProps(root, { [targetKey]: value });\n\t\t}\n\n\t\t// Layers have no copy function, we must therefore copy the mask property\n\t\tif (targetProp instanceof THREE.Layers && value instanceof THREE.Layers) {\n\t\t\ttargetProp.mask = value.mask;\n\t\t} else if (is.three<THREE.Color>(targetProp, 'isColor') && is.colorRepresentation(value)) {\n\t\t\ttargetProp.set(value);\n\t\t}\n\t\t// Copy if properties match signatures\n\t\telse if (\n\t\t\ttargetProp &&\n\t\t\ttypeof targetProp.set === 'function' &&\n\t\t\ttypeof targetProp.copy === 'function' &&\n\t\t\t(value as ClassConstructor | undefined)?.constructor &&\n\t\t\t(targetProp as ClassConstructor).constructor === (value as ClassConstructor).constructor\n\t\t) {\n\t\t\t// If both are geometries, we should assign the value directly instead of copying\n\t\t\tif (\n\t\t\t\tis.three<THREE.BufferGeometry>(targetProp, 'isBufferGeometry') &&\n\t\t\t\tis.three<THREE.BufferGeometry>(value, 'isBufferGeometry')\n\t\t\t) {\n\t\t\t\tObject.assign(root, { [targetKey]: value });\n\t\t\t} else {\n\t\t\t\ttargetProp.copy(value);\n\t\t\t}\n\t\t}\n\t\t// Set array types\n\t\telse if (targetProp && typeof targetProp.set === 'function' && Array.isArray(value)) {\n\t\t\tif (typeof targetProp.fromArray === 'function') targetProp.fromArray(value);\n\t\t\telse targetProp.set(...value);\n\t\t}\n\t\t// Set literal types\n\t\telse if (targetProp && typeof targetProp.set === 'function' && typeof value !== 'object') {\n\t\t\tconst isColor = is.three<THREE.Color>(targetProp, 'isColor');\n\t\t\t// Allow setting array scalars\n\t\t\tif (!isColor && typeof targetProp.setScalar === 'function' && typeof value === 'number')\n\t\t\t\ttargetProp.setScalar(value);\n\t\t\t// Otherwise just set single value\n\t\t\telse targetProp.set(value);\n\t\t}\n\t\t// Else, just overwrite the value\n\t\telse {\n\t\t\tObject.assign(root, { [targetKey]: value });\n\n\t\t\t// Auto-convert sRGB texture parameters for built-in materials\n\t\t\t// https://github.com/pmndrs/react-three-fiber/issues/344\n\t\t\t// https://github.com/mrdoob/three.js/pull/25857\n\t\t\tif (\n\t\t\t\trootState &&\n\t\t\t\t!rootState.linear &&\n\t\t\t\tcolorMaps.includes(targetKey) &&\n\t\t\t\t(root[targetKey] as THREE.Texture | undefined)?.isTexture &&\n\t\t\t\t// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129\n\t\t\t\troot[targetKey].format === THREE.RGBAFormat &&\n\t\t\t\troot[targetKey].type === THREE.UnsignedByteType\n\t\t\t) {\n\t\t\t\t// NOTE: this cannot be set from the renderer (e.g. sRGB source textures rendered to P3)\n\t\t\t\troot[targetKey].colorSpace = THREE.SRGBColorSpace;\n\t\t\t}\n\t\t}\n\n\t\tcheckUpdate(root[targetKey]);\n\t\tcheckUpdate(targetProp);\n\t\tinvalidateInstance(instance as NgtInstanceNode<T>);\n\t}\n\n\tconst instanceHandlersCount = localState?.eventCount;\n\tconst parent = localState?.hierarchyStore?.snapshot.parent;\n\n\tif (parent && rootState.internal && instance['raycast'] && instanceHandlersCount !== localState?.eventCount) {\n\t\t// Pre-emptively remove the instance from the interaction manager\n\t\tconst index = rootState.internal.interaction.indexOf(instance);\n\t\tif (index > -1) rootState.internal.interaction.splice(index, 1);\n\t\t// Add the instance to the interaction manager only when it has handlers\n\t\tif (localState?.eventCount) rootState.internal.interaction.push(instance);\n\t}\n\n\tif (parent && localState?.onUpdate && changes.length) {\n\t\tlocalState.onUpdate(instance as NgtInstanceNode<T>);\n\t}\n\n\t// clearing the intermediate store from the instance\n\tif (instance[NGT_APPLY_PROPS]) delete instance[NGT_APPLY_PROPS];\n\n\treturn instance;\n}\n","import { inject, InjectionToken } from '@angular/core';\nimport type { NgtConstructorRepresentation } from '../types';\n\n/**\n * @fileoverview Catalogue for registering Three.js constructors.\n *\n * The catalogue maps element names to their corresponding Three.js constructors,\n * allowing the custom renderer to instantiate objects when elements are created.\n */\n\nconst catalogue: Record<string, NgtConstructorRepresentation> = {};\n\n/**\n * Registers Three.js constructors for use in templates.\n *\n * Call this function to make Three.js classes available for use as custom elements.\n * The function returns a cleanup function that removes the registered entries.\n *\n * @param objects - An object mapping names to Three.js constructors\n * @returns A cleanup function to remove the registered entries\n *\n * @example\n * ```typescript\n * import { extend } from 'angular-three';\n * import { Mesh, BoxGeometry, MeshStandardMaterial } from 'three';\n *\n * // Register at component level\n * extend({ Mesh, BoxGeometry, MeshStandardMaterial });\n *\n * // Now you can use in templates:\n * // <ngt-mesh>\n * // <ngt-box-geometry />\n * // <ngt-mesh-standard-material />\n * // </ngt-mesh>\n * ```\n */\nexport function extend(objects: object) {\n\tconst keys = Object.keys(objects);\n\tObject.assign(catalogue, objects);\n\treturn () => {\n\t\tremove(...keys);\n\t};\n}\n\n/**\n * Removes entries from the catalogue by key.\n *\n * @param keys - The keys to remove from the catalogue\n */\nexport function remove(...keys: string[]) {\n\tfor (const key of keys) {\n\t\tdelete catalogue[key];\n\t}\n}\n\n/**\n * Injection token for the Three.js constructor catalogue.\n */\nexport const NGT_CATALOGUE = new InjectionToken<typeof catalogue>('NGT_CATALOGUE', { factory: () => catalogue });\n\n/**\n * Injects the Three.js constructor catalogue.\n *\n * @returns The catalogue mapping names to constructors\n */\nexport function injectCatalogue() {\n\treturn inject(NGT_CATALOGUE);\n}\n","import { Injector } from '@angular/core';\nimport type { NgtAnyRecord } from '../types';\nimport { NGT_DOM_PARENT_FLAG, NGT_GET_NODE_ATTRIBUTE_FLAG, NGT_RENDERER_NODE_FLAG } from './constants';\nimport { NgtRendererClassId } from './utils';\n\ntype ThreeRendererState = [\n\ttype: 'three',\n\tdestroyed: boolean,\n\trawValue: any | undefined,\n\tportalContainer: never | undefined,\n\tinjector: never | undefined,\n\t// ThreeRendererState is the case where *parent is used\n\tparent: NgtRendererNode<'platform' | 'portal' | 'three'> | undefined,\n\tchildren: Array<NgtRendererNode<'platform' | 'portal' | 'comment'>>,\n];\n\ntype PortalRendererState = [\n\ttype: 'portal',\n\tdestroyed: boolean,\n\trawValue: never | undefined,\n\tportalContainer: NgtRendererNode<'three'> | undefined,\n\tinjector: Injector | undefined,\n\tparent: any | undefined,\n\tchildren: any[],\n];\n\ntype PlatformRendererState = [\n\ttype: 'platform',\n\tdestroyed: boolean,\n\trawValue: never | undefined,\n\tportalContainer: never | undefined,\n\tinjector: never | undefined,\n\tparent: NgtRendererNode<'three' | 'portal'> | undefined,\n\tchildren: Array<NgtRendererNode<'three' | 'portal' | 'comment'>>,\n];\n\ntype CommentRendererState = [\n\ttype: 'comment',\n\tdestroyed: boolean,\n\trawValue: never | undefined,\n\tportalContainer: never | undefined,\n\tinjector: Injector | undefined,\n\tparent: NgtRendererNode | undefined,\n\tchildren: NgtRendererNode[],\n];\n\ntype TextRendererState = [\n\ttype: 'text',\n\tdestroyed: boolean,\n\trawValue: never | undefined,\n\tportalContainer: never | undefined,\n\tinjector: never | undefined,\n\tparent: NgtRendererNode | undefined,\n\tchildren: NgtRendererNode[],\n];\n\ntype NgtRendererStateMap = {\n\tthree: ThreeRendererState;\n\tportal: PortalRendererState;\n\tplatform: PlatformRendererState;\n\tcomment: CommentRendererState;\n\ttext: TextRendererState;\n};\n\nexport type NgtRendererState =\n\t| ThreeRendererState\n\t| PortalRendererState\n\t| PlatformRendererState\n\t| CommentRendererState\n\t| TextRendererState;\n\nexport interface NgtRendererNode<TType extends keyof NgtRendererStateMap = keyof NgtRendererStateMap>\n\textends NgtAnyRecord {\n\t[NGT_RENDERER_NODE_FLAG]: NgtRendererStateMap[TType];\n\t[NGT_DOM_PARENT_FLAG]?: HTMLElement;\n}\n\nexport function isRendererNode(node: unknown): node is NgtRendererNode {\n\treturn !!node && typeof node === 'object' && NGT_RENDERER_NODE_FLAG in node;\n}\n\nexport function createRendererNode<TType extends keyof NgtRendererStateMap>(\n\ttype: TType,\n\tnode: NgtAnyRecord,\n\tdocument: Document,\n) {\n\tconst state = [type, false, undefined, undefined, undefined, undefined, []] as NgtRendererState;\n\tconst rendererNode = Object.assign(node, { [NGT_RENDERER_NODE_FLAG]: state });\n\n\t// NOTE: assign ownerDocument to node so we can use HostListener in Component\n\tif (!rendererNode['ownerDocument']) rendererNode['ownerDocument'] = document;\n\n\t// NOTE: Angular SSR calls `node.getAttribute()` to retrieve hydration info on a node\n\tif (!('getAttribute' in rendererNode) || typeof rendererNode['getAttribute'] !== 'function') {\n\t\tconst getNodeAttribute = (name: string) => rendererNode[name];\n\t\tgetNodeAttribute[NGT_GET_NODE_ATTRIBUTE_FLAG] = true;\n\t\tObject.defineProperty(rendererNode, 'getAttribute', { value: getNodeAttribute, configurable: true });\n\t}\n\n\treturn rendererNode as NgtRendererNode<TType>;\n}\n\nexport function setRendererParentNode(node: NgtRendererNode, parent: NgtRendererNode) {\n\tif (!node.__ngt_renderer__[NgtRendererClassId.parent]) {\n\t\tnode.__ngt_renderer__[NgtRendererClassId.parent] = parent;\n\t}\n}\n\nexport function addRendererChildNode(node: NgtRendererNode, child: NgtRendererNode) {\n\tif (!node.__ngt_renderer__[NgtRendererClassId.children].includes(child)) {\n\t\tnode.__ngt_renderer__[NgtRendererClassId.children].push(child);\n\t}\n}\n","import * as THREE from 'three';\nimport type { NgtCanvasElement, NgtDpr, NgtGLDefaultOptions, NgtGLOptions, NgtIntersection, NgtSize } from '../types';\nimport { is } from './is';\n\nconst idCache: { [id: string]: boolean | undefined } = {};\n\n/**\n * Generates a unique identifier.\n *\n * When called with an intersection event, creates a deterministic ID based on\n * the object UUID, index, and instance ID. Otherwise, generates a new UUID.\n *\n * @param event - Optional intersection event to generate ID from\n * @returns A unique string identifier\n */\nexport function makeId(event?: NgtIntersection): string {\n\tif (event) {\n\t\treturn (event.eventObject || event.object).uuid + '/' + event.index + event.instanceId;\n\t}\n\n\tconst newId = THREE.MathUtils.generateUUID();\n\t// ensure not already used\n\tif (!idCache[newId]) {\n\t\tidCache[newId] = true;\n\t\treturn newId;\n\t}\n\treturn makeId();\n}\n\n/**\n * Resolves the device pixel ratio within specified bounds.\n *\n * When given a range [min, max], clamps the device's actual DPR to this range.\n * Falls back to 2x DPR in environments where it cannot be detected (e.g., workers).\n *\n * @param dpr - A single DPR value or [min, max] range\n * @param window - Optional window object to get devicePixelRatio from\n * @returns The resolved DPR value\n */\nexport function makeDpr(dpr: NgtDpr, window?: Window) {\n\t// Err on the side of progress by assuming 2x dpr if we can't detect it\n\t// This will happen in workers where window is defined but dpr isn't.\n\tconst target = typeof window !== 'undefined' ? (window.devicePixelRatio ?? 2) : 1;\n\treturn Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;\n}\n\n/**\n * Creates a WebGL renderer instance with sensible defaults.\n *\n * If a custom renderer is provided via glOptions, it will be used directly.\n * Otherwise, creates a new WebGLRenderer with high-performance defaults.\n *\n * @typeParam TCanvas - The type of canvas element\n * @param glOptions - Renderer configuration or custom renderer\n * @param canvas - The canvas element to render to\n * @returns A WebGLRenderer instance\n */\nexport function makeRendererInstance<TCanvas extends NgtCanvasElement>(\n\tglOptions: NgtGLOptions,\n\tcanvas: TCanvas,\n): THREE.WebGLRenderer {\n\tconst defaultOptions: NgtGLDefaultOptions = {\n\t\tpowerPreference: 'high-performance',\n\t\tcanvas,\n\t\tantialias: true,\n\t\talpha: true,\n\t};\n\n\tconst customRenderer = (\n\t\ttypeof glOptions === 'function' ? glOptions(defaultOptions) : glOptions\n\t) as THREE.WebGLRenderer;\n\tif (is.renderer(customRenderer)) return customRenderer;\n\treturn new THREE.WebGLRenderer({ ...defaultOptions, ...glOptions });\n}\n\n/**\n * Creates a camera instance based on the projection type.\n *\n * @param isOrthographic - Whether to create an orthographic camera\n * @param size - The viewport size for calculating aspect ratio\n * @returns Either an OrthographicCamera or PerspectiveCamera\n */\nexport function makeCameraInstance(isOrthographic: boolean, size: NgtSize) {\n\tif (isOrthographic) return new THREE.OrthographicCamera(0, 0, 0, 0, 0.1, 1000);\n\treturn new THREE.PerspectiveCamera(75, size.width / size.height, 0.1, 1000);\n}\n\n/**\n * Type representing a parsed object graph from a loaded 3D model.\n *\n * Contains maps of named nodes, materials, and meshes for easy access.\n */\nexport type NgtObjectMap = {\n\t/** Map of named Object3D nodes */\n\tnodes: Record<string, THREE.Object3D<any>>;\n\t/** Map of named materials */\n\tmaterials: Record<string, THREE.Material>;\n\t/** Map of named meshes */\n\tmeshes: Record<string, THREE.Mesh>;\n\t[key: string]: any;\n};\n\n/**\n * Creates an object graph from a Three.js scene hierarchy.\n *\n * Traverses the object and extracts named nodes, materials, and meshes\n * into lookup tables for convenient access.\n *\n * @param object - The root Object3D to traverse\n * @returns An object containing nodes, materials, and meshes maps\n *\n * @example\n * ```typescript\n * const gltf = await loader.loadAsync('model.gltf');\n * const { nodes, materials } = makeObjectGraph(gltf.scene);\n * // Access named objects: nodes['MyMesh'], materials['MyMaterial']\n * ```\n */\nexport function makeObjectGraph(object: THREE.Object3D): NgtObjectMap {\n\tconst data: NgtObjectMap = { nodes: {}, materials: {}, meshes: {} };\n\n\tif (object) {\n\t\tobject.traverse((child) => {\n\t\t\tif (child.name) data.nodes[child.name] = child;\n\t\t\tif ('material' in child && !data.materials[((child as THREE.Mesh).material as THREE.Material).name]) {\n\t\t\t\tdata.materials[((child as THREE.Mesh).material as THREE.Material).name] = (child as THREE.Mesh)\n\t\t\t\t\t.material as THREE.Material;\n\t\t\t}\n\t\t\tif (is.three<THREE.Mesh>(child, 'isMesh') && !data.meshes[child.name]) data.meshes[child.name] = child;\n\t\t});\n\t}\n\treturn data;\n}\n","import { Subject } from 'rxjs';\nimport * as THREE from 'three';\nimport { getInstanceState } from './instance';\nimport type {\n\tNgtAnyRecord,\n\tNgtDomEvent,\n\tNgtEventHandlers,\n\tNgtIntersection,\n\tNgtPointerCaptureTarget,\n\tNgtState,\n\tNgtThreeEvent,\n} from './types';\nimport { makeId } from './utils/make';\nimport { SignalState } from './utils/signal-state';\n\n/**\n * @fileoverview Event handling system for Angular Three.\n *\n * This module provides the event handling infrastructure for raycasting-based\n * pointer events in Three.js scenes. It handles event propagation, pointer\n * capture, and event bubbling through the scene graph.\n */\n\n/**\n * Releases pointer captures for an object.\n * Called by releasePointerCapture in the API, and when an object is removed.\n * @internal\n */\nfunction releaseInternalPointerCapture(\n\tcapturedMap: Map<number, Map<THREE.Object3D, NgtPointerCaptureTarget>>,\n\tobj: THREE.Object3D,\n\tcaptures: Map<THREE.Object3D, NgtPointerCaptureTarget>,\n\tpointerId: number,\n): void {\n\tconst captureData: NgtPointerCaptureTarget | undefined = captures.get(obj);\n\tif (captureData) {\n\t\tcaptures.delete(obj);\n\t\t// If this was the last capturing object for this pointer\n\t\tif (captures.size === 0) {\n\t\t\tcapturedMap.delete(pointerId);\n\t\t\tcaptureData.target.releasePointerCapture(pointerId);\n\t\t}\n\t}\n}\n\n/**\n * Removes all traces of an object from the event handling system.\n *\n * This function cleans up:\n * - Interaction array\n * - Initial hits\n * - Hovered elements map\n * - Pointer captures\n *\n * @param store - The Angular Three store\n * @param object - The object to remove from interactivity\n */\nexport function removeInteractivity(store: SignalState<NgtState>, object: THREE.Object3D) {\n\tconst { internal } = store.snapshot;\n\t// Removes every trace of an object from the data store\n\tinternal.interaction = internal.interaction.filter((o) => o !== object);\n\tinternal.initialHits = internal.initialHits.filter((o) => o !== object);\n\tinternal.hovered.forEach((value, key) => {\n\t\tif (value.eventObject === object || value.object === object) {\n\t\t\t// Clear out intersects, they are outdated by now\n\t\t\tinternal.hovered.delete(key);\n\t\t}\n\t});\n\tinternal.capturedMap.forEach((captures, pointerId) => {\n\t\treleaseInternalPointerCapture(internal.capturedMap, object, captures, pointerId);\n\t});\n}\n\n/**\n * Creates the event handling system for a store.\n *\n * Returns an object with a `handlePointer` function that creates event handlers\n * for different pointer event types. These handlers perform raycasting,\n * event propagation, and callback invocation.\n *\n * @param store - The Angular Three store to create events for\n * @returns An object containing the handlePointer factory function\n */\nexport function createEvents(store: SignalState<NgtState>) {\n\t/** Calculates delta */\n\tfunction calculateDistance(event: NgtDomEvent) {\n\t\tconst internal = store.snapshot.internal;\n\t\tconst dx = event.offsetX - internal.initialClick[0];\n\t\tconst dy = event.offsetY - internal.initialClick[1];\n\t\treturn Math.round(Math.sqrt(dx * dx + dy * dy));\n\t}\n\n\t/** Returns true if an instance has a valid pointer-event registered, this excludes scroll, clicks etc */\n\tfunction filterPointerEvents(objects: THREE.Object3D[]) {\n\t\treturn objects.filter((obj) =>\n\t\t\t['move', 'over', 'enter', 'out', 'leave'].some((name) => {\n\t\t\t\tconst eventName = `pointer${name}` as keyof NgtEventHandlers;\n\t\t\t\treturn getInstanceState(obj)?.handlers?.[eventName];\n\t\t\t}),\n\t\t);\n\t}\n\n\tfunction intersect(event: NgtDomEvent, filter?: (objects: THREE.Object3D[]) => THREE.Object3D[]) {\n\t\tconst state = store.snapshot;\n\t\tconst duplicates = new Set<string>();\n\t\tconst intersections: NgtIntersection[] = [];\n\t\t// Allow callers to eliminate event objects\n\t\tconst eventsObjects = filter ? filter(state.internal.interaction) : state.internal.interaction;\n\n\t\tif (!state.previousRoot) {\n\t\t\t// Make sure root-level pointer and ray are set up\n\t\t\tstate.events.compute?.(event, store, null);\n\t\t}\n\n\t\t// Skip work if there are no event objects\n\t\tif (eventsObjects.length === 0) return intersections;\n\n\t\t// Reset all raycaster cameras to undefined - use for loop for better performance\n\t\tconst eventsObjectsLen = eventsObjects.length;\n\t\tfor (let i = 0; i < eventsObjectsLen; i++) {\n\t\t\tconst objectRootState = getInstanceState(eventsObjects[i])?.store?.snapshot;\n\t\t\tif (objectRootState) {\n\t\t\t\tobjectRootState.raycaster.camera = undefined!;\n\t\t\t}\n\t\t}\n\n\t\t// Pre-allocate array to avoid garbage collection\n\t\tconst raycastResults: THREE.Intersection<THREE.Object3D>[] = [];\n\n\t\tfunction handleRaycast(obj: THREE.Object3D) {\n\t\t\tconst objStore = getInstanceState(obj)?.store;\n\t\t\tconst objState = objStore?.snapshot;\n\t\t\t// Skip event handling when noEvents is set, or when the raycasters camera is null\n\t\t\tif (!objState || !objState.events.enabled || objState.raycaster.camera === null) return [];\n\n\t\t\t// When the camera is undefined we have to call the event layers update function\n\t\t\tif (objState.raycaster.camera === undefined) {\n\t\t\t\tobjState.events.compute?.(event, objStore, objState.previousRoot);\n\t\t\t\t// If the camera is still undefined we have to skip this layer entirely\n\t\t\t\tif (objState.raycaster.camera === undefined) objState.raycaster.camera = null!;\n\t\t\t}\n\n\t\t\t// Intersect object by object\n\t\t\treturn objState.raycaster.camera ? objState.raycaster.intersectObject(obj, true) : [];\n\t\t}\n\n\t\t// Collect events\n\t\tfor (let i = 0; i < eventsObjectsLen; i++) {\n\t\t\tconst objResults = handleRaycast(eventsObjects[i]);\n\t\t\tif (objResults.length <= 0) continue;\n\t\t\tfor (let j = 0; j < objResults.length; j++) {\n\t\t\t\traycastResults.push(objResults[j]);\n\t\t\t}\n\t\t}\n\n\t\t// Sort by event priority and distance\n\t\traycastResults.sort((a, b) => {\n\t\t\tconst aState = getInstanceState(a.object)?.store?.snapshot;\n\t\t\tconst bState = getInstanceState(b.object)?.store?.snapshot;\n\t\t\tif (!aState || !bState) return a.distance - b.distance;\n\t\t\treturn bState.events.priority - aState.events.priority || a.distance - b.distance;\n\t\t});\n\n\t\t// Filter out duplicates - more efficient than chaining\n\t\tlet hits: THREE.Intersection<THREE.Object3D>[] = [];\n\t\tfor (let i = 0; i < raycastResults.length; i++) {\n\t\t\tconst item = raycastResults[i];\n\t\t\tconst id = makeId(item as NgtIntersection);\n\t\t\tif (duplicates.has(id)) continue;\n\t\t\tduplicates.add(id);\n\t\t\thits.push(item);\n\t\t}\n\n\t\t// https://github.com/mrdoob/three.js/issues/16031\n\t\t// Allow custom userland intersect sort order, this likely only makes sense on the root filter\n\t\tif (state.events.filter) hits = state.events.filter(hits, store);\n\n\t\t// Bubble up the events, find the event source (eventObject)\n\t\tconst hitsLen = hits.length;\n\t\tfor (let i = 0; i < hitsLen; i++) {\n\t\t\tconst hit = hits[i];\n\t\t\tlet eventObject: THREE.Object3D | null = hit.object;\n\t\t\t// bubble event up\n\t\t\twhile (eventObject) {\n\t\t\t\tif (getInstanceState(eventObject)?.eventCount) intersections.push({ ...hit, eventObject });\n\t\t\t\teventObject = eventObject.parent;\n\t\t\t}\n\t\t}\n\n\t\t// If the interaction is captured, make all capturing targets part of the intersect.\n\t\tif ('pointerId' in event && state.internal.capturedMap.has(event.pointerId)) {\n\t\t\tconst captures = state.internal.capturedMap.get(event.pointerId)!;\n\t\t\tfor (const captureData of captures.values()) {\n\t\t\t\tif (duplicates.has(makeId(captureData.intersection))) continue;\n\t\t\t\tintersections.push(captureData.intersection);\n\t\t\t}\n\t\t}\n\t\treturn intersections;\n\t}\n\n\t/** Handles intersections by forwarding them to handlers */\n\tfunction handleIntersects(\n\t\tintersections: NgtIntersection[],\n\t\tevent: NgtDomEvent,\n\t\tdelta: number,\n\t\tcallback: (event: NgtThreeEvent<NgtDomEvent>) => void,\n\t) {\n\t\tconst rootState = store.snapshot;\n\n\t\t// If anything has been found, forward it to the event listeners\n\t\tif (intersections.length) {\n\t\t\tconst localState = { stopped: false };\n\t\t\tfor (const hit of intersections) {\n\t\t\t\tlet instanceState = getInstanceState(hit.object);\n\n\t\t\t\t// If the object is not managed by NGT, it might be parented to an element which is.\n\t\t\t\t// Traverse upwards until we find a managed parent and use its state instead.\n\t\t\t\tif (!instanceState) {\n\t\t\t\t\thit.object.traverseAncestors((ancestor) => {\n\t\t\t\t\t\tconst parentInstanceState = getInstanceState(ancestor);\n\t\t\t\t\t\tif (parentInstanceState) {\n\t\t\t\t\t\t\tinstanceState = parentInstanceState;\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst { raycaster, pointer, camera, internal } = instanceState?.store?.snapshot || rootState;\n\n\t\t\t\tconst unprojectedPoint = new THREE.Vector3(pointer.x, pointer.y, 0).unproject(camera);\n\t\t\t\tconst hasPointerCapture = (id: number) => internal.capturedMap.get(id)?.has(hit.eventObject) ?? false;\n\n\t\t\t\tconst setPointerCapture = (id: number) => {\n\t\t\t\t\tconst captureData = { intersection: hit, target: event.target as Element };\n\t\t\t\t\tif (internal.capturedMap.has(id)) {\n\t\t\t\t\t\t// if the pointerId was previously captured, we add the hit to the\n\t\t\t\t\t\t// event capturedMap.\n\t\t\t\t\t\tinternal.capturedMap.get(id)!.set(hit.eventObject, captureData);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// if the pointerId was not previously captured, we create a map\n\t\t\t\t\t\t// containing the hitObject, and the hit. hitObject is used for\n\t\t\t\t\t\t// faster access.\n\t\t\t\t\t\tinternal.capturedMap.set(id, new Map([[hit.eventObject, captureData]]));\n\t\t\t\t\t}\n\t\t\t\t\t// Call the original event now\n\t\t\t\t\t(event.target as Element).setPointerCapture(id);\n\t\t\t\t};\n\n\t\t\t\tconst releasePointerCapture = (id: number) => {\n\t\t\t\t\tconst captures = internal.capturedMap.get(id);\n\t\t\t\t\tif (captures) {\n\t\t\t\t\t\treleaseInternalPointerCapture(internal.capturedMap, hit.eventObject, captures, id);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\t// Add native event props\n\t\t\t\tconst extractEventProps: any = {};\n\t\t\t\t// This iterates over the event's properties including the inherited ones. Native PointerEvents have most of their props as getters which are inherited, but polyfilled PointerEvents have them all as their own properties (i.e. not inherited). We can't use Object.keys() or Object.entries() as they only return \"own\" properties; nor Object.getPrototypeOf(event) as that *doesn't* return \"own\" properties, only inherited ones.\n\t\t\t\tfor (const prop in event) {\n\t\t\t\t\tconst property = event[prop as keyof NgtDomEvent];\n\t\t\t\t\t// Only copy over atomics, leave functions alone as these should be\n\t\t\t\t\t// called as event.nativeEvent.fn()\n\t\t\t\t\tif (typeof property !== 'function') extractEventProps[prop] = property;\n\t\t\t\t}\n\n\t\t\t\tconst raycastEvent: NgtThreeEvent<NgtDomEvent> = {\n\t\t\t\t\t...hit,\n\t\t\t\t\t...extractEventProps,\n\t\t\t\t\tpointer,\n\t\t\t\t\tintersections,\n\t\t\t\t\tstopped: localState.stopped,\n\t\t\t\t\tdelta,\n\t\t\t\t\tunprojectedPoint,\n\t\t\t\t\tray: raycaster.ray,\n\t\t\t\t\tcamera,\n\t\t\t\t\t// Hijack stopPropagation, which just sets a flag\n\t\t\t\t\tstopPropagation() {\n\t\t\t\t\t\t// https://github.com/pmndrs/react-three-fiber/issues/596\n\t\t\t\t\t\t// Events are not allowed to stop propagation if the pointer has been captured\n\t\t\t\t\t\tconst capturesForPointer = 'pointerId' in event && internal.capturedMap.get(event.pointerId);\n\n\t\t\t\t\t\t// We only authorize stopPropagation...\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t// ...if this pointer hasn't been captured\n\t\t\t\t\t\t\t!capturesForPointer ||\n\t\t\t\t\t\t\t// ... or if the hit object is capturing the pointer\n\t\t\t\t\t\t\tcapturesForPointer.has(hit.eventObject)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\traycastEvent.stopped = localState.stopped = true;\n\t\t\t\t\t\t\t// Propagation is stopped, remove all other hover records\n\t\t\t\t\t\t\t// An event handler is only allowed to flush other handlers if it is hovered itself\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tinternal.hovered.size &&\n\t\t\t\t\t\t\t\tArray.from(internal.hovered.values()).find((i) => i.eventObject === hit.eventObject)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t// Objects cannot flush out higher up objects that have already caught the event\n\t\t\t\t\t\t\t\tconst higher = intersections.slice(0, intersections.indexOf(hit));\n\t\t\t\t\t\t\t\tcancelPointer([...higher, hit]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t// there should be a distinction between target and currentTarget\n\t\t\t\t\ttarget: { hasPointerCapture, setPointerCapture, releasePointerCapture },\n\t\t\t\t\tcurrentTarget: { hasPointerCapture, setPointerCapture, releasePointerCapture },\n\t\t\t\t\tnativeEvent: event,\n\t\t\t\t};\n\n\t\t\t\t// Call subscribers\n\t\t\t\tcallback(raycastEvent);\n\t\t\t\t// Event bubbling may be interrupted by stopPropagation\n\t\t\t\tif (localState.stopped) break;\n\t\t\t}\n\t\t}\n\t\treturn intersections;\n\t}\n\n\tfunction cancelPointer(intersections: NgtIntersection[]) {\n\t\tconst internal = store.snapshot.internal;\n\t\tfor (const hoveredObj of internal.hovered.values()) {\n\t\t\t// When no objects were hit or the the hovered object wasn't found underneath the cursor\n\t\t\t// we call onPointerOut and delete the object from the hovered-elements map\n\t\t\tif (\n\t\t\t\t!intersections.length ||\n\t\t\t\t!intersections.find(\n\t\t\t\t\t(hit) =>\n\t\t\t\t\t\thit.object === hoveredObj.object &&\n\t\t\t\t\t\thit.index === hoveredObj.index &&\n\t\t\t\t\t\thit.instanceId === hoveredObj.instanceId,\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tconst eventObject = hoveredObj.eventObject;\n\t\t\t\tconst instance = getInstanceState(eventObject);\n\t\t\t\tconst handlers = instance?.handlers;\n\t\t\t\tinternal.hovered.delete(makeId(hoveredObj));\n\t\t\t\tif (instance?.eventCount) {\n\t\t\t\t\t// Clear out intersects, they are outdated by now\n\t\t\t\t\tconst data = { ...hoveredObj, intersections };\n\t\t\t\t\thandlers?.pointerout?.(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t\thandlers?.pointerleave?.(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction pointerMissed(event: MouseEvent, objects: THREE.Object3D[]) {\n\t\tfor (let i = 0; i < objects.length; i++) {\n\t\t\tconst instance = getInstanceState(objects[i]);\n\t\t\tinstance?.handlers.pointermissed?.(event);\n\t\t}\n\t}\n\n\tfunction handlePointer(name: string) {\n\t\t// Handle common cancelation events\n\t\tif (name === 'pointerleave' || name === 'pointercancel') {\n\t\t\treturn () => cancelPointer([]);\n\t\t}\n\n\t\tif (name === 'lostpointercapture') {\n\t\t\treturn (event: NgtDomEvent) => {\n\t\t\t\tconst { internal } = store.snapshot;\n\t\t\t\tif ('pointerId' in event && internal.capturedMap.has(event.pointerId)) {\n\t\t\t\t\t// If the object event interface had lostpointercapture, we'd call it here on every\n\t\t\t\t\t// object that's getting removed. We call it on the next frame because lostpointercapture\n\t\t\t\t\t// fires before pointerup. Otherwise pointerUp would never be called if the event didn't\n\t\t\t\t\t// happen in the object it originated from, leaving components in a in-between state.\n\t\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\t\t// Only release if pointer-up didn't do it already\n\t\t\t\t\t\tif (internal.capturedMap.has(event.pointerId)) {\n\t\t\t\t\t\t\tinternal.capturedMap.delete(event.pointerId);\n\t\t\t\t\t\t\tcancelPointer([]);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Cache these values since they're used in the closure\n\t\tconst isPointerMove = name === 'pointermove';\n\t\tconst isClickEvent = name === 'click' || name === 'contextmenu' || name === 'dblclick';\n\t\tconst filter = isPointerMove ? filterPointerEvents : undefined;\n\n\t\t// Any other pointer goes here ...\n\t\treturn function handleEvent(event: NgtDomEvent) {\n\t\t\t// NOTE: __pointerMissed$ on NgtStore is private subject since we only expose the Observable\n\t\t\tconst pointerMissed$: Subject<MouseEvent> = (store as NgtAnyRecord)['__pointerMissed$'];\n\t\t\tconst internal = store.snapshot.internal;\n\n\t\t\t// Cache the event\n\t\t\tinternal.lastEvent.nativeElement = event;\n\n\t\t\t// Get fresh intersects\n\t\t\tconst hits = intersect(event, filter);\n\t\t\t// Only calculate distance for click events to avoid unnecessary math\n\t\t\tconst delta = isClickEvent ? calculateDistance(event) : 0;\n\n\t\t\t// Save initial coordinates on pointer-down\n\t\t\tif (name === 'pointerdown') {\n\t\t\t\tinternal.initialClick = [event.offsetX, event.offsetY];\n\t\t\t\tinternal.initialHits = hits.map((hit) => hit.eventObject);\n\t\t\t}\n\n\t\t\t// Handle click miss events - early return optimization for better performance\n\t\t\tif (isClickEvent && hits.length === 0 && delta <= 2) {\n\t\t\t\tpointerMissed(event, internal.interaction);\n\t\t\t\tpointerMissed$.next(event);\n\t\t\t\treturn; // Early return if nothing was hit\n\t\t\t}\n\n\t\t\t// Take care of unhover for pointer moves\n\t\t\tif (isPointerMove) cancelPointer(hits);\n\n\t\t\t// Define onIntersect handler - locally cache common properties for better performance\n\t\t\tfunction onIntersect(data: NgtThreeEvent<NgtDomEvent>) {\n\t\t\t\tconst eventObject = data.eventObject;\n\t\t\t\tconst instance = getInstanceState(eventObject);\n\n\t\t\t\t// Early return if no instance or event count\n\t\t\t\tif (!instance?.eventCount) return;\n\n\t\t\t\tconst handlers = instance.handlers;\n\t\t\t\tif (!handlers) return;\n\n\t\t\t\tif (isPointerMove) {\n\t\t\t\t\t// Handle pointer move events\n\t\t\t\t\tconst hasPointerOverHandlers = !!(\n\t\t\t\t\t\thandlers.pointerover ||\n\t\t\t\t\t\thandlers.pointerenter ||\n\t\t\t\t\t\thandlers.pointerout ||\n\t\t\t\t\t\thandlers.pointerleave\n\t\t\t\t\t);\n\n\t\t\t\t\tif (hasPointerOverHandlers) {\n\t\t\t\t\t\tconst id = makeId(data);\n\t\t\t\t\t\tconst hoveredItem = internal.hovered.get(id);\n\t\t\t\t\t\tif (!hoveredItem) {\n\t\t\t\t\t\t\t// If the object wasn't previously hovered, book it and call its handler\n\t\t\t\t\t\t\tinternal.hovered.set(id, data);\n\t\t\t\t\t\t\tif (handlers.pointerover) handlers.pointerover(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t\t\t\tif (handlers.pointerenter) handlers.pointerenter(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t\t\t} else if (hoveredItem.stopped) {\n\t\t\t\t\t\t\t// If the object was previously hovered and stopped, we shouldn't allow other items to proceed\n\t\t\t\t\t\t\tdata.stopPropagation();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call mouse move\n\t\t\t\t\tif (handlers.pointermove) handlers.pointermove(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t} else {\n\t\t\t\t\t// All other events ...\n\t\t\t\t\tconst handler = handlers[name as keyof NgtEventHandlers] as (\n\t\t\t\t\t\tevent: NgtThreeEvent<PointerEvent>,\n\t\t\t\t\t) => void;\n\n\t\t\t\t\tif (handler) {\n\t\t\t\t\t\t// Forward all events back to their respective handlers with the exception of click events,\n\t\t\t\t\t\t// which must use the initial target\n\t\t\t\t\t\tif (!isClickEvent || internal.initialHits.includes(eventObject)) {\n\t\t\t\t\t\t\t// Get objects not in initialHits for pointer missed - avoid creating new arrays if possible\n\t\t\t\t\t\t\tconst missedObjects = internal.interaction.filter(\n\t\t\t\t\t\t\t\t(object) => !internal.initialHits.includes(object),\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t// Call pointerMissed only if we have objects to notify\n\t\t\t\t\t\t\tif (missedObjects.length > 0) {\n\t\t\t\t\t\t\t\tpointerMissed(event, missedObjects);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Now call the handler\n\t\t\t\t\t\t\thandler(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (isClickEvent && internal.initialHits.includes(eventObject)) {\n\t\t\t\t\t\t// Trigger onPointerMissed on all elements that have pointer over/out handlers, but not click and weren't hit\n\t\t\t\t\t\tconst missedObjects = internal.interaction.filter(\n\t\t\t\t\t\t\t(object) => !internal.initialHits.includes(object),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Call pointerMissed only if we have objects to notify\n\t\t\t\t\t\tif (missedObjects.length > 0) {\n\t\t\t\t\t\t\tpointerMissed(event, missedObjects);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process all intersections\n\t\t\tif (hits.length > 0) {\n\t\t\t\thandleIntersects(hits, event, delta, onIntersect);\n\t\t\t}\n\t\t};\n\t}\n\n\treturn { handlePointer };\n}\n","import { getInstanceState } from '../instance';\nimport type { NgtAttachFunction, NgtInstanceNode, NgtState } from '../types';\nimport { applyProps, NGT_APPLY_PROPS } from './apply-props';\nimport { SignalState } from './signal-state';\n\n/**\n * Attaches a value to an object at the specified path.\n *\n * This function recursively traverses the path and sets the value at the final key.\n * It's used internally to implement the `attach` property on Three.js elements.\n *\n * @param object - The target object to attach to\n * @param value - The value to attach\n * @param paths - An array of path segments (e.g., ['material', 'map'])\n * @param useApplyProps - Whether to use applyProps for setting the value\n *\n * @example\n * ```typescript\n * const mesh = new THREE.Mesh();\n * attach(mesh, texture, ['material', 'map']);\n * // mesh.material.map = texture\n * ```\n */\nexport function attach(object: NgtInstanceNode, value: unknown, paths: string[] = [], useApplyProps = false): void {\n\tconst [base, ...remaining] = paths;\n\tif (!base) return;\n\n\tif (remaining.length === 0) {\n\t\tif (useApplyProps) applyProps(object, { [base]: value });\n\t\telse object[base] = value;\n\t} else {\n\t\tassignEmpty(object, base, useApplyProps);\n\t\tattach(object[base], value, remaining, useApplyProps);\n\t}\n}\n\n/**\n * Detaches a child from its parent, restoring the previous value.\n *\n * This function reverses the attach operation by restoring the previous value\n * that was stored when the child was attached.\n *\n * @param parent - The parent object\n * @param child - The child object to detach\n * @param attachProp - The attach path or function that was used\n */\nexport function detach(parent: NgtInstanceNode, child: NgtInstanceNode, attachProp: string[] | NgtAttachFunction) {\n\tconst childInstanceState = getInstanceState(child);\n\tif (childInstanceState) {\n\t\tif (Array.isArray(attachProp))\n\t\t\tattach(parent, childInstanceState.previousAttach, attachProp, childInstanceState.type === 'ngt-value');\n\t\telse (childInstanceState.previousAttach as () => void)?.();\n\t}\n}\n\nfunction assignEmpty(obj: NgtInstanceNode, base: string, shouldAssignStoreForApplyProps = false) {\n\tif ((!Object.hasOwn(obj, base) && Reflect && !!Reflect.has && !Reflect.has(obj, base)) || obj[base] === undefined) {\n\t\tobj[base] = {};\n\t}\n\n\tif (shouldAssignStoreForApplyProps) {\n\t\tconst instanceState = getInstanceState(obj[base]);\n\t\t// if we already have instance state, bail out\n\t\tif (instanceState) return;\n\n\t\tconst parentInstanceState = getInstanceState(obj);\n\t\t// if parent doesn't have instance state, bail out\n\t\tif (!parentInstanceState) return;\n\n\t\tObject.assign(obj[base], { [NGT_APPLY_PROPS]: parentInstanceState.store });\n\t}\n}\n\n/**\n * Creates a custom attach function for advanced attachment scenarios.\n *\n * Use this when you need custom logic for attaching a child to a parent,\n * such as when the relationship isn't a simple property assignment.\n *\n * @typeParam TChild - The type of the child object\n * @typeParam TParent - The type of the parent object\n * @param cb - Callback that performs the attachment and optionally returns a cleanup function\n * @returns An attach function compatible with the `attach` property\n *\n * @example\n * ```typescript\n * const customAttach = createAttachFunction<THREE.Mesh, THREE.Group>(\n * ({ parent, child, store }) => {\n * parent.add(child);\n * return () => parent.remove(child);\n * }\n * );\n * ```\n */\nexport function createAttachFunction<TChild = any, TParent = any>(\n\tcb: (params: { parent: TParent; child: TChild; store: SignalState<NgtState> }) => (() => void) | void,\n): NgtAttachFunction<TChild, TParent> {\n\treturn (parent, child, store) => cb({ parent, child, store });\n}\n","import { untracked } from '@angular/core';\nimport * as THREE from 'three';\nimport { removeInteractivity } from '../events';\nimport { getInstanceState, invalidateInstance } from '../instance';\nimport { NgtAnyRecord, NgtInstanceNode } from '../types';\nimport { attach, detach } from '../utils/attach';\nimport { is } from '../utils/is';\nimport {\n\tNGT_CANVAS_CONTENT_FLAG,\n\tNGT_DOM_PARENT_FLAG,\n\tNGT_GET_NODE_ATTRIBUTE_FLAG,\n\tNGT_INTERNAL_ADD_COMMENT_FLAG,\n\tNGT_INTERNAL_SET_PARENT_COMMENT_FLAG,\n\tNGT_PORTAL_CONTENT_FLAG,\n} from './constants';\nimport { NgtRendererNode } from './state';\n\n// @internal\nexport const enum NgtRendererClassId {\n\ttype,\n\tdestroyed,\n\trawValue,\n\tportalContainer,\n\tinjector,\n\tparent,\n\tchildren,\n}\n\nexport function kebabToPascal(str: string): string {\n\tif (!str) return str; // Handle empty input\n\n\tlet pascalStr = '';\n\tlet capitalizeNext = true; // Flag to track capitalization\n\n\tfor (let i = 0; i < str.length; i++) {\n\t\tconst char = str[i];\n\t\tif (char === '-') {\n\t\t\tcapitalizeNext = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tpascalStr += capitalizeNext ? char.toUpperCase() : char;\n\t\tcapitalizeNext = false;\n\t}\n\n\treturn pascalStr;\n}\n\nfunction propagateStoreRecursively(node: NgtInstanceNode, parentNode: NgtInstanceNode) {\n\tconst iS = getInstanceState(node);\n\tconst pIS = getInstanceState(parentNode);\n\n\tif (!iS || !pIS) return;\n\n\t// assign store on child if not already exist\n\t// or child store is not the same as parent store\n\t// or child store is the parent of parent store\n\tif (!iS.store || iS.store !== pIS.store || iS.store === pIS.store.snapshot.previousRoot) {\n\t\tiS.store = pIS.store;\n\n\t\t// Call addInteraction if it exists\n\t\tiS.addInteraction?.(pIS.store);\n\n\t\t// Collect all children (objects and nonObjects)\n\t\tconst children = [\n\t\t\t...(iS.objects ? untracked(iS.objects) : []),\n\t\t\t...(iS.nonObjects ? untracked(iS.nonObjects) : []),\n\t\t];\n\n\t\t// Recursively reassign the store for each child\n\t\tfor (const child of children) {\n\t\t\tpropagateStoreRecursively(child, node);\n\t\t}\n\t}\n}\n\nexport function attachThreeNodes(parent: NgtInstanceNode, child: NgtInstanceNode) {\n\tconst pIS = getInstanceState(parent);\n\tconst cIS = getInstanceState(child);\n\n\tif (!pIS || !cIS) {\n\t\tthrow new Error(`[NGT] THREE instances need to be prepared with local state.`);\n\t}\n\n\t// whether the child is added to the parent with parent.add()\n\tlet added = false;\n\n\t// propagate store recursively\n\tpropagateStoreRecursively(child, parent);\n\n\tif (cIS.attach) {\n\t\tconst attachProp = cIS.attach;\n\n\t\tif (typeof attachProp === 'function') {\n\t\t\tlet attachCleanUp: ReturnType<typeof attachProp> | undefined = undefined;\n\n\t\t\tif (cIS.type === 'ngt-value') {\n\t\t\t\tif (cIS.hierarchyStore.snapshot.parent !== parent) {\n\t\t\t\t\tcIS.setParent(parent);\n\t\t\t\t}\n\t\t\t\t// at this point we don't have rawValue yet, so we bail and wait until the Renderer recalls attach\n\t\t\t\tif ((child as unknown as NgtRendererNode).__ngt_renderer__[NgtRendererClassId.rawValue] === undefined)\n\t\t\t\t\treturn;\n\t\t\t\tattachCleanUp = attachProp(\n\t\t\t\t\tparent,\n\t\t\t\t\t(child as unknown as NgtRendererNode).__ngt_renderer__[NgtRendererClassId.rawValue],\n\t\t\t\t\tcIS.store!,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tattachCleanUp = attachProp(parent, child, cIS.store!);\n\t\t\t}\n\n\t\t\tif (attachCleanUp) cIS.previousAttach = attachCleanUp;\n\t\t} else {\n\t\t\t// we skip attach none if set explicitly\n\t\t\tif (attachProp[0] === 'none') {\n\t\t\t\tinvalidateInstance(child);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// handle material array\n\t\t\tif (\n\t\t\t\tattachProp[0] === 'material' &&\n\t\t\t\tattachProp[1] &&\n\t\t\t\ttypeof Number(attachProp[1]) === 'number' &&\n\t\t\t\tis.three<THREE.Material>(child, 'isMaterial') &&\n\t\t\t\t!Array.isArray(parent['material'])\n\t\t\t) {\n\t\t\t\tparent['material'] = [];\n\t\t\t}\n\n\t\t\tif (cIS.type === 'ngt-value') {\n\t\t\t\tif (cIS.hierarchyStore.snapshot.parent !== parent) {\n\t\t\t\t\tcIS.setParent(parent);\n\t\t\t\t}\n\t\t\t\t// at this point we don't have rawValue yet, so we bail and wait until the Renderer recalls attach\n\t\t\t\tif ((child as unknown as NgtRendererNode).__ngt_renderer__[NgtRendererClassId.rawValue] === undefined)\n\t\t\t\t\treturn;\n\n\t\t\t\t// save prev value\n\t\t\t\tcIS.previousAttach = attachProp.reduce((value, key) => value[key], parent);\n\t\t\t\tattach(\n\t\t\t\t\tparent,\n\t\t\t\t\t(child as unknown as NgtRendererNode).__ngt_renderer__[NgtRendererClassId.rawValue],\n\t\t\t\t\tattachProp,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// save prev value\n\t\t\t\tcIS.previousAttach = attachProp.reduce((value, key) => value[key], parent);\n\t\t\t\tattach(parent, child, attachProp);\n\t\t\t}\n\t\t}\n\t} else if (is.three<THREE.Object3D>(parent, 'isObject3D') && is.three<THREE.Object3D>(child, 'isObject3D')) {\n\t\tparent.add(child);\n\t\tadded = true;\n\t\tcIS.addInteraction?.(cIS.store || pIS.store);\n\t}\n\n\tif (pIS.add) {\n\t\tpIS.add(child, added ? 'objects' : 'nonObjects');\n\t}\n\n\tif (cIS.parent && untracked(cIS.parent) !== parent) {\n\t\tcIS.setParent(parent);\n\t}\n\n\t// NOTE: this does not mean that the child is actually attached to the parent on the scenegraph.\n\t// a child on the Angular template can also emit onAttach\n\tif (cIS.onAttach) cIS.onAttach({ parent, node: child });\n\n\tinvalidateInstance(child);\n\tinvalidateInstance(parent);\n}\n\nexport function removeThreeChild(child: NgtInstanceNode, parent: NgtInstanceNode, dispose?: boolean) {\n\tconst pIS = getInstanceState(parent);\n\tconst cIS = getInstanceState(child);\n\n\t// clear parent ref\n\tcIS?.setParent(null);\n\n\t// remove child from parent\n\tpIS?.remove?.(child, 'objects');\n\tpIS?.remove?.(child, 'nonObjects');\n\n\tif (cIS?.attach) {\n\t\tdetach(parent, child, cIS.attach);\n\t} else if (is.three<THREE.Object3D>(parent, 'isObject3D') && is.three<THREE.Object3D>(child, 'isObject3D')) {\n\t\tparent.remove(child);\n\t\tconst store = cIS?.store || pIS?.store;\n\t\tcIS?.removeInteraction?.(store);\n\t\tif (store) removeInteractivity(store, child);\n\t}\n\n\t// dispose\n\tconst isPrimitive = cIS?.type && cIS.type !== 'ngt-primitive';\n\tif (!isPrimitive && child['dispose'] && !is.three<THREE.Scene>(child, 'isScene')) {\n\t\tqueueMicrotask(() => child['dispose']());\n\t}\n\n\tinvalidateInstance(parent);\n}\n\nexport function internalDestroyNode(\n\tnode: NgtRendererNode,\n\tremoveChild: null | ((node: NgtRendererNode, child: NgtRendererNode) => void),\n) {\n\tconst rS = node.__ngt_renderer__;\n\tif (!rS || rS[NgtRendererClassId.destroyed]) return;\n\n\tfor (const child of rS[NgtRendererClassId.children].slice()) {\n\t\tremoveChild?.(node, child);\n\t\tinternalDestroyNode(child, removeChild);\n\t}\n\n\t// clear out parent if haven't\n\trS[NgtRendererClassId.parent] = undefined;\n\t// clear out children\n\trS[NgtRendererClassId.children].length = 0;\n\n\t// clear out NgtInstanceState\n\tconst iS = getInstanceState(node);\n\tif (iS) {\n\t\tconst temp = iS as NgtAnyRecord;\n\n\t\tiS.removeInteraction?.(iS.store);\n\n\t\tdelete temp['onAttach'];\n\t\tdelete temp['onUpdate'];\n\t\tdelete temp['object'];\n\t\tdelete temp['objects'];\n\t\tdelete temp['nonObjects'];\n\t\tdelete temp['parent'];\n\t\tdelete temp['add'];\n\t\tdelete temp['remove'];\n\t\tdelete temp['updateGeometryStamp'];\n\t\tdelete temp['setParent'];\n\t\tdelete temp['store'];\n\t\tdelete temp['handlers'];\n\t\tdelete temp['hierarchyStore'];\n\t\tdelete temp['previousAttach'];\n\t\tdelete temp['setPointerEvent'];\n\t\tdelete temp['addInteraction'];\n\t\tdelete temp['removeInteraction'];\n\n\t\tif (iS.type !== 'ngt-primitive') {\n\t\t\tdelete node['__ngt__'];\n\t\t}\n\t}\n\n\t// clear our debugNode\n\trS[NgtRendererClassId.injector] = undefined;\n\n\tif (rS[NgtRendererClassId.type] === 'comment') {\n\t\tdelete node[NGT_INTERNAL_ADD_COMMENT_FLAG];\n\t\tdelete node[NGT_INTERNAL_SET_PARENT_COMMENT_FLAG];\n\t\tdelete node[NGT_CANVAS_CONTENT_FLAG];\n\t\tdelete node[NGT_PORTAL_CONTENT_FLAG];\n\t\tdelete node[NGT_DOM_PARENT_FLAG];\n\t}\n\n\t// clear getAttribute if exist\n\tif (\n\t\t'getAttribute' in node &&\n\t\ttypeof node['getAttribute'] === 'function' &&\n\t\tnode['getAttribute'][NGT_GET_NODE_ATTRIBUTE_FLAG]\n\t) {\n\t\tdelete node['getAttribute'];\n\t}\n\n\t// mark node as destroyed\n\trS[NgtRendererClassId.destroyed] = true;\n}\n","import {\n\tDOCUMENT,\n\tinject,\n\tInjectable,\n\tInjectionToken,\n\tInjector,\n\tRenderer2,\n\tRendererFactory2,\n\tRendererType2,\n\tType,\n\tuntracked,\n} from '@angular/core';\nimport * as THREE from 'three';\nimport { NgtArgs } from '../directives/args';\nimport { NgtCommonDirective } from '../directives/common';\nimport { NgtParent } from '../directives/parent';\nimport { getInstanceState, prepare } from '../instance';\nimport {\n\tNgtAttachable,\n\tNgtConstructorRepresentation,\n\tNgtEventHandlers,\n\tNgtInstanceNode,\n\tNgtInstanceState,\n} from '../types';\nimport { applyProps } from '../utils/apply-props';\nimport { is } from '../utils/is';\nimport { injectCatalogue } from './catalogue';\nimport {\n\tNGT_CANVAS_CONTENT_FLAG,\n\tNGT_DELEGATE_RENDERER_DESTROY_NODE_PATCHED_FLAG,\n\tNGT_DOM_PARENT_FLAG,\n\tNGT_HTML_FLAG,\n\tNGT_INTERNAL_ADD_COMMENT_FLAG,\n\tNGT_INTERNAL_SET_PARENT_COMMENT_FLAG,\n\tNGT_PORTAL_CONTENT_FLAG,\n\tNGT_RENDERER_NODE_FLAG,\n\tTHREE_NATIVE_EVENTS,\n} from './constants';\nimport {\n\taddRendererChildNode,\n\tcreateRendererNode,\n\tisRendererNode,\n\tNgtRendererNode,\n\tsetRendererParentNode,\n} from './state';\nimport { attachThreeNodes, internalDestroyNode, kebabToPascal, NgtRendererClassId, removeThreeChild } from './utils';\n\n/**\n * Configuration options for the Angular Three renderer factory.\n */\nexport interface NgtRendererFactory2Options {\n\t/**\n\t * Enable verbose logging for debugging renderer operations.\n\t * @default false\n\t */\n\tverbose?: boolean;\n\t/**\n\t * When a change happens to an object's direct children, Angular Three will notify the object's ancestors\n\t * of this change so the ancestors are aware of the updated matrices of the object. In order to reduce the\n\t * number of notifications, Angular Three caches and skips notifications when possible.\n\t *\n\t * However, this can cause missed notifications in some cases. Control the number of skips with this option.\n\t *\n\t * @default 5\n\t */\n\tmaxNotificationSkipCount?: number;\n}\n\n/**\n * Injection token for renderer factory options.\n */\nexport const NGT_RENDERER_OPTIONS = new InjectionToken<NgtRendererFactory2Options>('NGT_RENDERER_OPTIONS');\n\n/**\n * Angular renderer factory for Three.js elements.\n *\n * This factory creates NgtRenderer2 instances for components that use Angular Three.\n * It intercepts Angular's rendering operations and translates them to Three.js object\n * creation and manipulation.\n *\n * The factory is typically provided via `provideNgtRenderer()` in your application config.\n *\n * @example\n * ```typescript\n * // In app.config.ts\n * import { provideNgtRenderer } from 'angular-three/dom';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [provideNgtRenderer()]\n * };\n * ```\n */\n@Injectable()\nexport class NgtRendererFactory2 implements RendererFactory2 {\n\tprivate catalogue = injectCatalogue();\n\tprivate document = inject(DOCUMENT);\n\tprivate options = inject(NGT_RENDERER_OPTIONS, { optional: true }) || {};\n\tprivate rendererMap = new Map<string, Renderer2>();\n\n\t/**\n\t * NOTE: We use `useFactory` to instantiate `NgtRendererFactory2`\n\t */\n\tconstructor(private delegateRendererFactory: RendererFactory2) {}\n\n\tcreateRenderer(hostElement: any, type: RendererType2 | null): Renderer2 {\n\t\tconst delegateRenderer = this.delegateRendererFactory.createRenderer(hostElement, type);\n\t\tif (!type) return delegateRenderer;\n\n\t\tlet renderer = this.rendererMap.get(type.id);\n\t\tif (renderer) {\n\t\t\tif (renderer instanceof NgtRenderer2) {\n\t\t\t\trenderer.count += 1;\n\t\t\t\tif (renderer.delegateRenderer !== delegateRenderer) {\n\t\t\t\t\trenderer.delegateRenderer = delegateRenderer;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn renderer;\n\t\t}\n\n\t\tif (hostElement && !isRendererNode(hostElement)) {\n\t\t\tcreateRendererNode('platform', hostElement, this.document);\n\t\t}\n\n\t\tif (Reflect.get(type, 'type')?.[NGT_HTML_FLAG]) {\n\t\t\tthis.rendererMap.set(type.id, delegateRenderer);\n\n\t\t\t// patch delegate destroyNode so we can destroy this HTML node\n\t\t\t// TODO: make sure we really need to do this\n\t\t\tconst originalDestroyNode = delegateRenderer.destroyNode?.bind(delegateRenderer);\n\t\t\tif (!originalDestroyNode || !(NGT_DELEGATE_RENDERER_DESTROY_NODE_PATCHED_FLAG in originalDestroyNode)) {\n\t\t\t\tdelegateRenderer.destroyNode = (node) => {\n\t\t\t\t\toriginalDestroyNode?.(node);\n\t\t\t\t\tif (node !== hostElement) return;\n\t\t\t\t\tinternalDestroyNode(node, null);\n\t\t\t\t};\n\t\t\t\tObject.assign(delegateRenderer.destroyNode, {\n\t\t\t\t\t[NGT_DELEGATE_RENDERER_DESTROY_NODE_PATCHED_FLAG]: true,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn delegateRenderer;\n\t\t}\n\n\t\tthis.rendererMap.set(\n\t\t\ttype.id,\n\t\t\t(renderer = new NgtRenderer2(delegateRenderer, this.catalogue, this.document, this.options)),\n\t\t);\n\t\treturn renderer;\n\t}\n}\n\n/**\n * Custom Angular renderer for Three.js elements.\n *\n * This renderer intercepts Angular's DOM operations and translates them to Three.js\n * object manipulations. It handles:\n * - Element creation (converting ngt-* elements to Three.js objects)\n * - Property/attribute setting (applying props to Three.js objects)\n * - Event listening (setting up Three.js event handlers)\n * - Parent-child relationships (managing the Three.js scene graph)\n *\n * @internal\n */\nexport class NgtRenderer2 implements Renderer2 {\n\tprivate argsInjectors: Array<Injector> = [];\n\tprivate parentInjectors: Array<Injector> = [];\n\n\tconstructor(\n\t\tpublic delegateRenderer: Renderer2,\n\t\tprivate catalogue: Record<string, NgtConstructorRepresentation>,\n\t\tprivate document: Document,\n\t\tprivate options: NgtRendererFactory2Options,\n\t\tpublic count = 1,\n\t) {\n\t\tif (!this.options.verbose) {\n\t\t\tthis.options.verbose = false;\n\t\t}\n\t}\n\n\tget data(): { [key: string]: any } {\n\t\treturn { ...this.delegateRenderer.data, __ngt_renderer__: true };\n\t}\n\n\tdestroy(): void {\n\t\tif (this.count > 1) {\n\t\t\tthis.count -= 1;\n\t\t\treturn;\n\t\t}\n\n\t\t// this is the last instance of the same NgtRenderer2\n\t\tthis.count = 0;\n\t\tthis.argsInjectors = [];\n\t\tthis.parentInjectors = [];\n\t}\n\n\tcreateElement(name: string, namespace?: string | null) {\n\t\tconst platformElement = this.delegateRenderer.createElement(name, namespace);\n\n\t\tif (name === 'ngt-portal') {\n\t\t\treturn createRendererNode('portal', platformElement, this.document);\n\t\t}\n\n\t\tif (name === 'ngt-value') {\n\t\t\treturn createRendererNode('three', prepare(platformElement, 'ngt-value'), this.document);\n\t\t}\n\n\t\tconst [injectedArgs, injectedParent] = [\n\t\t\tthis.getNgtDirective(NgtArgs, this.argsInjectors)?.value || [],\n\t\t\tthis.getNgtDirective(NgtParent, this.parentInjectors)?.value,\n\t\t];\n\n\t\tif (name === 'ngt-primitive') {\n\t\t\tif (!injectedArgs[0]) throw new Error(`[NGT] ngt-primitive without args is invalid`);\n\t\t\tconst object = injectedArgs[0];\n\t\t\tlet instanceState = getInstanceState(object);\n\t\t\tif (!instanceState || instanceState.type !== 'ngt-primitive') {\n\t\t\t\t// if an object isn't already \"prepared\", we'll prepare it\n\t\t\t\tprepare(object, 'ngt-primitive', instanceState);\n\t\t\t}\n\n\t\t\tconst primitiveRendererNode = createRendererNode('three', object, this.document);\n\t\t\tif (injectedParent) {\n\t\t\t\tprimitiveRendererNode.__ngt_renderer__[NgtRendererClassId.parent] =\n\t\t\t\t\tinjectedParent as unknown as NgtRendererNode<'three'>;\n\t\t\t}\n\n\t\t\treturn primitiveRendererNode;\n\t\t}\n\n\t\tif (!name.startsWith('ngt-')) {\n\t\t\treturn createRendererNode('platform', platformElement, this.document);\n\t\t}\n\n\t\tconst threeName = kebabToPascal(name.startsWith('ngt-') ? name.slice(4) : name);\n\t\tlet threeTarget = this.catalogue[threeName];\n\n\t\tif (!threeTarget && threeName in THREE) {\n\t\t\tconst threeSymbol = THREE[threeName as keyof typeof THREE];\n\t\t\tif (typeof threeSymbol === 'function') {\n\t\t\t\t// we will attempt to prefill the catalogue with symbols from THREE\n\t\t\t\tthreeTarget = this.catalogue[threeName] = threeSymbol as NgtConstructorRepresentation;\n\t\t\t}\n\t\t}\n\n\t\tif (threeTarget) {\n\t\t\tconst threeInstance = prepare(new threeTarget(...injectedArgs), name);\n\t\t\tconst rendererNode = createRendererNode('three', threeInstance, this.document);\n\t\t\t// assert type here because it is just created so we don't have to null check it\n\t\t\tconst instanceState = getInstanceState(threeInstance) as NgtInstanceState;\n\n\t\t\t// auto-attach for geometry and material\n\t\t\tif (is.three<THREE.BufferGeometry>(threeInstance, 'isBufferGeometry')) {\n\t\t\t\tinstanceState.attach = ['geometry'];\n\t\t\t} else if (is.three<THREE.Material>(threeInstance, 'isMaterial')) {\n\t\t\t\tinstanceState.attach = ['material'];\n\t\t\t}\n\n\t\t\tif (injectedParent) {\n\t\t\t\trendererNode.__ngt_renderer__[NgtRendererClassId.parent] =\n\t\t\t\t\tinjectedParent as unknown as NgtRendererNode<'three'>;\n\t\t\t}\n\n\t\t\treturn rendererNode;\n\t\t}\n\n\t\treturn createRendererNode('platform', platformElement, this.document);\n\t}\n\n\tcreateComment(value: string) {\n\t\tconst commentNode = this.delegateRenderer.createComment(value);\n\n\t\tconst commentRendererNode = createRendererNode('comment', commentNode, this.document);\n\n\t\t// NOTE: we attach an arrow function to the Comment node\n\t\t// In our directives, we can call this function to then start tracking the RendererNode\n\t\t// this is done to limit the amount of Nodes we need to process for getCreationState\n\t\tObject.assign(commentRendererNode, {\n\t\t\t[NGT_INTERNAL_ADD_COMMENT_FLAG]: (type: 'args' | 'parent', injector: Injector) => {\n\t\t\t\tif (type === 'args') {\n\t\t\t\t\tthis.argsInjectors.push(injector);\n\t\t\t\t} else if (type === 'parent') {\n\t\t\t\t\tObject.assign(commentRendererNode, {\n\t\t\t\t\t\t[NGT_INTERNAL_SET_PARENT_COMMENT_FLAG]: (ngtParent: NgtRendererNode<'three'>) => {\n\t\t\t\t\t\t\tcommentRendererNode.__ngt_renderer__[NgtRendererClassId.parent] = ngtParent;\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tthis.parentInjectors.push(injector);\n\t\t\t\t}\n\n\t\t\t\tcommentRendererNode.__ngt_renderer__[NgtRendererClassId.injector] = injector;\n\t\t\t},\n\t\t});\n\n\t\treturn commentRendererNode;\n\t}\n\n\tcreateText(value: string) {\n\t\tconst textNode = this.delegateRenderer.createText(value);\n\t\treturn createRendererNode('text', textNode, this.document);\n\t}\n\n\tdestroyNode: (node: NgtRendererNode) => void = (node) => {\n\t\tinternalDestroyNode(node, this.removeChild.bind(this));\n\t};\n\n\tappendChild(\n\t\tparent: NgtRendererNode,\n\t\tnewChild: NgtRendererNode,\n\t\trefChild?: NgtRendererNode,\n\t\tisMove?: boolean,\n\t): void {\n\t\tconst delegatedFn = refChild\n\t\t\t? this.delegateRenderer.insertBefore.bind(this.delegateRenderer, parent, newChild, refChild, isMove)\n\t\t\t: this.delegateRenderer.appendChild.bind(this.delegateRenderer, parent, newChild);\n\n\t\tconst pRS = parent.__ngt_renderer__;\n\t\tconst cRS = newChild.__ngt_renderer__;\n\n\t\tif (!pRS || !cRS) {\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn('[NGT dev mode] One of parent or child is not a renderer node.', { parent, newChild });\n\t\t\treturn delegatedFn();\n\t\t}\n\n\t\tif (cRS[NgtRendererClassId.type] === 'comment') {\n\t\t\t// if child is a comment, we'll set the parent then bail.\n\t\t\t// comment usually means it's part of a templateRef ViewContainerRef or structural directive\n\t\t\tsetRendererParentNode(newChild, parent);\n\n\t\t\t// if parent is not three, we'll delegate to the renderer\n\t\t\tif (pRS[NgtRendererClassId.type] !== 'three') {\n\t\t\t\tdelegatedFn();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'platform' && cRS[NgtRendererClassId.type] === 'platform') {\n\t\t\tif (newChild[NGT_DOM_PARENT_FLAG] && newChild[NGT_DOM_PARENT_FLAG] instanceof HTMLElement) {\n\t\t\t\treturn this.delegateRenderer.appendChild(newChild[NGT_DOM_PARENT_FLAG], newChild);\n\t\t\t}\n\n\t\t\tif (pRS[NgtRendererClassId.parent] && !cRS[NgtRendererClassId.parent]) {\n\t\t\t\treturn this.appendChild(pRS[NgtRendererClassId.parent], newChild);\n\t\t\t}\n\n\t\t\treturn delegatedFn();\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'three' && cRS[NgtRendererClassId.type] === 'three') {\n\t\t\treturn this.appendThreeRendererNodes(parent, newChild);\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'platform' && cRS[NgtRendererClassId.type] === 'three') {\n\t\t\t// if platform has parent, delegate to that parent\n\t\t\tif (pRS[NgtRendererClassId.parent]) {\n\t\t\t\t// but track the child for this parent as well\n\t\t\t\taddRendererChildNode(parent, newChild);\n\t\t\t\treturn this.appendChild(pRS[NgtRendererClassId.parent], newChild);\n\t\t\t}\n\n\t\t\t// platform can also have normal parentNode\n\t\t\tconst platformParentNode = this.delegateRenderer.parentNode(parent);\n\t\t\tif (platformParentNode) {\n\t\t\t\treturn this.appendChild(platformParentNode, newChild);\n\t\t\t}\n\n\t\t\t// if not, set up parent and child relationship for this pair then bail\n\t\t\tthis.setNodeRelationship(parent, newChild);\n\t\t\treturn;\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'three' && cRS[NgtRendererClassId.type] === 'platform') {\n\t\t\tif (!cRS[NgtRendererClassId.parent]) {\n\t\t\t\tsetRendererParentNode(newChild, parent);\n\t\t\t}\n\n\t\t\tfor (const child of cRS[NgtRendererClassId.children]) {\n\t\t\t\tthis.appendChild(parent, child);\n\t\t\t}\n\n\t\t\tfor (const platformChildNode of newChild['childNodes'] || []) {\n\t\t\t\tif (\n\t\t\t\t\t!isRendererNode(platformChildNode) ||\n\t\t\t\t\tplatformChildNode.__ngt_renderer__[NgtRendererClassId.type] !== 'platform'\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\t\t\t\tthis.appendChild(parent, platformChildNode);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'portal' && cRS[NgtRendererClassId.type] === 'three') {\n\t\t\tif (!cRS[NgtRendererClassId.parent] && pRS[NgtRendererClassId.portalContainer]) {\n\t\t\t\treturn this.appendChild(pRS[NgtRendererClassId.portalContainer], newChild);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'platform' && cRS[NgtRendererClassId.type] === 'portal') {\n\t\t\treturn this.delegateRenderer.appendChild(parent, newChild);\n\t\t}\n\n\t\treturn delegatedFn();\n\t}\n\n\tinsertBefore(\n\t\tparent: NgtRendererNode,\n\t\tnewChild: NgtRendererNode,\n\t\trefChild: NgtRendererNode,\n\t\tisMove?: boolean,\n\t): void {\n\t\t// if both are comments and the reference child is NgtCanvasContent, we'll assign the same flag to the newChild\n\t\t// this means that the NgtCanvas component is embedding. This flag allows the Renderer to get the root scene\n\t\t// when it tries to attach the template under `ng-template[canvasContent]`\n\t\tif (\n\t\t\trefChild &&\n\t\t\trefChild[NGT_CANVAS_CONTENT_FLAG] &&\n\t\t\trefChild instanceof Comment &&\n\t\t\tnewChild instanceof Comment\n\t\t) {\n\t\t\tObject.assign(newChild, { [NGT_CANVAS_CONTENT_FLAG]: refChild[NGT_CANVAS_CONTENT_FLAG] });\n\t\t}\n\n\t\t// if there is no parent, we delegate\n\t\tif (!parent) {\n\t\t\treturn this.delegateRenderer.insertBefore(parent, newChild, refChild, isMove);\n\t\t}\n\n\t\treturn this.appendChild(parent, newChild, refChild, isMove);\n\t}\n\n\tremoveChild(parent: NgtRendererNode, oldChild: NgtRendererNode, isHostElement?: boolean): void {\n\t\tif (parent === null) {\n\t\t\tparent = this.parentNode(oldChild);\n\t\t}\n\n\t\tconst cRS = oldChild.__ngt_renderer__;\n\n\t\tif (!cRS) {\n\t\t\ttry {\n\t\t\t\treturn this.delegateRenderer.removeChild(parent, oldChild, isHostElement);\n\t\t\t} catch {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// disassociate things from oldChild\n\t\tcRS[NgtRendererClassId.parent] = null;\n\n\t\t// if parent is still undefined\n\t\tif (parent == null) {\n\t\t\tif (cRS[NgtRendererClassId.destroyed]) {\n\t\t\t\t// if the child is already destroyed, just skip\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn('[NGT dev mode] parent is not found when remove child', { parent, oldChild });\n\t\t\treturn;\n\t\t}\n\n\t\tconst pRS = parent.__ngt_renderer__;\n\n\t\tif (!pRS) {\n\t\t\treturn this.delegateRenderer.removeChild(parent, oldChild, isHostElement);\n\t\t}\n\n\t\tconst childIndex = pRS[NgtRendererClassId.children].indexOf(oldChild);\n\t\tif (childIndex >= 0) {\n\t\t\t// disassociate oldChild from parent children\n\t\t\tpRS[NgtRendererClassId.children].splice(childIndex, 1);\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'three' && cRS[NgtRendererClassId.type] === 'three') {\n\t\t\treturn removeThreeChild(oldChild as unknown as NgtInstanceNode, parent as unknown as NgtInstanceNode, true);\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'platform' && cRS[NgtRendererClassId.type] === 'platform') {\n\t\t\treturn this.delegateRenderer.removeChild(parent, oldChild, isHostElement);\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'three' && cRS[NgtRendererClassId.type] === 'platform') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'platform' && cRS[NgtRendererClassId.type] === 'three') {\n\t\t\tconst childLS = getInstanceState(oldChild);\n\t\t\tif (!childLS) return;\n\n\t\t\tconst threeParent = childLS.parent ? untracked(childLS.parent) : null;\n\t\t\tif (!threeParent) return;\n\n\t\t\treturn this.removeChild(threeParent as unknown as NgtRendererNode, oldChild);\n\t\t}\n\n\t\treturn this.delegateRenderer.removeChild(parent, oldChild, isHostElement);\n\t}\n\n\tparentNode(node: NgtRendererNode) {\n\t\tif (\n\t\t\tnode &&\n\t\t\t(node[NGT_CANVAS_CONTENT_FLAG] || node[NGT_PORTAL_CONTENT_FLAG]) &&\n\t\t\tnode instanceof Comment &&\n\t\t\tisRendererNode(node)\n\t\t) {\n\t\t\tconst store = node[NGT_CANVAS_CONTENT_FLAG] || node[NGT_PORTAL_CONTENT_FLAG];\n\n\t\t\t// this should not happen but if it does, we'll delegate to the renderer\n\t\t\tif (!store) {\n\t\t\t\treturn this.delegateRenderer.parentNode(node);\n\t\t\t}\n\n\t\t\tconst rootScene = store.snapshot.scene;\n\n\t\t\t// if we don't have the scene yet, bail again\n\t\t\tif (!rootScene) {\n\t\t\t\treturn this.delegateRenderer.parentNode(node);\n\t\t\t}\n\n\t\t\t// if root scene is not a renderer node, we'll make it a renderer node here\n\t\t\tif (!(NGT_RENDERER_NODE_FLAG in rootScene)) {\n\t\t\t\tconst sceneRendererNode = createRendererNode('three', rootScene, this.document);\n\t\t\t\t// set parent to the comment too\n\t\t\t\tsetRendererParentNode(node, sceneRendererNode);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tnode[NGT_PORTAL_CONTENT_FLAG] &&\n\t\t\t\tnode[NGT_DOM_PARENT_FLAG] &&\n\t\t\t\tisRendererNode(node[NGT_DOM_PARENT_FLAG])\n\t\t\t) {\n\t\t\t\tconst portalContentParent = node[NGT_DOM_PARENT_FLAG] as NgtRendererNode<'portal'>;\n\t\t\t\tconst portalContentParentRS = portalContentParent.__ngt_renderer__;\n\t\t\t\tif (!portalContentParentRS[NgtRendererClassId.portalContainer]) {\n\t\t\t\t\tportalContentParentRS[NgtRendererClassId.portalContainer] = rootScene;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn rootScene;\n\t\t}\n\n\t\tconst rendererParentNode = node.__ngt_renderer__?.[NgtRendererClassId.parent];\n\t\t// returns the renderer parent node if it exists, otherwise returns the delegateRenderer parentNode\n\t\treturn rendererParentNode ?? this.delegateRenderer.parentNode(node);\n\t}\n\n\tremoveAttribute(el: NgtRendererNode, name: string, namespace?: string | null): void {\n\t\tconst rS = el.__ngt_renderer__;\n\t\tif (!rS || rS[NgtRendererClassId.destroyed]) return this.delegateRenderer.removeAttribute(el, name, namespace);\n\n\t\tif (rS[NgtRendererClassId.type] === 'three') {\n\t\t\treturn;\n\t\t}\n\t\treturn this.delegateRenderer.removeAttribute(el, name, namespace);\n\t}\n\n\tsetAttribute(el: NgtRendererNode, name: string, value: string, namespace?: string | null): void {\n\t\tconst rS = el.__ngt_renderer__;\n\t\tif (!rS) return this.delegateRenderer.setAttribute(el, name, value, namespace);\n\n\t\tif (rS[NgtRendererClassId.destroyed]) {\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn(`[NGT dev mode] setAttribute is invoked on destroyed renderer node.`, { el, name, value });\n\t\t\treturn;\n\t\t}\n\n\t\tif (rS[NgtRendererClassId.type] === 'three') {\n\t\t\tif (name === 'attach') {\n\t\t\t\tconst paths = value.split('.');\n\t\t\t\tif (paths.length) {\n\t\t\t\t\tconst instanceState = getInstanceState(el);\n\t\t\t\t\tif (instanceState) instanceState.attach = paths;\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// coercion for primitive values\n\t\t\tlet maybeCoerced: string | number | boolean = value;\n\n\t\t\tif (maybeCoerced === '' || maybeCoerced === 'true' || maybeCoerced === 'false') {\n\t\t\t\tmaybeCoerced = maybeCoerced === 'true' || maybeCoerced === '';\n\t\t\t} else {\n\t\t\t\tconst maybeNumber = Number(maybeCoerced);\n\t\t\t\tif (!isNaN(maybeNumber)) maybeCoerced = maybeNumber;\n\t\t\t}\n\n\t\t\tif (name === 'rawValue') {\n\t\t\t\trS[NgtRendererClassId.rawValue] = maybeCoerced;\n\t\t\t} else {\n\t\t\t\tapplyProps(el, { [name]: maybeCoerced });\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.delegateRenderer.setAttribute(el, name, value, namespace);\n\t}\n\n\tsetProperty(el: NgtRendererNode, name: string, value: any): void {\n\t\t// NOTE: untrack all signal updates because this is during setProperty which is a reactive context\n\t\t// attaching potentially updates signals which is not allowed\n\n\t\tconst rS = el.__ngt_renderer__;\n\n\t\tif (!rS || rS[NgtRendererClassId.destroyed]) {\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn('[NGT dev mode] setProperty is invoked on destroyed renderer node.', { el, name, value });\n\t\t\treturn;\n\t\t}\n\n\t\tif (rS[NgtRendererClassId.type] === 'three') {\n\t\t\tconst instanceState = getInstanceState(el);\n\t\t\tconst parent = instanceState?.hierarchyStore.snapshot.parent || rS[NgtRendererClassId.parent];\n\n\t\t\tif (name === 'parameters') {\n\t\t\t\t// NOTE: short-cut for null raycast to prevent upstream from creating a nullRaycast property\n\t\t\t\tif ('raycast' in value && value['raycast'] === null) {\n\t\t\t\t\tvalue['raycast'] = () => null;\n\t\t\t\t}\n\n\t\t\t\tapplyProps(el, value);\n\n\t\t\t\tif ('geometry' in value && is.three<THREE.BufferGeometry>(value['geometry'], 'isBufferGeometry')) {\n\t\t\t\t\tuntracked(() => instanceState?.updateGeometryStamp());\n\t\t\t\t}\n\n\t\t\t\tif ('attach' in value && value['attach'] !== undefined) {\n\t\t\t\t\tif (instanceState) instanceState.attach = this.normalizeAttach(value['attach']);\n\t\t\t\t\tif (parent) untracked(() => attachThreeNodes(parent, el as unknown as NgtInstanceNode));\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// [rawValue]\n\t\t\tif (instanceState?.type === 'ngt-value' && name === 'rawValue') {\n\t\t\t\trS[NgtRendererClassId.rawValue] = value;\n\t\t\t\tif (parent) untracked(() => attachThreeNodes(parent, el as unknown as NgtInstanceNode));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// [attach]\n\t\t\tif (name === 'attach') {\n\t\t\t\tif (instanceState) instanceState.attach = this.normalizeAttach(value);\n\t\t\t\tif (parent) untracked(() => attachThreeNodes(parent, el as unknown as NgtInstanceNode));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// NOTE: short-cut for null raycast to prevent upstream from creating a nullRaycast property\n\t\t\tif (name === 'raycast' && value === null) {\n\t\t\t\tvalue = () => null;\n\t\t\t}\n\n\t\t\tapplyProps(el, { [name]: value });\n\n\t\t\tif (instanceState && name === 'geometry' && is.three<THREE.BufferGeometry>(value, 'isBufferGeometry')) {\n\t\t\t\tuntracked(() => {\n\t\t\t\t\tinstanceState.updateGeometryStamp();\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.delegateRenderer.setProperty(el, name, value);\n\t}\n\n\tlisten(\n\t\ttarget: 'window' | 'document' | 'body' | NgtRendererNode,\n\t\teventName: string,\n\t\tcallback: (event: any) => boolean | void,\n\t): () => void {\n\t\tif (typeof target === 'string') {\n\t\t\treturn this.delegateRenderer.listen(target, eventName, callback);\n\t\t}\n\n\t\tconst rS = target.__ngt_renderer__;\n\t\tif (!rS) {\n\t\t\treturn this.delegateRenderer.listen(target, eventName, callback);\n\t\t}\n\n\t\tif (rS[NgtRendererClassId.destroyed]) return () => {};\n\n\t\tif (rS[NgtRendererClassId.type] === 'three') {\n\t\t\tconst iS = getInstanceState(target);\n\t\t\tif (!iS) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'[NGT] instance which has not been prepared cannot have events. Call `prepare()` manually if needed.',\n\t\t\t\t);\n\t\t\t\treturn () => {};\n\t\t\t}\n\n\t\t\tif (eventName === 'created') {\n\t\t\t\tcallback(target);\n\t\t\t\treturn () => {};\n\t\t\t}\n\n\t\t\tif (eventName === 'attached') {\n\t\t\t\tiS.onAttach = callback;\n\t\t\t\tconst parent = iS.parent && untracked(iS.parent);\n\t\t\t\tif (parent) iS.onAttach({ parent, node: target as unknown as NgtInstanceNode });\n\t\t\t\treturn () => {\n\t\t\t\t\tiS.onAttach = undefined;\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (eventName === 'updated') {\n\t\t\t\tiS.onUpdate = callback;\n\t\t\t\treturn () => {\n\t\t\t\t\tiS.onUpdate = undefined;\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (THREE_NATIVE_EVENTS.includes(eventName) && target instanceof THREE.EventDispatcher) {\n\t\t\t\t// NOTE: rename to dispose because that's the event type, not disposed.\n\t\t\t\tif (eventName === 'disposed') {\n\t\t\t\t\teventName = 'dispose';\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(target as unknown as THREE.Object3D).parent &&\n\t\t\t\t\t(eventName === 'added' || eventName === 'removed')\n\t\t\t\t) {\n\t\t\t\t\tcallback({ type: eventName, target });\n\t\t\t\t}\n\n\t\t\t\ttarget.addEventListener(eventName, callback);\n\t\t\t\treturn () => {\n\t\t\t\t\ttarget.removeEventListener(eventName, callback);\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst cleanup = iS.setPointerEvent?.(eventName as keyof NgtEventHandlers, callback) || (() => {});\n\n\t\t\t// this means the object has already been attached to the parent and has its store propagated\n\t\t\tif (iS.store) iS.addInteraction?.(iS.store);\n\n\t\t\treturn cleanup;\n\t\t}\n\n\t\treturn this.delegateRenderer.listen(target, eventName, callback);\n\t}\n\n\tprivate appendThreeRendererNodes(parent: NgtRendererNode, child: NgtRendererNode) {\n\t\t// if parent and child are the same, skip\n\t\tif (parent === child) {\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn('[NGT dev mode] appending THREE.js parent and child but they are the same', {\n\t\t\t\t\tparent,\n\t\t\t\t\tchild,\n\t\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst cIS = getInstanceState(child);\n\n\t\t// if child is already attached to a parent, skip\n\t\tif (cIS?.hierarchyStore.snapshot.parent) {\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn('[NGT dev mode] appending THREE.js parent and child but child is already attached', {\n\t\t\t\t\tparent,\n\t\t\t\t\tchild,\n\t\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// set the relationship\n\t\tthis.setNodeRelationship(parent, child);\n\n\t\t// attach THREE child\n\t\tattachThreeNodes(parent as unknown as NgtInstanceNode, child as unknown as NgtInstanceNode);\n\t\treturn;\n\t}\n\n\tprivate setNodeRelationship(parent: NgtRendererNode, child: NgtRendererNode) {\n\t\tsetRendererParentNode(child, parent);\n\t\taddRendererChildNode(parent, child);\n\t}\n\n\tprivate getNgtDirective<TDirective extends NgtCommonDirective<any>>(\n\t\tdirective: Type<TDirective>,\n\t\tinjectors: Array<Injector>,\n\t) {\n\t\tlet directiveInstance: TDirective | undefined;\n\n\t\tlet i = injectors.length - 1;\n\t\twhile (i >= 0) {\n\t\t\tconst injector = injectors[i];\n\t\t\tconst instance = injector.get(directive, null);\n\t\t\tif (instance && typeof instance === 'object' && instance.validate()) {\n\t\t\t\tdirectiveInstance = instance;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti--;\n\t\t}\n\n\t\treturn directiveInstance;\n\t}\n\n\tprivate normalizeAttach(attach: NgtAttachable) {\n\t\tif (typeof attach === 'function') return attach;\n\t\tif (typeof attach === 'string') return attach.split('.');\n\t\treturn attach.flatMap((item) => item.toString().split('.'));\n\t}\n\n\taddClass = this.delegateRenderer.addClass.bind(this.delegateRenderer);\n\tremoveClass = this.delegateRenderer.removeClass.bind(this.delegateRenderer);\n\tsetStyle = this.delegateRenderer.setStyle.bind(this.delegateRenderer);\n\tremoveStyle = this.delegateRenderer.removeStyle.bind(this.delegateRenderer);\n\tselectRootElement = this.delegateRenderer.selectRootElement.bind(this.delegateRenderer);\n\tnextSibling = this.delegateRenderer.nextSibling.bind(this.delegateRenderer);\n\tsetValue = this.delegateRenderer.setValue.bind(this.delegateRenderer);\n}\n","import { DOCUMENT, ElementRef, InjectOptions, InjectionToken, effect, inject } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport * as THREE from 'three';\nimport { injectLoop } from './loop';\nimport { NGT_RENDERER_OPTIONS } from './renderer/renderer';\nimport type {\n\tNgtBeforeRenderRecord,\n\tNgtCamera,\n\tNgtDpr,\n\tNgtEventManager,\n\tNgtFrameloop,\n\tNgtSize,\n\tNgtState,\n\tNgtXRManager,\n} from './types';\nimport { is } from './utils/is';\nimport { makeDpr, makeId } from './utils/make';\nimport { SignalState, signalState } from './utils/signal-state';\nimport { updateCamera } from './utils/update';\n\n/**\n * Factory function to create the Angular Three store.\n *\n * Creates and initializes the central state management store for the Angular Three application.\n * This store contains all the state needed for rendering including the WebGL renderer, camera, scene,\n * raycaster, and internal state for managing the render loop and event handling.\n *\n * @returns A SignalState containing the NgtState object with reactive signals for all state properties\n *\n * @example\n * ```typescript\n * // Usually provided automatically by NgtCanvas\n * providers: [{ provide: NGT_STORE, useFactory: storeFactory }]\n * ```\n */\nexport function storeFactory() {\n\tconst { invalidate, advance } = injectLoop();\n\tconst rendererOptions = inject(NGT_RENDERER_OPTIONS, { optional: true }) || {};\n\tconst document = inject(DOCUMENT);\n\tconst window = document.defaultView || undefined;\n\n\t// NOTE: using Subject because we do not care about late-subscribers\n\tconst pointerMissed$ = new Subject<MouseEvent>();\n\n\tconst position = new THREE.Vector3();\n\tconst defaultTarget = new THREE.Vector3();\n\tconst tempTarget = new THREE.Vector3();\n\n\tlet performanceTimeout: ReturnType<typeof setTimeout> | undefined = undefined;\n\n\tconst pointer = new THREE.Vector2();\n\n\t// getCurrentViewport will mutate this instead of creating a new object everytime\n\tconst tempViewport = {\n\t\twidth: 0,\n\t\theight: 0,\n\t\ttop: 0,\n\t\tleft: 0,\n\t\tfactor: 1,\n\t\tdistance: 0,\n\t\taspect: 0,\n\t};\n\n\tconst store: SignalState<NgtState> = signalState<NgtState>({\n\t\tid: makeId(),\n\t\tmaxNotificationSkipCount: rendererOptions.maxNotificationSkipCount || 5,\n\t\tpointerMissed$: pointerMissed$.asObservable(),\n\t\tevents: { priority: 1, enabled: true, connected: false },\n\n\t\t// Mock objects that have to be configured\n\t\tgl: null as unknown as THREE.WebGLRenderer,\n\t\tcamera: null as unknown as NgtCamera,\n\t\traycaster: null as unknown as THREE.Raycaster,\n\t\tscene: null as unknown as THREE.Scene,\n\t\txr: null as unknown as NgtXRManager,\n\n\t\tinvalidate: (frames = 1) => invalidate(store, frames),\n\t\tadvance: (timestamp: number, runGlobalEffects?: boolean) => advance(timestamp, runGlobalEffects, store),\n\n\t\tlegacy: false,\n\t\tlinear: false,\n\t\tflat: false,\n\n\t\tcontrols: null,\n\t\tclock: new THREE.Clock(),\n\t\tpointer,\n\n\t\tframeloop: 'always',\n\n\t\tperformance: {\n\t\t\tcurrent: 1,\n\t\t\tmin: 0.5,\n\t\t\tmax: 1,\n\t\t\tdebounce: 200,\n\t\t\tregress: () => {\n\t\t\t\tconst state = store.snapshot;\n\t\t\t\t// Clear timeout\n\t\t\t\tif (performanceTimeout) clearTimeout(performanceTimeout);\n\t\t\t\t// Set lower bound performance\n\t\t\t\tif (state.performance.current !== state.performance.min)\n\t\t\t\t\tstore.update((state) => ({\n\t\t\t\t\t\tperformance: { ...state.performance, current: state.performance.min },\n\t\t\t\t\t}));\n\t\t\t\t// Go back to upper bound performance after a while unless something regresses meanwhile\n\t\t\t\tperformanceTimeout = setTimeout(\n\t\t\t\t\t() =>\n\t\t\t\t\t\tstore.update((state) => ({\n\t\t\t\t\t\t\tperformance: { ...state.performance, current: store.snapshot.performance.max },\n\t\t\t\t\t\t})),\n\t\t\t\t\tstate.performance.debounce,\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\n\t\tsize: { width: 0, height: 0, top: 0, left: 0 },\n\t\tviewport: {\n\t\t\tinitialDpr: window?.devicePixelRatio || 1,\n\t\t\tdpr: window?.devicePixelRatio || 1,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\ttop: 0,\n\t\t\tleft: 0,\n\t\t\taspect: 0,\n\t\t\tdistance: 0,\n\t\t\tfactor: 0,\n\t\t\tgetCurrentViewport(\n\t\t\t\tcamera: NgtCamera = store.snapshot.camera,\n\t\t\t\ttarget: THREE.Vector3 | Parameters<THREE.Vector3['set']> = defaultTarget,\n\t\t\t\tsize: NgtSize = store.snapshot.size,\n\t\t\t) {\n\t\t\t\tconst { width, height, top, left } = size;\n\t\t\t\tconst aspect = width / height;\n\n\t\t\t\tif ((target as THREE.Vector3).isVector3) tempTarget.copy(target as THREE.Vector3);\n\t\t\t\telse tempTarget.set(...(target as Parameters<THREE.Vector3['set']>));\n\n\t\t\t\tconst distance = camera.getWorldPosition(position).distanceTo(tempTarget);\n\n\t\t\t\t// Update the pre-allocated viewport object\n\t\t\t\ttempViewport.top = top;\n\t\t\t\ttempViewport.left = left;\n\t\t\t\ttempViewport.aspect = aspect;\n\t\t\t\ttempViewport.distance = distance;\n\n\t\t\t\tif (is.three<THREE.OrthographicCamera>(camera, 'isOrthographicCamera')) {\n\t\t\t\t\t// For orthographic cameras\n\t\t\t\t\ttempViewport.width = width / camera.zoom;\n\t\t\t\t\ttempViewport.height = height / camera.zoom;\n\t\t\t\t\ttempViewport.factor = 1;\n\t\t\t\t} else {\n\t\t\t\t\t// For perspective cameras\n\t\t\t\t\tconst fov = (camera.fov * Math.PI) / 180; // convert vertical fov to radians\n\t\t\t\t\tconst h = 2 * Math.tan(fov / 2) * distance; // visible height\n\t\t\t\t\tconst w = h * aspect; // visible width\n\t\t\t\t\ttempViewport.width = w;\n\t\t\t\t\ttempViewport.height = h;\n\t\t\t\t\ttempViewport.factor = width / w;\n\t\t\t\t}\n\n\t\t\t\treturn tempViewport;\n\t\t\t},\n\t\t},\n\n\t\tsetEvents: (events: Partial<NgtEventManager<any>>) =>\n\t\t\tstore.update((state) => ({ events: { ...state.events, ...events } })),\n\t\tsetSize: (width: number, height: number, top?: number, left?: number) => {\n\t\t\tconst camera = store.snapshot.camera;\n\t\t\tconst size = { width, height, top: top ?? 0, left: left ?? 0 };\n\n\t\t\tstore.update((state) => ({\n\t\t\t\tsize,\n\t\t\t\tviewport: {\n\t\t\t\t\t...state.viewport,\n\t\t\t\t\t...state.viewport.getCurrentViewport(camera, defaultTarget, size),\n\t\t\t\t},\n\t\t\t}));\n\t\t},\n\t\tsetDpr: (dpr: NgtDpr) => {\n\t\t\tconst resolved = makeDpr(dpr, window);\n\t\t\tstore.update((state) => ({\n\t\t\t\tviewport: { ...state.viewport, dpr: resolved, initialDpr: state.viewport.initialDpr || resolved },\n\t\t\t}));\n\t\t},\n\t\tsetFrameloop: (frameloop?: NgtFrameloop) => {\n\t\t\tconst clock = store.snapshot.clock;\n\n\t\t\t// if frameloop === \"never\" clock.elapsedTime is updated using advance(timestamp)\n\t\t\tclock.stop();\n\t\t\tclock.elapsedTime = 0;\n\n\t\t\tif (frameloop !== 'never') {\n\t\t\t\tclock.start();\n\t\t\t\tclock.elapsedTime = 0;\n\t\t\t}\n\n\t\t\tstore.update(() => ({ frameloop }));\n\t\t},\n\t\tpreviousRoot: null,\n\t\tinternal: {\n\t\t\tactive: false,\n\t\t\tpriority: 0,\n\t\t\tframes: 0,\n\t\t\tlastEvent: new ElementRef(null),\n\t\t\tinteraction: [],\n\t\t\thovered: new Map(),\n\t\t\tcapturedMap: new Map(),\n\t\t\tinitialClick: [0, 0],\n\t\t\tinitialHits: [],\n\t\t\tsubscribers: [],\n\t\t\tsubscribe: (\n\t\t\t\tcallback: NgtBeforeRenderRecord['callback'],\n\t\t\t\tpriority = 0,\n\t\t\t\t_store: SignalState<NgtState> = store,\n\t\t\t) => {\n\t\t\t\tconst internal = _store.snapshot.internal;\n\t\t\t\t// If this subscription was given a priority, it takes rendering into its own hands\n\t\t\t\t// For that reason we switch off automatic rendering and increase the manual flag\n\t\t\t\t// As long as this flag is positive there can be no internal rendering at all\n\t\t\t\t// because there could be multiple render subscriptions\n\t\t\t\tinternal.priority = internal.priority + (priority > 0 ? 1 : 0);\n\t\t\t\tinternal.subscribers.push({ callback, priority, store: _store });\n\t\t\t\t// Register subscriber and sort layers from lowest to highest, meaning,\n\t\t\t\t// highest priority renders last (on top of the other frames)\n\t\t\t\tinternal.subscribers = internal.subscribers.sort((a, b) => (a.priority || 0) - (b.priority || 0));\n\n\t\t\t\treturn () => {\n\t\t\t\t\tconst internal = _store.snapshot.internal;\n\t\t\t\t\tif (internal?.subscribers) {\n\t\t\t\t\t\t// Decrease manual flag if this subscription had a priority\n\t\t\t\t\t\tinternal.priority = internal.priority - (priority > 0 ? 1 : 0);\n\t\t\t\t\t\t// Remove subscriber from list\n\t\t\t\t\t\tinternal.subscribers = internal.subscribers.filter((s) => s.callback !== callback);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t});\n\n\tObject.defineProperty(store, '__pointerMissed$', { get: () => pointerMissed$ });\n\n\tlet {\n\t\tsize: oldSize,\n\t\tviewport: { dpr: oldDpr },\n\t\tcamera: oldCamera,\n\t} = store.snapshot;\n\n\teffect(() => {\n\t\tconst [newCamera, newSize, newDpr, gl] = [store.camera(), store.size(), store.viewport.dpr(), store.gl()];\n\n\t\t// Resize camera and renderer on changes to size and pixel-ratio\n\t\tif (newSize !== oldSize || newDpr !== oldDpr) {\n\t\t\toldSize = newSize;\n\t\t\toldDpr = newDpr;\n\t\t\t// Update camera & renderer\n\t\t\tupdateCamera(newCamera, newSize);\n\t\t\tgl.setPixelRatio(newDpr);\n\n\t\t\tconst updateStyle = typeof HTMLCanvasElement !== 'undefined' && gl.domElement instanceof HTMLCanvasElement;\n\t\t\tgl.setSize(newSize.width, newSize.height, updateStyle);\n\t\t}\n\n\t\t// Update viewport once the camera changes\n\t\tif (newCamera !== oldCamera) {\n\t\t\toldCamera = newCamera;\n\t\t\tupdateCamera(newCamera, newSize);\n\t\t\t// Update viewport\n\t\t\tstore.update((state) => ({\n\t\t\t\tviewport: { ...state.viewport, ...state.viewport.getCurrentViewport(newCamera) },\n\t\t\t}));\n\t\t}\n\t});\n\n\treturn store;\n}\n\n/**\n * Injection token for the Angular Three store.\n *\n * Use this token to access the store directly via Angular's dependency injection system.\n * The store contains the complete state of the Three.js scene including renderer, camera, scene, and more.\n *\n * @example\n * ```typescript\n * const store = inject(NGT_STORE);\n * const camera = store.camera();\n * ```\n */\nexport const NGT_STORE = new InjectionToken<SignalState<NgtState>>('NgtStore Token');\n\n/**\n * Injects the Angular Three store into the current injection context.\n *\n * This is the primary way to access the store in components, directives, and services.\n * The store provides reactive signals for all Three.js state including the renderer,\n * camera, scene, raycaster, and more.\n *\n * @param options - Optional injection options (e.g., { optional: true, skipSelf: true })\n * @returns The Angular Three store as a SignalState, or null if optional and not found\n *\n * @example\n * ```typescript\n * // In a component or directive\n * const store = injectStore();\n *\n * // Access reactive state\n * const camera = store.camera();\n * const scene = store.scene();\n *\n * // Access snapshot (non-reactive)\n * const { gl, size } = store.snapshot;\n * ```\n */\nexport function injectStore(options: InjectOptions & { optional?: false }): SignalState<NgtState>;\nexport function injectStore(options: InjectOptions): SignalState<NgtState> | null;\nexport function injectStore(): SignalState<NgtState>;\nexport function injectStore(options?: InjectOptions) {\n\treturn inject(NGT_STORE, options as InjectOptions);\n}\n","import { ElementRef } from '@angular/core';\nimport { is } from './is';\n\n/**\n * Resolves a value that may be wrapped in an Angular ElementRef.\n *\n * If the value is an ElementRef, returns its nativeElement.\n * Otherwise, returns the value directly.\n *\n * @typeParam TObject - The type of the object\n * @param ref - An ElementRef or direct value\n * @returns The unwrapped value\n *\n * @example\n * ```typescript\n * // With ElementRef\n * const mesh = resolveRef(meshRef); // returns meshRef.nativeElement\n *\n * // With direct value\n * const mesh = resolveRef(myMesh); // returns myMesh\n * ```\n */\nexport function resolveRef<TObject>(ref: ElementRef<TObject | undefined> | TObject | undefined): TObject | undefined {\n\tif (is.ref(ref)) {\n\t\treturn ref.nativeElement;\n\t}\n\n\treturn ref;\n}\n","import { computed, Directive, ElementRef, input, linkedSignal } from '@angular/core';\nimport type * as THREE from 'three';\nimport {\n\tNGT_INTERNAL_ADD_COMMENT_FLAG,\n\tNGT_INTERNAL_SET_PARENT_COMMENT_FLAG,\n\tNGT_PARENT_FLAG,\n} from '../renderer/constants';\nimport { injectStore } from '../store';\nimport { NgtNullish } from '../types';\nimport { resolveRef } from '../utils/resolve-ref';\nimport { NgtCommonDirective } from './common';\n\n/**\n * Structural directive for specifying a custom parent for Three.js objects.\n *\n * By default, Three.js objects are parented to the nearest Object3D ancestor in the template.\n * The `NgtParent` directive allows you to override this behavior and specify a different parent.\n *\n * The parent can be specified as:\n * - A string (name of an object in the scene)\n * - A THREE.Object3D reference\n * - An ElementRef containing a THREE.Object3D\n * - A Signal of any of the above\n *\n * @example\n * ```html\n * <!-- Parent to a named object in the scene -->\n * <ngt-mesh *parent=\"'myGroup'\">\n * <ngt-box-geometry />\n * </ngt-mesh>\n *\n * <!-- Parent to a reference -->\n * <ngt-mesh *parent=\"myGroupRef\">\n * <ngt-box-geometry />\n * </ngt-mesh>\n * ```\n */\n@Directive({ selector: 'ng-template[parent]' })\nexport class NgtParent extends NgtCommonDirective<THREE.Object3D | null | undefined> {\n\tparent = input.required<\n\t\t| string\n\t\t| THREE.Object3D\n\t\t| ElementRef<THREE.Object3D>\n\t\t| (() => NgtNullish<ElementRef<THREE.Object3D> | THREE.Object3D | string>)\n\t>();\n\n\tprivate store = injectStore();\n\n\tprivate _parent = computed(() => {\n\t\tconst parent = this.parent();\n\t\tconst rawParent = typeof parent === 'function' ? parent() : parent;\n\t\tif (!rawParent) return null;\n\n\t\tconst scene = this.store.scene();\n\t\tif (typeof rawParent === 'string') {\n\t\t\treturn scene.getObjectByName(rawParent);\n\t\t}\n\n\t\treturn resolveRef(rawParent);\n\t});\n\n\tprotected linkedValue = linkedSignal(this._parent);\n\tprotected shouldSkipRender = computed(() => !this._parent());\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tconst commentNode = this.commentNode;\n\t\tcommentNode.data = NGT_PARENT_FLAG;\n\t\tcommentNode[NGT_PARENT_FLAG] = true;\n\n\t\tif (commentNode[NGT_INTERNAL_ADD_COMMENT_FLAG]) {\n\t\t\tcommentNode[NGT_INTERNAL_ADD_COMMENT_FLAG]('parent', this.injector);\n\t\t\tdelete commentNode[NGT_INTERNAL_ADD_COMMENT_FLAG];\n\t\t}\n\t}\n\n\tvalidate() {\n\t\treturn !this.injected && !!this.injectedValue;\n\t}\n\n\tprotected override beforeCreateView() {\n\t\tconst commentNode = this.commentNode;\n\t\tif (commentNode[NGT_INTERNAL_SET_PARENT_COMMENT_FLAG]) {\n\t\t\tcommentNode[NGT_INTERNAL_SET_PARENT_COMMENT_FLAG](this.injectedValue);\n\t\t}\n\t}\n}\n","import { booleanAttribute, Directive, effect, ElementRef, inject, input, signal, untracked } from '@angular/core';\nimport { Group, Mesh, Object3D } from 'three';\nimport { getInstanceState } from '../instance';\n\n/**\n * Directive for managing selection state of Three.js objects.\n *\n * This directive creates a selection context that child `NgtSelect` directives can use\n * to register themselves as selectable. The selection state is exposed as a readonly signal.\n *\n * @example\n * ```html\n * <ngt-group [selection]=\"true\">\n * <ngt-mesh [select]=\"isSelected()\">\n * <ngt-box-geometry />\n * </ngt-mesh>\n * </ngt-group>\n * ```\n */\n@Directive({ selector: '[selection]' })\nexport class NgtSelectionApi {\n\tenabled = input(true, { alias: 'selection', transform: booleanAttribute });\n\n\tprivate source = signal<Array<ElementRef<Object3D> | Object3D>>([]);\n\tselected = this.source.asReadonly();\n\n\tupdate(...args: Parameters<typeof this.source.update>) {\n\t\tif (!this.enabled()) return;\n\t\tthis.source.update(...args);\n\t}\n}\n\n/**\n * Directive for marking Three.js objects as selectable.\n *\n * When applied to a mesh or group, this directive registers the object with the parent\n * `NgtSelectionApi` when enabled. For groups, all child meshes are automatically registered.\n *\n * @example\n * ```html\n * <ngt-mesh [select]=\"true\">\n * <ngt-box-geometry />\n * </ngt-mesh>\n * ```\n */\n@Directive({ selector: 'ngt-group[select], ngt-mesh[select]' })\nexport class NgtSelect {\n\tenabled = input(false, { transform: booleanAttribute, alias: 'select' });\n\n\tconstructor() {\n\t\tconst elementRef = inject<ElementRef<Group | Mesh>>(ElementRef);\n\t\tconst selectionApi = inject(NgtSelectionApi);\n\n\t\teffect((onCleanup) => {\n\t\t\tconst selectionEnabled = selectionApi.enabled();\n\t\t\tif (!selectionEnabled) return;\n\n\t\t\tconst enabled = this.enabled();\n\t\t\tif (!enabled) return;\n\n\t\t\tconst host = elementRef.nativeElement;\n\t\t\tconst localState = getInstanceState(host);\n\t\t\tif (!localState) return;\n\n\t\t\t// ngt-mesh[select]\n\t\t\tif (host.type === 'Mesh') {\n\t\t\t\tselectionApi.update((prev) => [...prev, host]);\n\t\t\t\tonCleanup(() => selectionApi.update((prev) => prev.filter((el) => el !== host)));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [collection] = [untracked(selectionApi.selected), localState.objects()];\n\t\t\tlet changed = false;\n\t\t\tconst current: Object3D[] = [];\n\t\t\thost.traverse((child) => {\n\t\t\t\tchild.type === 'Mesh' && current.push(child);\n\t\t\t\tif (collection.indexOf(child) === -1) changed = true;\n\t\t\t});\n\n\t\t\tif (!changed) return;\n\n\t\t\tselectionApi.update((prev) => [...prev, ...current]);\n\t\t\tonCleanup(() => {\n\t\t\t\tselectionApi.update((prev) => prev.filter((el) => !current.includes(el as Object3D)));\n\t\t\t});\n\t\t});\n\t}\n}\n\n/**\n * Array containing NgtSelectionApi and NgtSelect directives for convenient importing.\n *\n * @example\n * ```typescript\n * @Component({\n * imports: [NgtSelection],\n * })\n * export class MyComponent {}\n * ```\n */\nexport const NgtSelection = [NgtSelectionApi, NgtSelect] as const;\n","import {\n\tAbstractType,\n\tDestroyRef,\n\tDirective,\n\tElementRef,\n\tinject,\n\tInjectionToken,\n\tProvider,\n\tProviderToken,\n\tType,\n} from '@angular/core';\nimport { NGT_DOM_PARENT_FLAG, NGT_HTML_FLAG } from './renderer/constants';\nimport { injectStore } from './store';\nimport { NgtAnyRecord } from './types';\n\nconst NGT_HTML_DOM_ELEMENT = new InjectionToken<'gl' | HTMLElement>('NGT_HTML_DOM_ELEMENT');\n\n/**\n * Provider function for configuring the DOM element for HTML components in Angular Three.\n *\n * This function creates a provider that specifies where HTML content should be rendered\n * relative to the Three.js canvas. By default, HTML content is appended to the canvas's parent element.\n *\n * @returns A provider for the HTML DOM element configuration\n *\n * @example\n * ```typescript\n * // Default: append to canvas parent\n * @Component({\n * providers: [provideHTMLDomElement()],\n * })\n *\n * // Custom element\n * @Component({\n * providers: [provideHTMLDomElement(() => document.getElementById('my-container')!)],\n * })\n * ```\n */\nexport function provideHTMLDomElement(): Provider;\nexport function provideHTMLDomElement(factory: () => HTMLElement): Provider;\nexport function provideHTMLDomElement<\n\tTDeps extends Array<ProviderToken<any>>,\n\tTValues extends {\n\t\t[K in keyof TDeps]: TDeps[K] extends Type<infer T> | AbstractType<infer T> | InjectionToken<infer T>\n\t\t\t? T\n\t\t\t: never;\n\t},\n>(deps: TDeps, factory: (...args: TValues) => HTMLElement): Provider;\nexport function provideHTMLDomElement(...args: any[]) {\n\tif (args.length === 0) {\n\t\treturn { provide: NGT_HTML_DOM_ELEMENT, useFactory: () => 'gl' };\n\t}\n\n\tif (args.length === 1) {\n\t\treturn { provide: NGT_HTML_DOM_ELEMENT, useFactory: args[0] };\n\t}\n\n\treturn { provide: NGT_HTML_DOM_ELEMENT, useFactory: args.pop(), deps: args };\n}\n\n/**\n * Abstract base directive for creating HTML components that render alongside the Three.js canvas.\n *\n * Extend this class to create components that render DOM elements positioned relative to the\n * Three.js scene. The DOM element will be appended to either the canvas's parent element\n * or a custom element specified via `provideHTMLDomElement`.\n *\n * @example\n * ```typescript\n * @Directive({ selector: '[myHtml]', providers: [provideHTMLDomElement()] })\n * export class MyHtmlDirective extends NgtHTML {\n * // Implementation\n * }\n * ```\n */\n@Directive()\nexport abstract class NgtHTML {\n\tstatic [NGT_HTML_FLAG] = true;\n\n\tprotected domElement = inject(NGT_HTML_DOM_ELEMENT, { self: true, optional: true });\n\n\tconstructor() {\n\t\tconst host = inject<ElementRef<HTMLElement>>(ElementRef);\n\t\tconst store = injectStore();\n\n\t\tif (this.domElement === 'gl') {\n\t\t\tObject.assign(host.nativeElement, {\n\t\t\t\t[NGT_DOM_PARENT_FLAG]: store.snapshot.gl.domElement.parentElement,\n\t\t\t});\n\t\t} else if (this.domElement) {\n\t\t\tObject.assign(host.nativeElement, { [NGT_DOM_PARENT_FLAG]: this.domElement });\n\t\t}\n\n\t\tinject(DestroyRef).onDestroy(() => {\n\t\t\t(host.nativeElement as NgtAnyRecord)[NGT_DOM_PARENT_FLAG] = null;\n\t\t\tdelete (host.nativeElement as NgtAnyRecord)[NGT_DOM_PARENT_FLAG];\n\t\t});\n\t}\n}\n","import { Injector, Signal, effect, signal } from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport * as THREE from 'three';\nimport type { NgtAnyRecord } from './types';\nimport { NgtObjectMap, makeObjectGraph } from './utils/make';\n\n/**\n * Type representing a GLTF-like object with a scene property.\n */\nexport type NgtGLTFLike = { scene: THREE.Object3D };\n\n/**\n * Interface for Three.js loaders that support async loading.\n *\n * @typeParam T - The type of data the loader returns\n */\nexport interface NgtLoader<T> extends THREE.Loader {\n\tload(\n\t\turl: string,\n\t\tonLoad?: (result: T) => void,\n\t\tonProgress?: (event: ProgressEvent) => void,\n\t\tonError?: (event: unknown) => void,\n\t): unknown;\n\tloadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<T>;\n}\n\n/**\n * Type representing a loader constructor.\n */\nexport type NgtLoaderProto<T> = new (...args: any) => NgtLoader<T extends unknown ? any : T>;\n\n/**\n * Utility type to extract the return type of a loader.\n */\nexport type NgtLoaderReturnType<T, L extends NgtLoaderProto<T>> = T extends unknown\n\t? Awaited<ReturnType<InstanceType<L>['loadAsync']>>\n\t: T;\n\n/**\n * Type for loader extension functions that configure the loader before use.\n */\nexport type NgtLoaderExtensions<T extends { prototype: NgtLoaderProto<any> }> = (loader: T['prototype']) => void;\n\n/**\n * Conditional type utility.\n */\nexport type NgtConditionalType<Child, Parent, Truthy, Falsy> = Child extends Parent ? Truthy : Falsy;\n\n/**\n * Branching return type utility.\n */\nexport type NgtBranchingReturn<T, Parent, Coerced> = NgtConditionalType<T, Parent, Coerced, T>;\n\n/**\n * Type representing the result of loading based on input type.\n * - String input returns a single result\n * - Array input returns an array of results\n * - Object input returns an object with the same keys and loaded values\n */\nexport type NgtLoaderResults<\n\tTInput extends string | string[] | Record<string, string>,\n\tTReturn,\n> = TInput extends string[] ? TReturn[] : TInput extends object ? { [key in keyof TInput]: TReturn } : TReturn;\n\nconst cached = new Map();\nconst memoizedLoaders = new WeakMap();\n\nfunction normalizeInputs(input: string | string[] | Record<string, string>) {\n\tlet urls: string[] = [];\n\tif (Array.isArray(input)) {\n\t\turls = input;\n\t} else if (typeof input === 'string') {\n\t\turls = [input];\n\t} else {\n\t\turls = Object.values(input);\n\t}\n\n\treturn urls.map((url) => (url.includes('undefined') || url.includes('null') || !url ? '' : url));\n}\n\nfunction load<\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n\tTReturn = NgtLoaderReturnType<TData, TLoaderConstructor>,\n>(\n\tloaderConstructorFactory: (inputs: string[]) => TLoaderConstructor,\n\tinputs: () => TUrl,\n\t{\n\t\textensions,\n\t\tonLoad,\n\t\tonProgress,\n\t}: {\n\t\textensions?: NgtLoaderExtensions<TLoaderConstructor>;\n\t\tonLoad?: (data: NoInfer<TReturn>) => void;\n\t\tonProgress?: (event: ProgressEvent) => void;\n\t} = {},\n) {\n\treturn (): Array<Promise<any>> => {\n\t\tconst urls = normalizeInputs(inputs());\n\n\t\tlet loader: THREE.Loader<TData> = memoizedLoaders.get(loaderConstructorFactory(urls));\n\t\tif (!loader) {\n\t\t\tloader = new (loaderConstructorFactory(urls))();\n\t\t\tmemoizedLoaders.set(loaderConstructorFactory(urls), loader);\n\t\t}\n\n\t\tif (extensions) extensions(loader);\n\n\t\treturn urls.map((url) => {\n\t\t\tif (url === '') return Promise.resolve(null);\n\n\t\t\tif (!cached.has(url)) {\n\t\t\t\tcached.set(\n\t\t\t\t\turl,\n\t\t\t\t\tnew Promise<TData>((resolve, reject) => {\n\t\t\t\t\t\tloader.load(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t(data) => {\n\t\t\t\t\t\t\t\tif ('scene' in (data as NgtAnyRecord)) {\n\t\t\t\t\t\t\t\t\tObject.assign(\n\t\t\t\t\t\t\t\t\t\tdata as NgtAnyRecord,\n\t\t\t\t\t\t\t\t\t\tmakeObjectGraph((data as NgtAnyRecord)['scene']),\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (onLoad) {\n\t\t\t\t\t\t\t\t\tonLoad(data as unknown as TReturn);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tresolve(data);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonProgress,\n\t\t\t\t\t\t\t(error) =>\n\t\t\t\t\t\t\t\treject(new Error(`[NGT] Could not load ${url}: ${(error as ErrorEvent)?.message}`)),\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn cached.get(url)!;\n\t\t});\n\t};\n}\n\n/**\n * @deprecated Use loaderResource instead. Will be removed in v5.0.0\n * @since v4.0.0~\n */\nfunction _injectLoader<\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n\tTReturn = NgtLoaderReturnType<TData, TLoaderConstructor>,\n>(\n\tloaderConstructorFactory: (inputs: string[]) => TLoaderConstructor,\n\tinputs: () => TUrl,\n\t{\n\t\textensions,\n\t\tonProgress,\n\t\tonLoad,\n\t\tinjector,\n\t}: {\n\t\textensions?: NgtLoaderExtensions<TLoaderConstructor>;\n\t\tonProgress?: (event: ProgressEvent) => void;\n\t\tonLoad?: (data: NoInfer<TReturn>) => void;\n\t\tinjector?: Injector;\n\t} = {},\n): Signal<NgtLoaderResults<TUrl, NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>> | null> {\n\treturn assertInjector(_injectLoader, injector, () => {\n\t\tconst response = signal<NgtLoaderResults<\n\t\t\tTUrl,\n\t\t\tNgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>\n\t\t> | null>(null);\n\n\t\tconst cachedResultPromisesEffect = load(loaderConstructorFactory, inputs, {\n\t\t\textensions,\n\t\t\tonProgress,\n\t\t\tonLoad: onLoad as (data: unknown) => void,\n\t\t});\n\n\t\teffect(() => {\n\t\t\tconst originalUrls = inputs();\n\t\t\tconst cachedResultPromises = cachedResultPromisesEffect();\n\t\t\tPromise.all(cachedResultPromises).then((results) => {\n\t\t\t\tresponse.update(() => {\n\t\t\t\t\tif (Array.isArray(originalUrls)) return results;\n\t\t\t\t\tif (typeof originalUrls === 'string') return results[0];\n\t\t\t\t\tconst keys = Object.keys(originalUrls);\n\t\t\t\t\treturn keys.reduce(\n\t\t\t\t\t\t(result, key) => {\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\t(result as NgtAnyRecord)[key] = results[keys.indexOf(key)];\n\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as {\n\t\t\t\t\t\t\t[key in keyof TUrl]: NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>;\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\treturn response.asReadonly();\n\t});\n}\n\n_injectLoader.preload = <\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n>(\n\tloaderConstructorFactory: (inputs: string[]) => TLoaderConstructor,\n\tinputs: () => TUrl,\n\textensions?: NgtLoaderExtensions<TLoaderConstructor>,\n\tonLoad?: (data: NoInfer<TData>) => void,\n) => {\n\tconst effects = load(loaderConstructorFactory, inputs, { extensions, onLoad })();\n\tif (effects) {\n\t\tvoid Promise.all(effects);\n\t}\n};\n\n_injectLoader.destroy = () => {\n\tcached.clear();\n};\n\n_injectLoader.clear = (urls: string | string[]) => {\n\tconst urlToClear = Array.isArray(urls) ? urls : [urls];\n\turlToClear.forEach((url) => {\n\t\tcached.delete(url);\n\t});\n};\n\nexport type NgtInjectedLoader = typeof _injectLoader;\n\n/**\n * @deprecated Use loaderResource instead. Will be removed in v5.0.0\n * @since v4.0.0~\n */\nexport const injectLoader: NgtInjectedLoader = _injectLoader;\n","import { type Injector, resource, type ResourceRef } from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport * as THREE from 'three';\nimport type {\n\tNgtBranchingReturn,\n\tNgtGLTFLike,\n\tNgtLoaderExtensions,\n\tNgtLoaderProto,\n\tNgtLoaderResults,\n\tNgtLoaderReturnType,\n} from './loader';\nimport type { NgtAnyRecord } from './types';\nimport { makeObjectGraph, type NgtObjectMap } from './utils/make';\n\n/**\n * @fileoverview Asset loading utilities using Angular's resource API.\n *\n * This module provides the `loaderResource` function for loading Three.js assets\n * using Angular's resource API, which provides better integration with Angular's\n * change detection and signal-based reactivity.\n */\n\nfunction normalizeInputs(input: string | string[] | Record<string, string>) {\n\tlet urls: string[] = [];\n\tif (Array.isArray(input)) {\n\t\turls = input;\n\t} else if (typeof input === 'string') {\n\t\turls = [input];\n\t} else {\n\t\turls = Object.values(input);\n\t}\n\n\treturn urls.map((url) => (url.includes('undefined') || url.includes('null') || !url ? '' : url));\n}\n\nconst cached = new Map();\nconst memoizedLoaders = new WeakMap();\n\nfunction getLoaderResourceParams<\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n>(\n\tinput: { (): TUrl },\n\tloaderConstructorFactory: {\n\t\t(url: TUrl): TLoaderConstructor;\n\t},\n\textensions: NgtLoaderExtensions<TLoaderConstructor> | undefined,\n) {\n\tconst urls = input();\n\tconst LoaderConstructor = loaderConstructorFactory(urls);\n\tconst normalizedUrls = normalizeInputs(urls);\n\tlet loader: THREE.Loader<TData> = memoizedLoaders.get(LoaderConstructor);\n\tif (!loader) {\n\t\tloader = new LoaderConstructor();\n\t\tmemoizedLoaders.set(LoaderConstructor, loader);\n\t}\n\n\tif (extensions) extensions(loader);\n\n\treturn { urls, normalizedUrls, loader };\n}\n\nfunction getLoaderPromises<TData, TUrl extends string | string[] | Record<string, string>>(\n\tparams: { loader: THREE.Loader<TData>; normalizedUrls: string[]; urls: TUrl },\n\tonProgress?: { (event: ProgressEvent<EventTarget>): void },\n) {\n\treturn params.normalizedUrls.map((url) => {\n\t\tif (url === '') return Promise.resolve(null);\n\t\tconst cachedPromise = cached.get(url);\n\t\tif (cachedPromise) return cachedPromise;\n\n\t\tconst promise = new Promise<TData>((res, rej) => {\n\t\t\tparams.loader.load(\n\t\t\t\turl,\n\t\t\t\t(data) => {\n\t\t\t\t\tif ('scene' in (data as NgtAnyRecord)) {\n\t\t\t\t\t\tObject.assign(data as NgtAnyRecord, makeObjectGraph((data as NgtAnyRecord)['scene']));\n\t\t\t\t\t}\n\n\t\t\t\t\tres(data);\n\t\t\t\t},\n\t\t\t\tonProgress,\n\t\t\t\t(error) => rej(new Error(`[NGT] Could not load ${url}: ${(error as ErrorEvent)?.message}`)),\n\t\t\t);\n\t\t});\n\n\t\tcached.set(url, promise);\n\n\t\treturn promise;\n\t});\n}\n\n/**\n * Loads Three.js assets using Angular's resource API.\n *\n * This function provides a signal-based approach to loading Three.js assets like\n * GLTF models, textures, and other files. It leverages Angular's resource API\n * for better integration with Angular's reactivity system.\n *\n * Features:\n * - Automatic caching of loaded assets\n * - Support for single URLs, arrays, or object maps\n * - GLTF scene graph extraction\n * - Progress and completion callbacks\n *\n * @typeParam TData - The type of data returned by the loader\n * @typeParam TUrl - The type of URL input (string, string[], or Record<string, string>)\n * @typeParam TLoaderConstructor - The loader constructor type\n * @typeParam TReturn - The return type after loading\n *\n * @param loaderConstructorFactory - Factory function that returns the loader constructor\n * @param input - Signal containing the URL(s) to load\n * @param options - Optional configuration including extensions, callbacks, and injector\n * @returns A ResourceRef containing the loaded data\n *\n * @example\n * ```typescript\n * // Load a single GLTF model\n * const model = loaderResource(\n * () => GLTFLoader,\n * () => '/assets/model.gltf'\n * );\n *\n * // Access in template\n * @if (model.value(); as gltf) {\n * <ngt-primitive *args=\"[gltf.scene]\" />\n * }\n * ```\n */\nexport function loaderResource<\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n\tTReturn = NgtLoaderReturnType<TData, TLoaderConstructor>,\n>(\n\tloaderConstructorFactory: (url: TUrl) => TLoaderConstructor,\n\tinput: () => TUrl,\n\t{\n\t\textensions,\n\t\tonLoad,\n\t\tonProgress,\n\t\tinjector,\n\t}: {\n\t\textensions?: NgtLoaderExtensions<TLoaderConstructor>;\n\t\tonLoad?: (\n\t\t\tdata: NoInfer<NgtLoaderResults<TUrl, NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>>>,\n\t\t) => void;\n\t\tonProgress?: (event: ProgressEvent) => void;\n\t\tinjector?: Injector;\n\t} = {},\n): ResourceRef<\n\tNgtLoaderResults<TUrl, NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>> | undefined\n> {\n\treturn assertInjector(loaderResource, injector, () => {\n\t\treturn resource({\n\t\t\tparams: () => getLoaderResourceParams(input, loaderConstructorFactory, extensions),\n\t\t\tloader: async ({ params }) => {\n\t\t\t\t// TODO: use the abortSignal when THREE.Loader supports it\n\n\t\t\t\tconst loadedResults = await Promise.all(getLoaderPromises(params, onProgress));\n\n\t\t\t\tlet results: NgtLoaderResults<\n\t\t\t\t\tTUrl,\n\t\t\t\t\tNgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>\n\t\t\t\t>;\n\n\t\t\t\tif (Array.isArray(params.urls)) {\n\t\t\t\t\tresults = loadedResults as NgtLoaderResults<\n\t\t\t\t\t\tTUrl,\n\t\t\t\t\t\tNgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>\n\t\t\t\t\t>;\n\t\t\t\t} else if (typeof params.urls === 'string') {\n\t\t\t\t\tresults = loadedResults[0] as NgtLoaderResults<\n\t\t\t\t\t\tTUrl,\n\t\t\t\t\t\tNgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>\n\t\t\t\t\t>;\n\t\t\t\t} else {\n\t\t\t\t\tconst keys = Object.keys(params.urls);\n\t\t\t\t\tresults = keys.reduce(\n\t\t\t\t\t\t(result, key) => {\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\t(result as NgtAnyRecord)[key] = loadedResults[keys.indexOf(key)];\n\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as {\n\t\t\t\t\t\t\t[key in keyof TUrl]: NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>;\n\t\t\t\t\t\t},\n\t\t\t\t\t) as NgtLoaderResults<TUrl, NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>>;\n\t\t\t\t}\n\n\t\t\t\tif (onLoad) onLoad(results);\n\n\t\t\t\treturn results;\n\t\t\t},\n\t\t});\n\t});\n}\n\nloaderResource.preload = <\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n>(\n\tloaderConstructor: TLoaderConstructor,\n\tinputs: TUrl,\n\textensions?: NgtLoaderExtensions<TLoaderConstructor>,\n) => {\n\tconst params = getLoaderResourceParams(\n\t\t() => inputs,\n\t\t() => loaderConstructor,\n\t\textensions,\n\t);\n\tvoid Promise.all(getLoaderPromises(params));\n};\n\nloaderResource.destroy = () => {\n\tcached.clear();\n};\n\nloaderResource.clear = (urls: string | string[]) => {\n\tconst urlToClear = Array.isArray(urls) ? urls : [urls];\n\turlToClear.forEach((url) => {\n\t\tcached.delete(url);\n\t});\n};\n","import { DOCUMENT, inject, Pipe } from '@angular/core';\n\nconst RGBA_REGEX = /rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+),?\\s*(\\d*\\.?\\d+)?\\)/;\nconst DEFAULT_COLOR = 0x000000;\n\n/**\n * Pipe for converting CSS color strings to hexadecimal numbers.\n *\n * Supports various color formats:\n * - Hex strings: '#ff0000' -> 0xff0000\n * - RGB: 'rgb(255, 0, 0)' -> 0xff0000\n * - RGBA: 'rgba(255, 0, 0, 0.5)' -> hex with alpha\n * - CSS color names: 'red' -> 0xff0000\n *\n * Returns 0x000000 (black) for invalid or null values.\n *\n * @example\n * ```html\n * <ngt-mesh-basic-material [color]=\"'red' | hexify\" />\n * <ngt-mesh-basic-material [color]=\"'#ff0000' | hexify\" />\n * ```\n */\n@Pipe({ name: 'hexify', pure: true })\nexport class NgtHexify {\n\tprivate document = inject(DOCUMENT, { optional: true });\n\tprivate ctx?: CanvasRenderingContext2D | null;\n\tprivate cache: Record<string, number> = {};\n\n\t/**\n\t * transforms a:\n\t * - hex string to a hex number\n\t * - rgb string to a hex number\n\t * - rgba string to a hex number\n\t * - css color string to a hex number\n\t *\n\t * always default to black if failed\n\t * @param value\n\t */\n\ttransform(value: string): number {\n\t\tif (value == null) return DEFAULT_COLOR;\n\n\t\tif (value.startsWith('#')) {\n\t\t\tif (!this.cache[value]) {\n\t\t\t\tthis.cache[value] = this.hexStringToNumber(value);\n\t\t\t}\n\t\t\treturn this.cache[value];\n\t\t}\n\n\t\tif (!this.ctx) {\n\t\t\tthis.ctx = this.document?.createElement('canvas').getContext('2d');\n\t\t}\n\n\t\tif (!this.ctx) {\n\t\t\tconsole.warn('[NGT] hexify: canvas context is not available');\n\t\t\treturn DEFAULT_COLOR;\n\t\t}\n\n\t\tthis.ctx.fillStyle = value;\n\t\tconst computedValue = this.ctx.fillStyle;\n\n\t\tif (computedValue.startsWith('#')) {\n\t\t\tif (!this.cache[computedValue]) {\n\t\t\t\tthis.cache[computedValue] = this.hexStringToNumber(computedValue);\n\t\t\t}\n\t\t\treturn this.cache[computedValue];\n\t\t}\n\n\t\tif (!computedValue.startsWith('rgba')) {\n\t\t\tconsole.warn(`[NGT] hexify: invalid color format. Expected rgba or hex, receive: ${computedValue}`);\n\t\t\treturn DEFAULT_COLOR;\n\t\t}\n\n\t\tconst match = computedValue.match(RGBA_REGEX);\n\t\tif (!match) {\n\t\t\tconsole.warn(`[NGT] hexify: invalid color format. Expected rgba or hex, receive: ${computedValue}`);\n\t\t\treturn DEFAULT_COLOR;\n\t\t}\n\n\t\tconst r = parseInt(match[1], 10);\n\t\tconst g = parseInt(match[2], 10);\n\t\tconst b = parseInt(match[3], 10);\n\t\tconst a = match[4] ? parseFloat(match[4]) : 1.0;\n\n\t\tconst cacheKey = `${r}:${g}:${b}:${a}`;\n\n\t\t// check result from cache\n\t\tif (!this.cache[cacheKey]) {\n\t\t\t// Convert the components to hex strings\n\t\t\tconst hexR = this.componentToHex(r);\n\t\t\tconst hexG = this.componentToHex(g);\n\t\t\tconst hexB = this.componentToHex(b);\n\t\t\tconst hexA = this.componentToHex(Math.round(a * 255));\n\n\t\t\t// Combine the hex components into a single hex string\n\t\t\tconst hex = `#${hexR}${hexG}${hexB}${hexA}`;\n\t\t\tthis.cache[cacheKey] = this.hexStringToNumber(hex);\n\t\t}\n\n\t\treturn this.cache[cacheKey];\n\t}\n\n\tprivate hexStringToNumber(hexString: string): number {\n\t\treturn parseInt(hexString.replace('#', ''), 16);\n\t}\n\n\tprivate componentToHex(component: number): string {\n\t\tconst hex = component.toString(16);\n\t\treturn hex.length === 1 ? '0' + hex : hex;\n\t}\n}\n","import { computed, Signal, Type, ValueEqualityFn } from '@angular/core';\nimport * as THREE from 'three';\nimport type { NgtVector2, NgtVector3, NgtVector4 } from '../three-types';\nimport type { NgtAnyRecord } from '../types';\nimport { is } from './is';\n\n/**\n * @fileoverview Signal utilities for transforming and accessing object properties.\n *\n * This module provides computed signal utilities for working with object properties,\n * including `omit`, `pick`, `merge`, and vector conversion functions.\n */\n\ntype KeysOfType<TObject extends object, TType> = Exclude<\n\t{\n\t\t[K in keyof TObject]: TObject[K] extends TType | undefined | null ? K : never;\n\t}[keyof TObject],\n\tundefined\n>;\n\n/**\n * Creates a computed signal that omits specified keys from an object.\n *\n * @typeParam TObject - The type of the source object\n * @typeParam TKeys - The keys to omit\n * @param objFn - Function returning the source object\n * @param keysToOmit - Array of keys to omit\n * @param equal - Optional equality function for change detection\n * @returns A signal containing the object without the omitted keys\n *\n * @example\n * ```typescript\n * const state = signal({ a: 1, b: 2, c: 3 });\n * const withoutB = omit(() => state(), ['b']);\n * // withoutB() => { a: 1, c: 3 }\n * ```\n */\nexport function omit<TObject extends object, TKeys extends (keyof TObject)[]>(\n\tobjFn: () => TObject,\n\tkeysToOmit: TKeys,\n\tequal: ValueEqualityFn<NoInfer<Omit<TObject, TKeys[number]>>> = (a, b) =>\n\t\tis.equ(a, b, { objects: 'shallow', arrays: 'shallow' }),\n): Signal<Omit<TObject, TKeys[number]>> {\n\treturn computed(\n\t\t() => {\n\t\t\tconst obj = objFn();\n\t\t\tconst result = {} as NgtAnyRecord;\n\n\t\t\tfor (const key of Object.keys(obj)) {\n\t\t\t\tif (keysToOmit.includes(key as keyof TObject)) continue;\n\t\t\t\tObject.assign(result, { [key]: obj[key as keyof TObject] });\n\t\t\t}\n\n\t\t\treturn result as Omit<TObject, TKeys[number]>;\n\t\t},\n\t\t{ equal },\n\t);\n}\n\n/**\n * Creates a computed signal that picks specified keys from an object.\n *\n * Can pick a single key (returning the value) or multiple keys (returning a partial object).\n *\n * @example\n * ```typescript\n * const state = signal({ a: 1, b: 2, c: 3 });\n *\n * // Pick single key\n * const a = pick(() => state(), 'a');\n * // a() => 1\n *\n * // Pick multiple keys\n * const ab = pick(() => state(), ['a', 'b']);\n * // ab() => { a: 1, b: 2 }\n * ```\n */\nexport function pick<TObject extends object, TKey extends keyof TObject>(\n\tobjFn: () => TObject,\n\tkey: TKey,\n\tequal?: ValueEqualityFn<NoInfer<TObject[TKey]>>,\n): Signal<TObject[TKey]>;\nexport function pick<TObject extends object, TKeys extends (keyof TObject)[]>(\n\tobjFn: () => TObject,\n\tkeys: TKeys,\n\tequal?: ValueEqualityFn<NoInfer<Pick<TObject, TKeys[number]>>>,\n): Signal<Pick<TObject, TKeys[number]>>;\nexport function pick(objFn: () => NgtAnyRecord, keyOrKeys: string | string[], equal?: ValueEqualityFn<any>) {\n\tif (Array.isArray(keyOrKeys)) {\n\t\tif (!equal) {\n\t\t\tequal = (a, b) => is.equ(a, b, { objects: 'shallow', arrays: 'shallow' });\n\t\t}\n\n\t\treturn computed(\n\t\t\t() => {\n\t\t\t\tconst obj = objFn();\n\t\t\t\tconst result = {} as NgtAnyRecord;\n\t\t\t\tfor (const key of keyOrKeys) {\n\t\t\t\t\tif (!(key in obj)) continue;\n\t\t\t\t\tObject.assign(result, { [key]: obj[key] });\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\t{ equal },\n\t\t);\n\t}\n\n\treturn computed(() => objFn()[keyOrKeys], { equal });\n}\n\n/**\n * Creates a computed signal that merges an object with static values.\n *\n * @param objFn - Function returning the source object\n * @param toMerge - Static values to merge\n * @param mode - 'override' (default) puts toMerge values on top, 'backfill' puts them underneath\n * @param equal - Optional equality function\n * @returns A signal containing the merged object\n *\n * @example\n * ```typescript\n * const options = signal({ size: 10 });\n * const withDefaults = merge(() => options(), { color: 'red' }, 'backfill');\n * // withDefaults() => { color: 'red', size: 10 }\n * ```\n */\nexport function merge<TObject extends object>(\n\tobjFn: () => TObject,\n\ttoMerge: Partial<TObject>,\n\tmode: 'override' | 'backfill' = 'override',\n\tequal: ValueEqualityFn<NoInfer<TObject>> = (a, b) => is.equ(a, b, { objects: 'shallow', arrays: 'shallow' }),\n) {\n\tif (mode === 'override') return computed(() => ({ ...objFn(), ...toMerge }), { equal });\n\treturn computed(() => ({ ...toMerge, ...objFn() }), { equal });\n}\n\ntype NgtVectorComputed<\n\tTVector extends THREE.Vector2 | THREE.Vector3 | THREE.Vector4,\n\tTNgtVector = TVector extends THREE.Vector2 ? NgtVector2 : TVector extends THREE.Vector3 ? NgtVector3 : NgtVector4,\n> = {\n\t(input: Signal<TNgtVector>): Signal<TVector>;\n\t(input: Signal<TNgtVector>, keepUndefined: true): Signal<TVector | undefined>;\n\t<TObject extends object>(options: Signal<TObject>, key: KeysOfType<TObject, TNgtVector>): Signal<TVector>;\n\t<TObject extends object>(\n\t\toptions: Signal<TObject>,\n\t\tkey: KeysOfType<TObject, TNgtVector>,\n\t\tkeepUndefined: true,\n\t): Signal<TVector | undefined>;\n};\n\nfunction createVectorComputed<TVector extends THREE.Vector2 | THREE.Vector3 | THREE.Vector4>(\n\tvectorCtor: Type<TVector>,\n) {\n\ttype TNgtVector = TVector extends THREE.Vector2\n\t\t? NgtVector2\n\t\t: TVector extends THREE.Vector3\n\t\t\t? NgtVector3\n\t\t\t: NgtVector4;\n\treturn ((\n\t\tinputOrOptions: Signal<NgtAnyRecord> | Signal<TNgtVector>,\n\t\tkeyOrKeepUndefined?: string | true,\n\t\tkeepUndefined?: boolean,\n\t) => {\n\t\tif (typeof keyOrKeepUndefined === 'undefined' || typeof keyOrKeepUndefined === 'boolean') {\n\t\t\tkeepUndefined = !!keyOrKeepUndefined;\n\t\t\tconst input = inputOrOptions as Signal<TNgtVector>;\n\t\t\treturn computed(\n\t\t\t\t() => {\n\t\t\t\t\tconst value = input();\n\t\t\t\t\tif (keepUndefined && value == undefined) return undefined;\n\t\t\t\t\tif (typeof value === 'number') return new vectorCtor().setScalar(value);\n\t\t\t\t\telse if (Array.isArray(value)) return new vectorCtor(...value);\n\t\t\t\t\telse if (value) return value as unknown as TVector;\n\t\t\t\t\telse return new vectorCtor();\n\t\t\t\t},\n\t\t\t\t{ equal: (a, b) => !!a && !!b && a.equals(b as any) },\n\t\t\t);\n\t\t}\n\n\t\tconst options = inputOrOptions as Signal<NgtAnyRecord>;\n\t\tconst key = keyOrKeepUndefined as string;\n\n\t\treturn computed(\n\t\t\t() => {\n\t\t\t\tconst value = options()[key] as TNgtVector;\n\t\t\t\tif (keepUndefined && value == undefined) return undefined;\n\t\t\t\tif (typeof value === 'number') return new vectorCtor().setScalar(value);\n\t\t\t\telse if (Array.isArray(value)) return new vectorCtor(...value);\n\t\t\t\telse if (value) return value as unknown as TVector;\n\t\t\t\telse return new vectorCtor();\n\t\t\t},\n\t\t\t{ equal: (a, b) => !!a && !!b && a.equals(b as any) },\n\t\t);\n\t}) as NgtVectorComputed<TVector, TNgtVector>;\n}\n\n/**\n * Creates a computed Vector2 signal from various input formats.\n *\n * Accepts: number (scalar), [x, y] array, or Vector2 instance.\n *\n * @example\n * ```typescript\n * const pos = vector2(input);\n * // or from options object\n * const pos = vector2(options, 'position');\n * ```\n */\nexport const vector2 = createVectorComputed(THREE.Vector2);\n\n/**\n * Creates a computed Vector3 signal from various input formats.\n *\n * Accepts: number (scalar), [x, y, z] array, or Vector3 instance.\n *\n * @example\n * ```typescript\n * const pos = vector3(input);\n * // or from options object\n * const pos = vector3(options, 'position');\n * ```\n */\nexport const vector3 = createVectorComputed(THREE.Vector3);\n\n/**\n * Creates a computed Vector4 signal from various input formats.\n *\n * Accepts: number (scalar), [x, y, z, w] array, or Vector4 instance.\n *\n * @example\n * ```typescript\n * const pos = vector4(input);\n * // or from options object\n * const pos = vector4(options, 'position');\n * ```\n */\nexport const vector4 = createVectorComputed(THREE.Vector4);\n","import {\n\tChangeDetectionStrategy,\n\tComponent,\n\tcontentChild,\n\tCUSTOM_ELEMENTS_SCHEMA,\n\tDirective,\n\teffect,\n\tElementRef,\n\tEmbeddedViewRef,\n\tinject,\n\tInjector,\n\tinput,\n\tnumberAttribute,\n\tsignal,\n\tSkipSelf,\n\tTemplateRef,\n\tuntracked,\n\tViewContainerRef,\n} from '@angular/core';\nimport * as THREE from 'three';\nimport { Group } from 'three';\nimport { getInstanceState, prepare } from './instance';\nimport { extend } from './renderer/catalogue';\nimport { NGT_DOM_PARENT_FLAG, NGT_PORTAL_CONTENT_FLAG } from './renderer/constants';\nimport { injectStore, NGT_STORE } from './store';\nimport type { NgtComputeFunction, NgtEventManager, NgtSize, NgtState, NgtViewport } from './types';\nimport { is } from './utils/is';\nimport { makeId } from './utils/make';\nimport { omit, pick } from './utils/parameters';\nimport { signalState, SignalState } from './utils/signal-state';\nimport { updateCamera } from './utils/update';\n\n/**\n * Directive to enable automatic rendering for portal content.\n *\n * When applied to an `ngt-portal`, this directive sets up automatic rendering\n * of the portal's scene on each frame. The render priority can be configured\n * to control the order of rendering relative to other subscriptions.\n *\n * @example\n * ```html\n * <ngt-portal [container]=\"container\" [autoRender]=\"2\">\n * <ng-template portalContent>\n * <ngt-mesh />\n * </ng-template>\n * </ngt-portal>\n * ```\n */\n@Directive({ selector: 'ngt-portal[autoRender]' })\nexport class NgtPortalAutoRender {\n\tprivate portalStore = injectStore({ host: true });\n\tprivate parentStore = injectStore({ skipSelf: true });\n\tprivate portal = inject(NgtPortalImpl, { host: true });\n\n\trenderPriority = input(1, { alias: 'autoRender', transform: (value) => numberAttribute(value, 1) });\n\n\tconstructor() {\n\t\t// TODO: (chau) investigate if this is still needed\n\t\t// effect(() => {\n\t\t// this.portalStore.update((state) => ({ events: { ...state.events, priority: this.renderPriority() + 1 } }));\n\t\t// });\n\n\t\teffect((onCleanup) => {\n\t\t\tconst portalRendered = this.portal.portalRendered();\n\t\t\tif (!portalRendered) return;\n\n\t\t\t// track state\n\t\t\tconst [renderPriority, { internal }] = [this.renderPriority(), this.portalStore()];\n\n\t\t\tlet oldClean: boolean;\n\n\t\t\tconst cleanup = internal.subscribe(\n\t\t\t\t({ gl, scene, camera }) => {\n\t\t\t\t\tconst [parentScene, parentCamera] = [\n\t\t\t\t\t\tthis.parentStore.snapshot.scene,\n\t\t\t\t\t\tthis.parentStore.snapshot.camera,\n\t\t\t\t\t];\n\t\t\t\t\toldClean = gl.autoClear;\n\t\t\t\t\tif (renderPriority === 1) {\n\t\t\t\t\t\t// clear scene and render with default\n\t\t\t\t\t\tgl.autoClear = true;\n\t\t\t\t\t\tgl.render(parentScene, parentCamera);\n\t\t\t\t\t}\n\n\t\t\t\t\t// disable cleaning\n\t\t\t\t\tgl.autoClear = false;\n\t\t\t\t\tgl.clearDepth();\n\t\t\t\t\tgl.render(scene, camera);\n\t\t\t\t\t// restore\n\t\t\t\t\tgl.autoClear = oldClean;\n\t\t\t\t},\n\t\t\t\trenderPriority,\n\t\t\t\tthis.portalStore,\n\t\t\t);\n\n\t\t\tonCleanup(() => cleanup());\n\t\t});\n\t}\n}\n\n/**\n * Structural directive for defining portal content.\n *\n * This directive marks the template content that will be rendered inside the portal.\n * It must be used inside an `ngt-portal` component.\n *\n * @example\n * ```html\n * <ngt-portal [container]=\"myGroup\">\n * <ng-template portalContent let-injector=\"injector\">\n * <ngt-mesh />\n * </ng-template>\n * </ngt-portal>\n * ```\n */\n@Directive({ selector: 'ng-template[portalContent]' })\nexport class NgtPortalContent {\n\tstatic ngTemplateContextGuard(_: NgtPortalContent, ctx: unknown): ctx is { injector: Injector } {\n\t\treturn true;\n\t}\n\n\tconstructor() {\n\t\tconst host = inject<ElementRef<HTMLElement>>(ElementRef, { skipSelf: true });\n\t\tconst { element } = inject(ViewContainerRef);\n\t\tconst commentNode = element.nativeElement;\n\t\tconst store = injectStore();\n\n\t\tcommentNode.data = NGT_PORTAL_CONTENT_FLAG;\n\t\tcommentNode[NGT_PORTAL_CONTENT_FLAG] = store;\n\t\tcommentNode[NGT_DOM_PARENT_FLAG] = host.nativeElement;\n\t}\n}\n\n/**\n * State interface for portal configuration.\n *\n * Extends the base NgtState with customizable event handling configuration.\n */\nexport interface NgtPortalState extends Omit<NgtState, 'events'> {\n\t/** Portal-specific event configuration */\n\tevents: {\n\t\t/** Whether events are enabled for this portal */\n\t\tenabled?: boolean;\n\t\t/** Event handling priority */\n\t\tpriority?: number;\n\t\t/** Custom compute function for raycasting */\n\t\tcompute?: NgtComputeFunction;\n\t\t/** Connected event target */\n\t\tconnected?: any;\n\t};\n}\n\nfunction mergeState(\n\tpreviousRoot: SignalState<NgtState>,\n\tstore: SignalState<NgtState>,\n\tcontainer: THREE.Object3D,\n\tpointer: THREE.Vector2,\n\traycaster: THREE.Raycaster,\n\tevents?: NgtPortalState['events'],\n\tsize?: NgtSize,\n) {\n\t// we never want to spread the id\n\tconst { id: _, ...previousState } = previousRoot.snapshot;\n\tconst state = store.snapshot;\n\n\tlet viewport: Omit<NgtViewport, 'dpr' | 'initialDpr'> | undefined = undefined;\n\n\tif (state.camera && size) {\n\t\tconst camera = state.camera;\n\t\t// calculate the override viewport, if present\n\t\tviewport = previousState.viewport.getCurrentViewport(camera, new THREE.Vector3(), size);\n\t\t// update the portal camera, if it differs from the previous layer\n\t\tif (camera !== previousState.camera) updateCamera(camera, size);\n\t}\n\n\treturn {\n\t\t// the intersect consists of the previous root state\n\t\t...previousState,\n\t\t...state,\n\t\t// portals have their own scene, which forms the root, a raycaster and a pointer\n\t\tscene: container as THREE.Scene,\n\t\tpointer,\n\t\traycaster,\n\t\t// their previous root is the layer before it\n\t\tpreviousRoot,\n\t\tevents: { ...previousState.events, ...state.events, ...events },\n\t\tsize: { ...previousState.size, ...size },\n\t\tviewport: { ...previousState.viewport, ...viewport },\n\t\t// layers are allowed to override events\n\t\tsetEvents: (events: Partial<NgtEventManager<any>>) =>\n\t\t\tstore.update((state) => ({ ...state, events: { ...state.events, ...events } })),\n\t} as NgtState;\n}\n\n/**\n * Component for creating a portal to render Three.js content into a different container.\n *\n * Portals allow you to render content into a separate Three.js object while maintaining\n * the React-like declarative structure. Each portal has its own store with separate\n * raycaster and pointer state.\n *\n * @example\n * ```html\n * <ngt-group #portalContainer />\n *\n * <ngt-portal [container]=\"portalContainer\">\n * <ng-template portalContent>\n * <ngt-mesh>\n * <ngt-box-geometry />\n * </ngt-mesh>\n * </ng-template>\n * </ngt-portal>\n * ```\n */\n@Component({\n\tselector: 'ngt-portal',\n\ttemplate: `\n\t\t@if (portalRendered()) {\n\t\t\t<!-- Without an element that receives pointer events state.pointer will always be 0/0 -->\n\t\t\t<ngt-group (pointerover)=\"(undefined)\" attach=\"none\" />\n\t\t}\n\t`,\n\tschemas: [CUSTOM_ELEMENTS_SCHEMA],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NGT_STORE,\n\t\t\tuseFactory: (previousStore: SignalState<NgtState>) => {\n\t\t\t\tconst pointer = new THREE.Vector2();\n\t\t\t\tconst raycaster = new THREE.Raycaster();\n\n\t\t\t\tconst { id: _skipId, ...previousState } = previousStore.snapshot;\n\n\t\t\t\tconst store = signalState<NgtState>({\n\t\t\t\t\tid: makeId(),\n\t\t\t\t\t...previousState,\n\t\t\t\t\tscene: null as unknown as THREE.Scene,\n\t\t\t\t\tpreviousRoot: previousStore,\n\t\t\t\t\tpointer,\n\t\t\t\t\traycaster,\n\t\t\t\t});\n\t\t\t\tstore.update(mergeState(previousStore, store, null!, pointer, raycaster));\n\t\t\t\treturn store;\n\t\t\t},\n\t\t\tdeps: [[new SkipSelf(), NGT_STORE]],\n\t\t},\n\t],\n})\nexport class NgtPortalImpl {\n\tcontainer = input.required<THREE.Object3D>();\n\tstate = input<Partial<NgtPortalState>>({});\n\n\tprivate contentRef = contentChild.required(NgtPortalContent, { read: TemplateRef });\n\tprivate anchorRef = contentChild.required(NgtPortalContent, { read: ViewContainerRef });\n\n\tprivate previousStore = injectStore({ skipSelf: true });\n\tprivate portalStore = injectStore();\n\tprivate injector = inject(Injector);\n\n\tprivate size = pick(this.state, 'size');\n\tprivate events = pick(this.state, 'events');\n\tprivate restState = omit(this.state, ['size', 'events']);\n\n\tprivate portalContentRendered = signal(false);\n\tportalRendered = this.portalContentRendered.asReadonly();\n\n\tprivate portalViewRef?: EmbeddedViewRef<unknown>;\n\n\tconstructor() {\n\t\textend({ Group });\n\n\t\teffect(() => {\n\t\t\tlet [container, anchor, content] = [\n\t\t\t\tthis.container(),\n\t\t\t\tthis.anchorRef(),\n\t\t\t\tthis.contentRef(),\n\t\t\t\tthis.previousStore(),\n\t\t\t];\n\n\t\t\tconst [size, events, restState] = [untracked(this.size), untracked(this.events), untracked(this.restState)];\n\n\t\t\tif (!is.instance(container)) {\n\t\t\t\tcontainer = prepare(container, 'ngt-portal', { store: this.portalStore });\n\t\t\t}\n\n\t\t\tconst instanceState = getInstanceState(container);\n\t\t\tif (instanceState && instanceState.store !== this.portalStore) {\n\t\t\t\tinstanceState.store = this.portalStore;\n\t\t\t}\n\n\t\t\tthis.portalStore.update(\n\t\t\t\trestState,\n\t\t\t\tmergeState(\n\t\t\t\t\tthis.previousStore,\n\t\t\t\t\tthis.portalStore,\n\t\t\t\t\tcontainer,\n\t\t\t\t\tthis.portalStore.snapshot.pointer,\n\t\t\t\t\tthis.portalStore.snapshot.raycaster,\n\t\t\t\t\tevents,\n\t\t\t\t\tsize,\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tif (this.portalViewRef) {\n\t\t\t\tthis.portalViewRef.detectChanges();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst portalViewContext = { injector: this.injector };\n\t\t\tthis.portalViewRef = anchor.createEmbeddedView(content, portalViewContext, portalViewContext);\n\t\t\tthis.portalViewRef.detectChanges();\n\t\t\tthis.portalContentRendered.set(true);\n\t\t});\n\t}\n}\n\n/**\n * Array containing NgtPortalImpl and NgtPortalContent for convenient importing.\n *\n * @example\n * ```typescript\n * @Component({\n * imports: [NgtPortal],\n * })\n * export class MyComponent {}\n * ```\n */\nexport const NgtPortal = [NgtPortalImpl, NgtPortalContent] as const;\n","import { Injector } from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport * as THREE from 'three';\nimport { prepare } from './instance';\nimport { injectLoop, roots } from './loop';\nimport { injectStore } from './store';\nimport type { NgtCanvasElement, NgtCanvasOptions, NgtDisposable, NgtEquConfig, NgtSize, NgtState } from './types';\nimport { applyProps } from './utils/apply-props';\nimport { is } from './utils/is';\nimport { makeCameraInstance, makeDpr, makeRendererInstance } from './utils/make';\nimport { checkNeedsUpdate } from './utils/update';\n\nconst shallowLoose = { objects: 'shallow', strict: false } as NgtEquConfig;\n\n/**\n * Creates a canvas root initializer function.\n *\n * This function sets up the Three.js rendering context including the WebGL renderer,\n * camera, scene, and all related state. It returns a configurator object that can\n * be used to update canvas options and destroy the root.\n *\n * @param injector - Optional injector for dependency injection\n * @returns A function that takes a canvas element and returns a configurator\n *\n * @example\n * ```typescript\n * const initRoot = canvasRootInitializer();\n * const configurator = initRoot(canvasElement);\n * configurator.configure({ shadows: true, dpr: [1, 2] });\n * ```\n */\nexport function canvasRootInitializer(injector?: Injector) {\n\treturn assertInjector(canvasRootInitializer, injector, () => {\n\t\tconst injectedStore = injectStore();\n\t\tconst loop = injectLoop();\n\n\t\treturn (canvas: NgtCanvasElement) => {\n\t\t\tconst exist = roots.has(canvas);\n\t\t\tlet store = roots.get(canvas);\n\n\t\t\tif (store) {\n\t\t\t\tconsole.warn('[NGT] Same canvas root is being created twice');\n\t\t\t}\n\n\t\t\tstore ||= injectedStore;\n\n\t\t\tif (!store) {\n\t\t\t\tthrow new Error('[NGT] No store initialized');\n\t\t\t}\n\n\t\t\tif (!exist) {\n\t\t\t\troots.set(canvas, store);\n\t\t\t}\n\n\t\t\tlet isConfigured = false;\n\t\t\tlet lastCamera: NgtCanvasOptions['camera'];\n\n\t\t\treturn {\n\t\t\t\tisConfigured,\n\t\t\t\tdestroy: (timeout = 500) => {\n\t\t\t\t\tconst root = roots.get(canvas);\n\t\t\t\t\tif (root) {\n\t\t\t\t\t\troot.update((state) => ({ internal: { ...state.internal, active: false } }));\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst state = root.snapshot;\n\t\t\t\t\t\t\t\tstate.events.disconnect?.();\n\n\t\t\t\t\t\t\t\tstate.gl?.renderLists?.dispose?.();\n\t\t\t\t\t\t\t\tstate.gl?.dispose?.();\n\t\t\t\t\t\t\t\tstate.gl?.forceContextLoss?.();\n\t\t\t\t\t\t\t\tif (state.gl?.xr) state.xr.disconnect();\n\t\t\t\t\t\t\t\tdispose(state.scene);\n\t\t\t\t\t\t\t\troots.delete(canvas);\n\t\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t\tconsole.error('[NGT] Unexpected error while destroying Canvas Root', e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, timeout);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tconfigure: (inputs: NgtCanvasOptions) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tshadows = false,\n\t\t\t\t\t\tlinear = false,\n\t\t\t\t\t\tflat = false,\n\t\t\t\t\t\tlegacy = false,\n\t\t\t\t\t\torthographic = false,\n\t\t\t\t\t\tframeloop = 'always',\n\t\t\t\t\t\tdpr = [1, 2],\n\t\t\t\t\t\tgl: glOptions,\n\t\t\t\t\t\tsize: sizeOptions,\n\t\t\t\t\t\tcamera: cameraOptions,\n\t\t\t\t\t\traycaster: raycasterOptions,\n\t\t\t\t\t\tscene: sceneOptions,\n\t\t\t\t\t\tevents,\n\t\t\t\t\t\tlookAt,\n\t\t\t\t\t\tperformance,\n\t\t\t\t\t} = inputs;\n\n\t\t\t\t\tconst state = store.snapshot;\n\t\t\t\t\tconst stateToUpdate: Partial<NgtState> = {};\n\n\t\t\t\t\t// setup renderer\n\t\t\t\t\tlet gl = state.gl;\n\t\t\t\t\tif (!state.gl) stateToUpdate.gl = gl = makeRendererInstance(glOptions, canvas);\n\n\t\t\t\t\t// setup raycaster\n\t\t\t\t\tlet raycaster = state.raycaster;\n\t\t\t\t\tif (!raycaster) stateToUpdate.raycaster = raycaster = new THREE.Raycaster();\n\n\t\t\t\t\t// set raycaster options\n\t\t\t\t\tconst { params, ...options } = raycasterOptions || {};\n\t\t\t\t\tif (!is.equ(options, raycaster, shallowLoose)) applyProps(raycaster, options);\n\t\t\t\t\tif (!is.equ(params, raycaster.params, shallowLoose)) {\n\t\t\t\t\t\tapplyProps(raycaster, { params: { ...raycaster.params, ...(params || {}) } });\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create default camera, don't overwrite any user-set state\n\t\t\t\t\tif (\n\t\t\t\t\t\t!state.camera ||\n\t\t\t\t\t\t(state.camera === lastCamera && !is.equ(lastCamera, cameraOptions, shallowLoose))\n\t\t\t\t\t) {\n\t\t\t\t\t\tlastCamera = cameraOptions;\n\t\t\t\t\t\tconst isCamera = is.three<THREE.Camera>(cameraOptions, 'isCamera');\n\t\t\t\t\t\tlet camera = isCamera\n\t\t\t\t\t\t\t? cameraOptions\n\t\t\t\t\t\t\t: makeCameraInstance(orthographic, sizeOptions ?? state.size);\n\n\t\t\t\t\t\tif (!isCamera) {\n\t\t\t\t\t\t\tcamera.position.z = 5;\n\t\t\t\t\t\t\tif (cameraOptions) {\n\t\t\t\t\t\t\t\tapplyProps(camera, cameraOptions);\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t'aspect' in cameraOptions ||\n\t\t\t\t\t\t\t\t\t'left' in cameraOptions ||\n\t\t\t\t\t\t\t\t\t'right' in cameraOptions ||\n\t\t\t\t\t\t\t\t\t'top' in cameraOptions ||\n\t\t\t\t\t\t\t\t\t'bottom' in cameraOptions\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tObject.assign(camera, { manual: true });\n\t\t\t\t\t\t\t\t\tcamera?.updateProjectionMatrix();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// always look at center or passed-in lookAt by default\n\t\t\t\t\t\t\tif (!state.camera && !cameraOptions?.rotation && !cameraOptions?.quaternion) {\n\t\t\t\t\t\t\t\tif (Array.isArray(lookAt)) camera.lookAt(lookAt[0], lookAt[1], lookAt[2]);\n\t\t\t\t\t\t\t\telse if (typeof lookAt === 'number') camera.lookAt(lookAt, lookAt, lookAt);\n\t\t\t\t\t\t\t\telse if (lookAt?.isVector3) camera.lookAt(lookAt);\n\t\t\t\t\t\t\t\telse camera.lookAt(0, 0, 0);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// update projection matrix after applyprops\n\t\t\t\t\t\t\tcamera.updateProjectionMatrix?.();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!is.instance(camera)) camera = prepare(camera, '', { store });\n\n\t\t\t\t\t\tstateToUpdate.camera = camera;\n\n\t\t\t\t\t\t// Configure raycaster\n\t\t\t\t\t\t// https://github.com/pmndrs/react-xr/issues/300\n\t\t\t\t\t\traycaster.camera = camera;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set up scene (one time only!)\n\t\t\t\t\tif (!state.scene) {\n\t\t\t\t\t\tlet scene: THREE.Scene;\n\n\t\t\t\t\t\tif (is.three<THREE.Scene>(sceneOptions, 'isScene')) {\n\t\t\t\t\t\t\tscene = sceneOptions;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tscene = new THREE.Scene();\n\t\t\t\t\t\t\tif (sceneOptions) applyProps(scene, sceneOptions);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tapplyProps(scene, {\n\t\t\t\t\t\t\tname: '__ngt_root_scene__',\n\t\t\t\t\t\t\tsetAttribute: (name: string, value: string) => {\n\t\t\t\t\t\t\t\tif (canvas instanceof HTMLCanvasElement) {\n\t\t\t\t\t\t\t\t\tif (canvas.parentElement) {\n\t\t\t\t\t\t\t\t\t\tcanvas.parentElement.setAttribute(name, value);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tcanvas.setAttribute(name, value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tstateToUpdate.scene = prepare(scene, 'ngt-scene', { store });\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set up XR (one time only!)\n\t\t\t\t\tif (!state.xr) {\n\t\t\t\t\t\t// Handle frame behavior in WebXR\n\t\t\t\t\t\tconst handleXRFrame: XRFrameRequestCallback = (timestamp: number, frame?: XRFrame) => {\n\t\t\t\t\t\t\tconst state = store.snapshot;\n\t\t\t\t\t\t\tif (state.frameloop === 'never') return;\n\t\t\t\t\t\t\tloop.advance(timestamp, true, store, frame);\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Toggle render switching on session\n\t\t\t\t\t\tconst handleSessionChange = () => {\n\t\t\t\t\t\t\tconst state = store.snapshot;\n\t\t\t\t\t\t\tstate.gl.xr.enabled = state.gl.xr.isPresenting;\n\t\t\t\t\t\t\tstate.gl.xr.setAnimationLoop(state.gl.xr.isPresenting ? handleXRFrame : null);\n\t\t\t\t\t\t\tif (!state.gl.xr.isPresenting) loop.invalidate(store);\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// WebXR session manager\n\t\t\t\t\t\tconst xr = {\n\t\t\t\t\t\t\tconnect: () => {\n\t\t\t\t\t\t\t\tgl.xr.addEventListener('sessionstart', handleSessionChange);\n\t\t\t\t\t\t\t\tgl.xr.addEventListener('sessionend', handleSessionChange);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdisconnect: () => {\n\t\t\t\t\t\t\t\tgl.xr.removeEventListener('sessionstart', handleSessionChange);\n\t\t\t\t\t\t\t\tgl.xr.removeEventListener('sessionend', handleSessionChange);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Subscribe to WebXR session events\n\t\t\t\t\t\tif (gl.xr && typeof gl.xr.addEventListener === 'function') xr.connect();\n\t\t\t\t\t\tstateToUpdate.xr = xr;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set shadowmap\n\t\t\t\t\tif (gl.shadowMap) {\n\t\t\t\t\t\tconst oldEnabled = gl.shadowMap.enabled;\n\t\t\t\t\t\tconst oldType = gl.shadowMap.type;\n\t\t\t\t\t\tgl.shadowMap.enabled = !!shadows;\n\n\t\t\t\t\t\tif (typeof shadows === 'boolean') {\n\t\t\t\t\t\t\tgl.shadowMap.type = THREE.PCFSoftShadowMap;\n\t\t\t\t\t\t} else if (typeof shadows === 'string') {\n\t\t\t\t\t\t\tconst types = {\n\t\t\t\t\t\t\t\tbasic: THREE.BasicShadowMap,\n\t\t\t\t\t\t\t\tpercentage: THREE.PCFShadowMap,\n\t\t\t\t\t\t\t\tsoft: THREE.PCFSoftShadowMap,\n\t\t\t\t\t\t\t\tvariance: THREE.VSMShadowMap,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tgl.shadowMap.type = types[shadows] ?? THREE.PCFSoftShadowMap;\n\t\t\t\t\t\t} else if (is.obj(shadows)) {\n\t\t\t\t\t\t\tObject.assign(gl.shadowMap, shadows);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (oldEnabled !== gl.shadowMap.enabled || oldType !== gl.shadowMap.type)\n\t\t\t\t\t\t\tcheckNeedsUpdate(gl.shadowMap);\n\t\t\t\t\t}\n\n\t\t\t\t\tTHREE.ColorManagement.enabled = !legacy;\n\n\t\t\t\t\tif (!isConfigured) {\n\t\t\t\t\t\t// set color space and tonemapping preferences once\n\t\t\t\t\t\tapplyProps(gl, {\n\t\t\t\t\t\t\toutputColorSpace: linear ? THREE.LinearSRGBColorSpace : THREE.SRGBColorSpace,\n\t\t\t\t\t\t\ttoneMapping: flat ? THREE.NoToneMapping : THREE.ACESFilmicToneMapping,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Update color management state\n\t\t\t\t\tif (state.legacy !== legacy) stateToUpdate.legacy = legacy;\n\t\t\t\t\tif (state.linear !== linear) stateToUpdate.linear = linear;\n\t\t\t\t\tif (state.flat !== flat) stateToUpdate.flat = flat;\n\n\t\t\t\t\t// Set gl props\n\t\t\t\t\tif (gl.setClearAlpha) {\n\t\t\t\t\t\tgl.setClearAlpha(0);\n\t\t\t\t\t}\n\t\t\t\t\tgl.setPixelRatio(makeDpr(state.viewport.dpr));\n\t\t\t\t\tgl.setSize(sizeOptions?.width ?? state.size.width, sizeOptions?.height ?? state.size.height);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tis.obj(glOptions) &&\n\t\t\t\t\t\t!(typeof glOptions === 'function') &&\n\t\t\t\t\t\t!is.renderer(glOptions) &&\n\t\t\t\t\t\t!is.equ(glOptions, gl, shallowLoose)\n\t\t\t\t\t) {\n\t\t\t\t\t\tapplyProps(gl, glOptions);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Store events internally\n\t\t\t\t\tif (events && !state.events.handlers) stateToUpdate.events = events(store);\n\n\t\t\t\t\t// Check performance\n\t\t\t\t\tif (performance && !is.equ(performance, state.performance, shallowLoose)) {\n\t\t\t\t\t\tstateToUpdate.performance = { ...state.performance, ...performance };\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.keys(stateToUpdate).length) {\n\t\t\t\t\t\tstore.update(stateToUpdate);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check size, allow it to take on container bounds initially\n\t\t\t\t\tconst size = computeInitialSize(canvas, sizeOptions);\n\t\t\t\t\tif (!is.equ(size, state.size, shallowLoose)) {\n\t\t\t\t\t\tstate.setSize(size.width, size.height, size.top, size.left);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check pixelratio\n\t\t\t\t\tif (dpr && state.viewport.dpr !== makeDpr(dpr)) state.setDpr(dpr);\n\t\t\t\t\t// Check frameloop\n\t\t\t\t\tif (state.frameloop !== frameloop) state.setFrameloop(frameloop);\n\n\t\t\t\t\tisConfigured = true;\n\t\t\t\t},\n\t\t\t};\n\t\t};\n\t});\n}\n\n/**\n * Type representing the canvas configurator returned by canvasRootInitializer.\n */\nexport type NgtCanvasConfigurator = ReturnType<ReturnType<typeof canvasRootInitializer>>;\n\n/**\n * Computes the initial size for a canvas element.\n * @internal\n */\nfunction computeInitialSize(canvas: NgtCanvasElement, defaultSize?: NgtSize): NgtSize {\n\tif (defaultSize) return defaultSize;\n\n\tif (typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement && canvas.parentElement) {\n\t\treturn canvas.parentElement.getBoundingClientRect();\n\t}\n\n\tif (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {\n\t\treturn { width: canvas.width, height: canvas.height, top: 0, left: 0 };\n\t}\n\n\treturn { width: 0, height: 0, top: 0, left: 0 };\n}\n\n/**\n * Disposes an object and all its disposable properties.\n *\n * Recursively calls dispose() on the object and all its properties that have\n * a dispose method, except for Scene objects which are handled separately.\n *\n * @typeParam T - The type of the object to dispose\n * @param obj - The object to dispose\n */\nexport function dispose<T extends NgtDisposable>(obj: T): void {\n\tif (obj.type !== 'Scene') obj.dispose?.();\n\tfor (const p in obj) {\n\t\tconst prop = obj[p] as NgtDisposable | undefined;\n\t\tif (prop?.type !== 'Scene') prop?.dispose?.();\n\t}\n}\n","import { ChangeDetectorRef, Component, effect } from '@angular/core';\nimport { ActivationEnd, Router, RouterOutlet } from '@angular/router';\nimport { filter } from 'rxjs';\n\n/**\n * Component for rendering Three.js scenes based on Angular Router routes.\n *\n * This component wraps a router-outlet and ensures proper change detection\n * when routes change. Use this when you want to have different Three.js scenes\n * for different routes in your application.\n *\n * @example\n * ```typescript\n * // In your routes configuration\n * const routes: Routes = [\n * { path: 'scene1', component: Scene1Component },\n * { path: 'scene2', component: Scene2Component },\n * ];\n *\n * // In your template\n * <ngt-canvas>\n * <ngt-routed-scene *canvasContent />\n * </ngt-canvas>\n * ```\n */\n@Component({\n\tselector: 'ngt-routed-scene',\n\ttemplate: `\n\t\t<router-outlet />\n\t`,\n\timports: [RouterOutlet],\n})\nexport class NgtRoutedScene {\n\tconstructor(router: Router, cdr: ChangeDetectorRef) {\n\t\teffect((onCleanup) => {\n\t\t\tconst sub = router.events\n\t\t\t\t.pipe(filter((event) => event instanceof ActivationEnd))\n\t\t\t\t.subscribe(cdr.detectChanges.bind(cdr));\n\t\t\tonCleanup(() => sub.unsubscribe());\n\t\t});\n\t}\n}\n","import { DestroyRef, effect, inject, Injector } from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport { injectStore } from '../store';\nimport type { NgtBeforeRenderRecord } from '../types';\n\n/**\n * `beforeRender` invokes its callback on every frame. Hence, the notion of tracking\n * changes (i.e: signals) does not really matter since we're getting latest values of the things we need on every frame anyway.\n *\n * If `priority` is a Signal, `beforeRender` will set up an Effect internally and returns the `EffectRef#destroy` instead.\n *\n * @example\n * ```ts\n * const destroy = beforeRender(\n * ({ gl, camera }) => {\n * // before render logic\n * },\n * {\n * priority: this.priority, // this.priority is a Signal<number>\n * }\n * )\n * ```\n */\nexport function beforeRender(\n\tcb: NgtBeforeRenderRecord['callback'],\n\t{ priority = 0, injector }: { priority?: number | (() => number); injector?: Injector } = {},\n) {\n\tif (typeof priority === 'function') {\n\t\tconst effectRef = assertInjector(beforeRender, injector, () => {\n\t\t\tconst store = injectStore();\n\t\t\tconst ref = effect((onCleanup) => {\n\t\t\t\tconst p = priority();\n\t\t\t\tconst sub = store.snapshot.internal.subscribe(cb, p, store);\n\t\t\t\tonCleanup(() => sub());\n\t\t\t});\n\n\t\t\tinject(DestroyRef).onDestroy(() => void ref.destroy());\n\n\t\t\treturn ref;\n\t\t});\n\n\t\treturn effectRef.destroy.bind(effectRef);\n\t}\n\n\treturn assertInjector(beforeRender, injector, () => {\n\t\tconst store = injectStore();\n\t\tconst sub = store.snapshot.internal.subscribe(cb, priority, store);\n\t\tinject(DestroyRef).onDestroy(() => void sub());\n\t\treturn sub;\n\t});\n}\n\n/**\n * @deprecated Use `beforeRender` instead. Will be removed in v5.0.0\n * @since v4.0.0\n */\nexport const injectBeforeRender = beforeRender;\n","import {\n\tcomputed,\n\tDestroyRef,\n\tDirective,\n\teffect,\n\tElementRef,\n\tinject,\n\tInjector,\n\tmodel,\n\toutput,\n\tRenderer2,\n} from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport type { NgtAfterAttach } from '../types';\nimport { is } from './is';\nimport { resolveRef } from './resolve-ref';\n\n/**\n * Directive for binding Three.js element lifecycle events to outputs.\n *\n * This directive provides outputs for Angular Three element events and native\n * Three.js events like added, removed, and disposed. It's designed to be used\n * as a host directive.\n *\n * Outputs:\n * - Angular Three: created, attached, updated\n * - Three.js: added, removed, childadded, childremoved, change, disposed\n *\n * Input: `elementEvents` - The element to listen for events on\n *\n * @example\n * ```typescript\n * @Component({\n * hostDirectives: [{\n * directive: NgtElementEvents,\n * inputs: ['elementEvents: events'],\n * outputs: ['attached', 'updated']\n * }]\n * })\n * export class MyMesh {\n * elementEvents = inject(NgtElementEvents, { host: true });\n *\n * constructor() {\n * this.elementEvents.events.set(this.meshRef);\n * }\n * }\n * ```\n */\n@Directive({ selector: '[elementEvents]' })\nexport class NgtElementEvents<TElement extends object> {\n\tcreated = output<TElement>();\n\tattached = output<NgtAfterAttach<TElement>>();\n\tupdated = output<TElement>();\n\n\tadded = output<any>();\n\tremoved = output<any>();\n\tchildadded = output<any>();\n\tchildremoved = output<any>();\n\tchange = output<any>();\n\tdisposed = output<any>();\n\n\t// NOTE: we use model here to allow for the hostDirective host to set this value\n\tevents = model<\n\t\tElementRef<TElement> | TElement | null | undefined | (() => ElementRef<TElement> | TElement | null | undefined)\n\t>(undefined, { alias: 'elementEvents' });\n\n\tconstructor() {\n\t\tconst obj = computed(() => {\n\t\t\tconst ngtObject = this.events();\n\t\t\tif (typeof ngtObject === 'function') return ngtObject();\n\t\t\treturn ngtObject;\n\t\t});\n\n\t\telementEvents(obj, {\n\t\t\t// @ts-expect-error - different type\n\t\t\tcreated: this.emitEvent('created'),\n\t\t\t// @ts-expect-error - different type\n\t\t\tupdated: this.emitEvent('updated'),\n\t\t\t// @ts-expect-error - different type for attached\n\t\t\tattached: this.emitEvent('attached'),\n\t\t\tadded: this.emitEvent('added'),\n\t\t\tremoved: this.emitEvent('removed'),\n\t\t\tchildadded: this.emitEvent('childadded'),\n\t\t\tchildremoved: this.emitEvent('childremoved'),\n\t\t\tchange: this.emitEvent('change'),\n\t\t\tdisposed: this.emitEvent('disposed'),\n\t\t});\n\t}\n\n\tprivate emitEvent<\n\t\tTEvent extends\n\t\t\t| 'created'\n\t\t\t| 'updated'\n\t\t\t| 'attached'\n\t\t\t| 'added'\n\t\t\t| 'removed'\n\t\t\t| 'childadded'\n\t\t\t| 'childremoved'\n\t\t\t| 'change'\n\t\t\t| 'disposed',\n\t>(eventName: TEvent) {\n\t\treturn this[eventName].emit.bind(this[eventName]);\n\t}\n}\n\n/**\n * Sets up element lifecycle event listeners on a Three.js element.\n *\n * @typeParam TElement - The type of the element\n * @param target - Signal containing the target element\n * @param events - Object mapping event names to handler functions\n * @param options - Optional injector for dependency injection\n * @returns Array of cleanup functions\n *\n * @example\n * ```typescript\n * elementEvents(\n * () => this.meshRef.nativeElement,\n * {\n * created: (mesh) => console.log('Mesh created'),\n * attached: ({ parent, node }) => console.log('Attached to', parent),\n * }\n * );\n * ```\n */\nexport function elementEvents<TElement extends object>(\n\ttarget: () => ElementRef<TElement> | TElement | null | undefined,\n\tevents: {\n\t\tcreated?: (element: TElement) => void;\n\t\tupdated?: (element: TElement) => void;\n\t\tattached?: (element: NgtAfterAttach<TElement>) => void;\n\t\tadded?: (event: any) => void;\n\t\tremoved?: (event: any) => void;\n\t\tchildadded?: (event: any) => void;\n\t\tchildremoved?: (event: any) => void;\n\t\tchange?: (event: any) => void;\n\t\tdisposed?: (event: any) => void;\n\t},\n\t{ injector }: { injector?: Injector } = {},\n) {\n\treturn assertInjector(elementEvents, injector, () => {\n\t\tconst renderer = inject(Renderer2);\n\n\t\tconst cleanUps: Array<() => void> = [];\n\n\t\teffect((onCleanup) => {\n\t\t\tconst targetObj = resolveRef(target());\n\n\t\t\tif (!targetObj || !is.instance(targetObj)) return;\n\n\t\t\tObject.keys(events).forEach((eventName) => {\n\t\t\t\tcleanUps.push(renderer.listen(targetObj, eventName, events[eventName as keyof typeof events] as any));\n\t\t\t});\n\n\t\t\tonCleanup(() => {\n\t\t\t\tcleanUps.forEach((cleanUp) => cleanUp());\n\t\t\t});\n\t\t});\n\n\t\tinject(DestroyRef).onDestroy(() => {\n\t\t\tcleanUps.forEach((cleanUp) => cleanUp());\n\t\t});\n\n\t\treturn cleanUps;\n\t});\n}\n","import {\n\tcomputed,\n\tDestroyRef,\n\tDirective,\n\teffect,\n\tElementRef,\n\tinject,\n\tInjector,\n\tmodel,\n\toutput,\n\tRenderer2,\n} from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport type * as THREE from 'three';\nimport type { NgtEventHandlers, NgtThreeEvent } from '../types';\nimport { is } from './is';\nimport { resolveRef } from './resolve-ref';\n\n/**\n * Directive for binding Three.js pointer events to outputs.\n *\n * This directive provides outputs for all Three.js pointer events that can be used\n * with standard Angular event binding syntax. It's designed to be used as a host directive.\n *\n * Outputs: click, dblclick, contextmenu, pointerup, pointerdown, pointerover,\n * pointerout, pointerenter, pointerleave, pointermove, pointermissed, pointercancel, wheel\n *\n * Input: `objectEvents` - The Three.js object to listen for events on\n *\n * @example\n * ```typescript\n * @Component({\n * hostDirectives: [{\n * directive: NgtObjectEvents,\n * inputs: ['objectEvents: events'],\n * outputs: ['click', 'pointerover', 'pointerout']\n * }]\n * })\n * export class MyMesh {\n * objectEvents = inject(NgtObjectEvents, { host: true });\n *\n * constructor() {\n * this.objectEvents.events.set(this.meshRef);\n * }\n * }\n * ```\n */\n@Directive({ selector: '[objectEvents]' })\nexport class NgtObjectEvents {\n\tclick = output<NgtThreeEvent<MouseEvent>>();\n\tdblclick = output<NgtThreeEvent<MouseEvent>>();\n\tcontextmenu = output<NgtThreeEvent<MouseEvent>>();\n\tpointerup = output<NgtThreeEvent<PointerEvent>>();\n\tpointerdown = output<NgtThreeEvent<PointerEvent>>();\n\tpointerover = output<NgtThreeEvent<PointerEvent>>();\n\tpointerout = output<NgtThreeEvent<PointerEvent>>();\n\tpointerenter = output<NgtThreeEvent<PointerEvent>>();\n\tpointerleave = output<NgtThreeEvent<PointerEvent>>();\n\tpointermove = output<NgtThreeEvent<PointerEvent>>();\n\tpointermissed = output<NgtThreeEvent<MouseEvent>>();\n\tpointercancel = output<NgtThreeEvent<PointerEvent>>();\n\twheel = output<NgtThreeEvent<WheelEvent>>();\n\n\t// NOTE: we use model here to allow for the hostDirective host to set this value\n\tevents = model<\n\t\t| ElementRef<THREE.Object3D>\n\t\t| THREE.Object3D\n\t\t| null\n\t\t| undefined\n\t\t| (() => ElementRef<THREE.Object3D> | THREE.Object3D | null | undefined)\n\t>(undefined, { alias: 'objectEvents' });\n\n\tconstructor() {\n\t\tconst obj = computed(() => {\n\t\t\tconst ngtObject = this.events();\n\t\t\tif (typeof ngtObject === 'function') return ngtObject();\n\t\t\treturn ngtObject;\n\t\t});\n\n\t\tobjectEvents(obj, {\n\t\t\tclick: this.emitEvent('click'),\n\t\t\tdblclick: this.emitEvent('dblclick'),\n\t\t\tcontextmenu: this.emitEvent('contextmenu'),\n\t\t\tpointerup: this.emitEvent('pointerup'),\n\t\t\tpointerdown: this.emitEvent('pointerdown'),\n\t\t\tpointerover: this.emitEvent('pointerover'),\n\t\t\tpointerout: this.emitEvent('pointerout'),\n\t\t\tpointerenter: this.emitEvent('pointerenter'),\n\t\t\tpointerleave: this.emitEvent('pointerleave'),\n\t\t\tpointermove: this.emitEvent('pointermove'),\n\t\t\tpointermissed: this.emitEvent('pointermissed'),\n\t\t\tpointercancel: this.emitEvent('pointercancel'),\n\t\t\twheel: this.emitEvent('wheel'),\n\t\t});\n\t}\n\n\tprivate emitEvent<TEvent extends keyof NgtEventHandlers>(eventName: TEvent) {\n\t\treturn this[eventName].emit.bind(this[eventName]) as NgtEventHandlers[TEvent];\n\t}\n}\n\n/**\n * @deprecated Use objectEvents instead. Will be removed in v5.0.0\n * @since v4.0.0\n */\nexport const injectObjectEvents = objectEvents;\n\n/**\n * Sets up event listeners on a Three.js object.\n *\n * This function creates reactive event bindings that automatically clean up\n * when the target changes or the component is destroyed.\n *\n * @param target - Signal containing the target Object3D\n * @param events - Object mapping event names to handler functions\n * @param options - Optional injector for dependency injection\n * @returns Array of cleanup functions\n *\n * @example\n * ```typescript\n * objectEvents(\n * () => this.meshRef.nativeElement,\n * {\n * click: (event) => console.log('Clicked!', event),\n * pointerover: (event) => console.log('Hover start'),\n * }\n * );\n * ```\n */\nexport function objectEvents(\n\ttarget: () => ElementRef<THREE.Object3D> | THREE.Object3D | null | undefined,\n\tevents: NgtEventHandlers,\n\t{ injector }: { injector?: Injector } = {},\n) {\n\treturn assertInjector(objectEvents, injector, () => {\n\t\tconst renderer = inject(Renderer2);\n\n\t\tconst cleanUps: Array<() => void> = [];\n\n\t\teffect((onCleanup) => {\n\t\t\tconst targetObj = resolveRef(target());\n\n\t\t\tif (!targetObj || !is.instance(targetObj)) return;\n\n\t\t\tObject.entries(events).forEach(([eventName, eventHandler]) => {\n\t\t\t\tcleanUps.push(renderer.listen(targetObj, eventName, eventHandler));\n\t\t\t});\n\n\t\t\tonCleanup(() => {\n\t\t\t\tcleanUps.forEach((cleanUp) => cleanUp());\n\t\t\t});\n\t\t});\n\n\t\tinject(DestroyRef).onDestroy(() => {\n\t\t\tcleanUps.forEach((cleanUp) => cleanUp());\n\t\t});\n\n\t\treturn cleanUps;\n\t});\n}\n","import { OutputEmitterRef } from '@angular/core';\n\n/**\n * Gets the emit function from an OutputEmitterRef if it has active listeners.\n *\n * @typeParam T - The type of value the emitter emits\n * @param emitterRef - The output emitter reference\n * @returns The bound emit function, or undefined if no listeners\n */\nexport function getEmitter<T>(emitterRef: OutputEmitterRef<T> | undefined) {\n\tif (!emitterRef || !emitterRef['listeners'] || emitterRef['destroyed']) return undefined;\n\treturn emitterRef.emit.bind(emitterRef);\n}\n\n/**\n * Checks if any of the provided emitter refs have active listeners.\n *\n * @param emitterRefs - The output emitter references to check\n * @returns true if any emitter has listeners\n */\nexport function hasListener(...emitterRefs: (OutputEmitterRef<unknown> | undefined)[]) {\n\treturn emitterRefs.some(\n\t\t(emitterRef) =>\n\t\t\temitterRef && !emitterRef['destroyed'] && emitterRef['listeners'] && emitterRef['listeners'].length > 0,\n\t);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["cached","memoizedLoaders","normalizeInputs"],"mappings":";;;;;;;;;AAAA;;;;;AAKG;AAEH;AACO,MAAM,sBAAsB,GAAG;AACtC;AACO,MAAM,uBAAuB,GAAG;AACvC;AACO,MAAM,uBAAuB,GAAG;AACvC;AAC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C,WAAW,CAAC,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CACxG;AACF;;ACzBA;;AAEG;;;;"}
1
+ {"version":3,"file":"angular-three.mjs","sources":["../../../../libs/core/src/lib/renderer/constants.ts","../../../../libs/core/src/lib/utils/is.ts","../../../../libs/core/src/lib/directives/common.ts","../../../../libs/core/src/lib/directives/args.ts","../../../../libs/core/src/lib/loop.ts","../../../../libs/core/src/lib/utils/signal-state.ts","../../../../libs/core/src/lib/utils/update.ts","../../../../libs/core/src/lib/instance.ts","../../../../libs/core/src/lib/utils/apply-props.ts","../../../../libs/core/src/lib/renderer/catalogue.ts","../../../../libs/core/src/lib/renderer/state.ts","../../../../libs/core/src/lib/utils/make.ts","../../../../libs/core/src/lib/events.ts","../../../../libs/core/src/lib/utils/attach.ts","../../../../libs/core/src/lib/renderer/utils.ts","../../../../libs/core/src/lib/renderer/renderer.ts","../../../../libs/core/src/lib/store.ts","../../../../libs/core/src/lib/utils/resolve-ref.ts","../../../../libs/core/src/lib/directives/parent.ts","../../../../libs/core/src/lib/directives/selection.ts","../../../../libs/core/src/lib/html.ts","../../../../libs/core/src/lib/loader.ts","../../../../libs/core/src/lib/loader-resource.ts","../../../../libs/core/src/lib/pipes/hexify.ts","../../../../libs/core/src/lib/utils/parameters.ts","../../../../libs/core/src/lib/portal.ts","../../../../libs/core/src/lib/roots.ts","../../../../libs/core/src/lib/routed-scene.ts","../../../../libs/core/src/lib/utils/before-render.ts","../../../../libs/core/src/lib/utils/element-events.ts","../../../../libs/core/src/lib/utils/object-events.ts","../../../../libs/core/src/lib/utils/output-ref.ts","../../../../libs/core/src/angular-three.ts"],"sourcesContent":["/**\n * @fileoverview Internal constants used by the Angular Three renderer.\n *\n * These flags are used to mark DOM nodes and track renderer state.\n * @internal\n */\n\n/** Flag indicating a node is managed by the Angular Three renderer */\nexport const NGT_RENDERER_NODE_FLAG = '__ngt_renderer__';\n/** Flag for canvas content template comments */\nexport const NGT_CANVAS_CONTENT_FLAG = '__ngt_renderer_canvas_content__';\n/** Flag for portal content template comments */\nexport const NGT_PORTAL_CONTENT_FLAG = '__ngt_renderer_portal_content__';\n/** Flag for args directive comments */\nexport const NGT_ARGS_FLAG = '__ngt_renderer_args__';\n/** Flag for parent directive comments */\nexport const NGT_PARENT_FLAG = '__ngt_renderer_parent__';\n/** Internal flag for adding comment nodes */\nexport const NGT_INTERNAL_ADD_COMMENT_FLAG = '__ngt_renderer_add_comment__';\n/** Internal flag for setting parent on comment nodes */\nexport const NGT_INTERNAL_SET_PARENT_COMMENT_FLAG = '__ngt_renderer_set_parent_comment__';\n/** Flag for getting node attributes */\nexport const NGT_GET_NODE_ATTRIBUTE_FLAG = '__ngt_get_node_attribute__';\n/** Flag for DOM parent element reference */\nexport const NGT_DOM_PARENT_FLAG = '__ngt_dom_parent__';\n/** Flag indicating the delegate renderer's destroyNode has been patched */\nexport const NGT_DELEGATE_RENDERER_DESTROY_NODE_PATCHED_FLAG = '__ngt_delegate_renderer_destroy_node_patched__';\n/** Flag for HTML directive classes */\nexport const NGT_HTML_FLAG = '__ngt_html__';\n\n/** Native Three.js EventDispatcher events */\nexport const THREE_NATIVE_EVENTS = ['added', 'removed', 'childadded', 'childremoved', 'change', 'disposed'];\n","import type { ElementRef } from '@angular/core';\nimport type * as THREE from 'three';\nimport type { NgtAnyRecord, NgtEquConfig, NgtInstanceNode, NgtRendererLike } from '../types';\n\n/**\n * Collection of type checking and comparison utilities for Angular Three.\n *\n * These utilities help with runtime type checking of Three.js objects,\n * Angular references, and general equality comparisons.\n *\n * @example\n * ```typescript\n * // Check if something is a Three.js mesh\n * if (is.three<THREE.Mesh>(obj, 'isMesh')) {\n * // obj is typed as THREE.Mesh\n * }\n *\n * // Check if two values are equal\n * if (is.equ(a, b, { objects: 'shallow' })) {\n * // values are considered equal\n * }\n * ```\n */\nexport const is = {\n\t/** Checks if value is a plain object (not array or function) */\n\tobj: (a: unknown): a is object => a === Object(a) && !Array.isArray(a) && typeof a !== 'function',\n\t/** Checks if value is a Three.js Material */\n\tmaterial: (a: unknown): a is THREE.Material => !!a && (a as THREE.Material).isMaterial,\n\t/** Checks if value is a Three.js BufferGeometry */\n\tgeometry: (a: unknown): a is THREE.BufferGeometry => !!a && (a as THREE.BufferGeometry).isBufferGeometry,\n\t/** Checks if value is a Three.js OrthographicCamera */\n\torthographicCamera: (a: unknown): a is THREE.OrthographicCamera =>\n\t\t!!a && (a as THREE.OrthographicCamera).isOrthographicCamera,\n\t/** Checks if value is a Three.js PerspectiveCamera */\n\tperspectiveCamera: (a: unknown): a is THREE.PerspectiveCamera =>\n\t\t!!a && (a as THREE.PerspectiveCamera).isPerspectiveCamera,\n\t/** Checks if value is a Three.js Camera */\n\tcamera: (a: unknown): a is THREE.Camera => !!a && (a as THREE.Camera).isCamera,\n\t/** Checks if value is a renderer-like object with a render method */\n\trenderer: (a: unknown) => !!a && typeof a === 'object' && 'render' in a && typeof a['render'] === 'function',\n\t/** Checks if value is a Three.js Scene */\n\tscene: (a: unknown): a is THREE.Scene => !!a && (a as THREE.Scene).isScene,\n\t/** Checks if value is an Angular ElementRef */\n\tref: (a: unknown): a is ElementRef => !!a && typeof a === 'object' && 'nativeElement' in a,\n\t/** Checks if value is an Angular Three instance node (prepared object) */\n\tinstance: (a: unknown): a is NgtInstanceNode => !!a && !!(a as NgtAnyRecord)['__ngt__'],\n\t/** Checks if value is a Three.js Object3D */\n\tobject3D: (a: unknown): a is THREE.Object3D => !!a && (a as THREE.Object3D).isObject3D,\n\t/**\n\t * Generic Three.js type check using the is* pattern.\n\t * @example is.three<THREE.Mesh>(obj, 'isMesh')\n\t */\n\tthree: <TThreeEntity extends object, TKey extends keyof TThreeEntity = keyof TThreeEntity>(\n\t\ta: unknown,\n\t\tisKey: TKey extends `is${infer K}` ? TKey : never,\n\t): a is TThreeEntity => !!a && (a as any)[isKey],\n\t/** Checks if value is a valid Three.js ColorRepresentation */\n\tcolorRepresentation: (a: unknown): a is THREE.ColorRepresentation =>\n\t\ta != null && (typeof a === 'string' || typeof a === 'number' || is.three<THREE.Color>(a, 'isColor')),\n\t/** Checks if object has colorSpace or outputColorSpace property */\n\tcolorSpaceExist: <\n\t\tT extends NgtRendererLike | THREE.Texture | object,\n\t\tP = T extends NgtRendererLike ? { outputColorSpace: string } : { colorSpace: string },\n\t>(\n\t\tobject: T,\n\t): object is T & P => 'colorSpace' in object || 'outputColorSpace' in object,\n\t/**\n\t * Deep equality comparison with configurable behavior for arrays and objects.\n\t * @param a - First value to compare\n\t * @param b - Second value to compare\n\t * @param config - Comparison configuration\n\t */\n\tequ(a: any, b: any, { arrays = 'shallow', objects = 'reference', strict = true }: NgtEquConfig = {}) {\n\t\t// Wrong type or one of the two undefined, doesn't match\n\t\tif (typeof a !== typeof b || !!a !== !!b) return false;\n\t\t// Atomic, just compare a against b\n\t\tif (typeof a === 'string' || typeof a === 'number') return a === b;\n\t\tconst isObj = is.obj(a);\n\t\tif (isObj && objects === 'reference') return a === b;\n\t\tconst isArr = Array.isArray(a);\n\t\tif (isArr && arrays === 'reference') return a === b;\n\t\t// Array or Object, shallow compare first to see if it's a match\n\t\tif ((isArr || isObj) && a === b) return true;\n\t\t// Last resort, go through keys\n\t\tlet i;\n\t\tfor (i in a) if (!(i in b)) return false;\n\t\tfor (i in strict ? b : a) if (a[i] !== b[i]) return false;\n\t\tif (i === void 0) {\n\t\t\tif (isArr && a.length === 0 && b.length === 0) return true;\n\t\t\tif (isObj && Object.keys(a).length === 0 && Object.keys(b).length === 0) return true;\n\t\t\tif (a !== b) return false;\n\t\t}\n\t\treturn true;\n\t},\n};\n","import {\n\tDestroyRef,\n\tDirective,\n\teffect,\n\tEmbeddedViewRef,\n\tinject,\n\tInjector,\n\tSignal,\n\tTemplateRef,\n\tViewContainerRef,\n} from '@angular/core';\nimport { is } from '../utils/is';\n\n/**\n * Abstract base class for Angular Three structural directives.\n *\n * This class provides common functionality for structural directives like `NgtArgs` and `NgtParent`,\n * including view management, value injection, and change detection.\n *\n * Subclasses must implement:\n * - `validate()`: Returns true if the directive has a valid value to inject\n * - `linkedValue`: A signal containing the current value\n * - `shouldSkipRender`: A signal indicating whether rendering should be skipped\n *\n * @typeParam TValue - The type of value this directive manages\n */\n@Directive()\nexport abstract class NgtCommonDirective<TValue> {\n\tprivate vcr = inject(ViewContainerRef);\n\tprivate template = inject(TemplateRef);\n\tprotected injector = inject(Injector);\n\n\tprotected injected = false;\n\tprotected injectedValue: TValue | null = null;\n\tprivate view?: EmbeddedViewRef<unknown>;\n\n\tprotected get commentNode() {\n\t\treturn this.vcr.element.nativeElement;\n\t}\n\n\tabstract validate(): boolean;\n\tprotected abstract linkedValue: Signal<TValue | null>;\n\tprotected abstract shouldSkipRender: Signal<boolean>;\n\n\tprotected constructor() {\n\t\teffect(() => {\n\t\t\tif (this.shouldSkipRender()) return;\n\n\t\t\tconst value = this.linkedValue();\n\n\t\t\tif (is.equ(value, this.injectedValue)) {\n\t\t\t\t// we have the same value as before, no need to update\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.injected = false;\n\t\t\tthis.injectedValue = value;\n\t\t\tthis.createView();\n\t\t});\n\n\t\tinject(DestroyRef).onDestroy(() => {\n\t\t\tthis.view?.destroy();\n\t\t});\n\t}\n\n\tget value() {\n\t\tif (this.validate()) {\n\t\t\tthis.injected = true;\n\t\t\treturn this.injectedValue;\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected beforeCreateView() {\n\t\t/* noop */\n\t}\n\n\tprivate createView() {\n\t\tif (this.view && !this.view.destroyed) this.view.destroy();\n\n\t\tthis.beforeCreateView();\n\n\t\tthis.view = this.vcr.createEmbeddedView(this.template);\n\t\tthis.view.detectChanges();\n\t}\n}\n","import { computed, Directive, input, linkedSignal } from '@angular/core';\nimport { NGT_ARGS_FLAG, NGT_INTERNAL_ADD_COMMENT_FLAG } from '../renderer/constants';\nimport { NgtCommonDirective } from './common';\n\n/**\n * Structural directive for passing constructor arguments to Three.js elements.\n *\n * The `NgtArgs` directive allows you to pass constructor arguments to Three.js objects\n * when they are created. This is essential for objects that require constructor arguments\n * like geometries, materials, and custom objects.\n *\n * @example\n * ```html\n * <!-- Pass arguments to BoxGeometry constructor -->\n * <ngt-mesh>\n * <ngt-box-geometry *args=\"[1, 2, 3]\" />\n * </ngt-mesh>\n *\n * <!-- Use with primitive for external objects -->\n * <ngt-primitive *args=\"[myObject]\" />\n * ```\n */\n@Directive({ selector: 'ng-template[args]' })\nexport class NgtArgs extends NgtCommonDirective<any[]> {\n\targs = input.required<any[] | null>();\n\n\tprotected linkedValue = linkedSignal(this.args);\n\tprotected shouldSkipRender = computed(() => {\n\t\tconst args = this.args();\n\t\treturn args == null || !Array.isArray(args) || (args.length === 1 && args[0] === null);\n\t});\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tconst commentNode = this.commentNode;\n\t\tcommentNode.data = NGT_ARGS_FLAG;\n\t\tcommentNode[NGT_ARGS_FLAG] = true;\n\n\t\tif (commentNode[NGT_INTERNAL_ADD_COMMENT_FLAG]) {\n\t\t\tcommentNode[NGT_INTERNAL_ADD_COMMENT_FLAG]('args', this.injector);\n\t\t\tdelete commentNode[NGT_INTERNAL_ADD_COMMENT_FLAG];\n\t\t}\n\t}\n\n\tvalidate() {\n\t\treturn !this.injected && !!this.injectedValue?.length;\n\t}\n}\n","import { inject, InjectionToken } from '@angular/core';\nimport type { NgtCanvasElement, NgtGlobalRenderCallback, NgtState } from './types';\nimport type { SignalState } from './utils/signal-state';\n\n/**\n * Global map of canvas elements to their associated stores.\n *\n * This map maintains references to all active Angular Three canvas roots,\n * allowing the render loop to iterate over and render all active scenes.\n */\nexport const roots = new Map<NgtCanvasElement, SignalState<NgtState>>();\n\ntype SubItem = { callback: NgtGlobalRenderCallback };\n\nfunction createSubs(callback: NgtGlobalRenderCallback, subs: Set<SubItem>): () => void {\n\tconst sub = { callback };\n\tsubs.add(sub);\n\treturn () => void subs.delete(sub);\n}\n\nconst globalEffects: Set<SubItem> = new Set();\nconst globalAfterEffects: Set<SubItem> = new Set();\nconst globalTailEffects: Set<SubItem> = new Set();\n\n/**\n * Adds a global render callback which is called each frame.\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addEffect\n */\nexport const addEffect = (callback: NgtGlobalRenderCallback) => createSubs(callback, globalEffects);\n\n/**\n * Adds a global after-render callback which is called each frame.\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addAfterEffect\n */\nexport const addAfterEffect = (callback: NgtGlobalRenderCallback) => createSubs(callback, globalAfterEffects);\n\n/**\n * Adds a global callback which is called when rendering stops.\n * @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#addTail\n */\nexport const addTail = (callback: NgtGlobalRenderCallback) => createSubs(callback, globalTailEffects);\n\nfunction run(effects: Set<SubItem>, timestamp: number) {\n\tif (!effects.size) return;\n\tfor (const { callback } of effects.values()) {\n\t\tcallback(timestamp);\n\t}\n}\n\n/**\n * Type of global effect in the render loop.\n * - 'before': Runs before the main render\n * - 'after': Runs after the main render\n * - 'tail': Runs when rendering stops\n */\nexport type NgtGlobalEffectType = 'before' | 'after' | 'tail';\n\n/**\n * Executes all global effects of the specified type.\n *\n * @param type - The type of global effects to flush ('before', 'after', or 'tail')\n * @param timestamp - The current timestamp from requestAnimationFrame\n */\nexport function flushGlobalEffects(type: NgtGlobalEffectType, timestamp: number): void {\n\tswitch (type) {\n\t\tcase 'before':\n\t\t\treturn run(globalEffects, timestamp);\n\t\tcase 'after':\n\t\t\treturn run(globalAfterEffects, timestamp);\n\t\tcase 'tail':\n\t\t\treturn run(globalTailEffects, timestamp);\n\t}\n}\n\nfunction update(timestamp: number, store: SignalState<NgtState>, frame?: XRFrame) {\n\tconst state = store.snapshot;\n\t// Run local effects\n\tlet delta = state.clock.getDelta();\n\t// In frameloop='never' mode, clock times are updated using the provided timestamp\n\tif (state.frameloop === 'never' && typeof timestamp === 'number') {\n\t\tdelta = timestamp - state.clock.elapsedTime;\n\t\tstate.clock.oldTime = state.clock.elapsedTime;\n\t\tstate.clock.elapsedTime = timestamp;\n\t}\n\t// Call subscribers (beforeRender)\n\tconst subscribers = state.internal.subscribers;\n\tfor (let i = 0; i < subscribers.length; i++) {\n\t\tconst subscription = subscribers[i];\n\t\tsubscription.callback({ ...subscription.store.snapshot, delta, frame });\n\t}\n\t// Render content\n\tif (!state.internal.priority && state.gl.render) state.gl.render(state.scene, state.camera);\n\t// Decrease frame count\n\tstate.internal.frames = Math.max(0, state.internal.frames - 1);\n\treturn state.frameloop === 'always' ? 1 : state.internal.frames;\n}\n\nfunction createLoop<TCanvas>(roots: Map<TCanvas, SignalState<NgtState>>) {\n\tlet running = false;\n\tlet repeat: number;\n\tlet frame: number;\n\tlet beforeRenderInProgress = false;\n\n\tfunction loop(timestamp: number): void {\n\t\tframe = requestAnimationFrame(loop);\n\t\trunning = true;\n\t\trepeat = 0;\n\n\t\t// Run effects\n\t\tflushGlobalEffects('before', timestamp);\n\n\t\t// Render all roots\n\t\tbeforeRenderInProgress = true;\n\t\tfor (const root of roots.values()) {\n\t\t\tconst state = root.snapshot;\n\t\t\t// If the frameloop is invalidated, do not run another frame\n\t\t\tif (\n\t\t\t\tstate.internal.active &&\n\t\t\t\t(state.frameloop === 'always' || state.internal.frames > 0) &&\n\t\t\t\t!state.gl.xr?.isPresenting\n\t\t\t) {\n\t\t\t\trepeat += update(timestamp, root);\n\t\t\t}\n\t\t}\n\t\tbeforeRenderInProgress = false;\n\n\t\t// Run after-effects\n\t\tflushGlobalEffects('after', timestamp);\n\n\t\t// Stop the loop if nothing invalidates it\n\t\tif (repeat === 0) {\n\t\t\t// Tail call effects, they are called when rendering stops\n\t\t\tflushGlobalEffects('tail', timestamp);\n\n\t\t\t// Flag end of operation\n\t\t\trunning = false;\n\t\t\treturn cancelAnimationFrame(frame);\n\t\t}\n\t}\n\n\tfunction invalidate(store?: SignalState<NgtState>, frames = 1): void {\n\t\tconst state = store?.snapshot;\n\t\tif (!state) return roots.forEach((root) => invalidate(root, frames));\n\t\tif (state.gl.xr?.isPresenting || !state.internal.active || state.frameloop === 'never') return;\n\t\tif (frames > 1) {\n\t\t\t// legacy support for people using frames parameters\n\t\t\t// Increase frames, do not go higher than 60\n\t\t\tstate.internal.frames = Math.min(60, state.internal.frames + frames);\n\t\t} else {\n\t\t\tif (beforeRenderInProgress) {\n\t\t\t\t//called from within a beforeRender, it means the user wants an additional frame\n\t\t\t\tstate.internal.frames = 2;\n\t\t\t} else {\n\t\t\t\t//the user need a new frame, no need to increment further than 1\n\t\t\t\tstate.internal.frames = 1;\n\t\t\t}\n\t\t}\n\n\t\t// If the render-loop isn't active, start it\n\t\tif (!running) {\n\t\t\trunning = true;\n\t\t\trequestAnimationFrame(loop);\n\t\t}\n\t}\n\n\tfunction advance(timestamp: number, runGlobalEffects = true, store?: SignalState<NgtState>, frame?: XRFrame): void {\n\t\tif (runGlobalEffects) flushGlobalEffects('before', timestamp);\n\t\tif (!store) for (const root of roots.values()) update(timestamp, root);\n\t\telse update(timestamp, store, frame);\n\t\tif (runGlobalEffects) flushGlobalEffects('after', timestamp);\n\t}\n\n\treturn { loop, invalidate, advance };\n}\n\n/**\n * Injection token for the Angular Three render loop.\n *\n * Provides access to the render loop controls including invalidate and advance functions.\n */\nexport const NGT_LOOP = new InjectionToken<ReturnType<typeof createLoop>>('NGT_LOOP', {\n\tfactory: () => createLoop(roots),\n});\n\n/**\n * Injects the Angular Three render loop controller.\n *\n * The loop controller provides methods to control the render loop:\n * - `invalidate`: Marks the scene as needing a re-render\n * - `advance`: Manually advances the render loop by one frame\n * - `loop`: The main animation loop function\n *\n * @returns The render loop controller\n *\n * @example\n * ```typescript\n * const loop = injectLoop();\n * // Trigger a re-render\n * loop.invalidate();\n * // Manually advance one frame\n * loop.advance(performance.now());\n * ```\n */\nexport function injectLoop() {\n\treturn inject(NGT_LOOP);\n}\n","/**\n * @fileoverview Signal-based state management ported from ngrx/signals.\n *\n * This module provides a reactive state management solution using Angular signals.\n * It supports deep signal access for nested state properties and efficient state updates.\n *\n * Ported from ngrx/signals. Last synced: 08/16/2025\n */\nimport { computed, isSignal, type Signal, signal, untracked, type WritableSignal } from '@angular/core';\n\ntype NonRecord =\n\t| Iterable<any>\n\t| WeakSet<any>\n\t| WeakMap<any, any>\n\t| Promise<any>\n\t| Date\n\t| Error\n\t| RegExp\n\t| ArrayBuffer\n\t| DataView\n\t| Function;\n\ntype Prettify<T> = { [K in keyof T]: T[K] } & {};\ntype IsRecord<T> = T extends object ? (T extends NonRecord ? false : true) : false;\ntype IsUnknownRecord<T> = string extends keyof T ? true : number extends keyof T ? true : false;\ntype IsKnownRecord<T> = IsRecord<T> extends true ? (IsUnknownRecord<T> extends true ? false : true) : false;\n\nconst STATE_SOURCE = Symbol('STATE_SOURCE');\n\n/**\n * Type representing a writable state source with signals for each property.\n */\nexport type WritableStateSource<State extends object> = {\n\t[STATE_SOURCE]: { [K in keyof State]: WritableSignal<State[K]> };\n};\n\n/**\n * Type representing a readonly state source with signals for each property.\n */\nexport type StateSource<State extends object> = {\n\t[STATE_SOURCE]: { [K in keyof State]: Signal<State[K]> };\n};\n\n/**\n * Function type for partial state updates.\n */\nexport type PartialStateUpdater<State extends object> = (state: State) => Partial<State>;\n\nfunction getState<State extends object>(stateSource: StateSource<State>): State {\n\tconst signals: Record<string | symbol, Signal<unknown>> = stateSource[STATE_SOURCE];\n\treturn Reflect.ownKeys(stateSource[STATE_SOURCE]).reduce((state, key) => {\n\t\tconst value = signals[key]();\n\t\treturn Object.assign(state, { [key]: value });\n\t}, {} as State);\n}\n\nfunction patchState<State extends object>(\n\tstateSource: WritableStateSource<State>,\n\t...updaters: Array<Partial<NoInfer<State>> | PartialStateUpdater<NoInfer<State>>>\n): void {\n\tconst currentState = untracked(() => getState(stateSource));\n\tconst newState = updaters.reduce(\n\t\t(nextState: State, updater) => ({\n\t\t\t...nextState,\n\t\t\t...(typeof updater === 'function' ? updater(nextState) : updater),\n\t\t}),\n\t\tcurrentState,\n\t);\n\n\tconst signals = stateSource[STATE_SOURCE];\n\n\tfor (const key of Reflect.ownKeys(newState)) {\n\t\tconst signalKey = key as keyof State;\n\n\t\tif (currentState[signalKey] !== newState[signalKey]) {\n\t\t\tsignals[signalKey].set(newState[signalKey]);\n\t\t}\n\t}\n}\n\nconst DEEP_SIGNAL = Symbol('DEEP_SIGNAL');\n\n/**\n * A signal that provides deep access to nested properties as signals.\n *\n * Allows accessing nested properties directly on the signal, e.g., `state.user.name()`\n * instead of `state().user.name`.\n */\nexport type DeepSignal<T> = Signal<T> &\n\t(IsKnownRecord<T> extends true\n\t\t? Readonly<{\n\t\t\t\t[K in keyof T]: IsKnownRecord<T[K]> extends true ? DeepSignal<T[K]> : Signal<T[K]>;\n\t\t\t}>\n\t\t: unknown);\n\n/**\n * Converts a regular signal to a deep signal that allows nested property access.\n *\n * @typeParam T - The type of the signal's value\n * @param signal - The signal to convert\n * @returns A DeepSignal with nested property access\n */\nexport function toDeepSignal<T>(signal: Signal<T>): DeepSignal<T> {\n\treturn new Proxy(signal, {\n\t\thas(target: any, prop) {\n\t\t\treturn !!this.get!(target, prop, undefined);\n\t\t},\n\t\tget(target: any, prop) {\n\t\t\tconst value = untracked(target);\n\t\t\tif (!isRecord(value) || !(prop in value)) {\n\t\t\t\tif (isSignal(target[prop]) && (target[prop] as any)[DEEP_SIGNAL]) {\n\t\t\t\t\tdelete target[prop];\n\t\t\t\t}\n\n\t\t\t\treturn target[prop];\n\t\t\t}\n\n\t\t\tif (!isSignal(target[prop])) {\n\t\t\t\tObject.defineProperty(target, prop, {\n\t\t\t\t\tvalue: computed(() => target()[prop]),\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t});\n\t\t\t\ttarget[prop][DEEP_SIGNAL] = true;\n\t\t\t}\n\n\t\t\treturn toDeepSignal(target[prop]);\n\t\t},\n\t});\n}\n\nconst nonRecords = [WeakSet, WeakMap, Promise, Date, Error, RegExp, ArrayBuffer, DataView, Function];\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\tif (value === null || typeof value !== 'object' || isIterable(value)) {\n\t\treturn false;\n\t}\n\n\tlet proto = Object.getPrototypeOf(value);\n\tif (proto === Object.prototype) {\n\t\treturn true;\n\t}\n\n\twhile (proto && proto !== Object.prototype) {\n\t\tif (nonRecords.includes(proto.constructor)) {\n\t\t\treturn false;\n\t\t}\n\t\tproto = Object.getPrototypeOf(proto);\n\t}\n\n\treturn proto === Object.prototype;\n}\n\nfunction isIterable(value: any): value is Iterable<any> {\n\treturn typeof value?.[Symbol.iterator] === 'function';\n}\n\n/**\n * A reactive state container built on Angular signals.\n *\n * Provides deep signal access to nested properties, an update method for\n * modifying state, and a snapshot getter for non-reactive access.\n */\nexport type SignalState<State extends object> = DeepSignal<State> &\n\tWritableStateSource<State> & {\n\t\t/** Updates the state with partial updates or updater functions */\n\t\tupdate: (...updaters: Array<Partial<Prettify<State>> | PartialStateUpdater<Prettify<State>>>) => void;\n\t\t/** Gets the current state value without triggering reactivity */\n\t\tget snapshot(): State;\n\t};\n\n/**\n * Creates a reactive state container from an initial state object.\n *\n * The returned SignalState provides:\n * - Deep signal access to nested properties (e.g., `state.camera()`)\n * - An `update` method for modifying state\n * - A `snapshot` getter for non-reactive access\n *\n * @typeParam State - The shape of the state object\n * @param initialState - The initial state values\n * @returns A SignalState instance\n *\n * @example\n * ```typescript\n * const store = signalState({\n * camera: null,\n * scene: null,\n * size: { width: 0, height: 0 }\n * });\n *\n * // Access reactively\n * const width = store.size.width();\n *\n * // Update state\n * store.update({ camera: new THREE.PerspectiveCamera() });\n *\n * // Access snapshot\n * const { scene } = store.snapshot;\n * ```\n */\nexport function signalState<State extends object>(initialState: State): SignalState<State> {\n\tconst stateKeys = Reflect.ownKeys(initialState);\n\n\tconst stateSource = stateKeys.reduce(\n\t\t(signalsDict, key) =>\n\t\t\tObject.assign(signalsDict, {\n\t\t\t\t[key]: signal((initialState as Record<string | symbol, unknown>)[key]),\n\t\t\t}),\n\t\t{} as Record<string | symbol, any>,\n\t);\n\n\tconst signalState = computed(() => stateKeys.reduce((state, key) => ({ ...state, [key]: stateSource[key]() }), {}));\n\n\tObject.defineProperties(signalState, {\n\t\t[STATE_SOURCE]: { value: stateSource },\n\t\tupdate: { value: patchState.bind(null, signalState as SignalState<State>) },\n\t\tsnapshot: { get: () => untracked(signalState) },\n\t});\n\n\tfor (const key of stateKeys) {\n\t\tObject.defineProperty(signalState, key, {\n\t\t\tvalue: toDeepSignal(stateSource[key]),\n\t\t});\n\t}\n\n\treturn signalState as SignalState<State>;\n}\n","import type * as THREE from 'three';\nimport type { NgtCamera, NgtSize } from '../types';\nimport { is } from './is';\n\n/**\n * Sets the needsUpdate flag on an object if it has one.\n *\n * Also sets uniformsNeedUpdate for shader materials.\n *\n * @param value - The object to update\n */\nexport function checkNeedsUpdate(value: unknown) {\n\tif (value !== null && is.obj(value) && 'needsUpdate' in value) {\n\t\tvalue['needsUpdate'] = true;\n\t\tif ('uniformsNeedUpdate' in value) value['uniformsNeedUpdate'] = true;\n\t}\n}\n\n/**\n * Performs necessary updates on a Three.js object after property changes.\n *\n * For cameras, updates projection matrix and world matrix.\n * For other objects, sets the needsUpdate flag.\n *\n * @param value - The object to update\n */\nexport function checkUpdate(value: unknown) {\n\t// TODO (chau): this is messing with PivotControls. Re-evaluate later\n\t// if (is.object3D(value)) value.updateMatrix();\n\n\tif (is.three<THREE.Camera>(value, 'isCamera')) {\n\t\tif (\n\t\t\tis.three<THREE.PerspectiveCamera>(value, 'isPerspectiveCamera') ||\n\t\t\tis.three<THREE.OrthographicCamera>(value, 'isOrthographicCamera')\n\t\t)\n\t\t\tvalue.updateProjectionMatrix();\n\t\tvalue.updateMatrixWorld();\n\t}\n\n\t// NOTE: skip checkNeedsUpdate for CubeTexture\n\tif (is.three<THREE.CubeTexture>(value, 'isCubeTexture')) return;\n\n\tcheckNeedsUpdate(value);\n}\n\n/**\n * Updates a camera's projection based on the viewport size.\n *\n * For orthographic cameras, updates the frustum bounds.\n * For perspective cameras, updates the aspect ratio.\n * Skips update if the camera is marked as manual.\n *\n * @param camera - The camera to update\n * @param size - The current viewport size\n */\nexport function updateCamera(camera: NgtCamera, size: NgtSize) {\n\tif (!camera.manual) {\n\t\tif (is.three<THREE.OrthographicCamera>(camera, 'isOrthographicCamera')) {\n\t\t\tcamera.left = size.width / -2;\n\t\t\tcamera.right = size.width / 2;\n\t\t\tcamera.top = size.height / 2;\n\t\t\tcamera.bottom = size.height / -2;\n\t\t} else {\n\t\t\tcamera.aspect = size.width / size.height;\n\t\t}\n\n\t\tcamera.updateProjectionMatrix();\n\t\tcamera.updateMatrixWorld();\n\t}\n}\n","import { computed } from '@angular/core';\nimport type * as THREE from 'three';\nimport type {\n\tNgtAnyRecord,\n\tNgtEventHandlers,\n\tNgtInstanceHierarchyState,\n\tNgtInstanceNode,\n\tNgtInstanceState,\n\tNgtState,\n} from './types';\nimport { SignalState, signalState } from './utils/signal-state';\nimport { checkUpdate } from './utils/update';\n\n/**\n * @deprecated Use `getInstanceState` instead. Will be removed in 5.0.0\n * @param obj - The object to get local state from\n * @returns The instance state if the object has been prepared, undefined otherwise\n */\nexport function getLocalState<TInstance extends object>(obj: TInstance | undefined): NgtInstanceState | undefined {\n\treturn getInstanceState(obj);\n}\n\n/**\n * Retrieves the Angular Three instance state from a Three.js object.\n *\n * Every Three.js object managed by Angular Three has an associated instance state\n * that contains metadata such as the store reference, parent/child relationships,\n * event handlers, and attach information.\n *\n * @typeParam TInstance - The type of the Three.js object\n * @param obj - The Three.js object to get instance state from\n * @returns The instance state if the object has been prepared, undefined otherwise\n *\n * @example\n * ```typescript\n * const mesh = new THREE.Mesh();\n * prepare(mesh, 'ngt-mesh');\n * const state = getInstanceState(mesh);\n * console.log(state?.type); // 'ngt-mesh'\n * ```\n */\nexport function getInstanceState<TInstance extends NgtAnyRecord>(\n\tobj: TInstance | undefined,\n): NgtInstanceState<TInstance> | undefined {\n\tif (!obj) return undefined;\n\treturn (obj as NgtInstanceNode<TInstance>).__ngt__ || undefined;\n}\n\n/**\n * Invalidates an instance, triggering a re-render of the scene.\n *\n * This function marks the instance as needing an update and triggers the render loop\n * to re-render the scene. It traverses up to the root store to ensure proper invalidation\n * even for objects in portals.\n *\n * @typeParam TInstance - The type of the Three.js object\n * @param instance - The instance node to invalidate\n *\n * @example\n * ```typescript\n * // After modifying a mesh's properties\n * mesh.position.x = 10;\n * invalidateInstance(mesh);\n * ```\n */\nexport function invalidateInstance<TInstance extends NgtAnyRecord>(instance: NgtInstanceNode<TInstance>) {\n\tlet store = getInstanceState(instance)?.store;\n\n\tif (store) {\n\t\twhile (store.snapshot.previousRoot) {\n\t\t\tstore = store.snapshot.previousRoot;\n\t\t}\n\n\t\tif (store.snapshot.internal.frames === 0) {\n\t\t\tstore.snapshot.invalidate();\n\t\t}\n\t}\n\n\tcheckUpdate(instance);\n}\n\n/**\n * Prepares a Three.js object for use with Angular Three.\n *\n * This function attaches the Angular Three instance state to a Three.js object,\n * enabling it to be managed by the Angular Three renderer. The instance state\n * includes parent/child relationships, event handlers, and store references.\n *\n * @typeParam TInstance - The type of the Three.js object\n * @param object - The Three.js object to prepare\n * @param type - The element type name (e.g., 'ngt-mesh', 'ngt-primitive')\n * @param instanceState - Optional partial instance state to merge with defaults\n * @returns The prepared instance node\n *\n * @example\n * ```typescript\n * // Prepare a mesh for Angular Three\n * const mesh = new THREE.Mesh(geometry, material);\n * const prepared = prepare(mesh, 'ngt-mesh', { store });\n * ```\n */\nexport function prepare<TInstance extends NgtAnyRecord = NgtAnyRecord>(\n\tobject: TInstance,\n\ttype: string,\n\tinstanceState?: Partial<NgtInstanceState>,\n) {\n\tconst instance = object as NgtInstanceNode<TInstance>;\n\n\tif (instanceState?.type === 'ngt-primitive' || !instance.__ngt__) {\n\t\tconst {\n\t\t\thierarchyStore = signalState<NgtInstanceHierarchyState>({\n\t\t\t\tparent: null,\n\t\t\t\tobjects: [],\n\t\t\t\tnonObjects: [],\n\t\t\t\tgeometryStamp: Date.now(),\n\t\t\t}),\n\t\t\tstore = null,\n\t\t\t...rest\n\t\t} = instanceState || {};\n\n\t\tconst nonObjects = hierarchyStore.nonObjects;\n\t\tconst geometryStamp = hierarchyStore.geometryStamp;\n\n\t\tconst nonObjectsChanged = computed(() => {\n\t\t\tconst [_nonObjects] = [nonObjects(), geometryStamp()];\n\t\t\treturn _nonObjects;\n\t\t});\n\n\t\tinstance.__ngt_id__ = crypto.randomUUID();\n\t\tinstance.__ngt__ = {\n\t\t\tpreviousAttach: null,\n\t\t\ttype,\n\t\t\teventCount: 0,\n\t\t\thandlers: {},\n\t\t\thierarchyStore,\n\t\t\tobject: instance as any,\n\t\t\tparent: hierarchyStore.parent,\n\t\t\tobjects: hierarchyStore.objects,\n\t\t\tnonObjects: nonObjectsChanged,\n\t\t\tadd(object, type) {\n\t\t\t\tconst current = instance.__ngt__.hierarchyStore.snapshot[type];\n\t\t\t\tconst foundIndex = current.findIndex(\n\t\t\t\t\t(node) =>\n\t\t\t\t\t\tobject === node || (!!object['uuid'] && !!node['uuid'] && object['uuid'] === node['uuid']),\n\t\t\t\t);\n\n\t\t\t\tif (foundIndex > -1) {\n\t\t\t\t\tcurrent.splice(foundIndex, 1, object);\n\t\t\t\t\tinstance.__ngt__.hierarchyStore.update({ [type]: current });\n\t\t\t\t} else {\n\t\t\t\t\tinstance.__ngt__.hierarchyStore.update((prev) => ({ [type]: [...prev[type], object] }));\n\t\t\t\t}\n\n\t\t\t\tnotifyAncestors(instance.__ngt__.hierarchyStore.snapshot.parent, type);\n\t\t\t},\n\t\t\tremove(object, type) {\n\t\t\t\tinstance.__ngt__.hierarchyStore.update((prev) => ({\n\t\t\t\t\t[type]: prev[type].filter((node) => node !== object),\n\t\t\t\t}));\n\t\t\t\tnotifyAncestors(instance.__ngt__.hierarchyStore.snapshot.parent, type);\n\t\t\t},\n\t\t\tsetParent(parent) {\n\t\t\t\tinstance.__ngt__.hierarchyStore.update({ parent });\n\t\t\t},\n\t\t\tupdateGeometryStamp() {\n\t\t\t\tinstance.__ngt__.hierarchyStore.update({ geometryStamp: Date.now() });\n\t\t\t},\n\t\t\tstore,\n\t\t\t...rest,\n\t\t};\n\t}\n\n\tObject.defineProperties(instance.__ngt__, {\n\t\tsetPointerEvent: {\n\t\t\tvalue: <TEvent extends keyof NgtEventHandlers>(\n\t\t\t\teventName: TEvent,\n\t\t\t\tcallback: NonNullable<NgtEventHandlers[TEvent]>,\n\t\t\t) => {\n\t\t\t\tconst iS = getInstanceState(instance) as NgtInstanceState;\n\t\t\t\tif (!iS.handlers) iS.handlers = {};\n\n\t\t\t\t// try to get the previous handler. compound might have one, the THREE object might also have one with the same name\n\t\t\t\tconst previousHandler = iS.handlers[eventName];\n\t\t\t\t// readjust the callback\n\t\t\t\tconst updatedCallback: typeof callback = (event: any) => {\n\t\t\t\t\tif (previousHandler) previousHandler(event);\n\t\t\t\t\tcallback(event);\n\t\t\t\t};\n\n\t\t\t\tObject.assign(iS.handlers, { [eventName]: updatedCallback });\n\n\t\t\t\t// increment the count everytime\n\t\t\t\tiS.eventCount += 1;\n\n\t\t\t\t// clean up the event listener by removing the target from the interaction array\n\t\t\t\treturn () => {\n\t\t\t\t\tconst iS = getInstanceState(instance) as NgtInstanceState;\n\t\t\t\t\tif (iS) {\n\t\t\t\t\t\tiS.handlers && delete iS.handlers[eventName];\n\t\t\t\t\t\tiS.eventCount -= 1;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t\tconfigurable: true,\n\t\t},\n\t\taddInteraction: {\n\t\t\tvalue: (store?: SignalState<NgtState>) => {\n\t\t\t\tif (!store) return;\n\n\t\t\t\tconst iS = getInstanceState(instance) as NgtInstanceState;\n\n\t\t\t\tif (iS.eventCount < 1 || !('raycast' in instance) || !instance['raycast']) return;\n\n\t\t\t\tlet root = store;\n\t\t\t\twhile (root.snapshot.previousRoot) {\n\t\t\t\t\troot = root.snapshot.previousRoot;\n\t\t\t\t}\n\n\t\t\t\tif (root.snapshot.internal) {\n\t\t\t\t\tconst interactions = root.snapshot.internal.interaction;\n\t\t\t\t\tconst index = interactions.findIndex(\n\t\t\t\t\t\t(obj) => obj.uuid === (instance as unknown as THREE.Object3D).uuid,\n\t\t\t\t\t);\n\t\t\t\t\t// if already exists, do not add to interactions\n\t\t\t\t\tif (index < 0) {\n\t\t\t\t\t\troot.snapshot.internal.interaction.push(instance as unknown as THREE.Object3D);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tconfigurable: true,\n\t\t},\n\t\tremoveInteraction: {\n\t\t\tvalue: (store?: SignalState<NgtState>) => {\n\t\t\t\tif (!store) return;\n\n\t\t\t\tlet root = store;\n\t\t\t\twhile (root.snapshot.previousRoot) {\n\t\t\t\t\troot = root.snapshot.previousRoot;\n\t\t\t\t}\n\n\t\t\t\tif (root.snapshot.internal) {\n\t\t\t\t\tconst interactions = root.snapshot.internal.interaction;\n\t\t\t\t\tconst index = interactions.findIndex(\n\t\t\t\t\t\t(obj) => obj.uuid === (instance as unknown as THREE.Object3D).uuid,\n\t\t\t\t\t);\n\t\t\t\t\tif (index >= 0) interactions.splice(index, 1);\n\t\t\t\t}\n\t\t\t},\n\t\t\tconfigurable: true,\n\t\t},\n\t});\n\n\treturn instance;\n}\n\ninterface NotificationCacheState {\n\tskipCount: number;\n\tlastType: 'objects' | 'nonObjects';\n}\n\nconst notificationCache = new Map<string, NotificationCacheState>();\n\n/**\n * Notify ancestors about changes to a THREE.js objects' children\n *\n * For example: `NgtsCenter` might have a child that asynchronously loads a 3D model\n * in which case the model matrices will be settled later. `NgtsCenter` needs to know about this\n * matrices change to re-center everything inside of it.\n *\n * The implementation here uses a naive approach to reduce the number of notifications; we cache\n * the notifications by the instance ID and the type of the notification.\n *\n * 1. If there's no cache or\n * 2. If the type is different for the same instance or\n * 3. We've skipped the notifications for this instance more than a certain amount\n *\n * then we'll proceed with notification\n */\nfunction notifyAncestors(instance: NgtInstanceNode | null, type: 'objects' | 'nonObjects') {\n\tif (!instance) return;\n\n\tconst localState = getInstanceState(instance);\n\tif (!localState) return;\n\n\tconst id = instance.__ngt_id__ || instance['uuid'];\n\tif (!id) return;\n\n\tconst maxNotificationSkipCount = localState.store?.snapshot.maxNotificationSkipCount || 5;\n\tconst cached = notificationCache.get(id);\n\n\tif (!cached || cached.lastType !== type || cached.skipCount > maxNotificationSkipCount) {\n\t\tnotificationCache.set(id, { skipCount: 0, lastType: type });\n\n\t\tif (notificationCache.size === 1) {\n\t\t\tqueueMicrotask(() => notificationCache.clear());\n\t\t}\n\n\t\tconst { parent } = localState.hierarchyStore.snapshot;\n\t\tlocalState.hierarchyStore.update({ [type]: (localState.hierarchyStore.snapshot[type] || []).slice() });\n\t\tnotifyAncestors(parent, type);\n\t\treturn;\n\t}\n\n\tnotificationCache.set(id, { ...cached, skipCount: cached.skipCount + 1 });\n}\n","import * as THREE from 'three';\nimport { getInstanceState, invalidateInstance } from '../instance';\nimport type { NgtAnyRecord, NgtInstanceNode, NgtInstanceState, NgtState } from '../types';\nimport { is } from './is';\nimport { checkUpdate } from './update';\n\n/**\n * Prepares a set of changes to be applied to the instance by comparing props.\n *\n * @param instance - The Three.js instance to compare against\n * @param props - The props to diff\n * @returns An array of [key, value] tuples representing changed properties\n */\nfunction diffProps(instance: NgtAnyRecord, props: NgtAnyRecord) {\n\tconst changes: [key: string, value: unknown][] = [];\n\n\tfor (const propKey in props) {\n\t\tconst propValue = props[propKey];\n\t\tlet key = propKey;\n\t\tif (is.colorSpaceExist(instance)) {\n\t\t\tif (propKey === 'encoding') {\n\t\t\t\tkey = 'colorSpace';\n\t\t\t} else if (propKey === 'outputEncoding') {\n\t\t\t\tkey = 'outputColorSpace';\n\t\t\t}\n\t\t}\n\t\tif (is.equ(propValue, instance[key])) continue;\n\t\tchanges.push([propKey, propValue]);\n\t}\n\n\treturn changes;\n}\n\n/**\n * Internal symbol used to temporarily store the parent's store on an instance.\n * This is a workaround to give the instance access to the store from its parent\n * during property application. The property is cleared after applyProps completes.\n * @internal\n */\nexport const NGT_APPLY_PROPS = '__ngt_apply_props__';\n\n// https://github.com/mrdoob/three.js/pull/27042\n// https://github.com/mrdoob/three.js/pull/22748\nconst colorMaps = ['map', 'emissiveMap', 'sheenColorMap', 'specularColorMap', 'envMap'];\n\ntype ClassConstructor = { new (): void };\n\n/**\n * Resolves a property key that may contain dot notation (pierced props).\n *\n * This function handles nested property access like 'position.x' by traversing\n * the object hierarchy and returning the final target object and key.\n *\n * @param instance - The root instance to start from\n * @param key - The property key, potentially with dot notation\n * @returns An object containing the root object, target key, and target property value\n *\n * @example\n * ```typescript\n * const mesh = new THREE.Mesh();\n * const result = resolveInstanceKey(mesh, 'position.x');\n * // result.root = mesh.position\n * // result.targetKey = 'x'\n * // result.targetProp = mesh.position.x\n * ```\n */\nexport function resolveInstanceKey(instance: any, key: string): { root: any; targetKey: string; targetProp: any } {\n\tlet targetProp = instance[key];\n\tif (!key.includes('.')) return { root: instance, targetKey: key, targetProp };\n\n\t// Resolve pierced target\n\ttargetProp = instance;\n\tfor (const part of key.split('.')) {\n\t\tkey = part;\n\t\tinstance = targetProp;\n\t\ttargetProp = targetProp[key];\n\t}\n\t// const chain = key.split('.');\n\t// targetProp = chain.reduce((acc, part) => acc[part], instance);\n\t// const targetKey = chain.pop()!;\n\t//\n\t// // Switch root if atomic\n\t// if (!targetProp?.set) instance = chain.reduce((acc, part) => acc[part], instance);\n\n\treturn { root: instance, targetKey: key, targetProp };\n}\n\n/**\n * Applies a set of properties to a Three.js instance.\n *\n * This is the core function for updating Three.js objects with new property values.\n * It handles various property types including:\n * - Math types (Vector3, Color, Euler, etc.) with automatic conversion\n * - Pierced props (dot notation like 'position.x')\n * - Arrays (converted to set/fromArray calls)\n * - Layers (mask copying)\n * - Textures (automatic color space management)\n *\n * After applying props, the function triggers necessary updates like\n * camera projection matrix updates and texture needsUpdate flags.\n *\n * @typeParam T - The type of the Three.js instance\n * @param instance - The Three.js instance to update\n * @param props - An object containing the properties to apply\n * @returns The updated instance\n *\n * @example\n * ```typescript\n * const mesh = new THREE.Mesh();\n * applyProps(mesh, {\n * position: [1, 2, 3],\n * 'rotation.x': Math.PI / 2,\n * visible: true\n * });\n * ```\n */\nexport function applyProps<T extends NgtAnyRecord>(instance: NgtInstanceState<T>['object'], props: NgtAnyRecord) {\n\t// if props is empty\n\tif (!Object.keys(props).length) return instance;\n\n\tconst localState = getInstanceState(instance);\n\tconst rootState =\n\t\tlocalState?.store?.snapshot ?? (instance as NgtAnyRecord)[NGT_APPLY_PROPS]?.snapshot ?? ({} as NgtState);\n\tconst changes = diffProps(instance, props);\n\n\tfor (let i = 0; i < changes.length; i++) {\n\t\tlet [key, value] = changes[i];\n\n\t\t// Ignore setting undefined props\n\t\t// https://github.com/pmndrs/react-three-fiber/issues/274\n\t\tif (value === undefined) continue;\n\n\t\t// Alias (output)encoding => (output)colorSpace (since r152)\n\t\t// https://github.com/pmndrs/react-three-fiber/pull/2829\n\t\t// if (is.colorSpaceExist(instance)) {\n\t\t// \tconst sRGBEncoding = 3001;\n\t\t// \tconst SRGBColorSpace = 'srgb';\n\t\t// \tconst LinearSRGBColorSpace = 'srgb-linear';\n\t\t//\n\t\t// \tif (key === 'encoding') {\n\t\t// \t\tkey = 'colorSpace';\n\t\t// \t\tvalue = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n\t\t// \t} else if (key === 'outputEncoding') {\n\t\t// \t\tkey = 'outputColorSpace';\n\t\t// \t\tvalue = value === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n\t\t// \t}\n\t\t// }\n\n\t\tconst { root, targetKey, targetProp } = resolveInstanceKey(instance, key);\n\n\t\t// we have switched due to pierced props\n\t\tif (root !== instance) {\n\t\t\treturn applyProps(root, { [targetKey]: value });\n\t\t}\n\n\t\t// Layers have no copy function, we must therefore copy the mask property\n\t\tif (targetProp instanceof THREE.Layers && value instanceof THREE.Layers) {\n\t\t\ttargetProp.mask = value.mask;\n\t\t} else if (is.three<THREE.Color>(targetProp, 'isColor') && is.colorRepresentation(value)) {\n\t\t\ttargetProp.set(value);\n\t\t}\n\t\t// Copy if properties match signatures\n\t\telse if (\n\t\t\ttargetProp &&\n\t\t\ttypeof targetProp.set === 'function' &&\n\t\t\ttypeof targetProp.copy === 'function' &&\n\t\t\t(value as ClassConstructor | undefined)?.constructor &&\n\t\t\t(targetProp as ClassConstructor).constructor === (value as ClassConstructor).constructor\n\t\t) {\n\t\t\t// If both are geometries, we should assign the value directly instead of copying\n\t\t\tif (\n\t\t\t\tis.three<THREE.BufferGeometry>(targetProp, 'isBufferGeometry') &&\n\t\t\t\tis.three<THREE.BufferGeometry>(value, 'isBufferGeometry')\n\t\t\t) {\n\t\t\t\tObject.assign(root, { [targetKey]: value });\n\t\t\t} else {\n\t\t\t\ttargetProp.copy(value);\n\t\t\t}\n\t\t}\n\t\t// Set array types\n\t\telse if (targetProp && typeof targetProp.set === 'function' && Array.isArray(value)) {\n\t\t\tif (typeof targetProp.fromArray === 'function') targetProp.fromArray(value);\n\t\t\telse targetProp.set(...value);\n\t\t}\n\t\t// Set literal types\n\t\telse if (targetProp && typeof targetProp.set === 'function' && typeof value !== 'object') {\n\t\t\tconst isColor = is.three<THREE.Color>(targetProp, 'isColor');\n\t\t\t// Allow setting array scalars\n\t\t\tif (!isColor && typeof targetProp.setScalar === 'function' && typeof value === 'number')\n\t\t\t\ttargetProp.setScalar(value);\n\t\t\t// Otherwise just set single value\n\t\t\telse targetProp.set(value);\n\t\t}\n\t\t// Else, just overwrite the value\n\t\telse {\n\t\t\tObject.assign(root, { [targetKey]: value });\n\n\t\t\t// Auto-convert sRGB texture parameters for built-in materials\n\t\t\t// https://github.com/pmndrs/react-three-fiber/issues/344\n\t\t\t// https://github.com/mrdoob/three.js/pull/25857\n\t\t\tif (\n\t\t\t\trootState &&\n\t\t\t\t!rootState.linear &&\n\t\t\t\tcolorMaps.includes(targetKey) &&\n\t\t\t\t(root[targetKey] as THREE.Texture | undefined)?.isTexture &&\n\t\t\t\t// sRGB textures must be RGBA8 since r137 https://github.com/mrdoob/three.js/pull/23129\n\t\t\t\troot[targetKey].format === THREE.RGBAFormat &&\n\t\t\t\troot[targetKey].type === THREE.UnsignedByteType\n\t\t\t) {\n\t\t\t\t// NOTE: this cannot be set from the renderer (e.g. sRGB source textures rendered to P3)\n\t\t\t\troot[targetKey].colorSpace = THREE.SRGBColorSpace;\n\t\t\t}\n\t\t}\n\n\t\tcheckUpdate(root[targetKey]);\n\t\tcheckUpdate(targetProp);\n\t\tinvalidateInstance(instance as NgtInstanceNode<T>);\n\t}\n\n\tconst instanceHandlersCount = localState?.eventCount;\n\tconst parent = localState?.hierarchyStore?.snapshot.parent;\n\n\tif (parent && rootState.internal && instance['raycast'] && instanceHandlersCount !== localState?.eventCount) {\n\t\t// Pre-emptively remove the instance from the interaction manager\n\t\tconst index = rootState.internal.interaction.indexOf(instance);\n\t\tif (index > -1) rootState.internal.interaction.splice(index, 1);\n\t\t// Add the instance to the interaction manager only when it has handlers\n\t\tif (localState?.eventCount) rootState.internal.interaction.push(instance);\n\t}\n\n\tif (parent && localState?.onUpdate && changes.length) {\n\t\tlocalState.onUpdate(instance as NgtInstanceNode<T>);\n\t}\n\n\t// clearing the intermediate store from the instance\n\tif (instance[NGT_APPLY_PROPS]) delete instance[NGT_APPLY_PROPS];\n\n\treturn instance;\n}\n","import { inject, InjectionToken } from '@angular/core';\nimport type { NgtConstructorRepresentation } from '../types';\n\n/**\n * @fileoverview Catalogue for registering Three.js constructors.\n *\n * The catalogue maps element names to their corresponding Three.js constructors,\n * allowing the custom renderer to instantiate objects when elements are created.\n */\n\nconst catalogue: Record<string, NgtConstructorRepresentation> = {};\n\n/**\n * Registers Three.js constructors for use in templates.\n *\n * Call this function to make Three.js classes available for use as custom elements.\n * The function returns a cleanup function that removes the registered entries.\n *\n * @param objects - An object mapping names to Three.js constructors\n * @returns A cleanup function to remove the registered entries\n *\n * @example\n * ```typescript\n * import { extend } from 'angular-three';\n * import { Mesh, BoxGeometry, MeshStandardMaterial } from 'three';\n *\n * // Register at component level\n * extend({ Mesh, BoxGeometry, MeshStandardMaterial });\n *\n * // Now you can use in templates:\n * // <ngt-mesh>\n * // <ngt-box-geometry />\n * // <ngt-mesh-standard-material />\n * // </ngt-mesh>\n * ```\n */\nexport function extend(objects: object) {\n\tconst keys = Object.keys(objects);\n\tObject.assign(catalogue, objects);\n\treturn () => {\n\t\tremove(...keys);\n\t};\n}\n\n/**\n * Removes entries from the catalogue by key.\n *\n * @param keys - The keys to remove from the catalogue\n */\nexport function remove(...keys: string[]) {\n\tfor (const key of keys) {\n\t\tdelete catalogue[key];\n\t}\n}\n\n/**\n * Injection token for the Three.js constructor catalogue.\n */\nexport const NGT_CATALOGUE = new InjectionToken<typeof catalogue>('NGT_CATALOGUE', { factory: () => catalogue });\n\n/**\n * Injects the Three.js constructor catalogue.\n *\n * @returns The catalogue mapping names to constructors\n */\nexport function injectCatalogue() {\n\treturn inject(NGT_CATALOGUE);\n}\n","import { Injector } from '@angular/core';\nimport type { NgtAnyRecord } from '../types';\nimport { NGT_DOM_PARENT_FLAG, NGT_GET_NODE_ATTRIBUTE_FLAG, NGT_RENDERER_NODE_FLAG } from './constants';\nimport { NgtRendererClassId } from './utils';\n\ntype ThreeRendererState = [\n\ttype: 'three',\n\tdestroyed: boolean,\n\trawValue: any | undefined,\n\tportalContainer: never | undefined,\n\tinjector: never | undefined,\n\t// ThreeRendererState is the case where *parent is used\n\tparent: NgtRendererNode<'platform' | 'portal' | 'three'> | undefined,\n\tchildren: Array<NgtRendererNode<'platform' | 'portal' | 'comment'>>,\n];\n\ntype PortalRendererState = [\n\ttype: 'portal',\n\tdestroyed: boolean,\n\trawValue: never | undefined,\n\tportalContainer: NgtRendererNode<'three'> | undefined,\n\tinjector: Injector | undefined,\n\tparent: any | undefined,\n\tchildren: any[],\n];\n\ntype PlatformRendererState = [\n\ttype: 'platform',\n\tdestroyed: boolean,\n\trawValue: never | undefined,\n\tportalContainer: never | undefined,\n\tinjector: never | undefined,\n\tparent: NgtRendererNode<'three' | 'portal'> | undefined,\n\tchildren: Array<NgtRendererNode<'three' | 'portal' | 'comment'>>,\n];\n\ntype CommentRendererState = [\n\ttype: 'comment',\n\tdestroyed: boolean,\n\trawValue: never | undefined,\n\tportalContainer: never | undefined,\n\tinjector: Injector | undefined,\n\tparent: NgtRendererNode | undefined,\n\tchildren: NgtRendererNode[],\n];\n\ntype TextRendererState = [\n\ttype: 'text',\n\tdestroyed: boolean,\n\trawValue: never | undefined,\n\tportalContainer: never | undefined,\n\tinjector: never | undefined,\n\tparent: NgtRendererNode | undefined,\n\tchildren: NgtRendererNode[],\n];\n\ntype NgtRendererStateMap = {\n\tthree: ThreeRendererState;\n\tportal: PortalRendererState;\n\tplatform: PlatformRendererState;\n\tcomment: CommentRendererState;\n\ttext: TextRendererState;\n};\n\nexport type NgtRendererState =\n\t| ThreeRendererState\n\t| PortalRendererState\n\t| PlatformRendererState\n\t| CommentRendererState\n\t| TextRendererState;\n\nexport interface NgtRendererNode<TType extends keyof NgtRendererStateMap = keyof NgtRendererStateMap>\n\textends NgtAnyRecord {\n\t[NGT_RENDERER_NODE_FLAG]: NgtRendererStateMap[TType];\n\t[NGT_DOM_PARENT_FLAG]?: HTMLElement;\n}\n\nexport function isRendererNode(node: unknown): node is NgtRendererNode {\n\treturn !!node && typeof node === 'object' && NGT_RENDERER_NODE_FLAG in node;\n}\n\nexport function createRendererNode<TType extends keyof NgtRendererStateMap>(\n\ttype: TType,\n\tnode: NgtAnyRecord,\n\tdocument: Document,\n) {\n\tconst state = [type, false, undefined, undefined, undefined, undefined, []] as NgtRendererState;\n\tconst rendererNode = Object.assign(node, { [NGT_RENDERER_NODE_FLAG]: state });\n\n\t// NOTE: assign ownerDocument to node so we can use HostListener in Component\n\tif (!rendererNode['ownerDocument']) rendererNode['ownerDocument'] = document;\n\n\t// NOTE: Angular SSR calls `node.getAttribute()` to retrieve hydration info on a node\n\tif (!('getAttribute' in rendererNode) || typeof rendererNode['getAttribute'] !== 'function') {\n\t\tconst getNodeAttribute = (name: string) => rendererNode[name];\n\t\tgetNodeAttribute[NGT_GET_NODE_ATTRIBUTE_FLAG] = true;\n\t\tObject.defineProperty(rendererNode, 'getAttribute', { value: getNodeAttribute, configurable: true });\n\t}\n\n\treturn rendererNode as NgtRendererNode<TType>;\n}\n\nexport function setRendererParentNode(node: NgtRendererNode, parent: NgtRendererNode) {\n\tif (!node.__ngt_renderer__[NgtRendererClassId.parent]) {\n\t\tnode.__ngt_renderer__[NgtRendererClassId.parent] = parent;\n\t}\n}\n\nexport function addRendererChildNode(node: NgtRendererNode, child: NgtRendererNode) {\n\tif (!node.__ngt_renderer__[NgtRendererClassId.children].includes(child)) {\n\t\tnode.__ngt_renderer__[NgtRendererClassId.children].push(child);\n\t}\n}\n","import * as THREE from 'three';\nimport type { NgtCanvasElement, NgtDpr, NgtGLDefaultOptions, NgtGLOptions, NgtIntersection, NgtSize } from '../types';\nimport { is } from './is';\n\nconst idCache: { [id: string]: boolean | undefined } = {};\n\n/**\n * Generates a unique identifier.\n *\n * When called with an intersection event, creates a deterministic ID based on\n * the object UUID, index, and instance ID. Otherwise, generates a new UUID.\n *\n * @param event - Optional intersection event to generate ID from\n * @returns A unique string identifier\n */\nexport function makeId(event?: NgtIntersection): string {\n\tif (event) {\n\t\treturn (event.eventObject || event.object).uuid + '/' + event.index + event.instanceId;\n\t}\n\n\tconst newId = THREE.MathUtils.generateUUID();\n\t// ensure not already used\n\tif (!idCache[newId]) {\n\t\tidCache[newId] = true;\n\t\treturn newId;\n\t}\n\treturn makeId();\n}\n\n/**\n * Resolves the device pixel ratio within specified bounds.\n *\n * When given a range [min, max], clamps the device's actual DPR to this range.\n * Falls back to 2x DPR in environments where it cannot be detected (e.g., workers).\n *\n * @param dpr - A single DPR value or [min, max] range\n * @param window - Optional window object to get devicePixelRatio from\n * @returns The resolved DPR value\n */\nexport function makeDpr(dpr: NgtDpr, window?: Window) {\n\t// Err on the side of progress by assuming 2x dpr if we can't detect it\n\t// This will happen in workers where window is defined but dpr isn't.\n\tconst target = typeof window !== 'undefined' ? (window.devicePixelRatio ?? 2) : 1;\n\treturn Array.isArray(dpr) ? Math.min(Math.max(dpr[0], target), dpr[1]) : dpr;\n}\n\n/**\n * Creates a WebGL renderer instance with sensible defaults.\n *\n * If a custom renderer is provided via glOptions, it will be used directly.\n * Otherwise, creates a new WebGLRenderer with high-performance defaults.\n *\n * @typeParam TCanvas - The type of canvas element\n * @param glOptions - Renderer configuration or custom renderer\n * @param canvas - The canvas element to render to\n * @returns A WebGLRenderer instance\n */\nexport function makeRendererInstance<TCanvas extends NgtCanvasElement>(\n\tglOptions: NgtGLOptions,\n\tcanvas: TCanvas,\n): THREE.WebGLRenderer {\n\tconst defaultOptions: NgtGLDefaultOptions = {\n\t\tpowerPreference: 'high-performance',\n\t\tcanvas,\n\t\tantialias: true,\n\t\talpha: true,\n\t};\n\n\tconst customRenderer = (\n\t\ttypeof glOptions === 'function' ? glOptions(defaultOptions) : glOptions\n\t) as THREE.WebGLRenderer;\n\tif (is.renderer(customRenderer)) return customRenderer;\n\treturn new THREE.WebGLRenderer({ ...defaultOptions, ...glOptions });\n}\n\n/**\n * Creates a camera instance based on the projection type.\n *\n * @param isOrthographic - Whether to create an orthographic camera\n * @param size - The viewport size for calculating aspect ratio\n * @returns Either an OrthographicCamera or PerspectiveCamera\n */\nexport function makeCameraInstance(isOrthographic: boolean, size: NgtSize) {\n\tif (isOrthographic) return new THREE.OrthographicCamera(0, 0, 0, 0, 0.1, 1000);\n\treturn new THREE.PerspectiveCamera(75, size.width / size.height, 0.1, 1000);\n}\n\n/**\n * Type representing a parsed object graph from a loaded 3D model.\n *\n * Contains maps of named nodes, materials, and meshes for easy access.\n */\nexport type NgtObjectMap = {\n\t/** Map of named Object3D nodes */\n\tnodes: Record<string, THREE.Object3D<any>>;\n\t/** Map of named materials */\n\tmaterials: Record<string, THREE.Material>;\n\t/** Map of named meshes */\n\tmeshes: Record<string, THREE.Mesh>;\n\t[key: string]: any;\n};\n\n/**\n * Creates an object graph from a Three.js scene hierarchy.\n *\n * Traverses the object and extracts named nodes, materials, and meshes\n * into lookup tables for convenient access.\n *\n * @param object - The root Object3D to traverse\n * @returns An object containing nodes, materials, and meshes maps\n *\n * @example\n * ```typescript\n * const gltf = await loader.loadAsync('model.gltf');\n * const { nodes, materials } = makeObjectGraph(gltf.scene);\n * // Access named objects: nodes['MyMesh'], materials['MyMaterial']\n * ```\n */\nexport function makeObjectGraph(object: THREE.Object3D): NgtObjectMap {\n\tconst data: NgtObjectMap = { nodes: {}, materials: {}, meshes: {} };\n\n\tif (object) {\n\t\tobject.traverse((child) => {\n\t\t\tif (child.name) data.nodes[child.name] = child;\n\t\t\tif ('material' in child && !data.materials[((child as THREE.Mesh).material as THREE.Material).name]) {\n\t\t\t\tdata.materials[((child as THREE.Mesh).material as THREE.Material).name] = (child as THREE.Mesh)\n\t\t\t\t\t.material as THREE.Material;\n\t\t\t}\n\t\t\tif (is.three<THREE.Mesh>(child, 'isMesh') && !data.meshes[child.name]) data.meshes[child.name] = child;\n\t\t});\n\t}\n\treturn data;\n}\n","import { Subject } from 'rxjs';\nimport * as THREE from 'three';\nimport { getInstanceState } from './instance';\nimport type {\n\tNgtAnyRecord,\n\tNgtDomEvent,\n\tNgtEventHandlers,\n\tNgtIntersection,\n\tNgtPointerCaptureTarget,\n\tNgtState,\n\tNgtThreeEvent,\n} from './types';\nimport { makeId } from './utils/make';\nimport { SignalState } from './utils/signal-state';\n\n/**\n * @fileoverview Event handling system for Angular Three.\n *\n * This module provides the event handling infrastructure for raycasting-based\n * pointer events in Three.js scenes. It handles event propagation, pointer\n * capture, and event bubbling through the scene graph.\n */\n\n/**\n * Releases pointer captures for an object.\n * Called by releasePointerCapture in the API, and when an object is removed.\n * @internal\n */\nfunction releaseInternalPointerCapture(\n\tcapturedMap: Map<number, Map<THREE.Object3D, NgtPointerCaptureTarget>>,\n\tobj: THREE.Object3D,\n\tcaptures: Map<THREE.Object3D, NgtPointerCaptureTarget>,\n\tpointerId: number,\n): void {\n\tconst captureData: NgtPointerCaptureTarget | undefined = captures.get(obj);\n\tif (captureData) {\n\t\tcaptures.delete(obj);\n\t\t// If this was the last capturing object for this pointer\n\t\tif (captures.size === 0) {\n\t\t\tcapturedMap.delete(pointerId);\n\t\t\tcaptureData.target.releasePointerCapture(pointerId);\n\t\t}\n\t}\n}\n\n/**\n * Removes all traces of an object from the event handling system.\n *\n * This function cleans up:\n * - Interaction array\n * - Initial hits\n * - Hovered elements map\n * - Pointer captures\n *\n * @param store - The Angular Three store\n * @param object - The object to remove from interactivity\n */\nexport function removeInteractivity(store: SignalState<NgtState>, object: THREE.Object3D) {\n\tconst { internal } = store.snapshot;\n\t// Removes every trace of an object from the data store\n\tinternal.interaction = internal.interaction.filter((o) => o !== object);\n\tinternal.initialHits = internal.initialHits.filter((o) => o !== object);\n\tinternal.hovered.forEach((value, key) => {\n\t\tif (value.eventObject === object || value.object === object) {\n\t\t\t// Clear out intersects, they are outdated by now\n\t\t\tinternal.hovered.delete(key);\n\t\t}\n\t});\n\tinternal.capturedMap.forEach((captures, pointerId) => {\n\t\treleaseInternalPointerCapture(internal.capturedMap, object, captures, pointerId);\n\t});\n}\n\n/**\n * Creates the event handling system for a store.\n *\n * Returns an object with a `handlePointer` function that creates event handlers\n * for different pointer event types. These handlers perform raycasting,\n * event propagation, and callback invocation.\n *\n * @param store - The Angular Three store to create events for\n * @returns An object containing the handlePointer factory function\n */\nexport function createEvents(store: SignalState<NgtState>) {\n\t/** Calculates delta */\n\tfunction calculateDistance(event: NgtDomEvent) {\n\t\tconst internal = store.snapshot.internal;\n\t\tconst dx = event.offsetX - internal.initialClick[0];\n\t\tconst dy = event.offsetY - internal.initialClick[1];\n\t\treturn Math.round(Math.sqrt(dx * dx + dy * dy));\n\t}\n\n\t/** Returns true if an instance has a valid pointer-event registered, this excludes scroll, clicks etc */\n\tfunction filterPointerEvents(objects: THREE.Object3D[]) {\n\t\treturn objects.filter((obj) =>\n\t\t\t['move', 'over', 'enter', 'out', 'leave'].some((name) => {\n\t\t\t\tconst eventName = `pointer${name}` as keyof NgtEventHandlers;\n\t\t\t\treturn getInstanceState(obj)?.handlers?.[eventName];\n\t\t\t}),\n\t\t);\n\t}\n\n\tfunction intersect(event: NgtDomEvent, filter?: (objects: THREE.Object3D[]) => THREE.Object3D[]) {\n\t\tconst state = store.snapshot;\n\t\tconst duplicates = new Set<string>();\n\t\tconst intersections: NgtIntersection[] = [];\n\t\t// Allow callers to eliminate event objects\n\t\tconst eventsObjects = filter ? filter(state.internal.interaction) : state.internal.interaction;\n\n\t\tif (!state.previousRoot) {\n\t\t\t// Make sure root-level pointer and ray are set up\n\t\t\tstate.events.compute?.(event, store, null);\n\t\t}\n\n\t\t// Skip work if there are no event objects\n\t\tif (eventsObjects.length === 0) return intersections;\n\n\t\t// Reset all raycaster cameras to undefined - use for loop for better performance\n\t\tconst eventsObjectsLen = eventsObjects.length;\n\t\tfor (let i = 0; i < eventsObjectsLen; i++) {\n\t\t\tconst objectRootState = getInstanceState(eventsObjects[i])?.store?.snapshot;\n\t\t\tif (objectRootState) {\n\t\t\t\tobjectRootState.raycaster.camera = undefined!;\n\t\t\t}\n\t\t}\n\n\t\t// Pre-allocate array to avoid garbage collection\n\t\tconst raycastResults: THREE.Intersection<THREE.Object3D>[] = [];\n\n\t\tfunction handleRaycast(obj: THREE.Object3D) {\n\t\t\tconst objStore = getInstanceState(obj)?.store;\n\t\t\tconst objState = objStore?.snapshot;\n\t\t\t// Skip event handling when noEvents is set, or when the raycasters camera is null\n\t\t\tif (!objState || !objState.events.enabled || objState.raycaster.camera === null) return [];\n\n\t\t\t// When the camera is undefined we have to call the event layers update function\n\t\t\tif (objState.raycaster.camera === undefined) {\n\t\t\t\tobjState.events.compute?.(event, objStore, objState.previousRoot);\n\t\t\t\t// If the camera is still undefined we have to skip this layer entirely\n\t\t\t\tif (objState.raycaster.camera === undefined) objState.raycaster.camera = null!;\n\t\t\t}\n\n\t\t\t// Intersect object by object\n\t\t\treturn objState.raycaster.camera ? objState.raycaster.intersectObject(obj, true) : [];\n\t\t}\n\n\t\t// Collect events\n\t\tfor (let i = 0; i < eventsObjectsLen; i++) {\n\t\t\tconst objResults = handleRaycast(eventsObjects[i]);\n\t\t\tif (objResults.length <= 0) continue;\n\t\t\tfor (let j = 0; j < objResults.length; j++) {\n\t\t\t\traycastResults.push(objResults[j]);\n\t\t\t}\n\t\t}\n\n\t\t// Sort by event priority and distance\n\t\traycastResults.sort((a, b) => {\n\t\t\tconst aState = getInstanceState(a.object)?.store?.snapshot;\n\t\t\tconst bState = getInstanceState(b.object)?.store?.snapshot;\n\t\t\tif (!aState || !bState) return a.distance - b.distance;\n\t\t\treturn bState.events.priority - aState.events.priority || a.distance - b.distance;\n\t\t});\n\n\t\t// Filter out duplicates - more efficient than chaining\n\t\tlet hits: THREE.Intersection<THREE.Object3D>[] = [];\n\t\tfor (let i = 0; i < raycastResults.length; i++) {\n\t\t\tconst item = raycastResults[i];\n\t\t\tconst id = makeId(item as NgtIntersection);\n\t\t\tif (duplicates.has(id)) continue;\n\t\t\tduplicates.add(id);\n\t\t\thits.push(item);\n\t\t}\n\n\t\t// https://github.com/mrdoob/three.js/issues/16031\n\t\t// Allow custom userland intersect sort order, this likely only makes sense on the root filter\n\t\tif (state.events.filter) hits = state.events.filter(hits, store);\n\n\t\t// Bubble up the events, find the event source (eventObject)\n\t\tconst hitsLen = hits.length;\n\t\tfor (let i = 0; i < hitsLen; i++) {\n\t\t\tconst hit = hits[i];\n\t\t\tlet eventObject: THREE.Object3D | null = hit.object;\n\t\t\t// bubble event up\n\t\t\twhile (eventObject) {\n\t\t\t\tif (getInstanceState(eventObject)?.eventCount) intersections.push({ ...hit, eventObject });\n\t\t\t\teventObject = eventObject.parent;\n\t\t\t}\n\t\t}\n\n\t\t// If the interaction is captured, make all capturing targets part of the intersect.\n\t\tif ('pointerId' in event && state.internal.capturedMap.has(event.pointerId)) {\n\t\t\tconst captures = state.internal.capturedMap.get(event.pointerId)!;\n\t\t\tfor (const captureData of captures.values()) {\n\t\t\t\tif (duplicates.has(makeId(captureData.intersection))) continue;\n\t\t\t\tintersections.push(captureData.intersection);\n\t\t\t}\n\t\t}\n\t\treturn intersections;\n\t}\n\n\t/** Handles intersections by forwarding them to handlers */\n\tfunction handleIntersects(\n\t\tintersections: NgtIntersection[],\n\t\tevent: NgtDomEvent,\n\t\tdelta: number,\n\t\tcallback: (event: NgtThreeEvent<NgtDomEvent>) => void,\n\t) {\n\t\tconst rootState = store.snapshot;\n\n\t\t// If anything has been found, forward it to the event listeners\n\t\tif (intersections.length) {\n\t\t\tconst localState = { stopped: false };\n\t\t\tfor (const hit of intersections) {\n\t\t\t\tlet instanceState = getInstanceState(hit.object);\n\n\t\t\t\t// If the object is not managed by NGT, it might be parented to an element which is.\n\t\t\t\t// Traverse upwards until we find a managed parent and use its state instead.\n\t\t\t\tif (!instanceState) {\n\t\t\t\t\thit.object.traverseAncestors((ancestor) => {\n\t\t\t\t\t\tconst parentInstanceState = getInstanceState(ancestor);\n\t\t\t\t\t\tif (parentInstanceState) {\n\t\t\t\t\t\t\tinstanceState = parentInstanceState;\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst { raycaster, pointer, camera, internal } = instanceState?.store?.snapshot || rootState;\n\n\t\t\t\tconst unprojectedPoint = new THREE.Vector3(pointer.x, pointer.y, 0).unproject(camera);\n\t\t\t\tconst hasPointerCapture = (id: number) => internal.capturedMap.get(id)?.has(hit.eventObject) ?? false;\n\n\t\t\t\tconst setPointerCapture = (id: number) => {\n\t\t\t\t\tconst captureData = { intersection: hit, target: event.target as Element };\n\t\t\t\t\tif (internal.capturedMap.has(id)) {\n\t\t\t\t\t\t// if the pointerId was previously captured, we add the hit to the\n\t\t\t\t\t\t// event capturedMap.\n\t\t\t\t\t\tinternal.capturedMap.get(id)!.set(hit.eventObject, captureData);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// if the pointerId was not previously captured, we create a map\n\t\t\t\t\t\t// containing the hitObject, and the hit. hitObject is used for\n\t\t\t\t\t\t// faster access.\n\t\t\t\t\t\tinternal.capturedMap.set(id, new Map([[hit.eventObject, captureData]]));\n\t\t\t\t\t}\n\t\t\t\t\t// Call the original event now\n\t\t\t\t\t(event.target as Element).setPointerCapture(id);\n\t\t\t\t};\n\n\t\t\t\tconst releasePointerCapture = (id: number) => {\n\t\t\t\t\tconst captures = internal.capturedMap.get(id);\n\t\t\t\t\tif (captures) {\n\t\t\t\t\t\treleaseInternalPointerCapture(internal.capturedMap, hit.eventObject, captures, id);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\t// Add native event props\n\t\t\t\tconst extractEventProps: any = {};\n\t\t\t\t// This iterates over the event's properties including the inherited ones. Native PointerEvents have most of their props as getters which are inherited, but polyfilled PointerEvents have them all as their own properties (i.e. not inherited). We can't use Object.keys() or Object.entries() as they only return \"own\" properties; nor Object.getPrototypeOf(event) as that *doesn't* return \"own\" properties, only inherited ones.\n\t\t\t\tfor (const prop in event) {\n\t\t\t\t\tconst property = event[prop as keyof NgtDomEvent];\n\t\t\t\t\t// Only copy over atomics, leave functions alone as these should be\n\t\t\t\t\t// called as event.nativeEvent.fn()\n\t\t\t\t\tif (typeof property !== 'function') extractEventProps[prop] = property;\n\t\t\t\t}\n\n\t\t\t\tconst raycastEvent: NgtThreeEvent<NgtDomEvent> = {\n\t\t\t\t\t...hit,\n\t\t\t\t\t...extractEventProps,\n\t\t\t\t\tpointer,\n\t\t\t\t\tintersections,\n\t\t\t\t\tstopped: localState.stopped,\n\t\t\t\t\tdelta,\n\t\t\t\t\tunprojectedPoint,\n\t\t\t\t\tray: raycaster.ray,\n\t\t\t\t\tcamera,\n\t\t\t\t\t// Hijack stopPropagation, which just sets a flag\n\t\t\t\t\tstopPropagation() {\n\t\t\t\t\t\t// https://github.com/pmndrs/react-three-fiber/issues/596\n\t\t\t\t\t\t// Events are not allowed to stop propagation if the pointer has been captured\n\t\t\t\t\t\tconst capturesForPointer = 'pointerId' in event && internal.capturedMap.get(event.pointerId);\n\n\t\t\t\t\t\t// We only authorize stopPropagation...\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t// ...if this pointer hasn't been captured\n\t\t\t\t\t\t\t!capturesForPointer ||\n\t\t\t\t\t\t\t// ... or if the hit object is capturing the pointer\n\t\t\t\t\t\t\tcapturesForPointer.has(hit.eventObject)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\traycastEvent.stopped = localState.stopped = true;\n\t\t\t\t\t\t\t// Propagation is stopped, remove all other hover records\n\t\t\t\t\t\t\t// An event handler is only allowed to flush other handlers if it is hovered itself\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tinternal.hovered.size &&\n\t\t\t\t\t\t\t\tArray.from(internal.hovered.values()).find((i) => i.eventObject === hit.eventObject)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t// Objects cannot flush out higher up objects that have already caught the event\n\t\t\t\t\t\t\t\tconst higher = intersections.slice(0, intersections.indexOf(hit));\n\t\t\t\t\t\t\t\tcancelPointer([...higher, hit]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t// there should be a distinction between target and currentTarget\n\t\t\t\t\ttarget: { hasPointerCapture, setPointerCapture, releasePointerCapture },\n\t\t\t\t\tcurrentTarget: { hasPointerCapture, setPointerCapture, releasePointerCapture },\n\t\t\t\t\tnativeEvent: event,\n\t\t\t\t};\n\n\t\t\t\t// Call subscribers\n\t\t\t\tcallback(raycastEvent);\n\t\t\t\t// Event bubbling may be interrupted by stopPropagation\n\t\t\t\tif (localState.stopped) break;\n\t\t\t}\n\t\t}\n\t\treturn intersections;\n\t}\n\n\tfunction cancelPointer(intersections: NgtIntersection[]) {\n\t\tconst internal = store.snapshot.internal;\n\t\tfor (const hoveredObj of internal.hovered.values()) {\n\t\t\t// When no objects were hit or the the hovered object wasn't found underneath the cursor\n\t\t\t// we call onPointerOut and delete the object from the hovered-elements map\n\t\t\tif (\n\t\t\t\t!intersections.length ||\n\t\t\t\t!intersections.find(\n\t\t\t\t\t(hit) =>\n\t\t\t\t\t\thit.object === hoveredObj.object &&\n\t\t\t\t\t\thit.index === hoveredObj.index &&\n\t\t\t\t\t\thit.instanceId === hoveredObj.instanceId,\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tconst eventObject = hoveredObj.eventObject;\n\t\t\t\tconst instance = getInstanceState(eventObject);\n\t\t\t\tconst handlers = instance?.handlers;\n\t\t\t\tinternal.hovered.delete(makeId(hoveredObj));\n\t\t\t\tif (instance?.eventCount) {\n\t\t\t\t\t// Clear out intersects, they are outdated by now\n\t\t\t\t\tconst data = { ...hoveredObj, intersections };\n\t\t\t\t\thandlers?.pointerout?.(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t\thandlers?.pointerleave?.(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction pointerMissed(event: MouseEvent, objects: THREE.Object3D[]) {\n\t\tfor (let i = 0; i < objects.length; i++) {\n\t\t\tconst instance = getInstanceState(objects[i]);\n\t\t\tinstance?.handlers.pointermissed?.(event);\n\t\t}\n\t}\n\n\tfunction handlePointer(name: string) {\n\t\t// Handle common cancelation events\n\t\tif (name === 'pointerleave' || name === 'pointercancel') {\n\t\t\treturn () => cancelPointer([]);\n\t\t}\n\n\t\tif (name === 'lostpointercapture') {\n\t\t\treturn (event: NgtDomEvent) => {\n\t\t\t\tconst { internal } = store.snapshot;\n\t\t\t\tif ('pointerId' in event && internal.capturedMap.has(event.pointerId)) {\n\t\t\t\t\t// If the object event interface had lostpointercapture, we'd call it here on every\n\t\t\t\t\t// object that's getting removed. We call it on the next frame because lostpointercapture\n\t\t\t\t\t// fires before pointerup. Otherwise pointerUp would never be called if the event didn't\n\t\t\t\t\t// happen in the object it originated from, leaving components in a in-between state.\n\t\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\t\t// Only release if pointer-up didn't do it already\n\t\t\t\t\t\tif (internal.capturedMap.has(event.pointerId)) {\n\t\t\t\t\t\t\tinternal.capturedMap.delete(event.pointerId);\n\t\t\t\t\t\t\tcancelPointer([]);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Cache these values since they're used in the closure\n\t\tconst isPointerMove = name === 'pointermove';\n\t\tconst isClickEvent = name === 'click' || name === 'contextmenu' || name === 'dblclick';\n\t\tconst filter = isPointerMove ? filterPointerEvents : undefined;\n\n\t\t// Any other pointer goes here ...\n\t\treturn function handleEvent(event: NgtDomEvent) {\n\t\t\t// NOTE: __pointerMissed$ on NgtStore is private subject since we only expose the Observable\n\t\t\tconst pointerMissed$: Subject<MouseEvent> = (store as NgtAnyRecord)['__pointerMissed$'];\n\t\t\tconst internal = store.snapshot.internal;\n\n\t\t\t// Cache the event\n\t\t\tinternal.lastEvent.nativeElement = event;\n\n\t\t\t// Get fresh intersects\n\t\t\tconst hits = intersect(event, filter);\n\t\t\t// Only calculate distance for click events to avoid unnecessary math\n\t\t\tconst delta = isClickEvent ? calculateDistance(event) : 0;\n\n\t\t\t// Save initial coordinates on pointer-down\n\t\t\tif (name === 'pointerdown') {\n\t\t\t\tinternal.initialClick = [event.offsetX, event.offsetY];\n\t\t\t\tinternal.initialHits = hits.map((hit) => hit.eventObject);\n\t\t\t}\n\n\t\t\t// Handle click miss events - early return optimization for better performance\n\t\t\tif (isClickEvent && hits.length === 0 && delta <= 2) {\n\t\t\t\tpointerMissed(event, internal.interaction);\n\t\t\t\tpointerMissed$.next(event);\n\t\t\t\treturn; // Early return if nothing was hit\n\t\t\t}\n\n\t\t\t// Take care of unhover for pointer moves\n\t\t\tif (isPointerMove) cancelPointer(hits);\n\n\t\t\t// Define onIntersect handler - locally cache common properties for better performance\n\t\t\tfunction onIntersect(data: NgtThreeEvent<NgtDomEvent>) {\n\t\t\t\tconst eventObject = data.eventObject;\n\t\t\t\tconst instance = getInstanceState(eventObject);\n\n\t\t\t\t// Early return if no instance or event count\n\t\t\t\tif (!instance?.eventCount) return;\n\n\t\t\t\tconst handlers = instance.handlers;\n\t\t\t\tif (!handlers) return;\n\n\t\t\t\tif (isPointerMove) {\n\t\t\t\t\t// Handle pointer move events\n\t\t\t\t\tconst hasPointerOverHandlers = !!(\n\t\t\t\t\t\thandlers.pointerover ||\n\t\t\t\t\t\thandlers.pointerenter ||\n\t\t\t\t\t\thandlers.pointerout ||\n\t\t\t\t\t\thandlers.pointerleave\n\t\t\t\t\t);\n\n\t\t\t\t\tif (hasPointerOverHandlers) {\n\t\t\t\t\t\tconst id = makeId(data);\n\t\t\t\t\t\tconst hoveredItem = internal.hovered.get(id);\n\t\t\t\t\t\tif (!hoveredItem) {\n\t\t\t\t\t\t\t// If the object wasn't previously hovered, book it and call its handler\n\t\t\t\t\t\t\tinternal.hovered.set(id, data);\n\t\t\t\t\t\t\tif (handlers.pointerover) handlers.pointerover(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t\t\t\tif (handlers.pointerenter) handlers.pointerenter(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t\t\t} else if (hoveredItem.stopped) {\n\t\t\t\t\t\t\t// If the object was previously hovered and stopped, we shouldn't allow other items to proceed\n\t\t\t\t\t\t\tdata.stopPropagation();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Call mouse move\n\t\t\t\t\tif (handlers.pointermove) handlers.pointermove(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t} else {\n\t\t\t\t\t// All other events ...\n\t\t\t\t\tconst handler = handlers[name as keyof NgtEventHandlers] as (\n\t\t\t\t\t\tevent: NgtThreeEvent<PointerEvent>,\n\t\t\t\t\t) => void;\n\n\t\t\t\t\tif (handler) {\n\t\t\t\t\t\t// Forward all events back to their respective handlers with the exception of click events,\n\t\t\t\t\t\t// which must use the initial target\n\t\t\t\t\t\tif (!isClickEvent || internal.initialHits.includes(eventObject)) {\n\t\t\t\t\t\t\t// Get objects not in initialHits for pointer missed - avoid creating new arrays if possible\n\t\t\t\t\t\t\tconst missedObjects = internal.interaction.filter(\n\t\t\t\t\t\t\t\t(object) => !internal.initialHits.includes(object),\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t// Call pointerMissed only if we have objects to notify\n\t\t\t\t\t\t\tif (missedObjects.length > 0) {\n\t\t\t\t\t\t\t\tpointerMissed(event, missedObjects);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Now call the handler\n\t\t\t\t\t\t\thandler(data as NgtThreeEvent<PointerEvent>);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (isClickEvent && internal.initialHits.includes(eventObject)) {\n\t\t\t\t\t\t// Trigger onPointerMissed on all elements that have pointer over/out handlers, but not click and weren't hit\n\t\t\t\t\t\tconst missedObjects = internal.interaction.filter(\n\t\t\t\t\t\t\t(object) => !internal.initialHits.includes(object),\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Call pointerMissed only if we have objects to notify\n\t\t\t\t\t\tif (missedObjects.length > 0) {\n\t\t\t\t\t\t\tpointerMissed(event, missedObjects);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process all intersections\n\t\t\tif (hits.length > 0) {\n\t\t\t\thandleIntersects(hits, event, delta, onIntersect);\n\t\t\t}\n\t\t};\n\t}\n\n\treturn { handlePointer };\n}\n","import { getInstanceState } from '../instance';\nimport type { NgtAttachFunction, NgtInstanceNode, NgtState } from '../types';\nimport { applyProps, NGT_APPLY_PROPS } from './apply-props';\nimport { SignalState } from './signal-state';\n\n/**\n * Attaches a value to an object at the specified path.\n *\n * This function recursively traverses the path and sets the value at the final key.\n * It's used internally to implement the `attach` property on Three.js elements.\n *\n * @param object - The target object to attach to\n * @param value - The value to attach\n * @param paths - An array of path segments (e.g., ['material', 'map'])\n * @param useApplyProps - Whether to use applyProps for setting the value\n *\n * @example\n * ```typescript\n * const mesh = new THREE.Mesh();\n * attach(mesh, texture, ['material', 'map']);\n * // mesh.material.map = texture\n * ```\n */\nexport function attach(object: NgtInstanceNode, value: unknown, paths: string[] = [], useApplyProps = false): void {\n\tconst [base, ...remaining] = paths;\n\tif (!base) return;\n\n\tif (remaining.length === 0) {\n\t\tif (useApplyProps) applyProps(object, { [base]: value });\n\t\telse object[base] = value;\n\t} else {\n\t\tassignEmpty(object, base, useApplyProps);\n\t\tattach(object[base], value, remaining, useApplyProps);\n\t}\n}\n\n/**\n * Detaches a child from its parent, restoring the previous value.\n *\n * This function reverses the attach operation by restoring the previous value\n * that was stored when the child was attached.\n *\n * @param parent - The parent object\n * @param child - The child object to detach\n * @param attachProp - The attach path or function that was used\n */\nexport function detach(parent: NgtInstanceNode, child: NgtInstanceNode, attachProp: string[] | NgtAttachFunction) {\n\tconst childInstanceState = getInstanceState(child);\n\tif (childInstanceState) {\n\t\tif (Array.isArray(attachProp))\n\t\t\tattach(parent, childInstanceState.previousAttach, attachProp, childInstanceState.type === 'ngt-value');\n\t\telse (childInstanceState.previousAttach as () => void)?.();\n\t}\n}\n\nfunction assignEmpty(obj: NgtInstanceNode, base: string, shouldAssignStoreForApplyProps = false) {\n\tif ((!Object.hasOwn(obj, base) && Reflect && !!Reflect.has && !Reflect.has(obj, base)) || obj[base] === undefined) {\n\t\tobj[base] = {};\n\t}\n\n\tif (shouldAssignStoreForApplyProps) {\n\t\tconst instanceState = getInstanceState(obj[base]);\n\t\t// if we already have instance state, bail out\n\t\tif (instanceState) return;\n\n\t\tconst parentInstanceState = getInstanceState(obj);\n\t\t// if parent doesn't have instance state, bail out\n\t\tif (!parentInstanceState) return;\n\n\t\tObject.assign(obj[base], { [NGT_APPLY_PROPS]: parentInstanceState.store });\n\t}\n}\n\n/**\n * Creates a custom attach function for advanced attachment scenarios.\n *\n * Use this when you need custom logic for attaching a child to a parent,\n * such as when the relationship isn't a simple property assignment.\n *\n * @typeParam TChild - The type of the child object\n * @typeParam TParent - The type of the parent object\n * @param cb - Callback that performs the attachment and optionally returns a cleanup function\n * @returns An attach function compatible with the `attach` property\n *\n * @example\n * ```typescript\n * const customAttach = createAttachFunction<THREE.Mesh, THREE.Group>(\n * ({ parent, child, store }) => {\n * parent.add(child);\n * return () => parent.remove(child);\n * }\n * );\n * ```\n */\nexport function createAttachFunction<TChild = any, TParent = any>(\n\tcb: (params: { parent: TParent; child: TChild; store: SignalState<NgtState> }) => (() => void) | void,\n): NgtAttachFunction<TChild, TParent> {\n\treturn (parent, child, store) => cb({ parent, child, store });\n}\n","import { untracked } from '@angular/core';\nimport * as THREE from 'three';\nimport { removeInteractivity } from '../events';\nimport { getInstanceState, invalidateInstance } from '../instance';\nimport { NgtAnyRecord, NgtInstanceNode } from '../types';\nimport { attach, detach } from '../utils/attach';\nimport { is } from '../utils/is';\nimport {\n\tNGT_CANVAS_CONTENT_FLAG,\n\tNGT_DOM_PARENT_FLAG,\n\tNGT_GET_NODE_ATTRIBUTE_FLAG,\n\tNGT_INTERNAL_ADD_COMMENT_FLAG,\n\tNGT_INTERNAL_SET_PARENT_COMMENT_FLAG,\n\tNGT_PORTAL_CONTENT_FLAG,\n} from './constants';\nimport { NgtRendererNode } from './state';\n\n// @internal\nexport const enum NgtRendererClassId {\n\ttype,\n\tdestroyed,\n\trawValue,\n\tportalContainer,\n\tinjector,\n\tparent,\n\tchildren,\n}\n\nexport function kebabToPascal(str: string): string {\n\tif (!str) return str; // Handle empty input\n\n\tlet pascalStr = '';\n\tlet capitalizeNext = true; // Flag to track capitalization\n\n\tfor (let i = 0; i < str.length; i++) {\n\t\tconst char = str[i];\n\t\tif (char === '-') {\n\t\t\tcapitalizeNext = true;\n\t\t\tcontinue;\n\t\t}\n\n\t\tpascalStr += capitalizeNext ? char.toUpperCase() : char;\n\t\tcapitalizeNext = false;\n\t}\n\n\treturn pascalStr;\n}\n\nfunction propagateStoreRecursively(node: NgtInstanceNode, parentNode: NgtInstanceNode) {\n\tconst iS = getInstanceState(node);\n\tconst pIS = getInstanceState(parentNode);\n\n\tif (!iS || !pIS) return;\n\n\t// assign store on child if not already exist\n\t// or child store is not the same as parent store\n\t// or child store is the parent of parent store\n\tif (!iS.store || iS.store !== pIS.store || iS.store === pIS.store.snapshot.previousRoot) {\n\t\tiS.store = pIS.store;\n\n\t\t// Call addInteraction if it exists\n\t\tiS.addInteraction?.(pIS.store);\n\n\t\t// Collect all children (objects and nonObjects)\n\t\tconst children = [\n\t\t\t...(iS.objects ? untracked(iS.objects) : []),\n\t\t\t...(iS.nonObjects ? untracked(iS.nonObjects) : []),\n\t\t];\n\n\t\t// Recursively reassign the store for each child\n\t\tfor (const child of children) {\n\t\t\tpropagateStoreRecursively(child, node);\n\t\t}\n\t}\n}\n\nexport function attachThreeNodes(parent: NgtInstanceNode, child: NgtInstanceNode) {\n\tconst pIS = getInstanceState(parent);\n\tconst cIS = getInstanceState(child);\n\n\tif (!pIS || !cIS) {\n\t\tthrow new Error(`[NGT] THREE instances need to be prepared with local state.`);\n\t}\n\n\t// whether the child is added to the parent with parent.add()\n\tlet added = false;\n\n\t// propagate store recursively\n\tpropagateStoreRecursively(child, parent);\n\n\tif (cIS.attach) {\n\t\tconst attachProp = cIS.attach;\n\n\t\tif (typeof attachProp === 'function') {\n\t\t\tlet attachCleanUp: ReturnType<typeof attachProp> | undefined = undefined;\n\n\t\t\tif (cIS.type === 'ngt-value') {\n\t\t\t\tif (cIS.hierarchyStore.snapshot.parent !== parent) {\n\t\t\t\t\tcIS.setParent(parent);\n\t\t\t\t}\n\t\t\t\t// at this point we don't have rawValue yet, so we bail and wait until the Renderer recalls attach\n\t\t\t\tif ((child as unknown as NgtRendererNode).__ngt_renderer__[NgtRendererClassId.rawValue] === undefined)\n\t\t\t\t\treturn;\n\t\t\t\tattachCleanUp = attachProp(\n\t\t\t\t\tparent,\n\t\t\t\t\t(child as unknown as NgtRendererNode).__ngt_renderer__[NgtRendererClassId.rawValue],\n\t\t\t\t\tcIS.store!,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tattachCleanUp = attachProp(parent, child, cIS.store!);\n\t\t\t}\n\n\t\t\tif (attachCleanUp) cIS.previousAttach = attachCleanUp;\n\t\t} else {\n\t\t\t// we skip attach none if set explicitly\n\t\t\tif (attachProp[0] === 'none') {\n\t\t\t\tinvalidateInstance(child);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// handle material array\n\t\t\tif (\n\t\t\t\tattachProp[0] === 'material' &&\n\t\t\t\tattachProp[1] &&\n\t\t\t\ttypeof Number(attachProp[1]) === 'number' &&\n\t\t\t\tis.three<THREE.Material>(child, 'isMaterial') &&\n\t\t\t\t!Array.isArray(parent['material'])\n\t\t\t) {\n\t\t\t\tparent['material'] = [];\n\t\t\t}\n\n\t\t\tif (cIS.type === 'ngt-value') {\n\t\t\t\tif (cIS.hierarchyStore.snapshot.parent !== parent) {\n\t\t\t\t\tcIS.setParent(parent);\n\t\t\t\t}\n\t\t\t\t// at this point we don't have rawValue yet, so we bail and wait until the Renderer recalls attach\n\t\t\t\tif ((child as unknown as NgtRendererNode).__ngt_renderer__[NgtRendererClassId.rawValue] === undefined)\n\t\t\t\t\treturn;\n\n\t\t\t\t// save prev value\n\t\t\t\tcIS.previousAttach = attachProp.reduce((value, key) => value[key], parent);\n\t\t\t\tattach(\n\t\t\t\t\tparent,\n\t\t\t\t\t(child as unknown as NgtRendererNode).__ngt_renderer__[NgtRendererClassId.rawValue],\n\t\t\t\t\tattachProp,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// save prev value\n\t\t\t\tcIS.previousAttach = attachProp.reduce((value, key) => value[key], parent);\n\t\t\t\tattach(parent, child, attachProp);\n\t\t\t}\n\t\t}\n\t} else if (is.three<THREE.Object3D>(parent, 'isObject3D') && is.three<THREE.Object3D>(child, 'isObject3D')) {\n\t\tparent.add(child);\n\t\tadded = true;\n\t\tcIS.addInteraction?.(cIS.store || pIS.store);\n\t}\n\n\tif (pIS.add) {\n\t\tpIS.add(child, added ? 'objects' : 'nonObjects');\n\t}\n\n\tif (cIS.parent && untracked(cIS.parent) !== parent) {\n\t\tcIS.setParent(parent);\n\t}\n\n\t// NOTE: this does not mean that the child is actually attached to the parent on the scenegraph.\n\t// a child on the Angular template can also emit onAttach\n\tif (cIS.onAttach) cIS.onAttach({ parent, node: child });\n\n\tinvalidateInstance(child);\n\tinvalidateInstance(parent);\n}\n\nexport function removeThreeChild(child: NgtInstanceNode, parent: NgtInstanceNode, dispose?: boolean) {\n\tconst pIS = getInstanceState(parent);\n\tconst cIS = getInstanceState(child);\n\n\t// clear parent ref\n\tcIS?.setParent(null);\n\n\t// remove child from parent\n\tpIS?.remove?.(child, 'objects');\n\tpIS?.remove?.(child, 'nonObjects');\n\n\tif (cIS?.attach) {\n\t\tdetach(parent, child, cIS.attach);\n\t} else if (is.three<THREE.Object3D>(parent, 'isObject3D') && is.three<THREE.Object3D>(child, 'isObject3D')) {\n\t\tparent.remove(child);\n\t\tconst store = cIS?.store || pIS?.store;\n\t\tcIS?.removeInteraction?.(store);\n\t\tif (store) removeInteractivity(store, child);\n\t}\n\n\t// dispose\n\tconst isPrimitive = cIS?.type && cIS.type === 'ngt-primitive';\n\tif (!isPrimitive && child['dispose'] && !is.three<THREE.Scene>(child, 'isScene')) {\n\t\tqueueMicrotask(() => child['dispose']());\n\t}\n\n\tinvalidateInstance(parent);\n}\n\nexport function internalDestroyNode(\n\tnode: NgtRendererNode,\n\tremoveChild: null | ((node: NgtRendererNode, child: NgtRendererNode) => void),\n) {\n\tconst rS = node.__ngt_renderer__;\n\tif (!rS || rS[NgtRendererClassId.destroyed]) return;\n\n\tfor (const child of rS[NgtRendererClassId.children].slice()) {\n\t\tremoveChild?.(node, child);\n\t\tinternalDestroyNode(child, removeChild);\n\t}\n\n\t// clear out parent if haven't\n\trS[NgtRendererClassId.parent] = undefined;\n\t// clear out children\n\trS[NgtRendererClassId.children].length = 0;\n\n\t// clear out NgtInstanceState\n\tconst iS = getInstanceState(node);\n\tif (iS) {\n\t\tconst temp = iS as NgtAnyRecord;\n\n\t\tiS.removeInteraction?.(iS.store);\n\n\t\tdelete temp['onAttach'];\n\t\tdelete temp['onUpdate'];\n\t\tdelete temp['object'];\n\t\tdelete temp['objects'];\n\t\tdelete temp['nonObjects'];\n\t\tdelete temp['parent'];\n\t\tdelete temp['add'];\n\t\tdelete temp['remove'];\n\t\tdelete temp['updateGeometryStamp'];\n\t\tdelete temp['setParent'];\n\t\tdelete temp['store'];\n\t\tdelete temp['handlers'];\n\t\tdelete temp['hierarchyStore'];\n\t\tdelete temp['previousAttach'];\n\t\tdelete temp['setPointerEvent'];\n\t\tdelete temp['addInteraction'];\n\t\tdelete temp['removeInteraction'];\n\n\t\tif (iS.type !== 'ngt-primitive') {\n\t\t\tdelete node['__ngt__'];\n\t\t}\n\t}\n\n\t// clear our debugNode\n\trS[NgtRendererClassId.injector] = undefined;\n\n\tif (rS[NgtRendererClassId.type] === 'comment') {\n\t\tdelete node[NGT_INTERNAL_ADD_COMMENT_FLAG];\n\t\tdelete node[NGT_INTERNAL_SET_PARENT_COMMENT_FLAG];\n\t\tdelete node[NGT_CANVAS_CONTENT_FLAG];\n\t\tdelete node[NGT_PORTAL_CONTENT_FLAG];\n\t\tdelete node[NGT_DOM_PARENT_FLAG];\n\t}\n\n\t// clear getAttribute if exist\n\tif (\n\t\t'getAttribute' in node &&\n\t\ttypeof node['getAttribute'] === 'function' &&\n\t\tnode['getAttribute'][NGT_GET_NODE_ATTRIBUTE_FLAG]\n\t) {\n\t\tdelete node['getAttribute'];\n\t}\n\n\t// mark node as destroyed\n\trS[NgtRendererClassId.destroyed] = true;\n}\n","import {\n\tDOCUMENT,\n\tinject,\n\tInjectable,\n\tInjectionToken,\n\tInjector,\n\tRenderer2,\n\tRendererFactory2,\n\tRendererType2,\n\tType,\n\tuntracked,\n} from '@angular/core';\nimport * as THREE from 'three';\nimport { NgtArgs } from '../directives/args';\nimport { NgtCommonDirective } from '../directives/common';\nimport { NgtParent } from '../directives/parent';\nimport { getInstanceState, prepare } from '../instance';\nimport {\n\tNgtAttachable,\n\tNgtConstructorRepresentation,\n\tNgtEventHandlers,\n\tNgtInstanceNode,\n\tNgtInstanceState,\n} from '../types';\nimport { applyProps } from '../utils/apply-props';\nimport { is } from '../utils/is';\nimport { injectCatalogue } from './catalogue';\nimport {\n\tNGT_CANVAS_CONTENT_FLAG,\n\tNGT_DELEGATE_RENDERER_DESTROY_NODE_PATCHED_FLAG,\n\tNGT_DOM_PARENT_FLAG,\n\tNGT_HTML_FLAG,\n\tNGT_INTERNAL_ADD_COMMENT_FLAG,\n\tNGT_INTERNAL_SET_PARENT_COMMENT_FLAG,\n\tNGT_PORTAL_CONTENT_FLAG,\n\tNGT_RENDERER_NODE_FLAG,\n\tTHREE_NATIVE_EVENTS,\n} from './constants';\nimport {\n\taddRendererChildNode,\n\tcreateRendererNode,\n\tisRendererNode,\n\tNgtRendererNode,\n\tsetRendererParentNode,\n} from './state';\nimport { attachThreeNodes, internalDestroyNode, kebabToPascal, NgtRendererClassId, removeThreeChild } from './utils';\n\n/**\n * Configuration options for the Angular Three renderer factory.\n */\nexport interface NgtRendererFactory2Options {\n\t/**\n\t * Enable verbose logging for debugging renderer operations.\n\t * @default false\n\t */\n\tverbose?: boolean;\n\t/**\n\t * When a change happens to an object's direct children, Angular Three will notify the object's ancestors\n\t * of this change so the ancestors are aware of the updated matrices of the object. In order to reduce the\n\t * number of notifications, Angular Three caches and skips notifications when possible.\n\t *\n\t * However, this can cause missed notifications in some cases. Control the number of skips with this option.\n\t *\n\t * @default 5\n\t */\n\tmaxNotificationSkipCount?: number;\n}\n\n/**\n * Injection token for renderer factory options.\n */\nexport const NGT_RENDERER_OPTIONS = new InjectionToken<NgtRendererFactory2Options>('NGT_RENDERER_OPTIONS');\n\n/**\n * Angular renderer factory for Three.js elements.\n *\n * This factory creates NgtRenderer2 instances for components that use Angular Three.\n * It intercepts Angular's rendering operations and translates them to Three.js object\n * creation and manipulation.\n *\n * The factory is typically provided via `provideNgtRenderer()` in your application config.\n *\n * @example\n * ```typescript\n * // In app.config.ts\n * import { provideNgtRenderer } from 'angular-three/dom';\n *\n * export const appConfig: ApplicationConfig = {\n * providers: [provideNgtRenderer()]\n * };\n * ```\n */\n@Injectable()\nexport class NgtRendererFactory2 implements RendererFactory2 {\n\tprivate catalogue = injectCatalogue();\n\tprivate document = inject(DOCUMENT);\n\tprivate options = inject(NGT_RENDERER_OPTIONS, { optional: true }) || {};\n\tprivate rendererMap = new Map<string, Renderer2>();\n\n\t/**\n\t * NOTE: We use `useFactory` to instantiate `NgtRendererFactory2`\n\t */\n\tconstructor(private delegateRendererFactory: RendererFactory2) {}\n\n\tcreateRenderer(hostElement: any, type: RendererType2 | null): Renderer2 {\n\t\tconst delegateRenderer = this.delegateRendererFactory.createRenderer(hostElement, type);\n\t\tif (!type) return delegateRenderer;\n\n\t\tlet renderer = this.rendererMap.get(type.id);\n\t\tif (renderer) {\n\t\t\tif (renderer instanceof NgtRenderer2) {\n\t\t\t\trenderer.count += 1;\n\t\t\t\tif (renderer.delegateRenderer !== delegateRenderer) {\n\t\t\t\t\trenderer.delegateRenderer = delegateRenderer;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn renderer;\n\t\t}\n\n\t\tif (hostElement && !isRendererNode(hostElement)) {\n\t\t\tcreateRendererNode('platform', hostElement, this.document);\n\t\t}\n\n\t\tif (Reflect.get(type, 'type')?.[NGT_HTML_FLAG]) {\n\t\t\tthis.rendererMap.set(type.id, delegateRenderer);\n\n\t\t\t// patch delegate destroyNode so we can destroy this HTML node\n\t\t\t// TODO: make sure we really need to do this\n\t\t\tconst originalDestroyNode = delegateRenderer.destroyNode?.bind(delegateRenderer);\n\t\t\tif (!originalDestroyNode || !(NGT_DELEGATE_RENDERER_DESTROY_NODE_PATCHED_FLAG in originalDestroyNode)) {\n\t\t\t\tdelegateRenderer.destroyNode = (node) => {\n\t\t\t\t\toriginalDestroyNode?.(node);\n\t\t\t\t\tif (node !== hostElement) return;\n\t\t\t\t\tinternalDestroyNode(node, null);\n\t\t\t\t};\n\t\t\t\tObject.assign(delegateRenderer.destroyNode, {\n\t\t\t\t\t[NGT_DELEGATE_RENDERER_DESTROY_NODE_PATCHED_FLAG]: true,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn delegateRenderer;\n\t\t}\n\n\t\tthis.rendererMap.set(\n\t\t\ttype.id,\n\t\t\t(renderer = new NgtRenderer2(delegateRenderer, this.catalogue, this.document, this.options)),\n\t\t);\n\t\treturn renderer;\n\t}\n}\n\n/**\n * Custom Angular renderer for Three.js elements.\n *\n * This renderer intercepts Angular's DOM operations and translates them to Three.js\n * object manipulations. It handles:\n * - Element creation (converting ngt-* elements to Three.js objects)\n * - Property/attribute setting (applying props to Three.js objects)\n * - Event listening (setting up Three.js event handlers)\n * - Parent-child relationships (managing the Three.js scene graph)\n *\n * @internal\n */\nexport class NgtRenderer2 implements Renderer2 {\n\tprivate argsInjectors: Array<Injector> = [];\n\tprivate parentInjectors: Array<Injector> = [];\n\n\tconstructor(\n\t\tpublic delegateRenderer: Renderer2,\n\t\tprivate catalogue: Record<string, NgtConstructorRepresentation>,\n\t\tprivate document: Document,\n\t\tprivate options: NgtRendererFactory2Options,\n\t\tpublic count = 1,\n\t) {\n\t\tif (!this.options.verbose) {\n\t\t\tthis.options.verbose = false;\n\t\t}\n\t}\n\n\tget data(): { [key: string]: any } {\n\t\treturn { ...this.delegateRenderer.data, __ngt_renderer__: true };\n\t}\n\n\tdestroy(): void {\n\t\tif (this.count > 1) {\n\t\t\tthis.count -= 1;\n\t\t\treturn;\n\t\t}\n\n\t\t// this is the last instance of the same NgtRenderer2\n\t\tthis.count = 0;\n\t\tthis.argsInjectors = [];\n\t\tthis.parentInjectors = [];\n\t}\n\n\tcreateElement(name: string, namespace?: string | null) {\n\t\tconst platformElement = this.delegateRenderer.createElement(name, namespace);\n\n\t\tif (name === 'ngt-portal') {\n\t\t\treturn createRendererNode('portal', platformElement, this.document);\n\t\t}\n\n\t\tif (name === 'ngt-value') {\n\t\t\treturn createRendererNode('three', prepare(platformElement, 'ngt-value'), this.document);\n\t\t}\n\n\t\tconst [injectedArgs, injectedParent] = [\n\t\t\tthis.getNgtDirective(NgtArgs, this.argsInjectors)?.value || [],\n\t\t\tthis.getNgtDirective(NgtParent, this.parentInjectors)?.value,\n\t\t];\n\n\t\tif (name === 'ngt-primitive') {\n\t\t\tif (!injectedArgs[0]) throw new Error(`[NGT] ngt-primitive without args is invalid`);\n\t\t\tconst object = injectedArgs[0];\n\n\t\t\tif (getInstanceState(object)) {\n\t\t\t\tdelete object['__ngt__'];\n\t\t\t}\n\n\t\t\tprepare(object, 'ngt-primitive');\n\n\t\t\tconst primitiveRendererNode = createRendererNode('three', object, this.document);\n\t\t\tif (injectedParent) {\n\t\t\t\tprimitiveRendererNode.__ngt_renderer__[NgtRendererClassId.parent] =\n\t\t\t\t\tinjectedParent as unknown as NgtRendererNode<'three'>;\n\t\t\t}\n\n\t\t\treturn primitiveRendererNode;\n\t\t}\n\n\t\tif (!name.startsWith('ngt-')) {\n\t\t\treturn createRendererNode('platform', platformElement, this.document);\n\t\t}\n\n\t\tconst threeName = kebabToPascal(name.startsWith('ngt-') ? name.slice(4) : name);\n\t\tlet threeTarget = this.catalogue[threeName];\n\n\t\tif (!threeTarget && threeName in THREE) {\n\t\t\tconst threeSymbol = THREE[threeName as keyof typeof THREE];\n\t\t\tif (typeof threeSymbol === 'function') {\n\t\t\t\t// we will attempt to prefill the catalogue with symbols from THREE\n\t\t\t\tthreeTarget = this.catalogue[threeName] = threeSymbol as NgtConstructorRepresentation;\n\t\t\t}\n\t\t}\n\n\t\tif (threeTarget) {\n\t\t\tconst threeInstance = prepare(new threeTarget(...injectedArgs), name);\n\t\t\tconst rendererNode = createRendererNode('three', threeInstance, this.document);\n\t\t\t// assert type here because it is just created so we don't have to null check it\n\t\t\tconst instanceState = getInstanceState(threeInstance) as NgtInstanceState;\n\n\t\t\t// auto-attach for geometry and material\n\t\t\tif (is.three<THREE.BufferGeometry>(threeInstance, 'isBufferGeometry')) {\n\t\t\t\tinstanceState.attach = ['geometry'];\n\t\t\t} else if (is.three<THREE.Material>(threeInstance, 'isMaterial')) {\n\t\t\t\tinstanceState.attach = ['material'];\n\t\t\t}\n\n\t\t\tif (injectedParent) {\n\t\t\t\trendererNode.__ngt_renderer__[NgtRendererClassId.parent] =\n\t\t\t\t\tinjectedParent as unknown as NgtRendererNode<'three'>;\n\t\t\t}\n\n\t\t\treturn rendererNode;\n\t\t}\n\n\t\treturn createRendererNode('platform', platformElement, this.document);\n\t}\n\n\tcreateComment(value: string) {\n\t\tconst commentNode = this.delegateRenderer.createComment(value);\n\n\t\tconst commentRendererNode = createRendererNode('comment', commentNode, this.document);\n\n\t\t// NOTE: we attach an arrow function to the Comment node\n\t\t// In our directives, we can call this function to then start tracking the RendererNode\n\t\t// this is done to limit the amount of Nodes we need to process for getCreationState\n\t\tObject.assign(commentRendererNode, {\n\t\t\t[NGT_INTERNAL_ADD_COMMENT_FLAG]: (type: 'args' | 'parent', injector: Injector) => {\n\t\t\t\tif (type === 'args') {\n\t\t\t\t\tthis.argsInjectors.push(injector);\n\t\t\t\t} else if (type === 'parent') {\n\t\t\t\t\tObject.assign(commentRendererNode, {\n\t\t\t\t\t\t[NGT_INTERNAL_SET_PARENT_COMMENT_FLAG]: (ngtParent: NgtRendererNode<'three'>) => {\n\t\t\t\t\t\t\tcommentRendererNode.__ngt_renderer__[NgtRendererClassId.parent] = ngtParent;\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tthis.parentInjectors.push(injector);\n\t\t\t\t}\n\n\t\t\t\tcommentRendererNode.__ngt_renderer__[NgtRendererClassId.injector] = injector;\n\t\t\t},\n\t\t});\n\n\t\treturn commentRendererNode;\n\t}\n\n\tcreateText(value: string) {\n\t\tconst textNode = this.delegateRenderer.createText(value);\n\t\treturn createRendererNode('text', textNode, this.document);\n\t}\n\n\tdestroyNode: (node: NgtRendererNode) => void = (node) => {\n\t\tinternalDestroyNode(node, this.removeChild.bind(this));\n\t};\n\n\tappendChild(\n\t\tparent: NgtRendererNode,\n\t\tnewChild: NgtRendererNode,\n\t\trefChild?: NgtRendererNode,\n\t\tisMove?: boolean,\n\t): void {\n\t\tconst delegatedFn = refChild\n\t\t\t? this.delegateRenderer.insertBefore.bind(this.delegateRenderer, parent, newChild, refChild, isMove)\n\t\t\t: this.delegateRenderer.appendChild.bind(this.delegateRenderer, parent, newChild);\n\n\t\tconst pRS = parent.__ngt_renderer__;\n\t\tconst cRS = newChild.__ngt_renderer__;\n\n\t\tif (!pRS || !cRS) {\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn('[NGT dev mode] One of parent or child is not a renderer node.', { parent, newChild });\n\t\t\treturn delegatedFn();\n\t\t}\n\n\t\tif (cRS[NgtRendererClassId.type] === 'comment') {\n\t\t\t// if child is a comment, we'll set the parent then bail.\n\t\t\t// comment usually means it's part of a templateRef ViewContainerRef or structural directive\n\t\t\tsetRendererParentNode(newChild, parent);\n\n\t\t\t// if parent is not three, we'll delegate to the renderer\n\t\t\tif (pRS[NgtRendererClassId.type] !== 'three') {\n\t\t\t\tdelegatedFn();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'platform' && cRS[NgtRendererClassId.type] === 'platform') {\n\t\t\tif (newChild[NGT_DOM_PARENT_FLAG] && newChild[NGT_DOM_PARENT_FLAG] instanceof HTMLElement) {\n\t\t\t\treturn this.delegateRenderer.appendChild(newChild[NGT_DOM_PARENT_FLAG], newChild);\n\t\t\t}\n\n\t\t\tif (pRS[NgtRendererClassId.parent] && !cRS[NgtRendererClassId.parent]) {\n\t\t\t\treturn this.appendChild(pRS[NgtRendererClassId.parent], newChild);\n\t\t\t}\n\n\t\t\treturn delegatedFn();\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'three' && cRS[NgtRendererClassId.type] === 'three') {\n\t\t\treturn this.appendThreeRendererNodes(parent, newChild);\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'platform' && cRS[NgtRendererClassId.type] === 'three') {\n\t\t\t// if platform has parent, delegate to that parent\n\t\t\tif (pRS[NgtRendererClassId.parent]) {\n\t\t\t\t// but track the child for this parent as well\n\t\t\t\taddRendererChildNode(parent, newChild);\n\t\t\t\treturn this.appendChild(pRS[NgtRendererClassId.parent], newChild);\n\t\t\t}\n\n\t\t\t// platform can also have normal parentNode\n\t\t\tconst platformParentNode = this.delegateRenderer.parentNode(parent);\n\t\t\tif (platformParentNode) {\n\t\t\t\treturn this.appendChild(platformParentNode, newChild);\n\t\t\t}\n\n\t\t\t// if not, set up parent and child relationship for this pair then bail\n\t\t\tthis.setNodeRelationship(parent, newChild);\n\t\t\treturn;\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'three' && cRS[NgtRendererClassId.type] === 'platform') {\n\t\t\tif (!cRS[NgtRendererClassId.parent]) {\n\t\t\t\tsetRendererParentNode(newChild, parent);\n\t\t\t}\n\n\t\t\tfor (const child of cRS[NgtRendererClassId.children]) {\n\t\t\t\tthis.appendChild(parent, child);\n\t\t\t}\n\n\t\t\tfor (const platformChildNode of newChild['childNodes'] || []) {\n\t\t\t\tif (\n\t\t\t\t\t!isRendererNode(platformChildNode) ||\n\t\t\t\t\tplatformChildNode.__ngt_renderer__[NgtRendererClassId.type] !== 'platform'\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\t\t\t\tthis.appendChild(parent, platformChildNode);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'portal' && cRS[NgtRendererClassId.type] === 'three') {\n\t\t\tif (!cRS[NgtRendererClassId.parent] && pRS[NgtRendererClassId.portalContainer]) {\n\t\t\t\treturn this.appendChild(pRS[NgtRendererClassId.portalContainer], newChild);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'platform' && cRS[NgtRendererClassId.type] === 'portal') {\n\t\t\treturn this.delegateRenderer.appendChild(parent, newChild);\n\t\t}\n\n\t\treturn delegatedFn();\n\t}\n\n\tinsertBefore(\n\t\tparent: NgtRendererNode,\n\t\tnewChild: NgtRendererNode,\n\t\trefChild: NgtRendererNode,\n\t\tisMove?: boolean,\n\t): void {\n\t\t// if both are comments and the reference child is NgtCanvasContent, we'll assign the same flag to the newChild\n\t\t// this means that the NgtCanvas component is embedding. This flag allows the Renderer to get the root scene\n\t\t// when it tries to attach the template under `ng-template[canvasContent]`\n\t\tif (\n\t\t\trefChild &&\n\t\t\trefChild[NGT_CANVAS_CONTENT_FLAG] &&\n\t\t\trefChild instanceof Comment &&\n\t\t\tnewChild instanceof Comment\n\t\t) {\n\t\t\tObject.assign(newChild, { [NGT_CANVAS_CONTENT_FLAG]: refChild[NGT_CANVAS_CONTENT_FLAG] });\n\t\t}\n\n\t\t// if there is no parent, we delegate\n\t\tif (!parent) {\n\t\t\treturn this.delegateRenderer.insertBefore(parent, newChild, refChild, isMove);\n\t\t}\n\n\t\treturn this.appendChild(parent, newChild, refChild, isMove);\n\t}\n\n\tremoveChild(parent: NgtRendererNode, oldChild: NgtRendererNode, isHostElement?: boolean): void {\n\t\tif (parent === null) {\n\t\t\tparent = this.parentNode(oldChild);\n\t\t}\n\n\t\tconst cRS = oldChild.__ngt_renderer__;\n\n\t\tif (!cRS) {\n\t\t\ttry {\n\t\t\t\treturn this.delegateRenderer.removeChild(parent, oldChild, isHostElement);\n\t\t\t} catch {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// disassociate things from oldChild\n\t\tcRS[NgtRendererClassId.parent] = null;\n\n\t\t// if parent is still undefined\n\t\tif (parent == null) {\n\t\t\tif (cRS[NgtRendererClassId.destroyed]) {\n\t\t\t\t// if the child is already destroyed, just skip\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn('[NGT dev mode] parent is not found when remove child', { parent, oldChild });\n\t\t\treturn;\n\t\t}\n\n\t\tconst pRS = parent.__ngt_renderer__;\n\n\t\tif (!pRS) {\n\t\t\treturn this.delegateRenderer.removeChild(parent, oldChild, isHostElement);\n\t\t}\n\n\t\tconst childIndex = pRS[NgtRendererClassId.children].indexOf(oldChild);\n\t\tif (childIndex >= 0) {\n\t\t\t// disassociate oldChild from parent children\n\t\t\tpRS[NgtRendererClassId.children].splice(childIndex, 1);\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'three' && cRS[NgtRendererClassId.type] === 'three') {\n\t\t\treturn removeThreeChild(oldChild as unknown as NgtInstanceNode, parent as unknown as NgtInstanceNode, true);\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'platform' && cRS[NgtRendererClassId.type] === 'platform') {\n\t\t\treturn this.delegateRenderer.removeChild(parent, oldChild, isHostElement);\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'three' && cRS[NgtRendererClassId.type] === 'platform') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (pRS[NgtRendererClassId.type] === 'platform' && cRS[NgtRendererClassId.type] === 'three') {\n\t\t\tconst childLS = getInstanceState(oldChild);\n\t\t\tif (!childLS) return;\n\n\t\t\tconst threeParent = childLS.parent ? untracked(childLS.parent) : null;\n\t\t\tif (!threeParent) return;\n\n\t\t\treturn this.removeChild(threeParent as unknown as NgtRendererNode, oldChild);\n\t\t}\n\n\t\treturn this.delegateRenderer.removeChild(parent, oldChild, isHostElement);\n\t}\n\n\tparentNode(node: NgtRendererNode) {\n\t\tif (\n\t\t\tnode &&\n\t\t\t(node[NGT_CANVAS_CONTENT_FLAG] || node[NGT_PORTAL_CONTENT_FLAG]) &&\n\t\t\tnode instanceof Comment &&\n\t\t\tisRendererNode(node)\n\t\t) {\n\t\t\tconst store = node[NGT_CANVAS_CONTENT_FLAG] || node[NGT_PORTAL_CONTENT_FLAG];\n\n\t\t\t// this should not happen but if it does, we'll delegate to the renderer\n\t\t\tif (!store) {\n\t\t\t\treturn this.delegateRenderer.parentNode(node);\n\t\t\t}\n\n\t\t\tconst rootScene = store.snapshot.scene;\n\n\t\t\t// if we don't have the scene yet, bail again\n\t\t\tif (!rootScene) {\n\t\t\t\treturn this.delegateRenderer.parentNode(node);\n\t\t\t}\n\n\t\t\t// if root scene is not a renderer node, we'll make it a renderer node here\n\t\t\tif (!(NGT_RENDERER_NODE_FLAG in rootScene)) {\n\t\t\t\tconst sceneRendererNode = createRendererNode('three', rootScene, this.document);\n\t\t\t\t// set parent to the comment too\n\t\t\t\tsetRendererParentNode(node, sceneRendererNode);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tnode[NGT_PORTAL_CONTENT_FLAG] &&\n\t\t\t\tnode[NGT_DOM_PARENT_FLAG] &&\n\t\t\t\tisRendererNode(node[NGT_DOM_PARENT_FLAG])\n\t\t\t) {\n\t\t\t\tconst portalContentParent = node[NGT_DOM_PARENT_FLAG] as NgtRendererNode<'portal'>;\n\t\t\t\tconst portalContentParentRS = portalContentParent.__ngt_renderer__;\n\t\t\t\tif (!portalContentParentRS[NgtRendererClassId.portalContainer]) {\n\t\t\t\t\tportalContentParentRS[NgtRendererClassId.portalContainer] = rootScene;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn rootScene;\n\t\t}\n\n\t\tconst rendererParentNode = node.__ngt_renderer__?.[NgtRendererClassId.parent];\n\t\t// returns the renderer parent node if it exists, otherwise returns the delegateRenderer parentNode\n\t\treturn rendererParentNode ?? this.delegateRenderer.parentNode(node);\n\t}\n\n\tremoveAttribute(el: NgtRendererNode, name: string, namespace?: string | null): void {\n\t\tconst rS = el.__ngt_renderer__;\n\t\tif (!rS || rS[NgtRendererClassId.destroyed]) return this.delegateRenderer.removeAttribute(el, name, namespace);\n\n\t\tif (rS[NgtRendererClassId.type] === 'three') {\n\t\t\treturn;\n\t\t}\n\t\treturn this.delegateRenderer.removeAttribute(el, name, namespace);\n\t}\n\n\tsetAttribute(el: NgtRendererNode, name: string, value: string, namespace?: string | null): void {\n\t\tconst rS = el.__ngt_renderer__;\n\t\tif (!rS) return this.delegateRenderer.setAttribute(el, name, value, namespace);\n\n\t\tif (rS[NgtRendererClassId.destroyed]) {\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn(`[NGT dev mode] setAttribute is invoked on destroyed renderer node.`, { el, name, value });\n\t\t\treturn;\n\t\t}\n\n\t\tif (rS[NgtRendererClassId.type] === 'three') {\n\t\t\tif (name === 'attach') {\n\t\t\t\tconst paths = value.split('.');\n\t\t\t\tif (paths.length) {\n\t\t\t\t\tconst instanceState = getInstanceState(el);\n\t\t\t\t\tif (instanceState) instanceState.attach = paths;\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// coercion for primitive values\n\t\t\tlet maybeCoerced: string | number | boolean = value;\n\n\t\t\tif (maybeCoerced === '' || maybeCoerced === 'true' || maybeCoerced === 'false') {\n\t\t\t\tmaybeCoerced = maybeCoerced === 'true' || maybeCoerced === '';\n\t\t\t} else {\n\t\t\t\tconst maybeNumber = Number(maybeCoerced);\n\t\t\t\tif (!isNaN(maybeNumber)) maybeCoerced = maybeNumber;\n\t\t\t}\n\n\t\t\tif (name === 'rawValue') {\n\t\t\t\trS[NgtRendererClassId.rawValue] = maybeCoerced;\n\t\t\t} else {\n\t\t\t\tapplyProps(el, { [name]: maybeCoerced });\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.delegateRenderer.setAttribute(el, name, value, namespace);\n\t}\n\n\tsetProperty(el: NgtRendererNode, name: string, value: any): void {\n\t\t// NOTE: untrack all signal updates because this is during setProperty which is a reactive context\n\t\t// attaching potentially updates signals which is not allowed\n\n\t\tconst rS = el.__ngt_renderer__;\n\n\t\tif (!rS || rS[NgtRendererClassId.destroyed]) {\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn('[NGT dev mode] setProperty is invoked on destroyed renderer node.', { el, name, value });\n\t\t\treturn;\n\t\t}\n\n\t\tif (rS[NgtRendererClassId.type] === 'three') {\n\t\t\tconst instanceState = getInstanceState(el);\n\t\t\tconst parent = instanceState?.hierarchyStore.snapshot.parent || rS[NgtRendererClassId.parent];\n\n\t\t\tif (name === 'parameters') {\n\t\t\t\t// NOTE: short-cut for null raycast to prevent upstream from creating a nullRaycast property\n\t\t\t\tif ('raycast' in value && value['raycast'] === null) {\n\t\t\t\t\tvalue['raycast'] = () => null;\n\t\t\t\t}\n\n\t\t\t\tapplyProps(el, value);\n\n\t\t\t\tif ('geometry' in value && is.three<THREE.BufferGeometry>(value['geometry'], 'isBufferGeometry')) {\n\t\t\t\t\tuntracked(() => instanceState?.updateGeometryStamp());\n\t\t\t\t}\n\n\t\t\t\tif ('attach' in value && value['attach'] !== undefined) {\n\t\t\t\t\tif (instanceState) instanceState.attach = this.normalizeAttach(value['attach']);\n\t\t\t\t\tif (parent) untracked(() => attachThreeNodes(parent, el as unknown as NgtInstanceNode));\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// [rawValue]\n\t\t\tif (instanceState?.type === 'ngt-value' && name === 'rawValue') {\n\t\t\t\trS[NgtRendererClassId.rawValue] = value;\n\t\t\t\tif (parent) untracked(() => attachThreeNodes(parent, el as unknown as NgtInstanceNode));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// [attach]\n\t\t\tif (name === 'attach') {\n\t\t\t\tif (instanceState) instanceState.attach = this.normalizeAttach(value);\n\t\t\t\tif (parent) untracked(() => attachThreeNodes(parent, el as unknown as NgtInstanceNode));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// NOTE: short-cut for null raycast to prevent upstream from creating a nullRaycast property\n\t\t\tif (name === 'raycast' && value === null) {\n\t\t\t\tvalue = () => null;\n\t\t\t}\n\n\t\t\tapplyProps(el, { [name]: value });\n\n\t\t\tif (instanceState && name === 'geometry' && is.three<THREE.BufferGeometry>(value, 'isBufferGeometry')) {\n\t\t\t\tuntracked(() => {\n\t\t\t\t\tinstanceState.updateGeometryStamp();\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.delegateRenderer.setProperty(el, name, value);\n\t}\n\n\tlisten(\n\t\ttarget: 'window' | 'document' | 'body' | NgtRendererNode,\n\t\teventName: string,\n\t\tcallback: (event: any) => boolean | void,\n\t): () => void {\n\t\tif (typeof target === 'string') {\n\t\t\treturn this.delegateRenderer.listen(target, eventName, callback);\n\t\t}\n\n\t\tconst rS = target.__ngt_renderer__;\n\t\tif (!rS) {\n\t\t\treturn this.delegateRenderer.listen(target, eventName, callback);\n\t\t}\n\n\t\tif (rS[NgtRendererClassId.destroyed]) return () => {};\n\n\t\tif (rS[NgtRendererClassId.type] === 'three') {\n\t\t\tconst iS = getInstanceState(target);\n\t\t\tif (!iS) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'[NGT] instance which has not been prepared cannot have events. Call `prepare()` manually if needed.',\n\t\t\t\t);\n\t\t\t\treturn () => {};\n\t\t\t}\n\n\t\t\tif (eventName === 'created') {\n\t\t\t\tcallback(target);\n\t\t\t\treturn () => {};\n\t\t\t}\n\n\t\t\tif (eventName === 'attached') {\n\t\t\t\tiS.onAttach = callback;\n\t\t\t\tconst parent = iS.parent && untracked(iS.parent);\n\t\t\t\tif (parent) iS.onAttach({ parent, node: target as unknown as NgtInstanceNode });\n\t\t\t\treturn () => {\n\t\t\t\t\tiS.onAttach = undefined;\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (eventName === 'updated') {\n\t\t\t\tiS.onUpdate = callback;\n\t\t\t\treturn () => {\n\t\t\t\t\tiS.onUpdate = undefined;\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (THREE_NATIVE_EVENTS.includes(eventName) && target instanceof THREE.EventDispatcher) {\n\t\t\t\t// NOTE: rename to dispose because that's the event type, not disposed.\n\t\t\t\tif (eventName === 'disposed') {\n\t\t\t\t\teventName = 'dispose';\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t(target as unknown as THREE.Object3D).parent &&\n\t\t\t\t\t(eventName === 'added' || eventName === 'removed')\n\t\t\t\t) {\n\t\t\t\t\tcallback({ type: eventName, target });\n\t\t\t\t}\n\n\t\t\t\ttarget.addEventListener(eventName, callback);\n\t\t\t\treturn () => {\n\t\t\t\t\ttarget.removeEventListener(eventName, callback);\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst cleanup = iS.setPointerEvent?.(eventName as keyof NgtEventHandlers, callback) || (() => {});\n\n\t\t\t// this means the object has already been attached to the parent and has its store propagated\n\t\t\tif (iS.store) iS.addInteraction?.(iS.store);\n\n\t\t\treturn cleanup;\n\t\t}\n\n\t\treturn this.delegateRenderer.listen(target, eventName, callback);\n\t}\n\n\tprivate appendThreeRendererNodes(parent: NgtRendererNode, child: NgtRendererNode) {\n\t\t// if parent and child are the same, skip\n\t\tif (parent === child) {\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn('[NGT dev mode] appending THREE.js parent and child but they are the same', {\n\t\t\t\t\tparent,\n\t\t\t\t\tchild,\n\t\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst cIS = getInstanceState(child);\n\n\t\t// if child is already attached to a parent, skip\n\t\tif (cIS?.hierarchyStore.snapshot.parent) {\n\t\t\tthis.options.verbose &&\n\t\t\t\tconsole.warn('[NGT dev mode] appending THREE.js parent and child but child is already attached', {\n\t\t\t\t\tparent,\n\t\t\t\t\tchild,\n\t\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// set the relationship\n\t\tthis.setNodeRelationship(parent, child);\n\n\t\t// attach THREE child\n\t\tattachThreeNodes(parent as unknown as NgtInstanceNode, child as unknown as NgtInstanceNode);\n\t\treturn;\n\t}\n\n\tprivate setNodeRelationship(parent: NgtRendererNode, child: NgtRendererNode) {\n\t\tsetRendererParentNode(child, parent);\n\t\taddRendererChildNode(parent, child);\n\t}\n\n\tprivate getNgtDirective<TDirective extends NgtCommonDirective<any>>(\n\t\tdirective: Type<TDirective>,\n\t\tinjectors: Array<Injector>,\n\t) {\n\t\tlet directiveInstance: TDirective | undefined;\n\n\t\tlet i = injectors.length - 1;\n\t\twhile (i >= 0) {\n\t\t\tconst injector = injectors[i];\n\t\t\tconst instance = injector.get(directive, null);\n\t\t\tif (instance && typeof instance === 'object' && instance.validate()) {\n\t\t\t\tdirectiveInstance = instance;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti--;\n\t\t}\n\n\t\treturn directiveInstance;\n\t}\n\n\tprivate normalizeAttach(attach: NgtAttachable) {\n\t\tif (typeof attach === 'function') return attach;\n\t\tif (typeof attach === 'string') return attach.split('.');\n\t\treturn attach.flatMap((item) => item.toString().split('.'));\n\t}\n\n\taddClass = this.delegateRenderer.addClass.bind(this.delegateRenderer);\n\tremoveClass = this.delegateRenderer.removeClass.bind(this.delegateRenderer);\n\tsetStyle = this.delegateRenderer.setStyle.bind(this.delegateRenderer);\n\tremoveStyle = this.delegateRenderer.removeStyle.bind(this.delegateRenderer);\n\tselectRootElement = this.delegateRenderer.selectRootElement.bind(this.delegateRenderer);\n\tnextSibling = this.delegateRenderer.nextSibling.bind(this.delegateRenderer);\n\tsetValue = this.delegateRenderer.setValue.bind(this.delegateRenderer);\n}\n","import { DOCUMENT, ElementRef, InjectOptions, InjectionToken, effect, inject } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport * as THREE from 'three';\nimport { injectLoop } from './loop';\nimport { NGT_RENDERER_OPTIONS } from './renderer/renderer';\nimport type {\n\tNgtBeforeRenderRecord,\n\tNgtCamera,\n\tNgtDpr,\n\tNgtEventManager,\n\tNgtFrameloop,\n\tNgtSize,\n\tNgtState,\n\tNgtXRManager,\n} from './types';\nimport { is } from './utils/is';\nimport { makeDpr, makeId } from './utils/make';\nimport { SignalState, signalState } from './utils/signal-state';\nimport { updateCamera } from './utils/update';\n\n/**\n * Factory function to create the Angular Three store.\n *\n * Creates and initializes the central state management store for the Angular Three application.\n * This store contains all the state needed for rendering including the WebGL renderer, camera, scene,\n * raycaster, and internal state for managing the render loop and event handling.\n *\n * @returns A SignalState containing the NgtState object with reactive signals for all state properties\n *\n * @example\n * ```typescript\n * // Usually provided automatically by NgtCanvas\n * providers: [{ provide: NGT_STORE, useFactory: storeFactory }]\n * ```\n */\nexport function storeFactory() {\n\tconst { invalidate, advance } = injectLoop();\n\tconst rendererOptions = inject(NGT_RENDERER_OPTIONS, { optional: true }) || {};\n\tconst document = inject(DOCUMENT);\n\tconst window = document.defaultView || undefined;\n\n\t// NOTE: using Subject because we do not care about late-subscribers\n\tconst pointerMissed$ = new Subject<MouseEvent>();\n\n\tconst position = new THREE.Vector3();\n\tconst defaultTarget = new THREE.Vector3();\n\tconst tempTarget = new THREE.Vector3();\n\n\tlet performanceTimeout: ReturnType<typeof setTimeout> | undefined = undefined;\n\n\tconst pointer = new THREE.Vector2();\n\n\t// getCurrentViewport will mutate this instead of creating a new object everytime\n\tconst tempViewport = {\n\t\twidth: 0,\n\t\theight: 0,\n\t\ttop: 0,\n\t\tleft: 0,\n\t\tfactor: 1,\n\t\tdistance: 0,\n\t\taspect: 0,\n\t};\n\n\tconst store: SignalState<NgtState> = signalState<NgtState>({\n\t\tid: makeId(),\n\t\tmaxNotificationSkipCount: rendererOptions.maxNotificationSkipCount || 5,\n\t\tpointerMissed$: pointerMissed$.asObservable(),\n\t\tevents: { priority: 1, enabled: true, connected: false },\n\n\t\t// Mock objects that have to be configured\n\t\tgl: null as unknown as THREE.WebGLRenderer,\n\t\tcamera: null as unknown as NgtCamera,\n\t\traycaster: null as unknown as THREE.Raycaster,\n\t\tscene: null as unknown as THREE.Scene,\n\t\txr: null as unknown as NgtXRManager,\n\n\t\tinvalidate: (frames = 1) => invalidate(store, frames),\n\t\tadvance: (timestamp: number, runGlobalEffects?: boolean) => advance(timestamp, runGlobalEffects, store),\n\n\t\tlegacy: false,\n\t\tlinear: false,\n\t\tflat: false,\n\n\t\tcontrols: null,\n\t\tclock: new THREE.Clock(),\n\t\tpointer,\n\n\t\tframeloop: 'always',\n\n\t\tperformance: {\n\t\t\tcurrent: 1,\n\t\t\tmin: 0.5,\n\t\t\tmax: 1,\n\t\t\tdebounce: 200,\n\t\t\tregress: () => {\n\t\t\t\tconst state = store.snapshot;\n\t\t\t\t// Clear timeout\n\t\t\t\tif (performanceTimeout) clearTimeout(performanceTimeout);\n\t\t\t\t// Set lower bound performance\n\t\t\t\tif (state.performance.current !== state.performance.min)\n\t\t\t\t\tstore.update((state) => ({\n\t\t\t\t\t\tperformance: { ...state.performance, current: state.performance.min },\n\t\t\t\t\t}));\n\t\t\t\t// Go back to upper bound performance after a while unless something regresses meanwhile\n\t\t\t\tperformanceTimeout = setTimeout(\n\t\t\t\t\t() =>\n\t\t\t\t\t\tstore.update((state) => ({\n\t\t\t\t\t\t\tperformance: { ...state.performance, current: store.snapshot.performance.max },\n\t\t\t\t\t\t})),\n\t\t\t\t\tstate.performance.debounce,\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\n\t\tsize: { width: 0, height: 0, top: 0, left: 0 },\n\t\tviewport: {\n\t\t\tinitialDpr: window?.devicePixelRatio || 1,\n\t\t\tdpr: window?.devicePixelRatio || 1,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\ttop: 0,\n\t\t\tleft: 0,\n\t\t\taspect: 0,\n\t\t\tdistance: 0,\n\t\t\tfactor: 0,\n\t\t\tgetCurrentViewport(\n\t\t\t\tcamera: NgtCamera = store.snapshot.camera,\n\t\t\t\ttarget: THREE.Vector3 | Parameters<THREE.Vector3['set']> = defaultTarget,\n\t\t\t\tsize: NgtSize = store.snapshot.size,\n\t\t\t) {\n\t\t\t\tconst { width, height, top, left } = size;\n\t\t\t\tconst aspect = width / height;\n\n\t\t\t\tif ((target as THREE.Vector3).isVector3) tempTarget.copy(target as THREE.Vector3);\n\t\t\t\telse tempTarget.set(...(target as Parameters<THREE.Vector3['set']>));\n\n\t\t\t\tconst distance = camera.getWorldPosition(position).distanceTo(tempTarget);\n\n\t\t\t\t// Update the pre-allocated viewport object\n\t\t\t\ttempViewport.top = top;\n\t\t\t\ttempViewport.left = left;\n\t\t\t\ttempViewport.aspect = aspect;\n\t\t\t\ttempViewport.distance = distance;\n\n\t\t\t\tif (is.three<THREE.OrthographicCamera>(camera, 'isOrthographicCamera')) {\n\t\t\t\t\t// For orthographic cameras\n\t\t\t\t\ttempViewport.width = width / camera.zoom;\n\t\t\t\t\ttempViewport.height = height / camera.zoom;\n\t\t\t\t\ttempViewport.factor = 1;\n\t\t\t\t} else {\n\t\t\t\t\t// For perspective cameras\n\t\t\t\t\tconst fov = (camera.fov * Math.PI) / 180; // convert vertical fov to radians\n\t\t\t\t\tconst h = 2 * Math.tan(fov / 2) * distance; // visible height\n\t\t\t\t\tconst w = h * aspect; // visible width\n\t\t\t\t\ttempViewport.width = w;\n\t\t\t\t\ttempViewport.height = h;\n\t\t\t\t\ttempViewport.factor = width / w;\n\t\t\t\t}\n\n\t\t\t\treturn tempViewport;\n\t\t\t},\n\t\t},\n\n\t\tsetEvents: (events: Partial<NgtEventManager<any>>) =>\n\t\t\tstore.update((state) => ({ events: { ...state.events, ...events } })),\n\t\tsetSize: (width: number, height: number, top?: number, left?: number) => {\n\t\t\tconst camera = store.snapshot.camera;\n\t\t\tconst size = { width, height, top: top ?? 0, left: left ?? 0 };\n\n\t\t\tstore.update((state) => ({\n\t\t\t\tsize,\n\t\t\t\tviewport: {\n\t\t\t\t\t...state.viewport,\n\t\t\t\t\t...state.viewport.getCurrentViewport(camera, defaultTarget, size),\n\t\t\t\t},\n\t\t\t}));\n\t\t},\n\t\tsetDpr: (dpr: NgtDpr) => {\n\t\t\tconst resolved = makeDpr(dpr, window);\n\t\t\tstore.update((state) => ({\n\t\t\t\tviewport: { ...state.viewport, dpr: resolved, initialDpr: state.viewport.initialDpr || resolved },\n\t\t\t}));\n\t\t},\n\t\tsetFrameloop: (frameloop?: NgtFrameloop) => {\n\t\t\tconst clock = store.snapshot.clock;\n\n\t\t\t// if frameloop === \"never\" clock.elapsedTime is updated using advance(timestamp)\n\t\t\tclock.stop();\n\t\t\tclock.elapsedTime = 0;\n\n\t\t\tif (frameloop !== 'never') {\n\t\t\t\tclock.start();\n\t\t\t\tclock.elapsedTime = 0;\n\t\t\t}\n\n\t\t\tstore.update(() => ({ frameloop }));\n\t\t},\n\t\tpreviousRoot: null,\n\t\tinternal: {\n\t\t\tactive: false,\n\t\t\tpriority: 0,\n\t\t\tframes: 0,\n\t\t\tlastEvent: new ElementRef(null),\n\t\t\tinteraction: [],\n\t\t\thovered: new Map(),\n\t\t\tcapturedMap: new Map(),\n\t\t\tinitialClick: [0, 0],\n\t\t\tinitialHits: [],\n\t\t\tsubscribers: [],\n\t\t\tsubscribe: (\n\t\t\t\tcallback: NgtBeforeRenderRecord['callback'],\n\t\t\t\tpriority = 0,\n\t\t\t\t_store: SignalState<NgtState> = store,\n\t\t\t) => {\n\t\t\t\tconst internal = _store.snapshot.internal;\n\t\t\t\t// If this subscription was given a priority, it takes rendering into its own hands\n\t\t\t\t// For that reason we switch off automatic rendering and increase the manual flag\n\t\t\t\t// As long as this flag is positive there can be no internal rendering at all\n\t\t\t\t// because there could be multiple render subscriptions\n\t\t\t\tinternal.priority = internal.priority + (priority > 0 ? 1 : 0);\n\t\t\t\tinternal.subscribers.push({ callback, priority, store: _store });\n\t\t\t\t// Register subscriber and sort layers from lowest to highest, meaning,\n\t\t\t\t// highest priority renders last (on top of the other frames)\n\t\t\t\tinternal.subscribers = internal.subscribers.sort((a, b) => (a.priority || 0) - (b.priority || 0));\n\n\t\t\t\treturn () => {\n\t\t\t\t\tconst internal = _store.snapshot.internal;\n\t\t\t\t\tif (internal?.subscribers) {\n\t\t\t\t\t\t// Decrease manual flag if this subscription had a priority\n\t\t\t\t\t\tinternal.priority = internal.priority - (priority > 0 ? 1 : 0);\n\t\t\t\t\t\t// Remove subscriber from list\n\t\t\t\t\t\tinternal.subscribers = internal.subscribers.filter((s) => s.callback !== callback);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t});\n\n\tObject.defineProperty(store, '__pointerMissed$', { get: () => pointerMissed$ });\n\n\tlet {\n\t\tsize: oldSize,\n\t\tviewport: { dpr: oldDpr },\n\t\tcamera: oldCamera,\n\t} = store.snapshot;\n\n\teffect(() => {\n\t\tconst [newCamera, newSize, newDpr, gl] = [store.camera(), store.size(), store.viewport.dpr(), store.gl()];\n\n\t\t// Resize camera and renderer on changes to size and pixel-ratio\n\t\tif (newSize !== oldSize || newDpr !== oldDpr) {\n\t\t\toldSize = newSize;\n\t\t\toldDpr = newDpr;\n\t\t\t// Update camera & renderer\n\t\t\tupdateCamera(newCamera, newSize);\n\t\t\tgl.setPixelRatio(newDpr);\n\n\t\t\tconst updateStyle = typeof HTMLCanvasElement !== 'undefined' && gl.domElement instanceof HTMLCanvasElement;\n\t\t\tgl.setSize(newSize.width, newSize.height, updateStyle);\n\t\t}\n\n\t\t// Update viewport once the camera changes\n\t\tif (newCamera !== oldCamera) {\n\t\t\toldCamera = newCamera;\n\t\t\tupdateCamera(newCamera, newSize);\n\t\t\t// Update viewport\n\t\t\tstore.update((state) => ({\n\t\t\t\tviewport: { ...state.viewport, ...state.viewport.getCurrentViewport(newCamera) },\n\t\t\t}));\n\t\t}\n\t});\n\n\treturn store;\n}\n\n/**\n * Injection token for the Angular Three store.\n *\n * Use this token to access the store directly via Angular's dependency injection system.\n * The store contains the complete state of the Three.js scene including renderer, camera, scene, and more.\n *\n * @example\n * ```typescript\n * const store = inject(NGT_STORE);\n * const camera = store.camera();\n * ```\n */\nexport const NGT_STORE = new InjectionToken<SignalState<NgtState>>('NgtStore Token');\n\n/**\n * Injects the Angular Three store into the current injection context.\n *\n * This is the primary way to access the store in components, directives, and services.\n * The store provides reactive signals for all Three.js state including the renderer,\n * camera, scene, raycaster, and more.\n *\n * @param options - Optional injection options (e.g., { optional: true, skipSelf: true })\n * @returns The Angular Three store as a SignalState, or null if optional and not found\n *\n * @example\n * ```typescript\n * // In a component or directive\n * const store = injectStore();\n *\n * // Access reactive state\n * const camera = store.camera();\n * const scene = store.scene();\n *\n * // Access snapshot (non-reactive)\n * const { gl, size } = store.snapshot;\n * ```\n */\nexport function injectStore(options: InjectOptions & { optional?: false }): SignalState<NgtState>;\nexport function injectStore(options: InjectOptions): SignalState<NgtState> | null;\nexport function injectStore(): SignalState<NgtState>;\nexport function injectStore(options?: InjectOptions) {\n\treturn inject(NGT_STORE, options as InjectOptions);\n}\n","import { ElementRef } from '@angular/core';\nimport { is } from './is';\n\n/**\n * Resolves a value that may be wrapped in an Angular ElementRef.\n *\n * If the value is an ElementRef, returns its nativeElement.\n * Otherwise, returns the value directly.\n *\n * @typeParam TObject - The type of the object\n * @param ref - An ElementRef or direct value\n * @returns The unwrapped value\n *\n * @example\n * ```typescript\n * // With ElementRef\n * const mesh = resolveRef(meshRef); // returns meshRef.nativeElement\n *\n * // With direct value\n * const mesh = resolveRef(myMesh); // returns myMesh\n * ```\n */\nexport function resolveRef<TObject>(ref: ElementRef<TObject | undefined> | TObject | undefined): TObject | undefined {\n\tif (is.ref(ref)) {\n\t\treturn ref.nativeElement;\n\t}\n\n\treturn ref;\n}\n","import { computed, Directive, ElementRef, input, linkedSignal } from '@angular/core';\nimport type * as THREE from 'three';\nimport {\n\tNGT_INTERNAL_ADD_COMMENT_FLAG,\n\tNGT_INTERNAL_SET_PARENT_COMMENT_FLAG,\n\tNGT_PARENT_FLAG,\n} from '../renderer/constants';\nimport { injectStore } from '../store';\nimport { NgtNullish } from '../types';\nimport { resolveRef } from '../utils/resolve-ref';\nimport { NgtCommonDirective } from './common';\n\n/**\n * Structural directive for specifying a custom parent for Three.js objects.\n *\n * By default, Three.js objects are parented to the nearest Object3D ancestor in the template.\n * The `NgtParent` directive allows you to override this behavior and specify a different parent.\n *\n * The parent can be specified as:\n * - A string (name of an object in the scene)\n * - A THREE.Object3D reference\n * - An ElementRef containing a THREE.Object3D\n * - A Signal of any of the above\n *\n * @example\n * ```html\n * <!-- Parent to a named object in the scene -->\n * <ngt-mesh *parent=\"'myGroup'\">\n * <ngt-box-geometry />\n * </ngt-mesh>\n *\n * <!-- Parent to a reference -->\n * <ngt-mesh *parent=\"myGroupRef\">\n * <ngt-box-geometry />\n * </ngt-mesh>\n * ```\n */\n@Directive({ selector: 'ng-template[parent]' })\nexport class NgtParent extends NgtCommonDirective<THREE.Object3D | null | undefined> {\n\tparent = input.required<\n\t\t| string\n\t\t| THREE.Object3D\n\t\t| ElementRef<THREE.Object3D>\n\t\t| (() => NgtNullish<ElementRef<THREE.Object3D> | THREE.Object3D | string>)\n\t>();\n\n\tprivate store = injectStore();\n\n\tprivate _parent = computed(() => {\n\t\tconst parent = this.parent();\n\t\tconst rawParent = typeof parent === 'function' ? parent() : parent;\n\t\tif (!rawParent) return null;\n\n\t\tconst scene = this.store.scene();\n\t\tif (typeof rawParent === 'string') {\n\t\t\treturn scene.getObjectByName(rawParent);\n\t\t}\n\n\t\treturn resolveRef(rawParent);\n\t});\n\n\tprotected linkedValue = linkedSignal(this._parent);\n\tprotected shouldSkipRender = computed(() => !this._parent());\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tconst commentNode = this.commentNode;\n\t\tcommentNode.data = NGT_PARENT_FLAG;\n\t\tcommentNode[NGT_PARENT_FLAG] = true;\n\n\t\tif (commentNode[NGT_INTERNAL_ADD_COMMENT_FLAG]) {\n\t\t\tcommentNode[NGT_INTERNAL_ADD_COMMENT_FLAG]('parent', this.injector);\n\t\t\tdelete commentNode[NGT_INTERNAL_ADD_COMMENT_FLAG];\n\t\t}\n\t}\n\n\tvalidate() {\n\t\treturn !this.injected && !!this.injectedValue;\n\t}\n\n\tprotected override beforeCreateView() {\n\t\tconst commentNode = this.commentNode;\n\t\tif (commentNode[NGT_INTERNAL_SET_PARENT_COMMENT_FLAG]) {\n\t\t\tcommentNode[NGT_INTERNAL_SET_PARENT_COMMENT_FLAG](this.injectedValue);\n\t\t}\n\t}\n}\n","import { booleanAttribute, Directive, effect, ElementRef, inject, input, signal, untracked } from '@angular/core';\nimport { Group, Mesh, Object3D } from 'three';\nimport { getInstanceState } from '../instance';\n\n/**\n * Directive for managing selection state of Three.js objects.\n *\n * This directive creates a selection context that child `NgtSelect` directives can use\n * to register themselves as selectable. The selection state is exposed as a readonly signal.\n *\n * @example\n * ```html\n * <ngt-group [selection]=\"true\">\n * <ngt-mesh [select]=\"isSelected()\">\n * <ngt-box-geometry />\n * </ngt-mesh>\n * </ngt-group>\n * ```\n */\n@Directive({ selector: '[selection]' })\nexport class NgtSelectionApi {\n\tenabled = input(true, { alias: 'selection', transform: booleanAttribute });\n\n\tprivate source = signal<Array<ElementRef<Object3D> | Object3D>>([]);\n\tselected = this.source.asReadonly();\n\n\tupdate(...args: Parameters<typeof this.source.update>) {\n\t\tif (!this.enabled()) return;\n\t\tthis.source.update(...args);\n\t}\n}\n\n/**\n * Directive for marking Three.js objects as selectable.\n *\n * When applied to a mesh or group, this directive registers the object with the parent\n * `NgtSelectionApi` when enabled. For groups, all child meshes are automatically registered.\n *\n * @example\n * ```html\n * <ngt-mesh [select]=\"true\">\n * <ngt-box-geometry />\n * </ngt-mesh>\n * ```\n */\n@Directive({ selector: 'ngt-group[select], ngt-mesh[select]' })\nexport class NgtSelect {\n\tenabled = input(false, { transform: booleanAttribute, alias: 'select' });\n\n\tconstructor() {\n\t\tconst elementRef = inject<ElementRef<Group | Mesh>>(ElementRef);\n\t\tconst selectionApi = inject(NgtSelectionApi);\n\n\t\teffect((onCleanup) => {\n\t\t\tconst selectionEnabled = selectionApi.enabled();\n\t\t\tif (!selectionEnabled) return;\n\n\t\t\tconst enabled = this.enabled();\n\t\t\tif (!enabled) return;\n\n\t\t\tconst host = elementRef.nativeElement;\n\t\t\tconst localState = getInstanceState(host);\n\t\t\tif (!localState) return;\n\n\t\t\t// ngt-mesh[select]\n\t\t\tif (host.type === 'Mesh') {\n\t\t\t\tselectionApi.update((prev) => [...prev, host]);\n\t\t\t\tonCleanup(() => selectionApi.update((prev) => prev.filter((el) => el !== host)));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [collection] = [untracked(selectionApi.selected), localState.objects()];\n\t\t\tlet changed = false;\n\t\t\tconst current: Object3D[] = [];\n\t\t\thost.traverse((child) => {\n\t\t\t\tchild.type === 'Mesh' && current.push(child);\n\t\t\t\tif (collection.indexOf(child) === -1) changed = true;\n\t\t\t});\n\n\t\t\tif (!changed) return;\n\n\t\t\tselectionApi.update((prev) => [...prev, ...current]);\n\t\t\tonCleanup(() => {\n\t\t\t\tselectionApi.update((prev) => prev.filter((el) => !current.includes(el as Object3D)));\n\t\t\t});\n\t\t});\n\t}\n}\n\n/**\n * Array containing NgtSelectionApi and NgtSelect directives for convenient importing.\n *\n * @example\n * ```typescript\n * @Component({\n * imports: [NgtSelection],\n * })\n * export class MyComponent {}\n * ```\n */\nexport const NgtSelection = [NgtSelectionApi, NgtSelect] as const;\n","import {\n\tAbstractType,\n\tDestroyRef,\n\tDirective,\n\tElementRef,\n\tinject,\n\tInjectionToken,\n\tProvider,\n\tProviderToken,\n\tType,\n} from '@angular/core';\nimport { NGT_DOM_PARENT_FLAG, NGT_HTML_FLAG } from './renderer/constants';\nimport { injectStore } from './store';\nimport { NgtAnyRecord } from './types';\n\nconst NGT_HTML_DOM_ELEMENT = new InjectionToken<'gl' | HTMLElement>('NGT_HTML_DOM_ELEMENT');\n\n/**\n * Provider function for configuring the DOM element for HTML components in Angular Three.\n *\n * This function creates a provider that specifies where HTML content should be rendered\n * relative to the Three.js canvas. By default, HTML content is appended to the canvas's parent element.\n *\n * @returns A provider for the HTML DOM element configuration\n *\n * @example\n * ```typescript\n * // Default: append to canvas parent\n * @Component({\n * providers: [provideHTMLDomElement()],\n * })\n *\n * // Custom element\n * @Component({\n * providers: [provideHTMLDomElement(() => document.getElementById('my-container')!)],\n * })\n * ```\n */\nexport function provideHTMLDomElement(): Provider;\nexport function provideHTMLDomElement(factory: () => HTMLElement): Provider;\nexport function provideHTMLDomElement<\n\tTDeps extends Array<ProviderToken<any>>,\n\tTValues extends {\n\t\t[K in keyof TDeps]: TDeps[K] extends Type<infer T> | AbstractType<infer T> | InjectionToken<infer T>\n\t\t\t? T\n\t\t\t: never;\n\t},\n>(deps: TDeps, factory: (...args: TValues) => HTMLElement): Provider;\nexport function provideHTMLDomElement(...args: any[]) {\n\tif (args.length === 0) {\n\t\treturn { provide: NGT_HTML_DOM_ELEMENT, useFactory: () => 'gl' };\n\t}\n\n\tif (args.length === 1) {\n\t\treturn { provide: NGT_HTML_DOM_ELEMENT, useFactory: args[0] };\n\t}\n\n\treturn { provide: NGT_HTML_DOM_ELEMENT, useFactory: args.pop(), deps: args };\n}\n\n/**\n * Abstract base directive for creating HTML components that render alongside the Three.js canvas.\n *\n * Extend this class to create components that render DOM elements positioned relative to the\n * Three.js scene. The DOM element will be appended to either the canvas's parent element\n * or a custom element specified via `provideHTMLDomElement`.\n *\n * @example\n * ```typescript\n * @Directive({ selector: '[myHtml]', providers: [provideHTMLDomElement()] })\n * export class MyHtmlDirective extends NgtHTML {\n * // Implementation\n * }\n * ```\n */\n@Directive()\nexport abstract class NgtHTML {\n\tstatic [NGT_HTML_FLAG] = true;\n\n\tprotected domElement = inject(NGT_HTML_DOM_ELEMENT, { self: true, optional: true });\n\n\tconstructor() {\n\t\tconst host = inject<ElementRef<HTMLElement>>(ElementRef);\n\t\tconst store = injectStore();\n\n\t\tif (this.domElement === 'gl') {\n\t\t\tObject.assign(host.nativeElement, {\n\t\t\t\t[NGT_DOM_PARENT_FLAG]: store.snapshot.gl.domElement.parentElement,\n\t\t\t});\n\t\t} else if (this.domElement) {\n\t\t\tObject.assign(host.nativeElement, { [NGT_DOM_PARENT_FLAG]: this.domElement });\n\t\t}\n\n\t\tinject(DestroyRef).onDestroy(() => {\n\t\t\t(host.nativeElement as NgtAnyRecord)[NGT_DOM_PARENT_FLAG] = null;\n\t\t\tdelete (host.nativeElement as NgtAnyRecord)[NGT_DOM_PARENT_FLAG];\n\t\t});\n\t}\n}\n","import { Injector, Signal, effect, signal } from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport * as THREE from 'three';\nimport type { NgtAnyRecord } from './types';\nimport { NgtObjectMap, makeObjectGraph } from './utils/make';\n\n/**\n * Type representing a GLTF-like object with a scene property.\n */\nexport type NgtGLTFLike = { scene: THREE.Object3D };\n\n/**\n * Interface for Three.js loaders that support async loading.\n *\n * @typeParam T - The type of data the loader returns\n */\nexport interface NgtLoader<T> extends THREE.Loader {\n\tload(\n\t\turl: string,\n\t\tonLoad?: (result: T) => void,\n\t\tonProgress?: (event: ProgressEvent) => void,\n\t\tonError?: (event: unknown) => void,\n\t): unknown;\n\tloadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<T>;\n}\n\n/**\n * Type representing a loader constructor.\n */\nexport type NgtLoaderProto<T> = new (...args: any) => NgtLoader<T extends unknown ? any : T>;\n\n/**\n * Utility type to extract the return type of a loader.\n */\nexport type NgtLoaderReturnType<T, L extends NgtLoaderProto<T>> = T extends unknown\n\t? Awaited<ReturnType<InstanceType<L>['loadAsync']>>\n\t: T;\n\n/**\n * Type for loader extension functions that configure the loader before use.\n */\nexport type NgtLoaderExtensions<T extends { prototype: NgtLoaderProto<any> }> = (loader: T['prototype']) => void;\n\n/**\n * Conditional type utility.\n */\nexport type NgtConditionalType<Child, Parent, Truthy, Falsy> = Child extends Parent ? Truthy : Falsy;\n\n/**\n * Branching return type utility.\n */\nexport type NgtBranchingReturn<T, Parent, Coerced> = NgtConditionalType<T, Parent, Coerced, T>;\n\n/**\n * Type representing the result of loading based on input type.\n * - String input returns a single result\n * - Array input returns an array of results\n * - Object input returns an object with the same keys and loaded values\n */\nexport type NgtLoaderResults<\n\tTInput extends string | string[] | Record<string, string>,\n\tTReturn,\n> = TInput extends string[] ? TReturn[] : TInput extends object ? { [key in keyof TInput]: TReturn } : TReturn;\n\nconst cached = new Map();\nconst memoizedLoaders = new WeakMap();\n\nfunction normalizeInputs(input: string | string[] | Record<string, string>) {\n\tlet urls: string[] = [];\n\tif (Array.isArray(input)) {\n\t\turls = input;\n\t} else if (typeof input === 'string') {\n\t\turls = [input];\n\t} else {\n\t\turls = Object.values(input);\n\t}\n\n\treturn urls.map((url) => (url.includes('undefined') || url.includes('null') || !url ? '' : url));\n}\n\nfunction load<\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n\tTReturn = NgtLoaderReturnType<TData, TLoaderConstructor>,\n>(\n\tloaderConstructorFactory: (inputs: string[]) => TLoaderConstructor,\n\tinputs: () => TUrl,\n\t{\n\t\textensions,\n\t\tonLoad,\n\t\tonProgress,\n\t}: {\n\t\textensions?: NgtLoaderExtensions<TLoaderConstructor>;\n\t\tonLoad?: (data: NoInfer<TReturn>) => void;\n\t\tonProgress?: (event: ProgressEvent) => void;\n\t} = {},\n) {\n\treturn (): Array<Promise<any>> => {\n\t\tconst urls = normalizeInputs(inputs());\n\n\t\tlet loader: THREE.Loader<TData> = memoizedLoaders.get(loaderConstructorFactory(urls));\n\t\tif (!loader) {\n\t\t\tloader = new (loaderConstructorFactory(urls))();\n\t\t\tmemoizedLoaders.set(loaderConstructorFactory(urls), loader);\n\t\t}\n\n\t\tif (extensions) extensions(loader);\n\n\t\treturn urls.map((url) => {\n\t\t\tif (url === '') return Promise.resolve(null);\n\n\t\t\tif (!cached.has(url)) {\n\t\t\t\tcached.set(\n\t\t\t\t\turl,\n\t\t\t\t\tnew Promise<TData>((resolve, reject) => {\n\t\t\t\t\t\tloader.load(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t(data) => {\n\t\t\t\t\t\t\t\tif ('scene' in (data as NgtAnyRecord)) {\n\t\t\t\t\t\t\t\t\tObject.assign(\n\t\t\t\t\t\t\t\t\t\tdata as NgtAnyRecord,\n\t\t\t\t\t\t\t\t\t\tmakeObjectGraph((data as NgtAnyRecord)['scene']),\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (onLoad) {\n\t\t\t\t\t\t\t\t\tonLoad(data as unknown as TReturn);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tresolve(data);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonProgress,\n\t\t\t\t\t\t\t(error) =>\n\t\t\t\t\t\t\t\treject(new Error(`[NGT] Could not load ${url}: ${(error as ErrorEvent)?.message}`)),\n\t\t\t\t\t\t);\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn cached.get(url)!;\n\t\t});\n\t};\n}\n\n/**\n * @deprecated Use loaderResource instead. Will be removed in v5.0.0\n * @since v4.0.0~\n */\nfunction _injectLoader<\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n\tTReturn = NgtLoaderReturnType<TData, TLoaderConstructor>,\n>(\n\tloaderConstructorFactory: (inputs: string[]) => TLoaderConstructor,\n\tinputs: () => TUrl,\n\t{\n\t\textensions,\n\t\tonProgress,\n\t\tonLoad,\n\t\tinjector,\n\t}: {\n\t\textensions?: NgtLoaderExtensions<TLoaderConstructor>;\n\t\tonProgress?: (event: ProgressEvent) => void;\n\t\tonLoad?: (data: NoInfer<TReturn>) => void;\n\t\tinjector?: Injector;\n\t} = {},\n): Signal<NgtLoaderResults<TUrl, NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>> | null> {\n\treturn assertInjector(_injectLoader, injector, () => {\n\t\tconst response = signal<NgtLoaderResults<\n\t\t\tTUrl,\n\t\t\tNgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>\n\t\t> | null>(null);\n\n\t\tconst cachedResultPromisesEffect = load(loaderConstructorFactory, inputs, {\n\t\t\textensions,\n\t\t\tonProgress,\n\t\t\tonLoad: onLoad as (data: unknown) => void,\n\t\t});\n\n\t\teffect(() => {\n\t\t\tconst originalUrls = inputs();\n\t\t\tconst cachedResultPromises = cachedResultPromisesEffect();\n\t\t\tPromise.all(cachedResultPromises).then((results) => {\n\t\t\t\tresponse.update(() => {\n\t\t\t\t\tif (Array.isArray(originalUrls)) return results;\n\t\t\t\t\tif (typeof originalUrls === 'string') return results[0];\n\t\t\t\t\tconst keys = Object.keys(originalUrls);\n\t\t\t\t\treturn keys.reduce(\n\t\t\t\t\t\t(result, key) => {\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\t(result as NgtAnyRecord)[key] = results[keys.indexOf(key)];\n\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as {\n\t\t\t\t\t\t\t[key in keyof TUrl]: NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>;\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\treturn response.asReadonly();\n\t});\n}\n\n_injectLoader.preload = <\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n>(\n\tloaderConstructorFactory: (inputs: string[]) => TLoaderConstructor,\n\tinputs: () => TUrl,\n\textensions?: NgtLoaderExtensions<TLoaderConstructor>,\n\tonLoad?: (data: NoInfer<TData>) => void,\n) => {\n\tconst effects = load(loaderConstructorFactory, inputs, { extensions, onLoad })();\n\tif (effects) {\n\t\tvoid Promise.all(effects);\n\t}\n};\n\n_injectLoader.destroy = () => {\n\tcached.clear();\n};\n\n_injectLoader.clear = (urls: string | string[]) => {\n\tconst urlToClear = Array.isArray(urls) ? urls : [urls];\n\turlToClear.forEach((url) => {\n\t\tcached.delete(url);\n\t});\n};\n\nexport type NgtInjectedLoader = typeof _injectLoader;\n\n/**\n * @deprecated Use loaderResource instead. Will be removed in v5.0.0\n * @since v4.0.0~\n */\nexport const injectLoader: NgtInjectedLoader = _injectLoader;\n","import { type Injector, resource, type ResourceRef } from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport * as THREE from 'three';\nimport type {\n\tNgtBranchingReturn,\n\tNgtGLTFLike,\n\tNgtLoaderExtensions,\n\tNgtLoaderProto,\n\tNgtLoaderResults,\n\tNgtLoaderReturnType,\n} from './loader';\nimport type { NgtAnyRecord } from './types';\nimport { makeObjectGraph, type NgtObjectMap } from './utils/make';\n\n/**\n * @fileoverview Asset loading utilities using Angular's resource API.\n *\n * This module provides the `loaderResource` function for loading Three.js assets\n * using Angular's resource API, which provides better integration with Angular's\n * change detection and signal-based reactivity.\n */\n\nfunction normalizeInputs(input: string | string[] | Record<string, string>) {\n\tlet urls: string[] = [];\n\tif (Array.isArray(input)) {\n\t\turls = input;\n\t} else if (typeof input === 'string') {\n\t\turls = [input];\n\t} else {\n\t\turls = Object.values(input);\n\t}\n\n\treturn urls.map((url) => (url.includes('undefined') || url.includes('null') || !url ? '' : url));\n}\n\nconst cached = new Map();\nconst memoizedLoaders = new WeakMap();\n\nfunction getLoaderResourceParams<\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n>(\n\tinput: { (): TUrl },\n\tloaderConstructorFactory: {\n\t\t(url: TUrl): TLoaderConstructor;\n\t},\n\textensions: NgtLoaderExtensions<TLoaderConstructor> | undefined,\n) {\n\tconst urls = input();\n\tconst LoaderConstructor = loaderConstructorFactory(urls);\n\tconst normalizedUrls = normalizeInputs(urls);\n\tlet loader: THREE.Loader<TData> = memoizedLoaders.get(LoaderConstructor);\n\tif (!loader) {\n\t\tloader = new LoaderConstructor();\n\t\tmemoizedLoaders.set(LoaderConstructor, loader);\n\t}\n\n\tif (extensions) extensions(loader);\n\n\treturn { urls, normalizedUrls, loader };\n}\n\nfunction getLoaderPromises<TData, TUrl extends string | string[] | Record<string, string>>(\n\tparams: { loader: THREE.Loader<TData>; normalizedUrls: string[]; urls: TUrl },\n\tonProgress?: { (event: ProgressEvent<EventTarget>): void },\n) {\n\treturn params.normalizedUrls.map((url) => {\n\t\tif (url === '') return Promise.resolve(null);\n\t\tconst cachedPromise = cached.get(url);\n\t\tif (cachedPromise) return cachedPromise;\n\n\t\tconst promise = new Promise<TData>((res, rej) => {\n\t\t\tparams.loader.load(\n\t\t\t\turl,\n\t\t\t\t(data) => {\n\t\t\t\t\tif ('scene' in (data as NgtAnyRecord)) {\n\t\t\t\t\t\tObject.assign(data as NgtAnyRecord, makeObjectGraph((data as NgtAnyRecord)['scene']));\n\t\t\t\t\t}\n\n\t\t\t\t\tres(data);\n\t\t\t\t},\n\t\t\t\tonProgress,\n\t\t\t\t(error) => rej(new Error(`[NGT] Could not load ${url}: ${(error as ErrorEvent)?.message}`)),\n\t\t\t);\n\t\t});\n\n\t\tcached.set(url, promise);\n\n\t\treturn promise;\n\t});\n}\n\n/**\n * Loads Three.js assets using Angular's resource API.\n *\n * This function provides a signal-based approach to loading Three.js assets like\n * GLTF models, textures, and other files. It leverages Angular's resource API\n * for better integration with Angular's reactivity system.\n *\n * Features:\n * - Automatic caching of loaded assets\n * - Support for single URLs, arrays, or object maps\n * - GLTF scene graph extraction\n * - Progress and completion callbacks\n *\n * @typeParam TData - The type of data returned by the loader\n * @typeParam TUrl - The type of URL input (string, string[], or Record<string, string>)\n * @typeParam TLoaderConstructor - The loader constructor type\n * @typeParam TReturn - The return type after loading\n *\n * @param loaderConstructorFactory - Factory function that returns the loader constructor\n * @param input - Signal containing the URL(s) to load\n * @param options - Optional configuration including extensions, callbacks, and injector\n * @returns A ResourceRef containing the loaded data\n *\n * @example\n * ```typescript\n * // Load a single GLTF model\n * const model = loaderResource(\n * () => GLTFLoader,\n * () => '/assets/model.gltf'\n * );\n *\n * // Access in template\n * @if (model.value(); as gltf) {\n * <ngt-primitive *args=\"[gltf.scene]\" />\n * }\n * ```\n */\nexport function loaderResource<\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n\tTReturn = NgtLoaderReturnType<TData, TLoaderConstructor>,\n>(\n\tloaderConstructorFactory: (url: TUrl) => TLoaderConstructor,\n\tinput: () => TUrl,\n\t{\n\t\textensions,\n\t\tonLoad,\n\t\tonProgress,\n\t\tinjector,\n\t}: {\n\t\textensions?: NgtLoaderExtensions<TLoaderConstructor>;\n\t\tonLoad?: (\n\t\t\tdata: NoInfer<NgtLoaderResults<TUrl, NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>>>,\n\t\t) => void;\n\t\tonProgress?: (event: ProgressEvent) => void;\n\t\tinjector?: Injector;\n\t} = {},\n): ResourceRef<\n\tNgtLoaderResults<TUrl, NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>> | undefined\n> {\n\treturn assertInjector(loaderResource, injector, () => {\n\t\treturn resource({\n\t\t\tparams: () => getLoaderResourceParams(input, loaderConstructorFactory, extensions),\n\t\t\tloader: async ({ params }) => {\n\t\t\t\t// TODO: use the abortSignal when THREE.Loader supports it\n\n\t\t\t\tconst loadedResults = await Promise.all(getLoaderPromises(params, onProgress));\n\n\t\t\t\tlet results: NgtLoaderResults<\n\t\t\t\t\tTUrl,\n\t\t\t\t\tNgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>\n\t\t\t\t>;\n\n\t\t\t\tif (Array.isArray(params.urls)) {\n\t\t\t\t\tresults = loadedResults as NgtLoaderResults<\n\t\t\t\t\t\tTUrl,\n\t\t\t\t\t\tNgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>\n\t\t\t\t\t>;\n\t\t\t\t} else if (typeof params.urls === 'string') {\n\t\t\t\t\tresults = loadedResults[0] as NgtLoaderResults<\n\t\t\t\t\t\tTUrl,\n\t\t\t\t\t\tNgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>\n\t\t\t\t\t>;\n\t\t\t\t} else {\n\t\t\t\t\tconst keys = Object.keys(params.urls);\n\t\t\t\t\tresults = keys.reduce(\n\t\t\t\t\t\t(result, key) => {\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\t(result as NgtAnyRecord)[key] = loadedResults[keys.indexOf(key)];\n\t\t\t\t\t\t\treturn result;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{} as {\n\t\t\t\t\t\t\t[key in keyof TUrl]: NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>;\n\t\t\t\t\t\t},\n\t\t\t\t\t) as NgtLoaderResults<TUrl, NgtBranchingReturn<TReturn, NgtGLTFLike, NgtGLTFLike & NgtObjectMap>>;\n\t\t\t\t}\n\n\t\t\t\tif (onLoad) onLoad(results);\n\n\t\t\t\treturn results;\n\t\t\t},\n\t\t});\n\t});\n}\n\nloaderResource.preload = <\n\tTData,\n\tTUrl extends string | string[] | Record<string, string>,\n\tTLoaderConstructor extends NgtLoaderProto<TData>,\n>(\n\tloaderConstructor: TLoaderConstructor,\n\tinputs: TUrl,\n\textensions?: NgtLoaderExtensions<TLoaderConstructor>,\n) => {\n\tconst params = getLoaderResourceParams(\n\t\t() => inputs,\n\t\t() => loaderConstructor,\n\t\textensions,\n\t);\n\tvoid Promise.all(getLoaderPromises(params));\n};\n\nloaderResource.destroy = () => {\n\tcached.clear();\n};\n\nloaderResource.clear = (urls: string | string[]) => {\n\tconst urlToClear = Array.isArray(urls) ? urls : [urls];\n\turlToClear.forEach((url) => {\n\t\tcached.delete(url);\n\t});\n};\n","import { DOCUMENT, inject, Pipe } from '@angular/core';\n\nconst RGBA_REGEX = /rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+),?\\s*(\\d*\\.?\\d+)?\\)/;\nconst DEFAULT_COLOR = 0x000000;\n\n/**\n * Pipe for converting CSS color strings to hexadecimal numbers.\n *\n * Supports various color formats:\n * - Hex strings: '#ff0000' -> 0xff0000\n * - RGB: 'rgb(255, 0, 0)' -> 0xff0000\n * - RGBA: 'rgba(255, 0, 0, 0.5)' -> hex with alpha\n * - CSS color names: 'red' -> 0xff0000\n *\n * Returns 0x000000 (black) for invalid or null values.\n *\n * @example\n * ```html\n * <ngt-mesh-basic-material [color]=\"'red' | hexify\" />\n * <ngt-mesh-basic-material [color]=\"'#ff0000' | hexify\" />\n * ```\n */\n@Pipe({ name: 'hexify', pure: true })\nexport class NgtHexify {\n\tprivate document = inject(DOCUMENT, { optional: true });\n\tprivate ctx?: CanvasRenderingContext2D | null;\n\tprivate cache: Record<string, number> = {};\n\n\t/**\n\t * transforms a:\n\t * - hex string to a hex number\n\t * - rgb string to a hex number\n\t * - rgba string to a hex number\n\t * - css color string to a hex number\n\t *\n\t * always default to black if failed\n\t * @param value\n\t */\n\ttransform(value: string): number {\n\t\tif (value == null) return DEFAULT_COLOR;\n\n\t\tif (value.startsWith('#')) {\n\t\t\tif (!this.cache[value]) {\n\t\t\t\tthis.cache[value] = this.hexStringToNumber(value);\n\t\t\t}\n\t\t\treturn this.cache[value];\n\t\t}\n\n\t\tif (!this.ctx) {\n\t\t\tthis.ctx = this.document?.createElement('canvas').getContext('2d');\n\t\t}\n\n\t\tif (!this.ctx) {\n\t\t\tconsole.warn('[NGT] hexify: canvas context is not available');\n\t\t\treturn DEFAULT_COLOR;\n\t\t}\n\n\t\tthis.ctx.fillStyle = value;\n\t\tconst computedValue = this.ctx.fillStyle;\n\n\t\tif (computedValue.startsWith('#')) {\n\t\t\tif (!this.cache[computedValue]) {\n\t\t\t\tthis.cache[computedValue] = this.hexStringToNumber(computedValue);\n\t\t\t}\n\t\t\treturn this.cache[computedValue];\n\t\t}\n\n\t\tif (!computedValue.startsWith('rgba')) {\n\t\t\tconsole.warn(`[NGT] hexify: invalid color format. Expected rgba or hex, receive: ${computedValue}`);\n\t\t\treturn DEFAULT_COLOR;\n\t\t}\n\n\t\tconst match = computedValue.match(RGBA_REGEX);\n\t\tif (!match) {\n\t\t\tconsole.warn(`[NGT] hexify: invalid color format. Expected rgba or hex, receive: ${computedValue}`);\n\t\t\treturn DEFAULT_COLOR;\n\t\t}\n\n\t\tconst r = parseInt(match[1], 10);\n\t\tconst g = parseInt(match[2], 10);\n\t\tconst b = parseInt(match[3], 10);\n\t\tconst a = match[4] ? parseFloat(match[4]) : 1.0;\n\n\t\tconst cacheKey = `${r}:${g}:${b}:${a}`;\n\n\t\t// check result from cache\n\t\tif (!this.cache[cacheKey]) {\n\t\t\t// Convert the components to hex strings\n\t\t\tconst hexR = this.componentToHex(r);\n\t\t\tconst hexG = this.componentToHex(g);\n\t\t\tconst hexB = this.componentToHex(b);\n\t\t\tconst hexA = this.componentToHex(Math.round(a * 255));\n\n\t\t\t// Combine the hex components into a single hex string\n\t\t\tconst hex = `#${hexR}${hexG}${hexB}${hexA}`;\n\t\t\tthis.cache[cacheKey] = this.hexStringToNumber(hex);\n\t\t}\n\n\t\treturn this.cache[cacheKey];\n\t}\n\n\tprivate hexStringToNumber(hexString: string): number {\n\t\treturn parseInt(hexString.replace('#', ''), 16);\n\t}\n\n\tprivate componentToHex(component: number): string {\n\t\tconst hex = component.toString(16);\n\t\treturn hex.length === 1 ? '0' + hex : hex;\n\t}\n}\n","import { computed, Signal, Type, ValueEqualityFn } from '@angular/core';\nimport * as THREE from 'three';\nimport type { NgtVector2, NgtVector3, NgtVector4 } from '../three-types';\nimport type { NgtAnyRecord } from '../types';\nimport { is } from './is';\n\n/**\n * @fileoverview Signal utilities for transforming and accessing object properties.\n *\n * This module provides computed signal utilities for working with object properties,\n * including `omit`, `pick`, `merge`, and vector conversion functions.\n */\n\ntype KeysOfType<TObject extends object, TType> = Exclude<\n\t{\n\t\t[K in keyof TObject]: TObject[K] extends TType | undefined | null ? K : never;\n\t}[keyof TObject],\n\tundefined\n>;\n\n/**\n * Creates a computed signal that omits specified keys from an object.\n *\n * @typeParam TObject - The type of the source object\n * @typeParam TKeys - The keys to omit\n * @param objFn - Function returning the source object\n * @param keysToOmit - Array of keys to omit\n * @param equal - Optional equality function for change detection\n * @returns A signal containing the object without the omitted keys\n *\n * @example\n * ```typescript\n * const state = signal({ a: 1, b: 2, c: 3 });\n * const withoutB = omit(() => state(), ['b']);\n * // withoutB() => { a: 1, c: 3 }\n * ```\n */\nexport function omit<TObject extends object, TKeys extends (keyof TObject)[]>(\n\tobjFn: () => TObject,\n\tkeysToOmit: TKeys,\n\tequal: ValueEqualityFn<NoInfer<Omit<TObject, TKeys[number]>>> = (a, b) =>\n\t\tis.equ(a, b, { objects: 'shallow', arrays: 'shallow' }),\n): Signal<Omit<TObject, TKeys[number]>> {\n\treturn computed(\n\t\t() => {\n\t\t\tconst obj = objFn();\n\t\t\tconst result = {} as NgtAnyRecord;\n\n\t\t\tfor (const key of Object.keys(obj)) {\n\t\t\t\tif (keysToOmit.includes(key as keyof TObject)) continue;\n\t\t\t\tObject.assign(result, { [key]: obj[key as keyof TObject] });\n\t\t\t}\n\n\t\t\treturn result as Omit<TObject, TKeys[number]>;\n\t\t},\n\t\t{ equal },\n\t);\n}\n\n/**\n * Creates a computed signal that picks specified keys from an object.\n *\n * Can pick a single key (returning the value) or multiple keys (returning a partial object).\n *\n * @example\n * ```typescript\n * const state = signal({ a: 1, b: 2, c: 3 });\n *\n * // Pick single key\n * const a = pick(() => state(), 'a');\n * // a() => 1\n *\n * // Pick multiple keys\n * const ab = pick(() => state(), ['a', 'b']);\n * // ab() => { a: 1, b: 2 }\n * ```\n */\nexport function pick<TObject extends object, TKey extends keyof TObject>(\n\tobjFn: () => TObject,\n\tkey: TKey,\n\tequal?: ValueEqualityFn<NoInfer<TObject[TKey]>>,\n): Signal<TObject[TKey]>;\nexport function pick<TObject extends object, TKeys extends (keyof TObject)[]>(\n\tobjFn: () => TObject,\n\tkeys: TKeys,\n\tequal?: ValueEqualityFn<NoInfer<Pick<TObject, TKeys[number]>>>,\n): Signal<Pick<TObject, TKeys[number]>>;\nexport function pick(objFn: () => NgtAnyRecord, keyOrKeys: string | string[], equal?: ValueEqualityFn<any>) {\n\tif (Array.isArray(keyOrKeys)) {\n\t\tif (!equal) {\n\t\t\tequal = (a, b) => is.equ(a, b, { objects: 'shallow', arrays: 'shallow' });\n\t\t}\n\n\t\treturn computed(\n\t\t\t() => {\n\t\t\t\tconst obj = objFn();\n\t\t\t\tconst result = {} as NgtAnyRecord;\n\t\t\t\tfor (const key of keyOrKeys) {\n\t\t\t\t\tif (!(key in obj)) continue;\n\t\t\t\t\tObject.assign(result, { [key]: obj[key] });\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\t{ equal },\n\t\t);\n\t}\n\n\treturn computed(() => objFn()[keyOrKeys], { equal });\n}\n\n/**\n * Creates a computed signal that merges an object with static values.\n *\n * @param objFn - Function returning the source object\n * @param toMerge - Static values to merge\n * @param mode - 'override' (default) puts toMerge values on top, 'backfill' puts them underneath\n * @param equal - Optional equality function\n * @returns A signal containing the merged object\n *\n * @example\n * ```typescript\n * const options = signal({ size: 10 });\n * const withDefaults = merge(() => options(), { color: 'red' }, 'backfill');\n * // withDefaults() => { color: 'red', size: 10 }\n * ```\n */\nexport function merge<TObject extends object>(\n\tobjFn: () => TObject,\n\ttoMerge: Partial<TObject>,\n\tmode: 'override' | 'backfill' = 'override',\n\tequal: ValueEqualityFn<NoInfer<TObject>> = (a, b) => is.equ(a, b, { objects: 'shallow', arrays: 'shallow' }),\n) {\n\tif (mode === 'override') return computed(() => ({ ...objFn(), ...toMerge }), { equal });\n\treturn computed(() => ({ ...toMerge, ...objFn() }), { equal });\n}\n\ntype NgtVectorComputed<\n\tTVector extends THREE.Vector2 | THREE.Vector3 | THREE.Vector4,\n\tTNgtVector = TVector extends THREE.Vector2 ? NgtVector2 : TVector extends THREE.Vector3 ? NgtVector3 : NgtVector4,\n> = {\n\t(input: Signal<TNgtVector>): Signal<TVector>;\n\t(input: Signal<TNgtVector>, keepUndefined: true): Signal<TVector | undefined>;\n\t<TObject extends object>(options: Signal<TObject>, key: KeysOfType<TObject, TNgtVector>): Signal<TVector>;\n\t<TObject extends object>(\n\t\toptions: Signal<TObject>,\n\t\tkey: KeysOfType<TObject, TNgtVector>,\n\t\tkeepUndefined: true,\n\t): Signal<TVector | undefined>;\n};\n\nfunction createVectorComputed<TVector extends THREE.Vector2 | THREE.Vector3 | THREE.Vector4>(\n\tvectorCtor: Type<TVector>,\n) {\n\ttype TNgtVector = TVector extends THREE.Vector2\n\t\t? NgtVector2\n\t\t: TVector extends THREE.Vector3\n\t\t\t? NgtVector3\n\t\t\t: NgtVector4;\n\treturn ((\n\t\tinputOrOptions: Signal<NgtAnyRecord> | Signal<TNgtVector>,\n\t\tkeyOrKeepUndefined?: string | true,\n\t\tkeepUndefined?: boolean,\n\t) => {\n\t\tif (typeof keyOrKeepUndefined === 'undefined' || typeof keyOrKeepUndefined === 'boolean') {\n\t\t\tkeepUndefined = !!keyOrKeepUndefined;\n\t\t\tconst input = inputOrOptions as Signal<TNgtVector>;\n\t\t\treturn computed(\n\t\t\t\t() => {\n\t\t\t\t\tconst value = input();\n\t\t\t\t\tif (keepUndefined && value == undefined) return undefined;\n\t\t\t\t\tif (typeof value === 'number') return new vectorCtor().setScalar(value);\n\t\t\t\t\telse if (Array.isArray(value)) return new vectorCtor(...value);\n\t\t\t\t\telse if (value) return value as unknown as TVector;\n\t\t\t\t\telse return new vectorCtor();\n\t\t\t\t},\n\t\t\t\t{ equal: (a, b) => !!a && !!b && a.equals(b as any) },\n\t\t\t);\n\t\t}\n\n\t\tconst options = inputOrOptions as Signal<NgtAnyRecord>;\n\t\tconst key = keyOrKeepUndefined as string;\n\n\t\treturn computed(\n\t\t\t() => {\n\t\t\t\tconst value = options()[key] as TNgtVector;\n\t\t\t\tif (keepUndefined && value == undefined) return undefined;\n\t\t\t\tif (typeof value === 'number') return new vectorCtor().setScalar(value);\n\t\t\t\telse if (Array.isArray(value)) return new vectorCtor(...value);\n\t\t\t\telse if (value) return value as unknown as TVector;\n\t\t\t\telse return new vectorCtor();\n\t\t\t},\n\t\t\t{ equal: (a, b) => !!a && !!b && a.equals(b as any) },\n\t\t);\n\t}) as NgtVectorComputed<TVector, TNgtVector>;\n}\n\n/**\n * Creates a computed Vector2 signal from various input formats.\n *\n * Accepts: number (scalar), [x, y] array, or Vector2 instance.\n *\n * @example\n * ```typescript\n * const pos = vector2(input);\n * // or from options object\n * const pos = vector2(options, 'position');\n * ```\n */\nexport const vector2 = createVectorComputed(THREE.Vector2);\n\n/**\n * Creates a computed Vector3 signal from various input formats.\n *\n * Accepts: number (scalar), [x, y, z] array, or Vector3 instance.\n *\n * @example\n * ```typescript\n * const pos = vector3(input);\n * // or from options object\n * const pos = vector3(options, 'position');\n * ```\n */\nexport const vector3 = createVectorComputed(THREE.Vector3);\n\n/**\n * Creates a computed Vector4 signal from various input formats.\n *\n * Accepts: number (scalar), [x, y, z, w] array, or Vector4 instance.\n *\n * @example\n * ```typescript\n * const pos = vector4(input);\n * // or from options object\n * const pos = vector4(options, 'position');\n * ```\n */\nexport const vector4 = createVectorComputed(THREE.Vector4);\n","import {\n\tChangeDetectionStrategy,\n\tComponent,\n\tcontentChild,\n\tCUSTOM_ELEMENTS_SCHEMA,\n\tDirective,\n\teffect,\n\tElementRef,\n\tEmbeddedViewRef,\n\tinject,\n\tInjector,\n\tinput,\n\tnumberAttribute,\n\tsignal,\n\tSkipSelf,\n\tTemplateRef,\n\tuntracked,\n\tViewContainerRef,\n} from '@angular/core';\nimport * as THREE from 'three';\nimport { Group } from 'three';\nimport { getInstanceState, prepare } from './instance';\nimport { extend } from './renderer/catalogue';\nimport { NGT_DOM_PARENT_FLAG, NGT_PORTAL_CONTENT_FLAG } from './renderer/constants';\nimport { injectStore, NGT_STORE } from './store';\nimport type { NgtComputeFunction, NgtEventManager, NgtSize, NgtState, NgtViewport } from './types';\nimport { is } from './utils/is';\nimport { makeId } from './utils/make';\nimport { omit, pick } from './utils/parameters';\nimport { signalState, SignalState } from './utils/signal-state';\nimport { updateCamera } from './utils/update';\n\n/**\n * Directive to enable automatic rendering for portal content.\n *\n * When applied to an `ngt-portal`, this directive sets up automatic rendering\n * of the portal's scene on each frame. The render priority can be configured\n * to control the order of rendering relative to other subscriptions.\n *\n * @example\n * ```html\n * <ngt-portal [container]=\"container\" [autoRender]=\"2\">\n * <ng-template portalContent>\n * <ngt-mesh />\n * </ng-template>\n * </ngt-portal>\n * ```\n */\n@Directive({ selector: 'ngt-portal[autoRender]' })\nexport class NgtPortalAutoRender {\n\tprivate portalStore = injectStore({ host: true });\n\tprivate parentStore = injectStore({ skipSelf: true });\n\tprivate portal = inject(NgtPortalImpl, { host: true });\n\n\trenderPriority = input(1, { alias: 'autoRender', transform: (value) => numberAttribute(value, 1) });\n\n\tconstructor() {\n\t\t// TODO: (chau) investigate if this is still needed\n\t\t// effect(() => {\n\t\t// this.portalStore.update((state) => ({ events: { ...state.events, priority: this.renderPriority() + 1 } }));\n\t\t// });\n\n\t\teffect((onCleanup) => {\n\t\t\tconst portalRendered = this.portal.portalRendered();\n\t\t\tif (!portalRendered) return;\n\n\t\t\t// track state\n\t\t\tconst [renderPriority, { internal }] = [this.renderPriority(), this.portalStore()];\n\n\t\t\tlet oldClean: boolean;\n\n\t\t\tconst cleanup = internal.subscribe(\n\t\t\t\t({ gl, scene, camera }) => {\n\t\t\t\t\tconst [parentScene, parentCamera] = [\n\t\t\t\t\t\tthis.parentStore.snapshot.scene,\n\t\t\t\t\t\tthis.parentStore.snapshot.camera,\n\t\t\t\t\t];\n\t\t\t\t\toldClean = gl.autoClear;\n\t\t\t\t\tif (renderPriority === 1) {\n\t\t\t\t\t\t// clear scene and render with default\n\t\t\t\t\t\tgl.autoClear = true;\n\t\t\t\t\t\tgl.render(parentScene, parentCamera);\n\t\t\t\t\t}\n\n\t\t\t\t\t// disable cleaning\n\t\t\t\t\tgl.autoClear = false;\n\t\t\t\t\tgl.clearDepth();\n\t\t\t\t\tgl.render(scene, camera);\n\t\t\t\t\t// restore\n\t\t\t\t\tgl.autoClear = oldClean;\n\t\t\t\t},\n\t\t\t\trenderPriority,\n\t\t\t\tthis.portalStore,\n\t\t\t);\n\n\t\t\tonCleanup(() => cleanup());\n\t\t});\n\t}\n}\n\n/**\n * Structural directive for defining portal content.\n *\n * This directive marks the template content that will be rendered inside the portal.\n * It must be used inside an `ngt-portal` component.\n *\n * @example\n * ```html\n * <ngt-portal [container]=\"myGroup\">\n * <ng-template portalContent let-injector=\"injector\">\n * <ngt-mesh />\n * </ng-template>\n * </ngt-portal>\n * ```\n */\n@Directive({ selector: 'ng-template[portalContent]' })\nexport class NgtPortalContent {\n\tstatic ngTemplateContextGuard(_: NgtPortalContent, ctx: unknown): ctx is { injector: Injector } {\n\t\treturn true;\n\t}\n\n\tconstructor() {\n\t\tconst host = inject<ElementRef<HTMLElement>>(ElementRef, { skipSelf: true });\n\t\tconst { element } = inject(ViewContainerRef);\n\t\tconst commentNode = element.nativeElement;\n\t\tconst store = injectStore();\n\n\t\tcommentNode.data = NGT_PORTAL_CONTENT_FLAG;\n\t\tcommentNode[NGT_PORTAL_CONTENT_FLAG] = store;\n\t\tcommentNode[NGT_DOM_PARENT_FLAG] = host.nativeElement;\n\t}\n}\n\n/**\n * State interface for portal configuration.\n *\n * Extends the base NgtState with customizable event handling configuration.\n */\nexport interface NgtPortalState extends Omit<NgtState, 'events'> {\n\t/** Portal-specific event configuration */\n\tevents: {\n\t\t/** Whether events are enabled for this portal */\n\t\tenabled?: boolean;\n\t\t/** Event handling priority */\n\t\tpriority?: number;\n\t\t/** Custom compute function for raycasting */\n\t\tcompute?: NgtComputeFunction;\n\t\t/** Connected event target */\n\t\tconnected?: any;\n\t};\n}\n\nfunction mergeState(\n\tpreviousRoot: SignalState<NgtState>,\n\tstore: SignalState<NgtState>,\n\tcontainer: THREE.Object3D,\n\tpointer: THREE.Vector2,\n\traycaster: THREE.Raycaster,\n\tevents?: NgtPortalState['events'],\n\tsize?: NgtSize,\n) {\n\t// we never want to spread the id\n\tconst { id: _, ...previousState } = previousRoot.snapshot;\n\tconst state = store.snapshot;\n\n\tlet viewport: Omit<NgtViewport, 'dpr' | 'initialDpr'> | undefined = undefined;\n\n\tif (state.camera && size) {\n\t\tconst camera = state.camera;\n\t\t// calculate the override viewport, if present\n\t\tviewport = previousState.viewport.getCurrentViewport(camera, new THREE.Vector3(), size);\n\t\t// update the portal camera, if it differs from the previous layer\n\t\tif (camera !== previousState.camera) updateCamera(camera, size);\n\t}\n\n\treturn {\n\t\t// the intersect consists of the previous root state\n\t\t...previousState,\n\t\t...state,\n\t\t// portals have their own scene, which forms the root, a raycaster and a pointer\n\t\tscene: container as THREE.Scene,\n\t\tpointer,\n\t\traycaster,\n\t\t// their previous root is the layer before it\n\t\tpreviousRoot,\n\t\tevents: { ...previousState.events, ...state.events, ...events },\n\t\tsize: { ...previousState.size, ...size },\n\t\tviewport: { ...previousState.viewport, ...viewport },\n\t\t// layers are allowed to override events\n\t\tsetEvents: (events: Partial<NgtEventManager<any>>) =>\n\t\t\tstore.update((state) => ({ ...state, events: { ...state.events, ...events } })),\n\t} as NgtState;\n}\n\n/**\n * Component for creating a portal to render Three.js content into a different container.\n *\n * Portals allow you to render content into a separate Three.js object while maintaining\n * the React-like declarative structure. Each portal has its own store with separate\n * raycaster and pointer state.\n *\n * @example\n * ```html\n * <ngt-group #portalContainer />\n *\n * <ngt-portal [container]=\"portalContainer\">\n * <ng-template portalContent>\n * <ngt-mesh>\n * <ngt-box-geometry />\n * </ngt-mesh>\n * </ng-template>\n * </ngt-portal>\n * ```\n */\n@Component({\n\tselector: 'ngt-portal',\n\ttemplate: `\n\t\t@if (portalRendered()) {\n\t\t\t<!-- Without an element that receives pointer events state.pointer will always be 0/0 -->\n\t\t\t<ngt-group (pointerover)=\"(undefined)\" attach=\"none\" />\n\t\t}\n\t`,\n\tschemas: [CUSTOM_ELEMENTS_SCHEMA],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NGT_STORE,\n\t\t\tuseFactory: (previousStore: SignalState<NgtState>) => {\n\t\t\t\tconst pointer = new THREE.Vector2();\n\t\t\t\tconst raycaster = new THREE.Raycaster();\n\n\t\t\t\tconst { id: _skipId, ...previousState } = previousStore.snapshot;\n\n\t\t\t\tconst store = signalState<NgtState>({\n\t\t\t\t\tid: makeId(),\n\t\t\t\t\t...previousState,\n\t\t\t\t\tscene: null as unknown as THREE.Scene,\n\t\t\t\t\tpreviousRoot: previousStore,\n\t\t\t\t\tpointer,\n\t\t\t\t\traycaster,\n\t\t\t\t});\n\t\t\t\tstore.update(mergeState(previousStore, store, null!, pointer, raycaster));\n\t\t\t\treturn store;\n\t\t\t},\n\t\t\tdeps: [[new SkipSelf(), NGT_STORE]],\n\t\t},\n\t],\n})\nexport class NgtPortalImpl {\n\tcontainer = input.required<THREE.Object3D>();\n\tstate = input<Partial<NgtPortalState>>({});\n\n\tprivate contentRef = contentChild.required(NgtPortalContent, { read: TemplateRef });\n\tprivate anchorRef = contentChild.required(NgtPortalContent, { read: ViewContainerRef });\n\n\tprivate previousStore = injectStore({ skipSelf: true });\n\tprivate portalStore = injectStore();\n\tprivate injector = inject(Injector);\n\n\tprivate size = pick(this.state, 'size');\n\tprivate events = pick(this.state, 'events');\n\tprivate restState = omit(this.state, ['size', 'events']);\n\n\tprivate portalContentRendered = signal(false);\n\tportalRendered = this.portalContentRendered.asReadonly();\n\n\tprivate portalViewRef?: EmbeddedViewRef<unknown>;\n\n\tconstructor() {\n\t\textend({ Group });\n\n\t\teffect(() => {\n\t\t\tlet [container, anchor, content] = [\n\t\t\t\tthis.container(),\n\t\t\t\tthis.anchorRef(),\n\t\t\t\tthis.contentRef(),\n\t\t\t\tthis.previousStore(),\n\t\t\t];\n\n\t\t\tconst [size, events, restState] = [untracked(this.size), untracked(this.events), untracked(this.restState)];\n\n\t\t\tif (!is.instance(container)) {\n\t\t\t\tcontainer = prepare(container, 'ngt-portal', { store: this.portalStore });\n\t\t\t}\n\n\t\t\tconst instanceState = getInstanceState(container);\n\t\t\tif (instanceState && instanceState.store !== this.portalStore) {\n\t\t\t\tinstanceState.store = this.portalStore;\n\t\t\t}\n\n\t\t\tthis.portalStore.update(\n\t\t\t\trestState,\n\t\t\t\tmergeState(\n\t\t\t\t\tthis.previousStore,\n\t\t\t\t\tthis.portalStore,\n\t\t\t\t\tcontainer,\n\t\t\t\t\tthis.portalStore.snapshot.pointer,\n\t\t\t\t\tthis.portalStore.snapshot.raycaster,\n\t\t\t\t\tevents,\n\t\t\t\t\tsize,\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tif (this.portalViewRef) {\n\t\t\t\tthis.portalViewRef.detectChanges();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst portalViewContext = { injector: this.injector };\n\t\t\tthis.portalViewRef = anchor.createEmbeddedView(content, portalViewContext, portalViewContext);\n\t\t\tthis.portalViewRef.detectChanges();\n\t\t\tthis.portalContentRendered.set(true);\n\t\t});\n\t}\n}\n\n/**\n * Array containing NgtPortalImpl and NgtPortalContent for convenient importing.\n *\n * @example\n * ```typescript\n * @Component({\n * imports: [NgtPortal],\n * })\n * export class MyComponent {}\n * ```\n */\nexport const NgtPortal = [NgtPortalImpl, NgtPortalContent] as const;\n","import { Injector } from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport * as THREE from 'three';\nimport { prepare } from './instance';\nimport { injectLoop, roots } from './loop';\nimport { injectStore } from './store';\nimport type { NgtCanvasElement, NgtCanvasOptions, NgtDisposable, NgtEquConfig, NgtSize, NgtState } from './types';\nimport { applyProps } from './utils/apply-props';\nimport { is } from './utils/is';\nimport { makeCameraInstance, makeDpr, makeRendererInstance } from './utils/make';\nimport { checkNeedsUpdate } from './utils/update';\n\nconst shallowLoose = { objects: 'shallow', strict: false } as NgtEquConfig;\n\n/**\n * Creates a canvas root initializer function.\n *\n * This function sets up the Three.js rendering context including the WebGL renderer,\n * camera, scene, and all related state. It returns a configurator object that can\n * be used to update canvas options and destroy the root.\n *\n * @param injector - Optional injector for dependency injection\n * @returns A function that takes a canvas element and returns a configurator\n *\n * @example\n * ```typescript\n * const initRoot = canvasRootInitializer();\n * const configurator = initRoot(canvasElement);\n * configurator.configure({ shadows: true, dpr: [1, 2] });\n * ```\n */\nexport function canvasRootInitializer(injector?: Injector) {\n\treturn assertInjector(canvasRootInitializer, injector, () => {\n\t\tconst injectedStore = injectStore();\n\t\tconst loop = injectLoop();\n\n\t\treturn (canvas: NgtCanvasElement) => {\n\t\t\tconst exist = roots.has(canvas);\n\t\t\tlet store = roots.get(canvas);\n\n\t\t\tif (store) {\n\t\t\t\tconsole.warn('[NGT] Same canvas root is being created twice');\n\t\t\t}\n\n\t\t\tstore ||= injectedStore;\n\n\t\t\tif (!store) {\n\t\t\t\tthrow new Error('[NGT] No store initialized');\n\t\t\t}\n\n\t\t\tif (!exist) {\n\t\t\t\troots.set(canvas, store);\n\t\t\t}\n\n\t\t\tlet isConfigured = false;\n\t\t\tlet lastCamera: NgtCanvasOptions['camera'];\n\n\t\t\treturn {\n\t\t\t\tisConfigured,\n\t\t\t\tdestroy: (timeout = 500) => {\n\t\t\t\t\tconst root = roots.get(canvas);\n\t\t\t\t\tif (root) {\n\t\t\t\t\t\troot.update((state) => ({ internal: { ...state.internal, active: false } }));\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst state = root.snapshot;\n\t\t\t\t\t\t\t\tstate.events.disconnect?.();\n\n\t\t\t\t\t\t\t\tstate.gl?.renderLists?.dispose?.();\n\t\t\t\t\t\t\t\tstate.gl?.dispose?.();\n\t\t\t\t\t\t\t\tstate.gl?.forceContextLoss?.();\n\t\t\t\t\t\t\t\tif (state.gl?.xr) state.xr.disconnect();\n\t\t\t\t\t\t\t\tdispose(state.scene);\n\t\t\t\t\t\t\t\troots.delete(canvas);\n\t\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t\tconsole.error('[NGT] Unexpected error while destroying Canvas Root', e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, timeout);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tconfigure: (inputs: NgtCanvasOptions) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tshadows = false,\n\t\t\t\t\t\tlinear = false,\n\t\t\t\t\t\tflat = false,\n\t\t\t\t\t\tlegacy = false,\n\t\t\t\t\t\torthographic = false,\n\t\t\t\t\t\tframeloop = 'always',\n\t\t\t\t\t\tdpr = [1, 2],\n\t\t\t\t\t\tgl: glOptions,\n\t\t\t\t\t\tsize: sizeOptions,\n\t\t\t\t\t\tcamera: cameraOptions,\n\t\t\t\t\t\traycaster: raycasterOptions,\n\t\t\t\t\t\tscene: sceneOptions,\n\t\t\t\t\t\tevents,\n\t\t\t\t\t\tlookAt,\n\t\t\t\t\t\tperformance,\n\t\t\t\t\t} = inputs;\n\n\t\t\t\t\tconst state = store.snapshot;\n\t\t\t\t\tconst stateToUpdate: Partial<NgtState> = {};\n\n\t\t\t\t\t// setup renderer\n\t\t\t\t\tlet gl = state.gl;\n\t\t\t\t\tif (!state.gl) stateToUpdate.gl = gl = makeRendererInstance(glOptions, canvas);\n\n\t\t\t\t\t// setup raycaster\n\t\t\t\t\tlet raycaster = state.raycaster;\n\t\t\t\t\tif (!raycaster) stateToUpdate.raycaster = raycaster = new THREE.Raycaster();\n\n\t\t\t\t\t// set raycaster options\n\t\t\t\t\tconst { params, ...options } = raycasterOptions || {};\n\t\t\t\t\tif (!is.equ(options, raycaster, shallowLoose)) applyProps(raycaster, options);\n\t\t\t\t\tif (!is.equ(params, raycaster.params, shallowLoose)) {\n\t\t\t\t\t\tapplyProps(raycaster, { params: { ...raycaster.params, ...(params || {}) } });\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create default camera, don't overwrite any user-set state\n\t\t\t\t\tif (\n\t\t\t\t\t\t!state.camera ||\n\t\t\t\t\t\t(state.camera === lastCamera && !is.equ(lastCamera, cameraOptions, shallowLoose))\n\t\t\t\t\t) {\n\t\t\t\t\t\tlastCamera = cameraOptions;\n\t\t\t\t\t\tconst isCamera = is.three<THREE.Camera>(cameraOptions, 'isCamera');\n\t\t\t\t\t\tlet camera = isCamera\n\t\t\t\t\t\t\t? cameraOptions\n\t\t\t\t\t\t\t: makeCameraInstance(orthographic, sizeOptions ?? state.size);\n\n\t\t\t\t\t\tif (!isCamera) {\n\t\t\t\t\t\t\tcamera.position.z = 5;\n\t\t\t\t\t\t\tif (cameraOptions) {\n\t\t\t\t\t\t\t\tapplyProps(camera, cameraOptions);\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t'aspect' in cameraOptions ||\n\t\t\t\t\t\t\t\t\t'left' in cameraOptions ||\n\t\t\t\t\t\t\t\t\t'right' in cameraOptions ||\n\t\t\t\t\t\t\t\t\t'top' in cameraOptions ||\n\t\t\t\t\t\t\t\t\t'bottom' in cameraOptions\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tObject.assign(camera, { manual: true });\n\t\t\t\t\t\t\t\t\tcamera?.updateProjectionMatrix();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// always look at center or passed-in lookAt by default\n\t\t\t\t\t\t\tif (!state.camera && !cameraOptions?.rotation && !cameraOptions?.quaternion) {\n\t\t\t\t\t\t\t\tif (Array.isArray(lookAt)) camera.lookAt(lookAt[0], lookAt[1], lookAt[2]);\n\t\t\t\t\t\t\t\telse if (typeof lookAt === 'number') camera.lookAt(lookAt, lookAt, lookAt);\n\t\t\t\t\t\t\t\telse if (lookAt?.isVector3) camera.lookAt(lookAt);\n\t\t\t\t\t\t\t\telse camera.lookAt(0, 0, 0);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// update projection matrix after applyprops\n\t\t\t\t\t\t\tcamera.updateProjectionMatrix?.();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!is.instance(camera)) camera = prepare(camera, '', { store });\n\n\t\t\t\t\t\tstateToUpdate.camera = camera;\n\n\t\t\t\t\t\t// Configure raycaster\n\t\t\t\t\t\t// https://github.com/pmndrs/react-xr/issues/300\n\t\t\t\t\t\traycaster.camera = camera;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set up scene (one time only!)\n\t\t\t\t\tif (!state.scene) {\n\t\t\t\t\t\tlet scene: THREE.Scene;\n\n\t\t\t\t\t\tif (is.three<THREE.Scene>(sceneOptions, 'isScene')) {\n\t\t\t\t\t\t\tscene = sceneOptions;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tscene = new THREE.Scene();\n\t\t\t\t\t\t\tif (sceneOptions) applyProps(scene, sceneOptions);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tapplyProps(scene, {\n\t\t\t\t\t\t\tname: '__ngt_root_scene__',\n\t\t\t\t\t\t\tsetAttribute: (name: string, value: string) => {\n\t\t\t\t\t\t\t\tif (canvas instanceof HTMLCanvasElement) {\n\t\t\t\t\t\t\t\t\tif (canvas.parentElement) {\n\t\t\t\t\t\t\t\t\t\tcanvas.parentElement.setAttribute(name, value);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tcanvas.setAttribute(name, value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tstateToUpdate.scene = prepare(scene, 'ngt-scene', { store });\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set up XR (one time only!)\n\t\t\t\t\tif (!state.xr) {\n\t\t\t\t\t\t// Handle frame behavior in WebXR\n\t\t\t\t\t\tconst handleXRFrame: XRFrameRequestCallback = (timestamp: number, frame?: XRFrame) => {\n\t\t\t\t\t\t\tconst state = store.snapshot;\n\t\t\t\t\t\t\tif (state.frameloop === 'never') return;\n\t\t\t\t\t\t\tloop.advance(timestamp, true, store, frame);\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Toggle render switching on session\n\t\t\t\t\t\tconst handleSessionChange = () => {\n\t\t\t\t\t\t\tconst state = store.snapshot;\n\t\t\t\t\t\t\tstate.gl.xr.enabled = state.gl.xr.isPresenting;\n\t\t\t\t\t\t\tstate.gl.xr.setAnimationLoop(state.gl.xr.isPresenting ? handleXRFrame : null);\n\t\t\t\t\t\t\tif (!state.gl.xr.isPresenting) loop.invalidate(store);\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// WebXR session manager\n\t\t\t\t\t\tconst xr = {\n\t\t\t\t\t\t\tconnect: () => {\n\t\t\t\t\t\t\t\tgl.xr.addEventListener('sessionstart', handleSessionChange);\n\t\t\t\t\t\t\t\tgl.xr.addEventListener('sessionend', handleSessionChange);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdisconnect: () => {\n\t\t\t\t\t\t\t\tgl.xr.removeEventListener('sessionstart', handleSessionChange);\n\t\t\t\t\t\t\t\tgl.xr.removeEventListener('sessionend', handleSessionChange);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Subscribe to WebXR session events\n\t\t\t\t\t\tif (gl.xr && typeof gl.xr.addEventListener === 'function') xr.connect();\n\t\t\t\t\t\tstateToUpdate.xr = xr;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set shadowmap\n\t\t\t\t\tif (gl.shadowMap) {\n\t\t\t\t\t\tconst oldEnabled = gl.shadowMap.enabled;\n\t\t\t\t\t\tconst oldType = gl.shadowMap.type;\n\t\t\t\t\t\tgl.shadowMap.enabled = !!shadows;\n\n\t\t\t\t\t\tif (typeof shadows === 'boolean') {\n\t\t\t\t\t\t\tgl.shadowMap.type = THREE.PCFSoftShadowMap;\n\t\t\t\t\t\t} else if (typeof shadows === 'string') {\n\t\t\t\t\t\t\tconst types = {\n\t\t\t\t\t\t\t\tbasic: THREE.BasicShadowMap,\n\t\t\t\t\t\t\t\tpercentage: THREE.PCFShadowMap,\n\t\t\t\t\t\t\t\tsoft: THREE.PCFSoftShadowMap,\n\t\t\t\t\t\t\t\tvariance: THREE.VSMShadowMap,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tgl.shadowMap.type = types[shadows] ?? THREE.PCFSoftShadowMap;\n\t\t\t\t\t\t} else if (is.obj(shadows)) {\n\t\t\t\t\t\t\tObject.assign(gl.shadowMap, shadows);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (oldEnabled !== gl.shadowMap.enabled || oldType !== gl.shadowMap.type)\n\t\t\t\t\t\t\tcheckNeedsUpdate(gl.shadowMap);\n\t\t\t\t\t}\n\n\t\t\t\t\tTHREE.ColorManagement.enabled = !legacy;\n\n\t\t\t\t\tif (!isConfigured) {\n\t\t\t\t\t\t// set color space and tonemapping preferences once\n\t\t\t\t\t\tapplyProps(gl, {\n\t\t\t\t\t\t\toutputColorSpace: linear ? THREE.LinearSRGBColorSpace : THREE.SRGBColorSpace,\n\t\t\t\t\t\t\ttoneMapping: flat ? THREE.NoToneMapping : THREE.ACESFilmicToneMapping,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Update color management state\n\t\t\t\t\tif (state.legacy !== legacy) stateToUpdate.legacy = legacy;\n\t\t\t\t\tif (state.linear !== linear) stateToUpdate.linear = linear;\n\t\t\t\t\tif (state.flat !== flat) stateToUpdate.flat = flat;\n\n\t\t\t\t\t// Set gl props\n\t\t\t\t\tif (gl.setClearAlpha) {\n\t\t\t\t\t\tgl.setClearAlpha(0);\n\t\t\t\t\t}\n\t\t\t\t\tgl.setPixelRatio(makeDpr(state.viewport.dpr));\n\t\t\t\t\tgl.setSize(sizeOptions?.width ?? state.size.width, sizeOptions?.height ?? state.size.height);\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tis.obj(glOptions) &&\n\t\t\t\t\t\t!(typeof glOptions === 'function') &&\n\t\t\t\t\t\t!is.renderer(glOptions) &&\n\t\t\t\t\t\t!is.equ(glOptions, gl, shallowLoose)\n\t\t\t\t\t) {\n\t\t\t\t\t\tapplyProps(gl, glOptions);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Store events internally\n\t\t\t\t\tif (events && !state.events.handlers) stateToUpdate.events = events(store);\n\n\t\t\t\t\t// Check performance\n\t\t\t\t\tif (performance && !is.equ(performance, state.performance, shallowLoose)) {\n\t\t\t\t\t\tstateToUpdate.performance = { ...state.performance, ...performance };\n\t\t\t\t\t}\n\n\t\t\t\t\tif (Object.keys(stateToUpdate).length) {\n\t\t\t\t\t\tstore.update(stateToUpdate);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check size, allow it to take on container bounds initially\n\t\t\t\t\tconst size = computeInitialSize(canvas, sizeOptions);\n\t\t\t\t\tif (!is.equ(size, state.size, shallowLoose)) {\n\t\t\t\t\t\tstate.setSize(size.width, size.height, size.top, size.left);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check pixelratio\n\t\t\t\t\tif (dpr && state.viewport.dpr !== makeDpr(dpr)) state.setDpr(dpr);\n\t\t\t\t\t// Check frameloop\n\t\t\t\t\tif (state.frameloop !== frameloop) state.setFrameloop(frameloop);\n\n\t\t\t\t\tisConfigured = true;\n\t\t\t\t},\n\t\t\t};\n\t\t};\n\t});\n}\n\n/**\n * Type representing the canvas configurator returned by canvasRootInitializer.\n */\nexport type NgtCanvasConfigurator = ReturnType<ReturnType<typeof canvasRootInitializer>>;\n\n/**\n * Computes the initial size for a canvas element.\n * @internal\n */\nfunction computeInitialSize(canvas: NgtCanvasElement, defaultSize?: NgtSize): NgtSize {\n\tif (defaultSize) return defaultSize;\n\n\tif (typeof HTMLCanvasElement !== 'undefined' && canvas instanceof HTMLCanvasElement && canvas.parentElement) {\n\t\treturn canvas.parentElement.getBoundingClientRect();\n\t}\n\n\tif (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {\n\t\treturn { width: canvas.width, height: canvas.height, top: 0, left: 0 };\n\t}\n\n\treturn { width: 0, height: 0, top: 0, left: 0 };\n}\n\n/**\n * Disposes an object and all its disposable properties.\n *\n * Recursively calls dispose() on the object and all its properties that have\n * a dispose method, except for Scene objects which are handled separately.\n *\n * @typeParam T - The type of the object to dispose\n * @param obj - The object to dispose\n */\nexport function dispose<T extends NgtDisposable>(obj: T): void {\n\tif (obj.type !== 'Scene') obj.dispose?.();\n\tfor (const p in obj) {\n\t\tconst prop = obj[p] as NgtDisposable | undefined;\n\t\tif (prop?.type !== 'Scene') prop?.dispose?.();\n\t}\n}\n","import { ChangeDetectorRef, Component, effect } from '@angular/core';\nimport { ActivationEnd, Router, RouterOutlet } from '@angular/router';\nimport { filter } from 'rxjs';\n\n/**\n * Component for rendering Three.js scenes based on Angular Router routes.\n *\n * This component wraps a router-outlet and ensures proper change detection\n * when routes change. Use this when you want to have different Three.js scenes\n * for different routes in your application.\n *\n * @example\n * ```typescript\n * // In your routes configuration\n * const routes: Routes = [\n * { path: 'scene1', component: Scene1Component },\n * { path: 'scene2', component: Scene2Component },\n * ];\n *\n * // In your template\n * <ngt-canvas>\n * <ngt-routed-scene *canvasContent />\n * </ngt-canvas>\n * ```\n */\n@Component({\n\tselector: 'ngt-routed-scene',\n\ttemplate: `\n\t\t<router-outlet />\n\t`,\n\timports: [RouterOutlet],\n})\nexport class NgtRoutedScene {\n\tconstructor(router: Router, cdr: ChangeDetectorRef) {\n\t\teffect((onCleanup) => {\n\t\t\tconst sub = router.events\n\t\t\t\t.pipe(filter((event) => event instanceof ActivationEnd))\n\t\t\t\t.subscribe(cdr.detectChanges.bind(cdr));\n\t\t\tonCleanup(() => sub.unsubscribe());\n\t\t});\n\t}\n}\n","import { DestroyRef, effect, inject, Injector } from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport { injectStore } from '../store';\nimport type { NgtBeforeRenderRecord } from '../types';\n\n/**\n * `beforeRender` invokes its callback on every frame. Hence, the notion of tracking\n * changes (i.e: signals) does not really matter since we're getting latest values of the things we need on every frame anyway.\n *\n * If `priority` is a Signal, `beforeRender` will set up an Effect internally and returns the `EffectRef#destroy` instead.\n *\n * @example\n * ```ts\n * const destroy = beforeRender(\n * ({ gl, camera }) => {\n * // before render logic\n * },\n * {\n * priority: this.priority, // this.priority is a Signal<number>\n * }\n * )\n * ```\n */\nexport function beforeRender(\n\tcb: NgtBeforeRenderRecord['callback'],\n\t{ priority = 0, injector }: { priority?: number | (() => number); injector?: Injector } = {},\n) {\n\tif (typeof priority === 'function') {\n\t\tconst effectRef = assertInjector(beforeRender, injector, () => {\n\t\t\tconst store = injectStore();\n\t\t\tconst ref = effect((onCleanup) => {\n\t\t\t\tconst p = priority();\n\t\t\t\tconst sub = store.snapshot.internal.subscribe(cb, p, store);\n\t\t\t\tonCleanup(() => sub());\n\t\t\t});\n\n\t\t\tinject(DestroyRef).onDestroy(() => void ref.destroy());\n\n\t\t\treturn ref;\n\t\t});\n\n\t\treturn effectRef.destroy.bind(effectRef);\n\t}\n\n\treturn assertInjector(beforeRender, injector, () => {\n\t\tconst store = injectStore();\n\t\tconst sub = store.snapshot.internal.subscribe(cb, priority, store);\n\t\tinject(DestroyRef).onDestroy(() => void sub());\n\t\treturn sub;\n\t});\n}\n\n/**\n * @deprecated Use `beforeRender` instead. Will be removed in v5.0.0\n * @since v4.0.0\n */\nexport const injectBeforeRender = beforeRender;\n","import {\n\tcomputed,\n\tDestroyRef,\n\tDirective,\n\teffect,\n\tElementRef,\n\tinject,\n\tInjector,\n\tmodel,\n\toutput,\n\tRenderer2,\n} from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport type { NgtAfterAttach } from '../types';\nimport { is } from './is';\nimport { resolveRef } from './resolve-ref';\n\n/**\n * Directive for binding Three.js element lifecycle events to outputs.\n *\n * This directive provides outputs for Angular Three element events and native\n * Three.js events like added, removed, and disposed. It's designed to be used\n * as a host directive.\n *\n * Outputs:\n * - Angular Three: created, attached, updated\n * - Three.js: added, removed, childadded, childremoved, change, disposed\n *\n * Input: `elementEvents` - The element to listen for events on\n *\n * @example\n * ```typescript\n * @Component({\n * hostDirectives: [{\n * directive: NgtElementEvents,\n * inputs: ['elementEvents: events'],\n * outputs: ['attached', 'updated']\n * }]\n * })\n * export class MyMesh {\n * elementEvents = inject(NgtElementEvents, { host: true });\n *\n * constructor() {\n * this.elementEvents.events.set(this.meshRef);\n * }\n * }\n * ```\n */\n@Directive({ selector: '[elementEvents]' })\nexport class NgtElementEvents<TElement extends object> {\n\tcreated = output<TElement>();\n\tattached = output<NgtAfterAttach<TElement>>();\n\tupdated = output<TElement>();\n\n\tadded = output<any>();\n\tremoved = output<any>();\n\tchildadded = output<any>();\n\tchildremoved = output<any>();\n\tchange = output<any>();\n\tdisposed = output<any>();\n\n\t// NOTE: we use model here to allow for the hostDirective host to set this value\n\tevents = model<\n\t\tElementRef<TElement> | TElement | null | undefined | (() => ElementRef<TElement> | TElement | null | undefined)\n\t>(undefined, { alias: 'elementEvents' });\n\n\tconstructor() {\n\t\tconst obj = computed(() => {\n\t\t\tconst ngtObject = this.events();\n\t\t\tif (typeof ngtObject === 'function') return ngtObject();\n\t\t\treturn ngtObject;\n\t\t});\n\n\t\telementEvents(obj, {\n\t\t\t// @ts-expect-error - different type\n\t\t\tcreated: this.emitEvent('created'),\n\t\t\t// @ts-expect-error - different type\n\t\t\tupdated: this.emitEvent('updated'),\n\t\t\t// @ts-expect-error - different type for attached\n\t\t\tattached: this.emitEvent('attached'),\n\t\t\tadded: this.emitEvent('added'),\n\t\t\tremoved: this.emitEvent('removed'),\n\t\t\tchildadded: this.emitEvent('childadded'),\n\t\t\tchildremoved: this.emitEvent('childremoved'),\n\t\t\tchange: this.emitEvent('change'),\n\t\t\tdisposed: this.emitEvent('disposed'),\n\t\t});\n\t}\n\n\tprivate emitEvent<\n\t\tTEvent extends\n\t\t\t| 'created'\n\t\t\t| 'updated'\n\t\t\t| 'attached'\n\t\t\t| 'added'\n\t\t\t| 'removed'\n\t\t\t| 'childadded'\n\t\t\t| 'childremoved'\n\t\t\t| 'change'\n\t\t\t| 'disposed',\n\t>(eventName: TEvent) {\n\t\treturn this[eventName].emit.bind(this[eventName]);\n\t}\n}\n\n/**\n * Sets up element lifecycle event listeners on a Three.js element.\n *\n * @typeParam TElement - The type of the element\n * @param target - Signal containing the target element\n * @param events - Object mapping event names to handler functions\n * @param options - Optional injector for dependency injection\n * @returns Array of cleanup functions\n *\n * @example\n * ```typescript\n * elementEvents(\n * () => this.meshRef.nativeElement,\n * {\n * created: (mesh) => console.log('Mesh created'),\n * attached: ({ parent, node }) => console.log('Attached to', parent),\n * }\n * );\n * ```\n */\nexport function elementEvents<TElement extends object>(\n\ttarget: () => ElementRef<TElement> | TElement | null | undefined,\n\tevents: {\n\t\tcreated?: (element: TElement) => void;\n\t\tupdated?: (element: TElement) => void;\n\t\tattached?: (element: NgtAfterAttach<TElement>) => void;\n\t\tadded?: (event: any) => void;\n\t\tremoved?: (event: any) => void;\n\t\tchildadded?: (event: any) => void;\n\t\tchildremoved?: (event: any) => void;\n\t\tchange?: (event: any) => void;\n\t\tdisposed?: (event: any) => void;\n\t},\n\t{ injector }: { injector?: Injector } = {},\n) {\n\treturn assertInjector(elementEvents, injector, () => {\n\t\tconst renderer = inject(Renderer2);\n\n\t\tconst cleanUps: Array<() => void> = [];\n\n\t\teffect((onCleanup) => {\n\t\t\tconst targetObj = resolveRef(target());\n\n\t\t\tif (!targetObj || !is.instance(targetObj)) return;\n\n\t\t\tObject.keys(events).forEach((eventName) => {\n\t\t\t\tcleanUps.push(renderer.listen(targetObj, eventName, events[eventName as keyof typeof events] as any));\n\t\t\t});\n\n\t\t\tonCleanup(() => {\n\t\t\t\tcleanUps.forEach((cleanUp) => cleanUp());\n\t\t\t});\n\t\t});\n\n\t\tinject(DestroyRef).onDestroy(() => {\n\t\t\tcleanUps.forEach((cleanUp) => cleanUp());\n\t\t});\n\n\t\treturn cleanUps;\n\t});\n}\n","import {\n\tcomputed,\n\tDestroyRef,\n\tDirective,\n\teffect,\n\tElementRef,\n\tinject,\n\tInjector,\n\tmodel,\n\toutput,\n\tRenderer2,\n} from '@angular/core';\nimport { assertInjector } from 'ngxtension/assert-injector';\nimport type * as THREE from 'three';\nimport type { NgtEventHandlers, NgtThreeEvent } from '../types';\nimport { is } from './is';\nimport { resolveRef } from './resolve-ref';\n\n/**\n * Directive for binding Three.js pointer events to outputs.\n *\n * This directive provides outputs for all Three.js pointer events that can be used\n * with standard Angular event binding syntax. It's designed to be used as a host directive.\n *\n * Outputs: click, dblclick, contextmenu, pointerup, pointerdown, pointerover,\n * pointerout, pointerenter, pointerleave, pointermove, pointermissed, pointercancel, wheel\n *\n * Input: `objectEvents` - The Three.js object to listen for events on\n *\n * @example\n * ```typescript\n * @Component({\n * hostDirectives: [{\n * directive: NgtObjectEvents,\n * inputs: ['objectEvents: events'],\n * outputs: ['click', 'pointerover', 'pointerout']\n * }]\n * })\n * export class MyMesh {\n * objectEvents = inject(NgtObjectEvents, { host: true });\n *\n * constructor() {\n * this.objectEvents.events.set(this.meshRef);\n * }\n * }\n * ```\n */\n@Directive({ selector: '[objectEvents]' })\nexport class NgtObjectEvents {\n\tclick = output<NgtThreeEvent<MouseEvent>>();\n\tdblclick = output<NgtThreeEvent<MouseEvent>>();\n\tcontextmenu = output<NgtThreeEvent<MouseEvent>>();\n\tpointerup = output<NgtThreeEvent<PointerEvent>>();\n\tpointerdown = output<NgtThreeEvent<PointerEvent>>();\n\tpointerover = output<NgtThreeEvent<PointerEvent>>();\n\tpointerout = output<NgtThreeEvent<PointerEvent>>();\n\tpointerenter = output<NgtThreeEvent<PointerEvent>>();\n\tpointerleave = output<NgtThreeEvent<PointerEvent>>();\n\tpointermove = output<NgtThreeEvent<PointerEvent>>();\n\tpointermissed = output<NgtThreeEvent<MouseEvent>>();\n\tpointercancel = output<NgtThreeEvent<PointerEvent>>();\n\twheel = output<NgtThreeEvent<WheelEvent>>();\n\n\t// NOTE: we use model here to allow for the hostDirective host to set this value\n\tevents = model<\n\t\t| ElementRef<THREE.Object3D>\n\t\t| THREE.Object3D\n\t\t| null\n\t\t| undefined\n\t\t| (() => ElementRef<THREE.Object3D> | THREE.Object3D | null | undefined)\n\t>(undefined, { alias: 'objectEvents' });\n\n\tconstructor() {\n\t\tconst obj = computed(() => {\n\t\t\tconst ngtObject = this.events();\n\t\t\tif (typeof ngtObject === 'function') return ngtObject();\n\t\t\treturn ngtObject;\n\t\t});\n\n\t\tobjectEvents(obj, {\n\t\t\tclick: this.emitEvent('click'),\n\t\t\tdblclick: this.emitEvent('dblclick'),\n\t\t\tcontextmenu: this.emitEvent('contextmenu'),\n\t\t\tpointerup: this.emitEvent('pointerup'),\n\t\t\tpointerdown: this.emitEvent('pointerdown'),\n\t\t\tpointerover: this.emitEvent('pointerover'),\n\t\t\tpointerout: this.emitEvent('pointerout'),\n\t\t\tpointerenter: this.emitEvent('pointerenter'),\n\t\t\tpointerleave: this.emitEvent('pointerleave'),\n\t\t\tpointermove: this.emitEvent('pointermove'),\n\t\t\tpointermissed: this.emitEvent('pointermissed'),\n\t\t\tpointercancel: this.emitEvent('pointercancel'),\n\t\t\twheel: this.emitEvent('wheel'),\n\t\t});\n\t}\n\n\tprivate emitEvent<TEvent extends keyof NgtEventHandlers>(eventName: TEvent) {\n\t\treturn this[eventName].emit.bind(this[eventName]) as NgtEventHandlers[TEvent];\n\t}\n}\n\n/**\n * @deprecated Use objectEvents instead. Will be removed in v5.0.0\n * @since v4.0.0\n */\nexport const injectObjectEvents = objectEvents;\n\n/**\n * Sets up event listeners on a Three.js object.\n *\n * This function creates reactive event bindings that automatically clean up\n * when the target changes or the component is destroyed.\n *\n * @param target - Signal containing the target Object3D\n * @param events - Object mapping event names to handler functions\n * @param options - Optional injector for dependency injection\n * @returns Array of cleanup functions\n *\n * @example\n * ```typescript\n * objectEvents(\n * () => this.meshRef.nativeElement,\n * {\n * click: (event) => console.log('Clicked!', event),\n * pointerover: (event) => console.log('Hover start'),\n * }\n * );\n * ```\n */\nexport function objectEvents(\n\ttarget: () => ElementRef<THREE.Object3D> | THREE.Object3D | null | undefined,\n\tevents: NgtEventHandlers,\n\t{ injector }: { injector?: Injector } = {},\n) {\n\treturn assertInjector(objectEvents, injector, () => {\n\t\tconst renderer = inject(Renderer2);\n\n\t\tconst cleanUps: Array<() => void> = [];\n\n\t\teffect((onCleanup) => {\n\t\t\tconst targetObj = resolveRef(target());\n\n\t\t\tif (!targetObj || !is.instance(targetObj)) return;\n\n\t\t\tObject.entries(events).forEach(([eventName, eventHandler]) => {\n\t\t\t\tcleanUps.push(renderer.listen(targetObj, eventName, eventHandler));\n\t\t\t});\n\n\t\t\tonCleanup(() => {\n\t\t\t\tcleanUps.forEach((cleanUp) => cleanUp());\n\t\t\t});\n\t\t});\n\n\t\tinject(DestroyRef).onDestroy(() => {\n\t\t\tcleanUps.forEach((cleanUp) => cleanUp());\n\t\t});\n\n\t\treturn cleanUps;\n\t});\n}\n","import { OutputEmitterRef } from '@angular/core';\n\n/**\n * Gets the emit function from an OutputEmitterRef if it has active listeners.\n *\n * @typeParam T - The type of value the emitter emits\n * @param emitterRef - The output emitter reference\n * @returns The bound emit function, or undefined if no listeners\n */\nexport function getEmitter<T>(emitterRef: OutputEmitterRef<T> | undefined) {\n\tif (!emitterRef || !emitterRef['listeners'] || emitterRef['destroyed']) return undefined;\n\treturn emitterRef.emit.bind(emitterRef);\n}\n\n/**\n * Checks if any of the provided emitter refs have active listeners.\n *\n * @param emitterRefs - The output emitter references to check\n * @returns true if any emitter has listeners\n */\nexport function hasListener(...emitterRefs: (OutputEmitterRef<unknown> | undefined)[]) {\n\treturn emitterRefs.some(\n\t\t(emitterRef) =>\n\t\t\temitterRef && !emitterRef['destroyed'] && emitterRef['listeners'] && emitterRef['listeners'].length > 0,\n\t);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["cached","memoizedLoaders","normalizeInputs"],"mappings":";;;;;;;;;AAAA;;;;;AAKG;AAEH;AACO,MAAM,sBAAsB,GAAG;AACtC;AACO,MAAM,uBAAuB,GAAG;AACvC;AACO,MAAM,uBAAuB,GAAG;AACvC;AACO,MAAM,aAAa,GAAG;AAC7B;AACO,MAAM,eAAe,GAAG;AAC/B;AACO,MAAM,6BAA6B,GA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