import { p as proxyCustomElement, H, f as forceUpdate, h } from './p-C6Ye8jK5.js';
import { E as EventBus } from './p-S9juR7eS.js';
import { s as state, r as resetState } from './p-Us3IUV03.js';
import { d as defineCustomElement$5 } from './p-BoVsYek2.js';
import { d as defineCustomElement$4 } from './p-DAW0tbcX.js';
import { d as defineCustomElement$3 } from './p-D6abh916.js';
import { d as defineCustomElement$2 } from './p-B6XigyR5.js';

var SignEventsEnum;
(function (SignEventsEnum) {
    SignEventsEnum["CONFIRM"] = "CONFIRM";
    SignEventsEnum["BACK"] = "BACK";
    SignEventsEnum["DATA_UPDATE"] = "DATA_UPDATE";
    SignEventsEnum["SET_PPU"] = "SET_PPU";
    SignEventsEnum["OPEN_SIGN_TRANSACTIONS_PANEL"] = "OPEN_SIGN_TRANSACTIONS_PANEL";
    SignEventsEnum["CLOSE_SIGN_TRANSACTIONS_PANEL"] = "CLOSE_SIGN_TRANSACTIONS_PANEL";
})(SignEventsEnum || (SignEventsEnum = {}));

const signTransactionsPanelCss = "/*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */@layer theme{:host,:root{--mvx-font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--mvx-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--mvx-default-font-family:var(--mvx-font-sans);--mvx-default-mono-font-family:var(--mvx-font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--mvx-default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--mvx-default-font-feature-settings,normal);font-variation-settings:var(--mvx-default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--mvx-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--mvx-default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--mvx-default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentColor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components,utilities; /*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities;.transaction-header-container{display:flex;flex-direction:column}.loading-spinner{align-items:center;display:flex;justify-content:center;min-height:350px}.sign-transactions-panel{background-color:#fff;box-shadow:0 4px 12px #00000026;max-width:100%;padding:0;width:450px}.sign-transactions-content{display:flex;flex-direction:column;height:100%;padding:24px}.sign-transactions-header{border-bottom:1px solid #0000001a;margin-bottom:24px;padding-bottom:16px}.sign-transactions-header h2{font-size:20px;font-weight:600;margin-bottom:8px}.sign-transactions-header h4{color:#0009;font-size:14px;font-weight:400}.sign-transactions-body{flex:1;overflow-y:auto}";

