'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-75aef097.js');
const locale = require('./locale-ff30a5f3.js');
const assetsManager = require('./assets-manager-089e91b1.js');
require('./mer-animated-dots-78490ca4.js');
require('lit');
require('lit/directives/when.js');
require('lit/directives/if-defined.js');

const launchpadApisCss = ":host{display:block;block-size:100%;overflow:auto;background-color:var(--ch-color-surface-primary);color:var(--ch-color-text-primary)}.main{overflow:auto;display:block}.apis-container{padding:24px;display:flex;flex-direction:column;gap:var(--spacing-gap-xl);max-width:100%}.api-item{background:var(--ch-color-surface-secondary);border:1px solid var(--color-border-neutral-default);border-radius:0;overflow:hidden;transition:all var(--timing-fast) ease;width:100%;max-width:100%;display:flex;flex-direction:column;min-height:64px}.api-item:hover{box-shadow:var(--color-accent-surface-elevation-2);transform:translateY(-2px);border-color:var(--color-border-primary-hover)}.api-header{padding:16px;background:transparent;border-bottom:1px solid var(--color-border-neutral-default);flex-shrink:0}.api-header .api-name{margin:0;color:var(--color-text-neutral-default);word-break:break-all;overflow-wrap:break-word}.api-content{overflow:hidden}.no-apis,.no-data{color:var(--color-text-neutral-disabled);font-style:italic;text-align:center;padding:16px}.no-apis p,.no-data p{font-size:var(--font-size-body-m);font-weight:var(--font-style-semi-bold);line-height:var(--line-height-spacious)}";

var __classPrivateFieldSet$2 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
    if (kind === "m")
        throw new TypeError("Private method is not writable");
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a setter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot write private member to an object whose class did not declare it");
    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet$2 = (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 _GxIdeLaunchpadApis_componentLocale, _GxIdeLaunchpadApis_ACCORDION_MODEL;
const CSS_BUNDLES$2 = [
    "resets/box-sizing",
    "components/accordion",
    "utils/elevation",
    "utils/layout",
    "utils/typography",
    "utils/spacing"
];
const GxIdeLaunchpadApis = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.copyToClipboard = index.createEvent(this, "copyToClipboard", 7);
        _GxIdeLaunchpadApis_componentLocale.set(this, void 0);
        _GxIdeLaunchpadApis_ACCORDION_MODEL.set(this, []);
        this.apis = undefined;
        this.onObjectSelected = undefined;
    }
    async componentWillLoad() {
        try {
            __classPrivateFieldSet$2(this, _GxIdeLaunchpadApis_componentLocale, await locale.Locale.getComponentStrings(this.element), "f");
        }
        catch (error) {
            console.error("Error loading locale:", error);
            __classPrivateFieldSet$2(this, _GxIdeLaunchpadApis_componentLocale, {}, "f");
        }
        this.initializeAccordionModel();
    }
    /**
     * Initialize accordion model with dynamic sections for each API
     */
    initializeAccordionModel() {
        if (!this.apis || !Array.isArray(this.apis)) {
            __classPrivateFieldSet$2(this, _GxIdeLaunchpadApis_ACCORDION_MODEL, [], "f");
            return;
        }
        __classPrivateFieldSet$2(this, _GxIdeLaunchpadApis_ACCORDION_MODEL, this.apis
            .map((api, index) => {
            let url;
            if (typeof api === "string") {
                url = api;
            }
            else if (api && typeof api === "object" && api.url) {
                url = api.url.toString();
            }
            else {
                return null;
            }
            const lastSlash = url.lastIndexOf("/");
            const name = url.substring(lastSlash + 1, url.length).toUpperCase();
            return {
                id: `api-${index}`,
                caption: name,
                expanded: true
            };
        })
            .filter(Boolean), "f");
    }
    renderApis() {
        if (!this.apis || !Array.isArray(this.apis)) {
            return null;
        }
        return this.apis
            .map((api, index$1) => {
            let apiData;
            if (typeof api === "string") {
                apiData = { url: api };
            }
            else if (api && typeof api === "object" && api.url) {
                apiData = api;
            }
            else {
                return null;
            }
            return (index.h("div", { key: `api-${index$1}`, slot: `api-${index$1}`, class: "api-content spacing-body" }, index.h("gx-ide-launchpad-api", { data: apiData, onObjectSelected: (event) => this.handleObjectSelection(event), onCopyToClipboard: (event) => this.handleCopyToClipboard(event) })));
        })
            .filter(Boolean);
    }
    /**
     * Handles object selection from subcomponents
     */
    handleObjectSelection(event) {
        if (this.onObjectSelected) {
            this.onObjectSelected(event);
        }
    }
    /**
     * Handles copy to clipboard from subcomponents
     */
    handleCopyToClipboard(event) {
        this.copyToClipboard.emit({ url: event.detail.url });
    }
    render() {
        var _a;
        if (!this.apis || this.apis.length === 0) {
            return (index.h(index.Host, null, index.h("ch-theme", { model: CSS_BUNDLES$2 }), index.h("div", { class: "no-data" }, index.h("p", { class: "body-regular-s" }, ((_a = __classPrivateFieldGet$2(this, _GxIdeLaunchpadApis_componentLocale, "f")) === null || _a === void 0 ? void 0 : _a.noApis) || "No APIs available"))));
        }
        return (index.h(index.Host, null, index.h("ch-theme", { model: CSS_BUNDLES$2 }), index.h("div", { class: "main" }, index.h("ch-accordion-render", { class: "accordion-filled-header elevation-2 apis-accordion", model: __classPrivateFieldGet$2(this, _GxIdeLaunchpadApis_ACCORDION_MODEL, "f") }, this.renderApis()))));
    }
    static get assetsDirs() { return ["gx-ide-assets/launchpad-apis"]; }
    get element() { return index.getElement(this); }
};
_GxIdeLaunchpadApis_componentLocale = new WeakMap(), _GxIdeLaunchpadApis_ACCORDION_MODEL = new WeakMap();
GxIdeLaunchpadApis.style = launchpadApisCss;

