{"version":3,"file":"allianz-ng-aquila-virtual-scroll.mjs","names":[],"sources":["../../../projects/ng-aquila/src/virtual-scroll/virtual-scroll-errors.ts","../../../projects/ng-aquila/src/virtual-scroll/virtual-scroll-viewport.token.ts","../../../projects/ng-aquila/src/virtual-scroll/virtual-for.ts","../../../projects/ng-aquila/src/virtual-scroll/virtual-scroll-viewport.ts","../../../projects/ng-aquila/src/virtual-scroll/virtual-scroll-viewport.html","../../../projects/ng-aquila/src/virtual-scroll/virtual-scroll.module.ts"],"sourcesContent":["/**\n * Returns an exception to be thrown when `nxVirtualGroupOutlet` is used outside of the\n * group template of `nxVirtualFor`.\n * @docs-private\n */\nexport function getNxVirtualGroupOutletMisplacedError(): Error {\n  return Error('nxVirtualGroupOutlet can only be used in the groupTemplate of nxVirtualFor.');\n}\n\n/**\n * Returns an exception to be thrown when the group template of `nxVirtualFor` has no\n * `nxVirtualGroupOutlet`.\n * @docs-private\n */\nexport function getNxVirtualGroupOutletMissingError(): Error {\n  return Error('The groupTemplate of nxVirtualFor needs an element with nxVirtualGroupOutlet.');\n}\n","import { InjectionToken, InputSignal, Signal } from '@angular/core';\n\n/** Represents a range of indices in a list */\nexport interface ListRange {\n  start: number;\n  end: number;\n}\n\n/** Interface for the VirtualFor directive that the viewport communicates with */\nexport interface VirtualForOf {\n  /** Get the offset position for an item by index */\n  getOffsetForIndex(index: number): number;\n\n  /** Get the height for an item by index */\n  getHeightForIndex(index: number): number;\n\n  /** Total height of all content (viewport reads this reactively) */\n  readonly totalContentHeight: Signal<number>;\n\n  /** Current visible range (viewport reads this reactively to emit visibleRangeChange) */\n  readonly visibleRange: Signal<ListRange>;\n\n  /** Called by viewport when scroll position changes */\n  updateForScroll(scrollTop: number, viewportHeight: number): void;\n}\n\n/** Interface for the virtual scroll viewport that the directive communicates with */\nexport interface VirtualScrollViewport {\n  /** Estimated item height for initial calculations */\n  readonly itemHeight: InputSignal<number>;\n\n  /** Number of items to render above/below the visible area */\n  readonly overscan: InputSignal<number>;\n\n  /** Viewport height - directive reads this for resize updates */\n  readonly viewportHeight: Signal<number>;\n\n  /** Register the VirtualFor directive so viewport can call its methods */\n  setForOf(forOf: VirtualForOf): void;\n\n  /** Scroll to a specific index */\n  scrollToIndex(index: number, behavior?: ScrollBehavior): void;\n\n  /** Scroll an item into view using 'nearest' behavior (minimal scrolling) */\n  scrollIntoView(index: number): void;\n\n  /** Get the current DOM scroll position directly (bypassing signal) */\n  getDomScrollTop(): number;\n\n  /** Get the current DOM viewport height directly (bypassing signal) */\n  getDomViewportHeight(): number;\n\n  /** Check if viewport is currently scrolled to the bottom (using DOM values) */\n  isAtBottom(): boolean;\n\n  /** Imperatively update the spacer height on the DOM (bypasses signal/template async) */\n  updateSpacerHeight(height: number): void;\n\n  /** Set the scroll position directly */\n  setScrollTop(scrollTop: number): void;\n\n  /** Check if scroll is currently active (to avoid interrupting animations) */\n  isScrollActive(): boolean;\n}\n\n/** Injection token for the virtual scroll viewport */\nexport const NX_VIRTUAL_SCROLL_VIEWPORT = new InjectionToken<VirtualScrollViewport>(\n  'NxVirtualScrollViewport',\n);\n","import {\n  afterNextRender,\n  computed,\n  DestroyRef,\n  Directive,\n  effect,\n  EmbeddedViewRef,\n  ErrorHandler,\n  inject,\n  InjectionToken,\n  Injector,\n  input,\n  isDevMode,\n  NgZone,\n  OnDestroy,\n  signal,\n  TemplateRef,\n  untracked,\n  ViewContainerRef,\n  ViewRef,\n} from '@angular/core';\n\nimport {\n  getNxVirtualGroupOutletMisplacedError,\n  getNxVirtualGroupOutletMissingError,\n} from './virtual-scroll-errors';\nimport {\n  ListRange,\n  NX_VIRTUAL_SCROLL_VIEWPORT,\n  VirtualForOf,\n  VirtualScrollViewport,\n} from './virtual-scroll-viewport.token';\n\n/** Context provided to templates rendered by NxVirtualFor */\nexport interface NxVirtualForContext<T> {\n  /** The item data (available as implicit) */\n  $implicit: T;\n  /** The index in the source array */\n  index: number;\n  /** Total number of items */\n  count: number;\n  /** Whether this is the first item */\n  first: boolean;\n  /** Whether this is the last item */\n  last: boolean;\n  /** Whether the index is even */\n  even: boolean;\n  /** Whether the index is odd */\n  odd: boolean;\n}\n\n/** Context provided to the group template of NxVirtualFor */\nexport interface NxVirtualForGroupContext<G> {\n  /** The group as returned by `groupBy` */\n  $implicit: G;\n}\n\n/** Function type for trackBy */\nexport type TrackByFunction<T> = (index: number, item: T) => unknown;\n\n/** Accessor type - can be a property name string or a function */\nexport type TrackByAccessor<T> = string | TrackByFunction<T>;\n\ninterface GroupOutletRef {\n  viewContainerRef: ViewContainerRef | null;\n  changed: (() => void) | null;\n}\n\ninterface ItemGroup<G> {\n  group: G;\n  key: unknown;\n}\n\ninterface GroupView<G> {\n  view: EmbeddedViewRef<NxVirtualForGroupContext<G>>;\n  outlet: ViewContainerRef;\n  outletRef: GroupOutletRef;\n  key: unknown;\n}\n\nconst NX_VIRTUAL_GROUP_OUTLET_REF = new InjectionToken<GroupOutletRef>('NxVirtualGroupOutletRef');\n\n/** Marks where the items of a group are rendered inside the group template of `nxVirtualFor`. */\n@Directive({\n  selector: '[nxVirtualGroupOutlet]',\n})\nexport class NxVirtualGroupOutlet implements OnDestroy {\n  private readonly _outletRef: GroupOutletRef;\n  private readonly _viewContainerRef = inject(ViewContainerRef);\n\n  constructor() {\n    const outletRef = inject(NX_VIRTUAL_GROUP_OUTLET_REF, { optional: true });\n    if (!outletRef) {\n      throw getNxVirtualGroupOutletMisplacedError();\n    }\n    this._outletRef = outletRef;\n    outletRef.viewContainerRef = this._viewContainerRef;\n    outletRef.changed?.();\n  }\n\n  ngOnDestroy(): void {\n    if (this._outletRef.viewContainerRef === this._viewContainerRef) {\n      this._outletRef.viewContainerRef = null;\n    }\n    this._outletRef.changed?.();\n  }\n}\n\n/**\n * Structural directive for rendering items in a virtual scroll viewport.\n * @example\n * ```html\n * <nx-virtual-viewport>\n *   <div *nxVirtualFor=\"let item of items(); trackBy: 'id'\">\n *     {{ item.name }}\n *   </div>\n * </nx-virtual-viewport>\n * ```\n */\n@Directive({\n  selector: '[nxVirtualFor][nxVirtualForOf]',\n})\nexport class NxVirtualFor<T, G = unknown> implements VirtualForOf {\n  /** The data source (array of items) */\n  readonly nxVirtualForOf = input.required<T[]>();\n\n  /** Property name or function to use for tracking items */\n  readonly nxVirtualForTrackBy = input<TrackByAccessor<T>>('');\n\n  /**\n   * Returns the group of an item, or `null` for items without a group.\n   * The rendered items of each group (compared by `groupTrackBy`) are placed in one instance of\n   * `groupTemplate`. The items of a group must be next to each other, the data isn't reordered.\n   */\n  readonly nxVirtualForGroupBy = input<((item: T) => G | null | undefined) | null>(null);\n\n  /**\n   * Property name or function that identifies a group. Defaults to the group itself.\n   * A group that is replaced by an object with the same key keeps its container and items.\n   */\n  readonly nxVirtualForGroupTrackBy = input<string | ((group: G) => unknown)>('');\n\n  /**\n   * Template that wraps the rendered items of each group, e.g. to give them a `role=\"group\"`.\n   * Mark the place of the items with `nxVirtualGroupOutlet`. The wrapper must only contain the\n   * outlet and must not create a containing block, so the items are still positioned in the viewport.\n   */\n  readonly nxVirtualForGroupTemplate = input<TemplateRef<NxVirtualForGroupContext<G>> | null>(null);\n\n  private readonly _template = inject(TemplateRef<NxVirtualForContext<T>>);\n  private readonly _viewContainerRef = inject(ViewContainerRef);\n  private readonly _viewport = inject<VirtualScrollViewport>(NX_VIRTUAL_SCROLL_VIEWPORT);\n  private readonly _ngZone = inject(NgZone);\n  private readonly _destroyRef = inject(DestroyRef);\n  private readonly _injector = inject(Injector);\n  private readonly _errorHandler = inject(ErrorHandler);\n\n  /** Cache of embedded views by index */\n  private readonly _viewCache = new Map<number, EmbeddedViewRef<NxVirtualForContext<T>>>();\n\n  /** Cache of item keys for efficient view recycling */\n  private readonly _keyCache = new Map<number, unknown>();\n\n  /** Group of each item, `null` for items without a group */\n  private _itemGroups: (ItemGroup<G> | null)[] = [];\n\n  /** Group view that contains each rendered item view, `null` for items in the root container */\n  private readonly _groupCache = new Map<number, GroupView<G> | null>();\n\n  /** Rendered group views by group key */\n  private readonly _groupViews = new Map<unknown, GroupView<G>>();\n\n  /** Group template that the rendered group views were created from */\n  private _groupTemplateInUse: TemplateRef<NxVirtualForGroupContext<G>> | null = null;\n\n  /** Set when the group template has no outlet, items are then rendered without groups */\n  private _groupTemplateInvalid = false;\n\n  private _groupLayoutChecked = false;\n\n  private _repeatedGroupWarned = false;\n\n  private _renderRafId: number | null = null;\n\n  private _destroyed = false;\n\n  /** Cache of measured heights, keyed by trackBy identity */\n  private readonly _heightCache = new Map<unknown, number>();\n\n  /** Maximum cache size before triggering cleanup */\n  private readonly _heightCacheMaxSize = 1000;\n\n  /** Cached position data for all items */\n  private readonly _positionCache = signal<{ offset: number; height: number }[]>([]);\n\n  /** Total height of all content (viewport reads this reactively) */\n  readonly totalContentHeight = computed(() => {\n    const positions = this._positionCache();\n    if (positions.length === 0) {\n      return 0;\n    }\n    const last = positions[positions.length - 1];\n    return last.offset + last.height;\n  });\n\n  /** Current visible range (start and end indices) */\n  private readonly _visibleRange = signal<ListRange>({ start: 0, end: 0 });\n\n  /** Public accessor for visible range (viewport reads this reactively to emit visibleRangeChange) */\n  readonly visibleRange = computed(() => this._visibleRange());\n\n  /** ResizeObserver for monitoring item size changes */\n  private _itemResizeObserver: ResizeObserver | null = null;\n\n  /** Set of currently observed elements */\n  private readonly _observedElements = new Set<Element>();\n\n  /** RAF request ID for measurement, set while a measurement is pending */\n  private _measureRafId: number | null = null;\n\n  /** Whether initialization is complete */\n  private _initialized = false;\n\n  constructor() {\n    // Register with viewport\n    this._viewport.setForOf(this);\n\n    // React to data changes - recalculate positions and render\n    effect(() => {\n      const data = this.nxVirtualForOf();\n      this._rebuildItemGroups(data);\n      this._rebuildPositionCache(data);\n\n      if (this._initialized) {\n        // Otherwise the effect reruns on every measurement, which writes `_positionCache` that the render reads.\n        // A signal read only during the render won't rerun the effect, so read new inputs above it.\n        untracked(() => this._updateAndRender(true));\n      }\n    });\n\n    // React to viewport resize - recalculate visible range\n    effect(() => {\n      this._viewport.viewportHeight();\n\n      if (this._initialized) {\n        this._updateAndRender();\n      }\n    });\n\n    this._destroyRef.onDestroy(() => {\n      this._destroyed = true;\n      if (this._renderRafId !== null) {\n        cancelAnimationFrame(this._renderRafId);\n      }\n    });\n\n    // Set up after first render\n    afterNextRender(\n      () => {\n        this._setupItemResizeObserver();\n        this._initialized = true;\n        this._updateAndRender();\n      },\n      { injector: this._injector },\n    );\n  }\n\n  /**\n   * Get the offset position for an item (called by viewport for scrollToIndex)\n   */\n  getOffsetForIndex(index: number): number {\n    const positions = this._positionCache();\n    if (index < 0 || index >= positions.length) {\n      return 0;\n    }\n    return positions[index].offset;\n  }\n\n  /**\n   * Get the height for an item (called by viewport for scrollIntoView)\n   */\n  getHeightForIndex(index: number): number {\n    const positions = this._positionCache();\n    if (index < 0 || index >= positions.length) {\n      return this._viewport.itemHeight();\n    }\n    return positions[index].height;\n  }\n\n  /** trackBy accessor resolved to a function */\n  private readonly _trackByFn = computed<TrackByFunction<T> | null>(() => {\n    const accessor = this.nxVirtualForTrackBy();\n    if (!accessor) {\n      return null;\n    }\n    if (typeof accessor === 'function') {\n      return accessor;\n    }\n    return (_index: number, item: T) => (item as { [key: string]: unknown })[accessor];\n  });\n\n  /** groupTrackBy accessor resolved to a function */\n  private readonly _groupKeyFn = computed<(group: G) => unknown>(() => {\n    const accessor = this.nxVirtualForGroupTrackBy();\n    if (!accessor) {\n      return (group: G) => group;\n    }\n    if (typeof accessor === 'function') {\n      return accessor;\n    }\n    return (group: G) => (group as { [key: string]: unknown })[accessor];\n  });\n\n  /**\n   * Get the tracking key for an item\n   */\n  private _getItemKey(index: number, item: T): unknown {\n    const trackByFn = this._trackByFn();\n    if (trackByFn) {\n      return trackByFn(index, item);\n    }\n    return item;\n  }\n\n  /**\n   * Get the height for an item (cached or estimated)\n   */\n  private _getItemHeight(item: T, index: number): number {\n    const key = this._getItemKey(index, item);\n    return this._heightCache.get(key) ?? this._viewport.itemHeight();\n  }\n\n  /**\n   * Cache the measured height for an item\n   */\n  private _cacheHeight(key: unknown, height: number): boolean {\n    const currentHeight = this._heightCache.get(key);\n    if (currentHeight !== height) {\n      // Clean up cache if too large\n      if (this._heightCache.size >= this._heightCacheMaxSize) {\n        // Remove oldest entries (FIFO)\n        const toRemove = this._heightCache.size - this._heightCacheMaxSize + 1;\n        const keys = this._heightCache.keys();\n        for (let i = 0; i < toRemove; i++) {\n          const keyResult = keys.next();\n          if (!keyResult.done) {\n            this._heightCache.delete(keyResult.value);\n          }\n        }\n      }\n      this._heightCache.set(key, height);\n      return true;\n    }\n    return false;\n  }\n\n  /**\n   * Rebuild position cache from data using height cache.\n   * Returns the new total content height.\n   */\n  private _rebuildPositionCache(data: T[]): number {\n    const positions: { offset: number; height: number }[] = [];\n    let currentOffset = 0;\n\n    for (let i = 0; i < data.length; i++) {\n      const height = this._getItemHeight(data[i], i);\n      positions.push({ offset: currentOffset, height });\n      currentOffset += height;\n    }\n\n    this._positionCache.set(positions);\n    return currentOffset; // This is the total height\n  }\n\n  private _rebuildItemGroups(data: T[]): void {\n    const groupBy = this.nxVirtualForGroupBy();\n    if (!groupBy || !this.nxVirtualForGroupTemplate()) {\n      this._itemGroups = [];\n      return;\n    }\n\n    const groupKey = this._groupKeyFn();\n    const finishedKeys = new Set<unknown>();\n    const itemGroups: (ItemGroup<G> | null)[] = [];\n    let current: ItemGroup<G> | null = null;\n    for (const item of data) {\n      const group = groupBy(item) ?? null;\n      const key = group === null ? null : groupKey(group);\n      if (current && current.key !== key) {\n        finishedKeys.add(current.key);\n      }\n      if (group === null) {\n        current = null;\n      } else if (!current || current.key !== key) {\n        if (finishedKeys.has(key)) {\n          this._warnRepeatedGroup(key);\n        }\n        current = { group, key };\n      }\n      itemGroups.push(current);\n    }\n    this._itemGroups = itemGroups;\n  }\n\n  private _warnRepeatedGroup(key: unknown): void {\n    if (this._repeatedGroupWarned || !isDevMode()) {\n      return;\n    }\n    this._repeatedGroupWarned = true;\n    console.warn(\n      'NxVirtualFor: A group appears more than once in the data, its items are rendered in its first container. ' +\n        'Pass the data in display order, with the items of each group next to each other.',\n      key,\n    );\n  }\n\n  /**\n   * Find the start index for a given scroll position using binary search\n   */\n  private _findStartIndex(scrollTop: number): number {\n    const positions = this._positionCache();\n    if (positions.length === 0) {\n      return 0;\n    }\n\n    let low = 0;\n    let high = positions.length - 1;\n\n    while (low < high) {\n      const mid = Math.floor((low + high) / 2);\n      const position = positions[mid];\n\n      if (position.offset + position.height <= scrollTop) {\n        low = mid + 1;\n      } else {\n        high = mid;\n      }\n    }\n\n    return low;\n  }\n\n  /**\n   * Calculate the visible range based on scroll position and viewport height\n   */\n  private _calculateVisibleRange(scrollTop: number, viewportHeight: number): ListRange {\n    const positions = this._positionCache();\n    const itemCount = positions.length;\n\n    if (itemCount === 0) {\n      return { start: 0, end: 0 };\n    }\n\n    const overscan = this._viewport.overscan();\n\n    // Find start with binary search\n    let start = this._findStartIndex(scrollTop);\n\n    // Apply overscan to start\n    start = Math.max(0, start - overscan);\n\n    // Find end by walking forward\n    let end = start;\n    const scrollBottom = scrollTop + viewportHeight;\n\n    while (end < itemCount && positions[end].offset < scrollBottom) {\n      end++;\n    }\n\n    // Apply overscan to end\n    end = Math.min(itemCount, end + overscan);\n\n    return { start, end };\n  }\n\n  /**\n   * Called by viewport when scroll position changes.\n   * Directly updates visible range and renders items.\n   */\n  updateForScroll(scrollTop: number, viewportHeight: number): void {\n    this._updateVisibleRange(scrollTop, viewportHeight);\n  }\n\n  /**\n   * Internal helper to update and render using current DOM values\n   * @param forceRender If true, always re-render even if range hasn't changed\n   */\n  private _updateAndRender(forceRender = false): void {\n    const scrollTop = this._viewport.getDomScrollTop();\n    const viewportHeight = this._viewport.getDomViewportHeight();\n    this._updateVisibleRange(scrollTop, viewportHeight, forceRender);\n  }\n\n  /**\n   * Update the visible range and render items if changed\n   * @param scrollTop Current scroll position\n   * @param viewportHeight Current viewport height\n   * @param forceRender If true, always re-render even if range hasn't changed\n   */\n  private _updateVisibleRange(\n    scrollTop: number,\n    viewportHeight: number,\n    forceRender = false,\n  ): void {\n    const newRange = this._calculateVisibleRange(scrollTop, viewportHeight);\n    const currentRange = this._visibleRange();\n    const rangeChanged = newRange.start !== currentRange.start || newRange.end !== currentRange.end;\n\n    if (rangeChanged) {\n      this._visibleRange.set(newRange);\n    }\n\n    if (rangeChanged || forceRender) {\n      this._renderItems(newRange, this.nxVirtualForOf());\n    }\n  }\n\n  /**\n   * Create the template context for an item\n   */\n  private _createContext(item: T, index: number, count: number): NxVirtualForContext<T> {\n    return {\n      $implicit: item,\n      index,\n      count,\n      first: index === 0,\n      last: index === count - 1,\n      even: index % 2 === 0,\n      odd: index % 2 !== 0,\n    };\n  }\n\n  /**\n   * Update an existing context with new values\n   */\n  private _updateContext(\n    context: NxVirtualForContext<T>,\n    item: T,\n    index: number,\n    count: number,\n  ): void {\n    context.$implicit = item;\n    context.index = index;\n    context.count = count;\n    context.first = index === 0;\n    context.last = index === count - 1;\n    context.even = index % 2 === 0;\n    context.odd = index % 2 !== 0;\n  }\n\n  /**\n   * Render items in the given range\n   */\n  private _renderItems(range: ListRange, data: T[]): void {\n    const count = data.length;\n    const start = range.start;\n    const end = Math.min(range.end, count);\n    const positions = this._positionCache();\n\n    if (this.nxVirtualForGroupTemplate() !== this._groupTemplateInUse) {\n      this._resetGroupViews();\n    }\n    // An outlet inside control flow can be destroyed or replaced, together with the item views in it.\n    for (const groupView of this._groupViews.values()) {\n      if (this._groupTemplateInvalid || groupView.outletRef.viewContainerRef !== groupView.outlet) {\n        this._destroyGroupView(groupView);\n      }\n    }\n\n    // Remove views outside range\n    for (const index of this._viewCache.keys()) {\n      if (index < start || index >= end) {\n        this._destroyItemView(index);\n      }\n    }\n    // Before placing views, so the remaining ones don't have to move around them.\n    this._destroyUnusedGroupViews(start, end);\n\n    // Views are kept in item order in the DOM, so assistive technology reads them in order.\n    let rootIndex = 0;\n    let hasUnmeasuredRows = false;\n    const outletIndices = new Map<GroupView<G>, number>();\n\n    for (let i = start; i < end; i++) {\n      const item = data[i];\n      const newKey = this._getItemKey(i, item);\n      const offset = positions[i]?.offset ?? i * this._viewport.itemHeight();\n\n      const groupView = this._getGroupView(i, rootIndex);\n      let containerIndex: number;\n      if (groupView) {\n        if (!outletIndices.has(groupView)) {\n          this._placeView(this._viewContainerRef, groupView.view, rootIndex++);\n        }\n        containerIndex = outletIndices.get(groupView) ?? 0;\n        outletIndices.set(groupView, containerIndex + 1);\n      } else {\n        containerIndex = rootIndex++;\n      }\n      const container = groupView?.outlet ?? this._viewContainerRef;\n\n      let view = this._viewCache.get(i);\n\n      // Check if we need to recreate the view (item or its group changed)\n      if (view && (this._keyCache.get(i) !== newKey || this._groupCache.get(i) !== groupView)) {\n        this._destroyItemView(i);\n        view = undefined;\n      }\n\n      if (!view) {\n        // Create new view\n        const context = this._createContext(item, i, count);\n        view = container.createEmbeddedView(this._template, context, {\n          index: containerIndex,\n          injector: this._injector,\n        });\n        // Without it, a root element that only wraps control flow is measured empty when nothing checks the view first.\n        view.detectChanges();\n        this._viewCache.set(i, view);\n        this._keyCache.set(i, newKey);\n        this._groupCache.set(i, groupView);\n      } else {\n        this._placeView(container, view, containerIndex);\n        // Update existing view's context\n        this._updateContext(view.context, item, i, count);\n        view.markForCheck();\n      }\n\n      // Position the view and set the data attribute for measurement\n      const rootNode = view.rootNodes[0];\n      if (rootNode instanceof HTMLElement) {\n        rootNode.style.position = 'absolute';\n        rootNode.style.top = '0';\n        rootNode.style.left = '0';\n        rootNode.style.width = '100%';\n        rootNode.style.transform = `translateY(${offset}px)`;\n        rootNode.setAttribute('data-virtual-index', String(i));\n        hasUnmeasuredRows ||= !this._observedElements.has(rootNode);\n      }\n    }\n\n    // Measured rows are observed. Remeasuring them after every render never settles when rows share a key.\n    if (this._initialized && hasUnmeasuredRows) {\n      this._scheduleMeasurement();\n    }\n  }\n\n  private _placeView(container: ViewContainerRef, view: ViewRef, index: number): void {\n    if (container.get(index) !== view) {\n      container.move(view, index);\n    }\n  }\n\n  private _destroyItemView(index: number): void {\n    this._viewCache.get(index)?.destroy();\n    this._viewCache.delete(index);\n    this._keyCache.delete(index);\n    this._groupCache.delete(index);\n  }\n\n  /** Returns the group view of an item, creating it at `rootIndex` if it doesn't exist yet. */\n  private _getGroupView(index: number, rootIndex: number): GroupView<G> | null {\n    const itemGroup = this._itemGroups[index];\n    if (!itemGroup || !this._groupTemplateInUse || this._groupTemplateInvalid) {\n      return null;\n    }\n\n    const existing = this._groupViews.get(itemGroup.key);\n    if (!existing) {\n      return this._createGroupView(itemGroup, this._groupTemplateInUse, rootIndex);\n    }\n    if (existing.view.context.$implicit !== itemGroup.group) {\n      existing.view.context.$implicit = itemGroup.group;\n      existing.view.markForCheck();\n    }\n    return existing;\n  }\n\n  private _createGroupView(\n    itemGroup: ItemGroup<G>,\n    template: TemplateRef<NxVirtualForGroupContext<G>>,\n    rootIndex: number,\n  ): GroupView<G> | null {\n    const outletRef: GroupOutletRef = { viewContainerRef: null, changed: null };\n    const view = this._viewContainerRef.createEmbeddedView(\n      template,\n      { $implicit: itemGroup.group },\n      {\n        index: rootIndex,\n        injector: Injector.create({\n          providers: [{ provide: NX_VIRTUAL_GROUP_OUTLET_REF, useValue: outletRef }],\n          parent: this._injector,\n        }),\n      },\n    );\n    // An outlet inside control flow only exists after change detection.\n    view.detectChanges();\n\n    if (!outletRef.viewContainerRef) {\n      view.destroy();\n      // Set before throwing, so later renders fall back to items without groups instead of throwing again.\n      this._groupTemplateInvalid = true;\n      this._scheduleRender();\n      if (isDevMode()) {\n        throw getNxVirtualGroupOutletMissingError();\n      }\n      return null;\n    }\n\n    const groupView: GroupView<G> = {\n      view,\n      outlet: outletRef.viewContainerRef,\n      outletRef,\n      key: itemGroup.key,\n    };\n    outletRef.changed = () => this._scheduleRender();\n    this._groupViews.set(itemGroup.key, groupView);\n    return groupView;\n  }\n\n  /** Destroys a group view together with the item views in it. */\n  private _destroyGroupView(groupView: GroupView<G>): void {\n    for (const [index, itemGroupView] of this._groupCache) {\n      if (itemGroupView === groupView) {\n        this._destroyItemView(index);\n      }\n    }\n    groupView.outletRef.changed = null;\n    groupView.view.destroy();\n    this._groupViews.delete(groupView.key);\n  }\n\n  private _scheduleRender(): void {\n    if (this._renderRafId !== null || this._destroyed) {\n      return;\n    }\n    this._ngZone.runOutsideAngular(() => {\n      this._renderRafId = requestAnimationFrame(() => {\n        this._renderRafId = null;\n        this._ngZone.run(() => this._forceRender());\n      });\n    });\n  }\n\n  /** Destroys the group views that no item in the range belongs to. */\n  private _destroyUnusedGroupViews(start: number, end: number): void {\n    const usedGroupViews = new Set<GroupView<G>>();\n    for (let i = start; i < end; i++) {\n      const itemGroup = this._itemGroups[i];\n      const groupView = itemGroup && this._groupViews.get(itemGroup.key);\n      if (groupView) {\n        usedGroupViews.add(groupView);\n      }\n    }\n    for (const groupView of this._groupViews.values()) {\n      if (!usedGroupViews.has(groupView)) {\n        this._destroyGroupView(groupView);\n      }\n    }\n  }\n\n  private _resetGroupViews(): void {\n    for (const groupView of this._groupViews.values()) {\n      this._destroyGroupView(groupView);\n    }\n    this._groupTemplateInUse = this.nxVirtualForGroupTemplate();\n    this._groupTemplateInvalid = false;\n    this._groupLayoutChecked = false;\n  }\n\n  /** Warns once about a group template whose layout would misplace the items. */\n  private _checkGroupLayout(): void {\n    const groupView = this._groupViews.values().next().value;\n    if (!groupView) {\n      return;\n    }\n    this._groupLayoutChecked = true;\n\n    const root = groupView.view.rootNodes[0];\n    if (!(root instanceof HTMLElement)) {\n      return;\n    }\n    const style = getComputedStyle(root);\n    const createsContainingBlock =\n      style.position !== 'static' ||\n      style.transform !== 'none' ||\n      style.perspective !== 'none' ||\n      style.filter !== 'none' ||\n      /layout|paint|strict|content/.test(style.contain) ||\n      /transform|perspective|filter/.test(style.willChange);\n    if (createsContainingBlock || root.offsetHeight > 0) {\n      console.warn(\n        'NxVirtualFor: The root element of the group template must only contain the nxVirtualGroupOutlet and must not create a containing block (position, transform, perspective, filter, contain or will-change), otherwise the items are positioned incorrectly.',\n      );\n    }\n  }\n\n  /**\n   * Set up ResizeObserver to monitor item size changes\n   */\n  private _setupItemResizeObserver(): void {\n    this._itemResizeObserver = new ResizeObserver(() => this._scheduleMeasurement());\n\n    this._destroyRef.onDestroy(() => {\n      this._itemResizeObserver?.disconnect();\n      if (this._measureRafId !== null) {\n        cancelAnimationFrame(this._measureRafId);\n      }\n    });\n  }\n\n  /**\n   * Schedule a measurement of visible items\n   */\n  private _scheduleMeasurement(): void {\n    if (this._measureRafId !== null) {\n      return;\n    }\n\n    this._ngZone.runOutsideAngular(() => {\n      this._measureRafId = requestAnimationFrame(() => {\n        this._measureRafId = null;\n        this._measureRenderedItems();\n      });\n    });\n  }\n\n  /**\n   * Measure all currently rendered items and update caches\n   */\n  private _measureRenderedItems(): void {\n    if (!this._groupLayoutChecked && isDevMode()) {\n      this._checkGroupLayout();\n    }\n\n    const data = this.nxVirtualForOf();\n    const dataLength = data.length;\n\n    // Get rendered elements from view cache\n    let hasChanges = false;\n    const currentElements = new Set<Element>();\n\n    for (const [index, view] of this._viewCache) {\n      const rootNode = view.rootNodes[0];\n      if (!(rootNode instanceof HTMLElement)) {\n        continue;\n      }\n\n      if (index < 0 || index >= dataLength) {\n        continue;\n      }\n\n      currentElements.add(rootNode);\n\n      const measuredHeight = rootNode.offsetHeight;\n      const item = data[index];\n      const key = this._getItemKey(index, item);\n\n      if (this._cacheHeight(key, measuredHeight)) {\n        hasChanges = true;\n      }\n\n      // Add to resize observer if not already observed\n      if (!this._observedElements.has(rootNode)) {\n        // The measured offsetHeight is the border box; the default content box misses padding and border changes.\n        this._itemResizeObserver?.observe(rootNode, { box: 'border-box' });\n        this._observedElements.add(rootNode);\n      }\n    }\n\n    // Unobserve elements that are no longer rendered\n    for (const element of this._observedElements) {\n      if (!currentElements.has(element)) {\n        this._itemResizeObserver?.unobserve(element);\n        this._observedElements.delete(element);\n      }\n    }\n\n    if (hasChanges) {\n      this._ngZone.run(() => {\n        // 1. Capture state BEFORE rebuilding\n        const scrollTop = this._viewport.getDomScrollTop();\n        const viewportHeight = this._viewport.getDomViewportHeight();\n        const oldTotalHeight = this.totalContentHeight();\n        const wasAtBottom = scrollTop >= oldTotalHeight - viewportHeight - 1;\n\n        const anchorIndex = this._findStartIndex(scrollTop);\n        const oldAnchorOffset = this._positionCache()[anchorIndex]?.offset ?? 0;\n\n        // 2. Rebuild positions with new heights\n        const newTotalHeight = this._rebuildPositionCache(data);\n\n        // 3. Update spacer\n        this._viewport.updateSpacerHeight(newTotalHeight);\n\n        // 4. Adjust scroll position only when NOT actively scrolling\n        // This prevents interrupting smooth scroll animations\n        if (!this._viewport.isScrollActive()) {\n          if (wasAtBottom) {\n            // Stay at bottom\n            const newMaxScroll = newTotalHeight - viewportHeight;\n            this._viewport.setScrollTop(Math.max(0, newMaxScroll));\n          } else {\n            // Anchor to maintain visual position\n            const newAnchorOffset = this._positionCache()[anchorIndex]?.offset ?? 0;\n            const scrollDelta = newAnchorOffset - oldAnchorOffset;\n            if (scrollDelta !== 0) {\n              this._viewport.setScrollTop(scrollTop + scrollDelta);\n            }\n          }\n        }\n\n        // 5. Forced, since neither the new heights nor a scroll adjustment have to change the range.\n        this._forceRender();\n      });\n    }\n  }\n\n  /** Runs outside of change detection, so errors, e.g. a missing group outlet, are reported like there. */\n  private _forceRender(): void {\n    try {\n      this._updateAndRender(true);\n    } catch (error) {\n      this._errorHandler.handleError(error);\n    }\n  }\n}\n","import {\n  afterNextRender,\n  ChangeDetectionStrategy,\n  Component,\n  computed,\n  DestroyRef,\n  effect,\n  ElementRef,\n  inject,\n  Injector,\n  input,\n  NgZone,\n  output,\n  signal,\n  viewChild,\n} from '@angular/core';\n\nimport {\n  NX_VIRTUAL_SCROLL_VIEWPORT,\n  VirtualForOf,\n  VirtualScrollViewport,\n} from './virtual-scroll-viewport.token';\n\n/** Event emitted when visible range changes */\nexport interface VirtualRangeChangeEvent {\n  start: number;\n  end: number;\n}\n\n@Component({\n  selector: 'nx-virtual-viewport',\n  templateUrl: './virtual-scroll-viewport.html',\n  styleUrl: './virtual-scroll-viewport.scss',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  host: {\n    class: 'nx-virtual-viewport',\n  },\n  providers: [{ provide: NX_VIRTUAL_SCROLL_VIEWPORT, useExisting: NxVirtualViewportComponent }],\n})\nexport class NxVirtualViewportComponent implements VirtualScrollViewport {\n  /** Estimated height in pixels for items before measurement (default: 36) */\n  readonly itemHeight = input<number>(36);\n\n  /** Number of items to render above/below the visible area (default: 20) */\n  readonly overscan = input<number>(20);\n\n  /** Emitted when the visible range changes */\n  readonly visibleRangeChange = output<VirtualRangeChangeEvent>();\n\n  readonly _viewport = viewChild.required<ElementRef<HTMLElement>>('viewport');\n  readonly _sizer = viewChild.required<ElementRef<HTMLElement>>('sizer');\n\n  private readonly _ngZone = inject(NgZone);\n  private readonly _destroyRef = inject(DestroyRef);\n  private readonly _injector = inject(Injector);\n\n  /** Reference to the VirtualFor directive */\n  private readonly _virtualFor = signal<VirtualForOf | null>(null);\n\n  /** Viewport height (measured) */\n  private readonly _viewportHeight = signal<number>(0);\n\n  /** RAF request ID for scroll handling */\n  private _scrollRafId: number | null = null;\n\n  /** ResizeObserver for monitoring viewport size changes */\n  private _viewportResizeObserver: ResizeObserver | null = null;\n\n  /** Whether a smooth scroll animation is in progress */\n  private _smoothScrollInProgress = false;\n\n  /** Target index for smooth scroll (to correct position after animation) */\n  private _smoothScrollTargetIndex: number | null = null;\n\n  /** Timeout for detecting smooth scroll completion */\n  private _smoothScrollTimeout: ReturnType<typeof setTimeout> | null = null;\n\n  /** Viewport height - directive reads this for resize updates */\n  readonly viewportHeight = computed(() => this._viewportHeight());\n\n  /** Total content height in pixels (read-only, for template) */\n  readonly totalHeight = computed(() => this._virtualFor()?.totalContentHeight() ?? 0);\n\n  constructor() {\n    // Set up after first render\n    afterNextRender(\n      () => {\n        this._setupScrollListener();\n        this._setupViewportResizeObserver();\n        this._measureViewportHeight();\n      },\n      { injector: this._injector },\n    );\n\n    // Watch the directive's visible range and emit the output\n    effect(() => {\n      const forOf = this._virtualFor();\n      if (forOf) {\n        const range = forOf.visibleRange();\n        this.visibleRangeChange.emit({ start: range.start, end: range.end });\n      }\n    });\n  }\n\n  /**\n   * Register the VirtualFor directive so viewport can call its methods.\n   * We register it instead of a contentChild query that it is available as early as possible and\n   * for edge cases when the directive would be wrapped in another component.\n   */\n  setForOf(forOf: VirtualForOf): void {\n    this._virtualFor.set(forOf);\n  }\n\n  /**\n   * Scroll to a specific index\n   * @param index The index to scroll to\n   * @param behavior Scroll behavior ('auto' | 'smooth')\n   */\n  scrollToIndex(index: number, behavior: ScrollBehavior = 'auto'): void {\n    const virtualFor = this._virtualFor();\n    if (!virtualFor) {\n      return;\n    }\n\n    // Track smooth scrolling to avoid interrupting the animation\n    if (behavior === 'smooth') {\n      this._smoothScrollInProgress = true;\n      this._smoothScrollTargetIndex = index;\n    }\n\n    const offset = virtualFor.getOffsetForIndex(index);\n    this._viewport().nativeElement.scrollTo({ top: offset, behavior });\n  }\n\n  /**\n   * Scroll an item into view using 'nearest' behavior (minimal scrolling)\n   */\n  scrollIntoView(index: number): void {\n    const virtualFor = this._virtualFor();\n    if (!virtualFor) {\n      return;\n    }\n\n    const viewport = this._viewport().nativeElement;\n    const scrollTop = viewport.scrollTop;\n    const viewportHeight = viewport.clientHeight;\n    const itemOffset = virtualFor.getOffsetForIndex(index);\n    const itemHeight = virtualFor.getHeightForIndex(index);\n\n    const itemTop = itemOffset;\n    const itemBottom = itemOffset + itemHeight;\n    const viewportTop = scrollTop;\n    const viewportBottom = scrollTop + viewportHeight;\n\n    if (itemTop < viewportTop) {\n      // Item is above viewport, scroll up\n      viewport.scrollTo({ top: itemTop, behavior: 'auto' });\n    } else if (itemBottom > viewportBottom) {\n      // Item is below viewport, scroll down\n      viewport.scrollTo({ top: itemBottom - viewportHeight, behavior: 'auto' });\n    }\n    // Otherwise item is already visible, no scroll needed\n  }\n\n  /**\n   * Set up the scroll event listener with RAF throttling\n   */\n  private _setupScrollListener(): void {\n    const viewport = this._viewport().nativeElement;\n\n    const handleScroll = () => {\n      if (this._scrollRafId === null) {\n        this._scrollRafId = requestAnimationFrame(() => {\n          this._scrollRafId = null;\n          this._onScroll();\n        });\n      }\n    };\n\n    this._ngZone.runOutsideAngular(() => {\n      viewport.addEventListener('scroll', handleScroll, { passive: true });\n    });\n\n    this._destroyRef.onDestroy(() => {\n      viewport.removeEventListener('scroll', handleScroll);\n      if (this._scrollRafId !== null) {\n        cancelAnimationFrame(this._scrollRafId);\n      }\n      if (this._smoothScrollTimeout !== null) {\n        clearTimeout(this._smoothScrollTimeout);\n      }\n    });\n  }\n\n  /**\n   * Handle scroll event (called via RAF)\n   */\n  private _onScroll(): void {\n    // If smooth scroll is in progress, reset the idle timeout\n    // This detects when the animation completes (no more scroll events)\n    if (this._smoothScrollInProgress) {\n      if (this._smoothScrollTimeout !== null) {\n        clearTimeout(this._smoothScrollTimeout);\n      }\n      this._smoothScrollTimeout = setTimeout(() => {\n        this._smoothScrollInProgress = false;\n        this._smoothScrollTimeout = null;\n        // After smooth scroll completes, do a final instant scroll to correct position\n        // (heights may have changed during scrolling, making the original offset wrong)\n        if (this._smoothScrollTargetIndex !== null) {\n          const targetIndex = this._smoothScrollTargetIndex;\n          this._smoothScrollTargetIndex = null;\n          this.scrollToIndex(targetIndex, 'auto');\n        }\n      }, 150);\n    }\n\n    const el = this._viewport().nativeElement;\n    const scrollTop = el.scrollTop;\n\n    // Directly tell the directive to update with new scroll position\n    const virtualFor = this._virtualFor();\n    if (virtualFor) {\n      this._ngZone.run(() => {\n        virtualFor.updateForScroll(scrollTop, this._viewportHeight());\n      });\n    }\n  }\n\n  /**\n   * Get the current DOM scroll position directly (bypassing signal)\n   */\n  getDomScrollTop(): number {\n    return this._viewport().nativeElement.scrollTop;\n  }\n\n  /**\n   * Get the current DOM viewport height directly (bypassing signal)\n   */\n  getDomViewportHeight(): number {\n    return this._viewport().nativeElement.clientHeight;\n  }\n\n  /**\n   * Check if viewport is currently scrolled to the bottom (using DOM values)\n   */\n  isAtBottom(): boolean {\n    const el = this._viewport().nativeElement;\n    return el.scrollHeight - el.offsetHeight - el.scrollTop < 1;\n  }\n\n  /**\n   * Imperatively update the spacer height on the DOM.\n   * This bypasses the async signal → computed → template binding cycle,\n   * ensuring the browser has the correct scrollHeight before scrolling.\n   */\n  updateSpacerHeight(height: number): void {\n    this._sizer().nativeElement.style.height = `${height}px`;\n  }\n\n  /**\n   * Set the scroll position directly\n   */\n  setScrollTop(scrollTop: number): void {\n    this._viewport().nativeElement.scrollTop = scrollTop;\n  }\n\n  /**\n   * Check if a smooth scroll animation is in progress\n   */\n  isScrollActive(): boolean {\n    return this._smoothScrollInProgress;\n  }\n\n  /**\n   * Measure the viewport height\n   */\n  private _measureViewportHeight(): void {\n    const height = this._viewport().nativeElement.clientHeight;\n    this._viewportHeight.set(height);\n  }\n\n  /**\n   * Set up ResizeObserver to monitor viewport size changes\n   */\n  private _setupViewportResizeObserver(): void {\n    this._viewportResizeObserver = new ResizeObserver((entries) => {\n      for (const entry of entries) {\n        const height = entry.contentRect.height;\n        if (height !== this._viewportHeight()) {\n          this._ngZone.run(() => {\n            this._viewportHeight.set(height);\n          });\n        }\n      }\n    });\n\n    this._viewportResizeObserver.observe(this._viewport().nativeElement);\n\n    this._destroyRef.onDestroy(() => {\n      this._viewportResizeObserver?.disconnect();\n    });\n  }\n}\n","<div #viewport class=\"nx-virtual-viewport__viewport\">\n  <div #sizer class=\"nx-virtual-viewport__sizer\" [style.height.px]=\"totalHeight()\"></div>\n  <div class=\"nx-virtual-viewport__content\">\n    <ng-content></ng-content>\n  </div>\n</div>\n","import { NgModule } from '@angular/core';\n\nimport { NxVirtualFor, NxVirtualGroupOutlet } from './virtual-for';\nimport { NxVirtualViewportComponent } from './virtual-scroll-viewport';\n\n@NgModule({\n  imports: [NxVirtualViewportComponent, NxVirtualFor, NxVirtualGroupOutlet],\n  exports: [NxVirtualViewportComponent, NxVirtualFor, NxVirtualGroupOutlet],\n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