{"version":3,"file":"h-k-dev-angular-tree.mjs","sources":["../../../projects/angular-tree/src/lib/tree-controller.ts","../../../projects/angular-tree/src/lib/tree-dom.ts","../../../projects/angular-tree/src/lib/tree-drag-session.ts","../../../projects/angular-tree/src/lib/tree-focus-engine.ts","../../../projects/angular-tree/src/lib/tree-guides.ts","../../../projects/angular-tree/src/lib/tree-keyboard.ts","../../../projects/angular-tree/src/lib/tree-menu-host.ts","../../../projects/angular-tree/src/lib/tree-context-menu.ts","../../../projects/angular-tree/src/lib/tree-node-def.ts","../../../projects/angular-tree/src/lib/tree-state-def.ts","../../../projects/angular-tree/src/lib/types.ts","../../../projects/angular-tree/src/lib/angular-tree.ts","../../../projects/angular-tree/src/lib/angular-tree.html","../../../projects/angular-tree/src/lib/events.ts","../../../projects/angular-tree/src/lib/tree-node-checkbox.ts","../../../projects/angular-tree/src/lib/middle-ellipsis.ts","../../../projects/angular-tree/src/lib/tree-node-drag-handle.ts","../../../projects/angular-tree/src/lib/tree-node-edit-input.ts","../../../projects/angular-tree/src/lib/tree-node-toggle.ts","../../../projects/angular-tree/src/public-api.ts","../../../projects/angular-tree/src/h-k-dev-angular-tree.ts"],"sourcesContent":["import { computed, linkedSignal, Service, signal, Signal } from '@angular/core';\nimport { firstValueFrom, Observable } from 'rxjs';\n\nimport { CheckState, TreeChildrenAccessor, TreeExpansionKey } from './types';\n\n/** Outcome of `ensureChildren` — the component maps this to `childrenLoaded`. */\nexport type LoadResult =\n  | { status: 'noop' }\n  | { status: 'loaded' }\n  | { status: 'error'; error: unknown };\n\n/** Where in the hovered row the pointer sits (ROADMAP Phase 4 three-zone). */\nexport type DropZone = 'before' | 'inside' | 'after';\n\n/** A resolved, guard-validated drop destination (MoveEvent-shaped). */\nexport interface DropTarget<T> {\n  readonly parentKey: string | null;\n  readonly parentNode: T | null;\n  readonly index: number;\n}\n\n/** Pure three-zone math: top 25% → before, middle 50% → inside, bottom 25% → after. */\nexport function dropZoneAt(offsetInRow: number, itemSize: number): DropZone {\n  const ratio = Math.min(Math.max(offsetInRow / itemSize, 0), 1);\n  return ratio < 0.25 ? 'before' : ratio < 0.75 ? 'inside' : 'after';\n}\n\n/** True when `keys` describes exactly the entries of `current` (duplicates collapse). */\nfunction sameKeySet(\n  current: ReadonlySet<string>,\n  keys: readonly string[],\n): boolean {\n  const next = new Set(keys);\n  return (\n    next.size === current.size && [...next].every((key) => current.has(key))\n  );\n}\n\n/**\n * One node of the internal flat model (react-arborist style). Internal —\n * consumers see only `T` and the template context.\n */\nexport interface FlatTreeNode<T> {\n  readonly node: T;\n  readonly key: string;\n  readonly parentKey: string | null;\n  readonly level: number;\n  /** Reports children via `childrenAccessor` (incl. lazy, not-yet-loaded). */\n  readonly expandable: boolean;\n  /** Children resolved synchronously — `false` means lazy-pending or leaf. */\n  readonly loaded: boolean;\n  /** Sync-loaded children only; empty for leaves and lazy-pending nodes. */\n  readonly childKeys: readonly string[];\n  readonly setSize: number;\n  readonly posInSet: number;\n}\n\n/** A render-ready row: flat node + expansion resolved against search state. */\nexport interface VisibleTreeNode<T> {\n  readonly flat: FlatTreeNode<T>;\n  readonly isExpanded: boolean;\n}\n\n/** Signals the host component hands over once at construction. */\nexport interface TreeControllerInputs<T> {\n  dataSource: Signal<readonly T[]>;\n  childrenAccessor: Signal<TreeChildrenAccessor<T>>;\n  expansionKey: Signal<TreeExpansionKey<T>>;\n  defaultExpandedKeys: Signal<readonly string[]>;\n  defaultFocusedKey: Signal<string | undefined>;\n  /** Controlled expansion (`[(expandedKeys)]`); `undefined` = unbound. */\n  expandedKeys: Signal<readonly string[] | undefined>;\n  /** Controlled selection (`[(selectedKeys)]`); `undefined` = unbound. */\n  selectedKeys: Signal<readonly string[] | undefined>;\n  searchTerm: Signal<string>;\n  searchMatch: Signal<((node: T, term: string) => boolean) | undefined>;\n}\n\n/**\n * The single source of truth (react-arborist `TreeApi` equivalent): one flat\n * model, one place for expansion/selection/editing/focus state — no event\n * bubbling through nested components. Provided on `AngularTree`, internal-only.\n */\n@Service({ autoProvided: false })\nexport class TreeController<T> {\n  #inputs!: TreeControllerInputs<T>;\n\n  /** Must be called exactly once, before any signal is read. */\n  connect(inputs: TreeControllerInputs<T>) {\n    this.#inputs = inputs;\n  }\n\n  // ---------------------------------------------------------------------------\n  // Core state\n  // ---------------------------------------------------------------------------\n\n  /**\n   * Derived from the controlled `expandedKeys` input; interaction writes land\n   * via `.set` and stand until the input changes again. While UNBOUND\n   * (`undefined`), derives from `defaultExpandedKeys` instead — reading it\n   * only then keeps a later default change resetting unbound trees (the v1\n   * linkedSignal behavior) while a bound tree ignores it entirely. Echoes\n   * return the previous Set identity (see `selectedIds`).\n   */\n  readonly expandedIds = linkedSignal<\n    readonly string[] | undefined,\n    ReadonlySet<string>\n  >({\n    source: () => this.#inputs.expandedKeys(),\n    computation: (keys, previous) => {\n      if (keys === undefined)\n        return new Set(this.#inputs.defaultExpandedKeys());\n      return previous !== undefined && sameKeySet(previous.value, keys)\n        ? previous.value\n        : new Set(keys);\n    },\n  });\n  /**\n   * Derived from the controlled `selectedKeys` input; interaction writes land\n   * via `.set`/`.update` and stand until the input changes again. Unbound\n   * (`undefined`) never resets. Echoes (the consumer writing our own emission\n   * back) return the previous Set identity, so downstream computeds see no\n   * change — the controlled round-trip is churn-free by construction.\n   */\n  readonly selectedIds = linkedSignal<\n    readonly string[] | undefined,\n    ReadonlySet<string>\n  >({\n    source: () => this.#inputs.selectedKeys(),\n    computation: (keys, previous) => {\n      if (keys === undefined) return previous?.value ?? new Set();\n      return previous !== undefined && sameKeySet(previous.value, keys)\n        ? previous.value\n        : new Set(keys);\n    },\n  });\n  readonly editingId = signal<string | null>(null);\n  /** Derived from `defaultFocusedKey` until the first focus write (v2). */\n  readonly focusedId = linkedSignal<string | null>(\n    () => this.#inputs.defaultFocusedKey() ?? null,\n  );\n\n  // ---------------------------------------------------------------------------\n  // Lazy loading (virtualization-proof by design: everything lives here,\n  // keyed by node key — a row unmounting mid-fetch can't lose anything)\n  // ---------------------------------------------------------------------------\n\n  /** Children resolved from async accessors, by node key. */\n  readonly #loadedChildren = signal<ReadonlyMap<string, readonly T[]>>(\n    new Map(),\n  );\n  /**\n   * Stale-while-revalidate (decision 15): invalidation MARKS resolved\n   * children instead of dropping them, so the subtree stays rendered until\n   * the replacement resolves. A stale key re-runs the accessor despite\n   * `loaded`; ONLY an async resolve clears the mark — see the sync/leaf\n   * branch in `ensureChildren` for why a noop read must not.\n   */\n  readonly #staleChildren = signal<ReadonlySet<string>>(new Set());\n  /** The reconciler reads this: stale + expanded ⇒ revalidate. */\n  readonly staleChildren = this.#staleChildren.asReadonly();\n  readonly #loadStates = signal<ReadonlyMap<string, 'loading' | 'error'>>(\n    new Map(),\n  );\n  /** Rows read this via per-row computeds (`isLoading`/`hasError` context). */\n  readonly loadStates = this.#loadStates.asReadonly();\n  /** In-flight dedupe registry — repeat expands await the same promise. */\n  readonly #inflight = new Map<string, Promise<LoadResult>>();\n\n  /**\n   * Cancellation (v2): one controller per accessor invocation, keyed. Created\n   * only when the accessor *declares* the signal parameter (`length >= 2`) —\n   * sync single-arg accessors cost nothing across a 100k flatten.\n   */\n  readonly #abortControllers = new Map<string, AbortController>();\n\n  /**\n   * Stale-result guard (v2): `invalidateChildren` bumps the generation, so a\n   * superseded fetch that resolves late (consumer ignored the abort signal)\n   * can't overwrite fresh state.\n   */\n  readonly #loadGeneration = new Map<string, number>();\n\n  /**\n   * Accessor results memoized per node object. Without this, every `flat()`\n   * recompute would re-invoke the accessor — and a Promise-returning accessor\n   * *starts a fetch per call*. Memoization inside a computed is a deliberate\n   * STYLE.md § computed-purity exception: it exists to keep the accessor\n   * idempotent; repeated fetches are the side effect being prevented.\n   */\n  #rawChildren = new WeakMap<object, ReturnType<TreeChildrenAccessor<T>>>();\n  #rawChildrenAccessor: TreeChildrenAccessor<T> | null = null;\n\n  #childrenOf(node: T, key?: string): ReturnType<TreeChildrenAccessor<T>> {\n    const accessor = this.#inputs.childrenAccessor();\n    if (accessor !== this.#rawChildrenAccessor) {\n      this.#rawChildren = new WeakMap();\n      this.#rawChildrenAccessor = accessor;\n    }\n\n    // Cancellation opt-in: accessors that declare `(node, signal)` get an\n    // AbortSignal per invocation; the tree aborts it on destroy and on\n    // invalidate-while-in-flight. Single-arg accessors skip the allocation.\n    const invoke = () => {\n      if (accessor.length < 2) return accessor(node);\n      const abortKey = key ?? this.#inputs.expansionKey()(node);\n      const controller = new AbortController();\n      this.#abortControllers.set(abortKey, controller);\n      return accessor(node, controller.signal);\n    };\n\n    if (typeof node !== 'object' || node === null) return invoke();\n\n    if (this.#rawChildren.has(node)) return this.#rawChildren.get(node);\n    const raw = invoke();\n    // A probed-but-never-expanded rejection must not surface as a global\n    // unhandled rejection; ensureChildren attaches the real handlers.\n    if (raw instanceof Promise) raw.catch(() => undefined);\n    this.#rawChildren.set(node, raw);\n    return raw;\n  }\n\n  /**\n   * Resolves an async `childrenAccessor` for `key` exactly once. Keyed to the\n   * expand *intent* — rendering never triggers or cancels loads (ROADMAP\n   * Phase 3, virtualization-proof lazy loading).\n   */\n  ensureChildren(key: string): Promise<LoadResult> {\n    const entry = this.flat().map.get(key);\n    // Loaded blocks a re-run only while FRESH — a stale key revalidates\n    // (decision 15), its old children still rendering from the overlay.\n    if (\n      !entry ||\n      !entry.expandable ||\n      (entry.loaded && !this.#staleChildren().has(key))\n    )\n      return Promise.resolve({ status: 'noop' });\n\n    const pending = this.#inflight.get(key);\n    if (pending) return pending;\n\n    const raw = this.#childrenOf(entry.node, key);\n    if (raw == null || Array.isArray(raw)) {\n      // Sync/leaf reads keep their stale mark: this call may be running\n      // against a flat model the next change detection is about to replace\n      // (invalidate-then-swap consumers), and only an ASYNC resolve proves a\n      // revalidation happened. A mark lingering on a genuinely sync node is\n      // inert — this same branch noops every re-entry without touching any\n      // signal, so the reconciler settles.\n      return Promise.resolve({ status: 'noop' });\n    }\n\n    // Array.isArray doesn't narrow `readonly T[]` out of the union (TS quirk).\n    const async = raw as Promise<readonly T[]> | Observable<readonly T[]>;\n\n    // A later invalidateChildren bumps the generation: this task's handlers\n    // then write nothing — the re-run owns the state.\n    const generation = this.#loadGeneration.get(key) ?? 0;\n    const isCurrent = () => (this.#loadGeneration.get(key) ?? 0) === generation;\n\n    this.#setLoadState(key, 'loading');\n    const task: Promise<LoadResult> = (\n      async instanceof Observable ? firstValueFrom(async) : async\n    ).then(\n      (children: readonly T[]): LoadResult => {\n        if (!isCurrent()) return { status: 'noop' };\n        // Nullish resolves (typed away, still reachable in JS) count as \"no\n        // children\": a nullish overlay entry would read as never-loaded, and\n        // the expanded⇒load reconciler would re-fetch it forever.\n        this.#loadedChildren.update((current) =>\n          new Map(current).set(key, children ?? []),\n        );\n        this.#clearStale(key); // the replacement landed — fresh again\n        this.#setLoadState(key, undefined);\n        return { status: 'loaded' };\n      },\n      (error: unknown): LoadResult => {\n        if (!isCurrent()) return { status: 'noop' };\n        // Never leave a node stuck in `isLoading` (ROADMAP Phase 3).\n        this.#setLoadState(key, 'error');\n        return { status: 'error', error };\n      },\n    );\n    task.finally(() => {\n      if (this.#inflight.get(key) === task) this.#inflight.delete(key);\n    });\n\n    this.#inflight.set(key, task);\n    return task;\n  }\n\n  /**\n   * Lazy invalidation (v2, ROADMAP2 Phase 12; stale-while-revalidate since\n   * decision 15): forget the memoized accessor result, abort any in-flight\n   * fetch, clear load state, and mark the keyed overlay STALE — kept, not\n   * dropped, so the old children stay rendered until the next\n   * `ensureChildren` resolves their replacement. No key = tree-wide (every\n   * key with lazy traces). Returns the affected keys so the component can\n   * re-trigger loads for expanded nodes. The tree never fetches: refresh\n   * policy stays behind the accessor.\n   */\n  invalidateChildren(key?: string): readonly string[] {\n    const keys =\n      key != null\n        ? [key]\n        : [\n            ...new Set([\n              ...this.#loadedChildren().keys(),\n              ...this.#inflight.keys(),\n              ...this.#loadStates().keys(),\n            ]),\n          ];\n\n    for (const invalidKey of keys) {\n      this.#loadGeneration.set(\n        invalidKey,\n        (this.#loadGeneration.get(invalidKey) ?? 0) + 1,\n      );\n      this.#abortControllers.get(invalidKey)?.abort();\n      this.#abortControllers.delete(invalidKey);\n      this.#inflight.delete(invalidKey);\n      const node = this.flat().map.get(invalidKey)?.node;\n      if (node != null && typeof node === 'object')\n        this.#rawChildren.delete(node);\n      this.#setLoadState(invalidKey, undefined);\n    }\n    // One set write for the batch — a tree-wide invalidate over many loaded\n    // subtrees must not re-flatten once per key.\n    this.#staleChildren.update((current) => new Set([...current, ...keys]));\n    return keys;\n  }\n\n  #clearStale(key: string) {\n    const current = this.#staleChildren();\n    if (!current.has(key)) return;\n    const next = new Set(current);\n    next.delete(key);\n    this.#staleChildren.set(next);\n  }\n\n  /** Destroy-time cancellation — abort everything, touch no state. */\n  abortAll(): void {\n    this.#abortControllers.forEach((controller) => controller.abort());\n    this.#abortControllers.clear();\n  }\n\n  /** Clears the error state and re-runs the accessor with a fresh call. */\n  retryChildren(key: string): Promise<LoadResult> {\n    const entry = this.flat().map.get(key);\n    if (entry && typeof entry.node === 'object' && entry.node !== null) {\n      this.#rawChildren.delete(entry.node); // memoized rejection must not be retried into\n    }\n    this.#setLoadState(key, undefined);\n    return this.ensureChildren(key);\n  }\n\n  #setLoadState(key: string, state: 'loading' | 'error' | undefined) {\n    this.#loadStates.update((current) => {\n      const next = new Map(current);\n      if (state) next.set(key, state);\n      else next.delete(key);\n      return next;\n    });\n  }\n\n  // ---------------------------------------------------------------------------\n  // Flat model\n  // ---------------------------------------------------------------------------\n\n  /** Full loaded model in DFS pre-order (expansion-independent). */\n  readonly flat = computed(() => {\n    const key = this.#inputs.expansionKey();\n    const asyncLoaded = this.#loadedChildren();\n    const list: FlatTreeNode<T>[] = [];\n    const map = new Map<string, FlatTreeNode<T>>();\n\n    const visit = (\n      nodes: readonly T[],\n      parentKey: string | null,\n      level: number,\n    ): string[] =>\n      nodes.map((node, i) => {\n        const nodeKey = key(node);\n        const raw = this.#childrenOf(node, nodeKey);\n        // Async accessor results are overlaid by key, so lazy-resolved\n        // children flatten exactly like sync ones from here on.\n        const childNodes = Array.isArray(raw)\n          ? (raw as readonly T[])\n          : asyncLoaded.get(nodeKey);\n        const loaded = childNodes != null;\n        const entry: FlatTreeNode<T> = {\n          node,\n          key: nodeKey,\n          parentKey,\n          level,\n          expandable: raw != null,\n          loaded,\n          setSize: nodes.length,\n          posInSet: i + 1,\n          childKeys: [],\n        };\n        list.push(entry);\n        map.set(nodeKey, entry);\n        if (loaded) {\n          // Pre-order invariant: children append *after* their parent, so a\n          // reverse pass sees children first (checkStates depends on this).\n          // Single mutation before the entry is published anywhere.\n          (entry as { childKeys: readonly string[] }).childKeys = visit(\n            childNodes,\n            nodeKey,\n            level + 1,\n          );\n        }\n        return nodeKey;\n      });\n\n    const rootKeys = visit(this.#inputs.dataSource(), null, 0);\n    return { list, map, rootKeys };\n  });\n\n  // ---------------------------------------------------------------------------\n  // Search\n  // ---------------------------------------------------------------------------\n\n  /**\n   * Keys visible under the current search, or `null` when search is inactive.\n   * A match keeps its full ancestor chain visible (react-arborist behavior);\n   * expansion state is never mutated — clearing the term restores it intact.\n   */\n  readonly searchVisibleIds = computed<ReadonlySet<string> | null>(() => {\n    const term = this.#inputs.searchTerm();\n    const match = this.#inputs.searchMatch();\n    if (!term || !match) return null; // no matcher = search inert (ROADMAP settled)\n\n    const { list, map } = this.flat();\n    const visible = new Set<string>();\n    for (const entry of list) {\n      if (!match(entry.node, term)) continue;\n      for (\n        let current: FlatTreeNode<T> | undefined = entry;\n        current && !visible.has(current.key);\n        current =\n          current.parentKey != null ? map.get(current.parentKey) : undefined\n      ) {\n        visible.add(current.key);\n      }\n    }\n    return visible;\n  });\n\n  /** True matches under the current term (ancestors excluded), or `null` when search is inert. */\n  readonly searchMatchCount = computed<number | null>(() => {\n    const term = this.#inputs.searchTerm();\n    const match = this.#inputs.searchMatch();\n    if (!term || !match) return null;\n    let count = 0;\n    for (const entry of this.flat().list)\n      if (match(entry.node, term)) count += 1;\n    return count;\n  });\n\n  /** The 1D render array: collapsed subtrees skipped, search filter applied. */\n  readonly visibleNodes = computed<readonly VisibleTreeNode<T>[]>(() => {\n    const { map, rootKeys } = this.flat();\n    const expanded = this.expandedIds();\n    const searchIds = this.searchVisibleIds();\n    const out: VisibleTreeNode<T>[] = [];\n\n    const visit = (keys: readonly string[]) => {\n      for (const key of keys) {\n        const flat = map.get(key)!;\n        if (searchIds && !searchIds.has(key)) continue;\n        // Ancestors of matches render force-expanded while searching.\n        const isExpanded =\n          flat.expandable && (searchIds ? true : expanded.has(key));\n        out.push({ flat, isExpanded });\n        if (isExpanded) visit(flat.childKeys);\n      }\n    };\n\n    visit(rootKeys);\n    return out;\n  });\n\n  // ---------------------------------------------------------------------------\n  // Checkbox states\n  // ---------------------------------------------------------------------------\n\n  /**\n   * Single reverse pass, children before parents (DFS pre-order reversed):\n   * O(n) per selection change, never per node. Rows must read through a\n   * per-row `computed` so string equality stops propagation (ROADMAP Phase 1).\n   */\n  readonly checkStates = computed<ReadonlyMap<string, CheckState>>(() => {\n    const { list } = this.flat();\n    const selected = this.selectedIds();\n    const states = new Map<string, CheckState>();\n\n    for (let i = list.length - 1; i >= 0; i--) {\n      const entry = list[i];\n      if (entry.childKeys.length === 0) {\n        // Leaves and lazy-pending nodes carry their own selection —\n        // cascade covers *loaded* nodes only (ROADMAP non-goal).\n        states.set(\n          entry.key,\n          selected.has(entry.key) ? 'checked' : 'unchecked',\n        );\n        continue;\n      }\n\n      let checked = 0;\n      let indeterminate = false;\n      for (const childKey of entry.childKeys) {\n        const state = states.get(childKey);\n        if (state === 'checked') checked += 1;\n        else if (state === 'indeterminate') indeterminate = true;\n      }\n      states.set(\n        entry.key,\n        indeterminate || (checked > 0 && checked < entry.childKeys.length)\n          ? 'indeterminate'\n          : checked === entry.childKeys.length\n            ? 'checked'\n            : 'unchecked',\n      );\n    }\n    return states;\n  });\n\n  // ---------------------------------------------------------------------------\n  // Mutations (the component syncs interaction writes back into `selectedKeys`)\n  // ---------------------------------------------------------------------------\n\n  setExpanded(key: string, value: boolean) {\n    this.expandedIds.update((current) => {\n      const next = new Set(current);\n      if (value) next.add(key);\n      else next.delete(key);\n      return next;\n    });\n  }\n\n  expandAll() {\n    this.expandedIds.set(\n      new Set(\n        this.flat()\n          .list.filter((entry) => entry.loaded)\n          .map((entry) => entry.key),\n      ),\n    );\n  }\n\n  collapseAll() {\n    this.expandedIds.set(new Set());\n  }\n\n  expandWithDescendants(key: string) {\n    const { map } = this.flat();\n    const keys = new Set(this.expandedIds());\n    const visit = (k: string) => {\n      const entry = map.get(k);\n      if (!entry?.loaded) return; // lazy subtree: Phase 3 decides load-on-expand-all\n      keys.add(k);\n      entry.childKeys.forEach(visit);\n    };\n    visit(key);\n    this.expandedIds.set(keys);\n  }\n\n  /** `key` + every loaded descendant, in DFS order. */\n  subtreeKeys(key: string): readonly string[] {\n    const { map } = this.flat();\n    const out: string[] = [];\n    const visit = (k: string) => {\n      const entry = map.get(k);\n      if (!entry) return;\n      out.push(k);\n      entry.childKeys.forEach(visit);\n    };\n    visit(key);\n    return out;\n  }\n\n  /**\n   * What a checkbox toggle must do given the current tri-state: indeterminate\n   * and unchecked both select the subtree (ARIA checkbox-tree convention).\n   */\n  checkToggleDelta(\n    key: string,\n    cascade: boolean,\n  ): { keys: readonly string[]; select: boolean } {\n    const select = (this.checkStates().get(key) ?? 'unchecked') !== 'checked';\n    return { keys: cascade ? this.subtreeKeys(key) : [key], select };\n  }\n\n  // ---------------------------------------------------------------------------\n  // Drag & drop math (Phase 4)\n  // ---------------------------------------------------------------------------\n\n  /**\n   * Which keys travel when a drag starts on `pressedKey`: the whole selection\n   * if the pressed row is part of it (react-arborist), otherwise just the\n   * pressed row (selection untouched — Gmail semantics). Redundancy pruned:\n   * a key with a selected ancestor rides along anyway. DFS order — first key\n   * is the stable preview representative.\n   */\n  dragKeysFor(pressedKey: string): readonly string[] {\n    const selected = this.selectedIds();\n    if (!selected.has(pressedKey)) return [pressedKey];\n\n    const { list, map } = this.flat();\n    const out: string[] = [];\n    for (const entry of list) {\n      if (!selected.has(entry.key)) continue;\n      let ancestorSelected = false;\n      for (\n        let parent = entry.parentKey;\n        parent != null;\n        parent = map.get(parent)!.parentKey\n      ) {\n        if (selected.has(parent)) {\n          ancestorSelected = true;\n          break;\n        }\n      }\n      if (!ancestorSelected) out.push(entry.key);\n    }\n    return out;\n  }\n\n  /**\n   * Resolves hovered row + zone into a `MoveEvent`-shaped destination, or\n   * `null` when forbidden: dropping onto a dragged row, or anywhere inside a\n   * dragged subtree (every dragged id is checked — multi-drag contract).\n   * `inside` on a non-expandable row degrades to `after` (react-arborist).\n   */\n  dropTargetFor(\n    dragKeys: readonly string[],\n    targetKey: string,\n    zone: DropZone,\n  ): DropTarget<T> | null {\n    const { map } = this.flat();\n    const target = map.get(targetKey);\n    if (!target) return null;\n\n    const dragged = new Set(dragKeys);\n    if (dragged.has(target.key)) return null;\n\n    const effectiveZone: DropZone =\n      zone === 'inside' && !target.expandable ? 'after' : zone;\n    const parentKey =\n      effectiveZone === 'inside' ? target.key : target.parentKey;\n    for (\n      let key: string | null = parentKey;\n      key != null;\n      key = map.get(key)!.parentKey\n    ) {\n      if (dragged.has(key)) return null;\n    }\n\n    if (effectiveZone === 'inside') {\n      return {\n        parentKey: target.key,\n        parentNode: target.node,\n        index: target.childKeys.length,\n      };\n    }\n\n    const parent = target.parentKey != null ? map.get(target.parentKey)! : null;\n    const base = target.posInSet - 1; // 0-based among current siblings\n    return {\n      parentKey: parent?.key ?? null,\n      parentNode: parent?.node ?? null,\n      index: effectiveZone === 'before' ? base : base + 1,\n    };\n  }\n\n  nodesForKeys(keys: Iterable<string>): readonly T[] {\n    const { map } = this.flat();\n    const out: T[] = [];\n    for (const key of keys) {\n      const entry = map.get(key);\n      if (entry) out.push(entry.node);\n    }\n    return out;\n  }\n}\n","/**\n * Row-DOM lookups shared by the engines (focus, menu host). Pure functions —\n * the host element is a parameter, never ambient state.\n */\n\n/** Attribute-value escape for `[data-node-id=\"…\"]` queries — CSS.escape is absent in jsdom. */\nexport function escapeAttributeValue(value: string): string {\n  return value.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n}\n\n/** The row's rendered DOM element, or `null` outside the rendered range. */\nexport function rowElement(host: HTMLElement, key: string): HTMLElement | null {\n  return host.querySelector<HTMLElement>(\n    `[data-node-id=\"${escapeAttributeValue(key)}\"]`,\n  );\n}\n","import { CdkDragMove } from '@angular/cdk/drag-drop';\nimport { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';\nimport {\n  afterNextRender,\n  computed,\n  DestroyRef,\n  ElementRef,\n  inject,\n  Injector,\n  Service,\n  signal,\n  Signal,\n} from '@angular/core';\n\nimport type { MoveEvent } from './events';\nimport { DropTarget, dropZoneAt, TreeController } from './tree-controller';\nimport type { TreeDropContext } from './types';\n\n/** The row facts a drag needs — structurally satisfied by the component's FlatRow. */\nexport interface DragRow<T> {\n  readonly key: string;\n  readonly node: T;\n  readonly level: number;\n  readonly expandable: boolean;\n  readonly context: { readonly isExpanded: boolean };\n}\n\n/** Purely visual drop marker — never reorders DOM mid-drag (ROADMAP Phase 4). */\nexport interface DropIndicator {\n  /** Viewport-relative px (the indicator overlays the viewport, not the content). */\n  readonly top: number;\n  readonly height: number;\n  readonly inside: boolean;\n  readonly level: number;\n}\n\n/** Signals and intent callbacks the host component hands over once at construction. */\nexport interface TreeDragSessionInputs<T> {\n  viewport: Signal<CdkVirtualScrollViewport>;\n  itemSize: Signal<number>;\n  rows: Signal<readonly DragRow<T>[]>;\n  disableDrop: Signal<((ctx: TreeDropContext<T>) => boolean) | undefined>;\n  /** Expand intent — must go through the component's single write path (toggled + lazy load). */\n  expand: (node: T) => void;\n  /** A validated drop was released — the component emits `moved` and announces. */\n  drop: (event: MoveEvent<T>) => void;\n}\n\n/**\n * Pointer drag & drop (ROADMAP Phase 4) plus the keyboard move mark\n * (WCAG 2.5.7 — every drag has a non-pointer path). The zone/target *math*\n * is pure and lives in the controller (`dropZoneAt`, `dropTargetFor`); this\n * engine owns only the session lifecycle STYLE.md assigns to a class: the\n * drag/indicator/mark signals, the edge auto-scroll rAF loop, the\n * hover-expand timer, the mid-drag Escape listener, and the wheel-scroll\n * re-target subscription.\n * CDK touchpoints: `cdkDrag` events (start/move/end — the component's\n * template binds them through), `CdkVirtualScrollViewport`\n * (`measureScrollOffset`/`scrollToOffset` for manual auto-scroll: standard\n * `cdkDropList` auto-scroll doesn't know the virtual viewport).\n */\n@Service({ autoProvided: false })\nexport class TreeDragSession<T = unknown> {\n  readonly #controller = inject<TreeController<T>>(TreeController);\n  readonly #injector = inject(Injector);\n  readonly #destroyRef = inject(DestroyRef);\n  readonly #host: HTMLElement = inject(ElementRef).nativeElement;\n\n  #inputs!: TreeDragSessionInputs<T>;\n\n  /**\n   * Touch decision (ROADMAP): context menu owns long-press, so touch-initiated\n   * drags are effectively disabled; keyboard move is the non-pointer path.\n   */\n  readonly dragStartDelay = { mouse: 0, touch: 1 << 30 };\n\n  readonly #drag = signal<{\n    keys: readonly string[];\n    nodes: readonly T[];\n  } | null>(null);\n  readonly dragCount = computed(() => this.#drag()?.keys.length ?? 0);\n\n  readonly #dropIndicator = signal<DropIndicator | null>(null);\n  readonly dropIndicator = this.#dropIndicator.asReadonly();\n\n  /** The validated destination the next release commits to (plain field: read once). */\n  #pendingDrop: DropTarget<T> | null = null;\n  #lastPointerY = 0;\n  #autoScrollStep = 0;\n  #autoScrollFrame: number | undefined;\n  #hoverExpand:\n    { key: string; timer: ReturnType<typeof setTimeout> } | undefined;\n\n  /** Cut/paste-style keyboard move — rows read this for their `data-move-source` affordance. */\n  readonly #marked = signal<{\n    keys: ReadonlySet<string>;\n    nodes: readonly T[];\n    effect: 'move' | 'copy';\n  } | null>(null);\n  readonly marked = this.#marked.asReadonly();\n\n  /** Must be called exactly once, from the component's constructor. */\n  connect(inputs: TreeDragSessionInputs<T>) {\n    this.#inputs = inputs;\n\n    // afterNextRender, not an effect: viewChild.required throws before the\n    // first render, and effects can run that early.\n    afterNextRender(\n      () => {\n        // Wheel-scroll mid-drag (v2): the pointer is stationary, so no\n        // pointermove re-targets the drop — re-run it from the last known\n        // pointer position or the indicator tracks a recycled row.\n        const subscription = inputs\n          .viewport()\n          .elementScrolled()\n          .subscribe(() => {\n            if (this.#drag()) this.#updateDropTarget(this.#lastPointerY);\n          });\n        this.#destroyRef.onDestroy(() => subscription.unsubscribe());\n      },\n      { injector: this.#injector },\n    );\n    // Destroy mid-drag: timers, the rAF loop, and the Escape listener must\n    // not outlive the tree.\n    this.#destroyRef.onDestroy(() => this.#reset());\n  }\n\n  /** Marks the pressed row's pruned drag set for a keyboard drop (Ctrl+X / Ctrl+C). */\n  mark(pressedKey: string, effect: 'move' | 'copy') {\n    const keys = this.#controller.dragKeysFor(pressedKey);\n    this.#marked.set({\n      keys: new Set(keys),\n      nodes: this.#controller.nodesForKeys(keys),\n      effect,\n    });\n  }\n\n  clearMark() {\n    this.#marked.set(null);\n  }\n\n  /** Same validation and `MoveEvent` as a pointer drop — only the input differs. */\n  keyboardDrop(row: DragRow<T>, zone: 'inside' | 'after') {\n    const marked = this.#marked();\n    if (!marked) return;\n\n    const keys = [...marked.keys];\n    const target = this.#controller.dropTargetFor(keys, row.key, zone);\n    if (!target) return;\n    if (\n      this.#inputs.disableDrop()?.({\n        dragNodes: marked.nodes,\n        parentNode: target.parentNode,\n        index: target.index,\n      })\n    ) {\n      return;\n    }\n\n    this.#marked.set(null);\n    this.#inputs.drop({\n      dragIds: keys,\n      dragNodes: marked.nodes,\n      parentId: target.parentKey,\n      parentNode: target.parentNode,\n      index: target.index,\n      dropEffect: marked.effect,\n    });\n  }\n\n  dragStart(row: DragRow<T>) {\n    const keys = this.#controller.dragKeysFor(row.key);\n    this.#dragCopy = false;\n    this.#dragCancelled = false;\n    this.#drag.set({ keys, nodes: this.#controller.nodesForKeys(keys) });\n\n    // Escape cancels the drag (v2 — CDK has no public mid-drag cancel): flag\n    // the drop as dead, then end CDK's sequence with a synthetic mouseup.\n    // Mouse drags only — DragRef reads coordinates off the up-event, and a\n    // fabricated TouchEvent can't carry them; touch cancels by lifting.\n    const doc = this.#host.ownerDocument;\n    const onKeydown = (event: KeyboardEvent) => {\n      if (event.key !== 'Escape') return;\n      this.#dragCancelled = true;\n      this.#clearDropTarget();\n      event.stopPropagation(); // a hosting dialog must not close on the same press\n      doc.dispatchEvent(new MouseEvent('mouseup', { bubbles: true }));\n    };\n    doc.addEventListener('keydown', onKeydown, true);\n    this.#dragEscapeCleanup = () => {\n      doc.removeEventListener('keydown', onKeydown, true);\n      this.#dragEscapeCleanup = null;\n    };\n  }\n\n  #dragCancelled = false;\n  #dragEscapeCleanup: (() => void) | null = null;\n\n  dragMove(event: CdkDragMove<unknown>) {\n    // Copy modifier is sampled continuously and used at drop time — pressing\n    // or releasing it mid-drag must count (OS file-manager behavior).\n    this.#dragCopy = this.#isCopyModifierHeld(event.event);\n    this.#lastPointerY = event.pointerPosition.y;\n    this.#updateDropTarget(event.pointerPosition.y);\n    this.#updateAutoScroll(event.pointerPosition.y);\n  }\n\n  /** ⌥ copies on macOS, Ctrl elsewhere — Ctrl-drag is a context-menu gesture on mac. */\n  #isCopyModifierHeld(event: MouseEvent | TouchEvent): boolean {\n    if (!(event instanceof MouseEvent)) return false; // touch has no modifiers\n    const isApple = /Mac|iP(hone|ad|od)/.test(\n      globalThis.navigator?.platform ?? '',\n    );\n    return isApple ? event.altKey : event.ctrlKey;\n  }\n\n  /** Copy modifier state at the latest drag move — read at drop. */\n  #dragCopy = false;\n\n  dragEnd() {\n    const drag = this.#drag();\n    const drop = this.#pendingDrop;\n    if (drag && drop && !this.#dragCancelled) {\n      this.#inputs.drop({\n        dragIds: drag.keys,\n        dragNodes: drag.nodes,\n        parentId: drop.parentKey,\n        parentNode: drop.parentNode,\n        index: drop.index,\n        dropEffect: this.#dragCopy ? 'copy' : 'move',\n      });\n    }\n    this.#reset();\n  }\n\n  /** Fixed `itemSize` makes hovered row + zone pure arithmetic — no hit testing. */\n  #updateDropTarget(clientY: number) {\n    const drag = this.#drag();\n    if (!drag) return;\n\n    const viewport = this.#inputs.viewport();\n    const viewportTop =\n      viewport.elementRef.nativeElement.getBoundingClientRect().top;\n    const size = this.#inputs.itemSize();\n    const contentY = clientY - viewportTop + viewport.measureScrollOffset();\n    const rows = this.#inputs.rows();\n    const index = Math.floor(contentY / size);\n\n    if (index < 0 || index >= rows.length) {\n      this.#clearDropTarget();\n      return;\n    }\n\n    const row = rows[index];\n    const zone = dropZoneAt(contentY - index * size, size);\n    // The 'after' line under an EXPANDED row sits visually between the row and\n    // its first child — resolve to that slot (first child, react-arborist\n    // parity). Sibling-after would land the drop below the row's entire\n    // subtree, far from the line. Keyboard 'after' (Ctrl+Shift+V) keeps\n    // sibling semantics: no indicator justifies the remap there.\n    const insideFirst =\n      zone === 'after' && row.expandable && row.context.isExpanded;\n    const resolved = this.#controller.dropTargetFor(\n      drag.keys,\n      row.key,\n      insideFirst ? 'inside' : zone,\n    );\n    const target =\n      insideFirst && resolved ? { ...resolved, index: 0 } : resolved;\n    const forbidden =\n      target != null &&\n      (this.#inputs.disableDrop()?.({\n        dragNodes: drag.nodes,\n        parentNode: target.parentNode,\n        index: target.index,\n      }) ??\n        false);\n\n    this.#scheduleHoverExpand(\n      zone === 'inside' && target != null && !forbidden ? row : null,\n    );\n\n    if (target == null || forbidden) {\n      this.#clearDropTarget();\n      return;\n    }\n\n    this.#pendingDrop = target;\n    const rowTop = index * size - viewport.measureScrollOffset();\n    this.#dropIndicator.set(\n      zone === 'inside' && row.expandable\n        ? { top: rowTop, height: size, inside: true, level: row.level }\n        : {\n            top: zone === 'before' ? rowTop - 1 : rowTop + size - 1,\n            height: 2,\n            inside: false,\n            // First-child remap: the line indents one level deeper so it\n            // reads as \"will become a child\", not a sibling.\n            level: insideFirst ? row.level + 1 : row.level,\n          },\n    );\n  }\n\n  /** Hovering the make-child zone auto-expands after a delay (ROADMAP). */\n  #scheduleHoverExpand(row: DragRow<T> | null) {\n    if (this.#hoverExpand && this.#hoverExpand.key === row?.key) return;\n    if (this.#hoverExpand) {\n      clearTimeout(this.#hoverExpand.timer);\n      this.#hoverExpand = undefined;\n    }\n    if (!row || !row.expandable || row.context.isExpanded) return;\n\n    this.#hoverExpand = {\n      key: row.key,\n      timer: setTimeout(() => {\n        this.#hoverExpand = undefined;\n        this.#inputs.expand(row.node);\n      }, 600),\n    };\n  }\n\n  /**\n   * Manual edge auto-scroll: standard `cdkDropList` auto-scroll doesn't know\n   * the virtual viewport (ROADMAP). A rAF loop keeps scrolling — and keeps\n   * re-targeting rows that virtualization materializes mid-drag — while the\n   * pointer holds still inside an edge band.\n   */\n  #updateAutoScroll(clientY: number) {\n    const rect = this.#inputs\n      .viewport()\n      .elementRef.nativeElement.getBoundingClientRect();\n    const band = 32;\n    this.#autoScrollStep =\n      clientY < rect.top + band ? -8 : clientY > rect.bottom - band ? 8 : 0;\n\n    if (this.#autoScrollStep !== 0 && this.#autoScrollFrame === undefined) {\n      this.#autoScrollFrame = requestAnimationFrame(this.#autoScrollTick);\n    }\n  }\n\n  readonly #autoScrollTick = () => {\n    this.#autoScrollFrame = undefined;\n    if (!this.#drag() || this.#autoScrollStep === 0) return;\n    const viewport = this.#inputs.viewport();\n    viewport.scrollToOffset(\n      viewport.measureScrollOffset() + this.#autoScrollStep,\n    );\n    this.#updateDropTarget(this.#lastPointerY);\n    this.#autoScrollFrame = requestAnimationFrame(this.#autoScrollTick);\n  };\n\n  #clearDropTarget() {\n    this.#pendingDrop = null;\n    this.#dropIndicator.set(null);\n  }\n\n  #reset() {\n    this.#drag.set(null);\n    this.#dragCopy = false;\n    this.#dragEscapeCleanup?.();\n    this.#clearDropTarget();\n    this.#scheduleHoverExpand(null);\n    this.#autoScrollStep = 0;\n    if (this.#autoScrollFrame !== undefined) {\n      cancelAnimationFrame(this.#autoScrollFrame);\n      this.#autoScrollFrame = undefined;\n    }\n  }\n}\n","import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';\nimport {\n  afterNextRender,\n  computed,\n  effect,\n  ElementRef,\n  inject,\n  Injector,\n  Service,\n  Signal,\n  untracked,\n} from '@angular/core';\n\nimport { TreeController } from './tree-controller';\nimport { rowElement } from './tree-dom';\n\n/** Signals the host component hands over once at construction. */\nexport interface TreeFocusEngineInputs {\n  viewport: Signal<CdkVirtualScrollViewport>;\n  focusMode: Signal<'roving' | 'activedescendant'>;\n}\n\n/**\n * Controller-driven focus (ROADMAP Phase 3 decision): `focusedId` over the\n * flat model — not DOM-driven `FocusKeyManager`, which can't target rows\n * virtualization hasn't rendered. Owns the lifecycle STYLE.md assigns to an\n * engine: frame-aligned focus retry chases (Phase 8 matrix bug #4), the\n * focus-retention effect across data replacement (Phase 9), and the\n * tree-owns-focus flag behind it.\n * CDK touchpoints: `CdkVirtualScrollViewport` (`scrollToIndex`,\n * `getRenderedRange`); `afterNextRender` against this component's injector.\n */\n// autoProvided: false — this is per-tree component state, not an app-wide\n// singleton. Without it, @Service() lazily registers a root provider, and an\n// accidental inject() outside a tree would mint a broken, never-connect()ed\n// instance instead of failing fast; the component's providers list is the\n// only acquisition path.\n@Service({ autoProvided: false })\nexport class TreeFocusEngine<T = unknown> {\n  readonly #controller = inject<TreeController<T>>(TreeController);\n  readonly #injector = inject(Injector);\n  readonly #host: HTMLElement = inject(ElementRef).nativeElement;\n\n  #inputs!: TreeFocusEngineInputs;\n\n  /** Must be called exactly once, before any signal is read. */\n  connect(inputs: TreeFocusEngineInputs) {\n    this.#inputs = inputs;\n  }\n\n  /** Visible keys as a set — focus fallback + retention lookups (v2). */\n  readonly #visibleKeySet = computed(\n    () =>\n      new Set(\n        this.#controller.visibleNodes().map((visible) => visible.flat.key),\n      ),\n  );\n\n  /**\n   * Until the user moves focus — also when `focusedId` names a hidden or\n   * unknown row (bad `defaultFocusedKey`, collapsed-away ancestor) — the Tab\n   * target falls back to the first *selected* visible row (APG: a tree with a\n   * selection receives focus on it), then to the first row: the tree must\n   * never lose its Tab target.\n   */\n  readonly effectiveFocusKey = computed(() => {\n    const id = this.#controller.focusedId();\n    if (id != null && this.#visibleKeySet().has(id)) return id;\n\n    const nodes = this.#controller.visibleNodes();\n    const selected = this.#controller.selectedIds();\n\n    if (selected.size > 0) {\n      const row = nodes.find((node) => selected.has(node.flat.key));\n      if (row) return row.flat.key;\n    }\n\n    return nodes[0]?.flat.key ?? null;\n  });\n\n  constructor() {\n    // Focus retention across data replacement (v2, ROADMAP2 Phase 9): when\n    // the consumer swaps dataSource (immutable updates) or overlays change,\n    // the focused row's DOM is destroyed and browser focus silently dies.\n    // Re-attach it to the same key — or, when the key vanished (delete,\n    // move-to-trash), to the nearest survivor in the previous visible order\n    // (following first, then preceding — ends at the parent naturally).\n    effect(() => {\n      const visible = this.#controller.visibleNodes();\n      untracked(() => this.#retainFocus(visible));\n    });\n  }\n\n  /**\n   * Focus a row that may not be rendered yet: scroll it into the viewport,\n   * then focus its DOM after the next render (ROADMAP: `afterNextRender` +\n   * `data-node-id` query).\n   */\n  focusKey(key: string) {\n    this.#controller.focusedId.set(key);\n\n    const index = this.#controller\n      .visibleNodes()\n      .findIndex(({ flat }) => flat.key === key);\n    if (index < 0) return;\n    const viewport = this.#inputs.viewport();\n    const range = viewport.getRenderedRange();\n    if (index < range.start || index >= range.end)\n      viewport.scrollToIndex(index);\n\n    // activedescendant mode: DOM focus stays on the tree — aria-activedescendant\n    // (bound to focusedId) does the announcing; no per-row focus dance.\n    if (this.#inputs.focusMode() === 'activedescendant') return;\n\n    // Far jumps (End/Home, `focus()` API) race CDK's re-render: scrollToIndex\n    // materializes the target row asynchronously, so a single next-render\n    // query can miss it — focus then dies with the recycled source row\n    // (Phase 8 matrix find; jsdom's layoutless viewport can't reproduce it).\n    // Retry frame-aligned until the row DOM exists; a newer request wins.\n    this.#focusAttempt = key;\n    afterNextRender(() => this.#attemptFocus(key, 16), {\n      injector: this.#injector,\n    });\n  }\n\n  /** Keeps `focusedId` + focus ownership in sync when focus arrives via Tab or pointer. */\n  handleFocusIn(event: FocusEvent) {\n    this.#treeOwnsFocus = true;\n    const key = (event.target as HTMLElement).closest<HTMLElement>(\n      '[data-node-id]',\n    )?.dataset['nodeId'];\n    if (key != null) this.#controller.focusedId.set(key);\n  }\n\n  /**\n   * Focus-ownership bookkeeping for retention (v2). Only a focusout with a\n   * real outside destination clears the flag: when the browser drops focus\n   * because the focused row's DOM was destroyed, no event fires at all —\n   * that's exactly the orphaning retention exists to repair. Outside\n   * pointer-downs clear it too (`disownFocus`): clicking a non-focusable area\n   * emits focusout with a null relatedTarget, which is indistinguishable from\n   * destruction by events alone.\n   */\n  handleFocusOut(event: FocusEvent) {\n    const next = event.relatedTarget as HTMLElement | null;\n    if (next != null && !this.#host.contains(next)) this.#treeOwnsFocus = false;\n  }\n\n  /** An outside pointer-down means the user left the tree — retention stands down. */\n  disownFocus() {\n    this.#treeOwnsFocus = false;\n  }\n\n  #treeOwnsFocus = false;\n\n  /** Previous visible order — the neighborhood a vanished focus falls back into. */\n  #prevVisibleKeys: readonly string[] = [];\n\n  #retainFocus(visible: readonly { flat: { key: string } }[]) {\n    const keys = visible.map((entry) => entry.flat.key);\n    const prev = this.#prevVisibleKeys;\n    this.#prevVisibleKeys = keys;\n\n    if (prev.length === 0 || !this.#treeOwnsFocus) return;\n    if (this.#inputs.focusMode() === 'activedescendant') return; // DOM focus never leaves the tree\n    const focused = this.#controller.focusedId();\n    if (focused == null) return;\n\n    const current = new Set(keys);\n    let target: string | null = focused;\n    if (!current.has(focused)) {\n      const at = prev.indexOf(focused);\n      if (at < 0) return;\n      target = null;\n      for (let i = at + 1; i < prev.length && target == null; i++) {\n        if (current.has(prev[i])) target = prev[i];\n      }\n      for (let i = at - 1; i >= 0 && target == null; i--) {\n        if (current.has(prev[i])) target = prev[i];\n      }\n      if (target == null) return; // nothing survived — empty tree, no focus to keep\n    }\n\n    const key = target;\n    afterNextRender(\n      () => {\n        if (!this.#treeOwnsFocus) return;\n        const doc = this.#host.ownerDocument;\n        const active = doc.activeElement as HTMLElement | null;\n        const activeKey =\n          active?.closest<HTMLElement>('[data-node-id]')?.dataset['nodeId'];\n        // Focus survived on the right row → hands off. Anything else while we\n        // own focus is orphaning: body (row destroyed) or a recycled row\n        // element now showing a different node under the caret.\n        if (active != null && this.#host.contains(active) && activeKey === key)\n          return;\n        if (\n          active == null ||\n          active === doc.body ||\n          this.#host.contains(active)\n        ) {\n          this.focusKey(key);\n        }\n      },\n      { injector: this.#injector },\n    );\n  }\n\n  /** The focus target currently being chased across virtual re-renders. */\n  #focusAttempt: string | null = null;\n\n  #attemptFocus(key: string, retries: number) {\n    if (this.#focusAttempt !== key) return; // superseded\n    const row = rowElement(this.#host, key);\n    if (row) {\n      row.focus();\n      this.#focusAttempt = null;\n      return;\n    }\n    if (retries === 0) {\n      this.#focusAttempt = null; // row left the visible set (collapse/filter) — give up quietly\n      return;\n    }\n    requestAnimationFrame(() => this.#attemptFocus(key, retries - 1));\n  }\n}\n","import type { ListRange } from '@angular/cdk/collections';\n\nimport type { VisibleTreeNode } from './tree-controller';\n\n/**\n * Indent-guide math (ROADMAP Phase 8 \"should feel like Reddit\"). Pure — the\n * component wraps these in computeds so guides recompute only on visibility\n * changes (expand/collapse/search/data) and range changes, never on scroll.\n * CDK touchpoints: none here — `ListRange` comes from the viewport's\n * `renderedRangeStream` mirror in the component.\n */\n\n/** One expanded group's guide span over the *visible* flat array. Internal. */\nexport interface GuideGroup {\n  /** Key of the expanded parent the guide belongs to. */\n  readonly key: string;\n  readonly level: number;\n  /**\n   * First visible-row index the guide spans / the parent's LAST DIRECT child.\n   * Not the last descendant: a line dropping past its own children to end\n   * beside some deeper grandchild points at nothing — each nesting level\n   * draws its own line, so this one stops at the last row it connects.\n   */\n  readonly start: number;\n  readonly end: number;\n}\n\n/** A guide clamped to the rendered range, in content-wrapper px. Internal. */\nexport interface GuideOverlay {\n  readonly key: string;\n  readonly level: number;\n  readonly top: number;\n  readonly height: number;\n  /** True when the group's real end is rendered — the elbow may draw. */\n  readonly elbow: boolean;\n}\n\n/**\n * One guide span per expanded row with visible children, over the whole\n * visible flat array. Stack-based single pass: a row at a level ≤ an open\n * parent's closes that parent's group.\n */\nexport function computeGuideGroups(\n  rows: readonly VisibleTreeNode<unknown>[],\n): readonly GuideGroup[] {\n  const groups: GuideGroup[] = [];\n  const open: { key: string; level: number; start: number; end: number }[] = [];\n\n  const close = (until: number) => {\n    while (open.length > 0 && until <= open[open.length - 1].level) {\n      const group = open.pop()!;\n      // Expanded but childless (e.g. lazy load in flight) → no line yet.\n      if (group.end >= group.start) groups.push(group);\n    }\n  };\n\n  for (let index = 0; index < rows.length; index++) {\n    const { flat, isExpanded } = rows[index];\n    close(flat.level);\n    // Visible levels step by exactly 1 downward (a child renders only under\n    // its parent), so the innermost open group one level up IS the parent.\n    const parent = open[open.length - 1];\n    if (parent && parent.level === flat.level - 1) parent.end = index;\n    if (flat.expandable && isExpanded) {\n      open.push({\n        key: flat.key,\n        level: flat.level,\n        start: index + 1,\n        end: index,\n      });\n    }\n  }\n  close(-Infinity);\n  return groups;\n}\n\n/**\n * Guides clamped to the rendered range, in content-wrapper px — an unclamped\n * guide over 100k expanded rows would be a megapixel-tall element.\n *\n * Connector geometry: the line spans the parent row's *bottom edge* down to\n * the last direct child's row *centre* — not the first child's top to the last\n * descendant's bottom (which overshot half a row past the last child into the\n * gap before the next dedented row). The bottom-edge start keeps the line\n * visually dropping out of the parent's toggle without ever entering the\n * glyph — the toggle is consumer UI of unknown height, but it always fits\n * inside its row, so the row seam is the nearest safe anchor. At the bottom\n * the elbow turns toward the last child, terminating *at* it.\n *\n * `elbow` is false when the real last child is below the rendered window —\n * drawing the turn at the clamp edge would claim the group ends mid-scroll.\n */\nexport function clampGuideOverlays(\n  groups: readonly GuideGroup[],\n  range: ListRange,\n  itemSize: number,\n): readonly GuideOverlay[] {\n  const overlays: GuideOverlay[] = [];\n\n  for (const group of groups) {\n    const start = Math.max(group.start, range.start);\n    const end = Math.min(group.end, range.end - 1);\n    if (start > end) continue; // group entirely outside the rendered window\n    overlays.push({\n      key: group.key,\n      level: group.level,\n      top: (start - range.start) * itemSize,\n      height: (end - start + 0.5) * itemSize,\n      elbow: group.end <= range.end - 1,\n    });\n  }\n  return overlays;\n}\n","/**\n * Keyboard map (ROADMAP Phase 3 + APG optional keys). Pure interpreter:\n * `(event, context) → command union`, dispatched in the component's single\n * exhaustive `switch` — the map is testable without a DOM. RTL arrows are\n * normalized here so the map stays direction-free.\n * CDK touchpoints: none — the component samples `Directionality` and the\n * viewport's page size into the context before calling in.\n */\n\n/** Everything the key map needs to know — values, not signals or `this`. */\nexport interface TreeKeyContext {\n  readonly rtl: boolean;\n  readonly multi: boolean;\n  readonly enterAction: 'activate' | 'edit';\n  /** `selectionMode() === 'follow'` — arrow focus replaces the selection. */\n  readonly followSelection: boolean;\n  readonly hasMoveMark: boolean;\n  readonly hasSelection: boolean;\n  /** Focused row's index in the visible flat array. */\n  readonly index: number;\n  readonly rowCount: number;\n  /** Viewport rows per PageUp/Down jump, ≥ 1 (layoutless envs report 0). */\n  readonly pageStep: number;\n  readonly rowExpandable: boolean;\n  readonly rowExpanded: boolean;\n  /** The next visible row is a child of the focused one. */\n  readonly hasChildBelow: boolean;\n}\n\n/**\n * What a keypress means. Every command except `typeahead` consumes the event\n * (`preventDefault`); `null` leaves it entirely to the browser — an\n * unconsumed Escape must bubble so an enclosing dialog still closes.\n */\nexport type TreeKeyCommand =\n  | { readonly kind: 'markMove'; readonly effect: 'move' | 'copy' }\n  | { readonly kind: 'keyboardDrop'; readonly zone: 'inside' | 'after' }\n  | { readonly kind: 'selectAllVisible' }\n  | { readonly kind: 'selectToEdge'; readonly index: number }\n  | { readonly kind: 'clearMoveMark' }\n  | { readonly kind: 'clearSelection' }\n  | {\n      readonly kind: 'focusStep';\n      readonly index: number;\n      readonly extend: boolean;\n      readonly follow: boolean;\n    }\n  | { readonly kind: 'focusIndex'; readonly index: number }\n  | { readonly kind: 'expandRow' }\n  | { readonly kind: 'collapseRow' }\n  | { readonly kind: 'focusParent' }\n  | { readonly kind: 'openContextMenu' }\n  | { readonly kind: 'activate' }\n  | { readonly kind: 'beginEdit' }\n  | { readonly kind: 'toggleSelection'; readonly range: boolean }\n  /** Consume the event without acting (e.g. ArrowRight on an expanded, childless row). */\n  | { readonly kind: 'consume' }\n  | { readonly kind: 'typeahead'; readonly char: string };\n\nexport function interpretTreeKey(\n  event: KeyboardEvent,\n  ctx: TreeKeyContext,\n): TreeKeyCommand | null {\n  // Keyboard move: Ctrl+X marks a move, Ctrl+C marks a copy (v2 dropEffect),\n  // Ctrl+V drops into, Ctrl+Shift+V drops after. Multi-select (APG optional\n  // keys): Ctrl+A selects all visible (again = clear), Ctrl+Shift+Home/End\n  // range-selects to the edge and moves focus there.\n  if ((event.ctrlKey || event.metaKey) && !event.altKey) {\n    const combo = event.key.toLowerCase();\n    if (combo === 'x' || combo === 'c') {\n      return { kind: 'markMove', effect: combo === 'c' ? 'copy' : 'move' };\n    }\n    if (combo === 'v')\n      return {\n        kind: 'keyboardDrop',\n        zone: event.shiftKey ? 'after' : 'inside',\n      };\n    if (combo === 'a' && ctx.multi) return { kind: 'selectAllVisible' };\n    if (event.shiftKey && (combo === 'home' || combo === 'end') && ctx.multi) {\n      return {\n        kind: 'selectToEdge',\n        index: combo === 'home' ? 0 : ctx.rowCount - 1,\n      };\n    }\n    return null;\n  }\n\n  // Escape ladder — one layer per press: cancel move-mark, then clear the\n  // selection (Finder/Explorer; focus STAYS on the row — APG requires a\n  // visible active element).\n  if (event.key === 'Escape') {\n    if (ctx.hasMoveMark) return { kind: 'clearMoveMark' };\n    if (ctx.hasSelection) return { kind: 'clearSelection' };\n    return null;\n  }\n\n  // Normalize horizontal arrows so the switch stays direction-free (RTL\n  // flips expand/collapse — ROADMAP Phase 3).\n  const key =\n    event.key === 'ArrowRight'\n      ? ctx.rtl\n        ? 'collapse'\n        : 'expand'\n      : event.key === 'ArrowLeft'\n        ? ctx.rtl\n          ? 'expand'\n          : 'collapse'\n        : event.key;\n\n  switch (key) {\n    case 'ArrowDown':\n    case 'ArrowUp': {\n      // APG: Shift+Arrow extends the selection to the newly focused node.\n      const extend = event.shiftKey && ctx.multi;\n      return {\n        kind: 'focusStep',\n        index: key === 'ArrowDown' ? ctx.index + 1 : ctx.index - 1,\n        extend,\n        follow: !extend && ctx.followSelection,\n      };\n    }\n    case 'expand':\n      if (!ctx.rowExpandable) return null;\n      if (!ctx.rowExpanded) return { kind: 'expandRow' };\n      if (ctx.hasChildBelow)\n        return { kind: 'focusIndex', index: ctx.index + 1 };\n      return { kind: 'consume' };\n    case 'collapse':\n      return ctx.rowExpandable && ctx.rowExpanded\n        ? { kind: 'collapseRow' }\n        : { kind: 'focusParent' };\n    case 'ContextMenu':\n      // The caller's preventDefault also suppresses the browser's synthetic\n      // `contextmenu` event — no double emission with the pointer path.\n      return { kind: 'openContextMenu' };\n    case 'F10':\n      return event.shiftKey ? { kind: 'openContextMenu' } : null;\n    case 'Home':\n      return { kind: 'focusIndex', index: 0 };\n    case 'End':\n      return { kind: 'focusIndex', index: ctx.rowCount - 1 };\n    case 'PageDown':\n      return { kind: 'focusIndex', index: ctx.index + ctx.pageStep };\n    case 'PageUp':\n      return { kind: 'focusIndex', index: ctx.index - ctx.pageStep };\n    case 'Enter':\n      return ctx.enterAction === 'edit'\n        ? { kind: 'beginEdit' }\n        : { kind: 'activate' };\n    case ' ':\n      // APG Shift+Space: contiguous selection from the anchor — same range\n      // semantics as shift-click; a plain Space (or no anchor yet) toggles.\n      return { kind: 'toggleSelection', range: event.shiftKey };\n    default:\n      if (\n        event.key.length !== 1 ||\n        event.ctrlKey ||\n        event.metaKey ||\n        event.altKey\n      )\n        return null;\n      return { kind: 'typeahead', char: event.key };\n  }\n}\n\n/**\n * Type-ahead accumulator — cleared after a pause (aria-tree convention).\n * A class per STYLE.md § Feature Engines: it owns a timer, nothing else.\n */\nexport class TypeaheadBuffer {\n  #buffer = '';\n  #timer: ReturnType<typeof setTimeout> | undefined;\n\n  /** Appends a char and returns the accumulated lowercase prefix. */\n  push(char: string): string {\n    clearTimeout(this.#timer);\n    this.#buffer += char.toLowerCase();\n    this.#timer = setTimeout(() => (this.#buffer = ''), 500);\n    return this.#buffer;\n  }\n}\n\n/** Prefix match starting after `index`, wrapping over the whole array. */\nexport function typeaheadTarget<R>(\n  rows: readonly R[],\n  index: number,\n  prefix: string,\n  textOf: (row: R) => string,\n): R | null {\n  for (let offset = 1; offset <= rows.length; offset++) {\n    const candidate = rows[(index + offset) % rows.length];\n    if (textOf(candidate).toLowerCase().startsWith(prefix)) return candidate;\n  }\n  return null;\n}\n","import { CdkContextMenuTrigger } from '@angular/cdk/menu';\nimport { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';\nimport {\n  afterNextRender,\n  DestroyRef,\n  ElementRef,\n  inject,\n  Injector,\n  Service,\n  signal,\n  Signal,\n  TemplateRef,\n} from '@angular/core';\n\nimport { TreeContextMenuContext } from './tree-context-menu';\nimport { TreeController } from './tree-controller';\nimport { TreeFocusEngine } from './tree-focus-engine';\n\n/** Signals the host component hands over once at construction. */\nexport interface TreeMenuHostInputs {\n  viewport: Signal<CdkVirtualScrollViewport>;\n  /** The `cdkMenu` shell wrapping the projected `treeContextMenu` items. */\n  shell: Signal<TemplateRef<unknown>>;\n}\n\n/**\n * Built-in context-menu mechanics (ROADMAP Phase 7/8): arming the\n * `CdkContextMenuTrigger` host directive per event, the `_open` quarantine,\n * focus hand-off into the menu, Escape containment (matrix bug #2),\n * close-on-scroll (settled), and the close-time focus reclaim (matrix bugs\n * #3 + #7). Owns the lifecycle: trigger subscriptions, the outside-pointer\n * tracker, and the suppress/closed-by-pointer flags between them.\n * CDK touchpoints: `CdkContextMenuTrigger` (incl. the internal `_open` —\n * the single quarantined cast), overlay container DOM, viewport\n * `elementScrolled` for close-on-scroll.\n * Selection reconciliation and `contextRequested` stay in the component —\n * they are intent, not menu mechanics.\n */\n@Service({ autoProvided: false })\nexport class TreeMenuHost<T = unknown> {\n  readonly #controller = inject<TreeController<T>>(TreeController);\n  readonly #focus = inject<TreeFocusEngine<T>>(TreeFocusEngine);\n  readonly #injector = inject(Injector);\n  readonly #destroyRef = inject(DestroyRef);\n  readonly #host: HTMLElement = inject(ElementRef).nativeElement;\n\n  /** The built-in menu's trigger (host directive) — armed per-event by `open`. */\n  readonly #trigger = inject(CdkContextMenuTrigger, { self: true });\n\n  /** Scroll-dismiss must not reclaim focus (it would scroll right back). */\n  #suppressFocusRestore = false;\n\n  /** An outside pointer-down closed the menu — the click target keeps focus. */\n  #closedByPointer = false;\n  #pointerCleanup: (() => void) | null = null;\n\n  /** Context handed to the projected treeContextMenu template. */\n  readonly #context = signal<TreeContextMenuContext<T> | null>(null);\n  readonly context = this.#context.asReadonly();\n\n  constructor() {\n    // Disabled at rest: `open` un-gates it only for its own synchronous\n    // call, so CDK's own contextmenu listener can't open a stale menu on an\n    // empty-space click, and every open funnels through the tree.\n    this.#trigger.disabled = true;\n  }\n\n  /** Must be called exactly once, from the component's constructor. */\n  connect(inputs: TreeMenuHostInputs) {\n    // afterNextRender, not an effect: viewChild.required throws before the\n    // first render, and effects can run that early.\n    afterNextRender(\n      () => {\n        this.#trigger.menuTemplateRef = inputs.shell();\n\n        // Close-on-scroll (settled): under virtualization the anchor row's DOM\n        // is destroyed when it leaves the render range — repositioning would\n        // track a recycled element. Focus restore is suppressed here: pulling\n        // focus back to the row would `scrollToIndex` straight back against\n        // the user's scroll.\n        const scrollSubscription = inputs\n          .viewport()\n          .elementScrolled()\n          .subscribe(() => {\n            if (!this.#trigger.isOpen()) return;\n            this.#suppressFocusRestore = true;\n            this.#trigger.close();\n            this.#suppressFocusRestore = false;\n          });\n\n        // Menu close hands focus back to the row (matrix: \"restores focus to\n        // the row on close\") — CDK restores to its trigger host, which is the\n        // tree element, not the roving-tabindex row. Microtask: teardown must\n        // finish first. Two guards: outside-pointer closes keep the user's\n        // click target (tracked in `open`), and an element the close\n        // genuinely focused (e.g. rename's edit input) wins — only orphaned\n        // focus is reclaimed. \"Orphaned\" includes tabindex:-1 containers: a\n        // MatDialog focus trap re-anchors to its container when the menu DOM\n        // vanishes, and leaving focus there strands keyboard users.\n        const closedSubscription = this.#trigger.closed.subscribe(() => {\n          this.#pointerCleanup?.();\n          if (this.#suppressFocusRestore || this.#closedByPointer) return;\n          const key = this.#controller.focusedId();\n          if (key == null) return;\n          queueMicrotask(() => {\n            // A menu item that began a rename owns the hand-off: the edit input\n            // mounts on the NEXT render, invisible to the orphan check below —\n            // reclaiming the row would blur the input the moment it autofocuses,\n            // and blur commits: the rename dies untouched before the user types\n            // (matrix bug #7).\n            if (this.#controller.editingId() != null) return;\n            const active = this.#host.ownerDocument\n              .activeElement as HTMLElement | null;\n            const orphaned =\n              active == null ||\n              active === this.#host.ownerDocument.body ||\n              active.tabIndex < 0;\n            if (orphaned) this.#focus.focusKey(key);\n          });\n        });\n\n        this.#destroyRef.onDestroy(() => {\n          scrollSubscription.unsubscribe();\n          closedSubscription.unsubscribe();\n          this.#pointerCleanup?.(); // destroy with the menu still open\n        });\n      },\n      { injector: this.#injector },\n    );\n  }\n\n  /** Context for the projected items — set by the component before `open`. */\n  setContext(context: TreeContextMenuContext<T>) {\n    this.#context.set(context);\n  }\n\n  /**\n   * Opens the built-in menu at `at`. `userEvent` (the triggering\n   * `contextmenu`, or `null` for keyboard/API) is threaded into CDK's\n   * `_open` so the outside-click stream skips the gesture's own trailing\n   * pointer event — the public `open()` omits it and the menu self-closes\n   * (the flicker).\n   *\n   * `_open` is CDK-internal (no public coordinate+event overload) — the\n   * single quarantined boundary here.\n   */\n  open(userEvent: MouseEvent | null, at: { x: number; y: number }) {\n    const trigger = this.#trigger as unknown as {\n      _open(\n        event: MouseEvent | null,\n        coordinates: { x: number; y: number },\n      ): void;\n    };\n    this.#trigger.disabled = false;\n    try {\n      trigger._open(userEvent, at);\n    } finally {\n      // finally: a throw out of the CDK-internal _open (a version bump away)\n      // must not leave the trigger armed — its own contextmenu listener would\n      // then open stale menus on empty-space clicks. Never closes an open menu.\n      this.#trigger.disabled = true;\n    }\n\n    // CDK's context trigger leaves focus on the row — in a real browser the\n    // menu then ignores Escape and arrow keys until clicked (Phase 8 matrix\n    // find; jsdom couldn't see it). Mouse opens focus the shell (Escape +\n    // arrow entry work, no item pre-highlight — OS menu behavior);\n    // keyboard/API opens land on the first item (APG menu pattern). Overlay\n    // attach is synchronous, so the menu DOM exists here; last match wins if\n    // several trees render menus into the shared overlay container.\n    const menus = this.#host.ownerDocument.querySelectorAll<HTMLElement>(\n      '.cdk-overlay-container .tree-menu',\n    );\n    const menu = menus.item(menus.length - 1);\n    if (!menu) return;\n    if (userEvent) menu.focus();\n    else (menu.querySelector<HTMLElement>('[cdkmenuitem]') ?? menu).focus();\n\n    // One Escape, one layer (OS menus): CdkMenu handles Escape on the menu\n    // element itself, but the event then bubbles to the document where the\n    // overlay keyboard dispatcher hands it to the *dialog* hosting the tree —\n    // both close on a single keypress. stopPropagation here still lets\n    // CdkMenu's same-element listener run; the listener dies with the menu\n    // DOM on close.\n    menu.addEventListener('keydown', (event) => {\n      if (event.key === 'Escape') event.stopPropagation();\n    });\n\n    // Track whether the eventual close comes from an outside pointer-down —\n    // then the user's click target keeps focus and the close handler must\n    // not reclaim it for the row. Capture phase: CDK's own outside-click\n    // close runs on the same event.\n    this.#closedByPointer = false;\n    this.#pointerCleanup?.();\n    const doc = this.#host.ownerDocument;\n    const onPointerDown = (event: PointerEvent) => {\n      if (!(event.target as HTMLElement | null)?.closest('.tree-menu')) {\n        this.#closedByPointer = true;\n      }\n    };\n    doc.addEventListener('pointerdown', onPointerDown, true);\n    this.#pointerCleanup = () => {\n      doc.removeEventListener('pointerdown', onPointerDown, true);\n      this.#pointerCleanup = null;\n    };\n  }\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\n/** What a `treeContextMenu` template receives — act on `ids`, branch on the node. */\nexport interface TreeContextMenuContext<T> {\n  /** The clicked / focused node. */\n  $implicit: T;\n  /** Alias of `$implicit` for `let-node=\"node\"` readers. */\n  node: T;\n  /** Post-reconciliation selection as nodes — what the menu should act on. */\n  nodes: readonly T[];\n  /** …the same selection as keys. */\n  ids: readonly string[];\n  /** Where the menu opened (pointer, or the focused row's rect for keyboard). */\n  position: { x: number; y: number };\n}\n\n/**\n * Declares the tree's built-in context menu content (ROADMAP settled\n * 2026-07-06): the consumer projects menu *items*; the tree owns the\n * mechanics — trigger, positioning, keyboard access, close-on-scroll, and a\n * `cdkMenu` shell wrapping this template (so `cdkMenuItem` children get menu\n * keyboard navigation for free).\n *\n * ```html\n * <ng-template treeContextMenu let-node let-ids=\"ids\">\n *   @switch (node.kind) { … }\n * </ng-template>\n * ```\n */\n@Directive({\n  selector: 'ng-template[treeContextMenu]',\n})\nexport class TreeContextMenu<T> {\n  readonly template =\n    inject<TemplateRef<TreeContextMenuContext<T>>>(TemplateRef);\n\n  static ngTemplateContextGuard<T>(\n    _directive: TreeContextMenu<T>,\n    context: unknown,\n  ): context is TreeContextMenuContext<T> {\n    return true;\n  }\n}\n","import { Directive, inject, input, TemplateRef } from '@angular/core';\n\nimport type { TreeNodeContext } from './types';\n\n/**\n * Declares a node template. Multiple defs may coexist; the first whose `when`\n * predicate matches wins, and a def without `when` is the fallback (Material\n * `matTreeNodeDef` convention).\n *\n * When `when` is a type guard, the template context narrows to the guarded\n * union member under `strictTemplates`:\n *\n * ```html\n * <ng-template treeNodeDef [treeNodeDefWhen]=\"isFolder\" let-node>\n *   <!-- node is FolderNode here -->\n * </ng-template>\n * ```\n *\n * `S` defaults to `any` (not `unknown`) so guard-less fallback defs stay\n * usable — same trade-off CDK Table makes. Phase 0 spike, see ROADMAP.md.\n */\n@Directive({ selector: '[treeNodeDef]' })\nexport class TreeNodeDef<T = any, S extends T = T> {\n  readonly template = inject<TemplateRef<TreeNodeContext<S>>>(TemplateRef);\n\n  /** Type-guard predicate selecting which nodes this template renders. */\n  readonly when = input<((node: T) => node is S) | undefined>(undefined, {\n    alias: 'treeNodeDefWhen',\n  });\n\n  static ngTemplateContextGuard<T, S extends T>(\n    _dir: TreeNodeDef<T, S>,\n    _ctx: unknown,\n  ): _ctx is TreeNodeContext<S> {\n    return true;\n  }\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\n/**\n * Content for the tree's **empty state** — shown when there are zero visible\n * rows (no data, or search filtered everything out). The tree owns the slot;\n * the consumer projects the message. Absent by default → the tree renders\n * nothing (sensible blank default).\n *\n * The template lives in the consumer's component, so it already has their own\n * state in scope (e.g. a `search()` signal to say \"no results for …\" vs\n * \"no items\") — hence no template context.\n *\n * ```html\n * <ng-template treeEmptyDef>No documents yet.</ng-template>\n * ```\n */\n@Directive({\n  selector: 'ng-template[treeEmptyDef]',\n})\nexport class TreeEmptyDef {\n  readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n}\n\n/**\n * Content for the tree's **root-loading state** — shown while the consumer's\n * `[loading]` input is `true` (the whole `dataSource` is being fetched; this\n * is distinct from a lazy *child* load, which drives per-row `isLoading`).\n * Takes precedence over the empty state. Absent by default → nothing.\n *\n * ```html\n * <ng-template treeLoadingDef><mat-spinner /></ng-template>\n * ```\n */\n@Directive({\n  selector: 'ng-template[treeLoadingDef]',\n})\nexport class TreeLoadingDef {\n  readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n}\n","import { InjectionToken } from '@angular/core';\nimport type { Signal } from '@angular/core';\nimport type { Observable } from 'rxjs';\n\n/** Tri-state of a row under `checkboxSelection` (ARIA checkbox-tree pattern). */\nexport type CheckState = 'checked' | 'unchecked' | 'indeterminate';\n\n/**\n * Template context for `treeNodeDef`. `S` narrows to the union member matched\n * by a type-guard `when` predicate (Phase 0 spike, see ROADMAP.md).\n */\nexport interface TreeNodeContext<S> {\n  $implicit: S;\n  /** The node's `expansionKey` — parity with PrimeNG/jsTree templates (v2). */\n  key: string;\n  /** Zero-based depth in the flattened model. */\n  level: number;\n  /** Whether the node reports children via `childrenAccessor`. */\n  expandable: boolean;\n  isExpanded: boolean;\n  /** Index within the visible flat array. */\n  index: number;\n  /** Row is in the selection set (checkbox or ctrl/shift semantics). */\n  isSelected: boolean;\n  /** Row is being renamed — consumer renders its input (tree owns state only). */\n  isEditing: boolean;\n  /** Async `childrenAccessor` in flight for this node. */\n  isLoading: boolean;\n  /** Async `childrenAccessor` rejected — pair with `tree.retryChildren(node)`. */\n  hasError: boolean;\n  /**\n   * Tri-state under `checkboxSelection` — drives the icon-as-checkbox swap\n   * (icon while `'unchecked'`, checkbox visual otherwise) in consumer templates.\n   */\n  checkState: CheckState;\n}\n\n/**\n * Per-row handle injected into node content (e.g. `treeNodeToggle`).\n * Row-scoped counterpart to the tree-level `TreeApi`.\n */\nexport interface TreeNodeHandle {\n  readonly expandable: boolean;\n  /** Per-row signals: equality stops propagation — DOM updates stay O(visible). */\n  readonly isSelected: Signal<boolean>;\n  readonly checkState: Signal<CheckState>;\n  toggle(): void;\n  /**\n   * Cascades over the loaded subtree when `checkboxSelection` is on.\n   * `range = true` (Shift+checkbox, v2): additive range from the selection\n   * anchor over visible order instead of a toggle.\n   */\n  toggleSelection(range?: boolean): void;\n  /** Starts inline rename (respects `disableEdit`) — the row-scoped `edit()`. */\n  beginEdit(): void;\n  /** Ends editing and emits the `renamed` intent (no-op unless editing). */\n  commitEdit(name: string): void;\n  /** Ends editing without emitting. */\n  cancelEdit(): void;\n}\n\n/** DI token providing the row's {@link TreeNodeHandle} to content directives. */\nexport const TREE_NODE = new InjectionToken<TreeNodeHandle>('TREE_NODE');\n\n/**\n * Accessor contracts (Material `CdkTree` pattern — no forced node shape).\n * An async return (`Promise`/`Observable`) marks the node lazy: the tree sets\n * `isLoading` in the row context until it resolves (ROADMAP Phase 3).\n *\n * **Remote children: return a COLD `Observable` (`defer`), not a `Promise`.**\n * The tree also *probes* the accessor while flattening — once per loaded node,\n * expanded or not — just to learn expandability. A `Promise` starts its fetch\n * at probe time (one request per visible branch before any expand); an\n * `Observable` is only subscribed on expand intent, so probing stays free.\n *\n * Cancellation (v2) is opt-in by declaring the second parameter: accessors\n * written as `(node, signal) => fetch(url, { signal })` get an `AbortSignal`\n * the tree aborts on destroy and on `invalidateChildren` while in flight\n * (incl. collapse under `collapseBehavior: 'invalidate'`). Single-parameter\n * accessors are detected via `Function.length` and skip the allocation —\n * note that default/rest parameters reduce `length` and would opt out too.\n */\nexport type TreeChildrenAccessor<T> = (\n  node: T,\n  signal?: AbortSignal,\n) =>\n  | readonly T[]\n  | null\n  | undefined\n  | Promise<readonly T[]>\n  | Observable<readonly T[]>;\nexport type TreeExpansionKey<T> = (node: T) => string;\n\n/** Argument to the `disableDrop` predicate (Phase 4 three-zone drop math). */\nexport interface TreeDropContext<T> {\n  readonly dragNodes: readonly T[];\n  /** `null` = root level. */\n  readonly parentNode: T | null;\n  readonly index: number;\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { LiveAnnouncer } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport {\n  CdkDrag,\n  CdkDragMove,\n  CdkDragPreview,\n  CdkDropList,\n} from '@angular/cdk/drag-drop';\nimport { CdkContextMenuTrigger, CdkMenu } from '@angular/cdk/menu';\nimport {\n  CdkVirtualScrollViewport,\n  ScrollingModule,\n} from '@angular/cdk/scrolling';\nimport {\n  afterNextRender,\n  Component,\n  computed,\n  contentChild,\n  contentChildren,\n  DestroyRef,\n  effect,\n  ElementRef,\n  inject,\n  Injector,\n  input,\n  model,\n  output,\n  Signal,\n  signal,\n  TemplateRef,\n  TrackByFunction,\n  untracked,\n  viewChild,\n} from '@angular/core';\nimport type { ListRange } from '@angular/cdk/collections';\n\nimport type {\n  ContextRequestedEvent,\n  LoadChildrenEvent,\n  MoveEvent,\n  RenameEvent,\n  SelectCause,\n  SelectEvent,\n  ToggleEvent,\n  TreeAnnouncements,\n} from './events';\nimport { LoadResult, TreeController } from './tree-controller';\nimport { rowElement } from './tree-dom';\nimport { TreeDragSession } from './tree-drag-session';\nimport { TreeFocusEngine } from './tree-focus-engine';\nimport {\n  clampGuideOverlays,\n  computeGuideGroups,\n  GuideOverlay,\n} from './tree-guides';\nimport {\n  interpretTreeKey,\n  TypeaheadBuffer,\n  typeaheadTarget,\n} from './tree-keyboard';\nimport { TreeMenuHost } from './tree-menu-host';\nimport { TreeContextMenu } from './tree-context-menu';\nimport { TreeNodeDef } from './tree-node-def';\nimport { TreeEmptyDef, TreeLoadingDef } from './tree-state-def';\nimport {\n  TREE_NODE,\n  TreeChildrenAccessor,\n  TreeDropContext,\n  TreeExpansionKey,\n  TreeNodeContext,\n  TreeNodeHandle,\n} from './types';\n\n/** DOM-id mint for aria-activedescendant (static #private + decorators = TS18036). */\nlet nextTreeUid = 0;\n\n/** One entry of the visible flat render array. Internal. */\ninterface FlatRow<T> {\n  readonly node: T;\n  readonly key: string;\n  readonly level: number;\n  readonly expandable: boolean;\n  readonly setSize: number;\n  readonly posInSet: number;\n  /** Roving tabindex: 0 on the (effective) focused row, -1 elsewhere. */\n  readonly tabIndex: Signal<number>;\n  /** Row is marked by Ctrl+X, awaiting a keyboard drop. */\n  readonly moveSource: Signal<boolean>;\n  /** Tri-state for `aria-checked` under `checkboxSelection`. */\n  readonly checkState: Signal<'checked' | 'unchecked' | 'indeterminate'>;\n  readonly dragDisabled: boolean;\n  readonly context: TreeNodeContext<T>;\n  readonly injector: Injector;\n}\n\n/**\n * Virtualized tree. Consumer data stays untouched — `childrenAccessor` +\n * `expansionKey` describe it (Material `CdkTree` pattern). Rendering is a flat\n * virtual list (react-arborist internals); all state lives in the internal\n * `TreeController` (one source of truth, no event bubbling). See ROADMAP.md.\n */\n@Component({\n  selector: 'angular-tree',\n  exportAs: 'angularTree',\n  imports: [\n    ScrollingModule,\n    NgTemplateOutlet,\n    CdkDrag,\n    CdkDragPreview,\n    CdkDropList,\n    CdkMenu,\n  ],\n  providers: [TreeController, TreeFocusEngine, TreeMenuHost, TreeDragSession],\n  hostDirectives: [CdkContextMenuTrigger],\n  host: {\n    '[style.--tree-row-height]': 'itemSize() + \"px\"',\n    '[attr.data-label-overflow]':\n      \"labelOverflow() === 'ellipsis' ? 'ellipsis' : null\",\n  },\n  templateUrl: './angular-tree.html',\n  styleUrl: './angular-tree.scss',\n})\nexport class AngularTree<T> {\n  readonly #injector = inject(Injector);\n  readonly #controller = inject<TreeController<T>>(TreeController);\n  readonly #focus = inject<TreeFocusEngine<T>>(TreeFocusEngine);\n\n  /** Roots of the nested consumer data. The consumer owns it (controlled). */\n  readonly dataSource = input.required<readonly T[]>();\n\n  /** Returns a node's children; `null`/`undefined` marks a leaf, async = lazy. */\n  readonly childrenAccessor = input.required<TreeChildrenAccessor<T>>();\n\n  /** Stable string key per node — expansion, trackBy, DOM marking. */\n  readonly expansionKey = input.required<TreeExpansionKey<T>>();\n\n  /** Fixed row height in px — required for virtualization. */\n  readonly itemSize = input(32);\n\n  /** Keys expanded on first render; inert while `[expandedKeys]` is bound. */\n  readonly defaultExpandedKeys = input<readonly string[]>([]);\n\n  /**\n   * Controlled expansion over node keys (v2, Phase 15 — supersedes the\n   * `expandedKeys()` snapshot method). Unbound (`undefined`) = the tree owns\n   * expansion state (seeded by `defaultExpandedKeys`). Bound: external value\n   * changes replace the expansion set (set-equality guarded — write-backs\n   * never echo) and `defaultExpandedKeys` is inert; every tree-initiated\n   * expansion write (toggle, expandAll/collapseAll, expandDescendants,\n   * setExpanded) updates the model → `(expandedKeysChange)`. `(toggled)`\n   * stays the per-node intent; this is the whole-set state channel.\n   *\n   * A key naming a lazy, not-yet-loaded node counts as load intent (decision\n   * 14): the reconciler runs the accessor exactly as a toggle would, so\n   * restores and external writes never render aria-expanded over nothing.\n   */\n  expandedKeys = model<readonly string[] | undefined>(undefined);\n\n  /** Initial roving-tabindex target (v2) — unknown keys fall back to row 1. */\n  readonly defaultFocusedKey = input<string | undefined>(undefined);\n\n  /**\n   * What collapse does to a lazy node's resolved children (v2): `'keep'`\n   * reuses them on re-expand; `'invalidate'` marks them stale and aborts an\n   * in-flight load — the next expand shows the stale children immediately\n   * while the accessor re-runs and swaps them (decision 15).\n   */\n  readonly collapseBehavior = input<'keep' | 'invalidate'>('keep');\n\n  /**\n   * Declarative children-cache invalidation (v2, Phase 15 — mirrors\n   * `resource({ params })`): bind the parameters your `childrenAccessor`\n   * reads (filters, refs, locale). Whenever the value changes (reference\n   * equality, like any input), the tree behaves exactly like\n   * `invalidateChildren()` — resolved children go stale (kept on screen\n   * until their replacement resolves, decision 15), in-flight loads abort,\n   * expanded nodes re-run the accessor now, collapsed ones on their next\n   * expand — so a cached child list can never outlive the parameters it was\n   * fetched with. The tree still never fetches; it only re-asks YOUR accessor.\n   */\n  readonly childrenDeps = input<unknown>(undefined);\n\n  /**\n   * Controlled selection over node keys (v2, Phase 15). Unbound\n   * (`undefined`) = the tree owns selection state internally. Bound:\n   * external value changes replace the selection (set-equality guarded, so\n   * writing our own emission back never echoes); tree interactions — which\n   * the tree drives, only it knows the visible flat order — update the model\n   * → `(selectedKeysChange)`. `[(selectedKeys)]` shares state; one-way\n   * `[selectedKeys]` + write-back is the strictly controlled shape.\n   */\n  selectedKeys = model<readonly string[] | undefined>(undefined);\n\n  /** Multi-selection (naming aligned with `@angular/aria/tree`). */\n  readonly multi = input(false);\n\n  /**\n   * Clear the selection when the user clicks outside any row — empty viewport\n   * space or outside the tree (file-manager semantics). Clicks inside CDK\n   * overlays (context menu, dialogs) never clear: their actions operate ON\n   * the selection. Turn off when a toolbar outside the tree acts on the\n   * selection, or manage clearing yourself.\n   */\n  readonly deselectOnOutsideClick = input(true);\n\n  /** Cascade checkbox semantics over *loaded* nodes (ROADMAP settled). */\n  readonly checkboxSelection = input(false);\n\n  /** Matching child keeps its ancestor chain visible (react-arborist behavior). */\n  readonly searchTerm = input('');\n\n  /** Required for search — `T` has no shape to match against (ROADMAP settled). */\n  readonly searchMatch = input<\n    ((node: T, term: string) => boolean) | undefined\n  >(undefined);\n\n  /** Required for type-ahead — same rationale as `searchMatch`; inert without it. */\n  readonly typeaheadText = input<((node: T) => string) | undefined>(undefined);\n\n  /** What Enter does on the focused row. */\n  readonly enterAction = input<'activate' | 'edit'>('activate');\n\n  /**\n   * Accessible name for the `role=\"tree\"` element (APG: a tree MUST be\n   * labelled). Forwarded to the internal viewport — the role doesn't sit on\n   * the host, so a plain host attribute would be invisible to AT. Prefer\n   * `aria-labelledby` pointing at a visible heading; `aria-label` otherwise.\n   */\n  readonly ariaLabel = input<string | undefined>(undefined, {\n    alias: 'aria-label',\n  });\n\n  /** id of a visible element labelling the tree — wins over `aria-label`. */\n  readonly ariaLabelledby = input<string | undefined>(undefined, {\n    alias: 'aria-labelledby',\n  });\n\n  /**\n   * What a plain row click does (v2, reopened v1 lock — ROADMAP2 decisions\n   * table). `'activate'` (default, v1 behavior): click activates, selection\n   * only via checkbox/Ctrl/Shift. `'select'`: file-manager semantics — click\n   * replaces the selection with the row, double-click activates. Ctrl/Shift\n   * power shortcuts are identical in both modes.\n   */\n  readonly clickAction = input<'activate' | 'select'>('activate');\n\n  /**\n   * Screen-reader messages for moves, lazy-load outcomes, and search result\n   * counts (v2) — announced politely via CDK `LiveAnnouncer`, so the tree\n   * ships no live-region DOM. Omitted = terse English defaults; partial\n   * objects override per message; `null` silences everything.\n   */\n  readonly announcements = input<TreeAnnouncements<T> | null | undefined>(\n    undefined,\n  );\n\n  /** `'follow'` = selection tracks focus (aria alignment); default explicit. */\n  readonly selectionMode = input<'explicit' | 'follow'>('explicit');\n\n  /**\n   * `'activedescendant'` keeps DOM focus on the tree and points\n   * `aria-activedescendant` at the focused row — the virtualization-friendly\n   * mode (no focus loss when the focused row's DOM is recycled).\n   */\n  readonly focusMode = input<'roving' | 'activedescendant'>('roving');\n\n  /** One guide line per ancestor level; clicking a guide collapses that group. */\n  readonly indentGuides = input(false);\n\n  /**\n   * How rows behave when a nowrap label outgrows the viewport. Under `'scroll'`\n   * (default) the scroll content grows to the widest row — CDK's content\n   * wrapper shrink-wraps, its `min-width: 100%` is only a floor — so the tree\n   * scrolls horizontally and a consumer `text-overflow: ellipsis` never\n   * engages (the label never meets an edge). `'ellipsis'` caps rows at the\n   * visible viewport width so consumer label truncation works; horizontal\n   * scrolling is gone in that mode, so deep trees with wide rows should stay\n   * on `'scroll'`. The label CSS itself (`overflow: hidden; text-overflow:\n   * ellipsis; white-space: nowrap; min-inline-size: 0`) is the consumer's.\n   */\n  readonly labelOverflow = input<'scroll' | 'ellipsis'>('scroll');\n\n  /**\n   * Root-level load in flight — shows the projected `treeLoadingDef` over the\n   * tree. Consumer-driven (the data is controlled); distinct from a lazy\n   * *child* load, which drives per-row `isLoading`.\n   */\n  readonly loading = input(false);\n\n  /**\n   * Per-node classes for the tree-owned row element (v2, Phase 15 — accessor\n   * -shaped like the behavior predicates). Def content renders *inside* the\n   * row, so consumer templates can't reach it; this can. Row element only —\n   * never the guide overlays (a row-designed class would wreck them).\n   */\n  readonly rowClass = input<\n    ((node: T) => string | readonly string[] | undefined) | undefined\n  >(undefined);\n\n  /**\n   * Per-node inline styles for the row element (v2, Phase 15) — the custom-\n   * property hook: `--tree-*` chains resolve at point of use, so returning\n   * e.g. `{ '--tree-guide': node.color }` retunes tokens per node. The GROUP\n   * PARENT's result is additionally applied to that group's indent-guide\n   * overlay — guides are siblings of rows, not children, so row-applied\n   * variables can never reach them on their own. `height` stays the tree's\n   * (fixed-row virtualization is a locked contract).\n   */\n  readonly rowStyle = input<\n    ((node: T) => Record<string, string> | undefined) | undefined\n  >(undefined);\n\n  /// Behavior per type via predicates — the tree never interprets a type field.\n  readonly disableDrag = input<((node: T) => boolean) | undefined>(undefined);\n  readonly disableDrop = input<\n    ((ctx: TreeDropContext<T>) => boolean) | undefined\n  >(undefined);\n  readonly disableEdit = input<((node: T) => boolean) | undefined>(undefined);\n  readonly isSelectable = input<((node: T) => boolean) | undefined>(undefined);\n\n  /// Intent outputs — the consumer applies them to its own data (controlled).\n\n  /** Plain row click = activate; never mutates selection (Gmail semantics). */\n  readonly activated = output<T>();\n\n  /** Drop completed (Phase 4). */\n  readonly moved = output<MoveEvent<T>>();\n\n  /** Inline edit committed (Phase 3). */\n  readonly renamed = output<RenameEvent<T>>();\n\n  /** Selection set changed through tree interaction. */\n  readonly selectionChange = output<SelectEvent<T>>();\n\n  /** Node expanded or collapsed. */\n  readonly toggled = output<ToggleEvent<T>>();\n\n  /** Async `childrenAccessor` resolved or rejected (Phase 3). */\n  readonly childrenLoaded = output<LoadChildrenEvent<T>>();\n\n  /** Right-click / ContextMenu key / Shift+F10 (Phase 7). */\n  readonly contextRequested = output<ContextRequestedEvent<T>>();\n\n  // TS-private, not #private: Angular query members must be compiler-visible (NG1053).\n  private readonly defs = contentChildren<TreeNodeDef<T, T>>(TreeNodeDef);\n  private readonly viewport = viewChild.required(CdkVirtualScrollViewport);\n  protected readonly contextMenuDef =\n    contentChild<TreeContextMenu<T>>(TreeContextMenu);\n  private readonly contextMenuShell =\n    viewChild.required<TemplateRef<unknown>>('contextMenuShell');\n  private readonly emptyDef = contentChild(TreeEmptyDef);\n  private readonly loadingDef = contentChild(TreeLoadingDef);\n\n  readonly #dir = inject(Directionality);\n  readonly #host: HTMLElement = inject(ElementRef).nativeElement;\n\n  /** Menu mechanics live in the engine (tree-menu-host.ts). */\n  readonly #menu = inject<TreeMenuHost<T>>(TreeMenuHost);\n\n  /** Context handed to the projected treeContextMenu template. */\n  protected readonly contextMenuContext = this.#menu.context;\n\n  /** Gmail-style icon↔checkbox swap driver — reactive via the bridged mirror. */\n  readonly selectionActive = computed(\n    () => this.#controller.selectedIds().size > 0,\n  );\n\n  /** Type-ahead accumulator (tree-keyboard.ts) — cleared after a pause. */\n  readonly #typeahead = new TypeaheadBuffer();\n\n  // ---------------------------------------------------------------------------\n  // Drag & drop (Phase 4) — session lifecycle lives in tree-drag-session.ts\n  // ---------------------------------------------------------------------------\n\n  readonly #dnd = inject<TreeDragSession<T>>(TreeDragSession);\n\n  protected readonly dragStartDelay = this.#dnd.dragStartDelay;\n  protected readonly dragCount = this.#dnd.dragCount;\n  protected readonly dropIndicator = this.#dnd.dropIndicator;\n\n  // ---------------------------------------------------------------------------\n  // ARIA (Phase 6)\n  // ---------------------------------------------------------------------------\n\n  /** Minted once (STYLE.md) — prefixes row DOM ids for aria-activedescendant. */\n  readonly #uid = `angular-tree-${nextTreeUid++}`;\n\n  /** Range-selection anchor: the last explicitly selected row. */\n  #selectionAnchor: string | null = null;\n\n  protected rowId(key: string): string {\n    // encodeURIComponent keeps ids unique + free of spaces/quotes for any key.\n    return `${this.#uid}-${encodeURIComponent(key)}`;\n  }\n\n  protected readonly activeDescendantId = computed(() => {\n    const key = this.#focus.effectiveFocusKey();\n    return key != null ? this.rowId(key) : null;\n  });\n\n  readonly #destroyRef = inject(DestroyRef);\n\n  /**\n   * Mirror of the viewport's rendered range — the guide overlays live in the\n   * scroll content and must be clamped to it (an unclamped guide over 100k\n   * expanded rows would be a megapixel-tall element).\n   */\n  readonly #renderedRange = signal<ListRange>({ start: 0, end: 0 });\n\n  constructor() {\n    // afterNextRender, not an effect: viewChild.required throws before the\n    // first render, and effects can run that early.\n    afterNextRender(() => {\n      const viewport = this.viewport();\n      this.#renderedRange.set(viewport.getRenderedRange());\n      const subscription = viewport.renderedRangeStream.subscribe((range) =>\n        this.#renderedRange.set(range),\n      );\n      this.#destroyRef.onDestroy(() => subscription.unsubscribe());\n    });\n    this.#menu.connect({\n      viewport: this.viewport,\n      shell: this.contextMenuShell,\n    });\n    this.#dnd.connect({\n      viewport: this.viewport,\n      itemSize: this.itemSize,\n      rows: this.visibleRows,\n      disableDrop: this.disableDrop,\n      expand: (node) => this.expand(node),\n      drop: (event) => {\n        this.moved.emit(event);\n        this.#announce((messages) => messages.moved?.(event));\n      },\n    });\n\n    this.#controller.connect({\n      dataSource: this.dataSource,\n      childrenAccessor: this.childrenAccessor,\n      expansionKey: this.expansionKey,\n      defaultExpandedKeys: this.defaultExpandedKeys,\n      defaultFocusedKey: this.defaultFocusedKey,\n      expandedKeys: this.expandedKeys,\n      selectedKeys: this.selectedKeys,\n      searchTerm: this.searchTerm,\n      searchMatch: this.searchMatch,\n    });\n    this.#focus.connect({ viewport: this.viewport, focusMode: this.focusMode });\n    // In-flight accessor fetches must not outlive the tree (v2 cancellation).\n    this.#destroyRef.onDestroy(() => this.#controller.abortAll());\n\n    // ONE document listener, two duties (cheapest possible outside-click\n    // handling — no per-row listeners, no effects):\n    // 1. Focus-ownership: an outside pointer-down means the user left the\n    //    tree — retention must not yank focus back on the next data change.\n    //    Document level because clicking a non-focusable area fires no focus\n    //    events.\n    // 2. deselectOnOutsideClick: a pointer-down on no row clears the\n    //    selection (file-manager semantics). Guards run cheapest-first; the\n    //    DOM walks only happen with a non-empty selection.\n    const onDocPointerDown = (event: PointerEvent) => {\n      const target = event.target as HTMLElement;\n      const insideHost = this.#host.contains(target);\n      if (!insideHost) this.#focus.disownFocus();\n\n      if (!this.deselectOnOutsideClick()) return;\n      if (this.#controller.selectedIds().size === 0) return;\n      // Row clicks manage selection themselves; guide clicks collapse groups;\n      // overlay clicks (context menu, dialogs) act ON the selection.\n      if (target.closest('[data-node-id], .tree-guide, .cdk-overlay-container'))\n        return;\n      if (insideHost) {\n        // Scrollbar drags are not deselect gestures (layoutless envs skip this).\n        const viewport = this.viewport().elementRef.nativeElement;\n        if (\n          viewport.clientWidth > 0 &&\n          (event.offsetX >= viewport.clientWidth ||\n            event.offsetY >= viewport.clientHeight)\n        ) {\n          return;\n        }\n      }\n      this.#selectionAnchor = null;\n      this.#writeSelection([], 'replace', undefined, 'pointer');\n    };\n    this.#host.ownerDocument.addEventListener(\n      'pointerdown',\n      onDocPointerDown,\n      true,\n    );\n    this.#destroyRef.onDestroy(() =>\n      this.#host.ownerDocument.removeEventListener(\n        'pointerdown',\n        onDocPointerDown,\n        true,\n      ),\n    );\n\n    // childrenDeps (v2 Phase 15): an effect, not a derivation — invalidation\n    // is a process (abort in-flight, drop overlays, re-run the accessor for\n    // expanded nodes). The first run sees the INITIAL value, not a change:\n    // nothing is stale yet, so it must not invalidate.\n    let depsSeen = false;\n    effect(() => {\n      this.childrenDeps();\n      if (!depsSeen) {\n        depsSeen = true;\n        return;\n      }\n      untracked(() => this.invalidateChildren());\n    });\n\n    // Expanded ⇒ load intent, reconciled (v2, decision 14): a node flagged\n    // expanded whose lazy children are neither resolved nor resolving loads\n    // as if it had just been toggled open. Covers the states the toggle\n    // funnel can't reach: a controlled `expandedKeys` write naming a lazy\n    // node, `defaultExpandedKeys` over lazy roots, and a `dataSource`\n    // replacement re-minting node objects under keys still flagged open\n    // (post-refresh) — all previously rendered aria-expanded over nothing,\n    // with no gesture left that would ever fetch. A STALE key (decision 15)\n    // counts as unloaded here: its old children keep rendering, but an\n    // expanded stale node must revalidate even across a re-mint. Driven by\n    // expansion STATE, never by rendering (search's force-expansion bypasses\n    // `expandedIds`, virtualization can't start or cancel loads) and never\n    // re-fetching FRESH overlays (decision 3); `error` keys wait for\n    // `retryChildren`.\n    effect(() => {\n      const { list } = this.#controller.flat();\n      const expanded = this.#controller.expandedIds();\n      const states = this.#controller.loadStates();\n      const stale = this.#controller.staleChildren();\n      untracked(() => {\n        for (const entry of list) {\n          if (!entry.expandable) continue;\n          if (entry.loaded && !stale.has(entry.key)) continue;\n          if (!expanded.has(entry.key) || states.has(entry.key)) continue;\n          void this.#controller\n            .ensureChildren(entry.key)\n            .then((result) => this.#emitLoad(entry.key, entry.node, result));\n        }\n      });\n    });\n\n    // Search announcements (v2): result counts reach screen readers as the\n    // term or the data changes; the count is true matches, not the ancestor\n    // chains rendered around them.\n    effect(() => {\n      const count = this.#controller.searchMatchCount();\n      const term = this.searchTerm();\n      untracked(() => {\n        if (count != null)\n          this.#announce((messages) => messages.searchResults?.(count, term));\n      });\n    });\n  }\n\n  /** The 1D array actually rendered — built from the controller's walk. */\n  readonly visibleRows = computed<readonly FlatRow<T>[]>(() =>\n    this.#controller.visibleNodes().map(({ flat, isExpanded }, index) => {\n      const key = flat.key;\n      // Per-row computeds: value equality stops propagation, so a selection\n      // change re-renders only rows whose state actually flipped (O(visible)).\n      const isSelected = computed(() =>\n        this.#controller.selectedIds().has(key),\n      );\n      const checkState = computed(\n        () => this.#controller.checkStates().get(key) ?? 'unchecked',\n      );\n      const isEditing = computed(() => this.#controller.editingId() === key);\n      const isLoading = computed(\n        () => this.#controller.loadStates().get(key) === 'loading',\n      );\n      const hasError = computed(\n        () => this.#controller.loadStates().get(key) === 'error',\n      );\n      const tabIndex = computed(() =>\n        this.#focus.effectiveFocusKey() === key ? 0 : -1,\n      );\n      const moveSource = computed(\n        () => this.#dnd.marked()?.keys.has(key) ?? false,\n      );\n\n      const handle: TreeNodeHandle = {\n        expandable: flat.expandable,\n        isSelected,\n        checkState,\n        toggle: () => this.toggle(flat.node),\n        // Checkbox / consumer handle clicks are pointer-origin; keyboard Space\n        // goes through onKeydown → #toggleSelection with cause 'keyboard'.\n        toggleSelection: (range?: boolean) =>\n          this.#toggleSelection(key, flat.node, 'pointer', range),\n        beginEdit: () => this.edit(flat.node),\n        commitEdit: (name) => this.#commitEdit(key, flat.node, name),\n        cancelEdit: () => this.#cancelEdit(key),\n      };\n\n      return {\n        node: flat.node,\n        key,\n        level: flat.level,\n        expandable: flat.expandable,\n        setSize: flat.setSize,\n        posInSet: flat.posInSet,\n        tabIndex,\n        moveSource,\n        checkState,\n        dragDisabled: this.disableDrag()?.(flat.node) ?? false,\n        context: {\n          $implicit: flat.node,\n          key,\n          level: flat.level,\n          expandable: flat.expandable,\n          isExpanded,\n          index,\n          // Getters defer to per-row computeds: reading them during template\n          // execution registers the row's view — not the whole list — as the\n          // reactive consumer.\n          get isSelected() {\n            return isSelected();\n          },\n          get isEditing() {\n            return isEditing();\n          },\n          get isLoading() {\n            return isLoading();\n          },\n          get hasError() {\n            return hasError();\n          },\n          get checkState() {\n            return checkState();\n          },\n        },\n        injector: Injector.create({\n          parent: this.#injector,\n          providers: [{ provide: TREE_NODE, useValue: handle }],\n        }),\n      };\n    }),\n  );\n\n  readonly trackByKey: TrackByFunction<FlatRow<T>> = (_index, row) => row.key;\n\n  /**\n   * The empty/loading overlay content, or `null` for neither. Loading wins\n   * over empty (a root load in flight shouldn't flash \"no items\"); each shows\n   * only when its def is projected.\n   */\n  protected readonly stateTemplate = computed<TemplateRef<unknown> | null>(\n    () => {\n      if (this.loading()) return this.loadingDef()?.template ?? null;\n      if (this.visibleRows().length === 0)\n        return this.emptyDef()?.template ?? null;\n      return null;\n    },\n  );\n\n  /**\n   * `'activate'` (default): plain click activates, never mutates selection —\n   * Gmail. `'select'` (v2 opt-in): plain click replaces the selection —\n   * file manager; activation moves to double-click. Ctrl/Cmd+click toggles,\n   * Shift+click range-selects over visible order in both modes (power-user\n   * shortcuts, ROADMAP settled).\n   */\n  protected onRowClick(row: FlatRow<T>, event: MouseEvent) {\n    this.#controller.focusedId.set(row.key);\n\n    if ((event.ctrlKey || event.metaKey) && this.multi()) {\n      this.#toggleSelection(row.key, row.node, 'pointer');\n      return;\n    }\n    if (event.shiftKey && this.multi()) {\n      this.#selectRange(this.#selectionAnchor ?? row.key, row.key, 'pointer');\n      return;\n    }\n\n    if (this.clickAction() === 'select') {\n      // Single replace-select with anchor — same write as 'follow' focus\n      // (respects isSelectable); activation belongs to double-click here.\n      this.#followFocus(row, 'pointer');\n      return;\n    }\n\n    if (this.selectionMode() === 'follow') this.#followFocus(row, 'pointer');\n    this.activated.emit(row.node);\n  }\n\n  /**\n   * Activation gesture under `clickAction: 'select'` — inert otherwise so\n   * double-click stays entirely the consumer's (v1 rename-gesture decision).\n   */\n  protected onRowDoubleClick(row: FlatRow<T>) {\n    if (this.clickAction() !== 'select') return;\n    this.activated.emit(row.node);\n  }\n\n  /** Recomputes only on visibility changes (expand/collapse/search/data) — never on scroll. */\n  readonly #guideGroups = computed(() =>\n    computeGuideGroups(this.#controller.visibleNodes()),\n  );\n\n  /** Guides clamped to the rendered range, in content-wrapper px (see template). */\n  protected readonly guideOverlays = computed<readonly GuideOverlay[]>(() =>\n    this.indentGuides()\n      ? clampGuideOverlays(\n          this.#guideGroups(),\n          this.#renderedRange(),\n          this.itemSize(),\n        )\n      : [],\n  );\n\n  /** A guide click collapses — and focuses — the group's expanded parent. */\n  protected onGuideClick(parentKey: string) {\n    const parent = this.#controller.flat().map.get(parentKey);\n    if (!parent) return;\n    this.collapse(parent.node);\n    this.#focus.focusKey(parentKey);\n  }\n\n  /**\n   * Right-click contract (OS convention, ROADMAP Phase 7): an unselected row\n   * is selected first (replace); a row inside a multi-selection keeps the\n   * selection intact. With a projected treeContextMenu the tree owns the\n   * trigger, so it suppresses the browser menu on rows — but never inside\n   * inputs (a rename field keeps its paste menu). Without a def, suppression\n   * stays the consumer trigger's job (the tree never assumes a menu exists).\n   */\n  protected onContextMenu(row: FlatRow<T>, event: MouseEvent) {\n    this.#controller.focusedId.set(row.key);\n\n    // Inside a rename input, leave the browser's paste menu alone.\n    if (this.contextMenuDef() && (event.target as HTMLElement).closest('input'))\n      return;\n\n    const at = this.#prepareContext(row, {\n      x: event.clientX,\n      y: event.clientY,\n    });\n    if (at == null) return; // no projected def → the consumer's trigger's call\n\n    // Drive the open ourselves — do NOT lean on CDK's own `contextmenu` host\n    // listener (its firing through hostDirectives proved unreliable on real\n    // trackpads: the browser menu won). We suppress the native menu and open\n    // via the menu host, threading THIS event so the gesture's trailing pointer\n    // event doesn't self-close the menu (the flicker).\n    event.preventDefault();\n    this.#menu.open(event, at);\n  }\n\n  /** Focus bookkeeping lives in the engine (tree-focus-engine.ts). */\n  protected onFocusIn(event: FocusEvent) {\n    this.#focus.handleFocusIn(event);\n  }\n\n  protected onFocusOut(event: FocusEvent) {\n    this.#focus.handleFocusOut(event);\n  }\n\n  /**\n   * One handler over the whole viewport (controller-driven focus — ROADMAP\n   * Phase 3 decision): works for targets virtualization hasn't rendered.\n   * The key map itself is the pure `interpretTreeKey` (tree-keyboard.ts);\n   * this is only the exhaustive dispatch.\n   */\n  protected onKeydown(event: KeyboardEvent) {\n    // Keys inside a rename input belong to the input (Enter/Escape handled\n    // by treeNodeEditInput), not to tree navigation.\n    if ((event.target as HTMLElement).closest('input[treeNodeEditInput]'))\n      return;\n\n    const rows = this.visibleRows();\n    if (rows.length === 0) return;\n\n    const focusKey = this.#focus.effectiveFocusKey();\n    const index = Math.max(\n      0,\n      rows.findIndex((row) => row.key === focusKey),\n    );\n    const row = rows[index];\n\n    const command = interpretTreeKey(event, {\n      rtl: this.#dir.value === 'rtl',\n      multi: this.multi(),\n      enterAction: this.enterAction(),\n      followSelection: this.selectionMode() === 'follow',\n      hasMoveMark: this.#dnd.marked() != null,\n      hasSelection: this.#controller.selectedIds().size > 0,\n      index,\n      rowCount: rows.length,\n      // Viewport-height jumps (APG optional keys, v2). Layoutless\n      // environments report size 0 — clamp to a single-row step.\n      pageStep: Math.max(\n        1,\n        Math.floor(this.viewport().getViewportSize() / this.itemSize()),\n      ),\n      rowExpandable: row.expandable,\n      rowExpanded: row.context.isExpanded,\n      hasChildBelow:\n        rows[index + 1] != null && rows[index + 1].level > row.level,\n    });\n    if (command == null) return;\n\n    switch (command.kind) {\n      case 'markMove':\n        this.#dnd.mark(row.key, command.effect);\n        break;\n      case 'keyboardDrop':\n        this.#dnd.keyboardDrop(row, command.zone);\n        break;\n      case 'selectAllVisible':\n        this.#selectAllVisible('keyboard');\n        break;\n      case 'selectToEdge':\n        this.#selectRange(row.key, rows[command.index].key, 'keyboard');\n        this.#focusIndex(command.index);\n        break;\n      case 'clearMoveMark':\n        this.#dnd.clearMark();\n        break;\n      case 'clearSelection':\n        this.#selectionAnchor = null;\n        this.#writeSelection([], 'replace', undefined, 'keyboard');\n        this.#announce((messages) => messages.selectionCleared?.());\n        break;\n      case 'focusStep': {\n        const focused = this.#focusIndex(command.index);\n        if (!focused) break;\n        if (command.extend) this.#extendSelection(focused, 'keyboard');\n        else if (command.follow) this.#followFocus(focused, 'keyboard');\n        break;\n      }\n      case 'focusIndex':\n        this.#focusIndex(command.index);\n        break;\n      case 'expandRow':\n        this.expand(row.node);\n        break;\n      case 'collapseRow':\n        this.collapse(row.node);\n        break;\n      case 'focusParent': {\n        const parentKey = this.#controller.flat().map.get(row.key)?.parentKey;\n        if (parentKey != null) this.#focus.focusKey(parentKey);\n        break;\n      }\n      case 'openContextMenu':\n        this.#openContextMenuAt(row);\n        break;\n      case 'activate':\n        this.activated.emit(row.node);\n        break;\n      case 'beginEdit':\n        this.edit(row.node);\n        break;\n      case 'toggleSelection':\n        this.#toggleSelection(row.key, row.node, 'keyboard', command.range);\n        break;\n      case 'consume':\n        break;\n      case 'typeahead': {\n        const text = this.typeaheadText();\n        if (!text) return; // inert without the accessor (ROADMAP settled)\n        const prefix = this.#typeahead.push(command.char);\n        const match = typeaheadTarget(rows, index, prefix, (candidate) =>\n          text(candidate.node),\n        );\n        if (match) this.#focus.focusKey(match.key);\n        return; // type-ahead never consumes the event\n      }\n      default:\n        command satisfies never;\n    }\n    event.preventDefault();\n  }\n\n  // ---------------------------------------------------------------------------\n  // Pointer drag & drop (Phase 4)\n  // ---------------------------------------------------------------------------\n\n  protected previewLabel(node: T): string {\n    return this.typeaheadText()?.(node) ?? '';\n  }\n\n  /// cdkDrag template bindings — the session lives in tree-drag-session.ts.\n\n  protected onDragStart(row: FlatRow<T>) {\n    this.#dnd.dragStart(row);\n  }\n\n  protected onDragMove(event: CdkDragMove<unknown>) {\n    this.#dnd.dragMove(event);\n  }\n\n  protected onDragEnd() {\n    this.#dnd.dragEnd();\n  }\n\n  /** Focuses the row at `index` (clamped) and returns it — callers must not re-clamp. */\n  #focusIndex(index: number): FlatRow<T> | null {\n    const rows = this.visibleRows();\n    if (rows.length === 0) return null;\n    const row = rows[Math.max(0, Math.min(rows.length - 1, index))];\n    this.#focus.focusKey(row.key);\n    return row;\n  }\n\n  /**\n   * Selection reconciliation (OS convention) + `contextRequested` emit +\n   * building the projected menu's context. Returns the anchor position when a\n   * `treeContextMenu` def exists (so the caller opens it), or `null` when none\n   * is projected (external hosting: the tree touches nothing else).\n   */\n  #prepareContext(row: FlatRow<T>, position?: { x: number; y: number }) {\n    if (!row.context.isSelected && this.isSelectable()?.(row.node) !== false) {\n      this.#selectionAnchor = row.key;\n      // Why = menu preparation, not the opening gesture (pointer vs keyboard\n      // vs TreeApi.openContextMenu) — preview panes filter on this.\n      this.#writeSelection([row.key], 'replace', row.node, 'contextmenu');\n    }\n\n    const selected = [...this.#controller.selectedIds()];\n    const ids = selected.length > 0 ? selected : [row.key];\n    const rect = rowElement(this.#host, row.key)?.getBoundingClientRect();\n    const at = position ?? { x: rect?.left ?? 0, y: rect?.bottom ?? 0 };\n\n    this.contextRequested.emit({ ids, node: row.node, position: at });\n\n    if (!this.contextMenuDef()) return null;\n    this.#menu.setContext({\n      $implicit: row.node,\n      node: row.node,\n      nodes: this.#controller.nodesForKeys(ids),\n      ids,\n      position: at,\n    });\n    return at;\n  }\n\n  /** Keyboard / programmatic open — no pointer event to thread (and none to self-close). */\n  #openContextMenuAt(row: FlatRow<T>, position?: { x: number; y: number }) {\n    // Without a caller position the anchor comes from the row's rect — but a\n    // row outside the rendered range has no DOM (activedescendant keyboard\n    // opens, openContextMenu() on a scrolled-away node), and a missed query\n    // would anchor the menu — and the contextRequested position — at (0,0).\n    // Same race as #focusKey: scroll it into the window, then retry\n    // frame-aligned until its DOM exists.\n    if (position == null && rowElement(this.#host, row.key) == null) {\n      const index = this.visibleRows().findIndex(\n        (candidate) => candidate.key === row.key,\n      );\n      if (index < 0) return;\n      this.viewport().scrollToIndex(index);\n      this.#menuAttempt = row.key;\n      afterNextRender(() => this.#attemptOpenMenu(row.key, 16), {\n        injector: this.#injector,\n      });\n      return;\n    }\n    const at = this.#prepareContext(row, position);\n    if (at != null) this.#menu.open(null, at);\n  }\n\n  /** The menu-anchor target being chased across virtual re-renders. */\n  #menuAttempt: string | null = null;\n\n  #attemptOpenMenu(key: string, retries: number) {\n    if (this.#menuAttempt !== key) return; // superseded\n    if (rowElement(this.#host, key)) {\n      this.#menuAttempt = null;\n      // Re-resolve by key: the FlatRow from the initiating call may be stale\n      // if the data changed while the scroll materialized the row.\n      const row = this.visibleRows().find((candidate) => candidate.key === key);\n      if (!row) return;\n      const at = this.#prepareContext(row);\n      if (at != null) this.#menu.open(null, at);\n      return;\n    }\n    if (retries === 0) {\n      this.#menuAttempt = null; // row left the visible set (collapse/filter) — give up quietly\n      return;\n    }\n    requestAnimationFrame(() => this.#attemptOpenMenu(key, retries - 1));\n  }\n\n  /// Selection writes (Phase 6 interaction modes) — one funnel, one event.\n\n  /** `'follow'` selection: focus movement replaces the selection (aria alignment). */\n  #followFocus(row: FlatRow<T>, cause: SelectCause) {\n    if (this.isSelectable()?.(row.node) === false) return;\n    this.#selectionAnchor = row.key;\n    this.#writeSelection([row.key], 'replace', row.node, cause);\n  }\n\n  /** Shift+Arrow: the newly focused row joins the selection (APG tree pattern). */\n  #extendSelection(row: FlatRow<T>, cause: SelectCause) {\n    if (this.isSelectable()?.(row.node) === false) return;\n    this.#writeSelection([row.key], 'add', row.node, cause);\n  }\n\n  /** Additive range over the *visible* flat order (Shift+click / Shift+Space / select-to-edge). */\n  #selectRange(fromKey: string, toKey: string, cause: SelectCause) {\n    const rows = this.visibleRows();\n    const from = rows.findIndex((row) => row.key === fromKey);\n    const to = rows.findIndex((row) => row.key === toKey);\n    if (from < 0 || to < 0) return;\n\n    const [lo, hi] = from <= to ? [from, to] : [to, from];\n    const keys = rows\n      .slice(lo, hi + 1)\n      .filter((row) => this.isSelectable()?.(row.node) !== false)\n      .map((row) => row.key);\n    // The range ends where the gesture landed — that row is the trigger.\n    this.#writeSelection(keys, 'add', rows[to].node, cause);\n  }\n\n  /**\n   * Ctrl/Cmd+A (APG optional key): selects every visible selectable row —\n   * or clears the selection when they're already all selected.\n   */\n  #selectAllVisible(cause: SelectCause) {\n    const keys = this.visibleRows()\n      .filter((row) => this.isSelectable()?.(row.node) !== false)\n      .map((row) => row.key);\n    const selected = this.#controller.selectedIds();\n    const allSelected =\n      keys.length > 0 && keys.every((key) => selected.has(key));\n    this.#writeSelection(allSelected ? [] : keys, 'replace', undefined, cause);\n  }\n\n  #writeSelection(\n    keys: readonly string[],\n    mode: 'add' | 'replace',\n    trigger: T | undefined,\n    cause: SelectCause,\n  ) {\n    const previous = this.#controller.selectedIds();\n    this.#controller.selectedIds.update((current) => {\n      const next = mode === 'replace' ? new Set<string>() : new Set(current);\n      for (const key of keys) next.add(key);\n      return next;\n    });\n    this.#syncControlledKeys();\n    this.#emitSelection(previous, trigger, cause);\n  }\n\n  /** One event shape for both funnels — deltas against the pre-write set. */\n  #emitSelection(\n    previous: ReadonlySet<string>,\n    trigger: T | undefined,\n    cause: SelectCause,\n  ) {\n    const current = this.#controller.selectedIds();\n    const ids = [...current];\n    this.selectionChange.emit({\n      ids,\n      nodes: this.#controller.nodesForKeys(ids),\n      trigger,\n      cause,\n      added: ids.filter((key) => !previous.has(key)),\n      removed: [...previous].filter((key) => !current.has(key)),\n    });\n  }\n\n  /** First def whose `when` matches wins; a def without `when` is the fallback. */\n  templateFor(row: FlatRow<T>): TemplateRef<TreeNodeContext<T>> {\n    const defs = this.defs();\n    const match =\n      defs.find((def) => def.when()?.(row.node)) ??\n      defs.find((def) => !def.when());\n\n    if (!match)\n      throw new Error('angular-tree: no treeNodeDef matches this node.');\n    return match.template;\n  }\n\n  /// TreeApi (exportAs \"angularTree\" / viewChild) — CdkTree-compatible names.\n\n  isExpanded(node: T): boolean {\n    return this.#controller.expandedIds().has(this.expansionKey()(node));\n  }\n\n  expand(node: T) {\n    this.#applyExpansion(node, true);\n  }\n\n  collapse(node: T) {\n    this.#applyExpansion(node, false);\n  }\n\n  toggle(node: T) {\n    this.#applyExpansion(node, !this.isExpanded(node));\n  }\n\n  /** Expands `node` and every (sync-loaded) descendant beneath it. */\n  expandDescendants(node: T) {\n    this.#controller.expandWithDescendants(this.expansionKey()(node));\n    this.#syncControlledExpansion();\n  }\n\n  /**\n   * Expands every loaded node. `loadLazy` (v2, opt-in — a 100k lazy tree\n   * must never fetch-storm by accident): additionally resolves unloaded lazy\n   * subtrees in batched frontier waves, expanding each wave as it lands;\n   * per-load `childrenLoaded` events fire as usual. Nodes in `error` state\n   * are left alone — `retryChildren` stays the explicit recovery path.\n   */\n  expandAll(options?: { loadLazy?: boolean }) {\n    this.#controller.expandAll();\n    this.#syncControlledExpansion();\n    if (options?.loadLazy) void this.#expandLazyFrontier();\n  }\n\n  async #expandLazyFrontier(): Promise<void> {\n    for (;;) {\n      const frontier = this.#controller\n        .flat()\n        .list.filter(\n          (entry) =>\n            entry.expandable &&\n            !entry.loaded &&\n            this.#controller.loadStates().get(entry.key) !== 'error',\n        );\n      if (frontier.length === 0) return;\n\n      const results = await Promise.all(\n        frontier.map((entry) =>\n          this.#controller.ensureChildren(entry.key).then((result) => {\n            this.#emitLoad(entry.key, entry.node, result);\n            return result;\n          }),\n        ),\n      );\n      // No wave resolved anything (all errors/noops) → stop rather than spin.\n      if (!results.some((result) => result.status === 'loaded')) return;\n      this.#controller.expandAll();\n      this.#syncControlledExpansion();\n    }\n  }\n\n  collapseAll() {\n    this.#controller.collapseAll();\n    this.#syncControlledExpansion();\n  }\n\n  /** Bulk-set for unbound trees; a bound `[(expandedKeys)]` covers this reactively. */\n  setExpanded(keys: Iterable<string>) {\n    this.#controller.expandedIds.set(new Set(keys));\n    this.#syncControlledExpansion();\n  }\n\n  /**\n   * Starts inline rename; the consumer renders the input (`isEditing` context).\n   * The tree ships NO rename gesture — wire this to your own trigger (a\n   * keybinding on the tree element, a context-menu item, a row button, …).\n   * Respects `disableEdit`.\n   */\n  edit(node: T) {\n    if (this.disableEdit()?.(node)) return;\n    this.#controller.editingId.set(this.expansionKey()(node));\n  }\n\n  focus(node: T): void {\n    this.#focus.focusKey(this.expansionKey()(node));\n  }\n\n  scrollTo(node: T): void {\n    const key = this.expansionKey()(node);\n    const index = this.visibleRows().findIndex((row) => row.key === key);\n    if (index >= 0) this.viewport().scrollToIndex(index);\n  }\n\n  /**\n   * Opens the projected `treeContextMenu` anchored to the node's row — the\n   * `more_vert` row-button pattern. No-op when the node isn't visible or no\n   * def is projected.\n   */\n  openContextMenu(node: T): void {\n    const key = this.expansionKey()(node);\n    const row = this.visibleRows().find((candidate) => candidate.key === key);\n    if (row) this.#openContextMenuAt(row);\n  }\n\n  /** Re-runs a failed async `childrenAccessor` (never leave a node stuck). */\n  retryChildren(node: T): void {\n    const key = this.expansionKey()(node);\n    void this.#controller\n      .retryChildren(key)\n      .then((result) => this.#emitLoad(key, node, result));\n  }\n\n  /**\n   * Lazy invalidation (v2): mark resolved children stale and re-ask the\n   * accessor. Stale-while-revalidate (decision 15): the old subtree STAYS\n   * rendered — per-row `isLoading` alongside the stale rows — until the\n   * replacement resolves and swaps in; nothing blanks. Expanded nodes\n   * revalidate immediately; collapsed nodes on their next expand (showing\n   * their stale children instantly while the refetch runs). No argument\n   * invalidates tree-wide. The tree still never fetches — it only re-runs\n   * *your* accessor; batching and caching stay on your side of it.\n   *\n   * Nodes NOT materialised at call time — a resource-backed `dataSource`\n   * that flashes empty mid-refresh and re-mints objects under the same keys\n   * — are caught by the expanded⇒load reconciler once they appear (decision\n   * 14), so an open branch survives a refresh without collapsing.\n   */\n  invalidateChildren(node?: T): void {\n    const keys =\n      node === undefined\n        ? this.#controller.invalidateChildren()\n        : this.#controller.invalidateChildren(this.expansionKey()(node));\n\n    const expanded = this.#controller.expandedIds();\n    const { map } = this.#controller.flat();\n    for (const key of keys) {\n      const entry = map.get(key);\n      if (!entry || !expanded.has(key)) continue; // collapsed: next expand reloads\n      void this.#controller\n        .ensureChildren(key)\n        .then((result) => this.#emitLoad(key, entry.node, result));\n    }\n  }\n\n  /**\n   * Key-addressed facade over the node-addressed TreeApi (v2, Phase 15 —\n   * decision 11: a facade, not `T | string` unions, since `T` may itself be\n   * `string`). Keys are the tree's identity currency — consumers naturally\n   * store `parentKey`/`id` strings for post-intent work; this resolves them\n   * through the internal flat model so nobody rebuilds a key→node map\n   * outside. A key that is unknown or not currently loaded is a no-op\n   * (`isExpanded` reports the raw expansion set, which may hold keys of\n   * not-yet-loaded nodes — e.g. a restore before the lazy branch resolves;\n   * such keys load via the expanded⇒load reconciler once their node\n   * materialises, decision 14).\n   */\n  readonly byKey = {\n    expand: (key: string) => this.#withNode(key, (node) => this.expand(node)),\n    collapse: (key: string) =>\n      this.#withNode(key, (node) => this.collapse(node)),\n    toggle: (key: string) => this.#withNode(key, (node) => this.toggle(node)),\n    expandDescendants: (key: string) =>\n      this.#withNode(key, (node) => this.expandDescendants(node)),\n    isExpanded: (key: string): boolean =>\n      this.#controller.expandedIds().has(key),\n    edit: (key: string) => this.#withNode(key, (node) => this.edit(node)),\n    focus: (key: string) => this.#withNode(key, (node) => this.focus(node)),\n    scrollTo: (key: string) =>\n      this.#withNode(key, (node) => this.scrollTo(node)),\n    openContextMenu: (key: string) =>\n      this.#withNode(key, (node) => this.openContextMenu(node)),\n    retryChildren: (key: string) =>\n      this.#withNode(key, (node) => this.retryChildren(node)),\n    /** No argument = tree-wide, exactly like the node-addressed form. */\n    invalidateChildren: (key?: string) => {\n      if (key === undefined) this.invalidateChildren();\n      else this.#withNode(key, (node) => this.invalidateChildren(node));\n    },\n  };\n\n  /** Resolves a key through the flat model; unknown/unloaded keys no-op. */\n  #withNode(key: string, act: (node: T) => void): void {\n    const entry = this.#controller.flat().map.get(key);\n    if (entry) act(entry.node);\n  }\n\n  /// Per-node row styling (Phase 15) — template bindings for rows and guides.\n\n  protected rowClassFor(row: FlatRow<T>) {\n    return this.rowClass()?.(row.node);\n  }\n\n  protected rowStyleFor(row: FlatRow<T>) {\n    return this.rowStyle()?.(row.node);\n  }\n\n  /** A guide belongs to its group's PARENT — it carries that node's rowStyle. */\n  protected guideStyleFor(parentKey: string) {\n    const style = this.rowStyle();\n    if (!style) return undefined;\n    const entry = this.#controller.flat().map.get(parentKey);\n    return entry ? style(entry.node) : undefined;\n  }\n\n  /** Single write path for expansion — emits the `toggled` intent on change. */\n  #applyExpansion(node: T, value: boolean) {\n    if (this.isExpanded(node) === value) return;\n    const key = this.expansionKey()(node);\n    this.#controller.setExpanded(key, value);\n    this.#syncControlledExpansion();\n    this.toggled.emit({ id: key, node, expanded: value });\n\n    // Expand intent triggers the lazy load — rendering never does (ROADMAP:\n    // virtualization-proof lazy loading).\n    if (value) {\n      void this.#controller\n        .ensureChildren(key)\n        .then((result) => this.#emitLoad(key, node, result));\n    } else if (this.collapseBehavior() === 'invalidate') {\n      // Collapse drops the overlay and aborts an in-flight resolve — the next\n      // expand re-runs the accessor (v2; `'keep'` preserves v1 semantics).\n      this.#controller.invalidateChildren(key);\n    }\n  }\n\n  #emitLoad(key: string, node: T, result: LoadResult) {\n    if (result.status === 'noop') return;\n    const event: LoadChildrenEvent<T> =\n      result.status === 'loaded'\n        ? { id: key, node, status: 'loaded' }\n        : { id: key, node, status: 'error', error: result.error };\n    this.childrenLoaded.emit(event);\n    this.#announce((messages) => messages.childrenLoaded?.(event));\n  }\n\n  // ---------------------------------------------------------------------------\n  // Live announcements (v2) — polite, via CDK LiveAnnouncer (no DOM shipped)\n  // ---------------------------------------------------------------------------\n\n  readonly #liveAnnouncer = inject(LiveAnnouncer);\n\n  /** Instance-bound so defaults can name nodes through `typeaheadText`. */\n  readonly #defaultAnnouncements: Required<TreeAnnouncements<T>> = {\n    moved: (event) =>\n      `${event.dragIds.length} ${event.dragIds.length === 1 ? 'item' : 'items'} ${\n        event.dropEffect === 'copy' ? 'copied' : 'moved'\n      }`,\n    childrenLoaded: (event) => {\n      const name = this.typeaheadText()?.(event.node);\n      return event.status === 'error'\n        ? `Loading ${name ?? 'children'} failed`\n        : `${name ?? 'Children'} loaded`;\n    },\n    searchResults: (count, term) =>\n      `${count} ${count === 1 ? 'result' : 'results'} for ${term}`,\n    selectionCleared: () => 'Selection cleared',\n  };\n\n  #announce(\n    select: (messages: Required<TreeAnnouncements<T>>) => string | undefined,\n  ) {\n    const config = this.announcements();\n    if (config === null) return; // consumer-silenced\n    const message = select({ ...this.#defaultAnnouncements, ...config });\n    if (message) void this.#liveAnnouncer.announce(message, 'polite');\n  }\n\n  #commitEdit(key: string, node: T, name: string) {\n    // Escape-then-blur double fire: only the first commit/cancel counts.\n    if (this.#controller.editingId() !== key) return;\n    this.#controller.editingId.set(null);\n    this.renamed.emit({ id: key, node, name });\n  }\n\n  #cancelEdit(key: string) {\n    if (this.#controller.editingId() === key)\n      this.#controller.editingId.set(null);\n  }\n\n  /**\n   * Checkbox/row selection toggle — writes the controller's Set, then syncs\n   * the controlled `selectedKeys` input when bound.\n   */\n  #toggleSelection(key: string, node: T, cause: SelectCause, range = false) {\n    if (this.isSelectable()?.(node) === false) return;\n\n    // Shift+checkbox (v2): additive range from the anchor over visible order —\n    // the anchor survives so a further shift-click re-ranges from the same spot.\n    if (\n      range &&\n      this.multi() &&\n      this.#selectionAnchor != null &&\n      this.#selectionAnchor !== key\n    ) {\n      this.#selectRange(this.#selectionAnchor, key, cause);\n      return;\n    }\n\n    this.#selectionAnchor = key;\n    const cascade = this.checkboxSelection() && this.multi();\n    const { keys, select } = this.#controller.checkToggleDelta(key, cascade);\n\n    const previous = this.#controller.selectedIds();\n    this.#controller.selectedIds.update((current) => {\n      const next = this.multi() ? new Set(current) : new Set<string>();\n      for (const k of keys) {\n        if (select) next.add(k);\n        else next.delete(k);\n      }\n      return next;\n    });\n    this.#syncControlledKeys();\n    this.#emitSelection(previous, node, cause);\n  }\n\n  /** Tree-initiated write → the controlled input, when bound (→ selectedKeysChange). */\n  #syncControlledKeys() {\n    if (this.selectedKeys() !== undefined)\n      this.selectedKeys.set([...this.#controller.selectedIds()]);\n  }\n\n  /** Same as `#syncControlledKeys`, for expansion (→ expandedKeysChange). */\n  #syncControlledExpansion() {\n    if (this.expandedKeys() !== undefined)\n      this.expandedKeys.set([...this.#controller.expandedIds()]);\n  }\n}\n","<cdk-virtual-scroll-viewport\n  class=\"tree-viewport\"\n  role=\"tree\"\n  cdkDropList\n  [cdkDropListSortingDisabled]=\"true\"\n  [itemSize]=\"itemSize()\"\n  [attr.aria-label]=\"ariaLabelledby() ? null : ariaLabel()\"\n  [attr.aria-labelledby]=\"ariaLabelledby()\"\n  [attr.aria-multiselectable]=\"multi() || null\"\n  [attr.tabindex]=\"focusMode() === 'activedescendant' ? 0 : null\"\n  [attr.aria-activedescendant]=\"\n    focusMode() === 'activedescendant' ? activeDescendantId() : null\n  \"\n  (keydown)=\"onKeydown($event)\"\n  (focusin)=\"onFocusIn($event)\"\n  (focusout)=\"onFocusOut($event)\"\n>\n  <!-- data-loading / data-error are styling hooks AND the template's only\n       reads of the load-state computeds: without them a pending/failed load\n       schedules no zoneless CD (loads change visibleRows only on success),\n       leaving the consumer's spinner/Retry def stale. -->\n  <div\n    (keyup)=\"$event.stopPropagation()\"\n    *cdkVirtualFor=\"let row of visibleRows(); trackBy: trackByKey\"\n    class=\"tree-node\"\n    role=\"treeitem\"\n    cdkDrag\n    [cdkDragDisabled]=\"row.dragDisabled\"\n    [cdkDragStartDelay]=\"dragStartDelay\"\n    (cdkDragStarted)=\"onDragStart(row)\"\n    (cdkDragMoved)=\"onDragMove($event)\"\n    (cdkDragEnded)=\"onDragEnd()\"\n    [attr.id]=\"rowId(row.key)\"\n    [attr.aria-level]=\"row.level + 1\"\n    [attr.aria-expanded]=\"row.expandable ? row.context.isExpanded : null\"\n    [attr.aria-setsize]=\"row.setSize\"\n    [attr.aria-posinset]=\"row.posInSet\"\n    [attr.aria-selected]=\"checkboxSelection() ? null : row.context.isSelected\"\n    [attr.aria-checked]=\"\n      checkboxSelection()\n        ? row.checkState() === 'indeterminate'\n          ? 'mixed'\n          : row.checkState() === 'checked'\n        : null\n    \"\n    [attr.data-node-id]=\"row.key\"\n    [attr.data-selected]=\"row.context.isSelected || null\"\n    [attr.data-move-source]=\"row.moveSource() || null\"\n    [attr.data-loading]=\"row.context.isLoading || null\"\n    [attr.data-error]=\"row.context.hasError || null\"\n    [attr.tabindex]=\"focusMode() === 'roving' ? row.tabIndex() : -1\"\n    [class]=\"rowClassFor(row)\"\n    [style]=\"rowStyleFor(row)\"\n    [style.--tree-level]=\"row.level\"\n    [style.height.px]=\"itemSize()\"\n    (click)=\"onRowClick(row, $event)\"\n    (dblclick)=\"onRowDoubleClick(row)\"\n    (contextmenu)=\"onContextMenu(row, $event)\"\n  >\n    <!-- One representative + count badge — never N previews (ROADMAP) -->\n    <div *cdkDragPreview class=\"tree-drag-preview\">\n      <span>{{ previewLabel(row.node) }}</span>\n      @if (dragCount() > 1) {\n        <span class=\"tree-drag-preview-badge\">{{ dragCount() }}</span>\n      }\n    </div>\n    <ng-container\n      *ngTemplateOutlet=\"\n        templateFor(row);\n        context: row.context;\n        injector: row.injector\n      \"\n    />\n  </div>\n  <!-- Indent guides: ONE continuous line per expanded group (Reddit-style\n       whole-line hover + single click target), absolutely positioned in\n       the scroll content so it moves with the rows. Pointer sugar for\n       collapse-this-group; keyboard equivalent is ArrowLeft-to-parent,\n       hence aria-hidden. -->\n  @if (indentGuides()) {\n    @for (guide of guideOverlays(); track guide.key) {\n      <!-- Guides inherit their GROUP PARENT's rowStyle: they're siblings of\n           the rows, so a row-applied custom property can't reach them. -->\n      <div\n        class=\"tree-guide\"\n        aria-hidden=\"true\"\n        [attr.data-elbow]=\"guide.elbow || null\"\n        [style]=\"guideStyleFor(guide.key)\"\n        [style.top.px]=\"guide.top\"\n        [style.height.px]=\"guide.height\"\n        [style.--tree-level]=\"guide.level\"\n        (click)=\"onGuideClick(guide.key)\"\n      ></div>\n    }\n  }\n</cdk-virtual-scroll-viewport>\n\n@if (dropIndicator(); as indicator) {\n  <div\n    class=\"tree-drop-indicator\"\n    [class.tree-drop-indicator--inside]=\"indicator.inside\"\n    [style.top.px]=\"indicator.top\"\n    [style.height.px]=\"indicator.height\"\n    [style.--tree-level]=\"indicator.level\"\n  ></div>\n}\n\n<!-- Empty / root-loading state: the tree owns this slot (overlays the host,\n     clear of the viewport's transform), the consumer projects the content\n     via treeEmptyDef / treeLoadingDef. Absent def → nothing renders. -->\n\n@if (stateTemplate(); as template) {\n  <div class=\"tree-state\" role=\"status\" aria-live=\"polite\">\n    <ng-container *ngTemplateOutlet=\"template\" />\n  </div>\n}\n\n<!-- Built-in context menu: the tree ships the SHELL (cdkMenu = keyboard\n     nav, overlay container = stacking rules), the consumer ships the\n     items via treeContextMenu. Renders only while open. -->\n<ng-template #contextMenuShell>\n  @if (contextMenuDef(); as def) {\n    @if (contextMenuContext(); as context) {\n      <div cdkMenu class=\"tree-menu\">\n        <ng-container *ngTemplateOutlet=\"def.template; context: context\" />\n      </div>\n    }\n  }\n</ng-template>\n","/**\n * Intent event payloads (Phase 0 contract, see ROADMAP.md). The tree is\n * controlled: it never mutates consumer data — it emits these intents and the\n * consumer applies them.\n */\n\n/** Emitted when a drop completes. Consumer moves the nodes in its own data. */\nexport interface MoveEvent<T> {\n  /** Plural by contract: multi-drag-ready even if v1 ships single-drag. */\n  readonly dragIds: readonly string[];\n  readonly dragNodes: readonly T[];\n  /** `null` = root level. */\n  readonly parentId: string | null;\n  readonly parentNode: T | null;\n  /**\n   * Insertion index into the target parent's children *as they currently\n   * are* — dragged nodes are still present. Remove them first, adjusting the\n   * index for any removed sibling that sat before it (react-arborist\n   * convention, ROADMAP settled 2026-07-05).\n   */\n  readonly index: number;\n  /**\n   * `'copy'` when the platform copy modifier was held at drop time (⌥ on\n   * macOS, Ctrl elsewhere — the OS file-manager convention) or the keyboard\n   * move was armed with Ctrl/Cmd+C instead of Ctrl/Cmd+X. The consumer\n   * duplicates instead of moving; `index` semantics are unchanged (v2,\n   * ROADMAP2 settled 2026-07-06).\n   */\n  readonly dropEffect: 'move' | 'copy';\n}\n\n/** Emitted when inline editing commits. Consumer renames in its own data. */\nexport interface RenameEvent<T> {\n  readonly id: string;\n  readonly node: T;\n  readonly name: string;\n}\n\n/**\n * Why a {@link SelectEvent} write occurred — the reason for the write, not\n * the physical input device. Every path through context-menu preparation\n * (right-click, Shift+F10 / ContextMenu key, `openContextMenu()`) reports\n * `'contextmenu'`, so preview-pane consumers can ignore reconciliation:\n * `if (event.trigger && event.cause !== 'contextmenu') …`.\n */\nexport type SelectCause = 'pointer' | 'keyboard' | 'contextmenu';\n\n/**\n * Emitted on every selection interaction (checkbox or ctrl/shift semantics).\n * Fires even when the resulting set is unchanged — re-clicking the already\n * selected row under `clickAction=\"select\"` still identifies itself via\n * `trigger` (`added`/`removed` empty), so \"active row\" consumers (preview\n * panes) can refocus without guessing from the set.\n *\n * External `[(selectedKeys)]` writes update state but never emit — only\n * tree-initiated interactions produce a {@link SelectEvent}.\n */\nexport interface SelectEvent<T> {\n  readonly ids: readonly string[];\n  readonly nodes: readonly T[];\n  /**\n   * The row whose interaction caused this write — present for row-addressed\n   * gestures (click, Shift/Ctrl-click, checkbox, Space, `'follow'`-mode focus\n   * moves, right-click reconciliation; ranges report the row the gesture\n   * ended on). Absent for set-level operations: Ctrl/Cmd+A and the Escape /\n   * outside-click clears.\n   */\n  readonly trigger?: T;\n  /**\n   * Why this write occurred. Always present on tree-emitted events (including\n   * set-level clears where `trigger` is absent). `'contextmenu'` covers every\n   * selection reconciliation that precedes a menu open — not only the pointer\n   * right-click path.\n   */\n  readonly cause: SelectCause;\n  /** Keys that entered the set with this write (empty on a no-op re-click). */\n  readonly added: readonly string[];\n  /** Keys that left the set with this write. */\n  readonly removed: readonly string[];\n}\n\n/** Emitted when a node expands or collapses. */\nexport interface ToggleEvent<T> {\n  readonly id: string;\n  readonly node: T;\n  readonly expanded: boolean;\n}\n\n/**\n * Notification of an async `childrenAccessor` resolution — loading is driven\n * by the accessor itself (ROADMAP settled: no separate `loadChildren` output);\n * this only reports the outcome so consumers can react (telemetry, toasts).\n */\nexport interface LoadChildrenEvent<T> {\n  readonly id: string;\n  readonly node: T;\n  readonly status: 'loaded' | 'error';\n  /** Present when `status` is `'error'`; pair with `tree.retryChildren(node)`. */\n  readonly error?: unknown;\n}\n\n/**\n * Screen-reader messages for the tree's polite live region (v2, ROADMAP2\n * Phase 9 — announced via CDK `LiveAnnouncer`, no DOM shipped). Every field\n * is optional: omitted fields fall back to terse English defaults; pass the\n * whole input as `null` to silence the tree entirely. Returning `''` from a\n * field suppresses just that announcement.\n */\nexport interface TreeAnnouncements<T> {\n  /** After a completed move/copy (pointer or keyboard). */\n  moved?: (event: MoveEvent<T>) => string;\n  /** After an async `childrenAccessor` resolves or fails. */\n  childrenLoaded?: (event: LoadChildrenEvent<T>) => string;\n  /** When the search term or its match count changes (term non-empty). */\n  searchResults?: (count: number, term: string) => string;\n  /** After Escape clears the selection — a mass deselect is otherwise silent. */\n  selectionCleared?: () => string;\n}\n\n/**\n * Emitted on right-click / ContextMenu key / Shift+F10 (Phase 7). Selection\n * has already been reconciled per OS convention when this fires.\n */\nexport interface ContextRequestedEvent<T> {\n  /** The full selection the menu should act on. */\n  readonly ids: readonly string[];\n  /** The row that was invoked. */\n  readonly node: T;\n  /** Viewport coordinates for overlay positioning. */\n  readonly position: { readonly x: number; readonly y: number };\n}\n","import { Directive, effect, ElementRef, inject } from '@angular/core';\n\nimport { TREE_NODE } from './types';\n\n/**\n * Wires any element to the row's derived tri-state and toggle — the tree\n * ships no checkbox UI (ROADMAP settled). Writes native `checked`/\n * `indeterminate` properties (host binding can't target them on a directive:\n * NG8002). For `mat-checkbox`, bind its inputs from the template context\n * instead — see docs/RECIPES.md (settled 2026-07-07: pattern, not adapter).\n *\n * Shift+click range-selects from the selection anchor over visible order\n * (Gmail semantics). The host leaves the tab order: `Space` on the focused\n * row is the keyboard equivalent (APG — treeitem content is not a tab stop).\n */\n@Directive({\n  selector: '[treeNodeCheckbox]',\n  host: {\n    '(click)': 'onClick($event)',\n    tabindex: '-1',\n  },\n})\nexport class TreeNodeCheckbox {\n  readonly #node = inject(TREE_NODE);\n  readonly #element: HTMLInputElement = inject(ElementRef).nativeElement;\n\n  constructor() {\n    effect(() => {\n      const state = this.#node.checkState();\n      this.#element.checked = state === 'checked';\n      // `indeterminate` is property-only (no HTML attribute) — the reason\n      // this is an effect, not a template binding.\n      this.#element.indeterminate = state === 'indeterminate';\n    });\n  }\n\n  protected onClick(event: MouseEvent) {\n    // Gmail semantics: checkbox toggles selection, row click activates —\n    // without this stop, one click would do both.\n    event.stopPropagation();\n    this.#node.toggleSelection(event.shiftKey);\n  }\n}\n","import {\n  afterNextRender,\n  DestroyRef,\n  Directive,\n  effect,\n  ElementRef,\n  inject,\n  input,\n  signal,\n} from '@angular/core';\n\n// ---------------------------------------------------------------------------\n// Pure core — standalone functions (STYLE.md § Feature Engines): everything\n// that computes a string from values lives here, testable with a fake\n// measurer; the directive below is only lifecycle (observers, DOM writes).\n// ---------------------------------------------------------------------------\n\n/** Width of a single-line string in CSS px, in the label's own font. */\nexport type TextMeasure = (text: string) => number;\n\nexport interface MiddleEllipsisOptions {\n  /**\n   * `'balanced'` (default) keeps roughly equal halves — AppKit's\n   * `NSLineBreakByTruncatingMiddle`. `'extension'` cuts the STEM balanced and\n   * keeps everything after the last `.` intact on the tail (Finder never\n   * truncates the extension — but both ends of the name still survive:\n   * `virtualized-expl…ering.component.spec.ts`, never `virtualized-exp….ts`);\n   * names without a `.` fall back to balanced.\n   */\n  readonly tail?: 'balanced' | 'extension';\n}\n\nconst ELLIPSIS = '\\u2026'; // '…' — one glyph, never three periods (the macOS form)\n\n/** Strong-RTL presence — Hebrew, Arabic + presentation forms, Syriac, Thaana. */\nconst STRONG_RTL = /[\\u0590-\\u08ff\\ufb1d-\\ufdff\\ufe70-\\ufeff]/;\n\nconst FSI = '\\u2068'; // FIRST STRONG ISOLATE\nconst PDI = '\\u2069'; // POP DIRECTIONAL ISOLATE\n\nconst segmenter =\n  typeof Intl.Segmenter === 'function'\n    ? new Intl.Segmenter(undefined, { granularity: 'grapheme' })\n    : null;\n\n/** Grapheme clusters — a naive slice() bisects emoji ZWJ sequences and\n * combining marks; code points (`[...text]`) are the degraded fallback. */\nexport function graphemesOf(text: string): readonly string[] {\n  return segmenter\n    ? [...segmenter.segment(text)].map((segment) => segment.segment)\n    : [...text];\n}\n\n/**\n * Splicing mixed-direction text can visually reorder the halves around the\n * ellipsis, so each half is pinned in a bidi isolate (FSI…PDI) when strong\n * RTL is present. Applied at composition — the isolates are part of the\n * measured string, so measurement and rendering never disagree.\n */\nfunction compose(head: string, tail: string, isolate: boolean): string {\n  const wrap = (part: string) =>\n    part && isolate ? `${FSI}${part}${PDI}` : part;\n  return `${wrap(head)}${ELLIPSIS}${wrap(tail)}`;\n}\n\n/**\n * Largest `count` in [0, max] for which `fits(count)` holds, or -1 for none.\n * Width grows with kept-grapheme count, so the predicate is monotone.\n */\nfunction largestFitting(max: number, fits: (count: number) => boolean): number {\n  let low = 0;\n  let high = max;\n  let best = -1;\n  while (low <= high) {\n    const mid = (low + high) >> 1;\n    if (fits(mid)) {\n      best = mid;\n      low = mid + 1;\n    } else {\n      high = mid - 1;\n    }\n  }\n  return best;\n}\n\n/**\n * macOS-style middle truncation: `head…tail` capped at `maxWidth`.\n *\n * Every candidate is measured as the COMPOSED string — summing half-widths\n * lies whenever kerning or ligatures cross the cut. Both tail policies cut\n * BALANCED halves — extension mode cuts the STEM balanced and appends the\n * whole extension (a bare-extension tail would read as end-ellipsis with the\n * extension stapled on, not a middle cut). Collapse ladder as width shrinks:\n * balanced middle cut → (extension mode) the stem gives way around the held\n * extension → the extension gives way too → bare `…`. `maxWidth <= 0` means\n * \"layout hasn't happened\" (SSR, jsdom, display:none) — the full text returns\n * untouched rather than everything collapsing to `…`.\n */\nexport function middleEllipsis(\n  text: string,\n  maxWidth: number,\n  measure: TextMeasure,\n  options: MiddleEllipsisOptions = {},\n): string {\n  if (maxWidth <= 0 || measure(text) <= maxWidth) return text;\n\n  const isolate = STRONG_RTL.test(text);\n  const fitsComposed = (head: string, tail: string) =>\n    measure(compose(head, tail, isolate)) <= maxWidth;\n\n  // Balanced cut over `parts`: keep k graphemes, head ⌈k/2⌉ / tail ⌊k/2⌋,\n  // `suffix` (the protected extension) rides along whole on the tail side.\n  // Returns null when nothing fits — the caller steps down the ladder.\n  const cutBalanced = (\n    parts: readonly string[],\n    suffix: string,\n  ): string | null => {\n    const halves = (count: number): [string, string] => [\n      parts.slice(0, Math.ceil(count / 2)).join(''),\n      (count ? parts.slice(parts.length - (count >> 1)).join('') : '') +\n        suffix,\n    ];\n    const keep = largestFitting(parts.length - 1, (count) =>\n      fitsComposed(...halves(count)),\n    );\n    return keep < 0 ? null : compose(...halves(keep), isolate);\n  };\n\n  if (options.tail === 'extension') {\n    const dot = text.lastIndexOf('.');\n    // A leading dot (\".gitignore\") or no dot has no extension to protect.\n    if (dot > 0) {\n      const result = cutBalanced(graphemesOf(text.slice(0, dot)), text.slice(dot));\n      if (result !== null) return result;\n      // Even `…ext` overflows — the extension itself must give way (ladder).\n    }\n  }\n\n  return cutBalanced(graphemesOf(text), '') ?? ELLIPSIS; // floor: the glyph alone\n}\n\n/** One shared 2D context — measurement is layout-free by design (probing\n * scrollWidth per candidate would force synchronous reflow). */\nlet sharedContext: CanvasRenderingContext2D | null | undefined;\n\n/**\n * A `TextMeasure` in the element's computed font. The font is (re)applied on\n * every call — the context is shared across all directive instances.\n */\nexport function cssTextMeasure(element: Element): TextMeasure | null {\n  sharedContext ??= document.createElement('canvas').getContext('2d');\n  const context = sharedContext;\n  if (!context) return null;\n  const style = getComputedStyle(element);\n  const font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;\n  const letterSpacing =\n    style.letterSpacing === 'normal' ? '0px' : style.letterSpacing;\n  return (text) => {\n    context.font = font;\n    if ('letterSpacing' in context) context.letterSpacing = letterSpacing;\n    return context.measureText(text).width;\n  };\n}\n\n// ---------------------------------------------------------------------------\n// Directive — lifecycle shell\n// ---------------------------------------------------------------------------\n\n/**\n * macOS-Finder-style middle truncation for node labels: `head…tail` instead\n * of CSS's end-only `text-overflow`. The directive OWNS the element's text —\n * leave the element empty and bind the full string:\n *\n * ```html\n * <span class=\"node-name\" [middleEllipsis]=\"node.name\"></span>\n * ```\n *\n * Contract:\n * - The element's inline size must be content-independent (`flex: 1 1 auto;\n *   min-inline-size: 0`, or a fixed width) — a shrink-to-content box resizes\n *   when its text is replaced, and the re-truncation loop would chase its own\n *   output. Pair with the tree's `labelOverflow: 'ellipsis'`, which caps rows\n *   at the viewport; without it the row grows with the text and nothing ever\n *   overflows.\n * - The full text stays reachable: `title` (hover tooltip) and `aria-label`\n *   always carry the untruncated string, and the tree's type-ahead reads the\n *   `typeaheadText` accessor, never the rendered DOM.\n * - Re-derives on text change, element resize, and web-font arrival\n *   (`document.fonts` — measuring before the font loads is confidently\n *   wrong). Measurement is canvas-based and layout-free; a ~1px margin\n *   absorbs canvas-vs-DOM rendering drift.\n */\n@Directive({\n  selector: '[middleEllipsis]',\n  host: {\n    '[attr.title]': 'middleEllipsis()',\n    '[attr.aria-label]': 'middleEllipsis()',\n  },\n})\nexport class MiddleEllipsis {\n  readonly #element: HTMLElement = inject(ElementRef).nativeElement;\n\n  /** The full, untruncated label text. */\n  readonly middleEllipsis = input.required<string>();\n\n  /** Tail policy — see {@link MiddleEllipsisOptions}. */\n  readonly middleEllipsisTail = input<'balanced' | 'extension'>('balanced');\n\n  /** Layout-derived inline size; 0 until `afterNextRender` (SSR-safe). */\n  readonly #width = signal(0);\n\n  /** Bumped when `document.fonts` finishes a load — metrics changed. */\n  readonly #fontsGeneration = signal(0);\n\n  constructor() {\n    const destroyRef = inject(DestroyRef);\n\n    // Observers exist only in the browser; until layout reports a width the\n    // effect below renders the full text (which is also the SSR output).\n    afterNextRender(() => {\n      // Layout-less environments (jsdom) have no ResizeObserver — without a\n      // width the effect keeps rendering the full text, which is correct there.\n      if (typeof ResizeObserver !== 'function') return;\n      const observer = new ResizeObserver((entries) =>\n        this.#width.set(entries[0].contentRect.width),\n      );\n      observer.observe(this.#element);\n      destroyRef.onDestroy(() => observer.disconnect());\n\n      const fonts = document.fonts;\n      if (fonts) {\n        const onLoaded = () => this.#fontsGeneration.update((n) => n + 1);\n        fonts.addEventListener('loadingdone', onLoaded);\n        destroyRef.onDestroy(() =>\n          fonts.removeEventListener('loadingdone', onLoaded),\n        );\n      }\n    });\n\n    // DOM sync is a process, not a derivation — hence an effect. The measurer\n    // is rebuilt per run: font metrics may have changed (#fontsGeneration).\n    effect(() => {\n      const text = this.middleEllipsis();\n      const width = this.#width();\n      this.#fontsGeneration();\n      const measure = width > 0 ? cssTextMeasure(this.#element) : null;\n      this.#element.textContent = measure\n        ? middleEllipsis(text, width - 1, measure, {\n            tail: this.middleEllipsisTail(),\n          })\n        : text;\n    });\n  }\n}\n","import { CdkDrag, CdkDragHandle } from '@angular/cdk/drag-drop';\nimport { Directive, inject } from '@angular/core';\n\n/**\n * Opt-in drag handle inside a node template (v2, ROADMAP2 Phase 9): the row\n * then drags *only* from this element, and the start delay drops to zero —\n * including touch, where row drags are otherwise disabled because long-press\n * belongs to the context menu (v1 decision). Grabbing a dedicated handle IS\n * the drag intent, so no delay disambiguation is needed.\n *\n * ```html\n * <ng-template treeNodeDef let-node>\n *   <mat-icon treeNodeDragHandle>drag_indicator</mat-icon>\n *   {{ node.name }}\n * </ng-template>\n * ```\n */\n@Directive({\n  selector: '[treeNodeDragHandle]',\n  hostDirectives: [CdkDragHandle],\n  host: {\n    // Out of the tab order (APG: treeitem content is not a tab stop) — the\n    // keyboard move path is Ctrl/Cmd+X/C + V on the focused row.\n    tabindex: '-1',\n    '[attr.data-tree-drag-handle]': \"''\",\n  },\n})\nexport class TreeNodeDragHandle {\n  // The row's CdkDrag sits on an ancestor rendered by the tree itself; CDK\n  // wires handle registration through the hosted CdkDragHandle. This class\n  // only lifts the touch lockout — a dedicated handle makes long-press\n  // unambiguous, so the context-menu conflict the delay guarded is gone.\n  readonly #drag = inject(CdkDrag, { optional: true });\n\n  constructor() {\n    if (this.#drag) this.#drag.dragStartDelay = 0;\n  }\n}\n","import { afterNextRender, Directive, ElementRef, inject } from '@angular/core';\n\nimport { TREE_NODE } from './types';\n\n/**\n * The consumer-rendered rename input (the tree owns editing *state* only —\n * ROADMAP settled). Enter commits → the tree emits `renamed`; Escape cancels;\n * blur commits (file-explorer convention). Auto-focuses and selects on mount.\n */\n@Directive({\n  selector: 'input[treeNodeEditInput]',\n  host: {\n    '(keydown.enter)': 'commit()',\n    '(keydown.escape)': 'cancel()',\n    '(blur)': 'commit()',\n  },\n})\nexport class TreeNodeEditInput {\n  readonly #node = inject(TREE_NODE);\n  readonly #input: HTMLInputElement = inject(ElementRef).nativeElement;\n\n  constructor() {\n    afterNextRender(() => {\n      this.#input.focus();\n      this.#input.select();\n    });\n  }\n\n  protected commit() {\n    // cancel() (Escape) destroys the input, firing a trailing blur → the\n    // handle ignores commits once editing has ended.\n    this.#node.commitEdit(this.#input.value);\n  }\n\n  protected cancel() {\n    this.#node.cancelEdit();\n  }\n}\n","import { Directive, inject } from '@angular/core';\n\nimport { TREE_NODE } from './types';\n\n/**\n * Wires any element inside a node template to expand/collapse its row.\n * The tree ships no toggle UI — the consumer supplies the element.\n *\n * ```html\n * <button treeNodeToggle>{{ isExpanded ? '▾' : '▸' }}</button>\n * ```\n */\n@Directive({\n  selector: '[treeNodeToggle]',\n  host: {\n    '(click)': 'toggle($event)',\n    '[attr.data-tree-toggle]': \"''\",\n    // Out of the tab order (APG: treeitem content is not a tab stop) — the\n    // keyboard equivalent is ArrowLeft/ArrowRight on the focused row.\n    tabindex: '-1',\n  },\n})\nexport class TreeNodeToggle {\n  readonly #node = inject(TREE_NODE);\n\n  toggle(event: Event) {\n    // Row click means \"activate\" (Gmail semantics) — the toggle must not bubble into it.\n    event.stopPropagation();\n    this.#node.toggle();\n  }\n}\n","/*\n * Public API Surface of angular-tree\n */\n\nexport * from './lib/angular-tree';\nexport * from './lib/events';\nexport * from './lib/tree-node-checkbox';\nexport * from './lib/tree-node-def';\nexport * from './lib/middle-ellipsis';\nexport * from './lib/tree-node-drag-handle';\nexport * from './lib/tree-node-edit-input';\nexport * from './lib/tree-node-toggle';\nexport * from './lib/tree-state-def';\nexport * from './lib/types';\nexport * from './lib/tree-context-menu';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;AAqBA;AACM,SAAU,UAAU,CAAC,WAAmB,EAAE,QAAgB,EAAA;AAC9D,IAAA,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,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