import { ChangeDetectionStrategy, Component, Directive, Input, ViewEncapsulation } from '@angular/core';
import { KbqColorDirective, KbqComponentColors } from '@koobiq/components/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
let id = 0;
const MIN_PERCENT = 0;
const MAX_PERCENT = 100;
export class KbqProgressSpinnerText {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqProgressSpinnerText, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: KbqProgressSpinnerText, selector: "[kbq-progress-spinner-text]", host: { classAttribute: "kbq-progress-spinner-text" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqProgressSpinnerText, decorators: [{
            type: Directive,
            args: [{
                    selector: '[kbq-progress-spinner-text]',
                    host: {
                        class: 'kbq-progress-spinner-text'
                    }
                }]
        }] });
export class KbqProgressSpinnerCaption {
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqProgressSpinnerCaption, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: KbqProgressSpinnerCaption, selector: "[kbq-progress-spinner-caption]", host: { classAttribute: "kbq-progress-spinner-caption" }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqProgressSpinnerCaption, decorators: [{
            type: Directive,
            args: [{
                    selector: '[kbq-progress-spinner-caption]',
                    host: {
                        class: 'kbq-progress-spinner-caption'
                    }
                }]
        }] });
const MAX_DASH_ARRAY = 295;
export class KbqProgressSpinner extends KbqColorDirective {
    get size() {
        return this._size;
    }
    set size(value) {
        this._size = value;
        this.svgCircleRadius = value === 'big' ? '47%' : '42.5%';
    }
    get percentage() {
        return Math.max(MIN_PERCENT, Math.min(MAX_PERCENT, this.value)) / MAX_PERCENT;
    }
    get dashOffsetPercent() {
        return `${MAX_DASH_ARRAY - this.percentage * MAX_DASH_ARRAY}%`;
    }
    constructor() {
        super();
        this.id = `kbq-progress-spinner-${id++}`;
        this.value = 0;
        this.mode = 'determinate';
        this._size = 'compact';
        this.svgCircleRadius = '42.5%';
        this.color = KbqComponentColors.Theme;
    }
    /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqProgressSpinner, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: KbqProgressSpinner, selector: "kbq-progress-spinner", inputs: { id: "id", value: "value", mode: "mode", size: "size" }, host: { properties: { "class.kbq-progress-spinner_big": "size === 'big'", "class.kbq-progress-spinner_indeterminate": "mode === 'indeterminate'", "attr.id": "id" }, classAttribute: "kbq-progress-spinner" }, usesInheritance: true, ngImport: i0, template: "<div class=\"kbq-progress-spinner__inner\">\n    <svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" viewBox=\"0 0 100 100\">\n        <circle\n            cx=\"50%\"\n            cy=\"50%\"\n            stroke-linecap=\"round\"\n            class=\"kbq-progress-spinner__circle\"\n            [attr.r]=\"svgCircleRadius\"\n            [ngStyle]=\"{ 'stroke-dashoffset': mode === 'determinate' ? dashOffsetPercent : null }\"\n        />\n    </svg>\n</div>\n\n<div class=\"kbq-progress-spinner__content\">\n    <ng-content select=\"[kbq-progress-spinner-text]\" />\n    <ng-content select=\"[kbq-progress-spinner-caption]\" />\n</div>\n", styles: ["@keyframes kbq-progress-spinner-indeterminate{to{transform:rotate(270deg)}}.kbq-progress-spinner{display:flex;flex-direction:row}.kbq-progress-spinner__circle{fill:none;stroke:#000;stroke-dasharray:295%;stroke-width:13%;transition:stroke-dashoffset .3s;transform-origin:center center}.kbq-progress-spinner__inner{width:var(--kbq-progress-spinner-size-compact-size);height:var(--kbq-progress-spinner-size-compact-size);transform:rotate(-90deg);font-size:0}.kbq-progress-spinner__content .kbq-progress-spinner-text{margin-bottom:var(--kbq-progress-spinner-size-compact-content-gap-vertical)}.kbq-progress-spinner__content:not(:empty){margin-inline-start:var(--kbq-progress-spinner-size-compact-content-gap-horizontal)}.kbq-progress-spinner_big .kbq-progress-spinner__inner{width:var(--kbq-progress-spinner-size-big-size);height:var(--kbq-progress-spinner-size-big-size)}.kbq-progress-spinner_big .kbq-progress-spinner__circle{stroke-width:6%}.kbq-progress-spinner_big .kbq-progress-spinner__content:not(:empty){margin-inline-start:var(--kbq-progress-spinner-size-big-content-gap-horizontal)}.kbq-progress-spinner_indeterminate .kbq-progress-spinner__inner{animation:kbq-progress-spinner-indeterminate 1.5s cubic-bezier(.455,.03,.515,.955) infinite}.kbq-progress-spinner_indeterminate .kbq-progress-spinner__inner .kbq-progress-spinner__circle{stroke-dashoffset:80%}.kbq-progress-spinner .kbq-progress-spinner__circle{stroke:var(--kbq-progress-spinner-circle-background)}.kbq-progress-spinner-text{color:var(--kbq-progress-spinner-text-color)}.kbq-progress-spinner-caption{color:var(--kbq-progress-spinner-caption-color)}.kbq-progress-spinner-text{font-size:var(--kbq-typography-text-normal-font-size);font-style:var(--kbq-typography-text-normal-font-style);font-weight:var(--kbq-typography-text-normal-font-weight);line-height:var(--kbq-typography-text-normal-line-height);font-family:var(--kbq-typography-text-normal-font-family);text-transform:var(--kbq-typography-text-normal-text-transform);font-feature-settings:var(--kbq-typography-text-normal-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-letter-spacing)}.kbq-progress-spinner-caption{font-size:var(--kbq-typography-text-compact-font-size);font-style:var(--kbq-typography-text-compact-font-style);font-weight:var(--kbq-typography-text-compact-font-weight);line-height:var(--kbq-typography-text-compact-line-height);font-family:var(--kbq-typography-text-compact-font-family);text-transform:var(--kbq-typography-text-compact-text-transform);font-feature-settings:var(--kbq-typography-text-compact-font-feature-settings);letter-spacing:var(--kbq-typography-text-compact-letter-spacing)}\n", ".kbq-progress-spinner{--kbq-progress-spinner-size-compact-size: var(--kbq-size-l);--kbq-progress-spinner-size-compact-stroke-width: 2px;--kbq-progress-spinner-size-compact-content-gap-vertical: var(--kbq-size-3xs);--kbq-progress-spinner-size-compact-content-gap-horizontal: var(--kbq-size-s);--kbq-progress-spinner-size-big-size: var(--kbq-size-5xl);--kbq-progress-spinner-size-big-stroke-width: 3px;--kbq-progress-spinner-size-big-content-gap-vertical: var(--kbq-size-3xs);--kbq-progress-spinner-size-big-content-gap-horizontal: var(--kbq-size-s);--kbq-progress-spinner-circle-background: var(--kbq-icon-theme);--kbq-progress-spinner-text-color: var(--kbq-foreground-contrast);--kbq-progress-spinner-caption-color: var(--kbq-foreground-contrast-secondary)}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: KbqProgressSpinner, decorators: [{
            type: Component,
            args: [{ selector: 'kbq-progress-spinner', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'kbq-progress-spinner',
                        '[class.kbq-progress-spinner_big]': `size === 'big'`,
                        '[class.kbq-progress-spinner_indeterminate]': `mode === 'indeterminate'`,
                        '[attr.id]': 'id'
                    }, template: "<div class=\"kbq-progress-spinner__inner\">\n    <svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" viewBox=\"0 0 100 100\">\n        <circle\n            cx=\"50%\"\n            cy=\"50%\"\n            stroke-linecap=\"round\"\n            class=\"kbq-progress-spinner__circle\"\n            [attr.r]=\"svgCircleRadius\"\n            [ngStyle]=\"{ 'stroke-dashoffset': mode === 'determinate' ? dashOffsetPercent : null }\"\n        />\n    </svg>\n</div>\n\n<div class=\"kbq-progress-spinner__content\">\n    <ng-content select=\"[kbq-progress-spinner-text]\" />\n    <ng-content select=\"[kbq-progress-spinner-caption]\" />\n</div>\n", styles: ["@keyframes kbq-progress-spinner-indeterminate{to{transform:rotate(270deg)}}.kbq-progress-spinner{display:flex;flex-direction:row}.kbq-progress-spinner__circle{fill:none;stroke:#000;stroke-dasharray:295%;stroke-width:13%;transition:stroke-dashoffset .3s;transform-origin:center center}.kbq-progress-spinner__inner{width:var(--kbq-progress-spinner-size-compact-size);height:var(--kbq-progress-spinner-size-compact-size);transform:rotate(-90deg);font-size:0}.kbq-progress-spinner__content .kbq-progress-spinner-text{margin-bottom:var(--kbq-progress-spinner-size-compact-content-gap-vertical)}.kbq-progress-spinner__content:not(:empty){margin-inline-start:var(--kbq-progress-spinner-size-compact-content-gap-horizontal)}.kbq-progress-spinner_big .kbq-progress-spinner__inner{width:var(--kbq-progress-spinner-size-big-size);height:var(--kbq-progress-spinner-size-big-size)}.kbq-progress-spinner_big .kbq-progress-spinner__circle{stroke-width:6%}.kbq-progress-spinner_big .kbq-progress-spinner__content:not(:empty){margin-inline-start:var(--kbq-progress-spinner-size-big-content-gap-horizontal)}.kbq-progress-spinner_indeterminate .kbq-progress-spinner__inner{animation:kbq-progress-spinner-indeterminate 1.5s cubic-bezier(.455,.03,.515,.955) infinite}.kbq-progress-spinner_indeterminate .kbq-progress-spinner__inner .kbq-progress-spinner__circle{stroke-dashoffset:80%}.kbq-progress-spinner .kbq-progress-spinner__circle{stroke:var(--kbq-progress-spinner-circle-background)}.kbq-progress-spinner-text{color:var(--kbq-progress-spinner-text-color)}.kbq-progress-spinner-caption{color:var(--kbq-progress-spinner-caption-color)}.kbq-progress-spinner-text{font-size:var(--kbq-typography-text-normal-font-size);font-style:var(--kbq-typography-text-normal-font-style);font-weight:var(--kbq-typography-text-normal-font-weight);line-height:var(--kbq-typography-text-normal-line-height);font-family:var(--kbq-typography-text-normal-font-family);text-transform:var(--kbq-typography-text-normal-text-transform);font-feature-settings:var(--kbq-typography-text-normal-font-feature-settings);letter-spacing:var(--kbq-typography-text-normal-letter-spacing)}.kbq-progress-spinner-caption{font-size:var(--kbq-typography-text-compact-font-size);font-style:var(--kbq-typography-text-compact-font-style);font-weight:var(--kbq-typography-text-compact-font-weight);line-height:var(--kbq-typography-text-compact-line-height);font-family:var(--kbq-typography-text-compact-font-family);text-transform:var(--kbq-typography-text-compact-text-transform);font-feature-settings:var(--kbq-typography-text-compact-font-feature-settings);letter-spacing:var(--kbq-typography-text-compact-letter-spacing)}\n", ".kbq-progress-spinner{--kbq-progress-spinner-size-compact-size: var(--kbq-size-l);--kbq-progress-spinner-size-compact-stroke-width: 2px;--kbq-progress-spinner-size-compact-content-gap-vertical: var(--kbq-size-3xs);--kbq-progress-spinner-size-compact-content-gap-horizontal: var(--kbq-size-s);--kbq-progress-spinner-size-big-size: var(--kbq-size-5xl);--kbq-progress-spinner-size-big-stroke-width: 3px;--kbq-progress-spinner-size-big-content-gap-vertical: var(--kbq-size-3xs);--kbq-progress-spinner-size-big-content-gap-horizontal: var(--kbq-size-s);--kbq-progress-spinner-circle-background: var(--kbq-icon-theme);--kbq-progress-spinner-text-color: var(--kbq-foreground-contrast);--kbq-progress-spinner-caption-color: var(--kbq-foreground-contrast-secondary)}\n"] }]
        }], ctorParameters: () => [], propDecorators: { id: [{
                type: Input
            }], value: [{
                type: Input
            }], mode: [{
                type: Input
            }], size: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 