{"version":3,"file":"mtxDrawer.mjs","sources":["../../../projects/extensions/drawer/drawer-config.ts","../../../projects/extensions/drawer/drawer-animation.ts","../../../projects/extensions/drawer/drawer-container.ts","../../../projects/extensions/drawer/drawer-container.html","../../../projects/extensions/drawer/drawer-ref.ts","../../../projects/extensions/drawer/drawer.ts","../../../projects/extensions/drawer/drawer-module.ts","../../../projects/extensions/drawer/mtxDrawer.ts"],"sourcesContent":["import { Direction } from '@angular/cdk/bidi';\nimport { ScrollStrategy } from '@angular/cdk/overlay';\nimport { ViewContainerRef } from '@angular/core';\n\n/** Options for where to set focus to automatically on dialog open */\nexport type AutoFocusTarget = 'dialog' | 'first-tabbable' | 'first-heading';\n\n/** Possible overrides for a drawer's position. */\nexport type DrawerPosition = 'top' | 'bottom' | 'left' | 'right';\n\n/**\n * Configuration used when opening a drawer.\n */\nexport class MtxDrawerConfig<D = any> {\n  /** The view container to place the overlay for the drawer into. */\n  viewContainerRef?: ViewContainerRef;\n\n  /** Extra CSS classes to be added to the drawer container. */\n  panelClass?: string | string[];\n\n  /** Text layout direction for the drawer. */\n  direction?: Direction;\n\n  /** Data being injected into the child component. */\n  data?: D | null = null;\n\n  /** Whether the drawer has a backdrop. */\n  hasBackdrop?: boolean = true;\n\n  /** Custom class for the backdrop. */\n  backdropClass?: string;\n\n  /** Whether the user can use escape or clicking outside to close the drawer. */\n  disableClose?: boolean = false;\n\n  /** Aria label to assign to the drawer element. */\n  ariaLabel?: string | null = null;\n\n  /**\n   * Whether the drawer should close when the user goes backwards/forwards in history.\n   * Note that this usually doesn't include clicking on links (unless the user is using\n   * the `HashLocationStrategy`).\n   */\n  closeOnNavigation?: boolean = true;\n\n  /**\n   * Where the drawer should focus on open.\n   * @breaking-change 14.0.0 Remove boolean option from autoFocus. Use string or\n   * AutoFocusTarget instead.\n   */\n  autoFocus?: AutoFocusTarget | string | boolean = 'first-tabbable';\n\n  /**\n   * Whether the drawer should restore focus to the\n   * previously-focused element, after it's closed.\n   */\n  restoreFocus?: boolean = true;\n\n  /** Scroll strategy to be used for the drawer. */\n  scrollStrategy?: ScrollStrategy;\n\n  /** Position of the drawer */\n  position?: DrawerPosition = 'right';\n\n  /** Width of the drawer. If a number is provided, assumes pixel units. */\n  width?: number | string;\n\n  /** Height of the drawer. If a number is provided, assumes pixel units. */\n  height?: number | string;\n\n  /** Min-width of the drawer. If a number is provided, assumes pixel units. */\n  minWidth?: number | string;\n\n  /** Min-height of the drawer. If a number is provided, assumes pixel units. */\n  minHeight?: number | string;\n\n  /** Max-width of the drawer. If a number is provided, assumes pixel units. */\n  maxWidth?: number | string;\n\n  /** Max-height of the drawer. If a number is provided, assumes pixel units. */\n  maxHeight?: number | string;\n}\n","import {\n  animate,\n  state,\n  style,\n  transition,\n  trigger,\n  AnimationTriggerMetadata,\n} from '@angular/animations';\n\n/** Animations used by the drawer. */\nexport const mtxDrawerAnimations: {\n  readonly drawerState: AnimationTriggerMetadata;\n} = {\n  /** Animation that shows and hides a drawer. */\n  drawerState: trigger('state', [\n    state(\n      'void, hidden',\n      style({\n        'box-shadow': 'none',\n        'visibility': 'hidden',\n      })\n    ),\n    state(\n      'visible',\n      style({\n        transform: 'none',\n        visibility: 'visible',\n      })\n    ),\n    transition(\n      'visible => void, visible => hidden',\n      animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)')\n    ),\n    transition('void => visible', animate('150ms cubic-bezier(0, 0, 0.2, 1)')),\n  ]),\n};\n","import { AnimationEvent } from '@angular/animations';\nimport { FocusTrap, FocusTrapFactory, InteractivityChecker } from '@angular/cdk/a11y';\nimport { coerceArray, coerceCssPixelValue } from '@angular/cdk/coercion';\nimport { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';\nimport { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';\nimport {\n  BasePortalOutlet,\n  CdkPortalOutlet,\n  ComponentPortal,\n  DomPortal,\n  TemplatePortal,\n} from '@angular/cdk/portal';\nimport { DOCUMENT } from '@angular/common';\nimport {\n  ChangeDetectionStrategy,\n  ChangeDetectorRef,\n  Component,\n  ComponentRef,\n  ElementRef,\n  EmbeddedViewRef,\n  EventEmitter,\n  Inject,\n  NgZone,\n  OnDestroy,\n  Optional,\n  ViewChild,\n  ViewEncapsulation,\n} from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { mtxDrawerAnimations } from './drawer-animation';\nimport { MtxDrawerConfig } from './drawer-config';\n\n/**\n * Internal component that wraps user-provided drawer content.\n * @docs-private\n */\n@Component({\n  selector: 'mtx-drawer-container',\n  templateUrl: 'drawer-container.html',\n  styleUrls: ['drawer-container.scss'],\n  // In Ivy embedded views will be change detected from their declaration place, rather than where\n  // they were stamped out. This means that we can't have the drawer container be OnPush,\n  // because it might cause the sheets that were opened from a template not to be out of date.\n  changeDetection: ChangeDetectionStrategy.Default,\n  encapsulation: ViewEncapsulation.None,\n  animations: [mtxDrawerAnimations.drawerState],\n  host: {\n    'class': 'mtx-drawer-container',\n    '[class]': '_drawerPosition',\n    'tabindex': '-1',\n    'role': 'dialog',\n    'aria-modal': 'true',\n    '[attr.aria-label]': 'drawerConfig?.ariaLabel',\n    '[@state]': '_animationState',\n    '(@state.start)': '_onAnimationStart($event)',\n    '(@state.done)': '_onAnimationDone($event)',\n  },\n})\nexport class MtxDrawerContainer extends BasePortalOutlet implements OnDestroy {\n  private _breakpointSubscription: Subscription;\n\n  /** The portal outlet inside of this container into which the content will be loaded. */\n  @ViewChild(CdkPortalOutlet, { static: true }) _portalOutlet!: CdkPortalOutlet;\n\n  /** The state of the drawer animations. */\n  _animationState: 'void' | 'visible' | 'hidden' = 'void';\n\n  /** Emits whenever the state of the animation changes. */\n  _animationStateChanged = new EventEmitter<AnimationEvent>();\n\n  /** The class that traps and manages focus within the drawer. */\n  private _focusTrap!: FocusTrap;\n\n  /** Element that was focused before the drawer was opened. */\n  private _elementFocusedBeforeOpened: HTMLElement | null = null;\n\n  /** Server-side rendering-compatible reference to the global document object. */\n  private _document: Document;\n\n  /** Whether the component has been destroyed. */\n  private _destroyed!: boolean;\n\n  get _drawerPosition() {\n    return `mtx-drawer-${this.drawerConfig.position}`;\n  }\n\n  get _drawerWidth() {\n    return this.drawerConfig.position === 'left' || this.drawerConfig.position === 'right'\n      ? coerceCssPixelValue(this.drawerConfig.width)\n      : '100vw';\n  }\n\n  get _drawerHeight() {\n    return this.drawerConfig.position === 'top' || this.drawerConfig.position === 'bottom'\n      ? coerceCssPixelValue(this.drawerConfig.height)\n      : '100vh';\n  }\n\n  _getDrawerSize() {\n    return {\n      width: this._drawerWidth,\n      height: this._drawerHeight,\n      minWidth: coerceCssPixelValue(this.drawerConfig.minWidth),\n      minHeight: coerceCssPixelValue(this.drawerConfig.minHeight),\n      maxWidth: coerceCssPixelValue(this.drawerConfig.maxWidth),\n      maxHeight: coerceCssPixelValue(this.drawerConfig.maxHeight),\n    };\n  }\n\n  constructor(\n    private _elementRef: ElementRef<HTMLElement>,\n    private _changeDetectorRef: ChangeDetectorRef,\n    private _focusTrapFactory: FocusTrapFactory,\n    private readonly _interactivityChecker: InteractivityChecker,\n    private readonly _ngZone: NgZone,\n    breakpointObserver: BreakpointObserver,\n    @Optional() @Inject(DOCUMENT) document: any,\n    /** The drawer configuration. */\n    public drawerConfig: MtxDrawerConfig\n  ) {\n    super();\n\n    this._document = document;\n    this._breakpointSubscription = breakpointObserver\n      .observe([Breakpoints.Medium, Breakpoints.Large, Breakpoints.XLarge])\n      .subscribe(() => {});\n  }\n\n  /** Attach a component portal as content to this drawer container. */\n  attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T> {\n    this._validatePortalAttached();\n    this._setPanelClass();\n    this._savePreviouslyFocusedElement();\n    return this._portalOutlet.attachComponentPortal(portal);\n  }\n\n  /** Attach a template portal as content to this drawer container. */\n  attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C> {\n    this._validatePortalAttached();\n    this._setPanelClass();\n    this._savePreviouslyFocusedElement();\n    return this._portalOutlet.attachTemplatePortal(portal);\n  }\n\n  /**\n   * Attaches a DOM portal to the drawer container.\n   * @deprecated To be turned into a method.\n   * @breaking-change 10.0.0\n   */\n  override attachDomPortal = (portal: DomPortal) => {\n    this._validatePortalAttached();\n    this._setPanelClass();\n    this._savePreviouslyFocusedElement();\n    return this._portalOutlet.attachDomPortal(portal);\n  };\n\n  /** Begin animation of drawer entrance into view. */\n  enter(): void {\n    if (!this._destroyed) {\n      this._animationState = 'visible';\n      this._changeDetectorRef.detectChanges();\n    }\n  }\n\n  /** Begin animation of the drawer exiting from view. */\n  exit(): void {\n    if (!this._destroyed) {\n      this._animationState = 'hidden';\n      this._changeDetectorRef.markForCheck();\n    }\n  }\n\n  ngOnDestroy() {\n    this._breakpointSubscription.unsubscribe();\n    this._destroyed = true;\n  }\n\n  _onAnimationDone(event: AnimationEvent) {\n    if (event.toState === 'hidden') {\n      this._restoreFocus();\n    } else if (event.toState === 'visible') {\n      this._trapFocus();\n    }\n\n    this._animationStateChanged.emit(event);\n  }\n\n  _onAnimationStart(event: AnimationEvent) {\n    this._animationStateChanged.emit(event);\n  }\n\n  private _toggleClass(cssClass: string, add: boolean) {\n    this._elementRef.nativeElement.classList.toggle(cssClass, add);\n  }\n\n  private _validatePortalAttached() {\n    if (this._portalOutlet.hasAttached()) {\n      throw Error('Attempting to attach drawer content after content is already attached');\n    }\n  }\n\n  private _setPanelClass() {\n    const element: HTMLElement = this._elementRef.nativeElement;\n    element.classList.add(...coerceArray(this.drawerConfig.panelClass || []));\n  }\n\n  /**\n   * Focuses the provided element. If the element is not focusable, it will add a tabIndex\n   * attribute to forcefully focus it. The attribute is removed after focus is moved.\n   * @param element The element to focus.\n   */\n  private _forceFocus(element: HTMLElement, options?: FocusOptions) {\n    if (!this._interactivityChecker.isFocusable(element)) {\n      element.tabIndex = -1;\n      // The tabindex attribute should be removed to avoid navigating to that element again\n      this._ngZone.runOutsideAngular(() => {\n        element.addEventListener('blur', () => element.removeAttribute('tabindex'));\n        element.addEventListener('mousedown', () => element.removeAttribute('tabindex'));\n      });\n    }\n    element.focus(options);\n  }\n\n  /**\n   * Focuses the first element that matches the given selector within the focus trap.\n   * @param selector The CSS selector for the element to set focus to.\n   */\n  private _focusByCssSelector(selector: string, options?: FocusOptions) {\n    const elementToFocus = this._elementRef.nativeElement.querySelector(\n      selector\n    ) as HTMLElement | null;\n    if (elementToFocus) {\n      this._forceFocus(elementToFocus, options);\n    }\n  }\n\n  /**\n   * Moves the focus inside the focus trap. When autoFocus is not set to 'bottom-sheet',\n   * if focus cannot be moved then focus will go to the drawer container.\n   */\n  private _trapFocus() {\n    const element = this._elementRef.nativeElement;\n\n    if (!this._focusTrap) {\n      this._focusTrap = this._focusTrapFactory.create(element);\n    }\n\n    // If were to attempt to focus immediately, then the content of the drawer would not\n    // yet be ready in instances where change detection has to run first. To deal with this,\n    // we simply wait for the microtask queue to be empty when setting focus when autoFocus\n    // isn't set to drawer. If the element inside the drawer can't be focused,\n    // then the container is focused so the user can't tab into other elements behind it.\n    switch (this.drawerConfig.autoFocus) {\n      case false:\n      case 'dialog':\n        // eslint-disable-next-line no-case-declarations\n        const activeElement = _getFocusedElementPierceShadowDom();\n        // Ensure that focus is on the drawer container. It's possible that a different\n        // component tried to move focus while the open animation was running. See:\n        // https://github.com/angular/components/issues/16215. Note that we only want to do this\n        // if the focus isn't inside the drawer already, because it's possible that the\n        // consumer specified `autoFocus` in order to move focus themselves.\n        if (activeElement !== element && !element.contains(activeElement)) {\n          element.focus();\n        }\n        break;\n      case true:\n      case 'first-tabbable':\n        this._focusTrap.focusInitialElementWhenReady();\n        break;\n      case 'first-heading':\n        this._focusByCssSelector('h1, h2, h3, h4, h5, h6, [role=\"heading\"]');\n        break;\n      default:\n        this._focusByCssSelector(this.drawerConfig.autoFocus!);\n        break;\n    }\n  }\n\n  /** Restores focus to the element that was focused before the drawer was opened. */\n  private _restoreFocus() {\n    const toFocus = this._elementFocusedBeforeOpened;\n\n    // We need the extra check, because IE can set the `activeElement` to null in some cases.\n    if (this.drawerConfig.restoreFocus && toFocus && typeof toFocus.focus === 'function') {\n      const activeElement = _getFocusedElementPierceShadowDom();\n      const element = this._elementRef.nativeElement;\n\n      // Make sure that focus is still inside the drawer or is on the body (usually because a\n      // non-focusable element like the backdrop was clicked) before moving it. It's possible that\n      // the consumer moved it themselves before the animation was done, in which case we shouldn't\n      // do anything.\n      if (\n        !activeElement ||\n        activeElement === this._document.body ||\n        activeElement === element ||\n        element.contains(activeElement)\n      ) {\n        toFocus.focus();\n      }\n    }\n\n    if (this._focusTrap) {\n      this._focusTrap.destroy();\n    }\n  }\n\n  /** Saves a reference to the element that was focused before the drawer was opened. */\n  private _savePreviouslyFocusedElement() {\n    this._elementFocusedBeforeOpened = _getFocusedElementPierceShadowDom();\n\n    // The `focus` method isn't available during server-side rendering.\n    if (this._elementRef.nativeElement.focus) {\n      this._ngZone.runOutsideAngular(() => {\n        Promise.resolve().then(() => this._elementRef.nativeElement.focus());\n      });\n    }\n  }\n}\n","<div class=\"mtx-drawer-content-wrapper\" [style]=\"_getDrawerSize()\">\n  <ng-template cdkPortalOutlet></ng-template>\n</div>\n","import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';\nimport { OverlayRef } from '@angular/cdk/overlay';\nimport { merge, Observable, Subject } from 'rxjs';\nimport { filter, take } from 'rxjs/operators';\nimport { MtxDrawerContainer } from './drawer-container';\n\n/**\n * Reference to a drawer dispatched from the drawer service.\n */\nexport class MtxDrawerRef<T = any, R = any> {\n  /** Instance of the component making up the content of the drawer. */\n  instance!: T;\n\n  /**\n   * Instance of the component into which the drawer content is projected.\n   * @docs-private\n   */\n  containerInstance: MtxDrawerContainer;\n\n  /** Whether the user is allowed to close the drawer. */\n  disableClose: boolean | undefined;\n\n  /** Subject for notifying the user that the drawer has been dismissed. */\n  private readonly _afterDismissed = new Subject<R | undefined>();\n\n  /** Subject for notifying the user that the drawer has opened and appeared. */\n  private readonly _afterOpened = new Subject<void>();\n\n  /** Result to be passed down to the `afterDismissed` stream. */\n  private _result: R | undefined;\n\n  /** Handle to the timeout that's running as a fallback in case the exit animation doesn't fire. */\n  private _closeFallbackTimeout!: any;\n\n  constructor(containerInstance: MtxDrawerContainer, private _overlayRef: OverlayRef) {\n    this.containerInstance = containerInstance;\n    this.disableClose = containerInstance.drawerConfig.disableClose;\n    // Emit when opening animation completes\n    containerInstance._animationStateChanged\n      .pipe(\n        filter(event => event.phaseName === 'done' && event.toState === 'visible'),\n        take(1)\n      )\n      .subscribe(() => {\n        this._afterOpened.next();\n        this._afterOpened.complete();\n      });\n\n    // Dispose overlay when closing animation is complete\n    containerInstance._animationStateChanged\n      .pipe(\n        filter(event => event.phaseName === 'done' && event.toState === 'hidden'),\n        take(1)\n      )\n      .subscribe(() => {\n        clearTimeout(this._closeFallbackTimeout);\n        _overlayRef.dispose();\n      });\n\n    _overlayRef\n      .detachments()\n      .pipe(take(1))\n      .subscribe(() => {\n        this._afterDismissed.next(this._result);\n        this._afterDismissed.complete();\n      });\n\n    merge(\n      _overlayRef.backdropClick(),\n      _overlayRef.keydownEvents().pipe(filter(event => event.keyCode === ESCAPE))\n    ).subscribe(event => {\n      if (\n        !this.disableClose &&\n        (event.type !== 'keydown' || !hasModifierKey(event as KeyboardEvent))\n      ) {\n        event.preventDefault();\n        this.dismiss();\n      }\n    });\n  }\n\n  /**\n   * Dismisses the drawer.\n   * @param result Data to be passed back to the drawer opener.\n   */\n  dismiss(result?: R): void {\n    if (!this._afterDismissed.closed) {\n      // Transition the backdrop in parallel to the drawer.\n      this.containerInstance._animationStateChanged\n        .pipe(\n          filter(event => event.phaseName === 'start'),\n          take(1)\n        )\n        .subscribe(event => {\n          // The logic that disposes of the overlay depends on the exit animation completing, however\n          // it isn't guaranteed if the parent view is destroyed while it's running. Add a fallback\n          // timeout which will clean everything up if the animation hasn't fired within the specified\n          // amount of time plus 100ms. We don't need to run this outside the NgZone, because for the\n          // vast majority of cases the timeout will have been cleared before it has fired.\n          this._closeFallbackTimeout = setTimeout(() => {\n            this._overlayRef.dispose();\n          }, event.totalTime + 100);\n\n          this._overlayRef.detachBackdrop();\n        });\n\n      this._result = result;\n      this.containerInstance.exit();\n    }\n  }\n\n  /** Gets an observable that is notified when the drawer is finished closing. */\n  afterDismissed(): Observable<R | undefined> {\n    return this._afterDismissed;\n  }\n\n  /** Gets an observable that is notified when the drawer has opened and appeared. */\n  afterOpened(): Observable<void> {\n    return this._afterOpened;\n  }\n\n  /**\n   * Gets an observable that emits when the overlay's backdrop has been clicked.\n   */\n  backdropClick(): Observable<MouseEvent> {\n    return this._overlayRef.backdropClick();\n  }\n\n  /**\n   * Gets an observable that emits when keydown events are targeted on the overlay.\n   */\n  keydownEvents(): Observable<KeyboardEvent> {\n    return this._overlayRef.keydownEvents();\n  }\n}\n","import { Directionality } from '@angular/cdk/bidi';\nimport { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal, ComponentType, TemplatePortal } from '@angular/cdk/portal';\nimport {\n  ComponentRef,\n  Injectable,\n  Injector,\n  Optional,\n  SkipSelf,\n  TemplateRef,\n  InjectionToken,\n  Inject,\n  OnDestroy,\n  StaticProvider,\n  InjectFlags,\n} from '@angular/core';\nimport { of as observableOf } from 'rxjs';\nimport { MtxDrawerConfig } from './drawer-config';\nimport { MtxDrawerContainer } from './drawer-container';\nimport { MtxDrawerRef } from './drawer-ref';\n\n/** Injection token that can be used to access the data that was passed in to a drawer. */\nexport const MTX_DRAWER_DATA = new InjectionToken<any>('MtxDrawerData');\n\n/** Injection token that can be used to specify default drawer options. */\nexport const MTX_DRAWER_DEFAULT_OPTIONS = new InjectionToken<MtxDrawerConfig>(\n  'mtx-drawer-default-options'\n);\n\n/**\n * Service to trigger Material Design bottom sheets.\n */\n@Injectable()\nexport class MtxDrawer implements OnDestroy {\n  private _drawerRefAtThisLevel: MtxDrawerRef<any> | null = null;\n\n  /** Reference to the currently opened drawer. */\n  get _openedDrawerRef(): MtxDrawerRef<any> | null {\n    const parent = this._parentDrawer;\n    return parent ? parent._openedDrawerRef : this._drawerRefAtThisLevel;\n  }\n\n  set _openedDrawerRef(value: MtxDrawerRef<any> | null) {\n    if (this._parentDrawer) {\n      this._parentDrawer._openedDrawerRef = value;\n    } else {\n      this._drawerRefAtThisLevel = value;\n    }\n  }\n\n  constructor(\n    private _overlay: Overlay,\n    private _injector: Injector,\n    @Optional() @SkipSelf() private _parentDrawer: MtxDrawer,\n    @Optional()\n    @Inject(MTX_DRAWER_DEFAULT_OPTIONS)\n    private _defaultOptions?: MtxDrawerConfig\n  ) {}\n\n  /**\n   * Opens a drawer containing the given component.\n   * @param component Type of the component to load into the drawer.\n   * @param config Extra configuration options.\n   * @returns Reference to the newly-opened drawer.\n   */\n  open<T, D = any, R = any>(\n    component: ComponentType<T>,\n    config?: MtxDrawerConfig<D>\n  ): MtxDrawerRef<T, R>;\n\n  /**\n   * Opens a drawer containing the given template.\n   * @param template TemplateRef to instantiate as the drawer content.\n   * @param config Extra configuration options.\n   * @returns Reference to the newly-opened drawer.\n   */\n  open<T, D = any, R = any>(\n    template: TemplateRef<T>,\n    config?: MtxDrawerConfig<D>\n  ): MtxDrawerRef<T, R>;\n\n  open<T, D = any, R = any>(\n    componentOrTemplateRef: ComponentType<T> | TemplateRef<T>,\n    config?: MtxDrawerConfig<D>\n  ): MtxDrawerRef<T, R> {\n    const _config = _applyConfigDefaults(this._defaultOptions || new MtxDrawerConfig(), config);\n    const overlayRef = this._createOverlay(_config);\n    const container = this._attachContainer(overlayRef, _config);\n    const ref = new MtxDrawerRef<T, R>(container, overlayRef);\n\n    if (componentOrTemplateRef instanceof TemplateRef) {\n      container.attachTemplatePortal(\n        new TemplatePortal<T>(componentOrTemplateRef, null!, {\n          $implicit: _config.data,\n          drawerRef: ref,\n        } as any)\n      );\n    } else {\n      const portal = new ComponentPortal(\n        componentOrTemplateRef,\n        undefined,\n        this._createInjector(_config, ref)\n      );\n      const contentRef = container.attachComponentPortal(portal);\n      ref.instance = contentRef.instance;\n    }\n\n    // When the drawer is dismissed, clear the reference to it.\n    ref.afterDismissed().subscribe(() => {\n      // Clear the drawer ref if it hasn't already been replaced by a newer one.\n      if (this._openedDrawerRef == ref) {\n        this._openedDrawerRef = null;\n      }\n    });\n\n    if (this._openedDrawerRef) {\n      // If a drawer is already in view, dismiss it and enter the\n      // new drawer after exit animation is complete.\n      this._openedDrawerRef.afterDismissed().subscribe(() => ref.containerInstance.enter());\n      this._openedDrawerRef.dismiss();\n    } else {\n      // If no drawer is in view, enter the new drawer.\n      ref.containerInstance.enter();\n    }\n\n    this._openedDrawerRef = ref;\n\n    return ref;\n  }\n\n  /**\n   * Dismisses the currently-visible drawer.\n   * @param result Data to pass to the drawer instance.\n   */\n  dismiss<R = any>(result?: R): void {\n    if (this._openedDrawerRef) {\n      this._openedDrawerRef.dismiss(result);\n    }\n  }\n\n  ngOnDestroy() {\n    if (this._drawerRefAtThisLevel) {\n      this._drawerRefAtThisLevel.dismiss();\n    }\n  }\n\n  /**\n   * Attaches the drawer container component to the overlay.\n   */\n  private _attachContainer(overlayRef: OverlayRef, config: MtxDrawerConfig): MtxDrawerContainer {\n    const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;\n    const injector = Injector.create({\n      parent: userInjector || this._injector,\n      providers: [{ provide: MtxDrawerConfig, useValue: config }],\n    });\n\n    const containerPortal = new ComponentPortal(\n      MtxDrawerContainer,\n      config.viewContainerRef,\n      injector\n    );\n    const containerRef: ComponentRef<MtxDrawerContainer> = overlayRef.attach(containerPortal);\n    return containerRef.instance;\n  }\n\n  /**\n   * Creates a new overlay and places it in the correct location.\n   * @param config The user-specified drawer config.\n   */\n  private _createOverlay(config: MtxDrawerConfig): OverlayRef {\n    const overlayConfig = new OverlayConfig({\n      direction: config.direction,\n      hasBackdrop: config.hasBackdrop,\n      disposeOnNavigation: config.closeOnNavigation,\n      maxWidth: '100%',\n      scrollStrategy: config.scrollStrategy || this._overlay.scrollStrategies.block(),\n      positionStrategy: this._overlay.position().global()[config.position!]('0'),\n    });\n\n    if (config.backdropClass) {\n      overlayConfig.backdropClass = config.backdropClass;\n    }\n\n    return this._overlay.create(overlayConfig);\n  }\n\n  /**\n   * Creates an injector to be used inside of a drawer component.\n   * @param config Config that was used to create the drawer.\n   * @param drawerRef Reference to the drawer.\n   */\n  private _createInjector<T>(config: MtxDrawerConfig, drawerRef: MtxDrawerRef<T>): Injector {\n    const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;\n    const providers: StaticProvider[] = [\n      { provide: MtxDrawerRef, useValue: drawerRef },\n      { provide: MTX_DRAWER_DATA, useValue: config.data },\n    ];\n\n    if (\n      config.direction &&\n      (!userInjector ||\n        !userInjector.get<Directionality | null>(Directionality, null, InjectFlags.Optional))\n    ) {\n      providers.push({\n        provide: Directionality,\n        useValue: { value: config.direction, change: observableOf() },\n      });\n    }\n\n    return Injector.create({ parent: userInjector || this._injector, providers });\n  }\n}\n\n/**\n * Applies default options to the drawer config.\n * @param defaults Object containing the default values to which to fall back.\n * @param config The configuration to which the defaults will be applied.\n * @returns The new configuration object with defaults applied.\n */\nfunction _applyConfigDefaults(\n  defaults: MtxDrawerConfig,\n  config?: MtxDrawerConfig\n): MtxDrawerConfig {\n  return { ...defaults, ...config };\n}\n","import { OverlayModule } from '@angular/cdk/overlay';\nimport { PortalModule } from '@angular/cdk/portal';\nimport { NgModule } from '@angular/core';\nimport { MatCommonModule } from '@angular/material/core';\nimport { MtxDrawer } from './drawer';\nimport { MtxDrawerContainer } from './drawer-container';\n\n@NgModule({\n  imports: [OverlayModule, PortalModule, MatCommonModule],\n  exports: [MtxDrawerContainer, MatCommonModule],\n  declarations: [MtxDrawerContainer],\n  providers: [MtxDrawer],\n})\nexport class MtxDrawerModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i3.MtxDrawerConfig","observableOf","i1"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA;;AAEG;MACU,eAAe,CAAA;AAA5B,IAAA,WAAA,GAAA;;AAWE,QAAA,IAAI,CAAA,IAAA,G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