const launchpadNativeAppsCss = ".object-card{border:none;border-radius:4px;padding:12px;display:flex;gap:var(--spacing-gap-l);flex-direction:column;flex-shrink:0;text-align:left}.platform-grid{display:grid;grid-template-columns:repeat(auto-fit, minmax(var(--card-min-inline-size, 300px), var(--card-max-inline-size, 1fr)));gap:var(--spacing-gap-l);align-items:stretch}button.button-secondary{border-color:var(--color-border-neutral-default)}:host{display:block;block-size:100%;overflow:auto}.main{overflow:auto;display:block}ch-accordion-render{inline-size:100%;block-size:100%}.native-apps-accordion{inline-size:100%;block-size:100%}.platform-section{display:flex;align-items:center;gap:var(--spacing-gap-l)}.app__apple-store{height:32px;cursor:pointer;transition:opacity var(--timing-fast) ease}.app__apple-store:hover{opacity:0.8}.platform-grid{--card-min-inline-size:360px}.card-content{display:flex;gap:var(--spacing-gap-xl);flex:1;width:100%}.card-content:focus{outline:none}.info-section{flex:1;display:flex;flex-direction:column;justify-content:space-between;width:100%}.app-info{display:flex;flex-direction:column;gap:var(--spacing-gap-xs);flex:1}.name{color:var(--color-text-neutral-default)}.description{color:var(--color-text-neutral-disabled);margin:0;line-height:var(--line-height-relaxed)}.dialog{--ch-dialog-block-size:400px;--ch-dialog-inline-size:350px;--ch-dialog-min-block-size:400px;--ch-dialog-min-inline-size:350px}.qr-container{display:flex;align-items:center;justify-content:center}.card-actions{display:flex;justify-content:space-between;align-items:center;padding-top:12px;border-top:1px solid var(--color-border-neutral-default)}.no-data,.no-results{color:var(--color-text-neutral-disabled);font-style:italic;text-align:center;padding:16px}.no-data p,.no-results p{font-size:var(--font-size-body-m);font-weight:var(--font-style-semi-bold);line-height:var(--line-height-spacious)}@media (max-width: 768px){.platform-grid{justify-content:center}.card-content{flex-direction:column;gap:var(--spacing-gap-l)}.card-actions{flex-direction:column;gap:var(--spacing-gap-l);align-items:stretch}}@media (max-width: 480px){.main{padding:12px}.object-card{padding:12px}.platform-grid{gap:var(--spacing-gap-l);padding:12px}}.android:after{content:\"\";display:block}";

