import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { c as config } from './config.js';
import { L as Locale } from './locale.js';
import { d as defineCustomElement$2 } from './container.js';

const bpmTimerDurationCss = ":host{display:grid;block-size:100%}.opacity-0{opacity:0}.gxi-hidden{display:none !important}.align-center{display:flex;align-items:center}.align-end{display:flex;align-items:end}.overflow-auto{overflow:auto}:host(.gx-ide-component){height:100% !important;display:flex !important;flex-direction:column !important}.gx-ide-main-wrapper{color:var(--gx-ide-component-text-color);font-weight:var(--font-style-regular);font-size:var(--font-size-body-m);font-family:var(--font-family-body);height:100%;display:flex;flex-direction:column;flex-grow:1;box-sizing:border-box}.buttons-container{display:flex;gap:var(--spacing-gap-m)}.giu-static-pill-icon-and-text,.giu-static-pill{background-color:var(--elevation-background-color, var(--color-accent-surface-elevation-1));padding-inline:var(--spacing-padding-m);color:var(--color-text-neutral-default);font-size:var(--font-size-body-s);line-height:var(--line-height-relaxed);font-weight:var(--font-style-regular);border-radius:4px;min-block-size:25px;display:inline-grid;align-items:center;pointer-events:none;inline-size:max-content}.giu-static-pill-icon-and-text{display:inline-grid;grid-auto-flow:column;grid-auto-columns:max-content;gap:var(--spacing-gap-m)}.tab-full-width-buttons::part(tab-list block-start),.tab-full-width-buttons::part(tab-list block-end){grid-auto-columns:1fr}.tab-full-width-buttons::part(tab block-start){justify-content:center}.tree-view::part(item__header){--icon__system_warning_warning--disabled:var(\n    --icon__system_warning_warning--enabled\n  )}.tabular-grid{--focus-outline-width:1px}.control-wrapper{display:flex;gap:var(--spacing-gap-m);align-items:center}.control-wrapper--vertical{flex-direction:column;align-items:start}.controls-wrapper{display:flex;gap:var(--spacing-gap-m)}.controls-wrapper--vertical{flex-direction:column;align-items:start}.input-text{box-sizing:border-box;background-color:transparent;border:1px solid var(--color-border-neutral-default);border-radius:4px;height:26px;color:var(--color-text-neutral-default);font-size:var(--font-size-body-xs)}.input-text--full-width{align-self:stretch}:host{display:block}";

const GxIdeBpmTimerDuration$1 = /*@__PURE__*/ proxyCustomElement(class GxIdeBpmTimerDuration extends HTMLElement {
    constructor() {
        super();
        this.__registerHost();
        this.__attachShadow();
        this.componentDidRenderFirstTime = createEvent(this, "componentDidRenderFirstTime", 7);
        this.renderedFirstTime = false;
        // 7.LISTENERS //
        // 8.PUBLIC METHODS API //
        // 9.LOCAL METHODS //
        this.confirmCallbackHandler = async () => {
            if (this.confirmCallback) {
                const data = {
                    years: parseInt(this.yearsEl.value),
                    months: parseInt(this.monthsEl.value),
                    days: parseInt(this.daysEl.value),
                    hours: parseInt(this.hoursEl.value),
                    minutes: parseInt(this.minutesEl.value),
                    seconds: parseInt(this.secondsEl.value)
                };
                await this.confirmCallback(data);
            }
        };
        this.displayTitle = false;
        this.duration = undefined;
        this.confirmCallback = undefined;
        this.cancelCallback = undefined;
    }
    // 6.COMPONENT LIFECYCLE METHODS //
    async componentWillLoad() {
        this._componentLocale = await Locale.getComponentStrings(this.el);
    }
    componentDidRender() {
        if (!this.renderedFirstTime) {
            this.componentDidRenderFirstTime.emit(this._componentLocale.componentName);
            this.renderedFirstTime = true;
        }
    }
    // 10.RENDER() FUNCTION //
    render() {
        var _a, _b, _c, _d, _e, _f;
        return (h(Host, { class: "gx-ide-component" }, h("div", { class: "gx-ide-main-wrapper" }, h("gx-ide-container", { slimmerFooter: config.gxIdeContainer.slimmerFooter }, h("div", { class: "control-wrapper control-wrapper--vertical" }, h("label", { htmlFor: "years" }, this._componentLocale.controls.years), h("input", { type: "number", id: "years", class: "input-text input-text--full-width", value: (_a = this.duration) === null || _a === void 0 ? void 0 : _a.years.toString(), ref: el => (this.yearsEl = el) })), h("div", { class: "control-wrapper control-wrapper--vertical" }, h("label", { htmlFor: "months" }, this._componentLocale.controls.months), h("input", { type: "number", id: "months", class: "input-text input-text--full-width", value: (_b = this.duration) === null || _b === void 0 ? void 0 : _b.months.toString(), ref: el => (this.monthsEl = el) })), h("div", { class: "control-wrapper control-wrapper--vertical" }, h("label", { htmlFor: "days" }, this._componentLocale.controls.days), h("input", { type: "number", id: "days", class: "input-text input-text--full-width", value: (_c = this.duration) === null || _c === void 0 ? void 0 : _c.days.toString(), ref: el => (this.daysEl = el) })), h("div", { class: "control-wrapper control-wrapper--vertical" }, h("label", { htmlFor: "hours" }, this._componentLocale.controls.hours), h("input", { type: "number", id: "hours", class: "input-text input-text--full-width", value: (_d = this.duration) === null || _d === void 0 ? void 0 : _d.hours.toString(), ref: el => (this.hoursEl = el) })), h("div", { class: "control-wrapper control-wrapper--vertical" }, h("label", { htmlFor: "minutes" }, this._componentLocale.controls.minutes), h("input", { type: "number", id: "minutes", class: "input-text input-text--full-width", value: (_e = this.duration) === null || _e === void 0 ? void 0 : _e.minutes.toString(), ref: el => (this.minutesEl = el) })), h("div", { class: "control-wrapper control-wrapper--vertical" }, h("label", { htmlFor: "seconds" }, this._componentLocale.controls.seconds), h("input", { type: "number", id: "seconds", class: "input-text input-text--full-width", value: (_f = this.duration) === null || _f === void 0 ? void 0 : _f.seconds.toString(), ref: el => (this.secondsEl = el) })), h("div", { class: "controls-wrapper" }, h("button", { onClick: this.confirmCallbackHandler }, this._componentLocale.controls.ok), h("button", { onClick: this.cancelCallback }, this._componentLocale.controls.cancel))))));
    }
    static get assetsDirs() { return ["gx-ide-assets/bpm-timer-duration"]; }
    get el() { return this; }
    static get style() { return bpmTimerDurationCss; }
}, [1, "gx-ide-bpm-timer-duration", {
        "displayTitle": [4, "display-title"],
        "duration": [16],
        "confirmCallback": [16],
        "cancelCallback": [16]
    }]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["gx-ide-bpm-timer-duration", "gx-ide-container"];
    components.forEach(tagName => { switch (tagName) {
        case "gx-ide-bpm-timer-duration":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, GxIdeBpmTimerDuration$1);
            }
            break;
        case "gx-ide-container":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}

const GxIdeBpmTimerDuration = GxIdeBpmTimerDuration$1;
const defineCustomElement = defineCustomElement$1;

export { GxIdeBpmTimerDuration, defineCustomElement };

//# sourceMappingURL=gx-ide-bpm-timer-duration.js.map