{"version":3,"file":"progress-bar.mjs","sources":["../../../../../../src/material/progress-bar/progress-bar.ts","../../../../../../src/material/progress-bar/progress-bar.html","../../../../../../src/material/progress-bar/module.ts","../../../../../../src/material/progress-bar/progress-bar_public_index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n  ChangeDetectionStrategy,\n  Component,\n  ViewEncapsulation,\n  ElementRef,\n  NgZone,\n  Optional,\n  Inject,\n  Input,\n  Output,\n  EventEmitter,\n  AfterViewInit,\n  OnDestroy,\n  ChangeDetectorRef,\n  InjectionToken,\n  inject,\n} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {CanColor, mixinColor, ThemePalette} from '@angular/material/core';\nimport {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';\nimport {coerceNumberProperty, NumberInput} from '@angular/cdk/coercion';\n\n/** Last animation end data. */\nexport interface ProgressAnimationEnd {\n  value: number;\n}\n\n/** Default `mat-progress-bar` options that can be overridden. */\nexport interface MatProgressBarDefaultOptions {\n  /** Default color of the progress bar. */\n  color?: ThemePalette;\n\n  /** Default mode of the progress bar. */\n  mode?: ProgressBarMode;\n}\n\n/** Injection token to be used to override the default options for `mat-progress-bar`. */\nexport const MAT_PROGRESS_BAR_DEFAULT_OPTIONS = new InjectionToken<MatProgressBarDefaultOptions>(\n  'MAT_PROGRESS_BAR_DEFAULT_OPTIONS',\n);\n\n/**\n * Injection token used to provide the current location to `MatProgressBar`.\n * Used to handle server-side rendering and to stub out during unit tests.\n * @docs-private\n */\nexport const MAT_PROGRESS_BAR_LOCATION = new InjectionToken<MatProgressBarLocation>(\n  'mat-progress-bar-location',\n  {providedIn: 'root', factory: MAT_PROGRESS_BAR_LOCATION_FACTORY},\n);\n\n/**\n * Stubbed out location for `MatProgressBar`.\n * @docs-private\n */\nexport interface MatProgressBarLocation {\n  getPathname: () => string;\n}\n\n/** @docs-private */\nexport function MAT_PROGRESS_BAR_LOCATION_FACTORY(): MatProgressBarLocation {\n  const _document = inject(DOCUMENT);\n  const _location = _document ? _document.location : null;\n\n  return {\n    // Note that this needs to be a function, rather than a property, because Angular\n    // will only resolve it once, but we want the current path on each call.\n    getPathname: () => (_location ? _location.pathname + _location.search : ''),\n  };\n}\n\n// Boilerplate for applying mixins to MatProgressBar.\n/** @docs-private */\nconst _MatProgressBarBase = mixinColor(\n  class {\n    constructor(public _elementRef: ElementRef<HTMLElement>) {}\n  },\n  'primary',\n);\n\nexport type ProgressBarMode = 'determinate' | 'indeterminate' | 'buffer' | 'query';\n\n@Component({\n  selector: 'mat-progress-bar',\n  exportAs: 'matProgressBar',\n  host: {\n    'role': 'progressbar',\n    'aria-valuemin': '0',\n    'aria-valuemax': '100',\n    // set tab index to -1 so screen readers will read the aria-label\n    // Note: there is a known issue with JAWS that does not read progressbar aria labels on FireFox\n    'tabindex': '-1',\n    '[attr.aria-valuenow]': '_isIndeterminate() ? null : value',\n    '[attr.mode]': 'mode',\n    'class': 'mat-mdc-progress-bar mdc-linear-progress',\n    '[class._mat-animation-noopable]': '_isNoopAnimation',\n    '[class.mdc-linear-progress--animation-ready]': '!_isNoopAnimation',\n    '[class.mdc-linear-progress--indeterminate]': '_isIndeterminate()',\n  },\n  inputs: ['color'],\n  templateUrl: 'progress-bar.html',\n  styleUrls: ['progress-bar.css'],\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n})\nexport class MatProgressBar\n  extends _MatProgressBarBase\n  implements AfterViewInit, OnDestroy, CanColor\n{\n  constructor(\n    elementRef: ElementRef<HTMLElement>,\n    private _ngZone: NgZone,\n    private _changeDetectorRef: ChangeDetectorRef,\n    @Optional() @Inject(ANIMATION_MODULE_TYPE) public _animationMode?: string,\n    @Optional()\n    @Inject(MAT_PROGRESS_BAR_DEFAULT_OPTIONS)\n    defaults?: MatProgressBarDefaultOptions,\n  ) {\n    super(elementRef);\n    this._isNoopAnimation = _animationMode === 'NoopAnimations';\n\n    if (defaults) {\n      if (defaults.color) {\n        this.color = this.defaultColor = defaults.color;\n      }\n\n      this.mode = defaults.mode || this.mode;\n    }\n  }\n\n  /** Flag that indicates whether NoopAnimations mode is set to true. */\n  _isNoopAnimation = false;\n\n  /** Value of the progress bar. Defaults to zero. Mirrored to aria-valuenow. */\n  @Input()\n  get value(): number {\n    return this._value;\n  }\n  set value(v: NumberInput) {\n    this._value = clamp(coerceNumberProperty(v));\n    this._changeDetectorRef.markForCheck();\n  }\n  private _value = 0;\n\n  /** Buffer value of the progress bar. Defaults to zero. */\n  @Input()\n  get bufferValue(): number {\n    return this._bufferValue || 0;\n  }\n  set bufferValue(v: NumberInput) {\n    this._bufferValue = clamp(coerceNumberProperty(v));\n    this._changeDetectorRef.markForCheck();\n  }\n  private _bufferValue = 0;\n\n  /**\n   * Event emitted when animation of the primary progress bar completes. This event will not\n   * be emitted when animations are disabled, nor will it be emitted for modes with continuous\n   * animations (indeterminate and query).\n   */\n  @Output() readonly animationEnd = new EventEmitter<ProgressAnimationEnd>();\n\n  /**\n   * Mode of the progress bar.\n   *\n   * Input must be one of these values: determinate, indeterminate, buffer, query, defaults to\n   * 'determinate'.\n   * Mirrored to mode attribute.\n   */\n  @Input()\n  get mode(): ProgressBarMode {\n    return this._mode;\n  }\n  set mode(value: ProgressBarMode) {\n    // Note that we don't technically need a getter and a setter here,\n    // but we use it to match the behavior of the existing mat-progress-bar.\n    this._mode = value;\n    this._changeDetectorRef.markForCheck();\n  }\n  private _mode: ProgressBarMode = 'determinate';\n\n  ngAfterViewInit() {\n    // Run outside angular so change detection didn't get triggered on every transition end\n    // instead only on the animation that we care about (primary value bar's transitionend)\n    this._ngZone.runOutsideAngular(() => {\n      this._elementRef.nativeElement.addEventListener('transitionend', this._transitionendHandler);\n    });\n  }\n\n  ngOnDestroy() {\n    this._elementRef.nativeElement.removeEventListener('transitionend', this._transitionendHandler);\n  }\n\n  /** Gets the transform style that should be applied to the primary bar. */\n  _getPrimaryBarTransform(): string {\n    return `scaleX(${this._isIndeterminate() ? 1 : this.value / 100})`;\n  }\n\n  /** Gets the `flex-basis` value that should be applied to the buffer bar. */\n  _getBufferBarFlexBasis(): string {\n    return `${this.mode === 'buffer' ? this.bufferValue : 100}%`;\n  }\n\n  /** Returns whether the progress bar is indeterminate. */\n  _isIndeterminate(): boolean {\n    return this.mode === 'indeterminate' || this.mode === 'query';\n  }\n\n  /** Event handler for `transitionend` events. */\n  private _transitionendHandler = (event: TransitionEvent) => {\n    if (\n      this.animationEnd.observers.length === 0 ||\n      !event.target ||\n      !(event.target as HTMLElement).classList.contains('mdc-linear-progress__primary-bar')\n    ) {\n      return;\n    }\n\n    if (this.mode === 'determinate' || this.mode === 'buffer') {\n      this._ngZone.run(() => this.animationEnd.next({value: this.value}));\n    }\n  };\n}\n\n/** Clamps a value to be between two numbers, by default 0 and 100. */\nfunction clamp(v: number, min = 0, max = 100) {\n  return Math.max(min, Math.min(max, v));\n}\n","<!--\n  All children need to be hidden for screen readers in order to support ChromeVox.\n  More context in the issue: https://github.com/angular/components/issues/22165.\n-->\n<div class=\"mdc-linear-progress__buffer\" aria-hidden=\"true\">\n  <div\n    class=\"mdc-linear-progress__buffer-bar\"\n    [style.flex-basis]=\"_getBufferBarFlexBasis()\"></div>\n  <div class=\"mdc-linear-progress__buffer-dots\"></div>\n</div>\n<div\n  class=\"mdc-linear-progress__bar mdc-linear-progress__primary-bar\"\n  aria-hidden=\"true\"\n  [style.transform]=\"_getPrimaryBarTransform()\">\n  <span class=\"mdc-linear-progress__bar-inner\"></span>\n</div>\n<div class=\"mdc-linear-progress__bar mdc-linear-progress__secondary-bar\" aria-hidden=\"true\">\n  <span class=\"mdc-linear-progress__bar-inner\"></span>\n</div>\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {MatCommonModule} from '@angular/material/core';\nimport {MatProgressBar} from './progress-bar';\n\n@NgModule({\n  exports: [MatProgressBar, MatCommonModule],\n  declarations: [MatProgressBar],\n})\nexport class MatProgressBarModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA4CA;MACa,gCAAgC,GAAG,IAAI,cAAc,CAChE,kCAAkC,EAClC;AAEF;;;;AAIG;AACU,MAAA,yBAAyB,GAAG,IAAI,cAAc,CACzD,2BAA2B,EAC3B,EAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,iCAAiC,EAAC,EAChE;AAUF;SACgB,iCAAiC,GAAA;AAC/C,IAAA,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AACnC,IAAA,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC;IAExD,OAAO;;;QAGL,WAAW,EAAE,OAAO,SAAS,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,MAAM,GAAG,EAAE,CAAC;KAC5E,CAAC;AACJ,CAAC;AAED;AACA;AACA,MAAM,mBAAmB,GAAG,UAAU,CACpC,MAAA;AACE,IAAA,WAAA,CAAmB,WAAoC,EAAA;QAApC,IAAW,CAAA,WAAA,GAAX,WAAW,CAAyB;KAAI;CAC5D,EACD,SAAS,CACV,CAAC;AA2BI,MAAO,cACX,SAAQ,mBAAmB,CAAA;IAG3B,WACE,CAAA,UAAmC,EAC3B,OAAe,EACf,kBAAqC,EACK,cAAuB,EAGzE,QAAuC,EAAA;QAEvC,KAAK,CAAC,UAAU,CAAC,CAAC;QAPV,IAAO,CAAA,OAAA,GAAP,OAAO,CAAQ;QACf,IAAkB,CAAA,kBAAA,GAAlB,kBAAkB,CAAmB;QACK,IAAc,CAAA,cAAA,GAAd,cAAc,CAAS;;QAkB3E,IAAgB,CAAA,gBAAA,GAAG,KAAK,CAAC;QAWjB,IAAM,CAAA,MAA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