var __classPrivateFieldSet$1 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
    if (kind === "m")
        throw new TypeError("Private method is not writable");
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a setter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot write private member to an object whose class did not declare it");
    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet$1 = (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 _GxIdeLaunchpadNativeApps_instances, _GxIdeLaunchpadNativeApps_componentLocale, _GxIdeLaunchpadNativeApps_ACCORDION_MODEL, _GxIdeLaunchpadNativeApps_timeoutIds, _GxIdeLaunchpadNativeApps_getQRFillColor, _GxIdeLaunchpadNativeApps_getQRBackgroundColor, _GxIdeLaunchpadNativeApps_getCopyIcon, _GxIdeLaunchpadNativeApps_copyToClipboardFunc, _GxIdeLaunchpadNativeApps_openAppStoreFunc, _GxIdeLaunchpadNativeApps_handleQRClick, _GxIdeLaunchpadNativeApps_handleCloseQRDialog, _GxIdeLaunchpadNativeApps_handleObjectClick, _GxIdeLaunchpadNativeApps_renderPlatformSection;
const IOS_ID = "ios";
const ANDROID_ID = "android";
const APP_STORE_BADGE = index.getAssetPath("./gx-ide-assets/launchpad-native-apps/images/app-store-badge.svg");
const ANDROID_LOGO = index.getAssetPath("./gx-ide-assets/launchpad-native-apps/images/android-logo.svg");
const MAC_LOGO = index.getAssetPath("./gx-ide-assets/launchpad-native-apps/images/mac-logo.svg");
const CSS_BUNDLES$1 = [
    "resets/box-sizing",
    "components/accordion",
    "components/button",
    "components/dialog",
    "components/icon",
    "utils/elevation",
    "utils/layout",
    "utils/spacing",
    "utils/typography"
];
const QR_ICON = assetsManager.getIconPath({
    category: "system",
    name: "qr-code",
    colorType: "interactive"
});
const GxIdeLaunchpadNativeApps = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.copyToClipboard = index.createEvent(this, "copyToClipboard", 7);
        this.openOnTheAppStore = index.createEvent(this, "openOnTheAppStore", 7);
        _GxIdeLaunchpadNativeApps_instances.add(this);
        _GxIdeLaunchpadNativeApps_componentLocale.set(this, void 0);
        _GxIdeLaunchpadNativeApps_ACCORDION_MODEL.set(this, []);
        _GxIdeLaunchpadNativeApps_timeoutIds.set(this, new Set());
        this.objects = [];
        this.filterValue = "";
        this.order = {
            orderCriteria: null,
            ascending: null
        };
        this.page = 1;
        this.perPage = 10;
        this.onObjectSelected = undefined;
        this.showCopiedMessage = {};
        this.showQRDialog = false;
        this.selectedObjectForQR = null;
    }
    async componentWillLoad() {
        try {
            __classPrivateFieldSet$1(this, _GxIdeLaunchpadNativeApps_componentLocale, await locale.Locale.getComponentStrings(this.el), "f");
        }
        catch (error) {
            console.error("Error loading locale:", error);
            __classPrivateFieldSet$1(this, _GxIdeLaunchpadNativeApps_componentLocale, {}, "f");
        }
        __classPrivateFieldSet$1(this, _GxIdeLaunchpadNativeApps_ACCORDION_MODEL, [
            {
                id: IOS_ID,
                caption: "iOS",
                expanded: true
            },
            {
                id: ANDROID_ID,
                caption: "Android",
                expanded: true
            }
        ], "f");
    }
    /**
     * Cleanup method to prevent memory leaks
     */
    disconnectedCallback() {
        if (__classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_timeoutIds, "f")) {
            __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_timeoutIds, "f").forEach(timeoutId => {
                if (timeoutId) {
                    clearTimeout(timeoutId);
                }
            });
            __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_timeoutIds, "f").clear();
        }
    }
    render() {
        var _a;
        if (!this.objects || this.objects.length === 0) {
            index.h("div", { class: "no-data" }, index.h("p", { class: "body-regular-s" }, ((_a = __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_componentLocale, "f")) === null || _a === void 0 ? void 0 : _a.noData) ||
                "No native applications data available"));
        }
        return [
            index.h("ch-theme", { model: CSS_BUNDLES$1 }),
            index.h("div", { class: "main" }, index.h("ch-accordion-render", { class: "accordion-filled-header elevation-1 native-apps-accordion", model: __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_ACCORDION_MODEL, "f") }, index.h("div", { slot: IOS_ID, class: "accordion-content spacing-body" }, __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_instances, "m", _GxIdeLaunchpadNativeApps_renderPlatformSection).call(this, IOS_ID)), index.h("div", { slot: ANDROID_ID, class: "accordion-content spacing-body" }, __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_instances, "m", _GxIdeLaunchpadNativeApps_renderPlatformSection).call(this, ANDROID_ID)))),
            index.h("ch-dialog", { class: "dialog", show: this.showQRDialog, "show-header": true, closable: true, "close-button-accessible-name": "Close QR code", onDialogClosed: () => __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_instances, "m", _GxIdeLaunchpadNativeApps_handleCloseQRDialog).call(this) }, this.selectedObjectForQR && (index.h("div", { class: "qr-container" }, index.h("ch-qr", { value: this.selectedObjectForQR.url || "", size: 200, "error-correction-level": "Low", class: "qr-code", fill: __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_instances, "m", _GxIdeLaunchpadNativeApps_getQRFillColor).call(this), background: __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_instances, "m", _GxIdeLaunchpadNativeApps_getQRBackgroundColor).call(this) }))))
        ];
    }
    static get assetsDirs() { return ["gx-ide-assets/launchpad-native-apps"]; }
    get el() { return index.getElement(this); }
};
_GxIdeLaunchpadNativeApps_componentLocale = new WeakMap(), _GxIdeLaunchpadNativeApps_ACCORDION_MODEL = new WeakMap(), _GxIdeLaunchpadNativeApps_timeoutIds = new WeakMap(), _GxIdeLaunchpadNativeApps_instances = new WeakSet(), _GxIdeLaunchpadNativeApps_getQRFillColor = function _GxIdeLaunchpadNativeApps_getQRFillColor() {
    const computedStyle = getComputedStyle(document.documentElement);
    return (computedStyle.getPropertyValue("--color-text-neutral-default").trim() ||
        computedStyle.getPropertyValue("--color-neutral-400").trim() ||
        "#49566d");
}, _GxIdeLaunchpadNativeApps_getQRBackgroundColor = function _GxIdeLaunchpadNativeApps_getQRBackgroundColor() {
    const computedStyle = getComputedStyle(document.documentElement);
    return (computedStyle.getPropertyValue("--color-neutral-1600").trim() || "#ffffff");
}, _GxIdeLaunchpadNativeApps_getCopyIcon = function _GxIdeLaunchpadNativeApps_getCopyIcon() {
    return assetsManager.getIconPath({
        category: "system",
        name: "copy",
        colorType: "primary"
    });
}, _GxIdeLaunchpadNativeApps_copyToClipboardFunc = function _GxIdeLaunchpadNativeApps_copyToClipboardFunc(object) {
    this.copyToClipboard.emit({
        url: object.url
    });
    if (object.url) {
        navigator.clipboard
            .writeText(object.url)
            .then(() => {
            const objectKey = `${object.name}-${object.url}`;
            this.showCopiedMessage = Object.assign(Object.assign({}, this.showCopiedMessage), { [objectKey]: true });
            const timeoutId = window.setTimeout(() => {
                this.showCopiedMessage = Object.assign(Object.assign({}, this.showCopiedMessage), { [objectKey]: false });
                __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_timeoutIds, "f").delete(timeoutId);
            }, 2000);
            __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_timeoutIds, "f").add(timeoutId);
        })
            .catch(err => {
            console.error("Failed to copy text: ", err);
        });
    }
}, _GxIdeLaunchpadNativeApps_openAppStoreFunc = function _GxIdeLaunchpadNativeApps_openAppStoreFunc(object) {
    this.openOnTheAppStore.emit({
        url: object.url
    });
    if (object.url) {
        window.open(object.url, "_blank");
    }
}, _GxIdeLaunchpadNativeApps_handleQRClick = function _GxIdeLaunchpadNativeApps_handleQRClick(object) {
    this.selectedObjectForQR = object;
    this.showQRDialog = true;
}, _GxIdeLaunchpadNativeApps_handleCloseQRDialog = function _GxIdeLaunchpadNativeApps_handleCloseQRDialog() {
    this.showQRDialog = false;
    this.selectedObjectForQR = null;
}, _GxIdeLaunchpadNativeApps_handleObjectClick = function _GxIdeLaunchpadNativeApps_handleObjectClick(object) {
    if (object.key && this.onObjectSelected) {
        // Send the full key object as string in format "type|id"
        const keyString = `${object.key.type}|${object.key.id}`;
        this.onObjectSelected({ detail: { key: keyString } });
    }
}, _GxIdeLaunchpadNativeApps_renderPlatformSection = function _GxIdeLaunchpadNativeApps_renderPlatformSection(platformType) {
    var _a, _b;
    const platformIcon = platformType === IOS_ID ? (index.h("img", { src: MAC_LOGO, alt: "Apple iOS Logo" })) : (index.h("img", { src: ANDROID_LOGO, alt: "Android Logo" }));
    const platformSection = this.objects.find(obj => obj.type === platformType);
    if (!platformSection || platformSection.objects.length === 0) {
        return (index.h("div", { class: "no-results" }, index.h("p", { class: "body-regular-s" }, ((_b = (_a = __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_componentLocale, "f")) === null || _a === void 0 ? void 0 : _a.noPlatformApps) === null || _b === void 0 ? void 0 : _b.replace("{platformType}", platformType)) || `No ${platformType} applications available`)));
    }
    return (index.h("div", { class: "platform-grid" }, platformSection.objects.map((object, index$1) => {
        var _a, _b, _c;
        return (index.h("div", { key: index$1, class: "object-card elevation-1", tabindex: "0", onClick: () => __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_instances, "m", _GxIdeLaunchpadNativeApps_handleObjectClick).call(this, object) }, index.h("div", { class: "card-content" }, index.h("div", { class: "info-section" }, index.h("div", { class: "app-info" }, index.h("h1", { class: "name body-semi-bold-s" }, object.name), object.description && (index.h("p", { class: "description body-regular-xs" }, object.description))))), index.h("div", { class: "card-actions" }, object.url && (index.h("div", { class: "platform-section" }, object["app-store-badge"] ? (index.h("img", { src: APP_STORE_BADGE, alt: "Download on the App Store", class: "app__apple-store", onClick: () => __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_instances, "m", _GxIdeLaunchpadNativeApps_openAppStoreFunc).call(this, object) })) : (platformIcon), index.h("button", { class: "button-secondary button-icon-and-text", onClick: () => __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_instances, "m", _GxIdeLaunchpadNativeApps_handleQRClick).call(this, object), "aria-label": "Show QR Code" }, index.h("ch-image", { class: "icon-m", src: QR_ICON, type: "mask" }), ((_a = __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_componentLocale, "f")) === null || _a === void 0 ? void 0 : _a.showQR) || "Show QR"))), index.h("button", { class: "button-tertiary button-icon-and-text copy-button", onClick: () => __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_instances, "m", _GxIdeLaunchpadNativeApps_copyToClipboardFunc).call(this, object), "aria-label": "Copy to clipboard" }, index.h("ch-image", { class: "icon-m", src: __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_instances, "m", _GxIdeLaunchpadNativeApps_getCopyIcon).call(this) }), this.showCopiedMessage[`${object.name}-${object.url}`]
            ? ((_b = __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_componentLocale, "f")) === null || _b === void 0 ? void 0 : _b.copied) || "Copied!"
            : ((_c = __classPrivateFieldGet$1(this, _GxIdeLaunchpadNativeApps_componentLocale, "f")) === null || _c === void 0 ? void 0 : _c.copy) || "Copy"))));
    }), 
    // WA: Prevent card take full width if there is only one card
    platformSection.objects.length === 1 && index.h("div", null)));
};
GxIdeLaunchpadNativeApps.style = launchpadNativeAppsCss;

