import { r as h, i as p, x as a, e as f } from "./query-assigned-elements-D930kELM.mjs";
import { n as c } from "./property-DJzm_oB9.mjs";
import { s as u, a as g, T as x } from "./textfield-BEumconw.mjs";
import "./circular-progress.mjs";
import { o as m } from "./class-map-DPUylGZM.mjs";
var $ = Object.defineProperty, v = Object.getOwnPropertyDescriptor, o = (r, e, s, l) => {
  for (var t = l > 1 ? void 0 : l ? v(e, s) : e, n = r.length - 1, d; n >= 0; n--)
    (d = r[n]) && (t = (l ? d(e, s, t) : d(t)) || t);
  return l && t && $(e, s, t), t;
};
let i = class extends x {
  constructor() {
    super(...arguments), this.loading = !1, this.loaderDensity = -6, this.outlined = !0;
  }
  /**
   * This method is identical to the base implementation,
   * with the only difference being the addition of a class to handle the loading state.
   */
  render() {
    const r = this.charCounter && this.maxLength !== -1, e = !!this.helper || !!this.validationMessage || r, s = {
      "mdc-text-field--disabled": this.disabled,
      "mdc-text-field--no-label": !this.label,
      "mdc-text-field--filled": !this.outlined,
      "mdc-text-field--outlined": this.outlined,
      "mdc-text-field--with-leading-icon": this.icon,
      "mdc-text-field--with-trailing-icon": this.iconTrailing,
      "mdc-text-field--end-aligned": this.endAligned,
      "cv-text-field--loading": this.loading
    };
    return a`
      <label class="mdc-text-field ${m(s)}">
        ${this.renderRipple()}
        ${this.outlined ? this.renderOutline() : this.renderLabel()}
        ${this.renderLeadingIcon()} ${this.renderPrefix()}
        ${this.renderInput(e)} ${this.renderSuffix()}
        ${this.renderTrailingIcon()} ${this.renderLineRipple()}
      </label>
      ${this.renderHelperText(e, r)}
    `;
  }
  renderTrailingIcon() {
    return this.loading ? a`<cv-circular-progress
        class="text-field-loading"
        indeterminate
        progress="0"
        density="${this.loaderDensity}"
      >
      </cv-circular-progress>` : this.iconTrailing ? this.renderIcon(this.iconTrailing, !0) : "";
  }
};
i.styles = [
  u,
  p`
      ${h(g)}
    `
];
o([
  c({ type: Boolean, reflect: !0 })
], i.prototype, "loading", 2);
o([
  c({ type: Number })
], i.prototype, "loaderDensity", 2);
i = o([
  f("cv-textfield")
], i);
const D = i;
export {
  i as CovalentTextField,
  D as default
};
