import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-fb899b9a.js';
import { a as faTimes } from './index-83df969e.js';
import { c as classNames } from './index-097075ad.js';
import { D as DataTestIdsEnum } from './dataTestIds.enum-55de9911.js';
import { g as getIconHtmlFromIconDefinition } from './getIconHtmlFromIconDefinition-2377fd50.js';
import { g as getIconHtmlFromIconName } from './getIconHtmlFromIconName-84400bd5.js';

const TransactionToast = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.handleDeleteToast = createEvent(this, "handleDeleteToast", 7);
        this.toastId = '';
        this.processedTransactionsStatus = '';
        this.transactions = [];
    }
    onDeleteToast() {
        this.handleDeleteToast.emit(this.toastId);
    }
    render() {
        var _a, _b;
        return (h("transaction-toast-wrapper", { key: '31a7aca5e321b2a6a49bdd4dc17d6c15af316094', wrapperId: `toast-${this.toastId}`, wrapperClass: this.wrapperClass }, h("transaction-toast-progress", { key: this.toastId, startTime: (_a = this.transactionProgressState) === null || _a === void 0 ? void 0 : _a.startTime, endTime: (_b = this.transactionProgressState) === null || _b === void 0 ? void 0 : _b.endTime }, h("transaction-toast-content", { key: '16de241eba94591c8027b517e5c21b09099feb60', onDeleteToast: this.onDeleteToast.bind(this), processedTransactionsStatus: this.processedTransactionsStatus, toastDataState: this.toastDataState, transactions: this.transactions }))));
    }
};

const transactionToastContentCss = "*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;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}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.block{display:block}.flex{display:flex}.hidden{display:none}.border{border-width:1px}.content,.content-left{align-items:center;display:flex}.content-left{flex-direction:column;justify-content:center;padding-left:.5rem;padding-right:.75rem}.success{background-color:#5cb85c}.warning{background-color:#ffc107}.danger{background-color:#d9534f}.content-icon{align-items:center;border-radius:50%;display:flex;height:3rem;justify-content:center;width:3rem;svg{height:auto;width:20px;path{fill:#fff}}}.icon-close{align-items:center;background-color:transparent;border:0;color:#000;cursor:pointer;display:flex;float:right;font-size:1.5rem;font-weight:700;line-height:1;margin:0 .5rem;opacity:.5;padding:0;text-shadow:0 1px 0 #fff;width:12px}.content-right{display:block;overflow:hidden;width:100%}.content-heading{display:flex;justify-content:space-between;margin-bottom:.25rem}.content-heading-title{font-size:1.25rem;font-weight:500;line-height:1.2;margin:0 0 .5rem}.static{position:static}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.visible{visibility:visible}.fixed{position:fixed}.\\!container{width:100%!important}.container{width:100%}@media (min-width:640px){.\\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width:768px){.\\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width:1024px){.\\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width:1280px){.\\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width:1536px){.\\!container{max-width:1536px!important}.container{max-width:1536px}}";
const TransactionToastContentStyle0 = transactionToastContentCss;

const TransactionToastContent = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.deleteToast = createEvent(this, "deleteToast", 7);
    }
    handleDeleteToast() {
        this.deleteToast.emit();
    }
    render() {
        const { icon, iconClassName, title, hasCloseButton } = this.toastDataState;
        let iconHtml = null;
        if (typeof icon === 'string') {
            iconHtml = getIconHtmlFromIconName(icon);
        }
        if (icon instanceof HTMLElement) {
            iconHtml = icon.outerHTML;
        }
        return (h("div", { key: '272a0b2e0b12941a69c205e0de247f06a0b69497', class: "content", "data-testid": DataTestIdsEnum.transactionToastContent }, h("div", { key: '3c88c7553415a66bb4de14e4ea54fd85722ab89b', class: "content-left" }, h("div", { key: '3bb28edcdd0a9caf307d4c05fef328b00ee3ec4d', class: classNames('content-icon', iconClassName), innerHTML: iconHtml })), h("div", { key: 'b42bb2f2390d9eccac74854727f2010b958c5533', class: "content-right" }, h("div", { key: '3cca3eb7037588d171d4c8ecd720242b2278cadb', class: "content-heading" }, h("h5", { key: 'be550bbed4d3f1c7f752d8b762cfc2bd3b517ebe', class: "content-heading-title", "data-testid": DataTestIdsEnum.transactionToastTitle }, title), hasCloseButton && h("button", { key: '349c4c22ea092dc731bc92dd2b954af98f35475a', onClick: this.handleDeleteToast.bind(this), type: "button", class: "icon-close", innerHTML: getIconHtmlFromIconDefinition(faTimes) })), h("div", { key: 'a89fad6b4f2da35b6d9a628446adfe70d235fbdb', class: "content-heading-title" }, h("transaction-toast-details", { key: '94a907f15061c053c1db9223153fb8885745b2f8', transactions: this.transactions, processedTransactionsStatus: this.processedTransactionsStatus })))));
    }
};
TransactionToastContent.style = TransactionToastContentStyle0;

