import { r as registerInstance, c as createEvent, h, H as Host } from './index-b153bfd0.js';

const ideLoaderCss = "button.button-secondary{border-color:var(--color-border-neutral-default)}.loader__wrapper{position:absolute;border:none;opacity:0;transition:var(--show-transition) opacity;inline-size:100%;block-size:100%;display:flex;background-color:var(--elevation-background-color, var(--color-accent-surface-surface));padding:var(--spacing-padding-xxxl);flex-direction:column;align-items:center;justify-content:center;box-sizing:border-box;color:var(--color-text-neutral-default);z-index:99;animation:fadeIn var(--timing-fast) forwards}.loader__wrapper--visible{opacity:1}.loader__spinner{border:4px solid var(--elevation-border-color, var(--color-border-surface-on-surface));border-block-start:4px solid var(--color-border-primary-default);border-radius:50%;animation:spinner 0.6s infinite linear;inline-size:32px;block-size:32px;flex-shrink:0;opacity:1}.loader__content-wrapper{display:flex;text-align:center;flex-direction:column;margin-block-start:16px;gap:var(--spacing-gap-m);max-block-size:400px;opacity:1}.loader__content-wrapper--hidden{display:none}.loader__cancel-button{margin-block-start:8px}@keyframes spinner{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}@keyframes fadeIn{0%{opacity:0}}";

var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _IdeLoader_timeoutReference, _IdeLoader_cancelProcess, _IdeLoader_renderCancelButton, _IdeLoader_renderDescription, _IdeLoader_renderTitle;
const CSS_BUNDLES = [
    "resets/box-sizing",
    "components/button",
    "utils/typography"
];
const IdeLoader = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.loaderFinished = createEvent(this, "loaderFinished", 7);
        _IdeLoader_timeoutReference.set(this, void 0);
        _IdeLoader_cancelProcess.set(this, () => {
            if (this.cancelCallback) {
                this.cancelCallback();
            }
            clearTimeout(__classPrivateFieldGet(this, _IdeLoader_timeoutReference, "f"));
            this.show = false;
        });
        _IdeLoader_renderCancelButton.set(this, () => this.cancelLabel && (h("div", null, h("button", { class: "button-secondary loader__cancel-button", type: "button", onClick: __classPrivateFieldGet(this, _IdeLoader_cancelProcess, "f") }, this.cancelLabel))));
        _IdeLoader_renderDescription.set(this, () => this.description && h("p", { class: "body-regular-italic-s" }, this.description));
        _IdeLoader_renderTitle.set(this, () => this.loaderTitle && h("p", { class: "body-regular-l" }, this.loaderTitle));
        this.showWrapper = true;
        this.abortTime = 5 * 60 * 1000;
        this.cancelCallback = undefined;
        this.cancelLabel = undefined;
        this.description = undefined;
        this.loaderTitle = undefined;
        this.show = false;
    }
    render() {
        return (h(Host, null, h("ch-theme", { model: CSS_BUNDLES }), this.show && (h("div", { class: {
                [`loader__wrapper`]: true,
                "loader__wrapper--visible": this.showWrapper
            }, part: "loader-wrapper", popover: "" }, h("div", { class: "loader__spinner" }), h("div", { class: {
                "loader__content-wrapper": true,
                "loader__content-wrapper--hidden": !this.description && !this.loaderTitle && !this.cancelLabel
            } }, __classPrivateFieldGet(this, _IdeLoader_renderTitle, "f").call(this), __classPrivateFieldGet(this, _IdeLoader_renderDescription, "f").call(this), __classPrivateFieldGet(this, _IdeLoader_renderCancelButton, "f").call(this))))));
    }
};
_IdeLoader_timeoutReference = new WeakMap(), _IdeLoader_cancelProcess = new WeakMap(), _IdeLoader_renderCancelButton = new WeakMap(), _IdeLoader_renderDescription = new WeakMap(), _IdeLoader_renderTitle = new WeakMap();
IdeLoader.style = ideLoaderCss;

export { IdeLoader as gx_ide_loader };

//# sourceMappingURL=gx-ide-loader.entry.js.map