const launchpadWebAppsCss = ".object-card{border:none;border-radius:4px;padding:12px;display:flex;gap:var(--spacing-gap-l);flex-direction:column;flex-shrink:0;text-align:left}.object-card:focus-visible{outline:none;border-color:var(--focus__outline-color)}.object-card:hover{cursor:pointer;border-color:var(--color-border-item-hover)}.object-card:active{border-color:var(--color-border-item-pressed)}:host{display:block;block-size:100%;overflow:auto}.main{overflow:auto;display:block}.input-filter{inline-size:33%;min-inline-size:300px}ch-accordion-render{inline-size:100%;block-size:100%}.accordion-content{inline-size:100%;overflow-x:auto;min-width:0}.web-apps-accordion{inline-size:100%;block-size:100%}.main-objects-grid{display:grid;grid-template-columns:repeat(auto-fit, minmax(267px, 1fr));gap:var(--spacing-gap-l);align-items:stretch}.object-card{inline-size:100%;border-width:1px;border-style:solid}.object-card.elevation-1{--elevation-border-color:var(\n    --color-accent-surface-elevation-1\n  )}.card-header{display:flex;justify-content:space-between;align-items:flex-start;flex-shrink:0}.card-header .left{display:flex;flex-direction:column;flex:1;gap:8px}.card-header .left .name{color:var(--color-text-neutral-default);font-weight:var(--font-style-regular)}.card-header .left .module{color:var(--ch-color-text-secondary);margin:0}.card-header .right .type-container{display:flex;flex-direction:column;align-items:flex-end;gap:8px}.card-header .type{margin:0;color:var(--color-text-neutral-disabled)}.card-footer{display:flex;justify-content:space-between;align-items:center;margin-top:auto;padding-top:12px;border-top:1px solid var(--color-border-surface-on-elevation-1);flex-shrink:0}.card-footer .description{margin:0;line-height:var(--line-height-relaxed);color:var(--color-text-neutral-default)}.card-footer .angular-icon{inline-size:14px;block-size:14px;opacity:0.8}.no-results,.no-objects{color:var(--color-text-neutral-disabled);text-align:center;padding:16px}.recent-objects-grid-container .cell-content{display:flex;align-items:center;gap:var(--spacing-gap-m)}.tabular-grid-scroll-container{max-block-size:400px;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin}:host{display:block !important}.header{display:block !important;inline-size:100% !important;float:none !important;clear:both !important}.field{display:block !important;inline-size:100% !important;float:none !important;clear:both !important}.main{display:block !important;inline-size:100% !important;float:none !important;clear:both !important}";

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 __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
    if (kind === "m")
        throw new TypeError("Private method is not writable");
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a setter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot write private member to an object whose class did not declare it");
    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _GxIdeLaunchpadWebApps_instances, _GxIdeLaunchpadWebApps_componentLocale, _GxIdeLaunchpadWebApps_filterObjects, _GxIdeLaunchpadWebApps_sortRecentObjects, _GxIdeLaunchpadWebApps_getObjectValue, _GxIdeLaunchpadWebApps_handleColumnSortChanged, _GxIdeLaunchpadWebApps_getObjectTypeIcon, _GxIdeLaunchpadWebApps_handleObjectClick, _GxIdeLaunchpadWebApps_renderMainObjects, _GxIdeLaunchpadWebApps_renderRecentObjects;
