import { s as y, x as u, i as g, r as b, e as h } from "./query-assigned-elements-D930kELM.mjs";
import { _ as a } from "./tslib.es6-pPsSiLLK.mjs";
import { a as v } from "./aria-property-6O5bK0tV.mjs";
import { n as o } from "./property-DJzm_oB9.mjs";
import { t } from "./state-B_tK3mBm.mjs";
import { i as _ } from "./query-CDOd1Kwm.mjs";
import { o as x } from "./class-map-DPUylGZM.mjs";
import { l as p } from "./if-defined-DGrxuPYz.mjs";
import { o as f } from "./style-map-D2TR7M-D.mjs";
/**
 * @license
 * Copyright 2018 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
class e extends y {
  constructor() {
    super(...arguments), this.indeterminate = !1, this.progress = 0, this.buffer = 1, this.reverse = !1, this.closed = !1, this.stylePrimaryHalf = "", this.stylePrimaryFull = "", this.styleSecondaryQuarter = "", this.styleSecondaryHalf = "", this.styleSecondaryFull = "", this.animationReady = !0, this.closedAnimationOff = !1, this.resizeObserver = null;
  }
  connectedCallback() {
    super.connectedCallback(), this.rootEl && this.attachResizeObserver();
  }
  /**
   * @soyTemplate
   */
  render() {
    const r = {
      "mdc-linear-progress--closed": this.closed,
      "mdc-linear-progress--closed-animation-off": this.closedAnimationOff,
      "mdc-linear-progress--indeterminate": this.indeterminate,
      // needed for controller-less render
      "mdc-linear-progress--animation-ready": this.animationReady
    }, s = {
      "--mdc-linear-progress-primary-half": this.stylePrimaryHalf,
      "--mdc-linear-progress-primary-half-neg": this.stylePrimaryHalf !== "" ? `-${this.stylePrimaryHalf}` : "",
      "--mdc-linear-progress-primary-full": this.stylePrimaryFull,
      "--mdc-linear-progress-primary-full-neg": this.stylePrimaryFull !== "" ? `-${this.stylePrimaryFull}` : "",
      "--mdc-linear-progress-secondary-quarter": this.styleSecondaryQuarter,
      "--mdc-linear-progress-secondary-quarter-neg": this.styleSecondaryQuarter !== "" ? `-${this.styleSecondaryQuarter}` : "",
      "--mdc-linear-progress-secondary-half": this.styleSecondaryHalf,
      "--mdc-linear-progress-secondary-half-neg": this.styleSecondaryHalf !== "" ? `-${this.styleSecondaryHalf}` : "",
      "--mdc-linear-progress-secondary-full": this.styleSecondaryFull,
      "--mdc-linear-progress-secondary-full-neg": this.styleSecondaryFull !== "" ? `-${this.styleSecondaryFull}` : ""
    }, i = {
      "flex-basis": this.indeterminate ? "100%" : `${this.buffer * 100}%`
    }, n = {
      transform: this.indeterminate ? "scaleX(1)" : `scaleX(${this.progress})`
    };
    return u`
      <div
          role="progressbar"
          class="mdc-linear-progress ${x(r)}"
          style="${f(s)}"
          dir="${p(this.reverse ? "rtl" : void 0)}"
          aria-label="${p(this.ariaLabel)}"
          aria-valuemin="0"
          aria-valuemax="1"
          aria-valuenow="${p(this.indeterminate ? void 0 : this.progress)}"
        @transitionend="${this.syncClosedState}">
        <div class="mdc-linear-progress__buffer">
          <div
            class="mdc-linear-progress__buffer-bar"
            style=${f(i)}>
          </div>
          <div class="mdc-linear-progress__buffer-dots"></div>
        </div>
        <div
            class="mdc-linear-progress__bar mdc-linear-progress__primary-bar"
            style=${f(n)}>
          <span class="mdc-linear-progress__bar-inner"></span>
        </div>
        <div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar">
          <span class="mdc-linear-progress__bar-inner"></span>
        </div>
      </div>`;
  }
  update(r) {
    r.has("closed") && (!this.closed || r.get("closed") === void 0) && this.syncClosedState(), super.update(r);
  }
  async firstUpdated(r) {
    super.firstUpdated(r), this.attachResizeObserver();
  }
  syncClosedState() {
    this.closedAnimationOff = this.closed;
  }
  updated(r) {
    !r.has("indeterminate") && r.has("reverse") && this.indeterminate && this.restartAnimation(), r.has("indeterminate") && r.get("indeterminate") !== void 0 && this.indeterminate && window.ResizeObserver && this.calculateAndSetAnimationDimensions(this.rootEl.offsetWidth), super.updated(r);
  }
  disconnectedCallback() {
    this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), super.disconnectedCallback();
  }
  attachResizeObserver() {
    if (window.ResizeObserver) {
      this.resizeObserver = new window.ResizeObserver((r) => {
        if (this.indeterminate) {
          for (const s of r)
            if (s.contentRect) {
              const i = s.contentRect.width;
              this.calculateAndSetAnimationDimensions(i);
            }
        }
      }), this.resizeObserver.observe(this.rootEl);
      return;
    }
    this.resizeObserver = null;
  }
  calculateAndSetAnimationDimensions(r) {
    const s = r * 0.8367142, i = r * 2.00611057, n = r * 0.37651913, l = r * 0.84386165, m = r * 1.60277782;
    this.stylePrimaryHalf = `${s}px`, this.stylePrimaryFull = `${i}px`, this.styleSecondaryQuarter = `${n}px`, this.styleSecondaryHalf = `${l}px`, this.styleSecondaryFull = `${m}px`, this.restartAnimation();
  }
  async restartAnimation() {
    this.animationReady = !1, await this.updateComplete, await new Promise(requestAnimationFrame), this.animationReady = !0, await this.updateComplete;
  }
  open() {
    this.closed = !1;
  }
  close() {
    this.closed = !0;
  }
}
a([
  _(".mdc-linear-progress")
], e.prototype, "rootEl", void 0);
a([
  o({ type: Boolean, reflect: !0 })
], e.prototype, "indeterminate", void 0);
a([
  o({ type: Number })
], e.prototype, "progress", void 0);
a([
  o({ type: Number })
], e.prototype, "buffer", void 0);
a([
  o({ type: Boolean, reflect: !0 })
], e.prototype, "reverse", void 0);
a([
  o({ type: Boolean, reflect: !0 })
], e.prototype, "closed", void 0);
a([
  v,
  o({ attribute: "aria-label" })
], e.prototype, "ariaLabel", void 0);
a([
  t()
], e.prototype, "stylePrimaryHalf", void 0);
a([
  t()
], e.prototype, "stylePrimaryFull", void 0);
a([
  t()
], e.prototype, "styleSecondaryQuarter", void 0);
a([
  t()
], e.prototype, "styleSecondaryHalf", void 0);
a([
  t()
], e.prototype, "styleSecondaryFull", void 0);
a([
  t()
], e.prototype, "animationReady", void 0);
a([
  t()
], e.prototype, "closedAnimationOff", void 0);
/**
 * @license
 * Copyright 2021 Google LLC
 * SPDX-LIcense-Identifier: Apache-2.0
 */
