import { html } from 'lit';
import { property } from 'lit/decorators.js';
import FlowRdfElement from '../../internal/flow-ui-rdf-element.mjs';
import { LocalizeController } from '../../utilities/localize.mjs';
import styles from './progress-ring.styles.mjs';
import { boolean } from '../../internal/boolean.mjs';

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result)
    __defProp(target, key, result);
  return result;
};
class FlowUiProgressRing extends FlowRdfElement {
  constructor() {
    super(...arguments);
    this.localize = new LocalizeController(this);
    this.label = "";
    this.value = 0;
    this.indeterminate = false;
    this.variant = "primary";
    this.size = "medium";
  }
  connectedCallback() {
    super.connectedCallback();
    this.indeterminate = boolean(this.indeterminate, true);
  }
  render() {
    return html`
      <div
        part="base"
        class="progress-ring"
        role="progressbar"
        aria-label=${this.label.length > 0 ? this.label : this.localize.term("progress")}
        aria-describedby="label"
        aria-valuemin="0"
        aria-valuemax="100"
        aria-valuenow="${this.indeterminate ? 0 : this.value}"
        style="--percentage: ${this.value}"
      >
        <svg class="progress-ring__image">
          <circle class="progress-ring__track"></circle>
          <circle class="progress-ring__indicator"></circle>
        </svg>

        <slot id="label" part="label" class="progress-ring__label"></slot>
      </div>
    `;
  }
}
FlowUiProgressRing.styles = styles;
__decorateClass([
  property()
], FlowUiProgressRing.prototype, "label", 2);
__decorateClass([
  property({ type: Number, reflect: true })
], FlowUiProgressRing.prototype, "value", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], FlowUiProgressRing.prototype, "indeterminate", 2);
__decorateClass([
  property({ reflect: true })
], FlowUiProgressRing.prototype, "variant", 2);
__decorateClass([
  property({ reflect: true })
], FlowUiProgressRing.prototype, "size", 2);

export { FlowUiProgressRing as default };