const CSS_BUNDLES = [
    "resets/box-sizing",
    "components/edit",
    "components/accordion",
    "components/tabular-grid",
    "components/icon",
    "chameleon/scrollbar",
    "utils/layout",
    "utils/form",
    "utils/typography",
    "utils/spacing",
    "utils/elevation"
];
const ANGULAR_LOGO = index.getAssetPath("./gx-ide-assets/launchpad-web-apps/images/angular-logo.svg");
const ACCORDION_RECENT_OBJECTS_ID = "recent-objects";
const COLUMN_NAME = "name";
const COLUMN_MODULE = "module";
const COLUMN_TYPE = "type";
const COLUMN_DESCRIPTION = "description";
const GxIdeLaunchpadWebApps = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.copyToClipboard = index.createEvent(this, "copyToClipboard", 7);
        _GxIdeLaunchpadWebApps_instances.add(this);
        _GxIdeLaunchpadWebApps_componentLocale.set(this, void 0);
        /**
         * Sorts recent objects
         */
        _GxIdeLaunchpadWebApps_sortRecentObjects.set(this, (a, b) => {
            var _a, _b;
            if (this.order.orderCriteria) {
                const orderCriteriaA = ((_a = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_instances, "m", _GxIdeLaunchpadWebApps_getObjectValue).call(this, a, this.order.orderCriteria)) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || "";
                const orderCriteriaB = ((_b = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_instances, "m", _GxIdeLaunchpadWebApps_getObjectValue).call(this, b, this.order.orderCriteria)) === null || _b === void 0 ? void 0 : _b.toUpperCase()) || "";
                if (orderCriteriaA < orderCriteriaB) {
                    return this.order.ascending ? -1 : 1;
                }
                if (orderCriteriaA > orderCriteriaB) {
                    return this.order.ascending ? 1 : -1;
                }
            }
            return 0;
        });
        /**
         * Handles column sort changes
         */
        _GxIdeLaunchpadWebApps_handleColumnSortChanged.set(this, (e) => {
            const { columnId, sortDirection } = e.detail;
            this.order = {
                orderCriteria: columnId,
                ascending: sortDirection === "asc"
            };
        });
        this.objects = [];
        this.onObjectSelected = undefined;
        this.filterValue = "";
        this.recentObjectsExpanded = true;
        this.order = {
            orderCriteria: null,
            ascending: null
        };
    }
    async componentWillLoad() {
        try {
            __classPrivateFieldSet(this, _GxIdeLaunchpadWebApps_componentLocale, await locale.Locale.getComponentStrings(this.el), "f");
        }
        catch (error) {
            console.error("Error loading locale:", error);
            __classPrivateFieldSet(this, _GxIdeLaunchpadWebApps_componentLocale, {}, "f");
        }
    }
    handleAccordionExpandedChange(e) {
        if (e.detail.id === ACCORDION_RECENT_OBJECTS_ID) {
            this.recentObjectsExpanded = e.detail.expanded;
        }
    }
    render() {
        var _a, _b, _c;
        if (!this.objects || this.objects.length === 0) {
            return (index.h(index.Host, null, index.h("ch-theme", { model: CSS_BUNDLES }), index.h("div", { class: "no-data" }, index.h("p", { class: "body-regular-s" }, ((_a = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_componentLocale, "f")) === null || _a === void 0 ? void 0 : _a.noData) ||
                "No web applications data available"))));
        }
        return (index.h(index.Host, null, index.h("ch-theme", { model: CSS_BUNDLES }), index.h("header", { class: "header dialog-header" }, index.h("div", { class: "field field-block" }, index.h("ch-edit", { class: "input input-filter", id: "filter", placeholder: ((_b = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_componentLocale, "f")) === null || _b === void 0 ? void 0 : _b.search) || "Search", value: this.filterValue, accessibleName: ((_c = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_componentLocale, "f")) === null || _c === void 0 ? void 0 : _c.search) || "Search", onInput: e => (this.filterValue = String(e.detail)) }))), index.h("div", { class: "main" }, index.h("ch-accordion-render", { class: "accordion-filled-header elevation-1 web-apps-accordion", model: [
                {
                    id: "main-objects",
                    caption: "Main Objects",
                    expanded: true
                },
                {
                    id: ACCORDION_RECENT_OBJECTS_ID,
                    caption: "Recent Objects",
                    expanded: this.recentObjectsExpanded
                }
            ] }, index.h("div", { slot: "main-objects", class: "accordion-content spacing-body" }, __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_instances, "m", _GxIdeLaunchpadWebApps_renderMainObjects).call(this)), index.h("div", { slot: ACCORDION_RECENT_OBJECTS_ID, class: "accordion-content spacing-body" }, __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_instances, "m", _GxIdeLaunchpadWebApps_renderRecentObjects).call(this))))));
    }
    static get assetsDirs() { return ["gx-ide-assets/launchpad-web-apps"]; }
    get el() { return index.getElement(this); }
};
_GxIdeLaunchpadWebApps_componentLocale = new WeakMap(), _GxIdeLaunchpadWebApps_sortRecentObjects = new WeakMap(), _GxIdeLaunchpadWebApps_handleColumnSortChanged = new WeakMap(), _GxIdeLaunchpadWebApps_instances = new WeakSet(), _GxIdeLaunchpadWebApps_filterObjects = function _GxIdeLaunchpadWebApps_filterObjects(object) {
    if (!this.filterValue)
        return true;
    const filterV = this.filterValue.toLowerCase();
    return ((object.module && object.module.toLowerCase().includes(filterV)) ||
        (object.name && object.name.toLowerCase().includes(filterV)) ||
        (object.type && object.type.toLowerCase().includes(filterV)) ||
        (object.description && object.description.toLowerCase().includes(filterV)));
}, _GxIdeLaunchpadWebApps_getObjectValue = function _GxIdeLaunchpadWebApps_getObjectValue(obj, key) {
    switch (key) {
        case "name":
            return obj.name || "";
        case "module":
            return obj.module || "";
        case "type":
            return obj.type || "";
        case "description":
            return obj.description || "";
        default:
            return "";
    }
}, _GxIdeLaunchpadWebApps_getObjectTypeIcon = function _GxIdeLaunchpadWebApps_getObjectTypeIcon(object) {
    var _a;
    const iconMap = {
        "36e32e2d-023e-4188-95df-d13573bac2e0:API": assetsManager.getIconPath({
            category: "objects",
            name: "api"
        }),
        "2a9e9aba-d2de-4801-ae7f-5e3819222daf:Data Provider": assetsManager.getIconPath({
            category: "objects",
            name: "data-provider"
        }),
        "9bdcc055-174e-4af6-96cb-a2ceef6c5f09:Menu": assetsManager.getIconPath({
            category: "objects",
            name: "dashboard"
        }),
        "9bdcc055-174e-4af6-96cb-a2ceef6c5f09:Dashboard": assetsManager.getIconPath({
            category: "objects",
            name: "dashboard"
        }),
        "0eee17f4-cef9-4988-aed4-c2da632be85b:Mini App": assetsManager.getIconPath({
            category: "objects",
            name: "mini-app"
        }),
        "d82625fd-5892-40b0-99c9-5c8559c197fc:Panel": assetsManager.getIconPath({
            category: "objects",
            name: "panel-for-sd"
        }),
        "d82625fd-5892-40b0-99c9-5c8559c197fc:SDPanel": assetsManager.getIconPath({
            category: "objects",
            name: "panel-for-sd"
        }),
        "84a12160-f59b-4ad7-a683-ea4481ac23e9:Procedure": assetsManager.getIconPath({
            category: "objects",
            name: "procedure"
        }),
        "a7e6cce5-1171-49e9-a6a0-07f137eedc07:Super App": assetsManager.getIconPath({
            category: "objects",
            name: "super-app"
        }),
        "1db606f2-af09-4cf9-a3b5-b481519d28f6:Transaction": assetsManager.getIconPath({
            category: "objects",
            name: "transaction"
        }),
        "c9584656-94b6-4ccd-890f-332d11fc2c25:Web Panel": assetsManager.getIconPath({
            category: "objects",
            name: "webpanel"
        }),
        "c9584656-94b6-4ccd-890f-332d11fc2c25:WebPanel": assetsManager.getIconPath({
            category: "objects",
            name: "webpanel"
        }),
        "c9584656-94b6-4ccd-890f-332d11fc2c25:Web Component": assetsManager.getIconPath({
            category: "objects",
            name: "web-component"
        }),
        "c9584656-94b6-4ccd-890f-332d11fc2c25:WebComponent": assetsManager.getIconPath({
            category: "objects",
            name: "web-component"
        }),
        "15cf49b5-fc38-4899-91b5-395d02d79889:Work With": assetsManager.getIconPath({
            category: "patterns",
            name: "workwith-for-sd"
        }),
        "15cf49b5-fc38-4899-91b5-395d02d79889:WorkWith": assetsManager.getIconPath({
            category: "patterns",
            name: "workwith-for-sd"
        }),
        "API": assetsManager.getIconPath({ category: "objects", name: "api" }),
        "Data Provider": assetsManager.getIconPath({
            category: "objects",
            name: "data-provider"
        }),
        "Menu": assetsManager.getIconPath({ category: "objects", name: "dashboard" }),
        "Dashboard": assetsManager.getIconPath({ category: "objects", name: "dashboard" }),
        "Mini App": assetsManager.getIconPath({ category: "objects", name: "mini-app" }),
        "Panel": assetsManager.getIconPath({ category: "objects", name: "panel-for-sd" }),
        "SDPanel": assetsManager.getIconPath({ category: "objects", name: "panel-for-sd" }),
        "Procedure": assetsManager.getIconPath({ category: "objects", name: "procedure" }),
        "Super App": assetsManager.getIconPath({ category: "objects", name: "super-app" }),
        "Transaction": assetsManager.getIconPath({ category: "objects", name: "transaction" }),
        "Web Panel": assetsManager.getIconPath({ category: "objects", name: "webpanel" }),
        "WebPanel": assetsManager.getIconPath({ category: "objects", name: "webpanel" }),
        "Web Component": assetsManager.getIconPath({
            category: "objects",
            name: "web-component"
        }),
        "WebComponent": assetsManager.getIconPath({
            category: "objects",
            name: "web-component"
        }),
        "Work With": assetsManager.getIconPath({
            category: "patterns",
            name: "workwith-for-sd"
        }),
        "WorkWith": assetsManager.getIconPath({ category: "patterns", name: "workwith-for-sd" })
    };
    if ((_a = object.key) === null || _a === void 0 ? void 0 : _a.type) {
        const fullKey = `${object.key.type}:${object.type}`;
        if (iconMap[fullKey]) {
            return iconMap[fullKey];
        }
    }
    if (iconMap[object.type]) {
        return iconMap[object.type];
    }
    return assetsManager.getIconPath({ category: "objects", name: "object" });
}, _GxIdeLaunchpadWebApps_handleObjectClick = function _GxIdeLaunchpadWebApps_handleObjectClick(object) {
    if (object.key && this.onObjectSelected) {
        // Send the full key object as string in format "type|id"
        const keyString = `${object.key.type}|${object.key.id}`;
        this.onObjectSelected({ detail: { key: keyString } });
    }
}, _GxIdeLaunchpadWebApps_renderMainObjects = function _GxIdeLaunchpadWebApps_renderMainObjects() {
    var _a, _b, _c;
    const mainObjects = ((_a = this.objects.find(obj => obj.type === "main")) === null || _a === void 0 ? void 0 : _a.objects) || [];
    const filteredObjects = mainObjects.filter(obj => __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_instances, "m", _GxIdeLaunchpadWebApps_filterObjects).call(this, obj));
    if (mainObjects.length === 0) {
        return (index.h("div", { class: "no-results" }, index.h("p", { class: "body-regular-s" }, ((_b = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_componentLocale, "f")) === null || _b === void 0 ? void 0 : _b.noMainObjects) ||
            "There are no main objects to display")));
    }
    if (filteredObjects.length === 0) {
        return (index.h("div", { class: "no-results" }, index.h("p", { class: "body-regular-s" }, (_c = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_componentLocale, "f")) === null || _c === void 0 ? void 0 : _c.noObjectsMatchSearch)));
    }
    return (index.h("div", { class: "main-objects-grid" }, filteredObjects.map((object, index$1) => (index.h("button", { key: index$1, class: "object-card elevation-1", onClick: () => __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_instances, "m", _GxIdeLaunchpadWebApps_handleObjectClick).call(this, object) }, index.h("div", { class: "card-header" }, index.h("div", { class: "left" }, index.h("h1", { class: "name body-semi-bold-s" }, object.name), index.h("h3", { class: "module body-regular-xs" }, object.module), index.h("p", { class: "type body-italic-xs" }, object.type)), index.h("div", { class: "right" }, index.h("div", { class: "type-container" }, index.h("ch-image", { class: "type-icon icon-m", src: __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_instances, "m", _GxIdeLaunchpadWebApps_getObjectTypeIcon).call(this, object) })))), (object.description || object.angular) && (index.h("footer", { class: "card-footer" }, index.h("div", { class: "left" }, object.description && (index.h("p", { class: "description body-regular-xs" }, object.description))), index.h("div", { class: "right" }, object.angular && (index.h("img", { src: ANGULAR_LOGO, alt: "Angular Logotype" })))))))), 
    // WA: Add empty divs to ensure a minimum of 4 grid items for proper layout
    filteredObjects.length < 4 &&
        Array.from({ length: 4 - filteredObjects.length }).map((_, index$1) => index.h("div", { key: `empty-${index$1}` }))));
}, _GxIdeLaunchpadWebApps_renderRecentObjects = function _GxIdeLaunchpadWebApps_renderRecentObjects() {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
    const recentObjects = ((_a = this.objects.find(obj => obj.type === "recent")) === null || _a === void 0 ? void 0 : _a.objects) || [];
    const filteredObjects = recentObjects.filter(obj => __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_instances, "m", _GxIdeLaunchpadWebApps_filterObjects).call(this, obj));
    if (recentObjects.length === 0) {
        return (index.h("div", { class: "no-objects" }, index.h("p", { class: "body-regular-s" }, (_b = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_componentLocale, "f")) === null || _b === void 0 ? void 0 : _b.noRecentObjects)));
    }
    if (filteredObjects.length === 0) {
        return (index.h("div", { class: "no-objects" }, index.h("p", { class: "body-regular-s" }, (_c = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_componentLocale, "f")) === null || _c === void 0 ? void 0 : _c.noObjectsMatchSearch)));
    }
    const sortedObjects = [...filteredObjects].sort(__classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_sortRecentObjects, "f"));
    return (index.h("div", { class: "recent-objects-grid-container" }, index.h("div", { class: "tabular-grid-scroll-container" }, index.h("ch-tabular-grid", { class: "tabular-grid elevation-2" }, index.h("ch-tabular-grid-columnset", { class: "tabular-grid-column-set" }, index.h("ch-tabular-grid-column", { class: "tabular-grid-column", columnId: COLUMN_NAME, columnName: ((_e = (_d = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_componentLocale, "f")) === null || _d === void 0 ? void 0 : _d.columns) === null || _e === void 0 ? void 0 : _e.name) || "Name", columnNameHidden: false, settingable: false, sortable: true, onColumnSortChanged: __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_handleColumnSortChanged, "f"), size: "25%", resizable: false }), index.h("ch-tabular-grid-column", { class: "tabular-grid-column", columnId: COLUMN_MODULE, columnName: ((_g = (_f = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_componentLocale, "f")) === null || _f === void 0 ? void 0 : _f.columns) === null || _g === void 0 ? void 0 : _g.module) || "Module", columnNameHidden: false, settingable: false, sortable: true, onColumnSortChanged: __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_handleColumnSortChanged, "f"), size: "20%", resizable: false }), index.h("ch-tabular-grid-column", { class: "tabular-grid-column", columnId: COLUMN_TYPE, columnName: ((_j = (_h = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_componentLocale, "f")) === null || _h === void 0 ? void 0 : _h.columns) === null || _j === void 0 ? void 0 : _j.type) || "Type", columnNameHidden: false, settingable: false, sortable: true, onColumnSortChanged: __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_handleColumnSortChanged, "f"), size: "20%", resizable: false }), index.h("ch-tabular-grid-column", { class: "tabular-grid-column", columnId: COLUMN_DESCRIPTION, columnName: ((_l = (_k = __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_componentLocale, "f")) === null || _k === void 0 ? void 0 : _k.columns) === null || _l === void 0 ? void 0 : _l.description) || "Description", columnNameHidden: false, settingable: false, sortable: false, size: "35%", resizable: false })), index.h("ch-tabular-grid-rowset", { class: "tabular-grid-rowset" }, sortedObjects.map((obj, index$1) => {
        var _a;
        return (index.h("ch-tabular-grid-row", { rowid: ((_a = obj.key) === null || _a === void 0 ? void 0 : _a.id) || index$1.toString(), class: "tabular-grid-row", onClick: () => __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_instances, "m", _GxIdeLaunchpadWebApps_handleObjectClick).call(this, obj) }, index.h("ch-tabular-grid-cell", { class: "tabular-grid-cell" }, index.h("div", { class: "cell-content" }, index.h("ch-image", { class: "object-icon icon-m", src: __classPrivateFieldGet(this, _GxIdeLaunchpadWebApps_instances, "m", _GxIdeLaunchpadWebApps_getObjectTypeIcon).call(this, obj) }), index.h("span", { class: "object-name" }, obj.name || "Unnamed"))), index.h("ch-tabular-grid-cell", { class: "tabular-grid-cell" }, obj.module || ""), index.h("ch-tabular-grid-cell", { class: "tabular-grid-cell" }, obj.type), index.h("ch-tabular-grid-cell", { class: "tabular-grid-cell" }, obj.description || "")));
    }))))));
};
GxIdeLaunchpadWebApps.style = launchpadWebAppsCss;

exports.gx_ide_launchpad_apis = GxIdeLaunchpadApis;
exports.gx_ide_launchpad_native_apps = GxIdeLaunchpadNativeApps;
exports.gx_ide_launchpad_web_apps = GxIdeLaunchpadWebApps;

//# sourceMappingURL=gx-ide-launchpad-apis_3.cjs.entry.js.map