// #region Imports
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 __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Disableable } from '../../../Behaviors/Disableable';
import { Labelable } from '../../../Behaviors/Labelable';
import { Orientable } from '../../../Behaviors/Orientable';
import { Variantable } from '../../../Behaviors/Variantable';
import { TextElement } from '../../../Components/Primitives/Text/TextElement';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { RangeBaseElement } from '../Abstracts/RangeBaseElement';
import { progressBarElementTemplate } from './ProgressBarElementTemplate';
import { progressBarElementJoyStyle } from './Themes/ProgressBarElement.Joy';
import { progressBarElementMemphisStyle } from './Themes/ProgressBarElement.Memphis';
import { progressBarElementCosmopolitanStyle } from './Themes/ProgressBarElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
import { CssLength } from '@breadstone/mosaik-themes';
// #endregion
/**
 * ProgressBar - A horizontal or vertical indicator showing task completion or loading progress.
 *
 * Displays progress as a filled bar with configurable value ranges, orientations, and visual styles.
 * Supports determinate progress tracking and indeterminate loading states. Essential for showing
 * task progress, loading states, and completion percentages in user interfaces.
 *
 * @name ProgressBarElement
 * @element mosaik-progress-bar
 * @category Ranges
 *
 * @fires valueChanged - Fired when the value is changed.
 *
 * @csspart track - The background track container for the progress bar
 * @csspart fill - The filled portion indicating current progress
 * @csspart label - Text label showing progress information
 * @csspart segments - Individual segments for segmented progress display
 *
 * @cssprop --progress-bar-height - Height of horizontal progress bars
 * @cssprop --progress-bar-width - Width of vertical progress bars
 * @cssprop --progress-bar-background-color - Background color of the progress track
 * @cssprop --progress-bar-fill-color - Color of the progress fill
 * @cssprop --progress-bar-border-radius - Border radius for rounded progress bars
 * @cssprop --progress-bar-animation-duration - Duration of progress animations
 * @cssprop --progress-bar-thickness - Thickness/size of the progress bar
 *
 * @dependency TextElement - For rendering progress labels and text
 *
 * @example
 * ```html
 * <!-- Basic progress bar -->
 * <mosaik-progress-bar value="65" max="100"></mosaik-progress-bar>
 *
 * <!-- Progress bar with label -->
 * <mosaik-progress-bar value="45" max="100" label="Loading..."></mosaik-progress-bar>
 *
 * <!-- Indeterminate loading -->
 * <mosaik-progress-bar indeterminate></mosaik-progress-bar>
 *
 * <!-- Vertical progress bar -->
 * <mosaik-progress-bar
 *   value="80"
 *   max="100"
 *   orientation="vertical"
 *   thickness="8px">
 * </mosaik-progress-bar>
 *
 * <!-- Segmented progress -->
 * <mosaik-progress-bar
 *   value="3"
 *   max="5"
 *   segments="5"
 *   label="Step 3 of 5">
 * </mosaik-progress-bar>
 *
 * <!-- File upload progress -->
 * <div class="upload-progress">
 *   <span>Uploading document.pdf</span>
 *   <mosaik-progress-bar
 *     id="uploadProgress"
 *     value="0"
 *     max="100"
 *     thickness="4px">
 *   </mosaik-progress-bar>
 *   <span id="progressText">0%</span>
 * </div>
 * ```
 *
 * @public
 */
let ProgressBarElement = class ProgressBarElement extends Themeable(Variantable(Orientable(Disableable(Labelable(RangeBaseElement))))) {
    // #region Fields
    _isIndeterminate;
    _thickness;
    _segments;
    // #endregion
    // #region Ctor
    /**
     * Constructs a new instance of the `ProgressBarElement` class.
     *
     * @public
     */
    constructor() {
        super();
        this._isIndeterminate = false;
        this._thickness = 4;
        this._segments = 0;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     *
     * @public
     * @static
     * @readonly
    */
    static get is() {
        return 'mosaik-progress-bar';
    }
    /**
     * Determines if `ProgressBar` shows actual values `false` or generic, continuous progress feedback `true`.
     *
     * @public
     * @attr
     */
    get isIndeterminate() {
        return this._isIndeterminate;
    }
    set isIndeterminate(value) {
        if (this._isIndeterminate !== value) {
            this._isIndeterminate = value;
            this.requestUpdate('isIndeterminate');
        }
    }
    /**
     * Gets or sets the thickness property.
     *
     * @public
     * @attr
     */
    get thickness() {
        return this._thickness;
    }
    set thickness(value) {
        if (this._thickness !== value) {
            this._thickness = value;
            this.requestUpdate('thickness');
        }
    }
    /**
     * Gets or sets the `segments` property.
     *
     * @public
     * @attr
     */
    get segments() {
        return this._segments;
    }
    set segments(value) {
        if (this._segments !== value) {
            this._segments = value;
            this.requestUpdate('segments');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     */
    onSegmentsPropertyChanged(_prev, next) {
        if (next) {
            this.setAttribute('has-segments', '');
        }
        else {
            this.removeAttribute('has-segments');
        }
    }
};
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], ProgressBarElement.prototype, "isIndeterminate", null);
__decorate([
    Attribute({
        type: String,
        converter: (value) => CssLength.tryParse(value)
    }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [Object])
], ProgressBarElement.prototype, "thickness", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], ProgressBarElement.prototype, "segments", null);
__decorate([
    Watch('segments'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Number, Number]),
    __metadata("design:returntype", void 0)
], ProgressBarElement.prototype, "onSegmentsPropertyChanged", null);
ProgressBarElement = __decorate([
    Component({
        selector: 'mosaik-progress-bar',
        template: progressBarElementTemplate,
        themes: {
            joy: progressBarElementJoyStyle,
            memphis: progressBarElementMemphisStyle,
            cosmopolitan: progressBarElementCosmopolitanStyle
        },
        imports: [
            TextElement
        ]
    }),
    __metadata("design:paramtypes", [])
], ProgressBarElement);
export { ProgressBarElement };
//# sourceMappingURL=ProgressBarElement.js.map