{"version":3,"file":"ng-primitives-dialog.mjs","sources":["../../../../packages/ng-primitives/dialog/src/config/dialog-config.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog-ref.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog-state.ts","../../../../packages/ng-primitives/dialog/src/dialog-description/dialog-description-state.ts","../../../../packages/ng-primitives/dialog/src/dialog-description/dialog-description.ts","../../../../packages/ng-primitives/dialog/src/dialog-overlay/dialog-overlay-state.ts","../../../../packages/ng-primitives/dialog/src/dialog-overlay/dialog-overlay.ts","../../../../packages/ng-primitives/dialog/src/dialog-title/dialog-title-state.ts","../../../../packages/ng-primitives/dialog/src/dialog-title/dialog-title.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog.service.ts","../../../../packages/ng-primitives/dialog/src/dialog-trigger/dialog-trigger-state.ts","../../../../packages/ng-primitives/dialog/src/dialog-trigger/dialog-trigger.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog.ts","../../../../packages/ng-primitives/dialog/src/dialog-panel/dialog-panel-state.ts","../../../../packages/ng-primitives/dialog/src/ng-primitives-dialog.ts"],"sourcesContent":["import { InjectionToken, Injector, Provider, ViewContainerRef, inject } from '@angular/core';\nimport { NgpDismissGuard, ScrollStrategy } from 'ng-primitives/portal';\n\n/** Valid ARIA roles for a dialog. */\nexport type NgpDialogRole = 'dialog' | 'alertdialog';\n\n/**\n * How long a dialog opened by `ngpDialogTrigger` stays open.\n * - `application`: until it is closed or (by default) the route changes, even if its trigger is\n *   removed.\n * - `trigger`: also closes when its trigger is removed. A trigger inside a menu or popover\n *   defers to that overlay's trigger, so the dialog outlives the menu closing.\n */\nexport type NgpDialogLifetime = 'application' | 'trigger';\n\nexport interface NgpDialogConfig<T = any> {\n  /** The view container to attach the dialog to. */\n  viewContainerRef?: ViewContainerRef;\n\n  /** The injector to use for the dialog. Defaults to the view container's injector.*/\n  injector?: Injector;\n\n  /**\n   * The element the dialog is opened from, used to resolve the parent overlay and restore\n   * focus. Defaults to whatever holds focus when `open()` is called.\n   */\n  triggerElement?: HTMLElement;\n\n  /** ID for the dialog. If omitted, a unique one will be generated. */\n  id?: string;\n\n  /** The role of the dialog. */\n  role?: NgpDialogRole;\n\n  /**\n   * Whether the dialog is modal, read when it opens. A modal dialog hides the page from screen\n   * readers, applies the `scrollStrategy` (which blocks the page scroll by default) and traps\n   * focus. A non-modal one leaves the page usable, and\n   * applies `closeOnEscape` only to an Escape pressed inside it.\n   */\n  modal?: boolean;\n\n  /**\n   * The container element or selector the dialog should be rendered into.\n   * @default 'body'\n   */\n  container?: HTMLElement | string | null;\n\n  /**\n   * Whether the dialog should close when the user navigates. This includes both browser history\n   * navigation (back/forward) and programmatic route changes (e.g. router.navigate()).\n   */\n  closeOnNavigation?: boolean;\n\n  /** Whether the dialog should close when the user presses the escape key, or a guard function. */\n  closeOnEscape?: NgpDismissGuard<KeyboardEvent>;\n\n  /**\n   * Whether the dialog should close when clicking outside (on the overlay), or a guard function.\n   */\n  closeOnOutsideClick?: NgpDismissGuard<Element>;\n\n  /**\n   * Whether the dialog should close when the user clicks the overlay.\n   * @deprecated Use `closeOnOutsideClick` instead.\n   */\n  closeOnClick?: boolean;\n\n  /**\n   * How long a dialog opened by `ngpDialogTrigger` stays open. Has no effect on\n   * `NgpDialogManager.open()`.\n   * @default 'application'\n   */\n  lifetime?: NgpDialogLifetime;\n\n  /** Scroll strategy to be used for the dialog. */\n  scrollStrategy?: ScrollStrategy;\n\n  data?: T;\n}\n\nexport const defaultDialogConfig: NgpDialogConfig = {\n  role: 'dialog',\n  modal: true,\n  container: 'body',\n  closeOnNavigation: true,\n  closeOnEscape: true,\n  closeOnClick: true,\n  lifetime: 'application',\n};\n\nexport const NgpDialogConfigToken = new InjectionToken<NgpDialogConfig>('NgpDialogConfigToken');\n\n/**\n * Provide the default Dialog configuration\n * @param config The Dialog configuration\n * @returns The provider\n */\nexport function provideDialogConfig(config: Partial<NgpDialogConfig>): Provider[] {\n  return [\n    {\n      provide: NgpDialogConfigToken,\n      useValue: { ...defaultDialogConfig, ...config },\n    },\n  ];\n}\n\n/**\n * Inject the Dialog configuration\n * @returns The global Dialog configuration\n */\nexport function injectDialogConfig(): NgpDialogConfig {\n  return inject(NgpDialogConfigToken, { optional: true }) ?? defaultDialogConfig;\n}\n","import { FocusOrigin } from '@angular/cdk/a11y';\nimport { inject, InjectOptions, Injector } from '@angular/core';\nimport { NgpExitAnimationManager } from 'ng-primitives/internal';\nimport { NgpDismissGuard, NgpOverlayRef, NgpPortalDetachOptions } from 'ng-primitives/portal';\nimport { defer, EMPTY, fromEvent, Observable, Subject } from 'rxjs';\nimport { filter, map, takeUntil } from 'rxjs/operators';\nimport { NgpDialogConfig } from '../config/dialog-config';\n\n/** Minimal portal interface needed by the dialog ref. */\nexport interface NgpDialogPortalRef {\n  getElements(): HTMLElement[];\n  detach(options?: NgpPortalDetachOptions): Promise<void>;\n}\n\n/**\n * Reference to a dialog opened via the Dialog service.\n */\nexport class NgpDialogRef<T = unknown, R = unknown> implements NgpOverlayRef {\n  /** Whether the user is allowed to close the dialog. */\n  disableClose: boolean | undefined;\n\n  /** Whether the escape key is allowed to close the dialog, or a guard function. */\n  closeOnEscape: NgpDismissGuard<KeyboardEvent> | undefined;\n\n  /** Whether clicking outside (on the overlay) is allowed to close the dialog, or a guard function. */\n  closeOnOutsideClick: NgpDismissGuard<Element> | undefined;\n\n  /** Emits when the dialog has been closed. */\n  readonly closed = new Subject<{ focusOrigin?: FocusOrigin; result?: R }>();\n\n  /** @internal */\n  readonly afterClosed$ = new Subject<{ focusOrigin?: FocusOrigin; result?: R }>();\n\n  /**\n   * Observable that emits the dialog result after exit animations have completed.\n   */\n  readonly afterClosed: Observable<R | undefined> = this.afterClosed$.pipe(\n    map(event => event.result),\n  );\n\n  /** Data passed from the dialog opener. */\n  readonly data: T;\n\n  /** Unique ID for the dialog. */\n  readonly id: string;\n\n  /** @internal Store the injector */\n  injector: Injector | undefined;\n\n  /** Whether the dialog is closing. */\n  private closing = false;\n\n  /** @internal Portal reference for element access and detach. */\n  portal: NgpDialogPortalRef | null = null;\n\n  /** Emits on keyboard events within the dialog. */\n  readonly keydownEvents: Observable<KeyboardEvent>;\n\n  /**\n   * Emits pointer events (click, auxclick, contextmenu) that happen outside of the dialog.\n   * Fed by the NgpOverlayRegistry with CDK-compatible stacking awareness.\n   * @internal\n   */\n  readonly outsidePointerEvents$ = new Subject<MouseEvent>();\n\n  /** Emits on pointer events that happen outside of the dialog. */\n  readonly outsidePointerEvents: Observable<MouseEvent> = this.outsidePointerEvents$.asObservable();\n\n  constructor(\n    readonly config: NgpDialogConfig<T>,\n    private readonly document: Document,\n  ) {\n    this.data = config.data as T;\n    this.id = config.id!; // By the time the dialog is created we are guaranteed to have an ID.\n    this.closeOnEscape = config.closeOnEscape ?? true;\n    this.closeOnOutsideClick = config.closeOnOutsideClick;\n\n    // Use defer() so the observable is created on subscribe — by then the portal will be set.\n    this.keydownEvents = defer(() => {\n      const elements = this.getElements();\n      if (!elements.length) return EMPTY;\n      return fromEvent<KeyboardEvent>(this.document, 'keydown').pipe(\n        filter(event => elements.some(el => el.contains(event.target as Node))),\n        takeUntil(this.closed),\n      );\n    });\n  }\n\n  /**\n   * Updates the position of the dialog. No-op since dialogs are CSS-centered.\n   */\n  updatePosition(): this {\n    return this;\n  }\n\n  /**\n   * NgpOverlayRef implementation — called by the registry for escape-key dismiss.\n   */\n  hide(options?: { immediate?: boolean; origin?: FocusOrigin }): void {\n    if (this.disableClose) {\n      return;\n    }\n    this.close(undefined, options?.origin);\n  }\n\n  /**\n   * NgpOverlayRef implementation — called by the registry for descendant cascade.\n   * Skips exit animations and tears down immediately.\n   */\n  async hideImmediate(): Promise<void> {\n    if (this.closing) {\n      return;\n    }\n\n    this.closing = true;\n\n    this.closed.next({});\n    this.closed.complete();\n\n    // Detach the portal immediately — no exit animation\n    if (this.portal) {\n      await this.portal.detach({ immediate: true });\n      this.portal = null;\n    }\n\n    this.afterClosed$.next({});\n    this.afterClosed$.complete();\n  }\n\n  /**\n   * Close the dialog.\n   * @param result Optional result to return to the dialog opener.\n   * @param focusOrigin The origin of the focus event that triggered the close.\n   */\n  async close(result?: R, focusOrigin?: FocusOrigin): Promise<void> {\n    // If the dialog is already closed, do nothing.\n    if (this.closing) {\n      return;\n    }\n\n    this.closing = true;\n\n    // Emit immediately so consumers can react before exit animations run.\n    this.closed.next({ focusOrigin, result });\n    this.closed.complete();\n\n    const exitAnimationManager = this.injector?.get(NgpExitAnimationManager, undefined, {\n      optional: true,\n    });\n    if (exitAnimationManager) {\n      await exitAnimationManager.exit();\n    }\n\n    // Detach the portal (immediate since exit animation already ran)\n    if (this.portal) {\n      await this.portal.detach({ immediate: true });\n      this.portal = null;\n    }\n\n    this.afterClosed$.next({ focusOrigin, result });\n    this.afterClosed$.complete();\n  }\n\n  /**\n   * @deprecated Access dialog methods directly instead (keydownEvents, outsidePointerEvents,\n   * updatePosition, close). This shim will be removed in the next major version.\n   */\n  get overlayRef(): {\n    keydownEvents: () => Observable<KeyboardEvent>;\n    outsidePointerEvents: () => Observable<MouseEvent>;\n    updatePosition: () => NgpDialogRef<T, R>;\n    dispose: () => Promise<void>;\n    detachments: () => Observable<{ focusOrigin?: FocusOrigin; result?: R }>;\n    overlayElement: HTMLElement | undefined;\n  } {\n    return {\n      keydownEvents: () => this.keydownEvents,\n      outsidePointerEvents: () => this.outsidePointerEvents,\n      updatePosition: () => this.updatePosition(),\n      dispose: () => this.close(),\n      detachments: () => this.closed.asObservable(),\n      overlayElement: this.getElements()[0] as HTMLElement | undefined,\n    };\n  }\n\n  /**\n   * Get the portal elements.\n   * @internal\n   */\n  getElements(): HTMLElement[] {\n    return this.portal?.getElements() ?? [];\n  }\n}\n\nexport function injectDialogRef<T = unknown, R = unknown>(\n  options?: InjectOptions & { optional?: false },\n): NgpDialogRef<T, R>;\nexport function injectDialogRef<T = unknown, R = unknown>(\n  options: InjectOptions & { optional: true },\n): NgpDialogRef<T, R> | null;\nexport function injectDialogRef<T = unknown, R = unknown>(\n  options?: InjectOptions,\n): NgpDialogRef<T, R> | null {\n  return inject<NgpDialogRef<T, R>>(NgpDialogRef, options ?? {});\n}\n","import { DOCUMENT } from '@angular/common';\nimport { afterNextRender, Injector, inject, signal, Signal } from '@angular/core';\nimport { ngpFocusTrap } from 'ng-primitives/focus-trap';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n  attrBinding,\n  createPrimitive,\n  onDestroy,\n  StateInjectionOptions,\n} from 'ng-primitives/state';\nimport { NgpDialogRole } from '../config/dialog-config';\nimport { injectDialogRef } from './dialog-ref';\n\nexport interface NgpDialogState<R> {\n  /** The id of the dialog */\n  readonly id?: Signal<string>;\n  /** The dialog role. */\n  readonly role?: Signal<NgpDialogRole | undefined>;\n  /** Whether the dialog is a modal. */\n  readonly modal?: Signal<boolean>;\n  /** Close the dialog. */\n  close: (result?: R) => void;\n  /** @internal register a labelledby id */\n  setLabelledBy: (id: string) => void;\n  /** @internal register a describedby id */\n  setDescribedBy: (id: string) => void;\n  /** @internal remove a labelledby id */\n  removeLabelledBy: (id: string) => void;\n  /** @internal remove a describedby id */\n  removeDescribedBy: (id: string) => void;\n}\n\nexport interface NgpDialogProps {\n  /** The id of the dialog */\n  readonly id?: Signal<string>;\n  /** The dialog role. */\n  readonly role?: Signal<NgpDialogRole | undefined>;\n  /** Whether the dialog is a modal. */\n  readonly modal?: Signal<boolean>;\n}\n\nexport const [NgpDialogStateToken, ngpDialog, _injectDialogState, provideDialogState] =\n  createPrimitive(\n    'NgpDialog',\n    <T, R>({\n      id = signal<string>(''),\n      role = signal<NgpDialogRole | undefined>(undefined),\n      modal = signal<boolean>(true),\n    }: NgpDialogProps) => {\n      const elementRef = injectElementRef();\n      const dialogRef = injectDialogRef<T, R>();\n      const injector = inject(Injector);\n      const document = inject(DOCUMENT);\n\n      // A non-modal dialog leaves the page usable, so focus can leave it. It joins no trap, which\n      // would otherwise deactivate the trap of a modal dialog below it.\n      if (dialogRef.config.modal !== false) {\n        ngpFocusTrap({});\n      } else {\n        const focusOnRender = afterNextRender({ write: focusOnOpen }, { injector });\n        // A dialog closed before it rendered must not take focus during its exit animation.\n        dialogRef.closed.subscribe(() => focusOnRender.destroy());\n      }\n\n      const labelledBy = signal<string[]>([]);\n      const describedBy = signal<string[]>([]);\n\n      // Host binding\n      attrBinding(elementRef, 'tabindex', '-1');\n      attrBinding(elementRef, 'id', id);\n      attrBinding(elementRef, 'role', role);\n      attrBinding(elementRef, 'aria-modal', modal);\n      attrBinding(elementRef, 'aria-labelledby', () => labelledBy().join(' ') || null);\n      attrBinding(elementRef, 'aria-describedby', () => describedBy().join(' ') || null);\n\n      // Close the dialog when the directive is destroyed.\n      onDestroy(() => close());\n\n      function focusOnOpen(): void {\n        if (!elementRef.nativeElement.contains(document.activeElement)) {\n          elementRef.nativeElement.focus({ preventScroll: true });\n        }\n      }\n\n      function close(result?: R): void {\n        dialogRef.close(result);\n      }\n\n      function setLabelledBy(id: string): void {\n        labelledBy.update(ids => [...ids, id]);\n      }\n\n      function setDescribedBy(id: string): void {\n        describedBy.update(ids => [...ids, id]);\n      }\n\n      function removeLabelledBy(id: string): void {\n        labelledBy.update(ids => ids.filter(i => i !== id));\n      }\n\n      function removeDescribedBy(id: string): void {\n        describedBy.update(ids => ids.filter(i => i !== id));\n      }\n\n      return {\n        id,\n        role,\n        modal,\n        close,\n        setLabelledBy,\n        setDescribedBy,\n        removeLabelledBy,\n        removeDescribedBy,\n      } satisfies NgpDialogState<R>;\n    },\n  );\n\nexport function injectDialogState<R>(options?: StateInjectionOptions): Signal<NgpDialogState<R>> {\n  return _injectDialogState(options) as Signal<NgpDialogState<R>>;\n}\n","import { signal, Signal } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, onDestroy } from 'ng-primitives/state';\nimport { onChange } from 'ng-primitives/utils';\nimport { injectDialogState } from '../dialog/dialog-state';\n\nexport interface NgpDialogDescriptionState {\n  /** The id of the descriptions. */\n  readonly id: Signal<string>;\n}\n\nexport interface NgpDialogDescriptionProps {\n  /** The id of the descriptions. */\n  readonly id?: Signal<string>;\n}\n\nexport const [\n  NgpDialogDescriptionStateToken,\n  ngpDialogDescription,\n  injectDialogDescriptionState,\n  provideDialogDescriptionState,\n] = createPrimitive(\n  'NgpDialogDescription',\n  ({ id = signal<string>('') }: NgpDialogDescriptionProps) => {\n    const elementRef = injectElementRef();\n    const dialogState = injectDialogState();\n\n    // Host binding\n    attrBinding(elementRef, 'id', id);\n\n    // Effects\n    onChange(id, (id, prevId) => {\n      if (prevId) {\n        dialogState().removeDescribedBy(prevId);\n      }\n\n      if (id) {\n        dialogState().setDescribedBy(id);\n      }\n    });\n\n    onDestroy(() => dialogState().removeDescribedBy(id()));\n\n    return { id } satisfies NgpDialogDescriptionState;\n  },\n);\n","import { Directive, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpDialogDescription } from './dialog-description-state';\n\n@Directive({\n  selector: '[ngpDialogDescription]',\n  exportAs: 'ngpDialogDescription',\n})\nexport class NgpDialogDescription {\n  /** The id of the descriptions. */\n  readonly id = input<string>(uniqueId('ngp-dialog-description'));\n\n  protected readonly state = ngpDialogDescription({\n    id: this.id,\n  });\n}\n","import { inject, signal, Signal } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport {\n  NgpDismissGuard,\n  NgpOverlay,\n  NgpOverlayEntry,\n  NgpOverlayRegistry,\n} from 'ng-primitives/portal';\nimport { createPrimitive, listener, onDestroy } from 'ng-primitives/state';\nimport { Subscription } from 'rxjs';\nimport { injectDialogRef } from '../dialog/dialog-ref';\n\nexport interface NgpDialogOverlayState {\n  /**\n   * Whether the dialog should close on backdrop click. A backdrop click that closes a popover,\n   * menu, select or other overlay opened from the dialog leaves the dialog open; tooltips and\n   * preview cards don't count.\n   * @default `true`\n   */\n  readonly closeOnClick: Signal<NgpDismissGuard<Element> | undefined>;\n}\n\nexport interface NgpDialogOverlayProps {\n  /**\n   * Whether the dialog should close on backdrop click. A backdrop click that closes a popover,\n   * menu, select or other overlay opened from the dialog leaves the dialog open; tooltips and\n   * preview cards don't count.\n   * @default `true`\n   */\n  readonly closeOnClick?: Signal<NgpDismissGuard<Element> | undefined>;\n}\n\nexport const [\n  NgpDialogOverlayStateToken,\n  ngpDialogOverlay,\n  injectDialogOverlayState,\n  provideDialogOverlayState,\n] = createPrimitive(\n  'NgpDialogOverlay',\n  ({\n    closeOnClick = signal<NgpDismissGuard<Element> | undefined>(true),\n  }: NgpDialogOverlayProps) => {\n    const elementRef = injectElementRef();\n    const dialogRef = injectDialogRef();\n    const registry = inject(NgpOverlayRegistry);\n\n    const startedPointerDownOnOverlay = signal(false);\n    // Snapshot at press time: by the click, the registry has already started closing the child\n    const pressClosesChildOverlay = signal(false);\n    // The backdrop is not focusable, so a press on it blurs the focused control to the body. The\n    // blur is let through so values that commit on blur are up to date when a dismiss guard runs,\n    // and focus is returned only once the press is known not to close the dialog.\n    let focusedBeforePress: HTMLElement | null = null;\n    // The child overlays the press may close, and those whose close has started since: a dismiss\n    // guard can keep a child open, and focus inside it then stays where it is.\n    let pressedOverlays: NgpOverlayEntry[] = [];\n    const startedClosing = new Set<string>();\n    // Set while a child the press may close is still deciding on its guard: its close returns\n    // focus to `target`, which the press saved before it went to the body.\n    let pendingFocus: { target: HTMLElement | null } | null = null;\n    let closingSubscription = new Subscription();\n    onDestroy(() => closingSubscription.unsubscribe());\n\n    // Listener\n    listener(elementRef, 'pointerdown', handleOnPointerDown);\n    listener(elementRef, 'pointercancel', handleOnPointerCancel);\n    listener(elementRef, 'click', handleOnClick);\n\n    function handleOnPointerDown(event: Event): void {\n      const isOnOverlay = event.target === event.currentTarget;\n      const overlaysPressMayClose = isOnOverlay ? childOverlaysPressMayClose() : [];\n      startedPointerDownOnOverlay.set(isOnOverlay);\n      pressClosesChildOverlay.set(overlaysPressMayClose.length > 0);\n      watchClosing(overlaysPressMayClose);\n      // A press while an async guard is pending keeps the target saved by the first press, since\n      // focus is already on the body by then.\n      focusedBeforePress = isOnOverlay ? (focusedBeforePress ?? getActiveElement()) : null;\n    }\n\n    function watchClosing(overlays: NgpOverlayEntry[]): void {\n      closingSubscription.unsubscribe();\n      closingSubscription = new Subscription();\n      startedClosing.clear();\n      pendingFocus = null;\n      pressedOverlays = overlays;\n\n      for (const entry of overlays) {\n        // Another kind of overlay, such as a nested dialog, is taken to close as the press asks.\n        if (!(entry.overlay instanceof NgpOverlay)) {\n          startedClosing.add(entry.id);\n          continue;\n        }\n        closingSubscription.add(entry.overlay.closing.subscribe(() => onOverlayClosing(entry)));\n      }\n    }\n\n    function onOverlayClosing(entry: NgpOverlayEntry): void {\n      startedClosing.add(entry.id);\n      if (!pendingFocus) {\n        return;\n      }\n      const { target } = pendingFocus;\n      pendingFocus = null;\n      // Focus still inside the child is about to go with it, so it counts as lost too.\n      const active = getActiveElement();\n      const focusLost =\n        !active ||\n        active === active.ownerDocument.body ||\n        entry.getElements().some(overlayElement => containsComposed(overlayElement, active));\n      const element = outsideOf([entry], target);\n      if (focusLost && element?.isConnected) {\n        element.focus();\n      }\n    }\n\n    /**\n     * The overlays opened from the dialog that a backdrop press may close: those that close on an\n     * outside press, and those that close along with such a parent.\n     */\n    function childOverlaysPressMayClose(): NgpOverlayEntry[] {\n      // Listed parent before child, so a parent is decided before its children.\n      const descendants = registry.getDescendants(dialogRef.id);\n      const closing = new Set<string>();\n\n      for (const entry of descendants) {\n        const closesOnPress = entry.dismissPolicy.outsidePress !== false && !entry.passive;\n        const closesWithParent =\n          entry.parentId !== null && closing.has(entry.parentId) && entry.cascadeClose !== false;\n\n        if (closesOnPress || closesWithParent) {\n          closing.add(entry.id);\n        }\n      }\n\n      return descendants.filter(entry => closing.has(entry.id));\n    }\n\n    /**\n     * Focus inside an overlay the press closes would go with it, so it is returned to the trigger\n     * of that overlay instead, walking out through nested ones such as a submenu.\n     */\n    function outsideOf(\n      overlays: NgpOverlayEntry[],\n      element: HTMLElement | null,\n    ): HTMLElement | null {\n      const ownerOf = (node: HTMLElement) =>\n        overlays.find(entry =>\n          entry.getElements().some(overlayElement => containsComposed(overlayElement, node)),\n        );\n\n      let target = element;\n      let owner = target ? ownerOf(target) : undefined;\n      // Bounded by the number of overlays, in case a trigger sits inside its own overlay.\n      for (let depth = 0; owner && depth < overlays.length; depth++) {\n        target = owner.triggerElement;\n        owner = ownerOf(target);\n      }\n      return target;\n    }\n\n    function handleOnPointerCancel(): void {\n      startedPointerDownOnOverlay.set(false);\n      pressClosesChildOverlay.set(false);\n      restoreFocus();\n    }\n\n    function handleOnClick(event: Event): void {\n      const isOverlayClick = startedPointerDownOnOverlay() && event.target === event.currentTarget;\n      const closesChildOverlay = pressClosesChildOverlay();\n      startedPointerDownOnOverlay.set(false);\n      pressClosesChildOverlay.set(false);\n\n      if (!isOverlayClick || closesChildOverlay || dialogRef.disableClose) {\n        restoreFocus(closesChildOverlay);\n        return;\n      }\n\n      const guard: NgpDismissGuard<Element> =\n        dialogRef.closeOnOutsideClick ?? closeOnClick() ?? true;\n      evaluateGuard(guard, event.target as Element);\n    }\n\n    function evaluateGuard(guard: NgpDismissGuard<Element>, target: Element): void {\n      if (guard === true) {\n        close();\n        return;\n      }\n\n      if (guard === false) {\n        restoreFocus();\n        return;\n      }\n\n      // Function guard — evaluate sync or async\n      let result: boolean | Promise<boolean>;\n      try {\n        result = guard(target);\n      } catch (error) {\n        console.error('NgpDialogOverlay: dismiss guard threw', error);\n        restoreFocus();\n        return;\n      }\n\n      if (typeof result === 'boolean') {\n        closeOrRestoreFocus(result);\n      } else {\n        result.then(closeOrRestoreFocus).catch(error => {\n          console.error('NgpDialogOverlay: dismiss guard rejected', error);\n          restoreFocus();\n        });\n      }\n    }\n\n    function closeOrRestoreFocus(shouldClose: boolean): void {\n      if (shouldClose) {\n        close();\n      } else {\n        restoreFocus();\n      }\n    }\n\n    function close(): void {\n      focusedBeforePress = null;\n      watchClosing([]);\n      dialogRef.close(undefined, 'mouse');\n    }\n\n    /**\n     * `awaitingClose` is set on a click that may still close a child whose guard has not decided:\n     * the child's close then returns focus, so the watch is kept until it starts.\n     */\n    function restoreFocus(awaitingClose = false): void {\n      const closing = pressedOverlays.filter(entry => startedClosing.has(entry.id));\n      const element = outsideOf(closing, focusedBeforePress);\n      const awaiting = awaitingClose && closing.length < pressedOverlays.length;\n\n      if (awaiting) {\n        pendingFocus = { target: focusedBeforePress };\n      } else {\n        watchClosing([]);\n      }\n      focusedBeforePress = null;\n      returnFocus(element);\n    }\n\n    // Leave focus alone if something else (e.g. the guard) has moved it since the press.\n    function returnFocus(element: HTMLElement | null): void {\n      if (element?.isConnected && getActiveElement() === element.ownerDocument.body) {\n        element.focus();\n      }\n    }\n\n    // `document.activeElement` stops at a shadow host, which `focus()` can't send focus back into.\n    function getActiveElement(): HTMLElement | null {\n      let element = elementRef.nativeElement.ownerDocument.activeElement as HTMLElement | null;\n      while (element?.shadowRoot?.activeElement) {\n        element = element.shadowRoot.activeElement as HTMLElement;\n      }\n      return element;\n    }\n\n    return {\n      closeOnClick,\n    } satisfies NgpDialogOverlayState;\n  },\n);\n\n/** Whether `node` is `ancestor` or inside it, crossing shadow root boundaries. */\nfunction containsComposed(ancestor: Node, node: Node): boolean {\n  for (let current: Node | null = node; current; ) {\n    if (current === ancestor) {\n      return true;\n    }\n    current = current instanceof ShadowRoot ? current.host : current.parentNode;\n  }\n  return false;\n}\n","import { booleanAttribute, Directive, input } from '@angular/core';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { injectDialogRef } from '../dialog/dialog-ref';\nimport { ngpDialogOverlay } from './dialog-overlay-state';\n\n@Directive({\n  selector: '[ngpDialogOverlay]',\n  exportAs: 'ngpDialogOverlay',\n  hostDirectives: [NgpExitAnimation],\n})\nexport class NgpDialogOverlay {\n  protected readonly dialogRef = injectDialogRef();\n\n  /**\n   * Whether the dialog should close on backdrop click. A backdrop click that closes a popover,\n   * menu, select or other overlay opened from the dialog leaves the dialog open; tooltips and\n   * preview cards don't count.\n   * @default `true`\n   */\n  readonly closeOnClick = input(this.dialogRef.config.closeOnClick, {\n    alias: 'ngpDialogOverlayCloseOnClick',\n    transform: booleanAttribute,\n  });\n\n  protected readonly state = ngpDialogOverlay({\n    closeOnClick: this.closeOnClick,\n  });\n}\n","import { Signal, signal } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { attrBinding, createPrimitive, onDestroy } from 'ng-primitives/state';\nimport { onChange } from 'ng-primitives/utils';\nimport { injectDialogState } from '../dialog/dialog-state';\n\nexport interface NgpDialogTitleState {\n  /** The id of the title. */\n  readonly id: Signal<string>;\n}\n\nexport interface NgpDialogTitleProps {\n  /** The id of the title. */\n  readonly id?: Signal<string>;\n}\n\nexport const [\n  NgpDialogTitleStateToken,\n  ngpDialogTitle,\n  injectDialogTitleState,\n  provideDialogTitleState,\n] = createPrimitive('NgpDialogTitle', ({ id = signal<string>('') }: NgpDialogTitleProps) => {\n  const elementRef = injectElementRef();\n  const dialogState = injectDialogState();\n\n  // Host binding\n  attrBinding(elementRef, 'id', id);\n\n  // Effects\n  onChange(id, (id, prevId) => {\n    if (prevId) {\n      dialogState().removeLabelledBy(prevId);\n    }\n\n    if (id) {\n      dialogState().setLabelledBy(id);\n    }\n  });\n\n  onDestroy(() => dialogState().removeLabelledBy(id()));\n\n  return { id } satisfies NgpDialogTitleState;\n});\n","import { Directive, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpDialogTitle } from './dialog-title-state';\n\n@Directive({\n  selector: '[ngpDialogTitle]',\n  exportAs: 'ngpDialogTitle',\n})\nexport class NgpDialogTitle {\n  /** The id of the title. */\n  readonly id = input<string>(uniqueId('ngp-dialog-title'));\n\n  protected readonly state = ngpDialogTitle({\n    id: this.id,\n  });\n}\n","import { FocusMonitor } from '@angular/cdk/a11y';\nimport { ViewportRuler } from '@angular/cdk/scrolling';\nimport { DOCUMENT } from '@angular/common';\nimport {\n  ApplicationRef,\n  Injectable,\n  Injector,\n  OnDestroy,\n  StaticProvider,\n  TemplateRef,\n  Type,\n  ViewContainerRef,\n  inject,\n  isDevMode,\n} from '@angular/core';\nimport { NavigationStart, Router } from '@angular/router';\nimport { NgpExitAnimationManager, NgpFocusRestoration } from 'ng-primitives/internal';\nimport {\n  BlockScrollStrategy,\n  NgpHidingLayer,\n  NgpOutsideHiding,\n  NgpOverlay,\n  NgpOverlayRegistry,\n  ScrollStrategy,\n  createPortal,\n} from 'ng-primitives/portal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { Observable, Subject, Subscription, defer } from 'rxjs';\nimport { startWith } from 'rxjs/operators';\nimport { NgpDialogConfig, NgpDialogConfigToken, injectDialogConfig } from '../config/dialog-config';\nimport { NgpDialogRef } from './dialog-ref';\n\n/**\n * Originally based on Angular CDK Dialog service.\n * Re-implemented to use ng-primitives/portal instead of @angular/cdk/overlay.\n */\n\n@Injectable({\n  providedIn: 'root',\n})\nexport class NgpDialogManager implements OnDestroy {\n  private readonly applicationRef = inject(ApplicationRef);\n  private readonly injector = inject(Injector);\n  private readonly document = inject<Document>(DOCUMENT);\n  private readonly focusMonitor = inject(FocusMonitor);\n  private readonly focusRestoration = inject(NgpFocusRestoration);\n  private readonly viewportRuler = inject(ViewportRuler);\n  private readonly registry = inject(NgpOverlayRegistry);\n  private readonly outsideHiding = inject(NgpOutsideHiding);\n  private readonly defaultOptions = injectDialogConfig();\n  private readonly parentDialogManager = inject(NgpDialogManager, {\n    optional: true,\n    skipSelf: true,\n  });\n  private readonly router = inject(Router, { optional: true });\n\n  private openDialogsAtThisLevel: NgpDialogRef[] = [];\n  private readonly afterAllClosedAtThisLevel = new Subject<void>();\n  private readonly afterOpenedAtThisLevel = new Subject<NgpDialogRef>();\n  private readonly hidingLayerAtThisLevel: NgpHidingLayer = {\n    attribute: 'aria-hidden',\n    // A closing dialog keeps focus until it detaches, so it stays exposed alongside the open ones.\n    getElements: () =>\n      [...this.exposedOpenDialogs(), ...this.closingDialogs].flatMap(dialog =>\n        dialog.getElements(),\n      ),\n  };\n  private readonly closingDialogsAtThisLevel = new Set<NgpDialogRef>();\n  private routerSubscription: Subscription | undefined;\n\n  /** Scroll blocking strategy — shared across all dialogs. */\n  private scrollStrategy: ScrollStrategy | null = null;\n\n  /** Keeps track of the currently-open dialogs. */\n  get openDialogs(): readonly NgpDialogRef[] {\n    return this.parentDialogManager\n      ? this.parentDialogManager.openDialogs\n      : this.openDialogsAtThisLevel;\n  }\n\n  /**\n   * One hiding layer for all the open dialogs, shared with the parent since nested managers act on\n   * the same list of open dialogs.\n   */\n  private get hidingLayer(): NgpHidingLayer {\n    return this.parentDialogManager\n      ? this.parentDialogManager.hidingLayer\n      : this.hidingLayerAtThisLevel;\n  }\n\n  /**\n   * Dialogs that were exposed when they closed and are still in the DOM, running their exit\n   * animation.\n   */\n  private get closingDialogs(): Set<NgpDialogRef> {\n    return this.parentDialogManager\n      ? this.parentDialogManager.closingDialogs\n      : this.closingDialogsAtThisLevel;\n  }\n\n  /** Stacked modal dialogs all stay exposed, a non-modal one only above the top modal dialog. */\n  private exposedOpenDialogs(): NgpDialogRef[] {\n    let topModalIndex = -1;\n    this.openDialogs.forEach((dialog, index) => {\n      if (isModal(dialog.config)) {\n        topModalIndex = index;\n      }\n    });\n    return this.openDialogs.filter(\n      (dialog, index) => isModal(dialog.config) || index > topModalIndex,\n    );\n  }\n\n  /** Stream that emits when a dialog has been opened. */\n  get afterOpened(): Subject<NgpDialogRef> {\n    return this.parentDialogManager\n      ? this.parentDialogManager.afterOpened\n      : this.afterOpenedAtThisLevel;\n  }\n\n  /**\n   * Stream that emits when all open dialog have finished closing.\n   * Will emit on subscribe if there are no open dialogs to begin with.\n   */\n  readonly afterAllClosed: Observable<void> = defer(() =>\n    this.openDialogs.length\n      ? this.getAfterAllClosed()\n      : this.getAfterAllClosed().pipe(startWith(undefined)),\n  );\n\n  /**\n   * Opens a modal dialog containing the given template or component.\n   */\n  open(\n    templateRefOrComponentType: TemplateRef<NgpDialogContext> | Type<unknown>,\n    config?: NgpDialogConfig,\n  ): NgpDialogRef;\n\n  /**\n   * Opens a modal dialog containing the given template or component with typed data.\n   */\n  open<T, R = unknown>(\n    templateRefOrComponentType: TemplateRef<NgpDialogContext<T, R>> | Type<unknown>,\n    config: NgpDialogConfig<T> & { data: T },\n  ): NgpDialogRef<T, R>;\n\n  /**\n   * Opens a modal dialog with typed result but no data (explicit void for data type).\n   */\n  open<T extends void, R>(\n    templateRefOrComponentType: TemplateRef<NgpDialogContext<T, R>> | Type<unknown>,\n    config?: NgpDialogConfig,\n  ): NgpDialogRef<T, R>;\n\n  open(\n    templateRefOrComponentType: TemplateRef<any> | Type<unknown>,\n    config?: NgpDialogConfig<any>,\n  ): NgpDialogRef<any, any> {\n    // store the current active element so we can focus it after the dialog is closed\n    const activeElement = this.document.activeElement;\n\n    // this is not ideal, but there is a case where a dialog trigger is within an overlay (e.g. menu),\n    // which may be removed before the dialog is closed. This is not desired, so we need to access a view container ref\n    // that is not within the overlay. To solve this we use the view container ref of the root component.\n    // Could this have any unintended side effects? For example, the dialog would not be closed during route changes?\n    const viewContainerRef =\n      this.applicationRef.components[0]?.injector.get(ViewContainerRef) ??\n      config?.viewContainerRef ??\n      config?.injector?.get(ViewContainerRef);\n\n    const defaults = this.defaultOptions;\n    config = { ...defaults, viewContainerRef, ...config };\n    config.id = config.id ?? uniqueId('ngp-dialog');\n\n    // A spread `undefined` would override the global container; `null` still means the body.\n    if (config.container === undefined) {\n      config.container = defaults.container;\n    }\n\n    if (config.modal === undefined) {\n      config.modal = defaults.modal;\n    }\n\n    if (config.id && this.getDialogById(config.id) && isDevMode()) {\n      throw Error(`Dialog with id \"${config.id}\" exists already. The dialog id must be unique.`);\n    }\n\n    const dialogRef = new NgpDialogRef(config, this.document);\n    const injector = this.createInjector(config, dialogRef);\n\n    // store the injector in the dialog ref - this is so we can access the exit animation manager\n    dialogRef.injector = injector;\n\n    const context: NgpDialogContext = {\n      $implicit: dialogRef,\n      close: dialogRef.close.bind(dialogRef),\n    };\n\n    // Create the portal using our portal system\n    const portal = createPortal(\n      templateRefOrComponentType,\n      config.viewContainerRef!,\n      injector,\n      context,\n    );\n\n    portal.attach(this.resolveContainer(config.container));\n\n    // Store the portal reference on the dialog ref for element access and cleanup\n    dialogRef.portal = portal;\n\n    // If this is the first modal dialog that we're opening, enable scroll blocking.\n    if (isModal(config) && !this.hasModalDialog()) {\n      this.enableScrollBlocking(config);\n    }\n\n    // A programmatic open() has no trigger and falls back to whatever held focus.\n    const originElement =\n      config.triggerElement ?? (activeElement instanceof HTMLElement ? activeElement : null);\n\n    // Register under the overlay the dialog was opened from, so clicks inside it don't read\n    // as an outside press on that parent. `cascadeClose: false` below stops the inverse: a\n    // menu that closes on select must not take the dialog with it.\n    const parentId = originElement ? this.registry.findContainingOverlay(originElement) : null;\n\n    // Read now: a menu that closes on select is gone from the registry by the time the dialog\n    // closes, and with it the item that opened the dialog.\n    const focusTargets = [originElement, ...this.getContainingTriggers(parentId)];\n\n    // Register with the overlay registry for centralized escape-key routing.\n    // outsidePress is false because the NgpDialogOverlay directive handles its own backdrop clicks.\n    this.registry.register({\n      id: dialogRef.id,\n      parentId,\n      cascadeClose: false,\n      overlay: dialogRef,\n      getElements: () => dialogRef.getElements(),\n      triggerElement: originElement ?? this.document.body,\n      dismissPolicy: {\n        outsidePress: false,\n        escapeKey: config.closeOnEscape ?? true,\n      },\n      // A non-modal dialog leaves the page usable, so an Escape pressed on the page is not for it.\n      escapeKeyInsideOnly: !isModal(config),\n      outsidePointerEvents$: dialogRef.outsidePointerEvents$,\n    });\n\n    (this.openDialogs as NgpDialogRef[]).push(dialogRef as NgpDialogRef<any, any>);\n    this.refreshAssistiveTechnologyHiding();\n    this.afterOpened.next(dialogRef as NgpDialogRef<any, any>);\n    this.subscribeToRouterEvents();\n\n    // Beside a non-modal dialog the page stays usable: focus the user moved there stays put.\n    let restoreFocus = true;\n\n    dialogRef.closed.subscribe(() => {\n      restoreFocus = isModal(config) || this.isFocusInDialog(dialogRef);\n      // Deregister from the overlay registry immediately so stacking order is updated.\n      this.registry.deregister(dialogRef.id);\n      if (this.exposedOpenDialogs().includes(dialogRef as NgpDialogRef)) {\n        this.closingDialogs.add(dialogRef);\n        // A modal overlay below must not make the dialog `inert` while it still holds focus.\n        this.outsideHiding.keepExposed(dialogRef);\n      }\n      this.removeOpenDialog(dialogRef as NgpDialogRef<any, any>);\n    });\n\n    dialogRef.afterClosed$.subscribe(({ focusOrigin }) => {\n      // Recompute only now: until its exit animation ends the closing dialog is still in the DOM\n      // and holds focus, and hiding it would put focus inside an `aria-hidden` subtree.\n      this.closingDialogs.delete(dialogRef);\n      this.outsideHiding.releaseExposed(dialogRef);\n      this.refreshAssistiveTechnologyHiding();\n\n      // Focus the trigger element after exit animations complete, or, if it is gone, the\n      // trigger of the nearest menu or popover it sat in that is still in the page.\n      const focusTarget = focusTargets.find(element => element?.isConnected);\n\n      if (restoreFocus && focusTarget) {\n        // Its not great that we are relying on an internal API here, but we need to in order to\n        // try and best determine the focus origin when it is programmatically closed by the user.\n        this.focusRestoration.restore(focusTarget, () =>\n          this.focusMonitor.focusVia(\n            focusTarget,\n            focusOrigin ?? (this.focusMonitor as any)._lastFocusOrigin,\n          ),\n        );\n      }\n    });\n\n    return dialogRef;\n  }\n\n  /**\n   * Closes all of the currently-open dialogs.\n   */\n  closeAll(): void {\n    reverseForEach(this.openDialogs, dialog => dialog.close());\n  }\n\n  /**\n   * Finds an open dialog by its id.\n   * @param id ID to use when looking up the dialog.\n   */\n  getDialogById(id: string): NgpDialogRef | undefined {\n    return this.openDialogs.find(dialog => dialog.id === id);\n  }\n\n  /**\n   * Subscribe to router navigation events so that dialogs with `closeOnNavigation`\n   * are closed when the user navigates. This handles both browser popstate events\n   * and programmatic route changes (e.g. router.navigate()).\n   */\n  private subscribeToRouterEvents(): void {\n    if (this.routerSubscription || !this.router) {\n      return;\n    }\n\n    this.routerSubscription = this.router.events.subscribe(event => {\n      if (event instanceof NavigationStart && this.openDialogs.length) {\n        // Close dialogs that have closeOnNavigation enabled (iterate in reverse as closing modifies the array)\n        let i = this.openDialogs.length;\n        while (i--) {\n          const dialog = this.openDialogs[i];\n          if (dialog.config.closeOnNavigation !== false) {\n            dialog.close();\n          }\n        }\n      }\n    });\n  }\n\n  ngOnDestroy(): void {\n    reverseForEach(this.openDialogsAtThisLevel, dialog => dialog.close());\n\n    this.afterAllClosedAtThisLevel.complete();\n    this.afterOpenedAtThisLevel.complete();\n    this.openDialogsAtThisLevel = [];\n    this.routerSubscription?.unsubscribe();\n  }\n\n  /**\n   * Creates a custom injector to be used inside the dialog. This allows a component loaded inside\n   * of a dialog to close itself and, optionally, to return a value.\n   */\n  private createInjector<T, R>(\n    config: NgpDialogConfig<T>,\n    dialogRef: NgpDialogRef<T, R>,\n  ): Injector {\n    const userInjector = config.injector || config.viewContainerRef?.injector;\n    const providers: StaticProvider[] = [\n      { provide: NgpDialogRef, useValue: dialogRef },\n      // expose the merged per-dialog config so NgpDialog honours role/closeOn* passed to open(),\n      // not just the global config. `modal` belongs to this dialog only: a trigger inside it\n      // starts from the configuration where this dialog was opened.\n      {\n        provide: NgpDialogConfigToken,\n        useValue: {\n          ...config,\n          modal: (userInjector?.get(NgpDialogConfigToken, null) ?? this.defaultOptions).modal,\n        },\n      },\n      { provide: NgpExitAnimationManager, useClass: NgpExitAnimationManager },\n      // Keeps a dialog opened from a menu or popover from inheriting that overlay: its focus trap\n      // tears down when that overlay closes.\n      { provide: NgpOverlay, useValue: null },\n    ];\n\n    // Fall back to the service's own injector (root injector) to ensure\n    // ApplicationRef and other platform providers are available.\n    return Injector.create({ parent: userInjector || this.injector, providers });\n  }\n\n  /**\n   * Removes a dialog from the array of open dialogs.\n   */\n  private removeOpenDialog(dialogRef: NgpDialogRef) {\n    const index = this.openDialogs.indexOf(dialogRef);\n\n    if (index > -1) {\n      (this.openDialogs as NgpDialogRef[]).splice(index, 1);\n\n      // If all the modal dialogs were closed, restore the `aria-hidden` of the siblings and\n      // release the scroll block. Otherwise the hidden set is recomputed once the dialog has left\n      // the DOM.\n      if (!this.hasModalDialog()) {\n        this.outsideHiding.remove(this.hidingLayer);\n        this.disableScrollBlocking();\n      }\n\n      if (!this.openDialogs.length) {\n        this.getAfterAllClosed().next();\n      }\n    }\n  }\n\n  /**\n   * Enable scroll blocking when the first dialog opens.\n   */\n  private enableScrollBlocking(config?: NgpDialogConfig): void {\n    // Nested managers share the open dialogs, so the root one owns the scroll block.\n    if (this.parentDialogManager) {\n      this.parentDialogManager.enableScrollBlocking(config);\n      return;\n    }\n\n    if (!this.scrollStrategy) {\n      this.scrollStrategy =\n        config?.scrollStrategy ?? new BlockScrollStrategy(this.viewportRuler, this.document);\n    }\n    this.scrollStrategy.enable();\n  }\n\n  /**\n   * Disable scroll blocking when the last dialog closes.\n   */\n  private disableScrollBlocking(): void {\n    if (this.parentDialogManager) {\n      this.parentDialogManager.disableScrollBlocking();\n      return;\n    }\n\n    this.scrollStrategy?.disable();\n    this.scrollStrategy = null;\n  }\n\n  /**\n   * The triggers of the overlay with the given id and of its ancestors, nearest first, up to the\n   * first dialog: a trigger outside that dialog is behind its focus trap.\n   */\n  private getContainingTriggers(id: string | null): HTMLElement[] {\n    const entries = this.registry.getEntries();\n    const triggers: HTMLElement[] = [];\n    let entry = entries.find(e => e.id === id);\n\n    while (entry && !(entry.overlay instanceof NgpDialogRef)) {\n      triggers.push(entry.triggerElement);\n      const parentId = entry.parentId;\n      entry = entries.find(e => e.id === parentId);\n    }\n\n    return triggers;\n  }\n\n  /**\n   * Resolve the container element the dialog should be rendered into.\n   */\n  private resolveContainer(container: NgpDialogConfig['container']): HTMLElement {\n    if (!container) {\n      return this.document.body;\n    }\n\n    if (typeof container === 'string') {\n      const element = this.document.querySelector<HTMLElement>(container);\n\n      if (!element) {\n        console.warn(\n          `NgPrimitives: Container element with selector \"${container}\" not found. Falling back to document.body.`,\n        );\n        return this.document.body;\n      }\n\n      return element;\n    }\n\n    return container;\n  }\n\n  /**\n   * Recompute what is hidden from assistive technology for the currently open dialogs.\n   */\n  private refreshAssistiveTechnologyHiding(): void {\n    if (this.hasModalDialog()) {\n      this.outsideHiding.update(this.hidingLayer);\n    } else {\n      this.outsideHiding.remove(this.hidingLayer);\n      // A non-modal dialog opened from inside a hiding layer must not stay hidden.\n      this.outsideHiding.refresh();\n    }\n  }\n\n  /** Whether focus is in the dialog, or in an overlay opened from it that closes along with it. */\n  private isFocusInDialog(dialogRef: NgpDialogRef): boolean {\n    const elements = [...dialogRef.getElements()];\n\n    // Entries are in open order, so a submenu's parent is collected before the submenu. A nested\n    // dialog does not close with this one, so focus in it stays where it is.\n    for (const entry of this.registry.getEntries()) {\n      if (\n        entry.cascadeClose !== false &&\n        elements.some(element => element.contains(entry.triggerElement))\n      ) {\n        elements.push(...entry.getElements());\n      }\n    }\n\n    const focused = this.document.activeElement;\n    return elements.some(element => element.contains(focused));\n  }\n\n  private hasModalDialog(): boolean {\n    return this.openDialogs.some(dialog => isModal(dialog.config));\n  }\n\n  private getAfterAllClosed(): Subject<void> {\n    const parent = this.parentDialogManager;\n    return parent ? parent.getAfterAllClosed() : this.afterAllClosedAtThisLevel;\n  }\n}\n\nfunction isModal(config: NgpDialogConfig): boolean {\n  return config.modal !== false;\n}\n\n/**\n * Executes a callback against all elements in an array while iterating in reverse.\n * Useful if the array is being modified as it is being iterated.\n */\nfunction reverseForEach<T>(items: T[] | readonly T[], callback: (current: T) => void) {\n  let i = items.length;\n\n  while (i--) {\n    callback(items[i]);\n  }\n}\n\nexport interface NgpDialogContext<T = unknown, R = unknown> {\n  $implicit: NgpDialogRef<T, R>;\n  close: (result?: R) => void;\n}\n\nexport function injectDialogManager(): NgpDialogManager {\n  return inject(NgpDialogManager);\n}\n","import { DestroyRef, Injector, Signal, TemplateRef, inject, signal } from '@angular/core';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { NgpDismissGuard, NgpOverlay } from 'ng-primitives/portal';\nimport {\n  attrBinding,\n  createPrimitive,\n  emitter,\n  listener,\n  StateInjectionOptions,\n} from 'ng-primitives/state';\nimport { safeTakeUntilDestroyed } from 'ng-primitives/utils';\nimport { Observable } from 'rxjs';\nimport { injectDialogConfig } from '../config/dialog-config';\nimport { NgpDialogRef } from '../dialog/dialog-ref';\nimport { NgpDialogContext, NgpDialogManager } from '../dialog/dialog.service';\n\nexport interface NgpDialogTriggerState<T> {\n  /** The template to launch. */\n  readonly template?: Signal<TemplateRef<NgpDialogContext>>;\n  /**\n   * Whether the dialog should close on escape, or a guard function.\n   * @default `true`\n   */\n  readonly closeOnEscape?: Signal<NgpDismissGuard<KeyboardEvent>>;\n  /**\n   * Whether the dialog should close on outside click, or a guard function.\n   * @default `true`\n   */\n  readonly closeOnOutsideClick?: Signal<NgpDismissGuard<Element>>;\n  /**\n   * The container element or selector the dialog should be rendered into. `undefined` uses the\n   * dialog configuration, `null` renders into the body.\n   */\n  readonly container?: Signal<HTMLElement | string | null | undefined>;\n  /**\n   * Whether the dialog is modal. `undefined` uses `modal` from the dialog configuration.\n   */\n  readonly modal?: Signal<boolean | undefined>;\n  /** The event that is fired when the closed state changes. */\n  readonly closedChange: Observable<T>;\n}\n\nexport interface NgpDialogTriggerProps<T> {\n  /** The template to launch. */\n  readonly template: Signal<TemplateRef<NgpDialogContext>>;\n  /**\n   * Whether the dialog should close on escape, or a guard function.\n   * @default `true`\n   */\n  readonly closeOnEscape?: Signal<NgpDismissGuard<KeyboardEvent>>;\n  /**\n   * Whether the dialog should close on outside click, or a guard function.\n   * @default `true`\n   */\n  readonly closeOnOutsideClick?: Signal<NgpDismissGuard<Element>>;\n  /**\n   * The container element or selector the dialog should be rendered into. `undefined` uses the\n   * dialog configuration, `null` renders into the body.\n   */\n  readonly container?: Signal<HTMLElement | string | null | undefined>;\n  /**\n   * Whether the dialog is modal. `undefined` uses `modal` from the dialog configuration.\n   */\n  readonly modal?: Signal<boolean | undefined>;\n  readonly onClosedChange?: (value: T) => void;\n}\n\nexport const [\n  NgpDialogTriggerStateToken,\n  ngpDialogTrigger,\n  _injectDialogTriggerState,\n  provideDialogTriggerState,\n] = createPrimitive(\n  'NgpDialogTrigger',\n  <T>({\n    template,\n    closeOnEscape = signal<NgpDismissGuard<KeyboardEvent>>(true),\n    closeOnOutsideClick = signal<NgpDismissGuard<Element>>(true),\n    container = signal<HTMLElement | string | null | undefined>(undefined),\n    modal = signal<boolean | undefined>(undefined),\n    onClosedChange,\n  }: NgpDialogTriggerProps<T>) => {\n    const config = injectDialogConfig();\n    const elementRef = injectElementRef();\n    const dialogManager = inject(NgpDialogManager);\n    const destroyRef = inject(DestroyRef);\n    // Pass the trigger's injector so dialog content resolves DI from the component\n    // subtree, not the root injector. See #823.\n    const injector = inject(Injector);\n\n    const closed = emitter<T>();\n\n    // The dialog this trigger opened last, until it starts closing.\n    const openDialog = signal<NgpDialogRef | null>(null);\n\n    // Host bindings\n    attrBinding(elementRef, 'aria-expanded', () => (openDialog() ? 'true' : 'false'));\n\n    // Listener\n    listener(elementRef, 'click', handleClick);\n\n    function handleClick(): void {\n      // A non-modal dialog leaves its trigger usable: a second click closes it.\n      const current = openDialog();\n      if (current && current.config.modal === false) {\n        if (!current.disableClose) {\n          current.close();\n        }\n        return;\n      }\n\n      const dialogRef = dialogManager.open(template(), {\n        injector,\n        triggerElement: elementRef.nativeElement,\n        closeOnEscape: closeOnEscape(),\n        closeOnOutsideClick: closeOnOutsideClick(),\n        // resolve `undefined` here, the manager only sees the root configuration\n        container: container() === undefined ? config.container : container(),\n        modal: modal() ?? config.modal,\n      });\n\n      openDialog.set(dialogRef);\n\n      // `closed` emits when closing starts, before the exit animation\n      dialogRef.closed.pipe(safeTakeUntilDestroyed(destroyRef)).subscribe(({ result }) => {\n        if (openDialog() === dialogRef) {\n          openDialog.set(null);\n        }\n        onClosedChange?.(result as T);\n        closed.emit(result as T);\n      });\n\n      // Registered after the subscription above: destroy hooks run in order, so a trigger\n      // teardown unsubscribes it before closing the dialog, instead of emitting on a\n      // destroyed output.\n      if (config.lifetime === 'trigger') {\n        const stopFollowing = resolveTriggerLifetime(injector).onDestroy(() => dialogRef.close());\n        dialogRef.closed.subscribe(() => stopFollowing());\n      }\n    }\n\n    return {\n      template,\n      closeOnEscape,\n      closeOnOutsideClick,\n      container,\n      modal,\n      closedChange: closed.asObservable(),\n    } satisfies NgpDialogTriggerState<T>;\n  },\n);\n\n/**\n * The trigger whose removal closes the dialog: this one, or for a trigger inside a menu or\n * popover, that overlay's trigger, up to the first trigger outside any overlay or inside a\n * dialog.\n */\nfunction resolveTriggerLifetime(injector: Injector): DestroyRef {\n  const overlay = injector.get(NgpOverlay, null);\n  // An overlay reached through a dialog's injector holds the dialog's trigger, not this one.\n  const dialogRef = injector.get(NgpDialogRef, null);\n\n  if (!overlay || dialogRef?.injector?.get(NgpOverlay, null) === overlay) {\n    return injector.get(DestroyRef);\n  }\n\n  return resolveTriggerLifetime(overlay.triggerInjector);\n}\n\nexport function injectDialogTriggerState<T>(\n  options?: StateInjectionOptions,\n): Signal<NgpDialogTriggerState<T>> {\n  return _injectDialogTriggerState(options) as Signal<NgpDialogTriggerState<T>>;\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, input, output, TemplateRef } from '@angular/core';\nimport { dismissGuardAttribute, NgpDismissGuard, NgpDismissGuardInput } from 'ng-primitives/portal';\nimport { coerceBooleanOrUndefined } from 'ng-primitives/utils';\nimport { injectDialogConfig } from '../config/dialog-config';\nimport { NgpDialogContext } from '../dialog/dialog.service';\nimport { ngpDialogTrigger } from './dialog-trigger-state';\n\n@Directive({\n  selector: '[ngpDialogTrigger]',\n  exportAs: 'ngpDialogTrigger',\n})\nexport class NgpDialogTrigger<T = unknown> {\n  /** Access the global configuration */\n  private readonly config = injectDialogConfig();\n\n  /** The template to launch. */\n  readonly template = input.required<TemplateRef<NgpDialogContext>>({\n    alias: 'ngpDialogTrigger',\n  });\n\n  /**\n   * Whether the dialog should close on escape, or a guard function.\n   * @default `true`\n   */\n  readonly closeOnEscape = input<\n    NgpDismissGuard<KeyboardEvent>,\n    NgpDismissGuardInput<KeyboardEvent>\n  >(this.config.closeOnEscape ?? true, {\n    alias: 'ngpDialogTriggerCloseOnEscape',\n    transform: dismissGuardAttribute,\n  });\n\n  /**\n   * Whether the dialog should close on outside click, or a guard function.\n   * @default `true`\n   */\n  readonly closeOnOutsideClick = input<NgpDismissGuard<Element>, NgpDismissGuardInput<Element>>(\n    this.config.closeOnOutsideClick ?? true,\n    {\n      alias: 'ngpDialogTriggerCloseOnOutsideClick',\n      transform: dismissGuardAttribute,\n    },\n  );\n\n  /**\n   * The container element or selector the dialog should be rendered into. `undefined` uses the\n   * dialog configuration, `null` renders into the body.\n   * @default 'body'\n   */\n  readonly container = input<HTMLElement | string | null | undefined>(\n    this.config.container ?? 'body',\n    {\n      alias: 'ngpDialogTriggerContainer',\n    },\n  );\n\n  /**\n   * Whether the dialog is modal. A non-modal dialog, such as a drawer, leaves the page usable.\n   * `undefined` uses `modal` from the dialog configuration, not from a dialog the trigger is in.\n   * @default `true`\n   */\n  readonly modal = input<boolean | undefined, BooleanInput>(undefined, {\n    alias: 'ngpDialogTriggerModal',\n    transform: coerceBooleanOrUndefined,\n  });\n\n  /** Emits whenever the dialog is closed with the given result. */\n  readonly closed = output<T>({ alias: 'ngpDialogTriggerClosed' });\n\n  protected readonly state = ngpDialogTrigger({\n    template: this.template,\n    closeOnEscape: this.closeOnEscape,\n    closeOnOutsideClick: this.closeOnOutsideClick,\n    container: this.container,\n    modal: this.modal,\n    onClosedChange: (value: T) => this.closed.emit(value),\n  });\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input } from '@angular/core';\nimport { provideFocusTrapState } from 'ng-primitives/focus-trap';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectDialogConfig } from '../config/dialog-config';\nimport { injectDialogRef } from './dialog-ref';\nimport { ngpDialog, provideDialogState } from './dialog-state';\n\n@Directive({\n  selector: '[ngpDialog]',\n  exportAs: 'ngpDialog',\n  providers: [provideDialogState(), provideFocusTrapState()],\n  hostDirectives: [NgpExitAnimation],\n})\nexport class NgpDialog<T = unknown, R = unknown> {\n  private readonly config = injectDialogConfig();\n\n  /** The id of the dialog */\n  readonly id = input<string>(uniqueId('ngp-dialog'));\n\n  /** The dialog role. */\n  readonly role = input(this.config.role, {\n    alias: 'ngpDialogRole',\n  });\n\n  /**\n   * Whether the dialog is a modal, reflected in `aria-modal`. Defaults to the `modal` the dialog\n   * was opened with, which decides its behaviour.\n   */\n  readonly modal = input<boolean, BooleanInput>(injectDialogRef().config.modal !== false, {\n    alias: 'ngpDialogModal',\n    transform: booleanAttribute,\n  });\n\n  /** The dialog state */\n  protected readonly state = ngpDialog<T, R>({\n    id: this.id,\n    role: this.role,\n    modal: this.modal,\n  });\n\n  /** Close the dialog. */\n  close(result?: R): void {\n    return this.state.close(result);\n  }\n\n  /** @internal register a labelledby id */\n  setLabelledBy(id: string): void {\n    return this.state.setLabelledBy(id);\n  }\n\n  /** @internal register a describedby id */\n  setDescribedBy(id: string): void {\n    return this.state.setDescribedBy(id);\n  }\n\n  /** @internal remove a labelledby id */\n  removeLabelledBy(id: string): void {\n    return this.state.removeLabelledBy(id);\n  }\n\n  /** @internal remove a describedby id */\n  removeDescribedBy(id: string): void {\n    return this.state.removeDescribedBy(id);\n  }\n}\n","import { createPrimitive } from 'ng-primitives/state';\n\nexport interface NgpDialogPanelState {}\n\nexport interface NgpDialogPanelProps {}\n\nexport const [\n  NgpDialogPanelStateToken,\n  ngpDialogPanel,\n  injectDialogPanelState,\n  provideDialogPanelState,\n] = createPrimitive('NgpDialogPanel', ({}: NgpDialogPanelProps) => {\n  return {} satisfies NgpDialogPanelState;\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAiFO,MAAM,mBAAmB,GAAoB;AAClD,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,KAAK,EAAE,IAAI;AACX,IAAA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