const w = g`@keyframes mdc-linear-progress-primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%);transform:translateX(var(--mdc-linear-progress-primary-half, 83.67142%))}100%{transform:translateX(200.611057%);transform:translateX(var(--mdc-linear-progress-primary-full, 200.611057%))}}@keyframes mdc-linear-progress-primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes mdc-linear-progress-secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%);transform:translateX(var(--mdc-linear-progress-secondary-quarter, 37.651913%))}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%);transform:translateX(var(--mdc-linear-progress-secondary-half, 84.386165%))}100%{transform:translateX(160.277782%);transform:translateX(var(--mdc-linear-progress-secondary-full, 160.277782%))}}@keyframes mdc-linear-progress-secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes mdc-linear-progress-buffering{from{transform:rotate(180deg) translateX(-10px)}}@keyframes mdc-linear-progress-primary-indeterminate-translate-reverse{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(-83.67142%);transform:translateX(var(--mdc-linear-progress-primary-half-neg, -83.67142%))}100%{transform:translateX(-200.611057%);transform:translateX(var(--mdc-linear-progress-primary-full-neg, -200.611057%))}}@keyframes mdc-linear-progress-secondary-indeterminate-translate-reverse{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(-37.651913%);transform:translateX(var(--mdc-linear-progress-secondary-quarter-neg, -37.651913%))}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(-84.386165%);transform:translateX(var(--mdc-linear-progress-secondary-half-neg, -84.386165%))}100%{transform:translateX(-160.277782%);transform:translateX(var(--mdc-linear-progress-secondary-full-neg, -160.277782%))}}@keyframes mdc-linear-progress-buffering-reverse{from{transform:translateX(-10px)}}.mdc-linear-progress{position:relative;width:100%;transform:translateZ(0);outline:1px solid transparent;overflow:hidden;transition:opacity 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1)}@media screen and (forced-colors: active){.mdc-linear-progress{outline-color:CanvasText}}.mdc-linear-progress__bar{position:absolute;width:100%;height:100%;animation:none;transform-origin:top left;transition:transform 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1)}.mdc-linear-progress__bar-inner{display:inline-block;position:absolute;width:100%;animation:none;border-top-style:solid}.mdc-linear-progress__buffer{display:flex;position:absolute;width:100%;height:100%}.mdc-linear-progress__buffer-dots{background-repeat:repeat-x;flex:auto;transform:rotate(180deg);animation:mdc-linear-progress-buffering 250ms infinite linear}.mdc-linear-progress__buffer-bar{flex:0 1 100%;transition:flex-basis 250ms 0ms cubic-bezier(0.4, 0, 0.6, 1)}.mdc-linear-progress__primary-bar{transform:scaleX(0)}.mdc-linear-progress__secondary-bar{display:none}.mdc-linear-progress--indeterminate .mdc-linear-progress__bar{transition:none}.mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar{left:-145.166611%}.mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar{left:-54.888891%;display:block}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar{animation:mdc-linear-progress-primary-indeterminate-translate 2s infinite linear}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar>.mdc-linear-progress__bar-inner{animation:mdc-linear-progress-primary-indeterminate-scale 2s infinite linear}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar{animation:mdc-linear-progress-secondary-indeterminate-translate 2s infinite linear}.mdc-linear-progress--indeterminate.mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar>.mdc-linear-progress__bar-inner{animation:mdc-linear-progress-secondary-indeterminate-scale 2s infinite linear}[dir=rtl] .mdc-linear-progress:not([dir=ltr]) .mdc-linear-progress__bar,.mdc-linear-progress[dir=rtl]:not([dir=ltr]) .mdc-linear-progress__bar{right:0;-webkit-transform-origin:center right;transform-origin:center right}[dir=rtl] .mdc-linear-progress:not([dir=ltr]).mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar,.mdc-linear-progress[dir=rtl]:not([dir=ltr]).mdc-linear-progress--animation-ready .mdc-linear-progress__primary-bar{animation-name:mdc-linear-progress-primary-indeterminate-translate-reverse}[dir=rtl] .mdc-linear-progress:not([dir=ltr]).mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar,.mdc-linear-progress[dir=rtl]:not([dir=ltr]).mdc-linear-progress--animation-ready .mdc-linear-progress__secondary-bar{animation-name:mdc-linear-progress-secondary-indeterminate-translate-reverse}[dir=rtl] .mdc-linear-progress:not([dir=ltr]) .mdc-linear-progress__buffer-dots,.mdc-linear-progress[dir=rtl]:not([dir=ltr]) .mdc-linear-progress__buffer-dots{animation:mdc-linear-progress-buffering-reverse 250ms infinite linear;transform:rotate(0)}[dir=rtl] .mdc-linear-progress:not([dir=ltr]).mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar,.mdc-linear-progress[dir=rtl]:not([dir=ltr]).mdc-linear-progress--indeterminate .mdc-linear-progress__primary-bar{right:-145.166611%;left:auto}[dir=rtl] .mdc-linear-progress:not([dir=ltr]).mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar,.mdc-linear-progress[dir=rtl]:not([dir=ltr]).mdc-linear-progress--indeterminate .mdc-linear-progress__secondary-bar{right:-54.888891%;left:auto}.mdc-linear-progress--closed{opacity:0}.mdc-linear-progress--closed-animation-off .mdc-linear-progress__buffer-dots{animation:none}.mdc-linear-progress--closed-animation-off.mdc-linear-progress--indeterminate .mdc-linear-progress__bar,.mdc-linear-progress--closed-animation-off.mdc-linear-progress--indeterminate .mdc-linear-progress__bar .mdc-linear-progress__bar-inner{animation:none}.mdc-linear-progress__bar-inner{border-color:#6200ee;border-color:var(--mdc-theme-primary, #6200ee)}.mdc-linear-progress__buffer-dots{background-image:url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='none slice'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23e6e6e6'/%3E%3C/svg%3E")}.mdc-linear-progress__buffer-bar{background-color:#e6e6e6}.mdc-linear-progress{height:4px}.mdc-linear-progress__bar-inner{border-top-width:4px}.mdc-linear-progress__buffer-dots{background-size:10px 4px}:host{display:block}.mdc-linear-progress__buffer-bar{background-color:#e6e6e6;background-color:var(--mdc-linear-progress-buffer-color, #e6e6e6)}.mdc-linear-progress__buffer-dots{background-image:url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='none slice'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23e6e6e6'/%3E%3C/svg%3E");background-image:var(--mdc-linear-progress-buffering-dots-image, url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='none slice'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23e6e6e6'/%3E%3C/svg%3E"))}`, X = ":host{--mdc-linear-progress-buffer-color: var(--mdc-theme-border)}";
var k = Object.getOwnPropertyDescriptor, z = (c, r, s, i) => {
  for (var n = i > 1 ? void 0 : i ? k(r, s) : r, l = c.length - 1, m; l >= 0; l--)
    (m = c[l]) && (n = m(n) || n);
  return n;
};
let d = class extends e {
};
d.styles = [w, g`${b(X)}`];
d = z([
  h("cv-linear-progress")
], d);
const E = d;
export {
  d as CovalentLinearProgress,
  E as default
};
