var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var IgcCircularProgressComponent_1;
import { html, svg } from 'lit';
import { queryAssignedElements } from 'lit/decorators.js';
import { styleMap } from 'lit/directives/style-map.js';
import { themes } from '../../theming/theming-decorator.js';
import { registerComponent } from '../common/definitions/register.js';
import { createCounter, isEmpty, partNameMap } from '../common/util.js';
import { IgcProgressBaseComponent } from './base.js';
import IgcCircularGradientComponent from './circular-gradient.js';
import { styles } from './themes/circular/circular.progress.base.css.js';
import { styles as shared } from './themes/circular/shared/circular.progress.common.css.js';
import { all } from './themes/circular/themes.js';
let IgcCircularProgressComponent = IgcCircularProgressComponent_1 = class IgcCircularProgressComponent extends IgcProgressBaseComponent {
    constructor() {
        super(...arguments);
        this._gradientId = `circular-progress-${IgcCircularProgressComponent_1.increment()}`;
    }
    static register() {
        registerComponent(IgcCircularProgressComponent_1, IgcCircularGradientComponent);
    }
    renderSvg() {
        const parts = partNameMap({
            indeterminate: this.indeterminate,
            track: true,
        });
        const styles = {
            stroke: `url(#${this._gradientId})`,
        };
        const gradients = !isEmpty(this._assignedGradients)
            ? this._assignedGradients.map(({ offset, color, opacity }) => svg `<stop offset=${offset} stop-color=${color} stop-opacity=${opacity}/>`)
            : svg `
        <stop offset="0%" part="gradient_start" />
        <stop offset="100%" part="gradient_end" />
      `;
        return svg `
      <circle part=${parts}/>
      <circle style=${styleMap(styles)} part="fill"/>

      <defs>
          <linearGradient id=${this._gradientId} gradientTransform="rotate(90)">
          ${gradients}
          </linearGradient>
      </defs>
    `;
    }
    render() {
        const parts = partNameMap({
            svg: true,
            indeterminate: this.indeterminate,
        });
        return html `
      <div part="base" style=${styleMap(this._styleInfo)}>
        <svg part=${parts}>${this.renderSvg()}</svg>
        <slot name="gradient"></slot>
        ${this.renderDefaultSlot()}
      </div>
    `;
    }
};
IgcCircularProgressComponent.tagName = 'igc-circular-progress';
IgcCircularProgressComponent.styles = [styles, shared];
IgcCircularProgressComponent.increment = createCounter();
__decorate([
    queryAssignedElements({ slot: 'gradient' })
], IgcCircularProgressComponent.prototype, "_assignedGradients", void 0);
IgcCircularProgressComponent = IgcCircularProgressComponent_1 = __decorate([
    themes(all)
], IgcCircularProgressComponent);
export default IgcCircularProgressComponent;
//# sourceMappingURL=circular-progress.js.map