<commit_before>import {
  AfterViewInit,
  ChangeDetectionStrategy,
  ChangeDetectorRef,
  Component,
  ContentChildren,
  Directive,
  ElementRef,
  EventEmitter,
  Input,
  NgZone,
  OnDestroy,
  Output,
  QueryList,
  ViewEncapsulation
} from '@angular/core';
import { Subscription, fromEvent, Subject } from 'rxjs';
import { startWith, takeUntil, filter } from 'rxjs/operators';

import { Platform, toBoolean } from '@angular-mdc/web/common';
import { MdcList, MdcListItem } from '@angular-mdc/web/list';

import createFocusTrap from 'focus-trap';

import { createFocusTrapInstance } from '@material/drawer/util';
import {
  MDCDismissibleDrawerFoundation,
  MDCModalDrawerFoundation
} from '@material/drawer/index';

export type MdcDrawerType = 'permanent' | 'dismissible' | 'modal';

@Component({
  moduleId: module.id,
  selector: 'mdc-drawer-header',
  template: `
  <ng-content></ng-content>
  <h3 class="mdc-drawer__title" *ngIf="title">{{title}}</h3>
  <h6 class="mdc-drawer__subtitle" *ngIf="subtitle">{{subtitle}}</h6>
  `,
  host: {
    'class': 'mdc-drawer__header'
  },
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None
})
export class MdcDrawerHeader {
  @Input() title: string;
  @Input() subtitle: string;

  constructor(public elementRef: ElementRef<HTMLElement>) { }
}

@Directive({
  selector: '[mdcDrawerTitle]',
  host: {
    'class': 'mdc-drawer__title'
  }
})
export class MdcDrawerTitle { }

@Directive({
  selector: '[mdcDrawerSubtitle]',
  host: {
    'class': 'mdc-drawer__subtitle'
  }
})
export class MdcDrawerSubtitle { }

@Directive({
  selector: 'mdc-drawer-content, [mdcDrawerContent]',
  host: {
    'class': 'mdc-drawer__content'
  }
})
export class MdcDrawerContent { }

@Directive({
  selector: 'mdc-drawer-app-content, [mdcDrawerAppContent]',
  host: {
    'class': 'mdc-drawer-app-content'
  }
})
export class MdcDrawerAppContent { }

@Component({
  moduleId: module.id,
  selector: 'mdc-drawer',
  exportAs: 'mdcDrawer',
  host: {
    'role': 'navigation',
    'class': 'mdc-drawer'
  },
  template: '<ng-content></ng-content>',
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None
})
export class MdcDrawer implements AfterViewInit, OnDestroy {
  /** Emits whenever the component is destroyed. */
  private _destroy = new Subject<void>();

  private _initialized: boolean;
  private _previousFocus: Element | null;
  private _scrimElement: Element | null;

  private _focusTrapFactory: any;
  private _focusTrap: any;

  @Input()
  get open(): boolean { return this._open; }
  set open(value: boolean) {
    this._open = toBoolean(value);
    if (this._open) {
      this._foundation.open();
    } else {
      this._foundation.close();
    }
    this._changeDetectorRef.markForCheck();
  }
  private _open: boolean;

  @Input()
  get drawer(): string { return this._drawer; }
  set drawer(drawer: string) {<commit_msg>fix(drawer): Add support for SSR (#1483)<commit_after>import {
  AfterViewInit,
  ChangeDetectionStrategy,
  ChangeDetectorRef,
  Component,
  ContentChildren,
  Directive,
  ElementRef,
  EventEmitter,
  Input,
  NgZone,
  OnDestroy,
  Output,
  QueryList,
  ViewEncapsulation
} from '@angular/core';
import { Subscription, fromEvent, Subject } from 'rxjs';
import { startWith, takeUntil, filter } from 'rxjs/operators';

import { Platform, toBoolean } from '@angular-mdc/web/common';
import { MdcList, MdcListItem } from '@angular-mdc/web/list';

import createFocusTrap from 'focus-trap';

import { createFocusTrapInstance } from '@material/drawer/util';
import {
  MDCDismissibleDrawerFoundation,
  MDCModalDrawerFoundation
} from '@material/drawer/index';

export type MdcDrawerType = 'permanent' | 'dismissible' | 'modal';

@Component({
  moduleId: module.id,
  selector: 'mdc-drawer-header',
  template: `
  <ng-content></ng-content>
  <h3 class="mdc-drawer__title" *ngIf="title">{{title}}</h3>
  <h6 class="mdc-drawer__subtitle" *ngIf="subtitle">{{subtitle}}</h6>
  `,
  host: {
    'class': 'mdc-drawer__header'
  },
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None
})
export class MdcDrawerHeader {
  @Input() title: string;
  @Input() subtitle: string;

  constructor(public elementRef: ElementRef<HTMLElement>) { }
}

@Directive({
  selector: '[mdcDrawerTitle]',
  host: { 'class': 'mdc-drawer__title' }
})
export class MdcDrawerTitle { }

@Directive({
  selector: '[mdcDrawerSubtitle]',
  host: { 'class': 'mdc-drawer__subtitle' }
})
export class MdcDrawerSubtitle { }

@Directive({
  selector: 'mdc-drawer-content, [mdcDrawerContent]',
  host: { 'class': 'mdc-drawer__content' }
})
export class MdcDrawerContent { }

@Directive({
  selector: 'mdc-drawer-app-content, [mdcDrawerAppContent]',
  host: { 'class': 'mdc-drawer-app-content' }
})
export class MdcDrawerAppContent { }

@Component({
  moduleId: module.id,
  selector: 'mdc-drawer',
  exportAs: 'mdcDrawer',
  host: {
    'role': 'navigation',
    'class': 'mdc-drawer'
  },
  template: '<ng-content></ng-content>',
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None
})
export class MdcDrawer implements AfterViewInit, OnDestroy {
  /** Emits whenever the component is destroyed. */
  private _destroy = new Subject<void>();

  private _initialized: boolean;
  private _previousFocus: Element | null;
  private _scrimElement: Element | null;

  private _focusTrapFactory: any;
  private _focusTrap: any;

  @Input()
  get open(): boolean { return this._open; }
  set open(value: boolean) {
    this._open = toBoolean(value);
    if (this._platform.isBrowser) {
      this._open ? this._foundation.open() : this._foundation.close();
    }
    this._changeDetectorRef.markForCheck();
  }
  private _open: boolean;

  @Input()
  get drawer(): string { return this._drawer; }
  set drawer(drawer: string) {
{'fraction_non_alphanumeric': 0.14094301221166894, 'fraction_numerical': 0.0020352781546811396, 'mean_word_length': 4.626908396946565, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '325813', 'n_tokens_mistral': 2052, 'n_tokens_neox': 2038, 'n_words': 421}