text: /**
   * @fileoverview added by tsickle
   * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
   */
  /**
   * @license
   * Copyright Google LLC All Rights Reserved.
   *
   * Use of this source code is governed by an MIT-style license that can be
   * found in the LICENSE file at https://angular.io/license
   */
  import { CdkAccordionItem } from '@angular/cdk/accordion';
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
  import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
  import { TemplatePortal } from '@angular/cdk/portal';
  import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, Directive, EventEmitter, ElementRef, Input, Inject, Optional, Output, SkipSelf, ViewContainerRef, ViewEncapsulation, ViewChild, InjectionToken, } from '@angular/core';
  import { DOCUMENT } from '@angular/common';
  import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
  import { Subject } from 'rxjs';
  import { filter, startWith, take, distinctUntilChanged } from 'rxjs/operators';
  import { matExpansionAnimations } from './expansion-animations';
  import { MatExpansionPanelContent } from './expansion-panel-content';
  import { MAT_ACCORDION } from './accordion-base';
  /**
   * Counter for generating unique element ids.
   * @type {?}
   */
  let uniqueId = 0;
  /**
   * Object that can be used to override the default options
   * for all of the expansion panels in a module.
   * @record
   */
  export function MatExpansionPanelDefaultOptions() { }
  if (false) {
      /**
       * Height of the header while the panel is expanded.
       * @type {?}
       */
      MatExpansionPanelDefaultOptions.prototype.expandedHeight;
      /**
       * Height of the header while the panel is collapsed.
       * @type {?}
       */
      MatExpansionPanelDefaultOptions.prototype.collapsedHeight;
      /**
       * Whether the toggle indicator should be hidden.
       * @type {?}
       */
      MatExpansionPanelDefaultOptions.prototype.hideToggle;
  }
  /**
   * Injection token that can be used to configure the defalt
   * options for the expansion panel component.
   * @type {?}
   */
  export const MAT_EXPANSION_PANEL_DEFAULT_OPTIONS = new InjectionToken('MAT_EXPANSION_PANEL_DEFAULT_OPTIONS');
  const ɵ0 = undefined;
  /**
   * `<mat-expansion-panel>`
   *
   * This component can be used as a single element to show expandable content, or as one of
   * multiple children of an element with the MatAccordion directive attached.
   */
  export class MatExpansionPanel extends CdkAccordionItem {
      /**
       * @param {?} accordion
       * @param {?} _changeDetectorRef
       * @param {?} _uniqueSelectionDispatcher
       * @param {?} _viewContainerRef
       * @param {?=} _document
       * @param {?=} _animationMode
       * @param {?=} defaultOptions
       */
      constructor(accordion, _changeDetectorRef, _uniqueSelectionDispatcher, _viewContainerRef, 
      // @breaking-change 8.0.0 _document and _animationMode to be made required
      _document, _animationMode, defaultOptions) {
          super(accordion, _changeDetectorRef, _uniqueSelectionDispatcher);
          this._viewContainerRef = _viewContainerRef;
          this._animationMode = _animationMode;
          this._hideToggle = false;
          /**
           * An event emitted after the body's expansion animation happens.
           */
          this.afterExpand = new EventEmitter();
          /**
           * An event emitted after the body's collapse animation happens.
           */
          this.afterCollapse = new EventEmitter();
          /**
           * Stream that emits for changes in `\@Input` properties.
           */
          this._inputChanges = new Subject();
          /**
           * ID for the associated header element. Used for a11y labelling.
           */
          this._headerId = `mat-expansion-panel-header-${uniqueId++}`;
          /**
           * Stream of body animation done events.
           */
          this._bodyAnimationDone = new Subject();
          this.accordion = accordion;
          this._document = _document;
          // We need a Subject with distinctUntilChanged, because the `done` event
          // fires twice on some browsers. See https://github.com/angular/angular/issues/24084
          this._bodyAnimationDone.pipe(distinctUntilChanged((x, y) => {
              return x.fromState === y.fromState && x.toState === y.toState;
          })).subscribe(event => {
              if (event.fromState !== 'void') {
                  if (event.toState === 'expanded') {
                      this.afterExpand.emit();
                  }
                  else if (event.toState === 'collapsed') {
                      this.afterCollapse.emit();
                  }
              }
          });
          if (defaultOptions) {
              this.hideToggle = defaultOptions.hideToggle;
          }
      }
      /**
       * Whether the toggle indicator should be hidden.
       * @return {?}
       */
      get hideToggle() {
          return this._hideToggle || (this.accordion && this.accordion.hideToggle);
      }
      /**
       * @param {?} value
       * @return {?}
       */
      set hideToggle(value) {
          this._hideToggle = coerceBooleanProperty(value);
      }
      /**
       * Determines whether the expansion panel should have spacing between it and its siblings.
       * @return {?}
       */
      _hasSpacing() {
          if (this.accordion) {
              // We don't need to subscribe to the `stateChanges` of the parent accordion because each time
              // the [displayMode] input changes, the change detection will also cover the host bindings
              // of this expansion panel.
              return (this.expanded ? this.accordion.displayMode : this._getExpandedState()) === 'default';
          }
          return false;
      }
      /**
       * Gets the expanded state string.
       * @return {?}
       */
      _getExpandedState() {
          return this.expanded ? 'expanded' : 'collapsed';
      }
      /**
       * @return {?}
       */
      ngAfterContentInit() {
          if (this._lazyContent) {
              // Render the content as soon as the panel becomes open.
              this.opened.pipe(startWith((/** @type {?} */ (null))), filter(() => this.expanded && !this._portal), take(1)).subscribe(() => {
                  this._portal = new TemplatePortal(this._lazyContent._template, this._viewContainerRef);
              });
          }
      }
      /**
       * @param {?} changes
       * @return {?}
       */
      ngOnChanges(changes) {
          this._inputChanges.next(changes);
      }
      /**
       * @return {?}
       */
      ngOnDestroy() {
          super.ngOnDestroy();
          this._bodyAnimationDone.complete();
          this._inputChanges.complete();
      }
      /**
       * Checks whether the expansion panel's content contains the currently-focused element.
       * @return {?}
       */
      _containsFocus() {
          if (this._body && this._document) {
              /** @type {?} */
              const focusedElement = this._document.activeElement;
              /** @type {?} */
              const bodyElement = this._body.nativeElement;
              return focusedElement === bodyElement || bodyElement.contains(focusedElement);
          }
          return false;
      }
  }
  MatExpansionPanel.decorators = [
      { type: Component, args: [{styles: [".mat-expansion-panel{box-sizing:content-box;display:block;margin:0;border-radius:4px;overflow:hidden;transition:margin 225ms cubic-bezier(.4,0,.2,1),box-shadow 280ms cubic-bezier(.4,0,.2,1)}.mat-accordion .mat-expansion-panel:not(.mat-expanded),.mat-accordion .mat-expansion-panel:not(.mat-expansion-panel-spacing){border-radius:0}.mat-accordion .mat-expansion-panel:first-of-type{border-top-right-radius:4px;border-top-left-radius:4px}.mat-accordion .mat-expansion-panel:last-of-type{border-bottom-right-radius:4px;border-bottom-left-radius:4px}@media (-ms-high-contrast:active){.mat-expansion-panel{outline:solid 1px}}.mat-expansion-panel._mat-animation-noopable,.mat-expansion-panel.ng-animate-disabled,.ng-animate-disabled .mat-expansion-panel{transition:none}.mat-expansion-panel-content{display:flex;flex-direction:column;overflow:visible}.mat-expansion-panel-body{padding:0 24px 16px}.mat-expansion-panel-spacing{margin:16px 0}.mat-accordion>.mat-expansion-panel-spacing:first-child,.mat-accordion>:first-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-top:0}.mat-accordion>.mat-expansion-panel-spacing:last-child,.mat-accordion>:last-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-bottom:0}.mat-action-row{border-top-style:solid;border-top-width:1px;display:flex;flex-direction:row;justify-content:flex-end;padding:16px 8px 16px 24px}.mat-action-row button.mat-button{margin-left:8px}[dir=rtl] .mat-action-row button.mat-button{margin-left:0;margin-right:8px}"],
                  selector: 'mat-expansion-panel',
                  exportAs: 'matExpansionPanel',
                  template: "<ng-content select=\"mat-expansion-panel-header\"></ng-content><div class=\"mat-expansion-panel-content\" role=\"region\" [@bodyExpansion]=\"_getExpandedState()\" (@bodyExpansion.done)=\"_bodyAnimationDone.next($event)\" [attr.aria-labelledby]=\"_headerId\" [id]=\"id\" #body><div class=\"mat-expansion-panel-body\"><ng-content></ng-content><ng-template [cdkPortalOutlet]=\"_portal\"></ng-template></div><ng-content select=\"mat-action-row\"></ng-content></div>",
                  encapsulation: ViewEncapsulation.None,
                  changeDetection: ChangeDetectionStrategy.OnPush,
                  inputs: ['disabled', 'expanded'],
                  outputs: ['opened', 'closed', 'expandedChange'],
                  animations: [matExpansionAnimations.bodyExpansion],
                  providers: [
                      // Provide MatAccordion as undefined to prevent nested expansion panels from registering
                      // to the same accordion.
                      { provide: MAT_ACCORDION, useValue: ɵ0 },
                  ],
                  host: {
                      'class': 'mat-expansion-panel',
                      '[class.mat-expanded]': 'expanded',
                      '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
                      '[class.mat-expansion-panel-spacing]': '_hasSpacing()',
                  }
              },] },
  ];
  /** @nocollapse */
  MatExpansionPanel.ctorParameters = () => [
      { type: undefined, decorators: [{ type: Optional }, { type: SkipSelf }, { type: Inject, args: [MAT_ACCORDION,] }] },
      { type: ChangeDetectorRef },
      { type: UniqueSelectionDispatcher },
      { type: ViewContainerRef },
      { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
      { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] },
      { type: undefined, decorators: [{ type: Inject, args: [MAT_EXPANSION_PANEL_DEFAULT_OPTIONS,] }, { type: Optional }] }
  ];
  MatExpansionPanel.propDecorators = {
      hideToggle: [{ type: Input }],
      afterExpand: [{ type: Output }],
      afterCollapse: [{ type: Output }],
      _lazyContent: [{ type: ContentChild, args: [MatExpansionPanelContent,] }],
      _body: [{ type: ViewChild, args: ['body',] }]
  };
  if (false) {
      /**
       * @type {?}
       * @private
       */
      MatExpansionPanel.prototype._document;
      /**
       * @type {?}
       * @private
       */
      MatExpansionPanel.prototype._hideToggle;
      /**
       * An event emitted after the body's expansion animation happens.
       * @type {?}
       */
      MatExpansionPanel.prototype.afterExpand;
      /**
       * An event emitted after the body's collapse animation happens.
       * @type {?}
       */
      MatExpansionPanel.prototype.afterCollapse;
      /**
       * Stream that emits for changes in `\@Input` properties.
       * @type {?}
       */
      MatExpansionPanel.prototype._inputChanges;
      /**
       * Optionally defined accordion the expansion panel belongs to.
       * @type {?}
       */
      MatExpansionPanel.prototype.accordion;
      /**
       * Content that will be rendered lazily.
       * @type {?}
       */
      MatExpansionPanel.prototype._lazyContent;
      /**
       * Element containing the panel's user-provided content.
       * @type {?}
       */
      MatExpansionPanel.prototype._body;
      /**
       * Portal holding the user's content.
       * @type {?}
       */
      MatExpansionPanel.prototype._portal;
      /**
       * ID for the associated header element. Used for a11y labelling.
       * @type {?}
       */
      MatExpansionPanel.prototype._headerId;
      /**
       * Stream of body animation done events.
       * @type {?}
       */
      MatExpansionPanel.prototype._bodyAnimationDone;
      /**
       * @type {?}
       * @private
       */
      MatExpansionPanel.prototype._viewContainerRef;
      /** @type {?} */
      MatExpansionPanel.prototype._animationMode;
  }
  export class MatExpansionPanelActionRow {
  }
  MatExpansionPanelActionRow.decorators = [
      { type: Directive, args: [{
                  selector: 'mat-action-row',
                  host: {
                      class: 'mat-action-row'
                  }
              },] },
  ];
  export { ɵ0 };
  //# sourceMappingURL=expansion-panel.js.map