const signScreens = {
    FungibleESDT: 'token-component',
    SemiFungibleESDT: 'fungible-component',
    NonFungibleESDT: 'fungible-component',
    MetaESDT: 'token-component',
};
const SignTransactionsPanel = /*@__PURE__*/ proxyCustomElement(class SignTransactionsPanel extends H {
    constructor() {
        super();
        this.__registerHost();
        this.eventBus = new EventBus();
        this.isOpen = false;
        this.data = {
            commonData: {
                egldLabel: '',
                feeLimit: '',
                feeInFiatLimit: '',
                transactionsCount: 0,
                currentIndex: 0,
                ppuOptions: [],
            },
            tokenTransaction: null,
            nftTransaction: null,
            sftTransaction: null,
        };
    }
    componentWillLoad() {
        state.onCancel = () => {
            this.onClose({ isUserClick: true });
        };
        state.onConfirm = () => {
            this.eventBus.publish(SignEventsEnum.CONFIRM);
        };
        state.onBack = () => {
            this.eventBus.publish(SignEventsEnum.BACK);
        };
        state.onSetPpu = (ppu) => {
            this.eventBus.publish(SignEventsEnum.SET_PPU, ppu);
        };
    }
    componentDidLoad() {
        this.eventBus.subscribe(SignEventsEnum.DATA_UPDATE, this.dataUpdate.bind(this));
        this.eventBus.subscribe(SignEventsEnum.OPEN_SIGN_TRANSACTIONS_PANEL, this.handleOpen.bind(this));
        this.eventBus.subscribe(SignEventsEnum.CLOSE_SIGN_TRANSACTIONS_PANEL, this.onClose.bind(this, { isUserClick: false }));
    }
    disconnectedCallback() {
        resetState();
        this.eventBus.unsubscribe(SignEventsEnum.DATA_UPDATE, this.dataUpdate.bind(this));
        this.eventBus.unsubscribe(SignEventsEnum.OPEN_SIGN_TRANSACTIONS_PANEL, this.handleOpen.bind(this));
        this.eventBus.unsubscribe(SignEventsEnum.CLOSE_SIGN_TRANSACTIONS_PANEL, this.onClose.bind(this, { isUserClick: false }));
    }
    handleOpen() {
        this.isOpen = true;
    }
    handleClose() {
        this.isOpen = false;
        this.onClose({ isUserClick: true });
    }
    onClose(props = { isUserClick: true }) {
        this.isOpen = false;
        resetState();
        if (props.isUserClick) {
            this.eventBus.publish(SignEventsEnum.CLOSE_SIGN_TRANSACTIONS_PANEL);
        }
    }
    dataUpdate(payload) {
        this.data = Object.assign({}, payload);
        forceUpdate(this);
    }
    onDataChange(data) {
        for (const key in data) {
            if (Object.prototype.hasOwnProperty.call(state, key)) {
                state[key] = data[key];
            }
        }
        state.isWaitingForSignature = false;
        state.isLoading = false;
    }
    async getEventBus() {
        return this.eventBus;
    }
    render() {
        const { commonData, isLoading } = state;
        const { tokenType, currentIndex, transactionsCount } = commonData;
        const SignScreen = signScreens[tokenType];
        return (h("mvx-side-panel", { key: 'f5b19ad06601b8b8132db8c89201c57a84705f1b', isOpen: this.isOpen, panelClassName: "sign-transactions-panel", onClose: this.handleClose.bind(this) }, h("div", { key: '78d8c0e08c4cac94918b21bd5ee2ba657893045b', class: "sign-transactions-content" }, h("div", { key: '582075c236994a1e80285e7a5242619af15b5085', class: "sign-transactions-header" }, h("h2", { key: 'e5bd15e0d32067f8c64c2b852f2ac490d1242752' }, "Sign transaction"), h("h4", { key: '070cfa235bec8152978c34899fb5665dea1565d7' }, "Transaction ", currentIndex + 1, " of ", transactionsCount)), h("div", { key: '70ef74abb16a5f97640e9a2ccce162135311dd79', class: "sign-transactions-body" }, isLoading ? (h("div", { class: "loading-spinner" }, h("mvx-generic-spinner", null))) : (h(SignScreen, null))))));
    }
    static get watchers() { return {
        "data": ["onDataChange"]
    }; }
    static get style() { return signTransactionsPanelCss; }
}, [0, "mvx-sign-transactions-panel", {
        "data": [16],
        "isOpen": [32],
        "getEventBus": [64]
    }, undefined, {
        "data": ["onDataChange"]
    }]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["mvx-sign-transactions-panel", "mvx-back-arrow-icon", "mvx-close-icon", "mvx-generic-spinner", "mvx-side-panel"];
    components.forEach(tagName => { switch (tagName) {
        case "mvx-sign-transactions-panel":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, SignTransactionsPanel);
            }
            break;
        case "mvx-back-arrow-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$5();
            }
            break;
        case "mvx-close-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$4();
            }
            break;
        case "mvx-generic-spinner":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "mvx-side-panel":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}

const MvxSignTransactionsPanel = SignTransactionsPanel;
const defineCustomElement = defineCustomElement$1;

export { MvxSignTransactionsPanel, defineCustomElement };
//# sourceMappingURL=mvx-sign-transactions-panel.js.map

//# sourceMappingURL=mvx-sign-transactions-panel.js.map