import { Host, h } from "@stencil/core";
import { chatInputStore, chatsStore, configStore, connectionJobsStore, filterChatsStore, messagesStore, profilePanelStore, deviceModeStore, selectedChatStore, selectedMessageToReplyStore, userInfosStore, platformConnectionsStore, storageUsageStore, userStore, userAddressStore, tagsStore, statusesStore, businessStore, customFiltersStore, chatLanguageStore, translateStore, sessionTokensStore } from "../../store/store";
import { disconnectSocket, initSocket } from "../../utils/socket";
import { setupLanguage, setupTheme, setupBusinessId, setupShopId, setupAccessToken, setupIsProduction, setupTimeZone, setupTranslationSettings, setupIsNotConnected, setupIsZwiz, setupConnectionList, setupMemberList, setupZrmzApiUrl, setupOpenChatByFilter, setupPackage, setupIsShowWarningNotification, setupZwizSyncMessage } from "../../utils/setup";
import { handleGetChatFilterConfig, handleGetChats } from "../../store/chat";
import { Icon } from "../internal-component/icon";
import { dialogStore, handleError } from "../../store/dialog";
import { handleGetConnectionJobs } from "../../store/job";
import { getPlatformConnections, getUserToken } from "../../api";
import { getQuickMessageLibraryFilesStorageUsage } from "../../api/quick-message";
import { convertBytesToGB } from "../../utils/func";
import { initCacheDB } from "../../utils/cache-db";
export class ChatApp {
    languagePref;
    themeMode;
    businessId;
    shopId;
    accessToken;
    isProduction; //boolean;
    timeZone;
    translationSettings;
    isNotConnected; //boolean;
    isZwiz; //boolean;
    connectionList;
    memberList;
    zrmzApiUrl;
    openChatByFilter;
    currentPackage;
    isShowWarningNotification; //boolean;
    zwizSyncMessage; //boolean;
    layoutMode = 'monolith';
    deserializeTranslateSettingsArray(value) {
        try {
            return JSON.parse(value);
        }
        catch (e) {
            return null;
        }
    }
    deserializeTConnectionArray(value) {
        try {
            return JSON.parse(value);
        }
        catch (e) {
            return null;
        }
    }
    deserializeChannelMemberArray(value) {
        try {
            return JSON.parse(value);
        }
        catch (e) {
            return null;
        }
    }
    deserializeOpenChatByFilter(value) {
        try {
            return JSON.parse(value);
        }
        catch (e) {
            return null;
        }
    }
    deserializeCurrentPackage(value) {
        try {
            return JSON.parse(value);
        }
        catch (e) {
            return null;
        }
    }
    connect;
    nextKey;
    isLoading = false;
    hostElement;
    resizeObserver;
    containerRef;
    pendingLoadParams = null;
    disposeListener;
    isFirstLoadDone = false;
    handleLanguageChange(newLang, oldLang) {
        // Skip if value hasn't changed
        if (!newLang || newLang === oldLang)
            return;
        setupLanguage(newLang);
    }
    handleThemeChange(newTheme, oldTheme) {
        // Skip if value hasn't changed
        if (!newTheme || newTheme === oldTheme)
            return;
        setupTheme(newTheme);
    }
    handleBusinessIdChange(newBusinessId, oldBusinessId) {
        // Skip if value hasn't changed
        if (!newBusinessId || newBusinessId === oldBusinessId)
            return;
        setupBusinessId(newBusinessId);
    }
    handleShopIdChange(newShopId, oldShopId) {
        // Skip if value hasn't changed
        if (!newShopId || newShopId === oldShopId)
            return;
        setupShopId(newShopId);
    }
    handleAccessTokenChange(newAccessToken, oldAccessToken) {
        // Skip if value hasn't changed
        if (!newAccessToken || newAccessToken === oldAccessToken)
            return;
        setupAccessToken(newAccessToken);
    }
    handleIsProductionChange(newIsProduction, oldIsProduction) {
        // Skip if value hasn't changed
        if (!newIsProduction || newIsProduction === oldIsProduction)
            return;
        setupIsProduction(newIsProduction);
    }
    handleTimeZoneChange(newTimeZone, oldTimeZone) {
        // Skip if value hasn't changed
        if (!newTimeZone || newTimeZone === oldTimeZone)
            return;
        setupTimeZone(newTimeZone);
    }
    handleTranslationSettingsChange(newTranslationSettings, oldTranslationSettings) {
        // Skip if value hasn't changed
        if (!newTranslationSettings || newTranslationSettings === oldTranslationSettings)
            return;
        try {
            setupTranslationSettings(newTranslationSettings);
        }
        catch (error) {
            handleError(error, 'Failed to parse translationSettings');
        }
    }
    handleIsNotConnectedChange(newIsNotConnected, oldIsNotConnected) {
        // Skip if value hasn't changed
        if (!newIsNotConnected || newIsNotConnected === oldIsNotConnected)
            return;
        setupIsNotConnected(newIsNotConnected);
    }
    handleIsZwizChange(newIsZwiz, oldIsZwiz) {
        // Skip if value hasn't changed
        if (!newIsZwiz || newIsZwiz === oldIsZwiz)
            return;
        setupIsZwiz(newIsZwiz);
    }
    handleConnectionListChange(newConnectionList, oldConnectionList) {
        // Skip if value hasn't changed
        if (!newConnectionList || newConnectionList === oldConnectionList)
            return;
        try {
            setupConnectionList(newConnectionList);
        }
        catch (error) {
            handleError(error, 'Failed to parse connectionList');
        }
    }
    handleMemberListChange(newMemberList, oldMemberList) {
        // Skip if value hasn't changed
        if (!newMemberList || newMemberList === oldMemberList)
            return;
        try {
            setupMemberList(newMemberList);
        }
        catch (error) {
            handleError(error, 'Failed to parse memberList');
        }
    }
    handleZrmzApiUrlChange(newZrmzApiUrl, oldZrmzApiUrl) {
        // Skip if value hasn't changed
        if (!newZrmzApiUrl || newZrmzApiUrl === oldZrmzApiUrl)
            return;
        setupZrmzApiUrl(newZrmzApiUrl);
    }
    handleOpenChatByFilterChange(newOpenChatByFilter, oldOpenChatByFilter) {
        // Skip if value hasn't changed
        if (!newOpenChatByFilter || newOpenChatByFilter === oldOpenChatByFilter)
            return;
        try {
            setupOpenChatByFilter(newOpenChatByFilter);
        }
        catch (error) {
            handleError(error, 'Failed to parse openChatByFilter');
        }
    }
    handleCurrentPackageChange(newPackage, oldPackage) {
        // Skip if value hasn't changed
        if (!newPackage || newPackage === oldPackage)
            return;
        try {
            setupPackage(newPackage);
        }
        catch (error) {
            handleError(error, 'Failed to parse currentPackage');
        }
    }
    handleIsShowWarningNotificationChange(newVal, oldVal) {
        if (!newVal || newVal === oldVal)
            return;
        setupIsShowWarningNotification(newVal);
    }
    handleZwizSyncMessageChange(newVal, oldVal) {
        if (!newVal || newVal === oldVal)
            return;
        setupZwizSyncMessage(newVal);
    }
    handleClick(ev) {
        const target = ev.target;
        if (target && target.id === 'connect-channel') {
            this.connect.emit();
        }
    }
    checkSize = (width) => {
        deviceModeStore.set('mode', width <= 600 ? 'mobile' : width <= 1024 ? 'tablet' : 'desktop');
    };
    connectedCallback() {
        setupLanguage(this.languagePref);
        setupTheme(this.themeMode);
        setupBusinessId(this.businessId);
        setupShopId(this.shopId);
        setupAccessToken(this.accessToken);
        if (this.isProduction)
            setupIsProduction(this.isProduction);
        setupTimeZone(this.timeZone);
        setupTranslationSettings(this.translationSettings);
        if (this.isNotConnected)
            setupIsNotConnected(this.isNotConnected);
        if (this.isZwiz)
            setupIsZwiz(this.isZwiz);
        setupConnectionList(this.connectionList);
        setupMemberList(this.memberList);
        if (this.zrmzApiUrl)
            setupZrmzApiUrl(this.zrmzApiUrl);
        if (this.openChatByFilter)
            setupOpenChatByFilter(this.openChatByFilter);
        setupPackage(this.currentPackage);
        setupIsShowWarningNotification(this.isShowWarningNotification);
        setupZwizSyncMessage(this.zwizSyncMessage);
        initCacheDB();
    }
    async refreshData() {
        await this.initData();
    }
    async getStores() {
        return {
            chatInputStore,
            chatsStore,
            configStore,
            connectionJobsStore,
            filterChatsStore,
            messagesStore,
            profilePanelStore,
            deviceModeStore,
            selectedChatStore,
            selectedMessageToReplyStore,
            userInfosStore,
            platformConnectionsStore,
            storageUsageStore,
            userStore,
            userAddressStore,
            tagsStore,
            statusesStore,
            businessStore,
            customFiltersStore,
            chatLanguageStore,
            translateStore,
            sessionTokensStore,
        };
    }
    async componentWillLoad() {
        this.initData();
        initSocket();
        initSocket('/connection');
        const syncSocket = initSocket('/sync');
        syncSocket.on('message', this.onSyncMessageEvent);
        syncSocket.on('tags', this.onSyncTagsEvent);
        this.disposeListener = filterChatsStore.onChange('filterChat', async (filter) => {
            //Trigger load chats by filterChat (Initialize 1st time by handleSetFilterConnection in menu-chat-channel.tsx)
            const params = { ...filter };
            if (this.isFirstLoadDone) {
                params.ignoreCache = true;
            }
            chatsStore.set('loadedKeys', new Set());
            await this.loadChats(params);
            this.isFirstLoadDone = true;
        });
    }
    async initData() {
        /*const zdeskUserToken = */ await this.loadZdeskUserToken();
        await Promise.all([
            // this.loadMembers(),
            // this.loadChats({ enterprise_access_token: zdeskUserToken?.access_token }),
            this.loadChatFilterConfig(),
            this.loadPlatformConnections(),
            this.loadConnectionJobs(),
            this.loadUsageStorage()
        ]);
        selectedChatStore.reset();
        profilePanelStore.reset();
        chatInputStore.reset();
        selectedMessageToReplyStore.reset();
        messagesStore.reset();
    }
    componentDidLoad() {
        const chatAppDiv = this.hostElement.querySelector('#chat-app');
        if (chatAppDiv) {
            this.resizeObserver = new ResizeObserver(entries => {
                for (const entry of entries) {
                    const width = entry.contentRect.width;
                    this.checkSize(width);
                }
            });
            this.resizeObserver.observe(chatAppDiv);
            this.checkSize(chatAppDiv.clientWidth);
        }
    }
    disconnectedCallback() {
        if (this.disposeListener)
            this.disposeListener();
        const syncSocket = initSocket('/sync');
        syncSocket.off('message', this.onSyncMessageEvent);
        syncSocket.off('tags', this.onSyncTagsEvent);
        disconnectSocket();
        if (this.resizeObserver)
            this.resizeObserver.disconnect();
    }
    handleScroll = async () => {
        const element = this.containerRef;
        if (!element)
            return;
        const threshold = 150;
        const { scrollTop, scrollHeight, clientHeight } = element;
        const nextKey = chatsStore.get('next');
        if (scrollTop + clientHeight > scrollHeight - threshold && nextKey) {
            await this.loadChats({ start: nextKey, ...filterChatsStore.get('filterChat') });
        }
    };
    async loadChats(params) {
        if (this.isLoading) {
            this.pendingLoadParams = params;
            return;
        }
        try {
            this.isLoading = true;
            chatsStore.set('loading', true);
            await handleGetChats(params);
        }
        catch (error) {
            handleError(error, 'Failed to load chats');
        }
        finally {
            this.isLoading = false;
            chatsStore.set('loading', false);
            if (this.pendingLoadParams) {
                const nextParams = this.pendingLoadParams;
                this.pendingLoadParams = null;
                this.loadChats(nextParams);
            }
        }
    }
    async loadZdeskUserToken() {
        try {
            const zdeskConnection = this.connectionList.find(connection => connection.type === 'zwiz' && connection.platform === 'enterprise');
            if (!zdeskConnection)
                return;
            const userToken = await getUserToken({ connectionId: zdeskConnection.id });
            userInfosStore.set(zdeskConnection.id, {
                token: userToken
            });
            return userToken;
        }
        catch (error) {
            handleError(error, 'Failed to load zdesk user token');
        }
    }
    async loadPlatformConnections() {
        try {
            const smeConnection = this.connectionList.find(connection => connection.type === 'zwiz' && connection.platform === 'sme');
            if (!smeConnection)
                return;
            const platformConnections = await getPlatformConnections();
            platformConnectionsStore.set('connections', platformConnections);
        }
        catch (error) {
            handleError(error, 'Failed to load platform connections');
        }
    }
    async loadChatFilterConfig() {
        try {
            await handleGetChatFilterConfig();
        }
        catch (error) {
            handleError(error, 'Failed to load chats');
        }
    }
    async loadConnectionJobs() {
        try {
            await handleGetConnectionJobs();
        }
        catch (error) {
            handleError(error, 'Failed to load connection jobs');
        }
    }
    async loadUsageStorage() {
        try {
            const usage = await getQuickMessageLibraryFilesStorageUsage();
            storageUsageStore.set('usage', convertBytesToGB(usage.total_storage_bytes));
        }
        catch (error) {
            handleError(error, 'Failed to load usage storage');
        }
    }
    handleJobCompleted = () => {
        this.initData();
    };
    onSyncMessageEvent = ({ chat_session_id, state }) => {
        if (state === 'completed' || state === 'failed') {
            const selectedChat = selectedChatStore.get('selectedChat');
            if (selectedChat && selectedChat.id === chat_session_id) {
                selectedChatStore.set('isSyncingMessage', false);
                selectedChatStore.set('syncMessageJobId', undefined);
                if (state === 'completed') {
                    window.dispatchEvent(new CustomEvent('syncMessageComplete', { detail: selectedChat.id }));
                }
            }
        }
    };
    onSyncTagsEvent = ({ chat_session_id, state }) => {
        if (state === 'completed' || state === 'failed') {
            const selectedChat = selectedChatStore.get('selectedChat');
            if (selectedChat && selectedChat.id === chat_session_id) {
                selectedChatStore.set('isSyncingTag', false);
                selectedChatStore.set('syncTagJobId', undefined);
                if (state === 'completed') {
                    window.dispatchEvent(new CustomEvent('syncTagComplete', { detail: selectedChat.id }));
                }
            }
        }
    };
    setContainerRef = (el) => {
        this.containerRef = el;
    };
    getGridCols() {
        const isNotConnected = configStore.get('isNotConnected');
        const isSelectedChat = selectedChatStore.get('selectedChat') !== null;
        const mode = deviceModeStore.get('mode');
        if (isNotConnected)
            return 'grid-cols-1';
        if (mode === 'mobile')
            return 'grid-cols-1';
        if (isSelectedChat && mode === 'desktop') {
            return 'grid-cols-1_2_1';
        }
        return 'grid-cols-1_3';
    }
    displayChatPanel() {
        const isNotConnected = configStore.get('isNotConnected');
        const isSelectedChat = selectedChatStore.get('selectedChat') !== null;
        const mode = deviceModeStore.get('mode');
        if (isNotConnected || (mode === 'mobile' && isSelectedChat))
            return 'hidden!';
        return '';
    }
    displayMessagePanel() {
        const isNotConnected = configStore.get('isNotConnected');
        const isSelectedChat = selectedChatStore.get('selectedChat') !== null;
        const isShowProfile = profilePanelStore.get('isShowProfile');
        const mode = deviceModeStore.get('mode');
        if (isNotConnected)
            return '';
        if (mode === 'mobile') {
            if (isSelectedChat && !isShowProfile) {
                return '';
            }
            return 'hidden!';
        }
        else if (mode === 'tablet') {
            if (isShowProfile) {
                return 'hidden!';
            }
            return '';
        }
        return '';
    }
    displayUserProfilePanel() {
        const isNotConnected = configStore.get('isNotConnected');
        const isSelectedChat = selectedChatStore.get('selectedChat') !== null;
        const isShowProfile = profilePanelStore.get('isShowProfile');
        const mode = deviceModeStore.get('mode');
        if (isNotConnected)
            return 'hidden!';
        if (mode === 'mobile') {
            if (isSelectedChat && isShowProfile)
                return '';
            return 'hidden!';
        }
        else if (mode === 'tablet') {
            if (isSelectedChat && isShowProfile)
                return '';
            return 'hidden!';
        }
        if (isSelectedChat)
            return '';
        return 'hidden!';
    }
    render() {
        const theme = configStore.get('theme');
        const isZwiz = configStore.get('isZwiz');
        const isShowWarning = String(configStore.get('isShowWarningNotification')) === 'true';
        const dialog = dialogStore.dialog;
        const hasJobs = connectionJobsStore.get('jobs').length > 0;
        console.info('Internal State', {
            Lang: this.languagePref,
            Theme: this.themeMode,
            TimeZone: this.timeZone,
            TranslateSetting: this.translationSettings,
            ConnectionList: this.connectionList,
            MemberList: this.memberList,
            NotConnected: this.isNotConnected,
            IsZwiz: this.isZwiz,
            Production: this.isProduction,
            OpenChatByFilter: this.openChatByFilter,
            Package: this.currentPackage,
        });
        console.info('Store State', {
            LangStore: configStore.get('language'),
            ThemeStore: configStore.get('theme'),
            TimeZoneStore: configStore.get('timeZone'),
            TranslateSettingStore: configStore.get('translationSettings'),
            ConnectionListStore: configStore.get('connectionList'),
            MemberListStore: configStore.get('memberList'),
            NotConnectedStore: configStore.get('isNotConnected'),
            IsZwizStore: configStore.get('isZwiz'),
            ProductionStore: configStore.get('isProduction'),
            OpenChatByFilterStore: configStore.get('openChatByFilter'),
            PackageStore: configStore.get('package'),
        });
        return (h(Host, { key: '7d39935c3258bbaafbe4ba817043ef91f28a6590', "data-theme": theme }, h("warning-notification-permission", { key: '2a6b69cdad453a2fca38e597b4f5d811cdab3899' }), this.layoutMode === 'monolith' && (h("div", { key: 'c7ffd69a0d8f586069a8cd51bc2c984d18a60f7e', id: "chat-app", class: `chat-app ${isZwiz ? 'z-zwiz-max-height' : 'z-max-height'} ${isShowWarning ? 'has-warning-notification' : ''} ${this.getGridCols()}` }, h("div", { key: '1c5678c197847df6d31d6c29052334958a40ef0c', id: "chat-panel", class: `chat-panel z-animate-grid-template-cols ${this.displayChatPanel()}` }, h("search-box", { key: '423b1b82a1226c231aa09f6998f94ae8462cfc7f' }), h("div", { key: '4f100afe2d756380bcb6dc5bb8fab7b490322674', class: "chat-panel-channel-box-wrapper scroll-container", ref: this.setContainerRef, onScroll: this.handleScroll }, h("channel-box", { key: 'e4144f70bdc892c9ef5df561e1b92d47770aa787' }), chatsStore.get('loading') && (h("div", { key: '1734da1449dbfe64b5e824597e6020ae4302f626', class: "chat-panel-channel-box-loading" }, h(Icon, { key: 'c523077fcf00ff145940d81b12f26ca0f9a5b836', name: "LoaderCircle", addClass: "chat-panel-channel-box-loading-icon" }))))), h("div", { key: 'ab7e4c3c139d38329602a86f549342674a476c57', id: "message-panel", class: `chat-app-message-box-wrapper z-animate-grid-template-cols scroll-container ${this.displayMessagePanel()}` }, h("message-box", { key: '2394d54a8c2e21d9414a8b8c9591c390517cfbdb' })), h("div", { key: 'fa2365d65351ab9781e2cf49cdc5d7d96c1ba96f', id: "user-profile", class: `user-profile z-animate-grid-template-cols ${this.displayUserProfilePanel()}` }, h("profile-tabs", { key: 'c4030f2b7c52fbcfb84e32a51970b706556cc284' })))), hasJobs && h("background-jobs", { key: '3ab8be6030b48af7e9e406cbd5324e1479a60453', onJobCompleted: this.handleJobCompleted }), dialog.open && h("z-dialog", { key: '5eb7ad8d389428dd2a13a34d92c0cf8d6fccc504' })));
    }
    static get is() { return "chat-app"; }
    static get originalStyleUrls() {
        return {
            "$": ["chat-app.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["chat-app.css"]
        };
    }
    static get deserializers() {
        return [{
                "propName": "translationSettings",
                "methodName": "deserializeTranslateSettingsArray"
            }, {
                "propName": "connectionList",
                "methodName": "deserializeTConnectionArray"
            }, {
                "propName": "memberList",
                "methodName": "deserializeChannelMemberArray"
            }, {
                "propName": "openChatByFilter",
                "methodName": "deserializeOpenChatByFilter"
            }, {
                "propName": "currentPackage",
                "methodName": "deserializeCurrentPackage"
            }];
    }
    static get properties() {
        return {
            "languagePref": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'th' | 'en'",
                    "resolved": "\"en\" | \"th\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "language-pref"
            },
            "themeMode": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'dark' | 'light'",
                    "resolved": "\"dark\" | \"light\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "theme-mode"
            },
            "businessId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "business-id"
            },
            "shopId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "shop-id"
            },
            "accessToken": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "access-token"
            },
            "isProduction": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "is-production"
            },
            "timeZone": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "time-zone"
            },
            "translationSettings": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "TranslateSettings",
                    "resolved": "{ is_auto: boolean; target_language: string; exclude_languages: string[]; }",
                    "references": {
                        "TranslateSettings": {
                            "location": "import",
                            "path": "../../store/type",
                            "id": "src/store/type.ts::TranslateSettings",
                            "referenceLocation": "TranslateSettings"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "translation-settings"
            },
            "isNotConnected": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "is-not-connected"
            },
            "isZwiz": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "is-zwiz"
            },
            "connectionList": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "TConnection[]",
                    "resolved": "TConnection[]",
                    "references": {
                        "TConnection": {
                            "location": "import",
                            "path": "../../store/type",
                            "id": "src/store/type.ts::TConnection",
                            "referenceLocation": "TConnection"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "connection-list"
            },
            "memberList": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "ChannelMember[]",
                    "resolved": "ChannelMember[]",
                    "references": {
                        "ChannelMember": {
                            "location": "import",
                            "path": "../../store/type",
                            "id": "src/store/type.ts::ChannelMember",
                            "referenceLocation": "ChannelMember"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "member-list"
            },
            "zrmzApiUrl": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "zrmz-api-url"
            },
            "openChatByFilter": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "OpenChatByFilter",
                    "resolved": "{ user_id: string; connection_id: string; channel: ChannelType; }",
                    "references": {
                        "OpenChatByFilter": {
                            "location": "import",
                            "path": "../../store/type",
                            "id": "src/store/type.ts::OpenChatByFilter",
                            "referenceLocation": "OpenChatByFilter"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "open-chat-by-filter"
            },
            "currentPackage": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "TPackageConfig",
                    "resolved": "{ name?: EnumPackage; level?: number; remainingDays?: number; maxChannel: number; maxAdmin?: number; maxStorage: number; maxTemplateMessage: number; maxChatHistory: number; }",
                    "references": {
                        "TPackageConfig": {
                            "location": "import",
                            "path": "../../store/type",
                            "id": "src/store/type.ts::TPackageConfig",
                            "referenceLocation": "TPackageConfig"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "current-package"
            },
            "isShowWarningNotification": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "is-show-warning-notification"
            },
            "zwizSyncMessage": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "zwiz-sync-message"
            },
            "layoutMode": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'monolith' | 'headless'",
                    "resolved": "\"headless\" | \"monolith\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "layout-mode",
                "defaultValue": "'monolith'"
            }
        };
    }
    static get states() {
        return {
            "nextKey": {},
            "isLoading": {}
        };
    }
    static get events() {
        return [{
                "method": "connect",
                "name": "connect",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "void",
                    "resolved": "void",
                    "references": {}
                }
            }];
    }
    static get methods() {
        return {
            "refreshData": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "getStores": {
                "complexType": {
                    "signature": "() => Promise<any>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<any>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            }
        };
    }
    static get elementRef() { return "hostElement"; }
    static get watchers() {
        return [{
                "propName": "languagePref",
                "methodName": "handleLanguageChange"
            }, {
                "propName": "themeMode",
                "methodName": "handleThemeChange"
            }, {
                "propName": "businessId",
                "methodName": "handleBusinessIdChange"
            }, {
                "propName": "shopId",
                "methodName": "handleShopIdChange"
            }, {
                "propName": "accessToken",
                "methodName": "handleAccessTokenChange"
            }, {
                "propName": "isProduction",
                "methodName": "handleIsProductionChange"
            }, {
                "propName": "timeZone",
                "methodName": "handleTimeZoneChange"
            }, {
                "propName": "translationSettings",
                "methodName": "handleTranslationSettingsChange"
            }, {
                "propName": "isNotConnected",
                "methodName": "handleIsNotConnectedChange"
            }, {
                "propName": "isZwiz",
                "methodName": "handleIsZwizChange"
            }, {
                "propName": "connectionList",
                "methodName": "handleConnectionListChange"
            }, {
                "propName": "memberList",
                "methodName": "handleMemberListChange"
            }, {
                "propName": "zrmzApiUrl",
                "methodName": "handleZrmzApiUrlChange"
            }, {
                "propName": "openChatByFilter",
                "methodName": "handleOpenChatByFilterChange"
            }, {
                "propName": "currentPackage",
                "methodName": "handleCurrentPackageChange"
            }, {
                "propName": "isShowWarningNotification",
                "methodName": "handleIsShowWarningNotificationChange"
            }, {
                "propName": "zwizSyncMessage",
                "methodName": "handleZwizSyncMessageChange"
            }];
    }
    static get listeners() {
        return [{
                "name": "click",
                "method": "handleClick",
                "target": undefined,
                "capture": false,
                "passive": false
            }];
    }
}