const transactionToastProgressCss = "*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;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}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.flex{display:flex}.hidden{display:none}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes progressiveFixedWidthExpansion{0%{width:min(var(--start-width,0%),80%)}to{width:80%}}@keyframes progressiveInfiniteWidthExpansion{0%{width:min(var(--start-width,0%),100%)}to{width:100%}}@keyframes quickWidthExpansion{0%{width:0}to{width:100%}}.transaction-toast-progress{position:relative}.transaction-toast-bar-wrapper{background-color:#d3d3d3;border-radius:.25rem;bottom:0;display:flex;flex-direction:row-reverse;left:0;opacity:25%;overflow:hidden;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .25s ease-in}.transaction-toast-bar{bottom:0;height:100%;right:0;top:0}.transaction-toast-bar.fixed{animation-duration:var(--animation-duration,6s);animation-fill-mode:forwards;animation-name:progressiveFixedWidthExpansion;animation-timing-function:cubic-bezier(.5,.95,0,.35);background-color:#fff;width:min(var(--start-width,0%),50%)}.transaction-toast-bar.infinite{display:flex;flex-direction:row-reverse;width:20%}.transaction-toast-bar.infinite .transaction-toast-bar-line{animation-delay:var(--animation-delay,6s);animation-duration:var(--animation-duration,60s);animation-fill-mode:forwards;animation-name:progressiveInfiniteWidthExpansion;animation-timing-function:cubic-bezier(.1,.95,.25,.75);background-color:#fff;height:100%;position:relative;width:0}.transaction-toast-bar.infinite .transaction-toast-bar-line:before{background-color:#fff;bottom:0;content:\"\";position:absolute;right:-1px;top:0;width:2px}.transaction-toast-bar.fill{background-color:#fff;position:absolute;width:0}.transaction-toast-bar.fill.animate{animation:quickWidthExpansion .25s linear forwards}.transaction-toast-bar-content{position:relative;z-index:1}.static{position:static}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.visible{visibility:visible}.\\!container{width:100%!important}.container{width:100%}@media (min-width:640px){.\\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width:768px){.\\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width:1024px){.\\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width:1280px){.\\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width:1536px){.\\!container{max-width:1536px!important}.container{max-width:1536px}}";
const TransactionToastProgressStyle0 = transactionToastProgressCss;

const DEFAULT_INFINITE_ANIMATION_DURATION = 30;
const ToastProgress = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.currentTimestamp = Date.now() / 1000;
        this.hasTimeElapsed = false;
        this.expectedTransactionDuration = 0;
        this.secondsPassedSinceStart = 0;
        this.shouldShowProgressBar = false;
        this.percentagePassedSinceStart = 0;
        this.shouldQuickFill = false;
        this.infiniteProgressDelay = 0;
        this.infinitePercentagePassedSinceStart = 0;
        this.infinitePercentageAnimationDuration = DEFAULT_INFINITE_ANIMATION_DURATION + (this.endTime - this.startTime) * 2;
    }
    componentWillLoad() {
        this.updateProgress();
    }
    handleTimeChange() {
        this.updateProgress();
    }
    updateProgress() {
        this.shouldShowProgressBar = Boolean(this.endTime) && Boolean(this.startTime);
        if (!this.shouldShowProgressBar) {
            this.shouldQuickFill = true;
            this.timeElapsedTimeoutReference = setTimeout(() => (this.hasTimeElapsed = true), 500);
            return;
        }
        this.currentTimestamp = Date.now() / 1000;
        this.expectedTransactionDuration = this.endTime - this.startTime;
        this.secondsPassedSinceStart = this.currentTimestamp - this.startTime;
        this.percentagePassedSinceStart = this.expectedTransactionDuration > 0 ? (this.secondsPassedSinceStart / this.expectedTransactionDuration) * 100 : 0;
        this.infiniteProgressDelay = Math.max(0, this.expectedTransactionDuration - this.secondsPassedSinceStart);
        this.infinitePercentagePassedSinceStart = (this.secondsPassedSinceStart / (this.expectedTransactionDuration + this.infinitePercentageAnimationDuration)) * 100;
    }
    disconnectedCallback() {
        if (this.timeElapsedTimeoutReference) {
            clearTimeout(this.timeElapsedTimeoutReference);
        }
    }
    render() {
        return (h(Fragment, { key: '3badff7661e8f31c132bc7604ede5d7a721fbd81' }, h("div", { key: 'd80ac32f690cfe214da88e7ec1f76126bc76a5d6', class: "transaction-toast-bar-wrapper", style: { opacity: this.hasTimeElapsed ? '0' : '1' } }, h("div", { key: '70fc37ab2ce5cbb3d9a8c102777ce13998907ba1', class: "transaction-toast-bar fixed", style: {
                '--animation-duration': `${this.expectedTransactionDuration}s`,
                '--start-width': `${this.percentagePassedSinceStart}%`,
            } }), h("div", { key: '2e2b6a86e26fcb0f31ab7c57e9df172a701d55c5', class: "transaction-toast-bar infinite" }, h("div", { key: '7b477dbe7d80072f8772b5312ea487e1ec0e4772', class: "transaction-toast-bar-line", style: {
                '--start-width': `${this.infinitePercentagePassedSinceStart}%`,
                '--animation-duration': `${this.infinitePercentageAnimationDuration}s`,
                '--animation-delay': `${this.infiniteProgressDelay}s`,
            } })), h("div", { key: '69b898c700421df20ba80b80d22e902fb2a95f33', class: classNames('transaction-toast-bar fill', {
                animate: this.shouldQuickFill,
            }) })), h("div", { key: '45984b995a0035da9a3f9493a0c4b54c5b2ac9c2', class: "transaction-toast-bar-content" }, h("slot", { key: '831de91dafa913f66e3e4903a69aaa93a1e16697' }))));
    }
    static get watchers() { return {
        "startTime": ["handleTimeChange"],
        "endTime": ["handleTimeChange"]
    }; }
};
ToastProgress.style = TransactionToastProgressStyle0;

export { TransactionToast as transaction_toast, TransactionToastContent as transaction_toast_content, ToastProgress as transaction_toast_progress };

//# sourceMappingURL=transaction-toast_3.entry.js.map