@spot-flow/checkout-inline-js 0.1.33-dev.1 → 0.1.33-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(Ne,xe){typeof exports=="object"&&typeof module<"u"?xe(exports):typeof define=="function"&&define.amd?define(["exports"],xe):(Ne=typeof globalThis<"u"?globalThis:Ne||self,xe(Ne.SpotflowCheckout={}))})(this,function(Ne){"use strict";var pc=Object.defineProperty;var bc=(Ne,xe,Ln)=>xe in Ne?pc(Ne,xe,{enumerable:!0,configurable:!0,writable:!0,value:Ln}):Ne[xe]=Ln;var h=(Ne,xe,Ln)=>bc(Ne,typeof xe!="symbol"?xe+"":xe,Ln);var xe=document.createElement("style");xe.textContent=`*:where(#checkout-modal,#checkout-modal *),:before:where(#checkout-modal,#checkout-modal *),:after:where(#checkout-modal,#checkout-modal *){box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before:where(#checkout-modal,#checkout-modal *),:after:where(#checkout-modal,#checkout-modal *){--tw-content: ""}#checkout-modal{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:IBM Plex Sans,Inter,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}#checkout-modal{margin:0;line-height:inherit}hr:where(#checkout-modal,#checkout-modal *){height:0;color:inherit;border-top-width:1px}abbr:where([title]):where(#checkout-modal,#checkout-modal *){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1:where(#checkout-modal,#checkout-modal *),h2:where(#checkout-modal,#checkout-modal *),h3:where(#checkout-modal,#checkout-modal *),h4:where(#checkout-modal,#checkout-modal *),h5:where(#checkout-modal,#checkout-modal *),h6:where(#checkout-modal,#checkout-modal *){font-size:inherit;font-weight:inherit}a:where(#checkout-modal,#checkout-modal *){color:inherit;text-decoration:inherit}b:where(#checkout-modal,#checkout-modal *),strong:where(#checkout-modal,#checkout-modal *){font-weight:bolder}code:where(#checkout-modal,#checkout-modal *),kbd:where(#checkout-modal,#checkout-modal *),samp:where(#checkout-modal,#checkout-modal *),pre:where(#checkout-modal,#checkout-modal *){font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small:where(#checkout-modal,#checkout-modal *){font-size:80%}sub:where(#checkout-modal,#checkout-modal *),sup:where(#checkout-modal,#checkout-modal *){font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub:where(#checkout-modal,#checkout-modal *){bottom:-.25em}sup:where(#checkout-modal,#checkout-modal *){top:-.5em}table:where(#checkout-modal,#checkout-modal *){text-indent:0;border-color:inherit;border-collapse:collapse}button:where(#checkout-modal,#checkout-modal *),input:where(#checkout-modal,#checkout-modal *),optgroup:where(#checkout-modal,#checkout-modal *),select:where(#checkout-modal,#checkout-modal *),textarea:where(#checkout-modal,#checkout-modal *){font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button:where(#checkout-modal,#checkout-modal *),select:where(#checkout-modal,#checkout-modal *){text-transform:none}button:where(#checkout-modal,#checkout-modal *),input:where([type=button]):where(#checkout-modal,#checkout-modal *),input:where([type=reset]):where(#checkout-modal,#checkout-modal *),input:where([type=submit]):where(#checkout-modal,#checkout-modal *){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring:where(#checkout-modal,#checkout-modal *){outline:auto}:-moz-ui-invalid:where(#checkout-modal,#checkout-modal *){box-shadow:none}progress:where(#checkout-modal,#checkout-modal *){vertical-align:baseline}::-webkit-inner-spin-button:where(#checkout-modal,#checkout-modal *),::-webkit-outer-spin-button:where(#checkout-modal,#checkout-modal *){height:auto}[type=search]:where(#checkout-modal,#checkout-modal *){-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration:where(#checkout-modal,#checkout-modal *){-webkit-appearance:none}::-webkit-file-upload-button:where(#checkout-modal,#checkout-modal *){-webkit-appearance:button;font:inherit}summary:where(#checkout-modal,#checkout-modal *){display:list-item}blockquote:where(#checkout-modal,#checkout-modal *),dl:where(#checkout-modal,#checkout-modal *),dd:where(#checkout-modal,#checkout-modal *),h1:where(#checkout-modal,#checkout-modal *),h2:where(#checkout-modal,#checkout-modal *),h3:where(#checkout-modal,#checkout-modal *),h4:where(#checkout-modal,#checkout-modal *),h5:where(#checkout-modal,#checkout-modal *),h6:where(#checkout-modal,#checkout-modal *),hr:where(#checkout-modal,#checkout-modal *),figure:where(#checkout-modal,#checkout-modal *),p:where(#checkout-modal,#checkout-modal *),pre:where(#checkout-modal,#checkout-modal *){margin:0}fieldset:where(#checkout-modal,#checkout-modal *){margin:0;padding:0}legend:where(#checkout-modal,#checkout-modal *){padding:0}ol:where(#checkout-modal,#checkout-modal *),ul:where(#checkout-modal,#checkout-modal *),menu:where(#checkout-modal,#checkout-modal *){list-style:none;margin:0;padding:0}dialog:where(#checkout-modal,#checkout-modal *){padding:0}textarea:where(#checkout-modal,#checkout-modal *){resize:vertical}input::-moz-placeholder:where(#checkout-modal,#checkout-modal *),textarea::-moz-placeholder:where(#checkout-modal,#checkout-modal *){opacity:1;color:#9ca3af}input::placeholder:where(#checkout-modal,#checkout-modal *),textarea::placeholder:where(#checkout-modal,#checkout-modal *){opacity:1;color:#9ca3af}button:where(#checkout-modal,#checkout-modal *),[role=button]:where(#checkout-modal,#checkout-modal *){cursor:pointer}:disabled:where(#checkout-modal,#checkout-modal *){cursor:default}img:where(#checkout-modal,#checkout-modal *),svg:where(#checkout-modal,#checkout-modal *),video:where(#checkout-modal,#checkout-modal *),canvas:where(#checkout-modal,#checkout-modal *),audio:where(#checkout-modal,#checkout-modal *),iframe:where(#checkout-modal,#checkout-modal *),embed:where(#checkout-modal,#checkout-modal *),object:where(#checkout-modal,#checkout-modal *){display:block;vertical-align:middle}img:where(#checkout-modal,#checkout-modal *),video:where(#checkout-modal,#checkout-modal *){max-width:100%;height:auto}[hidden]:where(#checkout-modal,#checkout-modal *){display:none}:root{--primary: 264, 52%, 6%;--primary-light: 266, 21%, 76%;--primary-10: 240, 39%, 86%, 1;--primary-lighter: 240, 100%, 98%;--primary-dark: 240, 39%, 52%;--primary-darker: 240, 100%, 28%;--success: 151, 58%, 46%;--error: 0, 74%, 48%;--error-dark: 19, 100%, 37%;--common: 60, 4%, 43%;--tone-10: 240, 2%, 90%;--tone-40: 202, 6%, 82%;--tone-50: 202, 4%, 68%;--tone-60: 260, 4%, 43%, 1;--tone-70: 266, 3%, 53%;--tone-80: 265, 10%, 24%, 1;--tone-90: 266, 18%, 15%;--tone-100: 266, 54%, 6%;--grey: 218, 15%, 65%;--grey-100: 270, 3%, 62%;--grey-200: 264, 3%, 72%;--grey-300: 260, 3%, 81%;--grey-400: 264, 6%, 34%;--grey-500: 217, 24%, 27%;--grey-600: 265, 10%, 24%;--grey-700: 260, 4%, 43%;--grey-800: 265, 21%, 76%;--grey-faint: 240, 7%, 97%;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}input:focus,button:focus{outline:none}*,:before,:after{--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: rgb(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: }::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: rgb(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: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.container-center{display:flex;align-items:center;justify-content:center}.hide-scrollbar::-webkit-scrollbar{display:none!important}.hide-scrollbar{-ms-overflow-style:none!important;scrollbar-width:none!important}.container-between{display:flex;align-items:center;justify-content:space-between}.align-center{display:flex;align-items:center}.box-container{padding-left:0;padding-right:0;padding-top:1rem;padding-bottom:1rem}@media (min-width: 768px){.box-container{padding:1.75rem 1.25rem}}@media (min-width: 1024px){.box-container{padding-left:1.75rem;padding-right:1.75rem}}.button-fill{display:flex;height:2.5rem;align-items:center;justify-content:center;border-radius:.5rem;background-color:hsl(var(--primary));font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.button-outline{display:flex;height:2.5rem;align-items:center;justify-content:center;border-radius:.5rem;border-width:1px;border-color:hsl(var(--tone-100));font-size:.875rem;line-height:1.25rem;font-weight:600;color:hsl(var(--tone-100))}.payment-options{display:flex;width:100%;flex-direction:column;overflow:hidden}.tab{margin-bottom:.75rem;display:flex;align-items:center;justify-content:flex-start;text-align:left}.tab-button{display:flex;width:100%;flex-grow:1;align-items:center;border-radius:.5rem;border-width:1px;border-color:hsl(var(--grey-100));padding:.75rem 1.25rem;text-align:center;color:hsl(var(--primary))}.tab-button:disabled{cursor:not-allowed;opacity:.4}.tab-button:hover:disabled{border-color:#11032666;color:hsl(var(--primary) / .4)}@media (min-width: 768px){.tab-button{display:flex;justify-content:center}.tab-button:hover{border-color:hsl(var(--primary))}}.tab-button.active{border-width:2px;border-color:hsl(var(--primary))}.tab-button.active span{font-weight:700}.tab-button span{margin-top:.25rem;margin-bottom:.25rem;display:flex;flex-shrink:0;justify-content:center}@media (min-width: 768px){.tab-button span{font-size:.875rem;line-height:1.25rem}}@media (min-width: 1024px){.tab-button span{justify-content:flex-start}}.main{max-height:98dvh;width:100%;overflow:auto}@media (min-width: 768px){.main{padding-top:1rem;padding-bottom:1rem}}@media (min-width: 1024px){.main{width:calc(100% - 250px);padding-left:1rem;padding-right:1rem}}.header-container{border-radius:.75rem;padding:2.5rem 1rem;color:hsl(var(--primary))}@media (min-width: 768px){.header-container{padding:1.25rem 2.25rem}}.tooltip{position:absolute;left:-3rem;top:20px;margin-bottom:1.25rem;display:none;width:auto;flex-direction:column;align-items:center}.group:hover .tooltip{display:flex}@media (min-width: 768px){.tooltip{left:0}}.tooltip-textbox{position:relative;z-index:10;border-radius:.5rem;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));padding:.5rem;font-size:.75rem;line-height:1rem;--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}@media (min-width: 768px){.tooltip-textbox{padding:.75rem 1rem}}.tooltip-text{font-size:13px;line-height:17.4px;letter-spacing:.025em;color:hsl(var(--grey))}.details-input-container{width:100%;border-width:1px;border-style:none;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));font-weight:600;color:hsl(var(--tone-100))}.details-input-container::-moz-placeholder{font-size:.875rem;line-height:1.25rem;color:hsl(var(--tone-100))}.details-input-container::placeholder{font-size:.875rem;line-height:1.25rem;color:hsl(var(--tone-100))}.details-input-container:focus{outline:2px solid transparent;outline-offset:2px}.details-input-container:focus-visible{outline:2px solid transparent!important;outline-offset:2px!important}.avs-input-container{width:100%;border-radius:.25rem;border-width:1px;border-color:hsl(var(--tone-40));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));padding:1.5rem .75rem .5rem;color:hsl(var(--tone-100))}.avs-input-container:focus{border-color:hsl(var(--grey-100));outline:2px solid transparent;outline-offset:2px}.avs-input-container:focus-visible{outline:2px solid transparent!important;outline-offset:2px!important}.mm-input-container{width:100%;border-radius:.5rem;border-width:1px;border-color:hsl(var(--tone-40));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));padding:1.5rem .75rem .5rem;color:hsl(var(--tone-100))}.mm-input-container::-moz-placeholder{color:hsl(var(--tone-50))}.mm-input-container::placeholder{color:hsl(var(--tone-50))}.mm-input-container:focus{border-color:hsl(var(--grey-100));outline:2px solid transparent;outline-offset:2px}.mm-input-container:focus-visible{outline:2px solid transparent!important;outline-offset:2px!important}.details-form-button{display:inline-flex;height:50px;width:100%;align-items:center;justify-content:center;border-radius:.5rem;background-color:hsl(var(--primary));font-size:.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.details-form-button:focus{outline:2px solid transparent;outline-offset:2px}.details-form-button:disabled{background-color:hsl(var(--grey-100));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.pin-input{height:3.5rem;width:4rem;border-radius:.5rem;border-width:1px;border-color:hsla(var(--tone-90));text-align:center;font-size:1.125rem;line-height:1.75rem}.pin-input:focus{border-color:hsl(var(--primary));outline:2px solid transparent;outline-offset:2px}@media (min-width: 768px){.pin-input{height:3.5rem;width:6rem}}.otp-input{width:100%;border-radius:.5rem;border-width:1px;border-color:hsla(var(--tone-90));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));padding:.75rem;font-size:1.5rem;line-height:2rem;font-weight:700}.otp-input:focus{outline:2px solid transparent;outline-offset:2px}.otp-button{height:3.5rem;width:100%;border-radius:.5rem;background-color:hsl(var(--tone-100));padding-left:1.5rem;padding-right:1.5rem;font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.otp-button:disabled{background-color:hsl(var(--grey-100))}.warning-text,.success-text{margin-top:1rem;margin-bottom:1rem;margin-left:auto;margin-right:auto;text-align:center;font-weight:600;color:hsl(var(--grey-400))}.warning-list{margin-left:auto;margin-right:auto;margin-top:.25rem}@media (min-width: 768px){.warning-list{margin-top:.5rem}}.warning-button,.success-button{margin-bottom:1rem;width:100%;border-radius:.5rem;border-width:1px;border-color:hsl(var(--grey-800));padding:1rem;text-align:center;font-size:.875rem;line-height:1.25rem;font-weight:600;color:hsl(var(--grey-400))}.transfer-close{margin-bottom:1rem;width:200px;border-radius:.5rem;background-color:hsl(var(--success));padding:1rem;text-align:center;font-size:.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}#bank-search-input{width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:2px solid transparent;outline-offset:2px}#bank-select-container{display:flex;gap:.75rem;border-radius:.5rem;border-width:1px;border-color:hsl(var(--primary-light));padding:1rem}#bank-code-span{border-radius:.25rem;background-color:hsla(var(--primary-10));padding:.25rem;color:hsla(var(--tone-60))}.spinner{margin-right:.75rem;height:2rem;width:2rem}.spinner{animation:spin 1s linear infinite;fill:#fff}.transaction-issues-input{display:flex;height:3.5rem;width:100%;-webkit-user-select:all;-moz-user-select:all;user-select:all;border-radius:.5rem;border-width:1px;border-style:none;--tw-bg-opacity: 1;background-color:rgb(247 248 251 / var(--tw-bg-opacity));padding-left:1rem;padding-right:1rem;padding-top:1.25rem;padding-bottom:0;color:hsl(var(--tone-100));outline:2px solid transparent!important;outline-offset:2px!important;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transaction-issues-input:disabled{cursor:not-allowed;opacity:.5}.transaction-issues-input-placeholder{pointer-events:none;position:absolute;top:1rem;bottom:1rem;left:.75rem;z-index:20;margin:0;display:flex;height:-moz-fit-content;height:fit-content;--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;padding-left:.25rem;padding-right:.25rem;font-size:.625rem;color:hsla(var(--tone-70));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.peer:-moz-placeholder-shown~.transaction-issues-input-placeholder{margin:auto;--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));padding-left:0;padding-right:0;font-size:.875rem;line-height:1.25rem}.peer:placeholder-shown~.transaction-issues-input-placeholder{margin:auto;--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));padding-left:0;padding-right:0;font-size:.875rem;line-height:1.25rem}.peer:focus~.transaction-issues-input-placeholder{margin:0;--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));padding-left:.25rem;padding-right:.25rem;font-size:.625rem}#checkout-modal .static{position:static}#checkout-modal .fixed{position:fixed}#checkout-modal .absolute{position:absolute}#checkout-modal .relative{position:relative}#checkout-modal .inset-0{top:0;right:0;bottom:0;left:0}#checkout-modal .inset-y-4{top:1rem;bottom:1rem}#checkout-modal .left-0{left:0}#checkout-modal .right-4{right:1rem}#checkout-modal .top-0{top:0}#checkout-modal .top-1{top:.25rem}#checkout-modal .top-1\\/2{top:50%}#checkout-modal .top-5{top:1.25rem}#checkout-modal .z-10{z-index:10}#checkout-modal .z-30{z-index:30}#checkout-modal .z-\\[3000\\]{z-index:3000}#checkout-modal .order-1{order:1}#checkout-modal .order-2{order:2}#checkout-modal .mx-5{margin-left:1.25rem;margin-right:1.25rem}#checkout-modal .mx-\\[18px\\]{margin-left:18px;margin-right:18px}#checkout-modal .mx-auto{margin-left:auto;margin-right:auto}#checkout-modal .my-3{margin-top:.75rem;margin-bottom:.75rem}#checkout-modal .mb-1{margin-bottom:.25rem}#checkout-modal .mb-2{margin-bottom:.5rem}#checkout-modal .mb-3{margin-bottom:.75rem}#checkout-modal .mb-4{margin-bottom:1rem}#checkout-modal .mb-5{margin-bottom:1.25rem}#checkout-modal .mb-7{margin-bottom:1.75rem}#checkout-modal .mb-8{margin-bottom:2rem}#checkout-modal .ml-1{margin-left:.25rem}#checkout-modal .ml-20{margin-left:5rem}#checkout-modal .ml-9{margin-left:2.25rem}#checkout-modal .ml-auto{margin-left:auto}#checkout-modal .mr-1{margin-right:.25rem}#checkout-modal .mr-11{margin-right:2.75rem}#checkout-modal .mt-1{margin-top:.25rem}#checkout-modal .mt-10{margin-top:2.5rem}#checkout-modal .mt-2{margin-top:.5rem}#checkout-modal .mt-3{margin-top:.75rem}#checkout-modal .mt-4{margin-top:1rem}#checkout-modal .mt-5{margin-top:1.25rem}#checkout-modal .mt-6{margin-top:1.5rem}#checkout-modal .mt-7{margin-top:1.75rem}#checkout-modal .mt-8{margin-top:2rem}#checkout-modal .block{display:block}#checkout-modal .inline-block{display:inline-block}#checkout-modal .flex{display:flex}#checkout-modal .grid{display:grid}#checkout-modal .contents{display:contents}#checkout-modal .hidden{display:none}#checkout-modal .h-12{height:3rem}#checkout-modal .h-3{height:.75rem}#checkout-modal .h-8{height:2rem}#checkout-modal .h-\\[22px\\]{height:22px}#checkout-modal .h-\\[40dvh\\]{height:40dvh}#checkout-modal .h-\\[40vh\\]{height:40vh}#checkout-modal .h-\\[50px\\]{height:50px}#checkout-modal .h-auto{height:auto}#checkout-modal .h-full{height:100%}#checkout-modal .max-h-screen{max-height:100vh}#checkout-modal .min-h-\\[30dvh\\]{min-height:30dvh}#checkout-modal .min-h-\\[40dvh\\]{min-height:40dvh}#checkout-modal .min-h-full{min-height:100%}#checkout-modal .min-h-screen{min-height:100vh}#checkout-modal .w-0{width:0px}#checkout-modal .w-11\\/12{width:91.666667%}#checkout-modal .w-12{width:3rem}#checkout-modal .w-14{width:3.5rem}#checkout-modal .w-16{width:4rem}#checkout-modal .w-3{width:.75rem}#checkout-modal .w-4\\/5{width:80%}#checkout-modal .w-60{width:15rem}#checkout-modal .w-8{width:2rem}#checkout-modal .w-9\\/12{width:75%}#checkout-modal .w-\\[200px\\]{width:200px}#checkout-modal .w-full{width:100%}#checkout-modal .min-w-\\[15rem\\]{min-width:15rem}#checkout-modal .max-w-\\[200px\\]{max-width:200px}#checkout-modal .flex-1{flex:1 1 0%}#checkout-modal .flex-shrink-0{flex-shrink:0}#checkout-modal .flex-grow,#checkout-modal .grow{flex-grow:1}#checkout-modal .-translate-y-2\\/4{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .translate-x-\\[-45\\%\\]{--tw-translate-x: -45%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .translate-x-\\[0\\%\\]{--tw-translate-x: 0%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}#checkout-modal .animate-spin{animation:spin 1s linear infinite}#checkout-modal .cursor-pointer{cursor:pointer}#checkout-modal .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}#checkout-modal .grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}#checkout-modal .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}#checkout-modal .grid-cols-\\[1fr_auto\\]{grid-template-columns:1fr auto}#checkout-modal .grid-rows-1{grid-template-rows:repeat(1,minmax(0,1fr))}#checkout-modal .grid-rows-\\[auto_1fr\\]{grid-template-rows:auto 1fr}#checkout-modal .flex-col{flex-direction:column}#checkout-modal .items-start{align-items:flex-start}#checkout-modal .items-end{align-items:flex-end}#checkout-modal .items-center{align-items:center}#checkout-modal .justify-center{justify-content:center}#checkout-modal .justify-between{justify-content:space-between}#checkout-modal .gap-1{gap:.25rem}#checkout-modal .gap-1\\.5{gap:.375rem}#checkout-modal .gap-2{gap:.5rem}#checkout-modal .gap-3{gap:.75rem}#checkout-modal .gap-4{gap:1rem}#checkout-modal .gap-5{gap:1.25rem}#checkout-modal .gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}#checkout-modal .justify-self-center{justify-self:center}#checkout-modal .overflow-hidden{overflow:hidden}#checkout-modal .overflow-y-auto{overflow-y:auto}#checkout-modal .whitespace-normal{white-space:normal}#checkout-modal .whitespace-nowrap{white-space:nowrap}#checkout-modal .break-words{overflow-wrap:break-word}#checkout-modal .rounded-2xl{border-radius:1rem}#checkout-modal .rounded-\\[40px\\]{border-radius:40px}#checkout-modal .rounded-full{border-radius:9999px}#checkout-modal .rounded-lg{border-radius:.5rem}#checkout-modal .rounded-md{border-radius:.375rem}#checkout-modal .border,#checkout-modal .border-\\[1px\\]{border-width:1px}#checkout-modal .border-b{border-bottom-width:1px}#checkout-modal .border-r{border-right-width:1px}#checkout-modal .border-dashed{border-style:dashed}#checkout-modal .border-\\[\\#C0B5CF\\]{--tw-border-opacity: 1;border-color:rgb(192 181 207 / var(--tw-border-opacity))}#checkout-modal .border-\\[\\#D0D5DD\\]{--tw-border-opacity: 1;border-color:rgb(208 213 221 / var(--tw-border-opacity))}#checkout-modal .border-grey-100{border-color:hsl(var(--grey-100))}#checkout-modal .border-primary{border-color:hsl(var(--primary))}#checkout-modal .border-tone-10{border-color:hsl(var(--tone-10))}#checkout-modal .border-tone-40{border-color:hsl(var(--tone-40))}#checkout-modal .border-tone-70{border-color:hsla(var(--tone-70))}#checkout-modal .border-b-grey-faint{border-bottom-color:hsl(var(--grey-faint))}#checkout-modal .bg-\\[\\#FEF7ED\\]{--tw-bg-opacity: 1;background-color:rgb(254 247 237 / var(--tw-bg-opacity))}#checkout-modal .bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}#checkout-modal .bg-primary{background-color:hsl(var(--primary))}#checkout-modal .bg-tone-10{background-color:hsl(var(--tone-10))}#checkout-modal .bg-tone-100{background-color:hsl(var(--tone-100))}#checkout-modal .bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}#checkout-modal .bg-opacity-30{--tw-bg-opacity: .3}#checkout-modal .object-contain{-o-object-fit:contain;object-fit:contain}#checkout-modal .p-0{padding:0}#checkout-modal .p-2{padding:.5rem}#checkout-modal .p-3{padding:.75rem}#checkout-modal .p-4{padding:1rem}#checkout-modal .px-0{padding-left:0;padding-right:0}#checkout-modal .px-2{padding-left:.5rem;padding-right:.5rem}#checkout-modal .px-3{padding-left:.75rem;padding-right:.75rem}#checkout-modal .px-3\\.5{padding-left:.875rem;padding-right:.875rem}#checkout-modal .px-4{padding-left:1rem;padding-right:1rem}#checkout-modal .px-6{padding-left:1.5rem;padding-right:1.5rem}#checkout-modal .py-1{padding-top:.25rem;padding-bottom:.25rem}#checkout-modal .py-2{padding-top:.5rem;padding-bottom:.5rem}#checkout-modal .py-3{padding-top:.75rem;padding-bottom:.75rem}#checkout-modal .py-4{padding-top:1rem;padding-bottom:1rem}#checkout-modal .py-5{padding-top:1.25rem;padding-bottom:1.25rem}#checkout-modal .pb-1{padding-bottom:.25rem}#checkout-modal .pb-3{padding-bottom:.75rem}#checkout-modal .pb-4{padding-bottom:1rem}#checkout-modal .pb-5{padding-bottom:1.25rem}#checkout-modal .pl-4{padding-left:1rem}#checkout-modal .pr-2{padding-right:.5rem}#checkout-modal .pr-7{padding-right:1.75rem}#checkout-modal .pt-0{padding-top:0}#checkout-modal .pt-1{padding-top:.25rem}#checkout-modal .pt-3{padding-top:.75rem}#checkout-modal .pt-5{padding-top:1.25rem}#checkout-modal .pt-6{padding-top:1.5rem}#checkout-modal .text-left{text-align:left}#checkout-modal .text-center{text-align:center}#checkout-modal .text-2xl{font-size:1.5rem;line-height:2rem}#checkout-modal .text-\\[10px\\]{font-size:10px}#checkout-modal .text-\\[11px\\]{font-size:11px}#checkout-modal .text-base{font-size:1rem;line-height:1.5rem}#checkout-modal .text-lg{font-size:1.125rem;line-height:1.75rem}#checkout-modal .text-sm{font-size:.875rem;line-height:1.25rem}#checkout-modal .text-xl{font-size:1.25rem;line-height:1.75rem}#checkout-modal .text-xs{font-size:.75rem;line-height:1rem}#checkout-modal .text-xxs{font-size:.625rem}#checkout-modal .font-bold{font-weight:700}#checkout-modal .font-medium{font-weight:500}#checkout-modal .font-normal{font-weight:400}#checkout-modal .font-semibold{font-weight:600}#checkout-modal .uppercase{text-transform:uppercase}#checkout-modal .lowercase{text-transform:lowercase}#checkout-modal .tracking-\\[0\\.5px\\]{letter-spacing:.5px}#checkout-modal .text-\\[\\#816039\\]{--tw-text-opacity: 1;color:rgb(129 96 57 / var(--tw-text-opacity))}#checkout-modal .text-\\[\\#98A2B3\\]{--tw-text-opacity: 1;color:rgb(152 162 179 / var(--tw-text-opacity))}#checkout-modal .text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}#checkout-modal .text-error{color:hsl(var(--error))}#checkout-modal .text-error-dark{color:hsl(var(--error-dark))}#checkout-modal .text-grey-100{color:hsl(var(--grey-100))}#checkout-modal .text-grey-400{color:hsl(var(--grey-400))}#checkout-modal .text-tone-100{color:hsl(var(--tone-100))}#checkout-modal .text-tone-50{color:hsl(var(--tone-50))}#checkout-modal .text-tone-60{color:hsla(var(--tone-60))}#checkout-modal .text-tone-70{color:hsla(var(--tone-70))}#checkout-modal .text-tone-80{color:hsla(var(--tone-80))}#checkout-modal .text-tone-90{color:hsla(var(--tone-90))}#checkout-modal .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}#checkout-modal .opacity-0{opacity:0}#checkout-modal .shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(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)}#checkout-modal .shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#checkout-modal .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#checkout-modal .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#checkout-modal .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#checkout-modal .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#checkout-modal .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#checkout-modal .duration-500{transition-duration:.5s}#checkout-modal .duration-700{transition-duration:.7s}#checkout-modal *::-webkit-scrollbar{height:.2em;width:.4em;cursor:pointer;--tw-bg-opacity: 1;background-color:rgb(244 244 244 / var(--tw-bg-opacity))}#checkout-modal *::-webkit-scrollbar-track{border-radius:100vh;--tw-bg-opacity: 1;background-color:rgb(153 146 146 / var(--tw-bg-opacity))}#checkout-modal *::-webkit-scrollbar-thumb{cursor:pointer;border-radius:100vh;border-width:3px;--tw-border-opacity: 1;border-color:rgb(112 112 112 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(224 203 203 / var(--tw-bg-opacity))}#checkout-modal *::-webkit-scrollbar-thumb:hover{background:#53b6ed}@font-face{font-family:IBM Plex Sans;src:url("https://d104jydf2tp7hm.cloudfront.net/IBM Plex Sans/IBMPlexSans-Regular.ttf");font-weight:400;font-display:swap}@font-face{font-family:IBM Plex Sans;src:url("https://d104jydf2tp7hm.cloudfront.net/IBM Plex Sans/IBMPlexSans-SemiBold.ttf");font-weight:600;font-display:swap}@font-face{font-family:IBM Plex Sans;src:url("https://d104jydf2tp7hm.cloudfront.net/IBM Plex Sans/IBMPlexSans-Bold.ttf");font-weight:700;font-display:swap}.tab-button.active:after{animation:text-underline-animation .3s linear forwards}#toast-container{width:100%;margin:0 auto}.toast{display:flex;align-items:center;padding:15px;margin-bottom:10px;border-radius:5px;opacity:0;transform:translateY(-50px);transition:opacity .5s,transform .5s;box-shadow:0 1px 3px #0000001a,0 1px 2px -1px #0000001a}.toast.show{opacity:1;transform:translateY(0)}.toast.success{background-color:hsl(var(--success));color:#fff}.toast.error{background-color:hsl(var(--error));color:#fff}.toast .close-btn{margin-left:auto;cursor:pointer;color:#fff}.progress-container{width:100%;height:10px;background-color:#f3f3f3;border-radius:5px;overflow:hidden;position:relative}.progress-bar{height:100%;background-color:#4caf50;width:0;position:absolute;top:0;left:0;animation:progress 1s linear infinite}@keyframes progress{0%{width:0px}to{width:100%}}#checkout-modal{color:hsla(var(--tone-80))}@media (min-width: 768px){.md\\:container-center{display:flex;align-items:center;justify-content:center}}#checkout-modal .placeholder\\:text-sm::-moz-placeholder{font-size:.875rem;line-height:1.25rem}#checkout-modal .placeholder\\:text-sm::placeholder{font-size:.875rem;line-height:1.25rem}#checkout-modal .placeholder\\:text-tone-50::-moz-placeholder{color:hsl(var(--tone-50))}#checkout-modal .placeholder\\:text-tone-50::placeholder{color:hsl(var(--tone-50))}#checkout-modal .before\\:absolute:before{content:var(--tw-content);position:absolute}#checkout-modal .before\\:-top-0:before{content:var(--tw-content);top:-0px}#checkout-modal .before\\:left-0:before{content:var(--tw-content);left:0}#checkout-modal .before\\:h-4:before{content:var(--tw-content);height:1rem}#checkout-modal .before\\:w-4:before{content:var(--tw-content);width:1rem}#checkout-modal .before\\:-translate-y-1:before{content:var(--tw-content);--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .before\\:translate-x-\\[-45\\%\\]:before{content:var(--tw-content);--tw-translate-x: -45%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .before\\:translate-x-\\[0\\%\\]:before{content:var(--tw-content);--tw-translate-x: 0%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .before\\:rotate-45:before{content:var(--tw-content);--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .before\\:bg-white:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}#checkout-modal .hover\\:block:hover{display:block}#checkout-modal .hover\\:w-full:hover{width:100%}#checkout-modal .hover\\:rotate-0:hover{--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .hover\\:font-bold:hover{font-weight:700}#checkout-modal .hover\\:underline:hover{text-decoration-line:underline}#checkout-modal .hover\\:opacity-100:hover{opacity:1}#checkout-modal :is(.group:hover .group-hover\\:block){display:block}#checkout-modal :is(.group:hover .group-hover\\:w-4\\/5){width:80%}#checkout-modal :is(.group:hover .group-hover\\:w-full){width:100%}#checkout-modal :is(.group:hover .group-hover\\:rotate-0){--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 640px){#checkout-modal .sm\\:my-8{margin-top:2rem;margin-bottom:2rem}#checkout-modal .sm\\:items-center{align-items:center}}@media (min-width: 768px){#checkout-modal .md\\:mb-5{margin-bottom:1.25rem}#checkout-modal .md\\:mt-6{margin-top:1.5rem}#checkout-modal .md\\:mt-8{margin-top:2rem}#checkout-modal .md\\:block{display:block}#checkout-modal .md\\:flex{display:flex}#checkout-modal .md\\:hidden{display:none}#checkout-modal .md\\:min-h-\\[70\\%\\]{min-height:70%}#checkout-modal .md\\:w-16{width:4rem}#checkout-modal .md\\:w-20{width:5rem}#checkout-modal .md\\:w-3\\/5{width:60%}#checkout-modal .md\\:w-4\\/5{width:80%}#checkout-modal .md\\:w-4\\/6{width:66.666667%}#checkout-modal .md\\:min-w-\\[18rem\\]{min-width:18rem}#checkout-modal .md\\:max-w-\\[600px\\]{max-width:600px}#checkout-modal .md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}#checkout-modal .md\\:justify-between{justify-content:space-between}#checkout-modal .md\\:gap-6{gap:1.5rem}#checkout-modal .md\\:gap-9{gap:2.25rem}#checkout-modal .md\\:rounded-lg{border-radius:.5rem}#checkout-modal .md\\:px-5{padding-left:1.25rem;padding-right:1.25rem}#checkout-modal .md\\:px-7{padding-left:1.75rem;padding-right:1.75rem}#checkout-modal .md\\:py-3{padding-top:.75rem;padding-bottom:.75rem}#checkout-modal .md\\:py-4{padding-top:1rem;padding-bottom:1rem}#checkout-modal .md\\:py-5{padding-top:1.25rem;padding-bottom:1.25rem}#checkout-modal .md\\:text-xs{font-size:.75rem;line-height:1rem}}@media (min-width: 1024px){#checkout-modal .lg\\:block{display:block}#checkout-modal .lg\\:max-w-\\[20rem\\]{max-width:20rem}#checkout-modal .lg\\:px-7{padding-left:1.75rem;padding-right:1.75rem}#checkout-modal .lg\\:px-8{padding-left:2rem;padding-right:2rem}}
1
+ (function(Ne,xe){typeof exports=="object"&&typeof module<"u"?xe(exports):typeof define=="function"&&define.amd?define(["exports"],xe):(Ne=typeof globalThis<"u"?globalThis:Ne||self,xe(Ne.SpotflowCheckout={}))})(this,function(Ne){"use strict";var pc=Object.defineProperty;var bc=(Ne,xe,Ln)=>xe in Ne?pc(Ne,xe,{enumerable:!0,configurable:!0,writable:!0,value:Ln}):Ne[xe]=Ln;var h=(Ne,xe,Ln)=>bc(Ne,typeof xe!="symbol"?xe+"":xe,Ln);var xe=document.createElement("style");xe.textContent=`*:where(#checkout-modal,#checkout-modal *),:before:where(#checkout-modal,#checkout-modal *),:after:where(#checkout-modal,#checkout-modal *){box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before:where(#checkout-modal,#checkout-modal *),:after:where(#checkout-modal,#checkout-modal *){--tw-content: ""}#checkout-modal{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:IBM Plex Sans,Inter,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}#checkout-modal{margin:0;line-height:inherit}hr:where(#checkout-modal,#checkout-modal *){height:0;color:inherit;border-top-width:1px}abbr:where([title]):where(#checkout-modal,#checkout-modal *){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1:where(#checkout-modal,#checkout-modal *),h2:where(#checkout-modal,#checkout-modal *),h3:where(#checkout-modal,#checkout-modal *),h4:where(#checkout-modal,#checkout-modal *),h5:where(#checkout-modal,#checkout-modal *),h6:where(#checkout-modal,#checkout-modal *){font-size:inherit;font-weight:inherit}a:where(#checkout-modal,#checkout-modal *){color:inherit;text-decoration:inherit}b:where(#checkout-modal,#checkout-modal *),strong:where(#checkout-modal,#checkout-modal *){font-weight:bolder}code:where(#checkout-modal,#checkout-modal *),kbd:where(#checkout-modal,#checkout-modal *),samp:where(#checkout-modal,#checkout-modal *),pre:where(#checkout-modal,#checkout-modal *){font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small:where(#checkout-modal,#checkout-modal *){font-size:80%}sub:where(#checkout-modal,#checkout-modal *),sup:where(#checkout-modal,#checkout-modal *){font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub:where(#checkout-modal,#checkout-modal *){bottom:-.25em}sup:where(#checkout-modal,#checkout-modal *){top:-.5em}table:where(#checkout-modal,#checkout-modal *){text-indent:0;border-color:inherit;border-collapse:collapse}button:where(#checkout-modal,#checkout-modal *),input:where(#checkout-modal,#checkout-modal *),optgroup:where(#checkout-modal,#checkout-modal *),select:where(#checkout-modal,#checkout-modal *),textarea:where(#checkout-modal,#checkout-modal *){font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button:where(#checkout-modal,#checkout-modal *),select:where(#checkout-modal,#checkout-modal *){text-transform:none}button:where(#checkout-modal,#checkout-modal *),input:where([type=button]):where(#checkout-modal,#checkout-modal *),input:where([type=reset]):where(#checkout-modal,#checkout-modal *),input:where([type=submit]):where(#checkout-modal,#checkout-modal *){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring:where(#checkout-modal,#checkout-modal *){outline:auto}:-moz-ui-invalid:where(#checkout-modal,#checkout-modal *){box-shadow:none}progress:where(#checkout-modal,#checkout-modal *){vertical-align:baseline}::-webkit-inner-spin-button:where(#checkout-modal,#checkout-modal *),::-webkit-outer-spin-button:where(#checkout-modal,#checkout-modal *){height:auto}[type=search]:where(#checkout-modal,#checkout-modal *){-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration:where(#checkout-modal,#checkout-modal *){-webkit-appearance:none}::-webkit-file-upload-button:where(#checkout-modal,#checkout-modal *){-webkit-appearance:button;font:inherit}summary:where(#checkout-modal,#checkout-modal *){display:list-item}blockquote:where(#checkout-modal,#checkout-modal *),dl:where(#checkout-modal,#checkout-modal *),dd:where(#checkout-modal,#checkout-modal *),h1:where(#checkout-modal,#checkout-modal *),h2:where(#checkout-modal,#checkout-modal *),h3:where(#checkout-modal,#checkout-modal *),h4:where(#checkout-modal,#checkout-modal *),h5:where(#checkout-modal,#checkout-modal *),h6:where(#checkout-modal,#checkout-modal *),hr:where(#checkout-modal,#checkout-modal *),figure:where(#checkout-modal,#checkout-modal *),p:where(#checkout-modal,#checkout-modal *),pre:where(#checkout-modal,#checkout-modal *){margin:0}fieldset:where(#checkout-modal,#checkout-modal *){margin:0;padding:0}legend:where(#checkout-modal,#checkout-modal *){padding:0}ol:where(#checkout-modal,#checkout-modal *),ul:where(#checkout-modal,#checkout-modal *),menu:where(#checkout-modal,#checkout-modal *){list-style:none;margin:0;padding:0}dialog:where(#checkout-modal,#checkout-modal *){padding:0}textarea:where(#checkout-modal,#checkout-modal *){resize:vertical}input::-moz-placeholder:where(#checkout-modal,#checkout-modal *),textarea::-moz-placeholder:where(#checkout-modal,#checkout-modal *){opacity:1;color:#9ca3af}input::placeholder:where(#checkout-modal,#checkout-modal *),textarea::placeholder:where(#checkout-modal,#checkout-modal *){opacity:1;color:#9ca3af}button:where(#checkout-modal,#checkout-modal *),[role=button]:where(#checkout-modal,#checkout-modal *){cursor:pointer}:disabled:where(#checkout-modal,#checkout-modal *){cursor:default}img:where(#checkout-modal,#checkout-modal *),svg:where(#checkout-modal,#checkout-modal *),video:where(#checkout-modal,#checkout-modal *),canvas:where(#checkout-modal,#checkout-modal *),audio:where(#checkout-modal,#checkout-modal *),iframe:where(#checkout-modal,#checkout-modal *),embed:where(#checkout-modal,#checkout-modal *),object:where(#checkout-modal,#checkout-modal *){display:block;vertical-align:middle}img:where(#checkout-modal,#checkout-modal *),video:where(#checkout-modal,#checkout-modal *){max-width:100%;height:auto}[hidden]:where(#checkout-modal,#checkout-modal *){display:none}:root{--primary: 264, 52%, 6%;--primary-light: 266, 21%, 76%;--primary-10: 240, 39%, 86%, 1;--primary-lighter: 240, 100%, 98%;--primary-dark: 240, 39%, 52%;--primary-darker: 240, 100%, 28%;--success: 151, 58%, 46%;--error: 0, 74%, 48%;--error-dark: 19, 100%, 37%;--common: 60, 4%, 43%;--tone-10: 240, 2%, 90%;--tone-40: 202, 6%, 82%;--tone-50: 202, 4%, 68%;--tone-60: 260, 4%, 43%, 1;--tone-70: 266, 3%, 53%;--tone-80: 265, 10%, 24%, 1;--tone-90: 266, 18%, 15%;--tone-100: 266, 54%, 6%;--grey: 218, 15%, 65%;--grey-100: 270, 3%, 62%;--grey-200: 264, 3%, 72%;--grey-300: 260, 3%, 81%;--grey-400: 264, 6%, 34%;--grey-500: 217, 24%, 27%;--grey-600: 265, 10%, 24%;--grey-700: 260, 4%, 43%;--grey-800: 265, 21%, 76%;--grey-faint: 240, 7%, 97%;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}input:focus,button:focus{outline:none}*,:before,:after{--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: rgb(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: }::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: rgb(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: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.container-center{display:flex;align-items:center;justify-content:center}.hide-scrollbar::-webkit-scrollbar{display:none!important}.hide-scrollbar{-ms-overflow-style:none!important;scrollbar-width:none!important}.container-between{display:flex;align-items:center;justify-content:space-between}.align-center{display:flex;align-items:center}.box-container{padding-left:0;padding-right:0;padding-top:1rem;padding-bottom:1rem}@media (min-width: 768px){.box-container{padding:1.75rem 1.25rem}}@media (min-width: 1024px){.box-container{padding-left:1.75rem;padding-right:1.75rem}}.button-fill{display:flex;height:2.5rem;align-items:center;justify-content:center;border-radius:.5rem;background-color:hsl(var(--primary));font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.button-outline{display:flex;height:2.5rem;align-items:center;justify-content:center;border-radius:.5rem;border-width:1px;border-color:hsl(var(--tone-100));font-size:.875rem;line-height:1.25rem;font-weight:600;color:hsl(var(--tone-100))}.payment-options{display:flex;width:100%;flex-direction:column;overflow:hidden}.tab{margin-bottom:.75rem;display:flex;align-items:center;justify-content:flex-start;text-align:left}.tab-button{display:flex;width:100%;flex-grow:1;align-items:center;border-radius:.5rem;border-width:1px;border-color:hsl(var(--grey-100));padding:.75rem 1.25rem;text-align:center;color:hsl(var(--primary))}.tab-button:disabled{cursor:not-allowed;opacity:.4}.tab-button:hover:disabled{border-color:#11032666;color:hsl(var(--primary) / .4)}@media (min-width: 768px){.tab-button{display:flex;justify-content:center}.tab-button:hover{border-color:hsl(var(--primary))}}.tab-button.active{border-width:2px;border-color:hsl(var(--primary))}.tab-button.active span{font-weight:700}.tab-button span{margin-top:.25rem;margin-bottom:.25rem;display:flex;flex-shrink:0;justify-content:center}@media (min-width: 768px){.tab-button span{font-size:.875rem;line-height:1.25rem}}@media (min-width: 1024px){.tab-button span{justify-content:flex-start}}.main{max-height:98dvh;width:100%;overflow:auto}@media (min-width: 768px){.main{padding-top:1rem;padding-bottom:1rem}}@media (min-width: 1024px){.main{width:calc(100% - 250px);padding-left:1rem;padding-right:1rem}}.header-container{border-radius:.75rem;padding:2.5rem 1rem;color:hsl(var(--primary))}@media (min-width: 768px){.header-container{padding:1.25rem 2.25rem}}.tooltip{position:absolute;left:-3rem;top:20px;margin-bottom:1.25rem;display:none;width:auto;flex-direction:column;align-items:center}.group:hover .tooltip{display:flex}@media (min-width: 768px){.tooltip{left:0}}.tooltip-textbox{position:relative;z-index:10;border-radius:.5rem;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));padding:.5rem;font-size:.75rem;line-height:1rem;--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}@media (min-width: 768px){.tooltip-textbox{padding:.75rem 1rem}}.tooltip-text{font-size:13px;line-height:17.4px;letter-spacing:.025em;color:hsl(var(--grey))}.details-input-container{width:100%;border-width:1px;border-style:none;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));font-weight:600;color:hsl(var(--tone-100))}.details-input-container::-moz-placeholder{font-size:.875rem;line-height:1.25rem;color:hsl(var(--tone-100))}.details-input-container::placeholder{font-size:.875rem;line-height:1.25rem;color:hsl(var(--tone-100))}.details-input-container:focus{outline:2px solid transparent;outline-offset:2px}.details-input-container:focus-visible{outline:2px solid transparent!important;outline-offset:2px!important}.avs-input-container{width:100%;border-radius:.25rem;border-width:1px;border-color:hsl(var(--tone-40));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));padding:1.5rem .75rem .5rem;color:hsl(var(--tone-100))}.avs-input-container:focus{border-color:hsl(var(--grey-100));outline:2px solid transparent;outline-offset:2px}.avs-input-container:focus-visible{outline:2px solid transparent!important;outline-offset:2px!important}.mm-input-container{width:100%;border-radius:.5rem;border-width:1px;border-color:hsl(var(--tone-40));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));padding:1.5rem .75rem .5rem;color:hsl(var(--tone-100))}.mm-input-container::-moz-placeholder{color:hsl(var(--tone-50))}.mm-input-container::placeholder{color:hsl(var(--tone-50))}.mm-input-container:focus{border-color:hsl(var(--grey-100));outline:2px solid transparent;outline-offset:2px}.mm-input-container:focus-visible{outline:2px solid transparent!important;outline-offset:2px!important}.details-form-button{display:inline-flex;height:50px;width:100%;align-items:center;justify-content:center;border-radius:.5rem;background-color:hsl(var(--primary));font-size:.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.details-form-button:focus{outline:2px solid transparent;outline-offset:2px}.details-form-button:disabled{background-color:hsl(var(--grey-100));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.pin-input{height:3.5rem;width:4rem;border-radius:.5rem;border-width:1px;border-color:hsla(var(--tone-90));text-align:center;font-size:1.125rem;line-height:1.75rem}.pin-input:focus{border-color:hsl(var(--primary));outline:2px solid transparent;outline-offset:2px}@media (min-width: 768px){.pin-input{height:3.5rem;width:6rem}}.otp-input{width:100%;border-radius:.5rem;border-width:1px;border-color:hsla(var(--tone-90));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));padding:.75rem;font-size:1.5rem;line-height:2rem;font-weight:700}.otp-input:focus{outline:2px solid transparent;outline-offset:2px}.otp-button{height:3.5rem;width:100%;border-radius:.5rem;background-color:hsl(var(--tone-100));padding-left:1.5rem;padding-right:1.5rem;font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.otp-button:disabled{background-color:hsl(var(--grey-100))}.warning-text,.success-text{margin-top:1rem;margin-bottom:1rem;margin-left:auto;margin-right:auto;text-align:center;font-weight:600;color:hsl(var(--grey-400))}.warning-list{margin-left:auto;margin-right:auto;margin-top:.25rem}@media (min-width: 768px){.warning-list{margin-top:.5rem}}.warning-button,.success-button{margin-bottom:1rem;width:100%;border-radius:.5rem;border-width:1px;border-color:hsl(var(--grey-800));padding:1rem;text-align:center;font-size:.875rem;line-height:1.25rem;font-weight:600;color:hsl(var(--grey-400))}.transfer-close{margin-bottom:1rem;width:200px;border-radius:.5rem;background-color:hsl(var(--success));padding:1rem;text-align:center;font-size:.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}#bank-search-input{width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:2px solid transparent;outline-offset:2px}#bank-select-container{display:flex;gap:.75rem;border-radius:.5rem;border-width:1px;border-color:hsl(var(--primary-light));padding:1rem}#bank-code-span{border-radius:.25rem;background-color:hsla(var(--primary-10));padding:.25rem;color:hsla(var(--tone-60))}.spinner{margin-right:.75rem;height:2rem;width:2rem}.spinner{animation:spin 1s linear infinite;fill:#fff}.transaction-issues-input{display:flex;height:3.5rem;width:100%;-webkit-user-select:all;-moz-user-select:all;user-select:all;border-radius:.5rem;border-width:1px;border-style:none;--tw-bg-opacity: 1;background-color:rgb(247 248 251 / var(--tw-bg-opacity));padding-left:1rem;padding-right:1rem;padding-top:1.25rem;padding-bottom:0;color:hsl(var(--tone-100));outline:2px solid transparent!important;outline-offset:2px!important;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transaction-issues-input:disabled{cursor:not-allowed;opacity:.5}.transaction-issues-input-placeholder{pointer-events:none;position:absolute;top:1rem;bottom:1rem;left:.75rem;z-index:20;margin:0;display:flex;height:-moz-fit-content;height:fit-content;--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;padding-left:.25rem;padding-right:.25rem;font-size:.625rem;color:hsla(var(--tone-70));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.peer:-moz-placeholder-shown~.transaction-issues-input-placeholder{margin:auto;--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));padding-left:0;padding-right:0;font-size:.875rem;line-height:1.25rem}.peer:placeholder-shown~.transaction-issues-input-placeholder{margin:auto;--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));padding-left:0;padding-right:0;font-size:.875rem;line-height:1.25rem}.peer:focus~.transaction-issues-input-placeholder{margin:0;--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));padding-left:.25rem;padding-right:.25rem;font-size:.625rem}#checkout-modal .static{position:static}#checkout-modal .fixed{position:fixed}#checkout-modal .absolute{position:absolute}#checkout-modal .relative{position:relative}#checkout-modal .inset-0{top:0;right:0;bottom:0;left:0}#checkout-modal .inset-y-4{top:1rem;bottom:1rem}#checkout-modal .left-0{left:0}#checkout-modal .right-4{right:1rem}#checkout-modal .top-0{top:0}#checkout-modal .top-1{top:.25rem}#checkout-modal .top-1\\/2{top:50%}#checkout-modal .top-5{top:1.25rem}#checkout-modal .z-10{z-index:10}#checkout-modal .z-30{z-index:30}#checkout-modal .z-\\[3000\\]{z-index:3000}#checkout-modal .order-1{order:1}#checkout-modal .order-2{order:2}#checkout-modal .mx-5{margin-left:1.25rem;margin-right:1.25rem}#checkout-modal .mx-\\[18px\\]{margin-left:18px;margin-right:18px}#checkout-modal .mx-auto{margin-left:auto;margin-right:auto}#checkout-modal .my-3{margin-top:.75rem;margin-bottom:.75rem}#checkout-modal .mb-1{margin-bottom:.25rem}#checkout-modal .mb-2{margin-bottom:.5rem}#checkout-modal .mb-3{margin-bottom:.75rem}#checkout-modal .mb-4{margin-bottom:1rem}#checkout-modal .mb-5{margin-bottom:1.25rem}#checkout-modal .mb-7{margin-bottom:1.75rem}#checkout-modal .mb-8{margin-bottom:2rem}#checkout-modal .ml-1{margin-left:.25rem}#checkout-modal .ml-20{margin-left:5rem}#checkout-modal .ml-9{margin-left:2.25rem}#checkout-modal .ml-auto{margin-left:auto}#checkout-modal .mr-1{margin-right:.25rem}#checkout-modal .mr-11{margin-right:2.75rem}#checkout-modal .mt-1{margin-top:.25rem}#checkout-modal .mt-10{margin-top:2.5rem}#checkout-modal .mt-2{margin-top:.5rem}#checkout-modal .mt-3{margin-top:.75rem}#checkout-modal .mt-4{margin-top:1rem}#checkout-modal .mt-5{margin-top:1.25rem}#checkout-modal .mt-6{margin-top:1.5rem}#checkout-modal .mt-7{margin-top:1.75rem}#checkout-modal .mt-8{margin-top:2rem}#checkout-modal .block{display:block}#checkout-modal .inline-block{display:inline-block}#checkout-modal .flex{display:flex}#checkout-modal .grid{display:grid}#checkout-modal .contents{display:contents}#checkout-modal .hidden{display:none}#checkout-modal .h-12{height:3rem}#checkout-modal .h-3{height:.75rem}#checkout-modal .h-8{height:2rem}#checkout-modal .h-\\[22px\\]{height:22px}#checkout-modal .h-\\[40dvh\\]{height:40dvh}#checkout-modal .h-\\[40vh\\]{height:40vh}#checkout-modal .h-\\[50px\\]{height:50px}#checkout-modal .h-auto{height:auto}#checkout-modal .h-full{height:100%}#checkout-modal .max-h-screen{max-height:100vh}#checkout-modal .min-h-\\[30dvh\\]{min-height:30dvh}#checkout-modal .min-h-\\[40dvh\\]{min-height:40dvh}#checkout-modal .min-h-full{min-height:100%}#checkout-modal .min-h-screen{min-height:100vh}#checkout-modal .w-0{width:0px}#checkout-modal .w-11\\/12{width:91.666667%}#checkout-modal .w-12{width:3rem}#checkout-modal .w-14{width:3.5rem}#checkout-modal .w-16{width:4rem}#checkout-modal .w-3{width:.75rem}#checkout-modal .w-4\\/5{width:80%}#checkout-modal .w-60{width:15rem}#checkout-modal .w-8{width:2rem}#checkout-modal .w-9\\/12{width:75%}#checkout-modal .w-\\[200px\\]{width:200px}#checkout-modal .w-full{width:100%}#checkout-modal .min-w-\\[15rem\\]{min-width:15rem}#checkout-modal .max-w-\\[200px\\]{max-width:200px}#checkout-modal .flex-1{flex:1 1 0%}#checkout-modal .flex-shrink-0{flex-shrink:0}#checkout-modal .flex-grow,#checkout-modal .grow{flex-grow:1}#checkout-modal .-translate-y-2\\/4{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .translate-x-\\[-45\\%\\]{--tw-translate-x: -45%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .translate-x-\\[0\\%\\]{--tw-translate-x: 0%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}#checkout-modal .animate-spin{animation:spin 1s linear infinite}#checkout-modal .cursor-pointer{cursor:pointer}#checkout-modal .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}#checkout-modal .grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}#checkout-modal .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}#checkout-modal .grid-cols-\\[1fr_auto\\]{grid-template-columns:1fr auto}#checkout-modal .grid-rows-1{grid-template-rows:repeat(1,minmax(0,1fr))}#checkout-modal .grid-rows-\\[auto_1fr\\]{grid-template-rows:auto 1fr}#checkout-modal .flex-col{flex-direction:column}#checkout-modal .items-start{align-items:flex-start}#checkout-modal .items-end{align-items:flex-end}#checkout-modal .items-center{align-items:center}#checkout-modal .justify-center{justify-content:center}#checkout-modal .justify-between{justify-content:space-between}#checkout-modal .gap-1{gap:.25rem}#checkout-modal .gap-1\\.5{gap:.375rem}#checkout-modal .gap-2{gap:.5rem}#checkout-modal .gap-3{gap:.75rem}#checkout-modal .gap-4{gap:1rem}#checkout-modal .gap-5{gap:1.25rem}#checkout-modal .gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}#checkout-modal .justify-self-center{justify-self:center}#checkout-modal .overflow-hidden{overflow:hidden}#checkout-modal .overflow-y-auto{overflow-y:auto}#checkout-modal .whitespace-normal{white-space:normal}#checkout-modal .whitespace-nowrap{white-space:nowrap}#checkout-modal .break-words{overflow-wrap:break-word}#checkout-modal .rounded-2xl{border-radius:1rem}#checkout-modal .rounded-\\[40px\\]{border-radius:40px}#checkout-modal .rounded-full{border-radius:9999px}#checkout-modal .rounded-lg{border-radius:.5rem}#checkout-modal .rounded-md{border-radius:.375rem}#checkout-modal .border,#checkout-modal .border-\\[1px\\]{border-width:1px}#checkout-modal .border-b{border-bottom-width:1px}#checkout-modal .border-r{border-right-width:1px}#checkout-modal .border-dashed{border-style:dashed}#checkout-modal .border-\\[\\#C0B5CF\\]{--tw-border-opacity: 1;border-color:rgb(192 181 207 / var(--tw-border-opacity))}#checkout-modal .border-\\[\\#D0D5DD\\]{--tw-border-opacity: 1;border-color:rgb(208 213 221 / var(--tw-border-opacity))}#checkout-modal .border-\\[\\#D62020\\]{--tw-border-opacity: 1;border-color:rgb(214 32 32 / var(--tw-border-opacity))}#checkout-modal .border-grey-100{border-color:hsl(var(--grey-100))}#checkout-modal .border-primary{border-color:hsl(var(--primary))}#checkout-modal .border-tone-10{border-color:hsl(var(--tone-10))}#checkout-modal .border-tone-40{border-color:hsl(var(--tone-40))}#checkout-modal .border-tone-70{border-color:hsla(var(--tone-70))}#checkout-modal .border-b-grey-faint{border-bottom-color:hsl(var(--grey-faint))}#checkout-modal .bg-\\[\\#FEF7ED\\]{--tw-bg-opacity: 1;background-color:rgb(254 247 237 / var(--tw-bg-opacity))}#checkout-modal .bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}#checkout-modal .bg-primary{background-color:hsl(var(--primary))}#checkout-modal .bg-tone-10{background-color:hsl(var(--tone-10))}#checkout-modal .bg-tone-100{background-color:hsl(var(--tone-100))}#checkout-modal .bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}#checkout-modal .bg-opacity-30{--tw-bg-opacity: .3}#checkout-modal .object-contain{-o-object-fit:contain;object-fit:contain}#checkout-modal .p-0{padding:0}#checkout-modal .p-2{padding:.5rem}#checkout-modal .p-3{padding:.75rem}#checkout-modal .p-4{padding:1rem}#checkout-modal .px-0{padding-left:0;padding-right:0}#checkout-modal .px-2{padding-left:.5rem;padding-right:.5rem}#checkout-modal .px-3{padding-left:.75rem;padding-right:.75rem}#checkout-modal .px-3\\.5{padding-left:.875rem;padding-right:.875rem}#checkout-modal .px-4{padding-left:1rem;padding-right:1rem}#checkout-modal .px-6{padding-left:1.5rem;padding-right:1.5rem}#checkout-modal .py-1{padding-top:.25rem;padding-bottom:.25rem}#checkout-modal .py-2{padding-top:.5rem;padding-bottom:.5rem}#checkout-modal .py-3{padding-top:.75rem;padding-bottom:.75rem}#checkout-modal .py-4{padding-top:1rem;padding-bottom:1rem}#checkout-modal .py-5{padding-top:1.25rem;padding-bottom:1.25rem}#checkout-modal .pb-1{padding-bottom:.25rem}#checkout-modal .pb-3{padding-bottom:.75rem}#checkout-modal .pb-4{padding-bottom:1rem}#checkout-modal .pb-5{padding-bottom:1.25rem}#checkout-modal .pl-4{padding-left:1rem}#checkout-modal .pr-2{padding-right:.5rem}#checkout-modal .pr-7{padding-right:1.75rem}#checkout-modal .pt-0{padding-top:0}#checkout-modal .pt-1{padding-top:.25rem}#checkout-modal .pt-3{padding-top:.75rem}#checkout-modal .pt-5{padding-top:1.25rem}#checkout-modal .pt-6{padding-top:1.5rem}#checkout-modal .text-left{text-align:left}#checkout-modal .text-center{text-align:center}#checkout-modal .text-2xl{font-size:1.5rem;line-height:2rem}#checkout-modal .text-\\[10px\\]{font-size:10px}#checkout-modal .text-\\[11px\\]{font-size:11px}#checkout-modal .text-base{font-size:1rem;line-height:1.5rem}#checkout-modal .text-lg{font-size:1.125rem;line-height:1.75rem}#checkout-modal .text-sm{font-size:.875rem;line-height:1.25rem}#checkout-modal .text-xl{font-size:1.25rem;line-height:1.75rem}#checkout-modal .text-xs{font-size:.75rem;line-height:1rem}#checkout-modal .text-xxs{font-size:.625rem}#checkout-modal .font-bold{font-weight:700}#checkout-modal .font-medium{font-weight:500}#checkout-modal .font-normal{font-weight:400}#checkout-modal .font-semibold{font-weight:600}#checkout-modal .uppercase{text-transform:uppercase}#checkout-modal .lowercase{text-transform:lowercase}#checkout-modal .tracking-\\[0\\.5px\\]{letter-spacing:.5px}#checkout-modal .text-\\[\\#816039\\]{--tw-text-opacity: 1;color:rgb(129 96 57 / var(--tw-text-opacity))}#checkout-modal .text-\\[\\#98A2B3\\]{--tw-text-opacity: 1;color:rgb(152 162 179 / var(--tw-text-opacity))}#checkout-modal .text-\\[\\#D62020\\]{--tw-text-opacity: 1;color:rgb(214 32 32 / var(--tw-text-opacity))}#checkout-modal .text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}#checkout-modal .text-error{color:hsl(var(--error))}#checkout-modal .text-error-dark{color:hsl(var(--error-dark))}#checkout-modal .text-grey-100{color:hsl(var(--grey-100))}#checkout-modal .text-grey-400{color:hsl(var(--grey-400))}#checkout-modal .text-tone-100{color:hsl(var(--tone-100))}#checkout-modal .text-tone-50{color:hsl(var(--tone-50))}#checkout-modal .text-tone-60{color:hsla(var(--tone-60))}#checkout-modal .text-tone-70{color:hsla(var(--tone-70))}#checkout-modal .text-tone-80{color:hsla(var(--tone-80))}#checkout-modal .text-tone-90{color:hsla(var(--tone-90))}#checkout-modal .text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}#checkout-modal .opacity-0{opacity:0}#checkout-modal .shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(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)}#checkout-modal .shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#checkout-modal .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#checkout-modal .transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#checkout-modal .transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#checkout-modal .transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#checkout-modal .transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#checkout-modal .duration-500{transition-duration:.5s}#checkout-modal .duration-700{transition-duration:.7s}#checkout-modal *::-webkit-scrollbar{height:.2em;width:.4em;cursor:pointer;--tw-bg-opacity: 1;background-color:rgb(244 244 244 / var(--tw-bg-opacity))}#checkout-modal *::-webkit-scrollbar-track{border-radius:100vh;--tw-bg-opacity: 1;background-color:rgb(153 146 146 / var(--tw-bg-opacity))}#checkout-modal *::-webkit-scrollbar-thumb{cursor:pointer;border-radius:100vh;border-width:3px;--tw-border-opacity: 1;border-color:rgb(112 112 112 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(224 203 203 / var(--tw-bg-opacity))}#checkout-modal *::-webkit-scrollbar-thumb:hover{background:#53b6ed}@font-face{font-family:IBM Plex Sans;src:url("https://d104jydf2tp7hm.cloudfront.net/IBM Plex Sans/IBMPlexSans-Regular.ttf");font-weight:400;font-display:swap}@font-face{font-family:IBM Plex Sans;src:url("https://d104jydf2tp7hm.cloudfront.net/IBM Plex Sans/IBMPlexSans-SemiBold.ttf");font-weight:600;font-display:swap}@font-face{font-family:IBM Plex Sans;src:url("https://d104jydf2tp7hm.cloudfront.net/IBM Plex Sans/IBMPlexSans-Bold.ttf");font-weight:700;font-display:swap}.tab-button.active:after{animation:text-underline-animation .3s linear forwards}#toast-container{width:100%;margin:0 auto}.toast{display:flex;align-items:center;padding:15px;margin-bottom:10px;border-radius:5px;opacity:0;transform:translateY(-50px);transition:opacity .5s,transform .5s;box-shadow:0 1px 3px #0000001a,0 1px 2px -1px #0000001a}.toast.show{opacity:1;transform:translateY(0)}.toast.success{background-color:hsl(var(--success));color:#fff}.toast.error{background-color:hsl(var(--error));color:#fff}.toast .close-btn{margin-left:auto;cursor:pointer;color:#fff}.progress-container{width:100%;height:10px;background-color:#f3f3f3;border-radius:5px;overflow:hidden;position:relative}.progress-bar{height:100%;background-color:#4caf50;width:0;position:absolute;top:0;left:0;animation:progress 1s linear infinite}@keyframes progress{0%{width:0px}to{width:100%}}#checkout-modal{color:hsla(var(--tone-80))}@media (min-width: 768px){.md\\:container-center{display:flex;align-items:center;justify-content:center}}#checkout-modal .placeholder\\:text-sm::-moz-placeholder{font-size:.875rem;line-height:1.25rem}#checkout-modal .placeholder\\:text-sm::placeholder{font-size:.875rem;line-height:1.25rem}#checkout-modal .placeholder\\:text-tone-50::-moz-placeholder{color:hsl(var(--tone-50))}#checkout-modal .placeholder\\:text-tone-50::placeholder{color:hsl(var(--tone-50))}#checkout-modal .before\\:absolute:before{content:var(--tw-content);position:absolute}#checkout-modal .before\\:-top-0:before{content:var(--tw-content);top:-0px}#checkout-modal .before\\:left-0:before{content:var(--tw-content);left:0}#checkout-modal .before\\:h-4:before{content:var(--tw-content);height:1rem}#checkout-modal .before\\:w-4:before{content:var(--tw-content);width:1rem}#checkout-modal .before\\:-translate-y-1:before{content:var(--tw-content);--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .before\\:translate-x-\\[-45\\%\\]:before{content:var(--tw-content);--tw-translate-x: -45%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .before\\:translate-x-\\[0\\%\\]:before{content:var(--tw-content);--tw-translate-x: 0%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .before\\:rotate-45:before{content:var(--tw-content);--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .before\\:bg-white:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}#checkout-modal .hover\\:block:hover{display:block}#checkout-modal .hover\\:w-full:hover{width:100%}#checkout-modal .hover\\:rotate-0:hover{--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#checkout-modal .hover\\:font-bold:hover{font-weight:700}#checkout-modal .hover\\:underline:hover{text-decoration-line:underline}#checkout-modal .hover\\:opacity-100:hover{opacity:1}#checkout-modal :is(.group:hover .group-hover\\:block){display:block}#checkout-modal :is(.group:hover .group-hover\\:w-4\\/5){width:80%}#checkout-modal :is(.group:hover .group-hover\\:w-full){width:100%}#checkout-modal :is(.group:hover .group-hover\\:rotate-0){--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 640px){#checkout-modal .sm\\:my-8{margin-top:2rem;margin-bottom:2rem}#checkout-modal .sm\\:items-center{align-items:center}}@media (min-width: 768px){#checkout-modal .md\\:mb-5{margin-bottom:1.25rem}#checkout-modal .md\\:mt-6{margin-top:1.5rem}#checkout-modal .md\\:mt-8{margin-top:2rem}#checkout-modal .md\\:block{display:block}#checkout-modal .md\\:flex{display:flex}#checkout-modal .md\\:hidden{display:none}#checkout-modal .md\\:min-h-\\[70\\%\\]{min-height:70%}#checkout-modal .md\\:w-16{width:4rem}#checkout-modal .md\\:w-20{width:5rem}#checkout-modal .md\\:w-3\\/5{width:60%}#checkout-modal .md\\:w-4\\/5{width:80%}#checkout-modal .md\\:w-4\\/6{width:66.666667%}#checkout-modal .md\\:min-w-\\[18rem\\]{min-width:18rem}#checkout-modal .md\\:max-w-\\[600px\\]{max-width:600px}#checkout-modal .md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}#checkout-modal .md\\:justify-between{justify-content:space-between}#checkout-modal .md\\:gap-6{gap:1.5rem}#checkout-modal .md\\:gap-9{gap:2.25rem}#checkout-modal .md\\:rounded-lg{border-radius:.5rem}#checkout-modal .md\\:px-5{padding-left:1.25rem;padding-right:1.25rem}#checkout-modal .md\\:px-7{padding-left:1.75rem;padding-right:1.75rem}#checkout-modal .md\\:py-3{padding-top:.75rem;padding-bottom:.75rem}#checkout-modal .md\\:py-4{padding-top:1rem;padding-bottom:1rem}#checkout-modal .md\\:py-5{padding-top:1.25rem;padding-bottom:1.25rem}#checkout-modal .md\\:text-xs{font-size:.75rem;line-height:1rem}}@media (min-width: 1024px){#checkout-modal .lg\\:block{display:block}#checkout-modal .lg\\:max-w-\\[20rem\\]{max-width:20rem}#checkout-modal .lg\\:px-7{padding-left:1.75rem;padding-right:1.75rem}#checkout-modal .lg\\:px-8{padding-left:2rem;padding-right:2rem}}
2
2
  `,document.head.appendChild(xe);const Ln=`<div id="checkout-modal">
3
3
  <div role="dialog" class="relative z-10" aria-labelledby="modal-title" aria-modal="true">
4
4
  <div class="fixed inset-0 bg-black bg-opacity-30 transition-opacity" aria-hidden="true"></div>
@@ -13,7 +13,7 @@
13
13
  </div>
14
14
  </div>
15
15
  </div>
16
- </div>`,vs=`<div class="relative flex flex-1 flex-col gap-3 pb-5" id="main">
16
+ </div>`,fs=`<div class="relative flex flex-1 flex-col gap-3 pb-5" id="main">
17
17
 
18
18
  <div class="relative px-4 md:px-7 lg:px-8 py-4 flex flex-col gap-1 flex-1">
19
19
  <!-- header -->
@@ -42,7 +42,7 @@
42
42
  </div>
43
43
  <!-- end of footer -->
44
44
  </div>
45
- </div>`,ve=(n,e)=>e||n;let ee=class extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}},De=class extends Error{constructor(e){super(e),this.name="AuthorizationError"}};const je=(n,e,i)=>{if(!n)throw new De("Missing authorization token");const t=new Headers;return i||t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${n}`),e&&t.append("Spotflow-Payment-Code",e),t},Ve="https://api.spotflow.co/api/v1",fs=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},oi=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments/authorize`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},xt=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},gs=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?new ee(l.message,s.status):new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`UnexpectedError: ${o}`),o}},vn=async(n,e,i,t,o)=>{try{const s=je(n,t),r=await fetch(`${ve(Ve,o)}/payments/verify?reference=${e}`,{method:"GET",headers:s,signal:i});if(!r.ok){const c=await r.json();throw c.message?new ee(c.message,r.status):new ee("Network response was not ok",r.status)}return{data:await r.json(),headers:r.headers}}catch(s){throw s instanceof ee?console.error(`FetchError: ${s.message} (status: ${s.status})`):s instanceof De?console.error(`AuthorizationError: ${s.message}`):console.error(`Unexpected error: ${s}`),s}};async function ys(n,e,i,t,o){const s=je(n,i);try{const r=await fetch(`${ve(Ve,t)}/mobile-money/providers?currency=${o||e}`,{headers:s,method:"GET"});if(!r.ok){const l=await r.json();throw l.message?new ee(l.message,r.status):new ee("Network response was not okay",r.status)}return await r.json()}catch(r){throw r instanceof ee?console.error(`FetchError: ${r.message} (status: ${r.status})`):r instanceof De?console.error(`AuthorizationError: ${r.message}`):console.error(`Unexpected error: ${r}`),r}}const ks=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments/cancel`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return{headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},ws=async(n,e,i,t)=>{try{const o=je(n,i,!0),s=await fetch(`${ve(Ve,t)}/disputes/upload-documents`,{method:"POST",headers:o,body:e});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Cs=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/disputes/reference`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},si=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments/retry`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},ke=(n,e)=>{const i=new Intl.NumberFormat("ng-NG",{style:"decimal",maximumFractionDigits:e||0,minimumFractionDigits:e||0});return isNaN(parseFloat(i.format(n)))?"-":i.format(n)},pe={card:{key:"card",label:"Pay with Card",icon:`<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
45
+ </div>`,ve=(n,e)=>e||n;let ee=class extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}},De=class extends Error{constructor(e){super(e),this.name="AuthorizationError"}};const je=(n,e,i)=>{if(!n)throw new De("Missing authorization token");const t=new Headers;return i||t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${n}`),e&&t.append("Spotflow-Payment-Code",e),t},Ve="https://api.spotflow.co/api/v1",gs=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},oi=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments/authorize`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},xt=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},ys=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?new ee(l.message,s.status):new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`UnexpectedError: ${o}`),o}},vn=async(n,e,i,t,o)=>{try{const s=je(n,t),r=await fetch(`${ve(Ve,o)}/payments/verify?reference=${e}`,{method:"GET",headers:s,signal:i});if(!r.ok){const c=await r.json();throw c.message?new ee(c.message,r.status):new ee("Network response was not ok",r.status)}return{data:await r.json(),headers:r.headers}}catch(s){throw s instanceof ee?console.error(`FetchError: ${s.message} (status: ${s.status})`):s instanceof De?console.error(`AuthorizationError: ${s.message}`):console.error(`Unexpected error: ${s}`),s}};async function ks(n,e,i,t,o){const s=je(n,i);try{const r=await fetch(`${ve(Ve,t)}/mobile-money/providers?currency=${o||e}`,{headers:s,method:"GET"});if(!r.ok){const l=await r.json();throw l.message?new ee(l.message,r.status):new ee("Network response was not okay",r.status)}return await r.json()}catch(r){throw r instanceof ee?console.error(`FetchError: ${r.message} (status: ${r.status})`):r instanceof De?console.error(`AuthorizationError: ${r.message}`):console.error(`Unexpected error: ${r}`),r}}const ws=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments/cancel`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return{headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Cs=async(n,e,i,t)=>{try{const o=je(n,i,!0),s=await fetch(`${ve(Ve,t)}/disputes/upload-documents`,{method:"POST",headers:o,body:e});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},Ss=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/disputes/reference`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const r=await s.json();throw r.message?new ee(r.message,s.status):new ee("Network response was not ok",s.status)}return s.json()}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},si=async(n,e,i,t)=>{try{const o=je(n,i),s=await fetch(`${ve(Ve,t)}/payments/retry`,{method:"POST",headers:o,body:JSON.stringify(e)});if(!s.ok){const l=await s.json();throw l.message?l:new ee("Network response was not ok",s.status)}return{data:await s.json(),headers:s.headers}}catch(o){throw o instanceof ee?console.error(`FetchError: ${o.message} (status: ${o.status})`):o instanceof De?console.error(`AuthorizationError: ${o.message}`):console.error(`Unexpected error: ${o}`),o}},ke=(n,e)=>{const i=new Intl.NumberFormat("ng-NG",{style:"decimal",maximumFractionDigits:e||0,minimumFractionDigits:e||0});return isNaN(parseFloat(i.format(n)))?"-":i.format(n)},pe={card:{key:"card",label:"Pay with Card",icon:`<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
46
46
  <path d="M1.83398 6.16992H15.1673" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
47
47
  <path d="M4.5 11.5034H5.83333" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
48
48
  <path d="M7.5 11.5034H10.1667" stroke="currentColor" stroke-width="1.2" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
@@ -123,13 +123,13 @@
123
123
  <path d="M10.0163 6.41102L11.366 0.60263H13.5249L12.1742 6.41102H10.0163ZM19.974 0.727841C19.5464 0.610166 18.8761 0.483887 18.0392 0.483887C15.9058 0.483887 14.4033 1.27168 14.3904 2.40075C14.3784 3.23536 15.4632 3.70099 16.2821 3.9788C17.1225 4.26358 17.4049 4.44511 17.4009 4.6993C17.3955 5.08867 16.7298 5.26646 16.1092 5.26646C15.2452 5.26646 14.7861 5.17842 14.0771 4.96165L13.7988 4.86934L13.4959 6.16958C14.0002 6.33179 14.9326 6.4722 15.9008 6.4795C18.1702 6.4795 19.6435 5.70069 19.6602 4.49495C19.6683 3.83418 19.0931 3.33141 17.8475 2.91682C17.0929 2.64812 16.6308 2.46881 16.6357 2.19673C16.6357 1.9553 17.0269 1.69713 17.8722 1.69713C18.578 1.68909 19.0895 1.80199 19.488 1.91966L19.6814 1.98669L19.974 0.727841ZM25.5296 0.602541H23.8614C23.3447 0.602541 22.9579 0.705974 22.731 1.08422L19.5247 6.40719H21.7917C21.7917 6.40719 22.1623 5.69149 22.2461 5.53433C22.4939 5.53433 24.6962 5.53682 25.011 5.53682C25.0756 5.74018 25.2737 6.40719 25.2737 6.40719H27.277L25.5296 0.602363V0.602541ZM22.8828 4.35325C23.0614 4.01859 23.743 2.72953 23.743 2.72953C23.7303 2.74499 23.9203 2.39324 24.0292 2.17516L24.1751 2.67595C24.1751 2.67595 24.5885 4.06244 24.6749 4.35316H22.8828V4.35325ZM8.18357 0.602541L6.06996 4.56361L5.8448 3.75867C5.45128 2.83074 4.22537 1.8254 2.85486 1.32209L4.78753 6.40176L7.07172 6.39989L10.4706 0.602481L8.18357 0.602452" fill="#0E4595"/>
124
124
  <path d="M4.09771 0.602448H0.616461L0.588867 0.723297C3.29725 1.20409 5.08928 2.36597 5.83334 3.7622L5.07637 1.093C4.94572 0.725196 4.56669 0.615413 4.09779 0.602596" fill="#F2AE14"/>
125
125
  </svg>
126
- `}],Ss=[{name:"GHS",dialCode:"+233",icon:`<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-gh" viewBox="0 0 512 512">
126
+ `}],Tt=[{name:"GHS",dialCode:"+233",length:"9",cardTypes:["Visa","MasterCard","Gh-link"],icon:`<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-gh" viewBox="0 0 512 512">
127
127
  <path fill="#006b3f" d="M0 0h512v512H0z"/>
128
128
  <path fill="#fcd116" d="M0 0h512v341.3H0z"/>
129
129
  <path fill="#ce1126" d="M0 0h512v170.7H0z"/>
130
130
  <path fill="#000001" d="m256 170.7 55.5 170.6L166.3 236h179.4L200.6 341.3z"/>
131
131
  </svg>
132
- `},{name:"KES",dialCode:"+254",icon:`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="flag-icons-ke" viewBox="0 0 512 512">
132
+ `},{name:"KES",dialCode:"+254",length:"9",cardTypes:["Visa","MasterCard"],icon:`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="flag-icons-ke" viewBox="0 0 512 512">
133
133
  <defs>
134
134
  <path id="ke-a" stroke-miterlimit="10" d="m-28.6 47.5 1.8 1 46.7-81c2.7-.6 4.2-3.2 5.7-5.8 1-1.8 5-8.7 6.7-17.7a58 58 0 0 0-11.9 14.7c-1.5 2.6-3 5.2-2.3 7.9z"/>
135
135
  </defs>
@@ -152,7 +152,7 @@
152
152
  <use xlink:href="#ke-d" width="100%" height="100%" transform="scale(1 -1)"/>
153
153
  </g>
154
154
  </svg>
155
- `},{name:"ZAR",dialCode:"+27",icon:`<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-za" viewBox="0 0 512 512">
155
+ `},{name:"ZAR",dialCode:"+27",length:"9",cardTypes:["Visa","MasterCard","Amex","Diners Club"],icon:`<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-za" viewBox="0 0 512 512">
156
156
  <defs>
157
157
  <clipPath id="za-a">
158
158
  <path fill-opacity=".7" d="M70.1 0h499.6v499.6H70.1z"/>
@@ -169,6 +169,12 @@
169
169
  </g>
170
170
  </g>
171
171
  </svg>
172
+ `},{name:"NGN",dialCode:"+234",length:"10",cardTypes:["Visa","MasterCard","Verve","AfriGo"],icon:`<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-ng" viewBox="0 0 512 512">
173
+ <g fill-rule="evenodd" stroke-width="1pt">
174
+ <path fill="#fff" d="M0 0h512v512H0z"/>
175
+ <path fill="#008753" d="M341.3 0H512v512H341.3zM0 0h170.7v512H0z"/>
176
+ </g>
177
+ </svg>
172
178
  `}],_s=`<div>
173
179
  <form id="checkoutcard">
174
180
  <div>
@@ -249,7 +255,7 @@
249
255
  d="M2.80944 12.6864L7.40177 4.11968C8.13226 2.75698 10.1359 2.75698 10.8664 4.11968L15.4587 12.6864C16.1374 13.9525 15.1936 15.4677 13.7264 15.4677H4.54174C3.0745 15.4677 2.13075 13.9525 2.80944 12.6864ZM9.13406 5.28061C9.53593 5.28061 9.86171 5.60639 9.86171 6.00826V11.1018C9.86171 11.5037 9.53593 11.8295 9.13406 11.8295C8.73219 11.8295 8.40641 11.5037 8.40641 11.1018V6.00826C8.40641 5.60639 8.73219 5.28061 9.13406 5.28061ZM8.2245 13.1029C8.2245 13.6052 8.63172 14.0124 9.13406 14.0124C9.6364 14.0124 10.0436 13.6052 10.0436 13.1029C10.0436 12.6005 9.6364 12.1933 9.13406 12.1933C8.63172 12.1933 8.2245 12.6005 8.2245 13.1029Z"
250
256
  fill="white" />
251
257
  </svg>
252
- <span id="custom-toast-msg">${e}</span>`:e,t.appendChild(o);const s=document.createElement("span");return s.textContent="×",s.classList.add("close-btn","opacity-0"),s.onclick=()=>mn.removeToast(t),t.appendChild(s),t}),h(mn,"showToast",(e,i,t=3e3)=>{const o=document.getElementById("toast-container");if(o){const s=mn.createToast(e,i);o.appendChild(s),s.offsetHeight,s.classList.add("show"),setTimeout(()=>mn.removeToast(s),t)}}),h(mn,"removeToast",e=>{e.classList.remove("show"),e.addEventListener("transitionend",()=>{e.parentElement&&e.parentElement.removeChild(e)})});let li=mn;class Tt{constructor(e){h(this,"container");h(this,"onAction");h(this,"cardDetailsValues");h(this,"creditCardTypes");h(this,"merchantName");this.container=e.container,this.onAction=e.onAction,this.creditCardTypes=[...Lt],this.cardDetailsValues={number:"",expiry:"",cvv:""},this.merchantName=e.merchantName}attachListener(){const e=document.querySelector("#pci-dss");e&&e.classList.remove("hidden");const i=document.querySelector('input[name="number"]'),t=document.querySelector('input[name="expiry"]'),o=document.querySelector('input[name="cvv"]'),s=document.querySelector(".details-form-button"),r=document.querySelector("#checkoutcard");i&&i.addEventListener("input",l=>this.handleInputChange(l,s)),t&&t.addEventListener("input",l=>this.handleInputChange(l,s)),o&&o.addEventListener("input",l=>this.handleInputChange(l,s)),r&&r.addEventListener("submit",l=>{var c,b;l.preventDefault(),this.onAction(l)({pan:As(this.cardDetailsValues.number),cvv:this.cardDetailsValues.cvv,expiryMonth:(c=this.cardDetailsValues)==null?void 0:c.expiry.split("/")[0].trim(),expiryYear:(b=this.cardDetailsValues)==null?void 0:b.expiry.split("/")[1].trim()})})}validateCreditCard(e){if(e=e.replace(/\D/g,""),!e||e.length===0||e.length<13||e.length>19)return!1;const i=e.split("").map(o=>parseInt(o,10));for(let o=i.length-2;o>=0;o-=2){let s=i[o]*2;s>9&&(s-=9),i[o]=s}return i.reduce((o,s)=>o+s,0)%10===0}handleInputChange(e,i){var l,c,b;const t=e.target,{name:o,value:s}=t;let r=s;if(s.trim()===""){this.emptyCardState(t,o);return}if(o==="number"){r=xs(s);const p=r.replace(/\s+/g,""),g=this.validateCreditCard(p);this.filterCreditCardType(s);const f=(l=this.creditCardTypes[0])==null?void 0:l.name;if(f)if(f==="Visa"||f==="MasterCard"||f==="Verve"){const y=Ps[f];y.length>1?(p.length===y[0]&&this.checkInputValidity(g,t,"Your card number is invalid",p.length>=14&&p.length<=19),p.length===y[y.length-1]&&this.checkInputValidity(g,t,"Your card number is invalid",p.length>=14&&p.length<=19)):p.length===y[0]&&this.checkInputValidity(g,t,"Your card number is invalid",p.length>=14&&p.length<=19)}else this.checkInputValidity(!1,t,"Invalid card. Only locally issued cards are accepted.",s.trim().length>=14&&s.trim().length<=19)}else if(o==="expiry"){const p=new Date;r=Ts(s);const g=r.split("/"),f=(c=g[0])==null?void 0:c.trim(),y=(b=g[1])==null?void 0:b.trim(),C=new Date().getFullYear()%100,k=p.getMonth()+1;let S=!0;(parseInt(y)===C&&parseInt(f)<k||parseInt(y)<C)&&(S=!1),(y==null?void 0:y.length)===2&&this.checkInputValidity(S,t,"Your card has expired",g.join("").length===4)}else o==="cvv"&&(r=Ls(s));if(this.cardDetailsValues={...this.cardDetailsValues,[o]:r},t.value=r,this.validateCard())i&&i.removeAttribute("disabled");else if(i){if(i.disabled)return;i.setAttribute("disabled","")}}validateCard(){if(this.cardDetailsValues.expiry.split("/").length===2){const e=this.cardDetailsValues.expiry.split("/")[1].trim();return!!this.cardDetailsValues.number&&this.cardDetailsValues.number.length>15&&!!this.cardDetailsValues.expiry&&this.cardDetailsValues.expiry.length>3&&!!this.cardDetailsValues.cvv&&this.cardDetailsValues.cvv.length>2&&e.length===2}}displayCardTypes(){requestAnimationFrame(()=>{const e=this.container.querySelector("#card-type");e.innerHTML="",this.creditCardTypes.length>0?this.creditCardTypes.forEach(i=>{const t=document.createElement("div");t.classList.add("card-type"),t.innerHTML=i.icon,e.appendChild(t)}):e.innerHTML=`<svg width="25" height="16" viewBox="0 0 25 16" fill="none" xmlns="http://www.w3.org/2000/svg">
258
+ <span id="custom-toast-msg">${e}</span>`:e,t.appendChild(o);const s=document.createElement("span");return s.textContent="×",s.classList.add("close-btn","opacity-0"),s.onclick=()=>mn.removeToast(t),t.appendChild(s),t}),h(mn,"showToast",(e,i,t=3e3)=>{const o=document.getElementById("toast-container");if(o){const s=mn.createToast(e,i);o.appendChild(s),s.offsetHeight,s.classList.add("show"),setTimeout(()=>mn.removeToast(s),t)}}),h(mn,"removeToast",e=>{e.classList.remove("show"),e.addEventListener("transitionend",()=>{e.parentElement&&e.parentElement.removeChild(e)})});let li=mn;class Et{constructor(e){h(this,"container");h(this,"onAction");h(this,"cardDetailsValues");h(this,"creditCardTypes");h(this,"merchantName");this.container=e.container,this.onAction=e.onAction,this.creditCardTypes=[...Lt],this.cardDetailsValues={number:"",expiry:"",cvv:""},this.merchantName=e.merchantName}attachListener(){const e=document.querySelector("#pci-dss");e&&e.classList.remove("hidden");const i=document.querySelector('input[name="number"]'),t=document.querySelector('input[name="expiry"]'),o=document.querySelector('input[name="cvv"]'),s=document.querySelector(".details-form-button"),r=document.querySelector("#checkoutcard");i&&i.addEventListener("input",l=>this.handleInputChange(l,s)),t&&t.addEventListener("input",l=>this.handleInputChange(l,s)),o&&o.addEventListener("input",l=>this.handleInputChange(l,s)),r&&r.addEventListener("submit",l=>{var c,b;l.preventDefault(),this.onAction(l)({pan:As(this.cardDetailsValues.number),cvv:this.cardDetailsValues.cvv,expiryMonth:(c=this.cardDetailsValues)==null?void 0:c.expiry.split("/")[0].trim(),expiryYear:(b=this.cardDetailsValues)==null?void 0:b.expiry.split("/")[1].trim()})})}validateCreditCard(e){if(e=e.replace(/\D/g,""),!e||e.length===0||e.length<13||e.length>19)return!1;const i=e.split("").map(o=>parseInt(o,10));for(let o=i.length-2;o>=0;o-=2){let s=i[o]*2;s>9&&(s-=9),i[o]=s}return i.reduce((o,s)=>o+s,0)%10===0}handleInputChange(e,i){var l,c,b;const t=e.target,{name:o,value:s}=t;let r=s;if(s.trim()===""){this.emptyCardState(t,o);return}if(o==="number"){r=xs(s);const p=r.replace(/\s+/g,""),g=this.validateCreditCard(p);this.filterCreditCardType(s);const f=(l=this.creditCardTypes[0])==null?void 0:l.name;if(f)if(f==="Visa"||f==="MasterCard"||f==="Verve"){const y=Ps[f];y.length>1?(p.length===y[0]&&this.checkInputValidity(g,t,"Your card number is invalid",p.length>=14&&p.length<=19),p.length===y[y.length-1]&&this.checkInputValidity(g,t,"Your card number is invalid",p.length>=14&&p.length<=19)):p.length===y[0]&&this.checkInputValidity(g,t,"Your card number is invalid",p.length>=14&&p.length<=19)}else this.checkInputValidity(!1,t,"Invalid card. Only locally issued cards are accepted.",s.trim().length>=14&&s.trim().length<=19)}else if(o==="expiry"){const p=new Date;r=Ts(s);const g=r.split("/"),f=(c=g[0])==null?void 0:c.trim(),y=(b=g[1])==null?void 0:b.trim(),C=new Date().getFullYear()%100,k=p.getMonth()+1;let S=!0;(parseInt(y)===C&&parseInt(f)<k||parseInt(y)<C)&&(S=!1),(y==null?void 0:y.length)===2&&this.checkInputValidity(S,t,"Your card has expired",g.join("").length===4)}else o==="cvv"&&(r=Ls(s));if(this.cardDetailsValues={...this.cardDetailsValues,[o]:r},t.value=r,this.validateCard())i&&i.removeAttribute("disabled");else if(i){if(i.disabled)return;i.setAttribute("disabled","")}}validateCard(){if(this.cardDetailsValues.expiry.split("/").length===2){const e=this.cardDetailsValues.expiry.split("/")[1].trim();return!!this.cardDetailsValues.number&&this.cardDetailsValues.number.length>15&&!!this.cardDetailsValues.expiry&&this.cardDetailsValues.expiry.length>3&&!!this.cardDetailsValues.cvv&&this.cardDetailsValues.cvv.length>2&&e.length===2}}displayCardTypes(){requestAnimationFrame(()=>{const e=this.container.querySelector("#card-type");e.innerHTML="",this.creditCardTypes.length>0?this.creditCardTypes.forEach(i=>{const t=document.createElement("div");t.classList.add("card-type"),t.innerHTML=i.icon,e.appendChild(t)}):e.innerHTML=`<svg width="25" height="16" viewBox="0 0 25 16" fill="none" xmlns="http://www.w3.org/2000/svg">
253
259
  <path
254
260
  d="M24.5827 6.33333V14.6667C24.5827 14.8877 24.4554 15.0996 24.2288 15.2559C24.0022 15.4122 23.6948 15.5 23.3743 15.5H1.62435C1.30388 15.5 0.996535 15.4122 0.769928 15.2559C0.543322 15.0996 0.416016 14.8877 0.416016 14.6667V6.33333H24.5827ZM24.5827 4.66667H0.416016V1.33333C0.416016 1.11232 0.543322 0.900358 0.769928 0.744078C0.996535 0.587797 1.30388 0.5 1.62435 0.5H23.3743C23.6948 0.5 24.0022 0.587797 24.2288 0.744078C24.4554 0.900358 24.5827 1.11232 24.5827 1.33333V4.66667ZM16.1243 11.3333V13H20.9577V11.3333H16.1243Z"
255
261
  fill="#B6B4B9" />
@@ -275,7 +281,7 @@
275
281
  </p>
276
282
  </div>
277
283
  </div>
278
- </div>`;class Vn{constructor({container:e,amount:i,currency:t,localCurrency:o,rate:s,message:r}){h(this,"container");h(this,"amount");h(this,"currency");h(this,"localCurrency");h(this,"rate");h(this,"message");this.container=e,this.amount=i,this.currency=t,this.localCurrency=o,this.rate=s,this.message=r}attachListener(){}renderComponent(){this.container.innerHTML=this.render();const e=document.querySelector("#success-amount"),i=document.querySelector("#source-rate"),t=document.querySelector("#payment-success-text");t&&(this.message?t.innerHTML=this.message:t.innerHTML="Payment Successful");const o=document.querySelector("#source-rate-mob");i&&this.localCurrency&&this.localCurrency!==this.currency&&(i.children[0].innerHTML="Paid: "),o&&this.localCurrency&&this.localCurrency!==this.currency&&(o.children[0].innerHTML="Paid: "),e&&(this.localCurrency?this.localCurrency!==this.currency&&(e.innerHTML=`${this.currency} ${ke(this.amount)} (${this.localCurrency} ${ke(this.amount*(this.rate||1),2)})`):e.innerHTML=`${this.currency} ${ke(this.amount)}`)}render(){return Is}}const Et=`<div id="paymentWarning">
284
+ </div>`;class Vn{constructor({container:e,amount:i,currency:t,localCurrency:o,rate:s,message:r}){h(this,"container");h(this,"amount");h(this,"currency");h(this,"localCurrency");h(this,"rate");h(this,"message");this.container=e,this.amount=i,this.currency=t,this.localCurrency=o,this.rate=s,this.message=r}attachListener(){}renderComponent(){this.container.innerHTML=this.render();const e=document.querySelector("#success-amount"),i=document.querySelector("#source-rate"),t=document.querySelector("#payment-success-text");t&&(this.message?t.innerHTML=this.message:t.innerHTML="Payment Successful");const o=document.querySelector("#source-rate-mob");i&&this.localCurrency&&this.localCurrency!==this.currency&&(i.children[0].innerHTML="Paid: "),o&&this.localCurrency&&this.localCurrency!==this.currency&&(o.children[0].innerHTML="Paid: "),e&&(this.localCurrency?this.localCurrency!==this.currency&&(e.innerHTML=`${this.currency} ${ke(this.amount)} (${this.localCurrency} ${ke(this.amount*(this.rate||1),2)})`):e.innerHTML=`${this.currency} ${ke(this.amount)}`)}render(){return Is}}const Pt=`<div id="paymentWarning">
279
285
  <div class="container-center min-h-[30dvh]">
280
286
  <div>
281
287
  <div class="container-center mb-5">
@@ -306,7 +312,7 @@
306
312
  </div>
307
313
  </div>
308
314
  </div>
309
- </div>`;class fn{constructor({container:e,onAction:i,onReportIssue:t}){h(this,"container");h(this,"onAction");h(this,"onReportIssue");this.container=e,this.onAction=i||(()=>null),this.onReportIssue=t||(()=>null)}attachListener(){const e=this.container.querySelector("#try-again"),i=this.container.querySelector("#report-issue");e&&e.addEventListener("click",()=>{this.onAction&&this.onAction()}),i&&i.addEventListener("click",()=>{this.onReportIssue&&this.onReportIssue()})}setPaymentError(e,i,t){const o=this.container.querySelector("#payment-warning-text"),s=this.container.querySelector("#payment-warning-desc"),r=this.container.querySelector("#try-again");o&&(o.textContent=e),s&&i&&(s.textContent=i),r&&t&&(r.textContent=t),this.attachListener()}hideReportIssue(){const e=this.container.querySelector("#report-issue");e&&(e.style.display="none")}renderComponent(){this.container.innerHTML=this.render()}render(){return Et}}const Bs=`<div id="checkoutcardotp">
315
+ </div>`;class fn{constructor({container:e,onAction:i,onReportIssue:t}){h(this,"container");h(this,"onAction");h(this,"onReportIssue");this.container=e,this.onAction=i||(()=>null),this.onReportIssue=t||(()=>null)}attachListener(){const e=this.container.querySelector("#try-again"),i=this.container.querySelector("#report-issue");e&&e.addEventListener("click",()=>{this.onAction&&this.onAction()}),i&&i.addEventListener("click",()=>{this.onReportIssue&&this.onReportIssue()})}setPaymentError(e,i,t){const o=this.container.querySelector("#payment-warning-text"),s=this.container.querySelector("#payment-warning-desc"),r=this.container.querySelector("#try-again");o&&(o.textContent=e),s&&i&&(s.textContent=i),r&&t&&(r.textContent=t),this.attachListener()}hideReportIssue(){const e=this.container.querySelector("#report-issue");e&&(e.style.display="none")}renderComponent(){this.container.innerHTML=this.render()}render(){return Pt}}const Bs=`<div id="checkoutcardotp">
310
316
  <div class="w-full">
311
317
  <div id="otp-content" class=" grid gap-4">
312
318
  <h5 class="text-black" id="otp-message">
@@ -680,7 +686,7 @@
680
686
  stroke-linejoin="round" />
681
687
  </svg>`),y.innerHTML=`<span class="bg-primary text-white text-sm font-semibold py-2 px-3 rounded-md" id="upload-btn-text">
682
688
  Upload
683
- </span>`,p&&(p.textContent="Tap to Upload"),g&&(g.textContent="PDF, PNG, JPG | 10MB max."))})}else return}),k&&k.addEventListener("submit",A=>{var E;A.preventDefault();const{reason:_}=this.formValues;this.onAction({transactionReference:(E=this.paymentResponse)==null?void 0:E.reference,reportingReason:_,disputeSource:"CUSTOMER",supportingDocuments:this.documents})})}handleInputChange(e,i){const t=e.target,{name:o,value:s}=t;if(this.formValues={...this.formValues,[o]:s},this.validateForm())i&&i.removeAttribute("disabled");else if(i){if(i.disabled)return;i.setAttribute("disabled","")}}validateForm(){return Object.values(this.formValues).every(i=>!!i)}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return Vs}}function sn(n,e,i){const o=e.get("spf-redirect-url")||i;o&&setTimeout(()=>{const s=new URL(o);s.searchParams.append("status",n.status),s.searchParams.append("reference",n.reference),window.location.href=s.toString()},1800)}class di{constructor(e){h(this,"container");h(this,"transactionIssuesForm");h(this,"_currentStep");h(this,"onAction");h(this,"url");h(this,"token");h(this,"rdtCode");h(this,"paymentResponse");h(this,"paymentResponseHeaders");h(this,"callbackUrl");this.container=e.container,this._currentStep=1,this.onAction=e.onAction,this.url=e.url||"",this.token=e.token,this.rdtCode=e.rdtCode||"",this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.callbackUrl=e.callBackUrl}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransactionIssuesComponent()}attachListener(){const e=this.container.querySelector("#back"),i=document.querySelector("#main-header"),t=document.querySelector("#main-content"),o=document.querySelector("#main-footer");e&&e.addEventListener("click",()=>{this.onAction(),i.style.display="block",t.classList.add("box-container"),o.style.display="block"})}uploadEvidenceFile(e){const i=new FormData;return i.append("file",e),ws(this.token,i,this.rdtCode,this.url).then(t=>({message:"Upload successfully",status:"success",url:t.data})).catch(t=>({message:"Error uploading file. Please try again",status:"error",url:""}))}submitDisputeForm(e){Cs(this.token,e,this.rdtCode,this.url).then(t=>{this.container.innerHTML=this.renderSuccessComponent();const o=document.querySelector("#go-back-merchant");o&&o.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callbackUrl)})}).catch(t=>{this.container.innerHTML=this.renderErrorComponent();const o=document.querySelector("#go-back-merchant");o&&o.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callbackUrl)})})}renderSuccessComponent(){return`<div id="paymentSuccess">
689
+ </span>`,p&&(p.textContent="Tap to Upload"),g&&(g.textContent="PDF, PNG, JPG | 10MB max."))})}else return}),k&&k.addEventListener("submit",A=>{var E;A.preventDefault();const{reason:_}=this.formValues;this.onAction({transactionReference:(E=this.paymentResponse)==null?void 0:E.reference,reportingReason:_,disputeSource:"CUSTOMER",supportingDocuments:this.documents})})}handleInputChange(e,i){const t=e.target,{name:o,value:s}=t;if(this.formValues={...this.formValues,[o]:s},this.validateForm())i&&i.removeAttribute("disabled");else if(i){if(i.disabled)return;i.setAttribute("disabled","")}}validateForm(){return Object.values(this.formValues).every(i=>!!i)}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return Vs}}function sn(n,e,i){const o=e.get("spf-redirect-url")||i;o&&setTimeout(()=>{const s=new URL(o);s.searchParams.append("status",n.status),s.searchParams.append("reference",n.reference),window.location.href=s.toString()},1800)}class di{constructor(e){h(this,"container");h(this,"transactionIssuesForm");h(this,"_currentStep");h(this,"onAction");h(this,"url");h(this,"token");h(this,"rdtCode");h(this,"paymentResponse");h(this,"paymentResponseHeaders");h(this,"callbackUrl");this.container=e.container,this._currentStep=1,this.onAction=e.onAction,this.url=e.url||"",this.token=e.token,this.rdtCode=e.rdtCode||"",this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders,this.callbackUrl=e.callBackUrl}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransactionIssuesComponent()}attachListener(){const e=this.container.querySelector("#back"),i=document.querySelector("#main-header"),t=document.querySelector("#main-content"),o=document.querySelector("#main-footer");e&&e.addEventListener("click",()=>{this.onAction(),i.style.display="block",t.classList.add("box-container"),o.style.display="block"})}uploadEvidenceFile(e){const i=new FormData;return i.append("file",e),Cs(this.token,i,this.rdtCode,this.url).then(t=>({message:"Upload successfully",status:"success",url:t.data})).catch(t=>({message:"Error uploading file. Please try again",status:"error",url:""}))}submitDisputeForm(e){Ss(this.token,e,this.rdtCode,this.url).then(t=>{this.container.innerHTML=this.renderSuccessComponent();const o=document.querySelector("#go-back-merchant");o&&o.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callbackUrl)})}).catch(t=>{this.container.innerHTML=this.renderErrorComponent();const o=document.querySelector("#go-back-merchant");o&&o.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callbackUrl)})})}renderSuccessComponent(){return`<div id="paymentSuccess">
684
690
  <div class="container-center min-h-[40dvh]">
685
691
  <div>
686
692
  <div class="container-center mb-5">
@@ -721,9 +727,9 @@
721
727
 
722
728
  </div>
723
729
  </div>
724
- </div>`}renderTransactionIssuesComponent(){const e=document.querySelector("#main-header"),i=document.querySelector("#main-content"),t=document.querySelector("#main-footer");switch(e&&(e.style.display="none"),i&&i.classList.remove("box-container"),t&&(t.style.display="none"),this.currentStep){case 1:this.transactionIssuesForm=new Gs({container:this.container,uploadEvidenceFile:this.uploadEvidenceFile.bind(this),onAction:this.submitDisputeForm.bind(this),paymentResponse:this.paymentResponse}),this.transactionIssuesForm.renderComponent();break}this.attachListener()}}var le;(function(n){n[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment"})(le||(le={}));function zs(n){return n.nodeType===n.ELEMENT_NODE}function Gn(n){const e=n==null?void 0:n.host;return(e==null?void 0:e.shadowRoot)===n}function zn(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function Fs(n){return n.includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n}function qs(n){const{cssText:e}=n;if(e.split('"').length<3)return e;const i=["@import",`url(${JSON.stringify(n.href)})`];return n.layerName===""?i.push("layer"):n.layerName&&i.push(`layer(${n.layerName})`),n.supportsText&&i.push(`supports(${n.supportsText})`),n.media.length&&i.push(n.media.mediaText),i.join(" ")+";"}function ci(n){try{const e=n.rules||n.cssRules;return e?Fs(Array.from(e,Pt).join("")):null}catch{return null}}function Pt(n){let e;if(Zs(n))try{e=ci(n.styleSheet)||qs(n)}catch{}else if(Js(n)&&n.selectorText.includes(":"))return Ws(n.cssText);return e||n.cssText}function Ws(n){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(e,"$1\\$2")}function Zs(n){return"styleSheet"in n}function Js(n){return"selectorText"in n}class Nt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var i;if(!e)return-1;const t=(i=this.getMeta(e))===null||i===void 0?void 0:i.id;return t??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const i=this.getId(e);this.idNodeMap.delete(i),e.childNodes&&e.childNodes.forEach(t=>this.removeNodeFromMap(t))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,i){const t=i.id;this.idNodeMap.set(t,e),this.nodeMetaMap.set(e,i)}replace(e,i){const t=this.getNode(e);if(t){const o=this.nodeMetaMap.get(t);o&&this.nodeMetaMap.set(i,o)}this.idNodeMap.set(e,i)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function $s(){return new Nt}function Ui({element:n,maskInputOptions:e,tagName:i,type:t,value:o,maskInputFn:s}){let r=o||"";const l=t&&gn(t);return(e[i.toLowerCase()]||l&&e[l])&&(s?r=s(r,n):r="*".repeat(r.length)),r}function gn(n){return n.toLowerCase()}const It="__rrweb_original__";function Ys(n){const e=n.getContext("2d");if(!e)return!0;const i=50;for(let t=0;t<n.width;t+=i)for(let o=0;o<n.height;o+=i){const s=e.getImageData,r=It in s?s[It]:s;if(new Uint32Array(r.call(e,t,o,Math.min(i,n.width-t),Math.min(i,n.height-o)).data.buffer).some(c=>c!==0))return!1}return!0}function Ki(n){const e=n.type;return n.hasAttribute("data-rr-is-password")?"password":e?gn(e):null}function Bt(n,e){var i;let t;try{t=new URL(n,e??window.location.href)}catch{return null}const o=/\.([0-9a-z]+)(?:$)/i,s=t.pathname.match(o);return(i=s==null?void 0:s[1])!==null&&i!==void 0?i:null}let Qs=1;const Xs=new RegExp("[^a-z0-9-_:]"),Fn=-2;function Rt(){return Qs++}function ea(n){if(n instanceof HTMLFormElement)return"form";const e=gn(n.tagName);return Xs.test(e)?"div":e}function na(n){let e="";return n.indexOf("//")>-1?e=n.split("/").slice(0,3).join("/"):e=n.split("/")[0],e=e.split("?")[0],e}let Tn,Dt;const ia=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ta=/^(?:[a-z+]+:)?\/\//i,oa=/^www\..*/i,sa=/^(data:)([^,]*),(.*)/i;function ui(n,e){return(n||"").replace(ia,(i,t,o,s,r,l)=>{const c=o||r||l,b=t||s||"";if(!c)return i;if(ta.test(c)||oa.test(c))return`url(${b}${c}${b})`;if(sa.test(c))return`url(${b}${c}${b})`;if(c[0]==="/")return`url(${b}${na(e)+c}${b})`;const p=e.split("/"),g=c.split("/");p.pop();for(const f of g)f!=="."&&(f===".."?p.pop():p.push(f));return`url(${b}${p.join("/")}${b})`})}const aa=/^[^ \t\n\r\u000c]+/,ra=/^[, \t\n\r\u000c]+/;function la(n,e){if(e.trim()==="")return e;let i=0;function t(s){let r;const l=s.exec(e.substring(i));return l?(r=l[0],i+=r.length,r):""}const o=[];for(;t(ra),!(i>=e.length);){let s=t(aa);if(s.slice(-1)===",")s=En(n,s.substring(0,s.length-1)),o.push(s);else{let r="";s=En(n,s);let l=!1;for(;;){const c=e.charAt(i);if(c===""){o.push((s+r).trim());break}else if(l)c===")"&&(l=!1);else if(c===","){i+=1,o.push((s+r).trim());break}else c==="("&&(l=!0);r+=c,i+=1}}}return o.join(", ")}function En(n,e){if(!e||e.trim()==="")return e;const i=n.createElement("a");return i.href=e,i.href}function da(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function ji(){const n=document.createElement("a");return n.href="",n.href}function Ot(n,e,i,t){return t&&(i==="src"||i==="href"&&!(e==="use"&&t[0]==="#")||i==="xlink:href"&&t[0]!=="#"||i==="background"&&(e==="table"||e==="td"||e==="th")?En(n,t):i==="srcset"?la(n,t):i==="style"?ui(t,ji()):e==="object"&&i==="data"?En(n,t):t)}function Ht(n,e,i){return(n==="video"||n==="audio")&&e==="autoplay"}function ca(n,e,i){try{if(typeof e=="string"){if(n.classList.contains(e))return!0}else for(let t=n.classList.length;t--;){const o=n.classList[t];if(e.test(o))return!0}if(i)return n.matches(i)}catch{}return!1}function hi(n,e,i){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return i?hi(n.parentNode,e,i):!1;for(let t=n.classList.length;t--;){const o=n.classList[t];if(e.test(o))return!0}return i?hi(n.parentNode,e,i):!1}function Ut(n,e,i,t){try{const o=n.nodeType===n.ELEMENT_NODE?n:n.parentElement;if(o===null)return!1;if(typeof e=="string"){if(t){if(o.closest(`.${e}`))return!0}else if(o.classList.contains(e))return!0}else if(hi(o,e,t))return!0;if(i){if(t){if(o.closest(i))return!0}else if(o.matches(i))return!0}}catch{}return!1}function ua(n,e,i){const t=n.contentWindow;if(!t)return;let o=!1,s;try{s=t.document.readyState}catch{return}if(s!=="complete"){const l=setTimeout(()=>{o||(e(),o=!0)},i);n.addEventListener("load",()=>{clearTimeout(l),o=!0,e()});return}const r="about:blank";if(t.location.href!==r||n.src===r||n.src==="")return setTimeout(e,0),n.addEventListener("load",e);n.addEventListener("load",e)}function ha(n,e,i){let t=!1,o;try{o=n.sheet}catch{return}if(o)return;const s=setTimeout(()=>{t||(e(),t=!0)},i);n.addEventListener("load",()=>{clearTimeout(s),t=!0,e()})}function ma(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:r,inlineStylesheet:l,maskInputOptions:c={},maskTextFn:b,maskInputFn:p,dataURLOptions:g={},inlineImages:f,recordCanvas:y,keepIframeSrcFn:C,newlyAddedElement:k=!1}=e,S=pa(i,t);switch(n.nodeType){case n.DOCUMENT_NODE:return n.compatMode!=="CSS1Compat"?{type:le.Document,childNodes:[],compatMode:n.compatMode}:{type:le.Document,childNodes:[]};case n.DOCUMENT_TYPE_NODE:return{type:le.DocumentType,name:n.name,publicId:n.publicId,systemId:n.systemId,rootId:S};case n.ELEMENT_NODE:return va(n,{doc:i,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:c,maskInputFn:p,dataURLOptions:g,inlineImages:f,recordCanvas:y,keepIframeSrcFn:C,newlyAddedElement:k,rootId:S});case n.TEXT_NODE:return ba(n,{needsMask:r,maskTextFn:b,rootId:S});case n.CDATA_SECTION_NODE:return{type:le.CDATA,textContent:"",rootId:S};case n.COMMENT_NODE:return{type:le.Comment,textContent:n.textContent||"",rootId:S};default:return!1}}function pa(n,e){if(!e.hasNode(n))return;const i=e.getId(n);return i===1?void 0:i}function ba(n,e){var i;const{needsMask:t,maskTextFn:o,rootId:s}=e,r=n.parentNode&&n.parentNode.tagName;let l=n.textContent;const c=r==="STYLE"?!0:void 0,b=r==="SCRIPT"?!0:void 0;if(c&&l){try{n.nextSibling||n.previousSibling||!((i=n.parentNode.sheet)===null||i===void 0)&&i.cssRules&&(l=ci(n.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,n)}l=ui(l,ji())}return b&&(l="SCRIPT_PLACEHOLDER"),!c&&!b&&l&&t&&(l=o?o(l,n.parentElement):l.replace(/[\S]/g,"*")),{type:le.Text,textContent:l||"",isStyle:c,rootId:s}}function va(n,e){const{doc:i,blockClass:t,blockSelector:o,inlineStylesheet:s,maskInputOptions:r={},maskInputFn:l,dataURLOptions:c={},inlineImages:b,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:f=!1,rootId:y}=e,C=ca(n,t,o),k=ea(n);let S={};const M=n.attributes.length;for(let _=0;_<M;_++){const E=n.attributes[_];Ht(k,E.name,E.value)||(S[E.name]=Ot(i,k,gn(E.name),E.value))}if(k==="link"&&s){const _=Array.from(i.styleSheets).find(N=>N.href===n.href);let E=null;_&&(E=ci(_)),E&&(delete S.rel,delete S.href,S._cssText=ui(E,_.href))}if(k==="style"&&n.sheet&&!(n.innerText||n.textContent||"").trim().length){const _=ci(n.sheet);_&&(S._cssText=ui(_,ji()))}if(k==="input"||k==="textarea"||k==="select"){const _=n.value,E=n.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&_?S.value=Ui({element:n,type:Ki(n),tagName:k,value:_,maskInputOptions:r,maskInputFn:l}):E&&(S.checked=E)}if(k==="option"&&(n.selected&&!r.select?S.selected=!0:delete S.selected),k==="canvas"&&p){if(n.__context==="2d")Ys(n)||(S.rr_dataURL=n.toDataURL(c.type,c.quality));else if(!("__context"in n)){const _=n.toDataURL(c.type,c.quality),E=document.createElement("canvas");E.width=n.width,E.height=n.height;const N=E.toDataURL(c.type,c.quality);_!==N&&(S.rr_dataURL=_)}}if(k==="img"&&b){Tn||(Tn=i.createElement("canvas"),Dt=Tn.getContext("2d"));const _=n,E=_.crossOrigin;_.crossOrigin="anonymous";const N=()=>{_.removeEventListener("load",N);try{Tn.width=_.naturalWidth,Tn.height=_.naturalHeight,Dt.drawImage(_,0,0),S.rr_dataURL=Tn.toDataURL(c.type,c.quality)}catch(G){console.warn(`Cannot inline img src=${_.currentSrc}! Error: ${G}`)}E?S.crossOrigin=E:_.removeAttribute("crossorigin")};_.complete&&_.naturalWidth!==0?N():_.addEventListener("load",N)}if(k==="audio"||k==="video"){const _=S;_.rr_mediaState=n.paused?"paused":"played",_.rr_mediaCurrentTime=n.currentTime,_.rr_mediaPlaybackRate=n.playbackRate,_.rr_mediaMuted=n.muted,_.rr_mediaLoop=n.loop,_.rr_mediaVolume=n.volume}if(f||(n.scrollLeft&&(S.rr_scrollLeft=n.scrollLeft),n.scrollTop&&(S.rr_scrollTop=n.scrollTop)),C){const{width:_,height:E}=n.getBoundingClientRect();S={class:S.class,rr_width:`${_}px`,rr_height:`${E}px`}}k==="iframe"&&!g(S.src)&&(n.contentDocument||(S.rr_src=S.src),delete S.src);let A;try{customElements.get(k)&&(A=!0)}catch{}return{type:le.Element,tagName:k,attributes:S,childNodes:[],isSVG:da(n)||void 0,needBlock:C,rootId:y,isCustom:A}}function ne(n){return n==null?"":n.toLowerCase()}function fa(n,e){if(e.comment&&n.type===le.Comment)return!0;if(n.type===le.Element){if(e.script&&(n.tagName==="script"||n.tagName==="link"&&(n.attributes.rel==="preload"||n.attributes.rel==="modulepreload")&&n.attributes.as==="script"||n.tagName==="link"&&n.attributes.rel==="prefetch"&&typeof n.attributes.href=="string"&&Bt(n.attributes.href)==="js"))return!0;if(e.headFavicon&&(n.tagName==="link"&&n.attributes.rel==="shortcut icon"||n.tagName==="meta"&&(ne(n.attributes.name).match(/^msapplication-tile(image|color)$/)||ne(n.attributes.name)==="application-name"||ne(n.attributes.rel)==="icon"||ne(n.attributes.rel)==="apple-touch-icon"||ne(n.attributes.rel)==="shortcut icon")))return!0;if(n.tagName==="meta"){if(e.headMetaDescKeywords&&ne(n.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ne(n.attributes.property).match(/^(og|twitter|fb):/)||ne(n.attributes.name).match(/^(og|twitter):/)||ne(n.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(ne(n.attributes.name)==="robots"||ne(n.attributes.name)==="googlebot"||ne(n.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&n.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(ne(n.attributes.name)==="author"||ne(n.attributes.name)==="generator"||ne(n.attributes.name)==="framework"||ne(n.attributes.name)==="publisher"||ne(n.attributes.name)==="progid"||ne(n.attributes.property).match(/^article:/)||ne(n.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(ne(n.attributes.name)==="google-site-verification"||ne(n.attributes.name)==="yandex-verification"||ne(n.attributes.name)==="csrf-token"||ne(n.attributes.name)==="p:domain_verify"||ne(n.attributes.name)==="verify-v1"||ne(n.attributes.name)==="verification"||ne(n.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Pn(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,maskTextClass:r,maskTextSelector:l,skipChild:c=!1,inlineStylesheet:b=!0,maskInputOptions:p={},maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C={},inlineImages:k=!1,recordCanvas:S=!1,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_=5e3,onStylesheetLoad:E,stylesheetLoadTimeout:N=5e3,keepIframeSrcFn:G=()=>!1,newlyAddedElement:z=!1}=e;let{needsMask:U}=e,{preserveWhiteSpace:V=!0}=e;!U&&n.childNodes&&(U=Ut(n,r,l,U===void 0));const oe=ma(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,dataURLOptions:C,inlineImages:k,recordCanvas:S,keepIframeSrcFn:G,newlyAddedElement:z});if(!oe)return console.warn(n,"not serialized"),null;let fe;t.hasNode(n)?fe=t.getId(n):fa(oe,y)||!V&&oe.type===le.Text&&!oe.isStyle&&!oe.textContent.replace(/^\s+|\s+$/gm,"").length?fe=Fn:fe=Rt();const K=Object.assign(oe,{id:fe});if(t.add(n,K),fe===Fn)return null;M&&M(n);let Me=!c;if(K.type===le.Element){Me=Me&&!K.needBlock,delete K.needBlock;const ue=n.shadowRoot;ue&&zn(ue)&&(K.isShadowHost=!0)}if((K.type===le.Document||K.type===le.Element)&&Me){y.headWhitespace&&K.type===le.Element&&K.tagName==="head"&&(V=!1);const ue={doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:c,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:V,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:G};if(!(K.type===le.Element&&K.tagName==="textarea"&&K.attributes.value!==void 0))for(const Te of Array.from(n.childNodes)){const Ae=Pn(Te,ue);Ae&&K.childNodes.push(Ae)}if(zs(n)&&n.shadowRoot)for(const Te of Array.from(n.shadowRoot.childNodes)){const Ae=Pn(Te,ue);Ae&&(zn(n.shadowRoot)&&(Ae.isShadow=!0),K.childNodes.push(Ae))}}return n.parentNode&&Gn(n.parentNode)&&zn(n.parentNode)&&(K.isShadow=!0),K.type===le.Element&&K.tagName==="iframe"&&ua(n,()=>{const ue=n.contentDocument;if(ue&&A){const Te=Pn(ue,{doc:ue,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:!1,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:V,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:G});Te&&A(n,Te)}},_),K.type===le.Element&&K.tagName==="link"&&typeof K.attributes.rel=="string"&&(K.attributes.rel==="stylesheet"||K.attributes.rel==="preload"&&typeof K.attributes.href=="string"&&Bt(K.attributes.href)==="css")&&ha(n,()=>{if(E){const ue=Pn(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:!1,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:V,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:G});ue&&E(n,ue)}},N),K}function ga(n,e){const{mirror:i=new Nt,blockClass:t="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:r=null,inlineStylesheet:l=!0,inlineImages:c=!1,recordCanvas:b=!1,maskAllInputs:p=!1,maskTextFn:g,maskInputFn:f,slimDOM:y=!1,dataURLOptions:C,preserveWhiteSpace:k,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:E,keepIframeSrcFn:N=()=>!1}=e||{};return Pn(n,{doc:n,mirror:i,blockClass:t,blockSelector:o,maskTextClass:s,maskTextSelector:r,skipChild:!1,inlineStylesheet:l,maskInputOptions:p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p===!1?{password:!0}:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:y==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:y===!1?{}:y,dataURLOptions:C,inlineImages:c,recordCanvas:b,preserveWhiteSpace:k,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:E,keepIframeSrcFn:N,newlyAddedElement:!1})}function Se(n,e,i=document){const t={capture:!0,passive:!0};return i.addEventListener(n,e,t),()=>i.removeEventListener(n,e,t)}const Nn=`Please stop import mirror directly. Instead of that,\r
730
+ </div>`}renderTransactionIssuesComponent(){const e=document.querySelector("#main-header"),i=document.querySelector("#main-content"),t=document.querySelector("#main-footer");switch(e&&(e.style.display="none"),i&&i.classList.remove("box-container"),t&&(t.style.display="none"),this.currentStep){case 1:this.transactionIssuesForm=new Gs({container:this.container,uploadEvidenceFile:this.uploadEvidenceFile.bind(this),onAction:this.submitDisputeForm.bind(this),paymentResponse:this.paymentResponse}),this.transactionIssuesForm.renderComponent();break}this.attachListener()}}var le;(function(n){n[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment"})(le||(le={}));function zs(n){return n.nodeType===n.ELEMENT_NODE}function Gn(n){const e=n==null?void 0:n.host;return(e==null?void 0:e.shadowRoot)===n}function zn(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function Fs(n){return n.includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n}function qs(n){const{cssText:e}=n;if(e.split('"').length<3)return e;const i=["@import",`url(${JSON.stringify(n.href)})`];return n.layerName===""?i.push("layer"):n.layerName&&i.push(`layer(${n.layerName})`),n.supportsText&&i.push(`supports(${n.supportsText})`),n.media.length&&i.push(n.media.mediaText),i.join(" ")+";"}function ci(n){try{const e=n.rules||n.cssRules;return e?Fs(Array.from(e,Nt).join("")):null}catch{return null}}function Nt(n){let e;if(Zs(n))try{e=ci(n.styleSheet)||qs(n)}catch{}else if(Js(n)&&n.selectorText.includes(":"))return Ws(n.cssText);return e||n.cssText}function Ws(n){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return n.replace(e,"$1\\$2")}function Zs(n){return"styleSheet"in n}function Js(n){return"selectorText"in n}class It{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var i;if(!e)return-1;const t=(i=this.getMeta(e))===null||i===void 0?void 0:i.id;return t??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const i=this.getId(e);this.idNodeMap.delete(i),e.childNodes&&e.childNodes.forEach(t=>this.removeNodeFromMap(t))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,i){const t=i.id;this.idNodeMap.set(t,e),this.nodeMetaMap.set(e,i)}replace(e,i){const t=this.getNode(e);if(t){const o=this.nodeMetaMap.get(t);o&&this.nodeMetaMap.set(i,o)}this.idNodeMap.set(e,i)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function $s(){return new It}function Ui({element:n,maskInputOptions:e,tagName:i,type:t,value:o,maskInputFn:s}){let r=o||"";const l=t&&gn(t);return(e[i.toLowerCase()]||l&&e[l])&&(s?r=s(r,n):r="*".repeat(r.length)),r}function gn(n){return n.toLowerCase()}const Bt="__rrweb_original__";function Ys(n){const e=n.getContext("2d");if(!e)return!0;const i=50;for(let t=0;t<n.width;t+=i)for(let o=0;o<n.height;o+=i){const s=e.getImageData,r=Bt in s?s[Bt]:s;if(new Uint32Array(r.call(e,t,o,Math.min(i,n.width-t),Math.min(i,n.height-o)).data.buffer).some(c=>c!==0))return!1}return!0}function Ki(n){const e=n.type;return n.hasAttribute("data-rr-is-password")?"password":e?gn(e):null}function Rt(n,e){var i;let t;try{t=new URL(n,e??window.location.href)}catch{return null}const o=/\.([0-9a-z]+)(?:$)/i,s=t.pathname.match(o);return(i=s==null?void 0:s[1])!==null&&i!==void 0?i:null}let Qs=1;const Xs=new RegExp("[^a-z0-9-_:]"),Fn=-2;function Dt(){return Qs++}function ea(n){if(n instanceof HTMLFormElement)return"form";const e=gn(n.tagName);return Xs.test(e)?"div":e}function na(n){let e="";return n.indexOf("//")>-1?e=n.split("/").slice(0,3).join("/"):e=n.split("/")[0],e=e.split("?")[0],e}let Tn,Ot;const ia=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ta=/^(?:[a-z+]+:)?\/\//i,oa=/^www\..*/i,sa=/^(data:)([^,]*),(.*)/i;function ui(n,e){return(n||"").replace(ia,(i,t,o,s,r,l)=>{const c=o||r||l,b=t||s||"";if(!c)return i;if(ta.test(c)||oa.test(c))return`url(${b}${c}${b})`;if(sa.test(c))return`url(${b}${c}${b})`;if(c[0]==="/")return`url(${b}${na(e)+c}${b})`;const p=e.split("/"),g=c.split("/");p.pop();for(const f of g)f!=="."&&(f===".."?p.pop():p.push(f));return`url(${b}${p.join("/")}${b})`})}const aa=/^[^ \t\n\r\u000c]+/,ra=/^[, \t\n\r\u000c]+/;function la(n,e){if(e.trim()==="")return e;let i=0;function t(s){let r;const l=s.exec(e.substring(i));return l?(r=l[0],i+=r.length,r):""}const o=[];for(;t(ra),!(i>=e.length);){let s=t(aa);if(s.slice(-1)===",")s=En(n,s.substring(0,s.length-1)),o.push(s);else{let r="";s=En(n,s);let l=!1;for(;;){const c=e.charAt(i);if(c===""){o.push((s+r).trim());break}else if(l)c===")"&&(l=!1);else if(c===","){i+=1,o.push((s+r).trim());break}else c==="("&&(l=!0);r+=c,i+=1}}}return o.join(", ")}function En(n,e){if(!e||e.trim()==="")return e;const i=n.createElement("a");return i.href=e,i.href}function da(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function ji(){const n=document.createElement("a");return n.href="",n.href}function Ht(n,e,i,t){return t&&(i==="src"||i==="href"&&!(e==="use"&&t[0]==="#")||i==="xlink:href"&&t[0]!=="#"||i==="background"&&(e==="table"||e==="td"||e==="th")?En(n,t):i==="srcset"?la(n,t):i==="style"?ui(t,ji()):e==="object"&&i==="data"?En(n,t):t)}function Ut(n,e,i){return(n==="video"||n==="audio")&&e==="autoplay"}function ca(n,e,i){try{if(typeof e=="string"){if(n.classList.contains(e))return!0}else for(let t=n.classList.length;t--;){const o=n.classList[t];if(e.test(o))return!0}if(i)return n.matches(i)}catch{}return!1}function hi(n,e,i){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return i?hi(n.parentNode,e,i):!1;for(let t=n.classList.length;t--;){const o=n.classList[t];if(e.test(o))return!0}return i?hi(n.parentNode,e,i):!1}function Kt(n,e,i,t){try{const o=n.nodeType===n.ELEMENT_NODE?n:n.parentElement;if(o===null)return!1;if(typeof e=="string"){if(t){if(o.closest(`.${e}`))return!0}else if(o.classList.contains(e))return!0}else if(hi(o,e,t))return!0;if(i){if(t){if(o.closest(i))return!0}else if(o.matches(i))return!0}}catch{}return!1}function ua(n,e,i){const t=n.contentWindow;if(!t)return;let o=!1,s;try{s=t.document.readyState}catch{return}if(s!=="complete"){const l=setTimeout(()=>{o||(e(),o=!0)},i);n.addEventListener("load",()=>{clearTimeout(l),o=!0,e()});return}const r="about:blank";if(t.location.href!==r||n.src===r||n.src==="")return setTimeout(e,0),n.addEventListener("load",e);n.addEventListener("load",e)}function ha(n,e,i){let t=!1,o;try{o=n.sheet}catch{return}if(o)return;const s=setTimeout(()=>{t||(e(),t=!0)},i);n.addEventListener("load",()=>{clearTimeout(s),t=!0,e()})}function ma(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:r,inlineStylesheet:l,maskInputOptions:c={},maskTextFn:b,maskInputFn:p,dataURLOptions:g={},inlineImages:f,recordCanvas:y,keepIframeSrcFn:C,newlyAddedElement:k=!1}=e,S=pa(i,t);switch(n.nodeType){case n.DOCUMENT_NODE:return n.compatMode!=="CSS1Compat"?{type:le.Document,childNodes:[],compatMode:n.compatMode}:{type:le.Document,childNodes:[]};case n.DOCUMENT_TYPE_NODE:return{type:le.DocumentType,name:n.name,publicId:n.publicId,systemId:n.systemId,rootId:S};case n.ELEMENT_NODE:return va(n,{doc:i,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:c,maskInputFn:p,dataURLOptions:g,inlineImages:f,recordCanvas:y,keepIframeSrcFn:C,newlyAddedElement:k,rootId:S});case n.TEXT_NODE:return ba(n,{needsMask:r,maskTextFn:b,rootId:S});case n.CDATA_SECTION_NODE:return{type:le.CDATA,textContent:"",rootId:S};case n.COMMENT_NODE:return{type:le.Comment,textContent:n.textContent||"",rootId:S};default:return!1}}function pa(n,e){if(!e.hasNode(n))return;const i=e.getId(n);return i===1?void 0:i}function ba(n,e){var i;const{needsMask:t,maskTextFn:o,rootId:s}=e,r=n.parentNode&&n.parentNode.tagName;let l=n.textContent;const c=r==="STYLE"?!0:void 0,b=r==="SCRIPT"?!0:void 0;if(c&&l){try{n.nextSibling||n.previousSibling||!((i=n.parentNode.sheet)===null||i===void 0)&&i.cssRules&&(l=ci(n.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,n)}l=ui(l,ji())}return b&&(l="SCRIPT_PLACEHOLDER"),!c&&!b&&l&&t&&(l=o?o(l,n.parentElement):l.replace(/[\S]/g,"*")),{type:le.Text,textContent:l||"",isStyle:c,rootId:s}}function va(n,e){const{doc:i,blockClass:t,blockSelector:o,inlineStylesheet:s,maskInputOptions:r={},maskInputFn:l,dataURLOptions:c={},inlineImages:b,recordCanvas:p,keepIframeSrcFn:g,newlyAddedElement:f=!1,rootId:y}=e,C=ca(n,t,o),k=ea(n);let S={};const M=n.attributes.length;for(let _=0;_<M;_++){const E=n.attributes[_];Ut(k,E.name,E.value)||(S[E.name]=Ht(i,k,gn(E.name),E.value))}if(k==="link"&&s){const _=Array.from(i.styleSheets).find(N=>N.href===n.href);let E=null;_&&(E=ci(_)),E&&(delete S.rel,delete S.href,S._cssText=ui(E,_.href))}if(k==="style"&&n.sheet&&!(n.innerText||n.textContent||"").trim().length){const _=ci(n.sheet);_&&(S._cssText=ui(_,ji()))}if(k==="input"||k==="textarea"||k==="select"){const _=n.value,E=n.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&_?S.value=Ui({element:n,type:Ki(n),tagName:k,value:_,maskInputOptions:r,maskInputFn:l}):E&&(S.checked=E)}if(k==="option"&&(n.selected&&!r.select?S.selected=!0:delete S.selected),k==="canvas"&&p){if(n.__context==="2d")Ys(n)||(S.rr_dataURL=n.toDataURL(c.type,c.quality));else if(!("__context"in n)){const _=n.toDataURL(c.type,c.quality),E=document.createElement("canvas");E.width=n.width,E.height=n.height;const N=E.toDataURL(c.type,c.quality);_!==N&&(S.rr_dataURL=_)}}if(k==="img"&&b){Tn||(Tn=i.createElement("canvas"),Ot=Tn.getContext("2d"));const _=n,E=_.crossOrigin;_.crossOrigin="anonymous";const N=()=>{_.removeEventListener("load",N);try{Tn.width=_.naturalWidth,Tn.height=_.naturalHeight,Ot.drawImage(_,0,0),S.rr_dataURL=Tn.toDataURL(c.type,c.quality)}catch(G){console.warn(`Cannot inline img src=${_.currentSrc}! Error: ${G}`)}E?S.crossOrigin=E:_.removeAttribute("crossorigin")};_.complete&&_.naturalWidth!==0?N():_.addEventListener("load",N)}if(k==="audio"||k==="video"){const _=S;_.rr_mediaState=n.paused?"paused":"played",_.rr_mediaCurrentTime=n.currentTime,_.rr_mediaPlaybackRate=n.playbackRate,_.rr_mediaMuted=n.muted,_.rr_mediaLoop=n.loop,_.rr_mediaVolume=n.volume}if(f||(n.scrollLeft&&(S.rr_scrollLeft=n.scrollLeft),n.scrollTop&&(S.rr_scrollTop=n.scrollTop)),C){const{width:_,height:E}=n.getBoundingClientRect();S={class:S.class,rr_width:`${_}px`,rr_height:`${E}px`}}k==="iframe"&&!g(S.src)&&(n.contentDocument||(S.rr_src=S.src),delete S.src);let A;try{customElements.get(k)&&(A=!0)}catch{}return{type:le.Element,tagName:k,attributes:S,childNodes:[],isSVG:da(n)||void 0,needBlock:C,rootId:y,isCustom:A}}function ne(n){return n==null?"":n.toLowerCase()}function fa(n,e){if(e.comment&&n.type===le.Comment)return!0;if(n.type===le.Element){if(e.script&&(n.tagName==="script"||n.tagName==="link"&&(n.attributes.rel==="preload"||n.attributes.rel==="modulepreload")&&n.attributes.as==="script"||n.tagName==="link"&&n.attributes.rel==="prefetch"&&typeof n.attributes.href=="string"&&Rt(n.attributes.href)==="js"))return!0;if(e.headFavicon&&(n.tagName==="link"&&n.attributes.rel==="shortcut icon"||n.tagName==="meta"&&(ne(n.attributes.name).match(/^msapplication-tile(image|color)$/)||ne(n.attributes.name)==="application-name"||ne(n.attributes.rel)==="icon"||ne(n.attributes.rel)==="apple-touch-icon"||ne(n.attributes.rel)==="shortcut icon")))return!0;if(n.tagName==="meta"){if(e.headMetaDescKeywords&&ne(n.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ne(n.attributes.property).match(/^(og|twitter|fb):/)||ne(n.attributes.name).match(/^(og|twitter):/)||ne(n.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(ne(n.attributes.name)==="robots"||ne(n.attributes.name)==="googlebot"||ne(n.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&n.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(ne(n.attributes.name)==="author"||ne(n.attributes.name)==="generator"||ne(n.attributes.name)==="framework"||ne(n.attributes.name)==="publisher"||ne(n.attributes.name)==="progid"||ne(n.attributes.property).match(/^article:/)||ne(n.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(ne(n.attributes.name)==="google-site-verification"||ne(n.attributes.name)==="yandex-verification"||ne(n.attributes.name)==="csrf-token"||ne(n.attributes.name)==="p:domain_verify"||ne(n.attributes.name)==="verify-v1"||ne(n.attributes.name)==="verification"||ne(n.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Pn(n,e){const{doc:i,mirror:t,blockClass:o,blockSelector:s,maskTextClass:r,maskTextSelector:l,skipChild:c=!1,inlineStylesheet:b=!0,maskInputOptions:p={},maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C={},inlineImages:k=!1,recordCanvas:S=!1,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_=5e3,onStylesheetLoad:E,stylesheetLoadTimeout:N=5e3,keepIframeSrcFn:G=()=>!1,newlyAddedElement:z=!1}=e;let{needsMask:U}=e,{preserveWhiteSpace:V=!0}=e;!U&&n.childNodes&&(U=Kt(n,r,l,U===void 0));const oe=ma(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,dataURLOptions:C,inlineImages:k,recordCanvas:S,keepIframeSrcFn:G,newlyAddedElement:z});if(!oe)return console.warn(n,"not serialized"),null;let fe;t.hasNode(n)?fe=t.getId(n):fa(oe,y)||!V&&oe.type===le.Text&&!oe.isStyle&&!oe.textContent.replace(/^\s+|\s+$/gm,"").length?fe=Fn:fe=Dt();const K=Object.assign(oe,{id:fe});if(t.add(n,K),fe===Fn)return null;M&&M(n);let Me=!c;if(K.type===le.Element){Me=Me&&!K.needBlock,delete K.needBlock;const ue=n.shadowRoot;ue&&zn(ue)&&(K.isShadowHost=!0)}if((K.type===le.Document||K.type===le.Element)&&Me){y.headWhitespace&&K.type===le.Element&&K.tagName==="head"&&(V=!1);const ue={doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:c,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:V,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:G};if(!(K.type===le.Element&&K.tagName==="textarea"&&K.attributes.value!==void 0))for(const Te of Array.from(n.childNodes)){const Ae=Pn(Te,ue);Ae&&K.childNodes.push(Ae)}if(zs(n)&&n.shadowRoot)for(const Te of Array.from(n.shadowRoot.childNodes)){const Ae=Pn(Te,ue);Ae&&(zn(n.shadowRoot)&&(Ae.isShadow=!0),K.childNodes.push(Ae))}}return n.parentNode&&Gn(n.parentNode)&&zn(n.parentNode)&&(K.isShadow=!0),K.type===le.Element&&K.tagName==="iframe"&&ua(n,()=>{const ue=n.contentDocument;if(ue&&A){const Te=Pn(ue,{doc:ue,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:!1,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:V,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:G});Te&&A(n,Te)}},_),K.type===le.Element&&K.tagName==="link"&&typeof K.attributes.rel=="string"&&(K.attributes.rel==="stylesheet"||K.attributes.rel==="preload"&&typeof K.attributes.href=="string"&&Rt(K.attributes.href)==="css")&&ha(n,()=>{if(E){const ue=Pn(n,{doc:i,mirror:t,blockClass:o,blockSelector:s,needsMask:U,maskTextClass:r,maskTextSelector:l,skipChild:!1,inlineStylesheet:b,maskInputOptions:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y,dataURLOptions:C,inlineImages:k,recordCanvas:S,preserveWhiteSpace:V,onSerialize:M,onIframeLoad:A,iframeLoadTimeout:_,onStylesheetLoad:E,stylesheetLoadTimeout:N,keepIframeSrcFn:G});ue&&E(n,ue)}},N),K}function ga(n,e){const{mirror:i=new It,blockClass:t="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:r=null,inlineStylesheet:l=!0,inlineImages:c=!1,recordCanvas:b=!1,maskAllInputs:p=!1,maskTextFn:g,maskInputFn:f,slimDOM:y=!1,dataURLOptions:C,preserveWhiteSpace:k,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:E,keepIframeSrcFn:N=()=>!1}=e||{};return Pn(n,{doc:n,mirror:i,blockClass:t,blockSelector:o,maskTextClass:s,maskTextSelector:r,skipChild:!1,inlineStylesheet:l,maskInputOptions:p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p===!1?{password:!0}:p,maskTextFn:g,maskInputFn:f,slimDOMOptions:y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:y==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:y===!1?{}:y,dataURLOptions:C,inlineImages:c,recordCanvas:b,preserveWhiteSpace:k,onSerialize:S,onIframeLoad:M,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:E,keepIframeSrcFn:N,newlyAddedElement:!1})}function Se(n,e,i=document){const t={capture:!0,passive:!0};return i.addEventListener(n,e,t),()=>i.removeEventListener(n,e,t)}const Nn=`Please stop import mirror directly. Instead of that,\r
725
731
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
726
- or you can use record.mirror to access the mirror instance during recording.`;let Kt={map:{},getId(){return console.error(Nn),-1},getNode(){return console.error(Nn),null},removeNodeFromMap(){console.error(Nn)},has(){return console.error(Nn),!1},reset(){console.error(Nn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Kt=new Proxy(Kt,{get(n,e,i){return e==="map"&&console.error(Nn),Reflect.get(n,e,i)}}));function qn(n,e,i={}){let t=null,o=0;return function(...s){const r=Date.now();!o&&i.leading===!1&&(o=r);const l=e-(r-o),c=this;l<=0||l>e?(t&&(clearTimeout(t),t=null),o=r,n.apply(c,s)):!t&&i.trailing!==!1&&(t=setTimeout(()=>{o=i.leading===!1?0:Date.now(),t=null,n.apply(c,s)},l))}}function mi(n,e,i,t,o=window){const s=o.Object.getOwnPropertyDescriptor(n,e);return o.Object.defineProperty(n,e,t?i:{set(r){setTimeout(()=>{i.set.call(this,r)},0),s&&s.set&&s.set.call(this,r)}}),()=>mi(n,e,s||{},!0)}function In(n,e,i){try{if(!(e in n))return()=>{};const t=n[e],o=i(t);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:t}})),n[e]=o,()=>{n[e]=t}}catch{return()=>{}}}let pi=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(pi=()=>new Date().getTime());function jt(n){var e,i,t,o,s,r;const l=n.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:(l==null?void 0:l.documentElement.scrollLeft)||((i=(e=l==null?void 0:l.body)===null||e===void 0?void 0:e.parentElement)===null||i===void 0?void 0:i.scrollLeft)||((t=l==null?void 0:l.body)===null||t===void 0?void 0:t.scrollLeft)||0,top:l.scrollingElement?l.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(l==null?void 0:l.documentElement.scrollTop)||((s=(o=l==null?void 0:l.body)===null||o===void 0?void 0:o.parentElement)===null||s===void 0?void 0:s.scrollTop)||((r=l==null?void 0:l.body)===null||r===void 0?void 0:r.scrollTop)||0}}function Vt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Gt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function zt(n){return n?n.nodeType===n.ELEMENT_NODE?n:n.parentElement:null}function _e(n,e,i,t){if(!n)return!1;const o=zt(n);if(!o)return!1;try{if(typeof e=="string"){if(o.classList.contains(e)||t&&o.closest("."+e)!==null)return!0}else if(hi(o,e,t))return!0}catch{}return!!(i&&(o.matches(i)||t&&o.closest(i)!==null))}function ya(n,e){return e.getId(n)!==-1}function Vi(n,e){return e.getId(n)===Fn}function Ft(n,e){if(Gn(n))return!1;const i=e.getId(n);return e.has(i)?n.parentNode&&n.parentNode.nodeType===n.DOCUMENT_NODE?!1:n.parentNode?Ft(n.parentNode,e):!0:!0}function Gi(n){return!!n.changedTouches}function ka(n=window){"NodeList"in n&&!n.NodeList.prototype.forEach&&(n.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in n&&!n.DOMTokenList.prototype.forEach&&(n.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let i=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===i)return!0;while(i=i&&i.parentNode);return!1})}function qt(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function Wt(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function zi(n){return!!(n!=null&&n.shadowRoot)}class wa{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var i;return(i=this.styleIDMap.get(e))!==null&&i!==void 0?i:-1}has(e){return this.styleIDMap.has(e)}add(e,i){if(this.has(e))return this.getId(e);let t;return i===void 0?t=this.id++:t=i,this.styleIDMap.set(e,t),this.idStyleMap.set(t,e),t}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Zt(n){var e,i;let t=null;return((i=(e=n.getRootNode)===null||e===void 0?void 0:e.call(n))===null||i===void 0?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(t=n.getRootNode().host),t}function Ca(n){let e=n,i;for(;i=Zt(e);)e=i;return e}function Sa(n){const e=n.ownerDocument;if(!e)return!1;const i=Ca(n);return e.contains(i)}function Jt(n){const e=n.ownerDocument;return e?e.contains(n)||Sa(n):!1}var W=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(W||{}),F=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(F||{}),Le=(n=>(n[n.MouseUp=0]="MouseUp",n[n.MouseDown=1]="MouseDown",n[n.Click=2]="Click",n[n.ContextMenu=3]="ContextMenu",n[n.DblClick=4]="DblClick",n[n.Focus=5]="Focus",n[n.Blur=6]="Blur",n[n.TouchStart=7]="TouchStart",n[n.TouchMove_Departed=8]="TouchMove_Departed",n[n.TouchEnd=9]="TouchEnd",n[n.TouchCancel=10]="TouchCancel",n))(Le||{}),Ze=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(Ze||{}),Bn=(n=>(n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n))(Bn||{});function $t(n){return"__ln"in n}class _a{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let i=this.head;for(let t=0;t<e;t++)i=(i==null?void 0:i.next)||null;return i}addNode(e){const i={value:e,previous:null,next:null};if(e.__ln=i,e.previousSibling&&$t(e.previousSibling)){const t=e.previousSibling.__ln.next;i.next=t,i.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=i,t&&(t.previous=i)}else if(e.nextSibling&&$t(e.nextSibling)&&e.nextSibling.__ln.previous){const t=e.nextSibling.__ln.previous;i.previous=t,i.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=i,t&&(t.next=i)}else this.head&&(this.head.previous=i),i.next=this.head,this.head=i;i.next===null&&(this.tail=i),this.length++}removeNode(e){const i=e.__ln;this.head&&(i.previous?(i.previous.next=i.next,i.next?i.next.previous=i.previous:this.tail=i.previous):(this.head=i.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Yt=(n,e)=>`${n}@${e}`;class Ma{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],i=new Set,t=new _a,o=c=>{let b=c,p=Fn;for(;p===Fn;)b=b&&b.nextSibling,p=b&&this.mirror.getId(b);return p},s=c=>{if(!c.parentNode||!Jt(c)||c.parentNode.tagName==="TEXTAREA")return;const b=Gn(c.parentNode)?this.mirror.getId(Zt(c)):this.mirror.getId(c.parentNode),p=o(c);if(b===-1||p===-1)return t.addNode(c);const g=Pn(c,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:f=>{qt(f,this.mirror)&&this.iframeManager.addIframe(f),Wt(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),zi(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(f,y)=>{this.iframeManager.attachIframe(f,y),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,y)=>{this.stylesheetManager.attachLinkElement(f,y)}});g&&(e.push({parentId:b,nextId:p,node:g}),i.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)Qt(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||s(c);for(const c of this.addedSet)!eo(this.droppedSet,c)&&!Qt(this.removes,c,this.mirror)||eo(this.movedSet,c)?s(c):this.droppedSet.add(c);let r=null;for(;t.length;){let c=null;if(r){const b=this.mirror.getId(r.value.parentNode),p=o(r.value);b!==-1&&p!==-1&&(c=r)}if(!c){let b=t.tail;for(;b;){const p=b;if(b=b.previous,p){const g=this.mirror.getId(p.value.parentNode);if(o(p.value)===-1)continue;if(g!==-1){c=p;break}else{const y=p.value;if(y.parentNode&&y.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const C=y.parentNode.host;if(this.mirror.getId(C)!==-1){c=p;break}}}}}}if(!c){for(;t.head;)t.removeNode(t.head.value);break}r=c.previous,t.removeNode(c.value),s(c.value)}const l={texts:this.texts.map(c=>{const b=c.node;return b.parentNode&&b.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(b.parentNode),{id:this.mirror.getId(b),value:c.value}}).filter(c=>!i.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:b}=c;if(typeof b.style=="string"){const p=JSON.stringify(c.styleDiff),g=JSON.stringify(c._unchangedStyles);p.length<b.style.length&&(p+g).split("var(").length===b.style.split("var(").length&&(b.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:b}}).filter(c=>!i.has(c.id)).filter(c=>this.mirror.has(c.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(l))},this.genTextAreaValueMutation=e=>{let i=this.attributeMap.get(e);i||(i={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e,i)),i.attributes.value=Array.from(e.childNodes,t=>t.textContent||"").join("")},this.processMutation=e=>{if(!Vi(e.target,this.mirror))switch(e.type){case"characterData":{const i=e.target.textContent;!_e(e.target,this.blockClass,this.blockSelector,!1)&&i!==e.oldValue&&this.texts.push({value:Ut(e.target,this.maskTextClass,this.maskTextSelector,!0)&&i?this.maskTextFn?this.maskTextFn(i,zt(e.target)):i.replace(/[\S]/g,"*"):i,node:e.target});break}case"attributes":{const i=e.target;let t=e.attributeName,o=e.target.getAttribute(t);if(t==="value"){const r=Ki(i);o=Ui({element:i,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:r,value:o,maskInputFn:this.maskInputFn})}if(_e(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let s=this.attributeMap.get(e.target);if(i.tagName==="IFRAME"&&t==="src"&&!this.keepIframeSrcFn(o))if(!i.contentDocument)t="rr_src";else return;if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),t==="type"&&i.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&i.setAttribute("data-rr-is-password","true"),!Ht(i.tagName,t)&&(s.attributes[t]=Ot(this.doc,gn(i.tagName),gn(t),o),t==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const r=this.unattachedDoc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const l of Array.from(i.style)){const c=i.style.getPropertyValue(l),b=i.style.getPropertyPriority(l);c!==r.style.getPropertyValue(l)||b!==r.style.getPropertyPriority(l)?b===""?s.styleDiff[l]=c:s.styleDiff[l]=[c,b]:s._unchangedStyles[l]=[c,b]}for(const l of Array.from(r.style))i.style.getPropertyValue(l)===""&&(s.styleDiff[l]=!1)}break}case"childList":{if(_e(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(i=>this.genAdds(i,e.target)),e.removedNodes.forEach(i=>{const t=this.mirror.getId(i),o=Gn(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);_e(e.target,this.blockClass,this.blockSelector,!1)||Vi(i,this.mirror)||!ya(i,this.mirror)||(this.addedSet.has(i)?(Fi(this.addedSet,i),this.droppedSet.add(i)):this.addedSet.has(e.target)&&t===-1||Ft(e.target,this.mirror)||(this.movedSet.has(i)&&this.movedMap[Yt(t,o)]?Fi(this.movedSet,i):this.removes.push({parentId:o,id:t,isShadow:Gn(e.target)&&zn(e.target)?!0:void 0})),this.mapRemoves.push(i))});break}}},this.genAdds=(e,i)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Vi(e,this.mirror))return;this.movedSet.add(e);let t=null;i&&this.mirror.hasNode(i)&&(t=this.mirror.getId(i)),t&&t!==-1&&(this.movedMap[Yt(this.mirror.getId(e),t)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);_e(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(t=>this.genAdds(t)),zi(e)&&e.shadowRoot.childNodes.forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(i=>{this[i]=e[i]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Fi(n,e){n.delete(e),e.childNodes.forEach(i=>Fi(n,i))}function Qt(n,e,i){return n.length===0?!1:Xt(n,e,i)}function Xt(n,e,i){const{parentNode:t}=e;if(!t)return!1;const o=i.getId(t);return n.some(s=>s.id===o)?!0:Xt(n,t,i)}function eo(n,e){return n.size===0?!1:no(n,e)}function no(n,e){const{parentNode:i}=e;return i?n.has(i)?!0:no(n,i):!1}let Wn;function Aa(n){Wn=n}function xa(){Wn=void 0}const q=n=>Wn?(...i)=>{try{return n(...i)}catch(t){if(Wn&&Wn(t)===!0)return;throw t}}:n,yn=[];function Zn(n){try{if("composedPath"in n){const e=n.composedPath();if(e.length)return e[0]}else if("path"in n&&n.path.length)return n.path[0]}catch{}return n&&n.target}function io(n,e){var i,t;const o=new Ma;yn.push(o),o.init(n);let s=window.MutationObserver||window.__rrMutationObserver;const r=(t=(i=window==null?void 0:window.Zone)===null||i===void 0?void 0:i.__symbol__)===null||t===void 0?void 0:t.call(i,"MutationObserver");r&&window[r]&&(s=window[r]);const l=new s(q(o.processMutations.bind(o)));return l.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}function La({mousemoveCb:n,sampling:e,doc:i,mirror:t}){if(e.mousemove===!1)return()=>{};const o=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let r=[],l;const c=qn(q(g=>{const f=Date.now()-l;n(r.map(y=>(y.timeOffset-=f,y)),g),r=[],l=null}),s),b=q(qn(q(g=>{const f=Zn(g),{clientX:y,clientY:C}=Gi(g)?g.changedTouches[0]:g;l||(l=pi()),r.push({x:y,y:C,id:t.getId(f),timeOffset:pi()-l}),c(typeof DragEvent<"u"&&g instanceof DragEvent?F.Drag:g instanceof MouseEvent?F.MouseMove:F.TouchMove)}),o,{trailing:!1})),p=[Se("mousemove",b,i),Se("touchmove",b,i),Se("drag",b,i)];return q(()=>{p.forEach(g=>g())})}function Ta({mouseInteractionCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};const r=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[];let c=null;const b=p=>g=>{const f=Zn(g);if(_e(f,t,o,!0))return;let y=null,C=p;if("pointerType"in g){switch(g.pointerType){case"mouse":y=Ze.Mouse;break;case"touch":y=Ze.Touch;break;case"pen":y=Ze.Pen;break}y===Ze.Touch?Le[p]===Le.MouseDown?C="TouchStart":Le[p]===Le.MouseUp&&(C="TouchEnd"):Ze.Pen}else Gi(g)&&(y=Ze.Touch);y!==null?(c=y,(C.startsWith("Touch")&&y===Ze.Touch||C.startsWith("Mouse")&&y===Ze.Mouse)&&(y=null)):Le[p]===Le.Click&&(y=c,c=null);const k=Gi(g)?g.changedTouches[0]:g;if(!k)return;const S=i.getId(f),{clientX:M,clientY:A}=k;q(n)(Object.assign({type:Le[C],id:S,x:M,y:A},y!==null&&{pointerType:y}))};return Object.keys(Le).filter(p=>Number.isNaN(Number(p))&&!p.endsWith("_Departed")&&r[p]!==!1).forEach(p=>{let g=gn(p);const f=b(p);if(window.PointerEvent)switch(Le[p]){case Le.MouseDown:case Le.MouseUp:g=g.replace("mouse","pointer");break;case Le.TouchStart:case Le.TouchEnd:return}l.push(Se(g,f,e))}),q(()=>{l.forEach(p=>p())})}function to({scrollCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){const r=q(qn(q(l=>{const c=Zn(l);if(!c||_e(c,t,o,!0))return;const b=i.getId(c);if(c===e&&e.defaultView){const p=jt(e.defaultView);n({id:b,x:p.left,y:p.top})}else n({id:b,x:c.scrollLeft,y:c.scrollTop})}),s.scroll||100));return Se("scroll",r,e)}function Ea({viewportResizeCb:n},{win:e}){let i=-1,t=-1;const o=q(qn(q(()=>{const s=Vt(),r=Gt();(i!==s||t!==r)&&(n({width:Number(r),height:Number(s)}),i=s,t=r)}),200));return Se("resize",o,e)}const Pa=["INPUT","TEXTAREA","SELECT"],oo=new WeakMap;function Na({inputCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,ignoreClass:s,ignoreSelector:r,maskInputOptions:l,maskInputFn:c,sampling:b,userTriggeredOnInput:p}){function g(A){let _=Zn(A);const E=A.isTrusted,N=_&&_.tagName;if(_&&N==="OPTION"&&(_=_.parentElement),!_||!N||Pa.indexOf(N)<0||_e(_,t,o,!0)||_.classList.contains(s)||r&&_.matches(r))return;let G=_.value,z=!1;const U=Ki(_)||"";U==="radio"||U==="checkbox"?z=_.checked:(l[N.toLowerCase()]||l[U])&&(G=Ui({element:_,maskInputOptions:l,tagName:N,type:U,value:G,maskInputFn:c})),f(_,p?{text:G,isChecked:z,userTriggered:E}:{text:G,isChecked:z});const V=_.name;U==="radio"&&V&&z&&e.querySelectorAll(`input[type="radio"][name="${V}"]`).forEach(oe=>{if(oe!==_){const fe=oe.value;f(oe,p?{text:fe,isChecked:!z,userTriggered:!1}:{text:fe,isChecked:!z})}})}function f(A,_){const E=oo.get(A);if(!E||E.text!==_.text||E.isChecked!==_.isChecked){oo.set(A,_);const N=i.getId(A);q(n)(Object.assign(Object.assign({},_),{id:N}))}}const C=(b.input==="last"?["change"]:["input","change"]).map(A=>Se(A,q(g),e)),k=e.defaultView;if(!k)return()=>{C.forEach(A=>A())};const S=k.Object.getOwnPropertyDescriptor(k.HTMLInputElement.prototype,"value"),M=[[k.HTMLInputElement.prototype,"value"],[k.HTMLInputElement.prototype,"checked"],[k.HTMLSelectElement.prototype,"value"],[k.HTMLTextAreaElement.prototype,"value"],[k.HTMLSelectElement.prototype,"selectedIndex"],[k.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&C.push(...M.map(A=>mi(A[0],A[1],{set(){q(g)({target:this,isTrusted:!1})}},!1,k))),q(()=>{C.forEach(A=>A())})}function bi(n){const e=[];function i(t,o){if(vi("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||vi("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||vi("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||vi("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const r=Array.from(t.parentRule.cssRules).indexOf(t);o.unshift(r)}else if(t.parentStyleSheet){const r=Array.from(t.parentStyleSheet.cssRules).indexOf(t);o.unshift(r)}return o}return i(n,e)}function an(n,e,i){let t,o;return n?(n.ownerNode?t=e.getId(n.ownerNode):o=i.getId(n),{styleId:o,id:t}):{}}function Ia({styleSheetRuleCb:n,mirror:e,stylesheetManager:i},{win:t}){if(!t.CSSStyleSheet||!t.CSSStyleSheet.prototype)return()=>{};const o=t.CSSStyleSheet.prototype.insertRule;t.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:q((p,g,f)=>{const[y,C]=f,{id:k,styleId:S}=an(g,e,i.styleMirror);return(k&&k!==-1||S&&S!==-1)&&n({id:k,styleId:S,adds:[{rule:y,index:C}]}),p.apply(g,f)})});const s=t.CSSStyleSheet.prototype.deleteRule;t.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,removes:[{index:y}]}),p.apply(g,f)})});let r;t.CSSStyleSheet.prototype.replace&&(r=t.CSSStyleSheet.prototype.replace,t.CSSStyleSheet.prototype.replace=new Proxy(r,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,replace:y}),p.apply(g,f)})}));let l;t.CSSStyleSheet.prototype.replaceSync&&(l=t.CSSStyleSheet.prototype.replaceSync,t.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,replaceSync:y}),p.apply(g,f)})}));const c={};fi("CSSGroupingRule")?c.CSSGroupingRule=t.CSSGroupingRule:(fi("CSSMediaRule")&&(c.CSSMediaRule=t.CSSMediaRule),fi("CSSConditionRule")&&(c.CSSConditionRule=t.CSSConditionRule),fi("CSSSupportsRule")&&(c.CSSSupportsRule=t.CSSSupportsRule));const b={};return Object.entries(c).forEach(([p,g])=>{b[p]={insertRule:g.prototype.insertRule,deleteRule:g.prototype.deleteRule},g.prototype.insertRule=new Proxy(b[p].insertRule,{apply:q((f,y,C)=>{const[k,S]=C,{id:M,styleId:A}=an(y.parentStyleSheet,e,i.styleMirror);return(M&&M!==-1||A&&A!==-1)&&n({id:M,styleId:A,adds:[{rule:k,index:[...bi(y),S||0]}]}),f.apply(y,C)})}),g.prototype.deleteRule=new Proxy(b[p].deleteRule,{apply:q((f,y,C)=>{const[k]=C,{id:S,styleId:M}=an(y.parentStyleSheet,e,i.styleMirror);return(S&&S!==-1||M&&M!==-1)&&n({id:S,styleId:M,removes:[{index:[...bi(y),k]}]}),f.apply(y,C)})})}),q(()=>{t.CSSStyleSheet.prototype.insertRule=o,t.CSSStyleSheet.prototype.deleteRule=s,r&&(t.CSSStyleSheet.prototype.replace=r),l&&(t.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([p,g])=>{g.prototype.insertRule=b[p].insertRule,g.prototype.deleteRule=b[p].deleteRule})})}function so({mirror:n,stylesheetManager:e},i){var t,o,s;let r=null;i.nodeName==="#document"?r=n.getId(i):r=n.getId(i.host);const l=i.nodeName==="#document"?(t=i.defaultView)===null||t===void 0?void 0:t.Document:(s=(o=i.ownerDocument)===null||o===void 0?void 0:o.defaultView)===null||s===void 0?void 0:s.ShadowRoot,c=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return r===null||r===-1||!l||!c?()=>{}:(Object.defineProperty(i,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var b;return(b=c.get)===null||b===void 0?void 0:b.call(this)},set(b){var p;const g=(p=c.set)===null||p===void 0?void 0:p.call(this,b);if(r!==null&&r!==-1)try{e.adoptStyleSheets(b,r)}catch{}return g}}),q(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))}function Ba({styleDeclarationCb:n,mirror:e,ignoreCSSAttributes:i,stylesheetManager:t},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:q((l,c,b)=>{var p;const[g,f,y]=b;if(i.has(g))return s.apply(c,[g,f,y]);const{id:C,styleId:k}=an((p=c.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,set:{property:g,value:f,priority:y},index:bi(c.parentRule)}),l.apply(c,b)})});const r=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(r,{apply:q((l,c,b)=>{var p;const[g]=b;if(i.has(g))return r.apply(c,[g]);const{id:f,styleId:y}=an((p=c.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||y&&y!==-1)&&n({id:f,styleId:y,remove:{property:g},index:bi(c.parentRule)}),l.apply(c,b)})}),q(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=r})}function Ra({mediaInteractionCb:n,blockClass:e,blockSelector:i,mirror:t,sampling:o,doc:s}){const r=q(c=>qn(q(b=>{const p=Zn(b);if(!p||_e(p,e,i,!0))return;const{currentTime:g,volume:f,muted:y,playbackRate:C,loop:k}=p;n({type:c,id:t.getId(p),currentTime:g,volume:f,muted:y,playbackRate:C,loop:k})}),o.media||500)),l=[Se("play",r(0),s),Se("pause",r(1),s),Se("seeked",r(2),s),Se("volumechange",r(3),s),Se("ratechange",r(4),s)];return q(()=>{l.forEach(c=>c())})}function Da({fontCb:n,doc:e}){const i=e.defaultView;if(!i)return()=>{};const t=[],o=new WeakMap,s=i.FontFace;i.FontFace=function(c,b,p){const g=new s(c,b,p);return o.set(g,{family:c,buffer:typeof b!="string",descriptors:p,fontSource:typeof b=="string"?b:JSON.stringify(Array.from(new Uint8Array(b)))}),g};const r=In(e.fonts,"add",function(l){return function(c){return setTimeout(q(()=>{const b=o.get(c);b&&(n(b),o.delete(c))}),0),l.apply(this,[c])}});return t.push(()=>{i.FontFace=s}),t.push(r),q(()=>{t.forEach(l=>l())})}function Oa(n){const{doc:e,mirror:i,blockClass:t,blockSelector:o,selectionCb:s}=n;let r=!0;const l=q(()=>{const c=e.getSelection();if(!c||r&&(c!=null&&c.isCollapsed))return;r=c.isCollapsed||!1;const b=[],p=c.rangeCount||0;for(let g=0;g<p;g++){const f=c.getRangeAt(g),{startContainer:y,startOffset:C,endContainer:k,endOffset:S}=f;_e(y,t,o,!0)||_e(k,t,o,!0)||b.push({start:i.getId(y),startOffset:C,end:i.getId(k),endOffset:S})}s({ranges:b})});return l(),Se("selectionchange",l)}function Ha({doc:n,customElementCb:e}){const i=n.defaultView;return!i||!i.customElements?()=>{}:In(i.customElements,"define",function(o){return function(s,r,l){try{e({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,r,l])}})}function Ua(n,e){const{mutationCb:i,mousemoveCb:t,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:r,inputCb:l,mediaInteractionCb:c,styleSheetRuleCb:b,styleDeclarationCb:p,canvasMutationCb:g,fontCb:f,selectionCb:y,customElementCb:C}=n;n.mutationCb=(...k)=>{e.mutation&&e.mutation(...k),i(...k)},n.mousemoveCb=(...k)=>{e.mousemove&&e.mousemove(...k),t(...k)},n.mouseInteractionCb=(...k)=>{e.mouseInteraction&&e.mouseInteraction(...k),o(...k)},n.scrollCb=(...k)=>{e.scroll&&e.scroll(...k),s(...k)},n.viewportResizeCb=(...k)=>{e.viewportResize&&e.viewportResize(...k),r(...k)},n.inputCb=(...k)=>{e.input&&e.input(...k),l(...k)},n.mediaInteractionCb=(...k)=>{e.mediaInteaction&&e.mediaInteaction(...k),c(...k)},n.styleSheetRuleCb=(...k)=>{e.styleSheetRule&&e.styleSheetRule(...k),b(...k)},n.styleDeclarationCb=(...k)=>{e.styleDeclaration&&e.styleDeclaration(...k),p(...k)},n.canvasMutationCb=(...k)=>{e.canvasMutation&&e.canvasMutation(...k),g(...k)},n.fontCb=(...k)=>{e.font&&e.font(...k),f(...k)},n.selectionCb=(...k)=>{e.selection&&e.selection(...k),y(...k)},n.customElementCb=(...k)=>{e.customElement&&e.customElement(...k),C(...k)}}function Ka(n,e={}){const i=n.doc.defaultView;if(!i)return()=>{};Ua(n,e);let t;n.recordDOM&&(t=io(n,n.doc));const o=La(n),s=Ta(n),r=to(n),l=Ea(n,{win:i}),c=Na(n),b=Ra(n);let p=()=>{},g=()=>{},f=()=>{},y=()=>{};n.recordDOM&&(p=Ia(n,{win:i}),g=so(n,n.doc),f=Ba(n,{win:i}),n.collectFonts&&(y=Da(n)));const C=Oa(n),k=Ha(n),S=[];for(const M of n.plugins)S.push(M.observer(M.callback,i,M.options));return q(()=>{yn.forEach(M=>M.reset()),t==null||t.disconnect(),o(),s(),r(),l(),c(),b(),p(),g(),f(),y(),C(),k(),S.forEach(M=>M())})}function vi(n){return typeof window[n]<"u"}function fi(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class ao{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,i,t,o){const s=t||this.getIdToRemoteIdMap(e),r=o||this.getRemoteIdToIdMap(e);let l=s.get(i);return l||(l=this.generateIdFn(),s.set(i,l),r.set(l,i)),l}getIds(e,i){const t=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return i.map(s=>this.getId(e,s,t,o))}getRemoteId(e,i,t){const o=t||this.getRemoteIdToIdMap(e);if(typeof i!="number")return i;const s=o.get(i);return s||-1}getRemoteIds(e,i){const t=this.getRemoteIdToIdMap(e);return i.map(o=>this.getRemoteId(e,o,t))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let i=this.iframeIdToRemoteIdMap.get(e);return i||(i=new Map,this.iframeIdToRemoteIdMap.set(e,i)),i}getRemoteIdToIdMap(e){let i=this.iframeRemoteIdToIdMap.get(e);return i||(i=new Map,this.iframeRemoteIdToIdMap.set(e,i)),i}}class ja{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new ao(Rt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ao(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,i){var t;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:i}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(t=this.loadListener)===null||t===void 0||t.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const i=e;if(i.data.type!=="rrweb"||i.origin!==i.data.origin||!e.source)return;const o=this.crossOriginIframeMap.get(e.source);if(!o)return;const s=this.transformCrossOriginEvent(o,i.data.event);s&&this.wrappedEmit(s,i.data.isCheckout)}transformCrossOriginEvent(e,i){var t;switch(i.type){case W.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(i.data.node,e);const o=i.data.node.id;return this.crossOriginIframeRootIdMap.set(e,o),this.patchRootIdOnNode(i.data.node,o),{timestamp:i.timestamp,type:W.IncrementalSnapshot,data:{source:F.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:i.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case W.Meta:case W.Load:case W.DomContentLoaded:return!1;case W.Plugin:return i;case W.Custom:return this.replaceIds(i.data.payload,e,["id","parentId","previousId","nextId"]),i;case W.IncrementalSnapshot:switch(i.data.source){case F.Mutation:return i.data.adds.forEach(o=>{this.replaceIds(o,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(o.node,s)}),i.data.removes.forEach(o=>{this.replaceIds(o,e,["parentId","id"])}),i.data.attributes.forEach(o=>{this.replaceIds(o,e,["id"])}),i.data.texts.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case F.Drag:case F.TouchMove:case F.MouseMove:return i.data.positions.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case F.ViewportResize:return!1;case F.MediaInteraction:case F.MouseInteraction:case F.Scroll:case F.CanvasMutation:case F.Input:return this.replaceIds(i.data,e,["id"]),i;case F.StyleSheetRule:case F.StyleDeclaration:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleId"]),i;case F.Font:return i;case F.Selection:return i.data.ranges.forEach(o=>{this.replaceIds(o,e,["start","end"])}),i;case F.AdoptedStyleSheet:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleIds"]),(t=i.data.styles)===null||t===void 0||t.forEach(o=>{this.replaceStyleIds(o,e,["styleId"])}),i}}return!1}replace(e,i,t,o){for(const s of o)!Array.isArray(i[s])&&typeof i[s]!="number"||(Array.isArray(i[s])?i[s]=e.getIds(t,i[s]):i[s]=e.getId(t,i[s]));return i}replaceIds(e,i,t){return this.replace(this.crossOriginIframeMirror,e,i,t)}replaceStyleIds(e,i,t){return this.replace(this.crossOriginIframeStyleMirror,e,i,t)}replaceIdOnNode(e,i){this.replaceIds(e,i,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(t=>{this.replaceIdOnNode(t,i)})}patchRootIdOnNode(e,i){e.type!==le.Document&&!e.rootId&&(e.rootId=i),"childNodes"in e&&e.childNodes.forEach(t=>{this.patchRootIdOnNode(t,i)})}}class Va{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,i){if(!zn(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const t=io(Object.assign(Object.assign({},this.bypassOptions),{doc:i,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>t.disconnect()),this.restoreHandlers.push(to(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(so({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,i){const t=this;this.restoreHandlers.push(In(e.prototype,"attachShadow",function(o){return function(s){const r=o.call(this,s);return this.shadowRoot&&Jt(this)&&t.addShadowRoot(this.shadowRoot,i),r}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
732
+ or you can use record.mirror to access the mirror instance during recording.`;let jt={map:{},getId(){return console.error(Nn),-1},getNode(){return console.error(Nn),null},removeNodeFromMap(){console.error(Nn)},has(){return console.error(Nn),!1},reset(){console.error(Nn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(jt=new Proxy(jt,{get(n,e,i){return e==="map"&&console.error(Nn),Reflect.get(n,e,i)}}));function qn(n,e,i={}){let t=null,o=0;return function(...s){const r=Date.now();!o&&i.leading===!1&&(o=r);const l=e-(r-o),c=this;l<=0||l>e?(t&&(clearTimeout(t),t=null),o=r,n.apply(c,s)):!t&&i.trailing!==!1&&(t=setTimeout(()=>{o=i.leading===!1?0:Date.now(),t=null,n.apply(c,s)},l))}}function mi(n,e,i,t,o=window){const s=o.Object.getOwnPropertyDescriptor(n,e);return o.Object.defineProperty(n,e,t?i:{set(r){setTimeout(()=>{i.set.call(this,r)},0),s&&s.set&&s.set.call(this,r)}}),()=>mi(n,e,s||{},!0)}function In(n,e,i){try{if(!(e in n))return()=>{};const t=n[e],o=i(t);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:t}})),n[e]=o,()=>{n[e]=t}}catch{return()=>{}}}let pi=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(pi=()=>new Date().getTime());function Vt(n){var e,i,t,o,s,r;const l=n.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:(l==null?void 0:l.documentElement.scrollLeft)||((i=(e=l==null?void 0:l.body)===null||e===void 0?void 0:e.parentElement)===null||i===void 0?void 0:i.scrollLeft)||((t=l==null?void 0:l.body)===null||t===void 0?void 0:t.scrollLeft)||0,top:l.scrollingElement?l.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(l==null?void 0:l.documentElement.scrollTop)||((s=(o=l==null?void 0:l.body)===null||o===void 0?void 0:o.parentElement)===null||s===void 0?void 0:s.scrollTop)||((r=l==null?void 0:l.body)===null||r===void 0?void 0:r.scrollTop)||0}}function Gt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function zt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ft(n){return n?n.nodeType===n.ELEMENT_NODE?n:n.parentElement:null}function _e(n,e,i,t){if(!n)return!1;const o=Ft(n);if(!o)return!1;try{if(typeof e=="string"){if(o.classList.contains(e)||t&&o.closest("."+e)!==null)return!0}else if(hi(o,e,t))return!0}catch{}return!!(i&&(o.matches(i)||t&&o.closest(i)!==null))}function ya(n,e){return e.getId(n)!==-1}function Vi(n,e){return e.getId(n)===Fn}function qt(n,e){if(Gn(n))return!1;const i=e.getId(n);return e.has(i)?n.parentNode&&n.parentNode.nodeType===n.DOCUMENT_NODE?!1:n.parentNode?qt(n.parentNode,e):!0:!0}function Gi(n){return!!n.changedTouches}function ka(n=window){"NodeList"in n&&!n.NodeList.prototype.forEach&&(n.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in n&&!n.DOMTokenList.prototype.forEach&&(n.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let i=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===i)return!0;while(i=i&&i.parentNode);return!1})}function Wt(n,e){return!!(n.nodeName==="IFRAME"&&e.getMeta(n))}function Zt(n,e){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&e.getMeta(n))}function zi(n){return!!(n!=null&&n.shadowRoot)}class wa{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var i;return(i=this.styleIDMap.get(e))!==null&&i!==void 0?i:-1}has(e){return this.styleIDMap.has(e)}add(e,i){if(this.has(e))return this.getId(e);let t;return i===void 0?t=this.id++:t=i,this.styleIDMap.set(e,t),this.idStyleMap.set(t,e),t}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Jt(n){var e,i;let t=null;return((i=(e=n.getRootNode)===null||e===void 0?void 0:e.call(n))===null||i===void 0?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(t=n.getRootNode().host),t}function Ca(n){let e=n,i;for(;i=Jt(e);)e=i;return e}function Sa(n){const e=n.ownerDocument;if(!e)return!1;const i=Ca(n);return e.contains(i)}function $t(n){const e=n.ownerDocument;return e?e.contains(n)||Sa(n):!1}var W=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(W||{}),F=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(F||{}),Le=(n=>(n[n.MouseUp=0]="MouseUp",n[n.MouseDown=1]="MouseDown",n[n.Click=2]="Click",n[n.ContextMenu=3]="ContextMenu",n[n.DblClick=4]="DblClick",n[n.Focus=5]="Focus",n[n.Blur=6]="Blur",n[n.TouchStart=7]="TouchStart",n[n.TouchMove_Departed=8]="TouchMove_Departed",n[n.TouchEnd=9]="TouchEnd",n[n.TouchCancel=10]="TouchCancel",n))(Le||{}),Ze=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(Ze||{}),Bn=(n=>(n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n))(Bn||{});function Yt(n){return"__ln"in n}class _a{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let i=this.head;for(let t=0;t<e;t++)i=(i==null?void 0:i.next)||null;return i}addNode(e){const i={value:e,previous:null,next:null};if(e.__ln=i,e.previousSibling&&Yt(e.previousSibling)){const t=e.previousSibling.__ln.next;i.next=t,i.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=i,t&&(t.previous=i)}else if(e.nextSibling&&Yt(e.nextSibling)&&e.nextSibling.__ln.previous){const t=e.nextSibling.__ln.previous;i.previous=t,i.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=i,t&&(t.next=i)}else this.head&&(this.head.previous=i),i.next=this.head,this.head=i;i.next===null&&(this.tail=i),this.length++}removeNode(e){const i=e.__ln;this.head&&(i.previous?(i.previous.next=i.next,i.next?i.next.previous=i.previous:this.tail=i.previous):(this.head=i.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Qt=(n,e)=>`${n}@${e}`;class Ma{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],i=new Set,t=new _a,o=c=>{let b=c,p=Fn;for(;p===Fn;)b=b&&b.nextSibling,p=b&&this.mirror.getId(b);return p},s=c=>{if(!c.parentNode||!$t(c)||c.parentNode.tagName==="TEXTAREA")return;const b=Gn(c.parentNode)?this.mirror.getId(Jt(c)):this.mirror.getId(c.parentNode),p=o(c);if(b===-1||p===-1)return t.addNode(c);const g=Pn(c,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:f=>{Wt(f,this.mirror)&&this.iframeManager.addIframe(f),Zt(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),zi(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(f,y)=>{this.iframeManager.attachIframe(f,y),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,y)=>{this.stylesheetManager.attachLinkElement(f,y)}});g&&(e.push({parentId:b,nextId:p,node:g}),i.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)Xt(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||s(c);for(const c of this.addedSet)!no(this.droppedSet,c)&&!Xt(this.removes,c,this.mirror)||no(this.movedSet,c)?s(c):this.droppedSet.add(c);let r=null;for(;t.length;){let c=null;if(r){const b=this.mirror.getId(r.value.parentNode),p=o(r.value);b!==-1&&p!==-1&&(c=r)}if(!c){let b=t.tail;for(;b;){const p=b;if(b=b.previous,p){const g=this.mirror.getId(p.value.parentNode);if(o(p.value)===-1)continue;if(g!==-1){c=p;break}else{const y=p.value;if(y.parentNode&&y.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const C=y.parentNode.host;if(this.mirror.getId(C)!==-1){c=p;break}}}}}}if(!c){for(;t.head;)t.removeNode(t.head.value);break}r=c.previous,t.removeNode(c.value),s(c.value)}const l={texts:this.texts.map(c=>{const b=c.node;return b.parentNode&&b.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(b.parentNode),{id:this.mirror.getId(b),value:c.value}}).filter(c=>!i.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:b}=c;if(typeof b.style=="string"){const p=JSON.stringify(c.styleDiff),g=JSON.stringify(c._unchangedStyles);p.length<b.style.length&&(p+g).split("var(").length===b.style.split("var(").length&&(b.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:b}}).filter(c=>!i.has(c.id)).filter(c=>this.mirror.has(c.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(l))},this.genTextAreaValueMutation=e=>{let i=this.attributeMap.get(e);i||(i={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e,i)),i.attributes.value=Array.from(e.childNodes,t=>t.textContent||"").join("")},this.processMutation=e=>{if(!Vi(e.target,this.mirror))switch(e.type){case"characterData":{const i=e.target.textContent;!_e(e.target,this.blockClass,this.blockSelector,!1)&&i!==e.oldValue&&this.texts.push({value:Kt(e.target,this.maskTextClass,this.maskTextSelector,!0)&&i?this.maskTextFn?this.maskTextFn(i,Ft(e.target)):i.replace(/[\S]/g,"*"):i,node:e.target});break}case"attributes":{const i=e.target;let t=e.attributeName,o=e.target.getAttribute(t);if(t==="value"){const r=Ki(i);o=Ui({element:i,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:r,value:o,maskInputFn:this.maskInputFn})}if(_e(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let s=this.attributeMap.get(e.target);if(i.tagName==="IFRAME"&&t==="src"&&!this.keepIframeSrcFn(o))if(!i.contentDocument)t="rr_src";else return;if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),t==="type"&&i.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&i.setAttribute("data-rr-is-password","true"),!Ut(i.tagName,t)&&(s.attributes[t]=Ht(this.doc,gn(i.tagName),gn(t),o),t==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const r=this.unattachedDoc.createElement("span");e.oldValue&&r.setAttribute("style",e.oldValue);for(const l of Array.from(i.style)){const c=i.style.getPropertyValue(l),b=i.style.getPropertyPriority(l);c!==r.style.getPropertyValue(l)||b!==r.style.getPropertyPriority(l)?b===""?s.styleDiff[l]=c:s.styleDiff[l]=[c,b]:s._unchangedStyles[l]=[c,b]}for(const l of Array.from(r.style))i.style.getPropertyValue(l)===""&&(s.styleDiff[l]=!1)}break}case"childList":{if(_e(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(i=>this.genAdds(i,e.target)),e.removedNodes.forEach(i=>{const t=this.mirror.getId(i),o=Gn(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);_e(e.target,this.blockClass,this.blockSelector,!1)||Vi(i,this.mirror)||!ya(i,this.mirror)||(this.addedSet.has(i)?(Fi(this.addedSet,i),this.droppedSet.add(i)):this.addedSet.has(e.target)&&t===-1||qt(e.target,this.mirror)||(this.movedSet.has(i)&&this.movedMap[Qt(t,o)]?Fi(this.movedSet,i):this.removes.push({parentId:o,id:t,isShadow:Gn(e.target)&&zn(e.target)?!0:void 0})),this.mapRemoves.push(i))});break}}},this.genAdds=(e,i)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Vi(e,this.mirror))return;this.movedSet.add(e);let t=null;i&&this.mirror.hasNode(i)&&(t=this.mirror.getId(i)),t&&t!==-1&&(this.movedMap[Qt(this.mirror.getId(e),t)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);_e(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach(t=>this.genAdds(t)),zi(e)&&e.shadowRoot.childNodes.forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(i=>{this[i]=e[i]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Fi(n,e){n.delete(e),e.childNodes.forEach(i=>Fi(n,i))}function Xt(n,e,i){return n.length===0?!1:eo(n,e,i)}function eo(n,e,i){const{parentNode:t}=e;if(!t)return!1;const o=i.getId(t);return n.some(s=>s.id===o)?!0:eo(n,t,i)}function no(n,e){return n.size===0?!1:io(n,e)}function io(n,e){const{parentNode:i}=e;return i?n.has(i)?!0:io(n,i):!1}let Wn;function Aa(n){Wn=n}function xa(){Wn=void 0}const q=n=>Wn?(...i)=>{try{return n(...i)}catch(t){if(Wn&&Wn(t)===!0)return;throw t}}:n,yn=[];function Zn(n){try{if("composedPath"in n){const e=n.composedPath();if(e.length)return e[0]}else if("path"in n&&n.path.length)return n.path[0]}catch{}return n&&n.target}function to(n,e){var i,t;const o=new Ma;yn.push(o),o.init(n);let s=window.MutationObserver||window.__rrMutationObserver;const r=(t=(i=window==null?void 0:window.Zone)===null||i===void 0?void 0:i.__symbol__)===null||t===void 0?void 0:t.call(i,"MutationObserver");r&&window[r]&&(s=window[r]);const l=new s(q(o.processMutations.bind(o)));return l.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}function La({mousemoveCb:n,sampling:e,doc:i,mirror:t}){if(e.mousemove===!1)return()=>{};const o=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let r=[],l;const c=qn(q(g=>{const f=Date.now()-l;n(r.map(y=>(y.timeOffset-=f,y)),g),r=[],l=null}),s),b=q(qn(q(g=>{const f=Zn(g),{clientX:y,clientY:C}=Gi(g)?g.changedTouches[0]:g;l||(l=pi()),r.push({x:y,y:C,id:t.getId(f),timeOffset:pi()-l}),c(typeof DragEvent<"u"&&g instanceof DragEvent?F.Drag:g instanceof MouseEvent?F.MouseMove:F.TouchMove)}),o,{trailing:!1})),p=[Se("mousemove",b,i),Se("touchmove",b,i),Se("drag",b,i)];return q(()=>{p.forEach(g=>g())})}function Ta({mouseInteractionCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};const r=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[];let c=null;const b=p=>g=>{const f=Zn(g);if(_e(f,t,o,!0))return;let y=null,C=p;if("pointerType"in g){switch(g.pointerType){case"mouse":y=Ze.Mouse;break;case"touch":y=Ze.Touch;break;case"pen":y=Ze.Pen;break}y===Ze.Touch?Le[p]===Le.MouseDown?C="TouchStart":Le[p]===Le.MouseUp&&(C="TouchEnd"):Ze.Pen}else Gi(g)&&(y=Ze.Touch);y!==null?(c=y,(C.startsWith("Touch")&&y===Ze.Touch||C.startsWith("Mouse")&&y===Ze.Mouse)&&(y=null)):Le[p]===Le.Click&&(y=c,c=null);const k=Gi(g)?g.changedTouches[0]:g;if(!k)return;const S=i.getId(f),{clientX:M,clientY:A}=k;q(n)(Object.assign({type:Le[C],id:S,x:M,y:A},y!==null&&{pointerType:y}))};return Object.keys(Le).filter(p=>Number.isNaN(Number(p))&&!p.endsWith("_Departed")&&r[p]!==!1).forEach(p=>{let g=gn(p);const f=b(p);if(window.PointerEvent)switch(Le[p]){case Le.MouseDown:case Le.MouseUp:g=g.replace("mouse","pointer");break;case Le.TouchStart:case Le.TouchEnd:return}l.push(Se(g,f,e))}),q(()=>{l.forEach(p=>p())})}function oo({scrollCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,sampling:s}){const r=q(qn(q(l=>{const c=Zn(l);if(!c||_e(c,t,o,!0))return;const b=i.getId(c);if(c===e&&e.defaultView){const p=Vt(e.defaultView);n({id:b,x:p.left,y:p.top})}else n({id:b,x:c.scrollLeft,y:c.scrollTop})}),s.scroll||100));return Se("scroll",r,e)}function Ea({viewportResizeCb:n},{win:e}){let i=-1,t=-1;const o=q(qn(q(()=>{const s=Gt(),r=zt();(i!==s||t!==r)&&(n({width:Number(r),height:Number(s)}),i=s,t=r)}),200));return Se("resize",o,e)}const Pa=["INPUT","TEXTAREA","SELECT"],so=new WeakMap;function Na({inputCb:n,doc:e,mirror:i,blockClass:t,blockSelector:o,ignoreClass:s,ignoreSelector:r,maskInputOptions:l,maskInputFn:c,sampling:b,userTriggeredOnInput:p}){function g(A){let _=Zn(A);const E=A.isTrusted,N=_&&_.tagName;if(_&&N==="OPTION"&&(_=_.parentElement),!_||!N||Pa.indexOf(N)<0||_e(_,t,o,!0)||_.classList.contains(s)||r&&_.matches(r))return;let G=_.value,z=!1;const U=Ki(_)||"";U==="radio"||U==="checkbox"?z=_.checked:(l[N.toLowerCase()]||l[U])&&(G=Ui({element:_,maskInputOptions:l,tagName:N,type:U,value:G,maskInputFn:c})),f(_,p?{text:G,isChecked:z,userTriggered:E}:{text:G,isChecked:z});const V=_.name;U==="radio"&&V&&z&&e.querySelectorAll(`input[type="radio"][name="${V}"]`).forEach(oe=>{if(oe!==_){const fe=oe.value;f(oe,p?{text:fe,isChecked:!z,userTriggered:!1}:{text:fe,isChecked:!z})}})}function f(A,_){const E=so.get(A);if(!E||E.text!==_.text||E.isChecked!==_.isChecked){so.set(A,_);const N=i.getId(A);q(n)(Object.assign(Object.assign({},_),{id:N}))}}const C=(b.input==="last"?["change"]:["input","change"]).map(A=>Se(A,q(g),e)),k=e.defaultView;if(!k)return()=>{C.forEach(A=>A())};const S=k.Object.getOwnPropertyDescriptor(k.HTMLInputElement.prototype,"value"),M=[[k.HTMLInputElement.prototype,"value"],[k.HTMLInputElement.prototype,"checked"],[k.HTMLSelectElement.prototype,"value"],[k.HTMLTextAreaElement.prototype,"value"],[k.HTMLSelectElement.prototype,"selectedIndex"],[k.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&C.push(...M.map(A=>mi(A[0],A[1],{set(){q(g)({target:this,isTrusted:!1})}},!1,k))),q(()=>{C.forEach(A=>A())})}function bi(n){const e=[];function i(t,o){if(vi("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||vi("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||vi("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||vi("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const r=Array.from(t.parentRule.cssRules).indexOf(t);o.unshift(r)}else if(t.parentStyleSheet){const r=Array.from(t.parentStyleSheet.cssRules).indexOf(t);o.unshift(r)}return o}return i(n,e)}function an(n,e,i){let t,o;return n?(n.ownerNode?t=e.getId(n.ownerNode):o=i.getId(n),{styleId:o,id:t}):{}}function Ia({styleSheetRuleCb:n,mirror:e,stylesheetManager:i},{win:t}){if(!t.CSSStyleSheet||!t.CSSStyleSheet.prototype)return()=>{};const o=t.CSSStyleSheet.prototype.insertRule;t.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:q((p,g,f)=>{const[y,C]=f,{id:k,styleId:S}=an(g,e,i.styleMirror);return(k&&k!==-1||S&&S!==-1)&&n({id:k,styleId:S,adds:[{rule:y,index:C}]}),p.apply(g,f)})});const s=t.CSSStyleSheet.prototype.deleteRule;t.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,removes:[{index:y}]}),p.apply(g,f)})});let r;t.CSSStyleSheet.prototype.replace&&(r=t.CSSStyleSheet.prototype.replace,t.CSSStyleSheet.prototype.replace=new Proxy(r,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,replace:y}),p.apply(g,f)})}));let l;t.CSSStyleSheet.prototype.replaceSync&&(l=t.CSSStyleSheet.prototype.replaceSync,t.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:q((p,g,f)=>{const[y]=f,{id:C,styleId:k}=an(g,e,i.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,replaceSync:y}),p.apply(g,f)})}));const c={};fi("CSSGroupingRule")?c.CSSGroupingRule=t.CSSGroupingRule:(fi("CSSMediaRule")&&(c.CSSMediaRule=t.CSSMediaRule),fi("CSSConditionRule")&&(c.CSSConditionRule=t.CSSConditionRule),fi("CSSSupportsRule")&&(c.CSSSupportsRule=t.CSSSupportsRule));const b={};return Object.entries(c).forEach(([p,g])=>{b[p]={insertRule:g.prototype.insertRule,deleteRule:g.prototype.deleteRule},g.prototype.insertRule=new Proxy(b[p].insertRule,{apply:q((f,y,C)=>{const[k,S]=C,{id:M,styleId:A}=an(y.parentStyleSheet,e,i.styleMirror);return(M&&M!==-1||A&&A!==-1)&&n({id:M,styleId:A,adds:[{rule:k,index:[...bi(y),S||0]}]}),f.apply(y,C)})}),g.prototype.deleteRule=new Proxy(b[p].deleteRule,{apply:q((f,y,C)=>{const[k]=C,{id:S,styleId:M}=an(y.parentStyleSheet,e,i.styleMirror);return(S&&S!==-1||M&&M!==-1)&&n({id:S,styleId:M,removes:[{index:[...bi(y),k]}]}),f.apply(y,C)})})}),q(()=>{t.CSSStyleSheet.prototype.insertRule=o,t.CSSStyleSheet.prototype.deleteRule=s,r&&(t.CSSStyleSheet.prototype.replace=r),l&&(t.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([p,g])=>{g.prototype.insertRule=b[p].insertRule,g.prototype.deleteRule=b[p].deleteRule})})}function ao({mirror:n,stylesheetManager:e},i){var t,o,s;let r=null;i.nodeName==="#document"?r=n.getId(i):r=n.getId(i.host);const l=i.nodeName==="#document"?(t=i.defaultView)===null||t===void 0?void 0:t.Document:(s=(o=i.ownerDocument)===null||o===void 0?void 0:o.defaultView)===null||s===void 0?void 0:s.ShadowRoot,c=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return r===null||r===-1||!l||!c?()=>{}:(Object.defineProperty(i,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var b;return(b=c.get)===null||b===void 0?void 0:b.call(this)},set(b){var p;const g=(p=c.set)===null||p===void 0?void 0:p.call(this,b);if(r!==null&&r!==-1)try{e.adoptStyleSheets(b,r)}catch{}return g}}),q(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))}function Ba({styleDeclarationCb:n,mirror:e,ignoreCSSAttributes:i,stylesheetManager:t},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:q((l,c,b)=>{var p;const[g,f,y]=b;if(i.has(g))return s.apply(c,[g,f,y]);const{id:C,styleId:k}=an((p=c.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(C&&C!==-1||k&&k!==-1)&&n({id:C,styleId:k,set:{property:g,value:f,priority:y},index:bi(c.parentRule)}),l.apply(c,b)})});const r=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(r,{apply:q((l,c,b)=>{var p;const[g]=b;if(i.has(g))return r.apply(c,[g]);const{id:f,styleId:y}=an((p=c.parentRule)===null||p===void 0?void 0:p.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||y&&y!==-1)&&n({id:f,styleId:y,remove:{property:g},index:bi(c.parentRule)}),l.apply(c,b)})}),q(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=r})}function Ra({mediaInteractionCb:n,blockClass:e,blockSelector:i,mirror:t,sampling:o,doc:s}){const r=q(c=>qn(q(b=>{const p=Zn(b);if(!p||_e(p,e,i,!0))return;const{currentTime:g,volume:f,muted:y,playbackRate:C,loop:k}=p;n({type:c,id:t.getId(p),currentTime:g,volume:f,muted:y,playbackRate:C,loop:k})}),o.media||500)),l=[Se("play",r(0),s),Se("pause",r(1),s),Se("seeked",r(2),s),Se("volumechange",r(3),s),Se("ratechange",r(4),s)];return q(()=>{l.forEach(c=>c())})}function Da({fontCb:n,doc:e}){const i=e.defaultView;if(!i)return()=>{};const t=[],o=new WeakMap,s=i.FontFace;i.FontFace=function(c,b,p){const g=new s(c,b,p);return o.set(g,{family:c,buffer:typeof b!="string",descriptors:p,fontSource:typeof b=="string"?b:JSON.stringify(Array.from(new Uint8Array(b)))}),g};const r=In(e.fonts,"add",function(l){return function(c){return setTimeout(q(()=>{const b=o.get(c);b&&(n(b),o.delete(c))}),0),l.apply(this,[c])}});return t.push(()=>{i.FontFace=s}),t.push(r),q(()=>{t.forEach(l=>l())})}function Oa(n){const{doc:e,mirror:i,blockClass:t,blockSelector:o,selectionCb:s}=n;let r=!0;const l=q(()=>{const c=e.getSelection();if(!c||r&&(c!=null&&c.isCollapsed))return;r=c.isCollapsed||!1;const b=[],p=c.rangeCount||0;for(let g=0;g<p;g++){const f=c.getRangeAt(g),{startContainer:y,startOffset:C,endContainer:k,endOffset:S}=f;_e(y,t,o,!0)||_e(k,t,o,!0)||b.push({start:i.getId(y),startOffset:C,end:i.getId(k),endOffset:S})}s({ranges:b})});return l(),Se("selectionchange",l)}function Ha({doc:n,customElementCb:e}){const i=n.defaultView;return!i||!i.customElements?()=>{}:In(i.customElements,"define",function(o){return function(s,r,l){try{e({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,r,l])}})}function Ua(n,e){const{mutationCb:i,mousemoveCb:t,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:r,inputCb:l,mediaInteractionCb:c,styleSheetRuleCb:b,styleDeclarationCb:p,canvasMutationCb:g,fontCb:f,selectionCb:y,customElementCb:C}=n;n.mutationCb=(...k)=>{e.mutation&&e.mutation(...k),i(...k)},n.mousemoveCb=(...k)=>{e.mousemove&&e.mousemove(...k),t(...k)},n.mouseInteractionCb=(...k)=>{e.mouseInteraction&&e.mouseInteraction(...k),o(...k)},n.scrollCb=(...k)=>{e.scroll&&e.scroll(...k),s(...k)},n.viewportResizeCb=(...k)=>{e.viewportResize&&e.viewportResize(...k),r(...k)},n.inputCb=(...k)=>{e.input&&e.input(...k),l(...k)},n.mediaInteractionCb=(...k)=>{e.mediaInteaction&&e.mediaInteaction(...k),c(...k)},n.styleSheetRuleCb=(...k)=>{e.styleSheetRule&&e.styleSheetRule(...k),b(...k)},n.styleDeclarationCb=(...k)=>{e.styleDeclaration&&e.styleDeclaration(...k),p(...k)},n.canvasMutationCb=(...k)=>{e.canvasMutation&&e.canvasMutation(...k),g(...k)},n.fontCb=(...k)=>{e.font&&e.font(...k),f(...k)},n.selectionCb=(...k)=>{e.selection&&e.selection(...k),y(...k)},n.customElementCb=(...k)=>{e.customElement&&e.customElement(...k),C(...k)}}function Ka(n,e={}){const i=n.doc.defaultView;if(!i)return()=>{};Ua(n,e);let t;n.recordDOM&&(t=to(n,n.doc));const o=La(n),s=Ta(n),r=oo(n),l=Ea(n,{win:i}),c=Na(n),b=Ra(n);let p=()=>{},g=()=>{},f=()=>{},y=()=>{};n.recordDOM&&(p=Ia(n,{win:i}),g=ao(n,n.doc),f=Ba(n,{win:i}),n.collectFonts&&(y=Da(n)));const C=Oa(n),k=Ha(n),S=[];for(const M of n.plugins)S.push(M.observer(M.callback,i,M.options));return q(()=>{yn.forEach(M=>M.reset()),t==null||t.disconnect(),o(),s(),r(),l(),c(),b(),p(),g(),f(),y(),C(),k(),S.forEach(M=>M())})}function vi(n){return typeof window[n]<"u"}function fi(n){return!!(typeof window[n]<"u"&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class ro{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,i,t,o){const s=t||this.getIdToRemoteIdMap(e),r=o||this.getRemoteIdToIdMap(e);let l=s.get(i);return l||(l=this.generateIdFn(),s.set(i,l),r.set(l,i)),l}getIds(e,i){const t=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return i.map(s=>this.getId(e,s,t,o))}getRemoteId(e,i,t){const o=t||this.getRemoteIdToIdMap(e);if(typeof i!="number")return i;const s=o.get(i);return s||-1}getRemoteIds(e,i){const t=this.getRemoteIdToIdMap(e);return i.map(o=>this.getRemoteId(e,o,t))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let i=this.iframeIdToRemoteIdMap.get(e);return i||(i=new Map,this.iframeIdToRemoteIdMap.set(e,i)),i}getRemoteIdToIdMap(e){let i=this.iframeRemoteIdToIdMap.get(e);return i||(i=new Map,this.iframeRemoteIdToIdMap.set(e,i)),i}}class ja{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new ro(Dt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ro(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,i){var t;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:i}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(t=this.loadListener)===null||t===void 0||t.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const i=e;if(i.data.type!=="rrweb"||i.origin!==i.data.origin||!e.source)return;const o=this.crossOriginIframeMap.get(e.source);if(!o)return;const s=this.transformCrossOriginEvent(o,i.data.event);s&&this.wrappedEmit(s,i.data.isCheckout)}transformCrossOriginEvent(e,i){var t;switch(i.type){case W.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(i.data.node,e);const o=i.data.node.id;return this.crossOriginIframeRootIdMap.set(e,o),this.patchRootIdOnNode(i.data.node,o),{timestamp:i.timestamp,type:W.IncrementalSnapshot,data:{source:F.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:i.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case W.Meta:case W.Load:case W.DomContentLoaded:return!1;case W.Plugin:return i;case W.Custom:return this.replaceIds(i.data.payload,e,["id","parentId","previousId","nextId"]),i;case W.IncrementalSnapshot:switch(i.data.source){case F.Mutation:return i.data.adds.forEach(o=>{this.replaceIds(o,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(o.node,s)}),i.data.removes.forEach(o=>{this.replaceIds(o,e,["parentId","id"])}),i.data.attributes.forEach(o=>{this.replaceIds(o,e,["id"])}),i.data.texts.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case F.Drag:case F.TouchMove:case F.MouseMove:return i.data.positions.forEach(o=>{this.replaceIds(o,e,["id"])}),i;case F.ViewportResize:return!1;case F.MediaInteraction:case F.MouseInteraction:case F.Scroll:case F.CanvasMutation:case F.Input:return this.replaceIds(i.data,e,["id"]),i;case F.StyleSheetRule:case F.StyleDeclaration:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleId"]),i;case F.Font:return i;case F.Selection:return i.data.ranges.forEach(o=>{this.replaceIds(o,e,["start","end"])}),i;case F.AdoptedStyleSheet:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleIds"]),(t=i.data.styles)===null||t===void 0||t.forEach(o=>{this.replaceStyleIds(o,e,["styleId"])}),i}}return!1}replace(e,i,t,o){for(const s of o)!Array.isArray(i[s])&&typeof i[s]!="number"||(Array.isArray(i[s])?i[s]=e.getIds(t,i[s]):i[s]=e.getId(t,i[s]));return i}replaceIds(e,i,t){return this.replace(this.crossOriginIframeMirror,e,i,t)}replaceStyleIds(e,i,t){return this.replace(this.crossOriginIframeStyleMirror,e,i,t)}replaceIdOnNode(e,i){this.replaceIds(e,i,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(t=>{this.replaceIdOnNode(t,i)})}patchRootIdOnNode(e,i){e.type!==le.Document&&!e.rootId&&(e.rootId=i),"childNodes"in e&&e.childNodes.forEach(t=>{this.patchRootIdOnNode(t,i)})}}class Va{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,i){if(!zn(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const t=to(Object.assign(Object.assign({},this.bypassOptions),{doc:i,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>t.disconnect()),this.restoreHandlers.push(oo(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(ao({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,i){const t=this;this.restoreHandlers.push(In(e.prototype,"attachShadow",function(o){return function(s){const r=o.call(this,s);return this.shadowRoot&&$t(this)&&t.addShadowRoot(this.shadowRoot,i),r}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
727
733
  Copyright (c) Microsoft Corporation.
728
734
 
729
735
  Permission to use, copy, modify, and/or distribute this software for any
@@ -736,7 +742,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
736
742
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
737
743
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
738
744
  PERFORMANCE OF THIS SOFTWARE.
739
- ***************************************************************************** */function Ga(n,e){var i={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(i[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(n);o<t.length;o++)e.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(n,t[o])&&(i[t[o]]=n[t[o]]);return i}function za(n,e,i,t){function o(s){return s instanceof i?s:new i(function(r){r(s)})}return new(i||(i=Promise))(function(s,r){function l(p){try{b(t.next(p))}catch(g){r(g)}}function c(p){try{b(t.throw(p))}catch(g){r(g)}}function b(p){p.done?s(p.value):o(p.value).then(l,c)}b((t=t.apply(n,[])).next())})}for(var Rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fa=typeof Uint8Array>"u"?[]:new Uint8Array(256),gi=0;gi<Rn.length;gi++)Fa[Rn.charCodeAt(gi)]=gi;var qa=function(n){var e=new Uint8Array(n),i,t=e.length,o="";for(i=0;i<t;i+=3)o+=Rn[e[i]>>2],o+=Rn[(e[i]&3)<<4|e[i+1]>>4],o+=Rn[(e[i+1]&15)<<2|e[i+2]>>6],o+=Rn[e[i+2]&63];return t%3===2?o=o.substring(0,o.length-1)+"=":t%3===1&&(o=o.substring(0,o.length-2)+"=="),o};const ro=new Map;function Wa(n,e){let i=ro.get(n);return i||(i=new Map,ro.set(n,i)),i.has(e)||i.set(e,[]),i.get(e)}const lo=(n,e,i)=>{if(!n||!(uo(n,e)||typeof n=="object"))return;const t=n.constructor.name,o=Wa(i,t);let s=o.indexOf(n);return s===-1&&(s=o.length,o.push(n)),s};function yi(n,e,i){if(n instanceof Array)return n.map(t=>yi(t,e,i));if(n===null)return n;if(n instanceof Float32Array||n instanceof Float64Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Uint8Array||n instanceof Uint16Array||n instanceof Int16Array||n instanceof Int8Array||n instanceof Uint8ClampedArray)return{rr_type:n.constructor.name,args:[Object.values(n)]};if(n instanceof ArrayBuffer){const t=n.constructor.name,o=qa(n);return{rr_type:t,base64:o}}else{if(n instanceof DataView)return{rr_type:n.constructor.name,args:[yi(n.buffer,e,i),n.byteOffset,n.byteLength]};if(n instanceof HTMLImageElement){const t=n.constructor.name,{src:o}=n;return{rr_type:t,src:o}}else if(n instanceof HTMLCanvasElement){const t="HTMLImageElement",o=n.toDataURL();return{rr_type:t,src:o}}else{if(n instanceof ImageData)return{rr_type:n.constructor.name,args:[yi(n.data,e,i),n.width,n.height]};if(uo(n,e)||typeof n=="object"){const t=n.constructor.name,o=lo(n,e,i);return{rr_type:t,index:o}}}}return n}const co=(n,e,i)=>n.map(t=>yi(t,e,i)),uo=(n,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof e[o]=="function").find(o=>n instanceof e[o]);function Za(n,e,i,t){const o=[],s=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const r of s)try{if(typeof e.CanvasRenderingContext2D.prototype[r]!="function")continue;const l=In(e.CanvasRenderingContext2D.prototype,r,function(c){return function(...b){return _e(this.canvas,i,t,!0)||setTimeout(()=>{const p=co(b,e,this);n(this.canvas,{type:Bn["2D"],property:r,args:p})},0),c.apply(this,b)}});o.push(l)}catch{const c=mi(e.CanvasRenderingContext2D.prototype,r,{set(b){n(this.canvas,{type:Bn["2D"],property:r,args:[b],setter:!0})}});o.push(c)}return()=>{o.forEach(r=>r())}}function Ja(n){return n==="experimental-webgl"?"webgl":n}function ho(n,e,i,t){const o=[];try{const s=In(n.HTMLCanvasElement.prototype,"getContext",function(r){return function(l,...c){if(!_e(this,e,i,!0)){const b=Ja(l);if("__context"in this||(this.__context=b),t&&["webgl","webgl2"].includes(b))if(c[0]&&typeof c[0]=="object"){const p=c[0];p.preserveDrawingBuffer||(p.preserveDrawingBuffer=!0)}else c.splice(0,1,{preserveDrawingBuffer:!0})}return r.apply(this,[l,...c])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function mo(n,e,i,t,o,s,r){const l=[],c=Object.getOwnPropertyNames(n);for(const b of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(b))try{if(typeof n[b]!="function")continue;const p=In(n,b,function(g){return function(...f){const y=g.apply(this,f);if(lo(y,r,this),"tagName"in this.canvas&&!_e(this.canvas,t,o,!0)){const C=co(f,r,this),k={type:e,property:b,args:C};i(this.canvas,k)}return y}});l.push(p)}catch{const g=mi(n,b,{set(f){i(this.canvas,{type:e,property:b,args:[f],setter:!0})}});l.push(g)}return l}function $a(n,e,i,t,o){const s=[];return s.push(...mo(e.WebGLRenderingContext.prototype,Bn.WebGL,n,i,t,o,e)),typeof e.WebGL2RenderingContext<"u"&&s.push(...mo(e.WebGL2RenderingContext.prototype,Bn.WebGL2,n,i,t,o,e)),()=>{s.forEach(r=>r())}}function Ya(n,e){var i=n.toString(),t=i.split(`
745
+ ***************************************************************************** */function Ga(n,e){var i={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.indexOf(t)<0&&(i[t]=n[t]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(n);o<t.length;o++)e.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(n,t[o])&&(i[t[o]]=n[t[o]]);return i}function za(n,e,i,t){function o(s){return s instanceof i?s:new i(function(r){r(s)})}return new(i||(i=Promise))(function(s,r){function l(p){try{b(t.next(p))}catch(g){r(g)}}function c(p){try{b(t.throw(p))}catch(g){r(g)}}function b(p){p.done?s(p.value):o(p.value).then(l,c)}b((t=t.apply(n,[])).next())})}for(var Rn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fa=typeof Uint8Array>"u"?[]:new Uint8Array(256),gi=0;gi<Rn.length;gi++)Fa[Rn.charCodeAt(gi)]=gi;var qa=function(n){var e=new Uint8Array(n),i,t=e.length,o="";for(i=0;i<t;i+=3)o+=Rn[e[i]>>2],o+=Rn[(e[i]&3)<<4|e[i+1]>>4],o+=Rn[(e[i+1]&15)<<2|e[i+2]>>6],o+=Rn[e[i+2]&63];return t%3===2?o=o.substring(0,o.length-1)+"=":t%3===1&&(o=o.substring(0,o.length-2)+"=="),o};const lo=new Map;function Wa(n,e){let i=lo.get(n);return i||(i=new Map,lo.set(n,i)),i.has(e)||i.set(e,[]),i.get(e)}const co=(n,e,i)=>{if(!n||!(ho(n,e)||typeof n=="object"))return;const t=n.constructor.name,o=Wa(i,t);let s=o.indexOf(n);return s===-1&&(s=o.length,o.push(n)),s};function yi(n,e,i){if(n instanceof Array)return n.map(t=>yi(t,e,i));if(n===null)return n;if(n instanceof Float32Array||n instanceof Float64Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Uint8Array||n instanceof Uint16Array||n instanceof Int16Array||n instanceof Int8Array||n instanceof Uint8ClampedArray)return{rr_type:n.constructor.name,args:[Object.values(n)]};if(n instanceof ArrayBuffer){const t=n.constructor.name,o=qa(n);return{rr_type:t,base64:o}}else{if(n instanceof DataView)return{rr_type:n.constructor.name,args:[yi(n.buffer,e,i),n.byteOffset,n.byteLength]};if(n instanceof HTMLImageElement){const t=n.constructor.name,{src:o}=n;return{rr_type:t,src:o}}else if(n instanceof HTMLCanvasElement){const t="HTMLImageElement",o=n.toDataURL();return{rr_type:t,src:o}}else{if(n instanceof ImageData)return{rr_type:n.constructor.name,args:[yi(n.data,e,i),n.width,n.height]};if(ho(n,e)||typeof n=="object"){const t=n.constructor.name,o=co(n,e,i);return{rr_type:t,index:o}}}}return n}const uo=(n,e,i)=>n.map(t=>yi(t,e,i)),ho=(n,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof e[o]=="function").find(o=>n instanceof e[o]);function Za(n,e,i,t){const o=[],s=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const r of s)try{if(typeof e.CanvasRenderingContext2D.prototype[r]!="function")continue;const l=In(e.CanvasRenderingContext2D.prototype,r,function(c){return function(...b){return _e(this.canvas,i,t,!0)||setTimeout(()=>{const p=uo(b,e,this);n(this.canvas,{type:Bn["2D"],property:r,args:p})},0),c.apply(this,b)}});o.push(l)}catch{const c=mi(e.CanvasRenderingContext2D.prototype,r,{set(b){n(this.canvas,{type:Bn["2D"],property:r,args:[b],setter:!0})}});o.push(c)}return()=>{o.forEach(r=>r())}}function Ja(n){return n==="experimental-webgl"?"webgl":n}function mo(n,e,i,t){const o=[];try{const s=In(n.HTMLCanvasElement.prototype,"getContext",function(r){return function(l,...c){if(!_e(this,e,i,!0)){const b=Ja(l);if("__context"in this||(this.__context=b),t&&["webgl","webgl2"].includes(b))if(c[0]&&typeof c[0]=="object"){const p=c[0];p.preserveDrawingBuffer||(p.preserveDrawingBuffer=!0)}else c.splice(0,1,{preserveDrawingBuffer:!0})}return r.apply(this,[l,...c])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function po(n,e,i,t,o,s,r){const l=[],c=Object.getOwnPropertyNames(n);for(const b of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(b))try{if(typeof n[b]!="function")continue;const p=In(n,b,function(g){return function(...f){const y=g.apply(this,f);if(co(y,r,this),"tagName"in this.canvas&&!_e(this.canvas,t,o,!0)){const C=uo(f,r,this),k={type:e,property:b,args:C};i(this.canvas,k)}return y}});l.push(p)}catch{const g=mi(n,b,{set(f){i(this.canvas,{type:e,property:b,args:[f],setter:!0})}});l.push(g)}return l}function $a(n,e,i,t,o){const s=[];return s.push(...po(e.WebGLRenderingContext.prototype,Bn.WebGL,n,i,t,o,e)),typeof e.WebGL2RenderingContext<"u"&&s.push(...po(e.WebGL2RenderingContext.prototype,Bn.WebGL2,n,i,t,o,e)),()=>{s.forEach(r=>r())}}function Ya(n,e){var i=n.toString(),t=i.split(`
740
746
  `);t.pop(),t.shift();for(var o=t[0].search(/\S/),s=/(['"])__worker_loader_strict__(['"])/g,r=0,l=t.length;r<l;++r)t[r]=t[r].substring(o).replace(s,"$1use strict$2")+`
741
747
  `;return t}function Qa(n,e){var i=Ya(n),t=new Blob(i,{type:"application/javascript"});return URL.createObjectURL(t)}function Xa(n,e){var i;return function(o){return i=i||Qa(n),new Worker(i,o)}}var er=Xa(function(){(function(){"__worker_loader_strict__";/*! *****************************************************************************
742
748
  Copyright (c) Microsoft Corporation.
@@ -751,13 +757,13 @@ or you can use record.mirror to access the mirror instance during recording.`;le
751
757
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
752
758
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
753
759
  PERFORMANCE OF THIS SOFTWARE.
754
- ***************************************************************************** */function n(b,p,g,f){function y(C){return C instanceof g?C:new g(function(k){k(C)})}return new(g||(g=Promise))(function(C,k){function S(_){try{A(f.next(_))}catch(E){k(E)}}function M(_){try{A(f.throw(_))}catch(E){k(E)}}function A(_){_.done?C(_.value):y(_.value).then(S,M)}A((f=f.apply(b,[])).next())})}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=typeof Uint8Array>"u"?[]:new Uint8Array(256),t=0;t<e.length;t++)i[e.charCodeAt(t)]=t;var o=function(b){var p=new Uint8Array(b),g,f=p.length,y="";for(g=0;g<f;g+=3)y+=e[p[g]>>2],y+=e[(p[g]&3)<<4|p[g+1]>>4],y+=e[(p[g+1]&15)<<2|p[g+2]>>6],y+=e[p[g+2]&63];return f%3===2?y=y.substring(0,y.length-1)+"=":f%3===1&&(y=y.substring(0,y.length-2)+"=="),y};const s=new Map,r=new Map;function l(b,p,g){return n(this,void 0,void 0,function*(){const f=`${b}-${p}`;if("OffscreenCanvas"in globalThis){if(r.has(f))return r.get(f);const y=new OffscreenCanvas(b,p);y.getContext("2d");const k=yield(yield y.convertToBlob(g)).arrayBuffer(),S=o(k);return r.set(f,S),S}else return""})}const c=self;c.onmessage=function(b){return n(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:p,bitmap:g,width:f,height:y,dataURLOptions:C}=b.data,k=l(f,y,C),S=new OffscreenCanvas(f,y);S.getContext("2d").drawImage(g,0,0),g.close();const A=yield S.convertToBlob(C),_=A.type,E=yield A.arrayBuffer(),N=o(E);if(!s.has(p)&&(yield k)===N)return s.set(p,N),c.postMessage({id:p});if(s.get(p)===N)return c.postMessage({id:p});c.postMessage({id:p,type:_,base64:N,width:f,height:y}),s.set(p,N)}else return c.postMessage({id:b.data.id})})}})()});class nr{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(c,b)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(b)};const{sampling:i="all",win:t,blockClass:o,blockSelector:s,recordCanvas:r,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&i==="all"&&this.initCanvasMutationObserver(t,o,s),r&&typeof i=="number"&&this.initCanvasFPSObserver(i,t,o,s,{dataURLOptions:l})}initCanvasFPSObserver(e,i,t,o,s){const r=ho(i,t,o,!0),l=new Map,c=new er;c.onmessage=C=>{const{id:k}=C.data;if(l.set(k,!1),!("base64"in C.data))return;const{base64:S,type:M,width:A,height:_}=C.data;this.mutationCb({id:k,type:Bn["2D"],commands:[{property:"clearRect",args:[0,0,A,_]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:M}]},0,0]}]})};const b=1e3/e;let p=0,g;const f=()=>{const C=[];return i.document.querySelectorAll("canvas").forEach(k=>{_e(k,t,o,!0)||C.push(k)}),C},y=C=>{if(p&&C-p<b){g=requestAnimationFrame(y);return}p=C,f().forEach(k=>za(this,void 0,void 0,function*(){var S;const M=this.mirror.getId(k);if(l.get(M)||k.width===0||k.height===0)return;if(l.set(M,!0),["webgl","webgl2"].includes(k.__context)){const _=k.getContext(k.__context);((S=_==null?void 0:_.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===!1&&_.clear(_.COLOR_BUFFER_BIT)}const A=yield createImageBitmap(k);c.postMessage({id:M,bitmap:A,width:k.width,height:k.height,dataURLOptions:s.dataURLOptions},[A])})),g=requestAnimationFrame(y)};g=requestAnimationFrame(y),this.resetObservers=()=>{r(),cancelAnimationFrame(g)}}initCanvasMutationObserver(e,i,t){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=ho(e,i,t,!1),s=Za(this.processMutation.bind(this),e,i,t),r=$a(this.processMutation.bind(this),e,i,t,this.mirror);this.resetObservers=()=>{o(),s(),r()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=i=>{this.rafStamps.latestId=i,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,i)=>{const t=this.mirror.getId(i);this.flushPendingCanvasMutationFor(i,t)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,i){if(this.frozen||this.locked)return;const t=this.pendingCanvasMutations.get(e);if(!t||i===-1)return;const o=t.map(r=>Ga(r,["type"])),{type:s}=t[0];this.mutationCb({id:i,type:s,commands:o}),this.pendingCanvasMutations.delete(e)}}class ir{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new wa,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,i){if(e.length===0)return;const t={id:i,styleIds:[]},o=[];for(const s of e){let r;this.styleMirror.has(s)?r=this.styleMirror.getId(s):(r=this.styleMirror.add(s),o.push({styleId:r,rules:Array.from(s.rules||CSSRule,(l,c)=>({rule:Pt(l),index:c}))})),t.styleIds.push(r)}o.length>0&&(t.styles=o),this.adoptedStyleSheetCb(t)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class tr{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(e,i){const t=this.nodeMap.get(e);return t&&Array.from(t).some(o=>o!==i)}add(e,i){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(i))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function de(n){return Object.assign(Object.assign({},n),{timestamp:pi()})}let ae,ki,qi,wi=!1;const Oe=$s();function Jn(n={}){const{emit:e,checkoutEveryNms:i,checkoutEveryNth:t,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:r="rr-ignore",ignoreSelector:l=null,maskTextClass:c="rr-mask",maskTextSelector:b=null,inlineStylesheet:p=!0,maskAllInputs:g,maskInputOptions:f,slimDOMOptions:y,maskInputFn:C,maskTextFn:k,hooks:S,packFn:M,sampling:A={},dataURLOptions:_={},mousemoveWait:E,recordDOM:N=!0,recordCanvas:G=!1,recordCrossOriginIframes:z=!1,recordAfter:U=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:V=!1,collectFonts:oe=!1,inlineImages:fe=!1,plugins:K,keepIframeSrcFn:Me=()=>!1,ignoreCSSAttributes:ue=new Set([]),errorHandler:Te}=n;Aa(Te);const Ae=z?window.parent===window:!0;let Xe=!1;if(!Ae)try{window.parent.document&&(Xe=!1)}catch{Xe=!0}if(Ae&&!e)throw new Error("emit function is required");E!==void 0&&A.mousemove===void 0&&(A.mousemove=E),Oe.reset();const pn=g===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f!==void 0?f:{password:!0},en=y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:y==="all",headMetaDescKeywords:y==="all"}:y||{};ka();let Sn,bn=0;const Ee=B=>{for(const he of K||[])he.eventProcessor&&(B=he.eventProcessor(B));return M&&!Xe&&(B=M(B)),B};ae=(B,he)=>{var $;if(!(($=yn[0])===null||$===void 0)&&$.isFrozen()&&B.type!==W.FullSnapshot&&!(B.type===W.IncrementalSnapshot&&B.data.source===F.Mutation)&&yn.forEach(ge=>ge.unfreeze()),Ae)e==null||e(Ee(B),he);else if(Xe){const ge={type:"rrweb",event:Ee(B),origin:window.location.origin,isCheckout:he};window.parent.postMessage(ge,"*")}if(B.type===W.FullSnapshot)Sn=B,bn=0;else if(B.type===W.IncrementalSnapshot){if(B.data.source===F.Mutation&&B.data.isAttachIframe)return;bn++;const ge=t&&bn>=t,We=i&&B.timestamp-Sn.timestamp>i;(ge||We)&&ki(!0)}};const nn=B=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Mutation},B)}))},_n=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Scroll},B)})),re=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.CanvasMutation},B)})),be=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.AdoptedStyleSheet},B)})),Re=new ir({mutationCb:nn,adoptedStyleSheetCb:be}),Pe=new ja({mirror:Oe,mutationCb:nn,stylesheetManager:Re,recordCrossOriginIframes:z,wrappedEmit:ae});for(const B of K||[])B.getMirror&&B.getMirror({nodeMirror:Oe,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});const Ce=new tr;qi=new nr({recordCanvas:G,mutationCb:re,win:window,blockClass:o,blockSelector:s,mirror:Oe,sampling:A.canvas,dataURLOptions:_});const qe=new Va({mutationCb:nn,scrollCb:_n,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:b,inlineStylesheet:p,maskInputOptions:pn,dataURLOptions:_,maskTextFn:k,maskInputFn:C,recordCanvas:G,inlineImages:fe,sampling:A,slimDOMOptions:en,iframeManager:Pe,stylesheetManager:Re,canvasManager:qi,keepIframeSrcFn:Me,processedNodeManager:Ce},mirror:Oe});ki=(B=!1)=>{if(!N)return;ae(de({type:W.Meta,data:{href:window.location.href,width:Gt(),height:Vt()}}),B),Re.reset(),qe.init(),yn.forEach($=>$.lock());const he=ga(document,{mirror:Oe,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:b,inlineStylesheet:p,maskAllInputs:pn,maskTextFn:k,slimDOM:en,dataURLOptions:_,recordCanvas:G,inlineImages:fe,onSerialize:$=>{qt($,Oe)&&Pe.addIframe($),Wt($,Oe)&&Re.trackLinkElement($),zi($)&&qe.addShadowRoot($.shadowRoot,document)},onIframeLoad:($,ge)=>{Pe.attachIframe($,ge),qe.observeAttachShadow($)},onStylesheetLoad:($,ge)=>{Re.attachLinkElement($,ge)},keepIframeSrcFn:Me});if(!he)return console.warn("Failed to snapshot the document");ae(de({type:W.FullSnapshot,data:{node:he,initialOffset:jt(window)}}),B),yn.forEach($=>$.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Re.adoptStyleSheets(document.adoptedStyleSheets,Oe.getId(document))};try{const B=[],he=ge=>{var We;return q(Ka)({mutationCb:nn,mousemoveCb:(Q,ni)=>ae(de({type:W.IncrementalSnapshot,data:{source:ni,positions:Q}})),mouseInteractionCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.MouseInteraction},Q)})),scrollCb:_n,viewportResizeCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.ViewportResize},Q)})),inputCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Input},Q)})),mediaInteractionCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.MediaInteraction},Q)})),styleSheetRuleCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.StyleSheetRule},Q)})),styleDeclarationCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.StyleDeclaration},Q)})),canvasMutationCb:re,fontCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Font},Q)})),selectionCb:Q=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Selection},Q)}))},customElementCb:Q=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.CustomElement},Q)}))},blockClass:o,ignoreClass:r,ignoreSelector:l,maskTextClass:c,maskTextSelector:b,maskInputOptions:pn,inlineStylesheet:p,sampling:A,recordDOM:N,recordCanvas:G,inlineImages:fe,userTriggeredOnInput:V,collectFonts:oe,doc:ge,maskInputFn:C,maskTextFn:k,keepIframeSrcFn:Me,blockSelector:s,slimDOMOptions:en,dataURLOptions:_,mirror:Oe,iframeManager:Pe,stylesheetManager:Re,shadowDomManager:qe,processedNodeManager:Ce,canvasManager:qi,ignoreCSSAttributes:ue,plugins:((We=K==null?void 0:K.filter(Q=>Q.observer))===null||We===void 0?void 0:We.map(Q=>({observer:Q.observer,options:Q.options,callback:ni=>ae(de({type:W.Plugin,data:{plugin:Q.name,payload:ni}}))})))||[]},S)};Pe.addLoadListener(ge=>{try{B.push(he(ge.contentDocument))}catch(We){console.warn(We)}});const $=()=>{ki(),B.push(he(document)),wi=!0};return document.readyState==="interactive"||document.readyState==="complete"?$():(B.push(Se("DOMContentLoaded",()=>{ae(de({type:W.DomContentLoaded,data:{}})),U==="DOMContentLoaded"&&$()})),B.push(Se("load",()=>{ae(de({type:W.Load,data:{}})),U==="load"&&$()},window))),()=>{B.forEach(ge=>ge()),Ce.destroy(),wi=!1,xa()}}catch(B){console.warn(B)}}Jn.addCustomEvent=(n,e)=>{if(!wi)throw new Error("please add custom event after start recording");ae(de({type:W.Custom,data:{tag:n,payload:e}}))},Jn.freezePage=()=>{yn.forEach(n=>n.freeze())},Jn.takeFullSnapshot=n=>{if(!wi)throw new Error("please take full snapshot after start recording");ki(n)},Jn.mirror=Oe;var po=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(po||{}),Ge=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(Ge||{}),Je={DEBUG:!1,LIB_VERSION:"2.55.1"},R;if(typeof window>"u"){var bo={hostname:""};R={navigator:{userAgent:"",onLine:!0},document:{location:bo,referrer:""},screen:{width:0,height:0},location:bo}}else R=window;var $n=24*60*60*1e3,Wi=8*1e3,Ci=Array.prototype,or=Function.prototype,vo=Object.prototype,rn=Ci.slice,Yn=vo.toString,Si=vo.hasOwnProperty,ce=R.console,ln=R.navigator,X=R.document,_i=R.opera,Mi=R.screen,ze=ln.userAgent,Zi=or.bind,fo=Ci.forEach,go=Ci.indexOf,yo=Ci.map,sr=Array.isArray,Ji={},m={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},J={log:function(){if(Je.DEBUG&&!m.isUndefined(ce)&&ce)try{ce.log.apply(ce,arguments)}catch{m.each(arguments,function(e){ce.log(e)})}},warn:function(){if(Je.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel warning:"].concat(m.toArray(arguments));try{ce.warn.apply(ce,n)}catch{m.each(n,function(i){ce.warn(i)})}}},error:function(){if(Je.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}},critical:function(){if(!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}}},$i=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(J,arguments)}},Ai=function(n){return{log:$i(J.log,n),error:$i(J.error,n),critical:$i(J.critical,n)}};m.bind=function(n,e){var i,t;if(Zi&&n.bind===Zi)return Zi.apply(n,rn.call(arguments,1));if(!m.isFunction(n))throw new TypeError;return i=rn.call(arguments,2),t=function(){if(!(this instanceof t))return n.apply(e,i.concat(rn.call(arguments)));var o={};o.prototype=n.prototype;var s=new o;o.prototype=null;var r=n.apply(s,i.concat(rn.call(arguments)));return Object(r)===r?r:s},t},m.each=function(n,e,i){if(n!=null){if(fo&&n.forEach===fo)n.forEach(e,i);else if(n.length===+n.length){for(var t=0,o=n.length;t<o;t++)if(t in n&&e.call(i,n[t],t,n)===Ji)return}else for(var s in n)if(Si.call(n,s)&&e.call(i,n[s],s,n)===Ji)return}},m.extend=function(n){return m.each(rn.call(arguments,1),function(e){for(var i in e)e[i]!==void 0&&(n[i]=e[i])}),n},m.isArray=sr||function(n){return Yn.call(n)==="[object Array]"},m.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},m.isArguments=function(n){return!!(n&&Si.call(n,"callee"))},m.toArray=function(n){return n?n.toArray?n.toArray():m.isArray(n)||m.isArguments(n)?rn.call(n):m.values(n):[]},m.map=function(n,e,i){if(yo&&n.map===yo)return n.map(e,i);var t=[];return m.each(n,function(o){t.push(e.call(i,o))}),t},m.keys=function(n){var e=[];return n===null||m.each(n,function(i,t){e[e.length]=t}),e},m.values=function(n){var e=[];return n===null||m.each(n,function(i){e[e.length]=i}),e},m.include=function(n,e){var i=!1;return n===null?i:go&&n.indexOf===go?n.indexOf(e)!=-1:(m.each(n,function(t){if(i||(i=t===e))return Ji}),i)},m.includes=function(n,e){return n.indexOf(e)!==-1},m.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},m.isObject=function(n){return n===Object(n)&&!m.isArray(n)},m.isEmptyObject=function(n){if(m.isObject(n)){for(var e in n)if(Si.call(n,e))return!1;return!0}return!1},m.isUndefined=function(n){return n===void 0},m.isString=function(n){return Yn.call(n)=="[object String]"},m.isDate=function(n){return Yn.call(n)=="[object Date]"},m.isNumber=function(n){return Yn.call(n)=="[object Number]"},m.isElement=function(n){return!!(n&&n.nodeType===1)},m.encodeDates=function(n){return m.each(n,function(e,i){m.isDate(e)?n[i]=m.formatDate(e):m.isObject(e)&&(n[i]=m.encodeDates(e))}),n},m.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},m.formatDate=function(n){function e(i){return i<10?"0"+i:i}return n.getUTCFullYear()+"-"+e(n.getUTCMonth()+1)+"-"+e(n.getUTCDate())+"T"+e(n.getUTCHours())+":"+e(n.getUTCMinutes())+":"+e(n.getUTCSeconds())},m.strip_empty_properties=function(n){var e={};return m.each(n,function(i,t){m.isString(i)&&i.length>0&&(e[t]=i)}),e},m.truncate=function(n,e){var i;return typeof n=="string"?i=n.slice(0,e):m.isArray(n)?(i=[],m.each(n,function(t){i.push(m.truncate(t,e))})):m.isObject(n)?(i={},m.each(n,function(t,o){i[o]=m.truncate(t,e)})):i=n,i},m.JSONEncode=function(){return function(n){var e=n,i=function(o){var s=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return s.lastIndex=0,s.test(o)?'"'+o.replace(s,function(l){var c=r[l];return typeof c=="string"?c:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+o+'"'},t=function(o,s){var r="",l=" ",c=0,b="",p="",g=0,f=r,y=[],C=s[o];switch(C&&typeof C=="object"&&typeof C.toJSON=="function"&&(C=C.toJSON(o)),typeof C){case"string":return i(C);case"number":return isFinite(C)?String(C):"null";case"boolean":case"null":return String(C);case"object":if(!C)return"null";if(r+=l,y=[],Yn.apply(C)==="[object Array]"){for(g=C.length,c=0;c<g;c+=1)y[c]=t(c,C)||"null";return p=y.length===0?"[]":r?`[
760
+ ***************************************************************************** */function n(b,p,g,f){function y(C){return C instanceof g?C:new g(function(k){k(C)})}return new(g||(g=Promise))(function(C,k){function S(_){try{A(f.next(_))}catch(E){k(E)}}function M(_){try{A(f.throw(_))}catch(E){k(E)}}function A(_){_.done?C(_.value):y(_.value).then(S,M)}A((f=f.apply(b,[])).next())})}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=typeof Uint8Array>"u"?[]:new Uint8Array(256),t=0;t<e.length;t++)i[e.charCodeAt(t)]=t;var o=function(b){var p=new Uint8Array(b),g,f=p.length,y="";for(g=0;g<f;g+=3)y+=e[p[g]>>2],y+=e[(p[g]&3)<<4|p[g+1]>>4],y+=e[(p[g+1]&15)<<2|p[g+2]>>6],y+=e[p[g+2]&63];return f%3===2?y=y.substring(0,y.length-1)+"=":f%3===1&&(y=y.substring(0,y.length-2)+"=="),y};const s=new Map,r=new Map;function l(b,p,g){return n(this,void 0,void 0,function*(){const f=`${b}-${p}`;if("OffscreenCanvas"in globalThis){if(r.has(f))return r.get(f);const y=new OffscreenCanvas(b,p);y.getContext("2d");const k=yield(yield y.convertToBlob(g)).arrayBuffer(),S=o(k);return r.set(f,S),S}else return""})}const c=self;c.onmessage=function(b){return n(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:p,bitmap:g,width:f,height:y,dataURLOptions:C}=b.data,k=l(f,y,C),S=new OffscreenCanvas(f,y);S.getContext("2d").drawImage(g,0,0),g.close();const A=yield S.convertToBlob(C),_=A.type,E=yield A.arrayBuffer(),N=o(E);if(!s.has(p)&&(yield k)===N)return s.set(p,N),c.postMessage({id:p});if(s.get(p)===N)return c.postMessage({id:p});c.postMessage({id:p,type:_,base64:N,width:f,height:y}),s.set(p,N)}else return c.postMessage({id:b.data.id})})}})()});class nr{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(c,b)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(b)};const{sampling:i="all",win:t,blockClass:o,blockSelector:s,recordCanvas:r,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&i==="all"&&this.initCanvasMutationObserver(t,o,s),r&&typeof i=="number"&&this.initCanvasFPSObserver(i,t,o,s,{dataURLOptions:l})}initCanvasFPSObserver(e,i,t,o,s){const r=mo(i,t,o,!0),l=new Map,c=new er;c.onmessage=C=>{const{id:k}=C.data;if(l.set(k,!1),!("base64"in C.data))return;const{base64:S,type:M,width:A,height:_}=C.data;this.mutationCb({id:k,type:Bn["2D"],commands:[{property:"clearRect",args:[0,0,A,_]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:M}]},0,0]}]})};const b=1e3/e;let p=0,g;const f=()=>{const C=[];return i.document.querySelectorAll("canvas").forEach(k=>{_e(k,t,o,!0)||C.push(k)}),C},y=C=>{if(p&&C-p<b){g=requestAnimationFrame(y);return}p=C,f().forEach(k=>za(this,void 0,void 0,function*(){var S;const M=this.mirror.getId(k);if(l.get(M)||k.width===0||k.height===0)return;if(l.set(M,!0),["webgl","webgl2"].includes(k.__context)){const _=k.getContext(k.__context);((S=_==null?void 0:_.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===!1&&_.clear(_.COLOR_BUFFER_BIT)}const A=yield createImageBitmap(k);c.postMessage({id:M,bitmap:A,width:k.width,height:k.height,dataURLOptions:s.dataURLOptions},[A])})),g=requestAnimationFrame(y)};g=requestAnimationFrame(y),this.resetObservers=()=>{r(),cancelAnimationFrame(g)}}initCanvasMutationObserver(e,i,t){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=mo(e,i,t,!1),s=Za(this.processMutation.bind(this),e,i,t),r=$a(this.processMutation.bind(this),e,i,t,this.mirror);this.resetObservers=()=>{o(),s(),r()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=i=>{this.rafStamps.latestId=i,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,i)=>{const t=this.mirror.getId(i);this.flushPendingCanvasMutationFor(i,t)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,i){if(this.frozen||this.locked)return;const t=this.pendingCanvasMutations.get(e);if(!t||i===-1)return;const o=t.map(r=>Ga(r,["type"])),{type:s}=t[0];this.mutationCb({id:i,type:s,commands:o}),this.pendingCanvasMutations.delete(e)}}class ir{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new wa,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,i){if(e.length===0)return;const t={id:i,styleIds:[]},o=[];for(const s of e){let r;this.styleMirror.has(s)?r=this.styleMirror.getId(s):(r=this.styleMirror.add(s),o.push({styleId:r,rules:Array.from(s.rules||CSSRule,(l,c)=>({rule:Nt(l),index:c}))})),t.styleIds.push(r)}o.length>0&&(t.styles=o),this.adoptedStyleSheetCb(t)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class tr{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(e,i){const t=this.nodeMap.get(e);return t&&Array.from(t).some(o=>o!==i)}add(e,i){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(i))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function de(n){return Object.assign(Object.assign({},n),{timestamp:pi()})}let ae,ki,qi,wi=!1;const Oe=$s();function Jn(n={}){const{emit:e,checkoutEveryNms:i,checkoutEveryNth:t,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:r="rr-ignore",ignoreSelector:l=null,maskTextClass:c="rr-mask",maskTextSelector:b=null,inlineStylesheet:p=!0,maskAllInputs:g,maskInputOptions:f,slimDOMOptions:y,maskInputFn:C,maskTextFn:k,hooks:S,packFn:M,sampling:A={},dataURLOptions:_={},mousemoveWait:E,recordDOM:N=!0,recordCanvas:G=!1,recordCrossOriginIframes:z=!1,recordAfter:U=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:V=!1,collectFonts:oe=!1,inlineImages:fe=!1,plugins:K,keepIframeSrcFn:Me=()=>!1,ignoreCSSAttributes:ue=new Set([]),errorHandler:Te}=n;Aa(Te);const Ae=z?window.parent===window:!0;let Xe=!1;if(!Ae)try{window.parent.document&&(Xe=!1)}catch{Xe=!0}if(Ae&&!e)throw new Error("emit function is required");E!==void 0&&A.mousemove===void 0&&(A.mousemove=E),Oe.reset();const pn=g===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f!==void 0?f:{password:!0},en=y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:y==="all",headMetaDescKeywords:y==="all"}:y||{};ka();let Sn,bn=0;const Ee=B=>{for(const he of K||[])he.eventProcessor&&(B=he.eventProcessor(B));return M&&!Xe&&(B=M(B)),B};ae=(B,he)=>{var $;if(!(($=yn[0])===null||$===void 0)&&$.isFrozen()&&B.type!==W.FullSnapshot&&!(B.type===W.IncrementalSnapshot&&B.data.source===F.Mutation)&&yn.forEach(ge=>ge.unfreeze()),Ae)e==null||e(Ee(B),he);else if(Xe){const ge={type:"rrweb",event:Ee(B),origin:window.location.origin,isCheckout:he};window.parent.postMessage(ge,"*")}if(B.type===W.FullSnapshot)Sn=B,bn=0;else if(B.type===W.IncrementalSnapshot){if(B.data.source===F.Mutation&&B.data.isAttachIframe)return;bn++;const ge=t&&bn>=t,We=i&&B.timestamp-Sn.timestamp>i;(ge||We)&&ki(!0)}};const nn=B=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Mutation},B)}))},_n=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Scroll},B)})),re=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.CanvasMutation},B)})),be=B=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.AdoptedStyleSheet},B)})),Re=new ir({mutationCb:nn,adoptedStyleSheetCb:be}),Pe=new ja({mirror:Oe,mutationCb:nn,stylesheetManager:Re,recordCrossOriginIframes:z,wrappedEmit:ae});for(const B of K||[])B.getMirror&&B.getMirror({nodeMirror:Oe,crossOriginIframeMirror:Pe.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pe.crossOriginIframeStyleMirror});const Ce=new tr;qi=new nr({recordCanvas:G,mutationCb:re,win:window,blockClass:o,blockSelector:s,mirror:Oe,sampling:A.canvas,dataURLOptions:_});const qe=new Va({mutationCb:nn,scrollCb:_n,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:b,inlineStylesheet:p,maskInputOptions:pn,dataURLOptions:_,maskTextFn:k,maskInputFn:C,recordCanvas:G,inlineImages:fe,sampling:A,slimDOMOptions:en,iframeManager:Pe,stylesheetManager:Re,canvasManager:qi,keepIframeSrcFn:Me,processedNodeManager:Ce},mirror:Oe});ki=(B=!1)=>{if(!N)return;ae(de({type:W.Meta,data:{href:window.location.href,width:zt(),height:Gt()}}),B),Re.reset(),qe.init(),yn.forEach($=>$.lock());const he=ga(document,{mirror:Oe,blockClass:o,blockSelector:s,maskTextClass:c,maskTextSelector:b,inlineStylesheet:p,maskAllInputs:pn,maskTextFn:k,slimDOM:en,dataURLOptions:_,recordCanvas:G,inlineImages:fe,onSerialize:$=>{Wt($,Oe)&&Pe.addIframe($),Zt($,Oe)&&Re.trackLinkElement($),zi($)&&qe.addShadowRoot($.shadowRoot,document)},onIframeLoad:($,ge)=>{Pe.attachIframe($,ge),qe.observeAttachShadow($)},onStylesheetLoad:($,ge)=>{Re.attachLinkElement($,ge)},keepIframeSrcFn:Me});if(!he)return console.warn("Failed to snapshot the document");ae(de({type:W.FullSnapshot,data:{node:he,initialOffset:Vt(window)}}),B),yn.forEach($=>$.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Re.adoptStyleSheets(document.adoptedStyleSheets,Oe.getId(document))};try{const B=[],he=ge=>{var We;return q(Ka)({mutationCb:nn,mousemoveCb:(Q,ni)=>ae(de({type:W.IncrementalSnapshot,data:{source:ni,positions:Q}})),mouseInteractionCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.MouseInteraction},Q)})),scrollCb:_n,viewportResizeCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.ViewportResize},Q)})),inputCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Input},Q)})),mediaInteractionCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.MediaInteraction},Q)})),styleSheetRuleCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.StyleSheetRule},Q)})),styleDeclarationCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.StyleDeclaration},Q)})),canvasMutationCb:re,fontCb:Q=>ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Font},Q)})),selectionCb:Q=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.Selection},Q)}))},customElementCb:Q=>{ae(de({type:W.IncrementalSnapshot,data:Object.assign({source:F.CustomElement},Q)}))},blockClass:o,ignoreClass:r,ignoreSelector:l,maskTextClass:c,maskTextSelector:b,maskInputOptions:pn,inlineStylesheet:p,sampling:A,recordDOM:N,recordCanvas:G,inlineImages:fe,userTriggeredOnInput:V,collectFonts:oe,doc:ge,maskInputFn:C,maskTextFn:k,keepIframeSrcFn:Me,blockSelector:s,slimDOMOptions:en,dataURLOptions:_,mirror:Oe,iframeManager:Pe,stylesheetManager:Re,shadowDomManager:qe,processedNodeManager:Ce,canvasManager:qi,ignoreCSSAttributes:ue,plugins:((We=K==null?void 0:K.filter(Q=>Q.observer))===null||We===void 0?void 0:We.map(Q=>({observer:Q.observer,options:Q.options,callback:ni=>ae(de({type:W.Plugin,data:{plugin:Q.name,payload:ni}}))})))||[]},S)};Pe.addLoadListener(ge=>{try{B.push(he(ge.contentDocument))}catch(We){console.warn(We)}});const $=()=>{ki(),B.push(he(document)),wi=!0};return document.readyState==="interactive"||document.readyState==="complete"?$():(B.push(Se("DOMContentLoaded",()=>{ae(de({type:W.DomContentLoaded,data:{}})),U==="DOMContentLoaded"&&$()})),B.push(Se("load",()=>{ae(de({type:W.Load,data:{}})),U==="load"&&$()},window))),()=>{B.forEach(ge=>ge()),Ce.destroy(),wi=!1,xa()}}catch(B){console.warn(B)}}Jn.addCustomEvent=(n,e)=>{if(!wi)throw new Error("please add custom event after start recording");ae(de({type:W.Custom,data:{tag:n,payload:e}}))},Jn.freezePage=()=>{yn.forEach(n=>n.freeze())},Jn.takeFullSnapshot=n=>{if(!wi)throw new Error("please take full snapshot after start recording");ki(n)},Jn.mirror=Oe;var bo=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(bo||{}),Ge=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(Ge||{}),Je={DEBUG:!1,LIB_VERSION:"2.55.1"},R;if(typeof window>"u"){var vo={hostname:""};R={navigator:{userAgent:"",onLine:!0},document:{location:vo,referrer:""},screen:{width:0,height:0},location:vo}}else R=window;var $n=24*60*60*1e3,Wi=8*1e3,Ci=Array.prototype,or=Function.prototype,fo=Object.prototype,rn=Ci.slice,Yn=fo.toString,Si=fo.hasOwnProperty,ce=R.console,ln=R.navigator,X=R.document,_i=R.opera,Mi=R.screen,ze=ln.userAgent,Zi=or.bind,go=Ci.forEach,yo=Ci.indexOf,ko=Ci.map,sr=Array.isArray,Ji={},m={trim:function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},J={log:function(){if(Je.DEBUG&&!m.isUndefined(ce)&&ce)try{ce.log.apply(ce,arguments)}catch{m.each(arguments,function(e){ce.log(e)})}},warn:function(){if(Je.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel warning:"].concat(m.toArray(arguments));try{ce.warn.apply(ce,n)}catch{m.each(n,function(i){ce.warn(i)})}}},error:function(){if(Je.DEBUG&&!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}},critical:function(){if(!m.isUndefined(ce)&&ce){var n=["Mixpanel error:"].concat(m.toArray(arguments));try{ce.error.apply(ce,n)}catch{m.each(n,function(i){ce.error(i)})}}}},$i=function(n,e){return function(){return arguments[0]="["+e+"] "+arguments[0],n.apply(J,arguments)}},Ai=function(n){return{log:$i(J.log,n),error:$i(J.error,n),critical:$i(J.critical,n)}};m.bind=function(n,e){var i,t;if(Zi&&n.bind===Zi)return Zi.apply(n,rn.call(arguments,1));if(!m.isFunction(n))throw new TypeError;return i=rn.call(arguments,2),t=function(){if(!(this instanceof t))return n.apply(e,i.concat(rn.call(arguments)));var o={};o.prototype=n.prototype;var s=new o;o.prototype=null;var r=n.apply(s,i.concat(rn.call(arguments)));return Object(r)===r?r:s},t},m.each=function(n,e,i){if(n!=null){if(go&&n.forEach===go)n.forEach(e,i);else if(n.length===+n.length){for(var t=0,o=n.length;t<o;t++)if(t in n&&e.call(i,n[t],t,n)===Ji)return}else for(var s in n)if(Si.call(n,s)&&e.call(i,n[s],s,n)===Ji)return}},m.extend=function(n){return m.each(rn.call(arguments,1),function(e){for(var i in e)e[i]!==void 0&&(n[i]=e[i])}),n},m.isArray=sr||function(n){return Yn.call(n)==="[object Array]"},m.isFunction=function(n){try{return/^\s*\bfunction\b/.test(n)}catch{return!1}},m.isArguments=function(n){return!!(n&&Si.call(n,"callee"))},m.toArray=function(n){return n?n.toArray?n.toArray():m.isArray(n)||m.isArguments(n)?rn.call(n):m.values(n):[]},m.map=function(n,e,i){if(ko&&n.map===ko)return n.map(e,i);var t=[];return m.each(n,function(o){t.push(e.call(i,o))}),t},m.keys=function(n){var e=[];return n===null||m.each(n,function(i,t){e[e.length]=t}),e},m.values=function(n){var e=[];return n===null||m.each(n,function(i){e[e.length]=i}),e},m.include=function(n,e){var i=!1;return n===null?i:yo&&n.indexOf===yo?n.indexOf(e)!=-1:(m.each(n,function(t){if(i||(i=t===e))return Ji}),i)},m.includes=function(n,e){return n.indexOf(e)!==-1},m.inherit=function(n,e){return n.prototype=new e,n.prototype.constructor=n,n.superclass=e.prototype,n},m.isObject=function(n){return n===Object(n)&&!m.isArray(n)},m.isEmptyObject=function(n){if(m.isObject(n)){for(var e in n)if(Si.call(n,e))return!1;return!0}return!1},m.isUndefined=function(n){return n===void 0},m.isString=function(n){return Yn.call(n)=="[object String]"},m.isDate=function(n){return Yn.call(n)=="[object Date]"},m.isNumber=function(n){return Yn.call(n)=="[object Number]"},m.isElement=function(n){return!!(n&&n.nodeType===1)},m.encodeDates=function(n){return m.each(n,function(e,i){m.isDate(e)?n[i]=m.formatDate(e):m.isObject(e)&&(n[i]=m.encodeDates(e))}),n},m.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},m.formatDate=function(n){function e(i){return i<10?"0"+i:i}return n.getUTCFullYear()+"-"+e(n.getUTCMonth()+1)+"-"+e(n.getUTCDate())+"T"+e(n.getUTCHours())+":"+e(n.getUTCMinutes())+":"+e(n.getUTCSeconds())},m.strip_empty_properties=function(n){var e={};return m.each(n,function(i,t){m.isString(i)&&i.length>0&&(e[t]=i)}),e},m.truncate=function(n,e){var i;return typeof n=="string"?i=n.slice(0,e):m.isArray(n)?(i=[],m.each(n,function(t){i.push(m.truncate(t,e))})):m.isObject(n)?(i={},m.each(n,function(t,o){i[o]=m.truncate(t,e)})):i=n,i},m.JSONEncode=function(){return function(n){var e=n,i=function(o){var s=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return s.lastIndex=0,s.test(o)?'"'+o.replace(s,function(l){var c=r[l];return typeof c=="string"?c:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+o+'"'},t=function(o,s){var r="",l=" ",c=0,b="",p="",g=0,f=r,y=[],C=s[o];switch(C&&typeof C=="object"&&typeof C.toJSON=="function"&&(C=C.toJSON(o)),typeof C){case"string":return i(C);case"number":return isFinite(C)?String(C):"null";case"boolean":case"null":return String(C);case"object":if(!C)return"null";if(r+=l,y=[],Yn.apply(C)==="[object Array]"){for(g=C.length,c=0;c<g;c+=1)y[c]=t(c,C)||"null";return p=y.length===0?"[]":r?`[
755
761
  `+r+y.join(`,
756
762
  `+r)+`
757
763
  `+f+"]":"["+y.join(",")+"]",r=f,p}for(b in C)Si.call(C,b)&&(p=t(b,C),p&&y.push(i(b)+(r?": ":":")+p));return p=y.length===0?"{}":r?"{"+y.join(",")+f+"}":"{"+y.join(",")+"}",r=f,p}};return t("",{"":e})}}(),m.JSONDecode=function(){var n,e,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
758
764
  `,r:"\r",t:" "},t,o=function(y){var C=new SyntaxError(y);throw C.at=n,C.text=t,C},s=function(y){return y&&y!==e&&o("Expected '"+y+"' instead of '"+e+"'"),e=t.charAt(n),n+=1,e},r=function(){var y,C="";for(e==="-"&&(C="-",s("-"));e>="0"&&e<="9";)C+=e,s();if(e===".")for(C+=".";s()&&e>="0"&&e<="9";)C+=e;if(e==="e"||e==="E")for(C+=e,s(),(e==="-"||e==="+")&&(C+=e,s());e>="0"&&e<="9";)C+=e,s();if(y=+C,!isFinite(y))o("Bad number");else return y},l=function(){var y,C,k="",S;if(e==='"')for(;s();){if(e==='"')return s(),k;if(e==="\\")if(s(),e==="u"){for(S=0,C=0;C<4&&(y=parseInt(s(),16),!!isFinite(y));C+=1)S=S*16+y;k+=String.fromCharCode(S)}else if(typeof i[e]=="string")k+=i[e];else break;else k+=e}o("Bad string")},c=function(){for(;e&&e<=" ";)s()},b=function(){switch(e){case"t":return s("t"),s("r"),s("u"),s("e"),!0;case"f":return s("f"),s("a"),s("l"),s("s"),s("e"),!1;case"n":return s("n"),s("u"),s("l"),s("l"),null}o('Unexpected "'+e+'"')},p,g=function(){var y=[];if(e==="["){if(s("["),c(),e==="]")return s("]"),y;for(;e;){if(y.push(p()),c(),e==="]")return s("]"),y;s(","),c()}}o("Bad array")},f=function(){var y,C={};if(e==="{"){if(s("{"),c(),e==="}")return s("}"),C;for(;e;){if(y=l(),c(),s(":"),Object.hasOwnProperty.call(C,y)&&o('Duplicate key "'+y+'"'),C[y]=p(),c(),e==="}")return s("}"),C;s(","),c()}}o("Bad object")};return p=function(){switch(c(),e){case"{":return f();case"[":return g();case'"':return l();case"-":return r();default:return e>="0"&&e<="9"?r():b()}},function(y){var C;return t=y,n=0,e=" ",C=p(),c(),e&&o("Syntax error"),C}}(),m.base64Encode=function(n){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i,t,o,s,r,l,c,b,p=0,g=0,f="",y=[];if(!n)return n;n=m.utf8Encode(n);do i=n.charCodeAt(p++),t=n.charCodeAt(p++),o=n.charCodeAt(p++),b=i<<16|t<<8|o,s=b>>18&63,r=b>>12&63,l=b>>6&63,c=b&63,y[g++]=e.charAt(s)+e.charAt(r)+e.charAt(l)+e.charAt(c);while(p<n.length);switch(f=y.join(""),n.length%3){case 1:f=f.slice(0,-2)+"==";break;case 2:f=f.slice(0,-1)+"=";break}return f},m.utf8Encode=function(n){n=(n+"").replace(/\r\n/g,`
759
765
  `).replace(/\r/g,`
760
- `);var e="",i,t,o=0,s;for(i=t=0,o=n.length,s=0;s<o;s++){var r=n.charCodeAt(s),l=null;r<128?t++:r>127&&r<2048?l=String.fromCharCode(r>>6|192,r&63|128):l=String.fromCharCode(r>>12|224,r>>6&63|128,r&63|128),l!==null&&(t>i&&(e+=n.substring(i,t)),e+=l,i=t=s+1)}return t>i&&(e+=n.substring(i,n.length)),e},m.UUID=function(){var n=function(){var t=1*new Date,o;if(R.performance&&R.performance.now)o=R.performance.now();else for(o=0;t==1*new Date;)o++;return t.toString(16)+Math.floor(o).toString(16)},e=function(){return Math.random().toString(16).replace(".","")},i=function(){var t=ze,o,s,r=[],l=0;function c(b,p){var g,f=0;for(g=0;g<p.length;g++)f|=r[g]<<g*8;return b^f}for(o=0;o<t.length;o++)s=t.charCodeAt(o),r.unshift(s&255),r.length>=4&&(l=c(l,r),r=[]);return r.length>0&&(l=c(l,r)),l.toString(16)};return function(){var t=(Mi.height*Mi.width).toString(16);return n()+"-"+e()+"-"+i()+"-"+t+"-"+n()}}();var ko=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];m.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<ko.length;e++)if(n.indexOf(ko[e])!==-1)return!0;return!1},m.HTTPBuildQuery=function(n,e){var i,t,o=[];return m.isUndefined(e)&&(e="&"),m.each(n,function(s,r){i=encodeURIComponent(s.toString()),t=encodeURIComponent(r),o[o.length]=t+"="+i}),o.join(e)},m.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var i="[\\?&]"+e+"=([^&#]*)",t=new RegExp(i),o=t.exec(n);if(o===null||o&&typeof o[1]!="string"&&o[1].length)return"";var s=o[1];try{s=decodeURIComponent(s)}catch{J.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},m.cookie={get:function(n){for(var e=n+"=",i=X.cookie.split(";"),t=0;t<i.length;t++){for(var o=i[t];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(e)===0)return decodeURIComponent(o.substring(e.length,o.length))}return null},parse:function(n){var e;try{e=m.JSONDecode(m.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,i,t,o,s,r){var l="",c="",b="";if(r)l="; domain="+r;else if(t){var p=wo(X.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*1e3),c="; expires="+g.toGMTString()}s&&(o=!0,b="; SameSite=None"),o&&(b+="; secure"),X.cookie=n+"="+encodeURIComponent(e)+c+"; path=/"+l+b},set:function(n,e,i,t,o,s,r){var l="",c="",b="";if(r)l="; domain="+r;else if(t){var p=wo(X.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*24*60*60*1e3),c="; expires="+g.toGMTString()}s&&(o=!0,b="; SameSite=None"),o&&(b+="; secure");var f=n+"="+encodeURIComponent(e)+c+"; path=/"+l+b;return X.cookie=f,f},remove:function(n,e,i){m.cookie.set(n,"",-1,e,!1,!1,i)}};var Yi=null,xi=function(n,e){if(Yi!==null&&!e)return Yi;var i=!0;try{n=n||window.localStorage;var t="__mplss_"+Qi(8),o="xyz";n.setItem(t,o),n.getItem(t)!==o&&(i=!1),n.removeItem(t)}catch{i=!1}return Yi=i,i};m.localStorage={is_supported:function(n){var e=xi(null,n);return e||J.error("localStorage unsupported; falling back to cookie store"),e},error:function(n){J.error("localStorage error: "+n)},get:function(n){try{return window.localStorage.getItem(n)}catch(e){m.localStorage.error(e)}return null},parse:function(n){try{return m.JSONDecode(m.localStorage.get(n))||{}}catch{}return null},set:function(n,e){try{window.localStorage.setItem(n,e)}catch(i){m.localStorage.error(i)}},remove:function(n){try{window.localStorage.removeItem(n)}catch(e){m.localStorage.error(e)}}},m.register_event=function(){var n=function(t,o,s,r,l){if(!t){J.error("No valid element provided to register_event");return}if(t.addEventListener&&!r)t.addEventListener(o,s,!!l);else{var c="on"+o,b=t[c];t[c]=e(t,s,b)}};function e(t,o,s){var r=function(l){if(l=l||i(window.event),!!l){var c=!0,b,p;return m.isFunction(s)&&(b=s(l)),p=o.call(t,l),(b===!1||p===!1)&&(c=!1),c}};return r}function i(t){return t&&(t.preventDefault=i.preventDefault,t.stopPropagation=i.stopPropagation),t}return i.preventDefault=function(){this.returnValue=!1},i.stopPropagation=function(){this.cancelBubble=!0},n}();var ar=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');m.dom_query=function(){function n(o){return o.all?o.all:o.getElementsByTagName("*")}var e=/[\t\r\n]/g;function i(o,s){var r=" "+s+" ";return(" "+o.className+" ").replace(e," ").indexOf(r)>=0}function t(o){if(!X.getElementsByTagName)return[];var s=o.split(" "),r,l,c,b,p,g,f,y,C,k,S=[X];for(g=0;g<s.length;g++){if(r=s[g].replace(/^\s+/,"").replace(/\s+$/,""),r.indexOf("#")>-1){l=r.split("#"),c=l[0];var M=l[1],A=X.getElementById(M);if(!A||c&&A.nodeName.toLowerCase()!=c)return[];S=[A];continue}if(r.indexOf(".")>-1){l=r.split("."),c=l[0];var _=l[1];for(c||(c="*"),b=[],p=0,f=0;f<S.length;f++)for(c=="*"?C=n(S[f]):C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];for(S=[],k=0,f=0;f<b.length;f++)b[f].className&&m.isString(b[f].className)&&i(b[f],_)&&(S[k++]=b[f]);continue}var E=r.match(ar);if(E){c=E[1];var N=E[2],G=E[3],z=E[4];for(c||(c="*"),b=[],p=0,f=0;f<S.length;f++)for(c=="*"?C=n(S[f]):C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];S=[],k=0;var U;switch(G){case"=":U=function(V){return V.getAttribute(N)==z};break;case"~":U=function(V){return V.getAttribute(N).match(new RegExp("\\b"+z+"\\b"))};break;case"|":U=function(V){return V.getAttribute(N).match(new RegExp("^"+z+"-?"))};break;case"^":U=function(V){return V.getAttribute(N).indexOf(z)===0};break;case"$":U=function(V){return V.getAttribute(N).lastIndexOf(z)==V.getAttribute(N).length-z.length};break;case"*":U=function(V){return V.getAttribute(N).indexOf(z)>-1};break;default:U=function(V){return V.getAttribute(N)}}for(S=[],k=0,f=0;f<b.length;f++)U(b[f])&&(S[k++]=b[f]);continue}for(c=r,b=[],p=0,f=0;f<S.length;f++)for(C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];S=b}return S}return function(o){return m.isElement(o)?[o]:m.isObject(o)&&!m.isUndefined(o.length)?o:t.call(this,o)}}();var rr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],lr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];m.info={campaignParams:function(n){var e="",i={};return m.each(rr,function(t){e=m.getQueryParam(X.URL,t),e.length?i[t]=e:n!==void 0&&(i[t]=n)}),i},clickParams:function(){var n="",e={};return m.each(lr,function(i){n=m.getQueryParam(X.URL,i),n.length&&(e[i]=n)}),e},marketingParams:function(){return m.extend(m.info.campaignParams(),m.info.clickParams())},searchEngine:function(n){return n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(n){var e=m.info.searchEngine(n),i=e!="yahoo"?"q":"p",t={};if(e!==null){t.$search_engine=e;var o=m.getQueryParam(n,i);o.length&&(t.mp_keyword=o)}return t},browser:function(n,e,i){return e=e||"",i||m.includes(n," OPR/")?m.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":m.includes(n,"IEMobile")||m.includes(n,"WPDesktop")?"Internet Explorer Mobile":m.includes(n,"SamsungBrowser/")?"Samsung Internet":m.includes(n,"Edge")||m.includes(n,"Edg/")?"Microsoft Edge":m.includes(n,"FBIOS")?"Facebook Mobile":m.includes(n,"Chrome")?"Chrome":m.includes(n,"CriOS")?"Chrome iOS":m.includes(n,"UCWEB")||m.includes(n,"UCBrowser")?"UC Browser":m.includes(n,"FxiOS")?"Firefox iOS":m.includes(e,"Apple")?m.includes(n,"Mobile")?"Mobile Safari":"Safari":m.includes(n,"Android")?"Android Mobile":m.includes(n,"Konqueror")?"Konqueror":m.includes(n,"Firefox")?"Firefox":m.includes(n,"MSIE")||m.includes(n,"Trident/")?"Internet Explorer":m.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,i){var t=m.info.browser(n,e,i),o={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},s=o[t];if(s===void 0)return null;var r=n.match(s);return r?parseFloat(r[r.length-2]):null},os:function(){var n=ze;return/Windows/i.test(n)?/Phone/.test(n)||/WPDesktop/.test(n)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(n)?"iOS":/Android/.test(n)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Mac/i.test(n)?"Mac OS X":/Linux/.test(n)?"Linux":/CrOS/.test(n)?"Chrome OS":""},device:function(n){return/Windows Phone/i.test(n)||/WPDesktop/.test(n)?"Windows Phone":/iPad/.test(n)?"iPad":/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Android/.test(n)?"Android":""},referringDomain:function(n){var e=n.split("/");return e.length>=3?e[2]:""},currentUrl:function(){return R.location.href},properties:function(n){return typeof n!="object"&&(n={}),m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(ze,ln.vendor,_i),$referrer:X.referrer,$referring_domain:m.info.referringDomain(X.referrer),$device:m.info.device(ze)}),{$current_url:m.info.currentUrl(),$browser_version:m.info.browserVersion(ze,ln.vendor,_i),$screen_height:Mi.height,$screen_width:Mi.width,mp_lib:"web",$lib_version:Je.LIB_VERSION,$insert_id:Qi(),time:m.timestamp()/1e3},m.strip_empty_properties(n))},people_properties:function(){return m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(ze,ln.vendor,_i)}),{$browser_version:m.info.browserVersion(ze,ln.vendor,_i)})},mpPageViewProperties:function(){return m.strip_empty_properties({current_page_title:X.title,current_domain:R.location.hostname,current_url_path:R.location.pathname,current_url_protocol:R.location.protocol,current_url_search:R.location.search})}};var Qi=function(n){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return n?e.substring(0,n):e},dr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,cr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,wo=function(n){var e=cr,i=n.split("."),t=i[i.length-1];(t.length>4||t==="com"||t==="org")&&(e=dr);var o=n.match(e);return o?o[0]:""},ur=function(){var n=R.navigator.onLine;return m.isUndefined(n)||n},Li=null,Ti=null;typeof JSON<"u"&&(Li=JSON.stringify,Ti=JSON.parse),Li=Li||m.JSONEncode,Ti=Ti||m.JSONDecode,m.toArray=m.toArray,m.isObject=m.isObject,m.JSONEncode=m.JSONEncode,m.JSONDecode=m.JSONDecode,m.isBlockedUA=m.isBlockedUA,m.isEmptyObject=m.isEmptyObject,m.info=m.info,m.info.device=m.info.device,m.info.browser=m.info.browser,m.info.browserVersion=m.info.browserVersion,m.info.properties=m.info.properties;var hr="__mp_opt_in_out_";function mr(n,e){_o(!0,n,e)}function pr(n,e){_o(!1,n,e)}function br(n,e){return So(n,e)==="1"}function Co(n,e){if(fr(e))return J.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var i=So(n,e)==="0";return i&&J.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),i}function dn(n){return nt(n,function(e){return this.get_config(e)})}function cn(n){return nt(n,function(e){return this._get_config(e)})}function Dn(n){return nt(n,function(e){return this._get_config(e)})}function vr(n,e){e=e||{},Xi(e).remove(et(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function Xi(n){return n=n||{},n.persistenceType==="localStorage"?m.localStorage:m.cookie}function et(n,e){return e=e||{},(e.persistencePrefix||hr)+n}function So(n,e){return Xi(e).get(et(n,e))}function fr(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||R,i=e.navigator||{},t=!1;return m.each([i.doNotTrack,i.msDoNotTrack,e.doNotTrack],function(o){m.includes([!0,1,"1","yes"],o)&&(t=!0)}),t}function _o(n,e,i){if(!m.isString(e)||!e.length){J.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}i=i||{},Xi(i).set(et(e,i),n?1:0,m.isNumber(i.cookieExpiration)?i.cookieExpiration:null,!!i.crossSubdomainCookie,!!i.secureCookie,!!i.crossSiteCookie,i.cookieDomain),i.track&&n&&i.track(i.trackEventName||"$opt_in",i.trackProperties,{send_immediately:!0})}function nt(n,e){return function(){var i=!1;try{var t=e.call(this,"token"),o=e.call(this,"ignore_dnt"),s=e.call(this,"opt_out_tracking_persistence_type"),r=e.call(this,"opt_out_tracking_cookie_prefix"),l=e.call(this,"window");t&&(i=Co(t,{ignoreDnt:o,persistenceType:s,persistencePrefix:r,window:l}))}catch(b){J.error("Unexpected error when checking tracking opt-out status: "+b)}if(!i)return n.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var gr=Ai("lock"),Mo=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3};Mo.prototype.withLock=function(n,e,i){!i&&typeof e!="function"&&(i=e,e=null);var t=i||new Date().getTime()+"|"+Math.random(),o=new Date().getTime(),s=this.storageKey,r=this.pollIntervalMS,l=this.timeoutMS,c=this.storage,b=s+":X",p=s+":Y",g=s+":Z",f=function(A){e&&e(A)},y=function(A){if(new Date().getTime()-o>l){gr.error("Timeout waiting for mutex on "+s+"; clearing lock. ["+t+"]"),c.removeItem(g),c.removeItem(p),S();return}setTimeout(function(){try{A()}catch(_){f(_)}},r*(Math.random()+.1))},C=function(A,_){A()?_():y(function(){C(A,_)})},k=function(){var A=c.getItem(p);if(A&&A!==t)return!1;if(c.setItem(p,t),c.getItem(p)===t)return!0;if(!xi(c,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},S=function(){c.setItem(b,t),C(k,function(){if(c.getItem(b)===t){M();return}y(function(){if(c.getItem(p)!==t){S();return}C(function(){return!c.getItem(g)},M)})})},M=function(){c.setItem(g,"1");try{n()}finally{c.removeItem(g),c.getItem(p)===t&&c.removeItem(p),c.getItem(b)===t&&c.removeItem(b)}};try{if(xi(c,!0))S();else throw new Error("localStorage support check failed")}catch(A){f(A)}};var Ao=Ai("batch"),un=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.reportError=e.errorReporter||m.bind(Ao.error,Ao),this.lock=new Mo(n,{storage:this.storage}),this.usePersistence=e.usePersistence,this.pid=e.pid||null,this.memQueue=[]};un.prototype.enqueue=function(n,e,i){var t={id:Qi(),flushAfter:new Date().getTime()+e*2,payload:n};this.usePersistence?this.lock.withLock(m.bind(function(){var s;try{var r=this.readFromStorage();r.push(t),s=this.saveToStorage(r),s&&this.memQueue.push(t)}catch{this.reportError("Error enqueueing item",n),s=!1}i&&i(s)},this),m.bind(function(s){this.reportError("Error acquiring storage lock",s),i&&i(!1)},this),this.pid):(this.memQueue.push(t),i&&i(!0))},un.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);if(this.usePersistence&&e.length<n){var i=this.readFromStorage();if(i.length){var t={};m.each(e,function(r){t[r.id]=!0});for(var o=0;o<i.length;o++){var s=i[o];if(new Date().getTime()>s.flushAfter&&!t[s.id]&&(s.orphaned=!0,e.push(s),e.length>=n))break}}}return e};var xo=function(n,e){var i=[];return m.each(n,function(t){t.id&&!e[t.id]&&i.push(t)}),i};un.prototype.removeItemsByID=function(n,e){var i={};if(m.each(n,function(o){i[o]=!0}),this.memQueue=xo(this.memQueue,i),!this.usePersistence)e&&e(!0);else{var t=m.bind(function(){var o;try{var s=this.readFromStorage();if(s=xo(s,i),o=this.saveToStorage(s),o){s=this.readFromStorage();for(var r=0;r<s.length;r++){var l=s[r];if(l.id&&i[l.id])return this.reportError("Item not removed from storage"),!1}}}catch{this.reportError("Error removing items",n),o=!1}return o},this);this.lock.withLock(function(){var s=t();e&&e(s)},m.bind(function(s){var r=!1;if(this.reportError("Error acquiring storage lock",s),!xi(this.storage,!0)&&(r=t(),!r))try{this.storage.removeItem(this.storageKey)}catch(l){this.reportError("Error clearing queue",l)}e&&e(r)},this),this.pid)}};var Lo=function(n,e){var i=[];return m.each(n,function(t){var o=t.id;if(o in e){var s=e[o];s!==null&&(t.payload=s,i.push(t))}else i.push(t)}),i};un.prototype.updatePayloads=function(n,e){this.memQueue=Lo(this.memQueue,n),this.usePersistence?this.lock.withLock(m.bind(function(){var t;try{var o=this.readFromStorage();o=Lo(o,n),t=this.saveToStorage(o)}catch{this.reportError("Error updating items",n),t=!1}e&&e(t)},this),m.bind(function(t){this.reportError("Error acquiring storage lock",t),e&&e(!1)},this),this.pid):e&&e(!0)},un.prototype.readFromStorage=function(){var n;try{n=this.storage.getItem(this.storageKey),n&&(n=Ti(n),m.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null))}catch(e){this.reportError("Error retrieving queue",e),n=null}return n||[]},un.prototype.saveToStorage=function(n){try{return this.storage.setItem(this.storageKey,Li(n)),!0}catch(e){return this.reportError("Error saving queue",e),!1}},un.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var yr=10*60*1e3,Qn=Ai("batch"),He=function(n,e){this.errorReporter=e.errorReporter,this.queue=new un(n,{errorReporter:m.bind(this.reportError,this),storage:e.storage,usePersistence:e.usePersistence}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=e.flushOnlyOnInterval||!1};He.prototype.enqueue=function(n,e){this.queue.enqueue(n,this.flushInterval,e)},He.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},He.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},He.prototype.clear=function(){this.queue.clear()},He.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},He.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},He.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(m.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},He.prototype.flush=function(n){try{if(this.requestInProgress){Qn.log("Flush: Request already in progress");return}n=n||{};var e=this.libConfig.batch_request_timeout_ms,i=new Date().getTime(),t=this.batchSize,o=this.queue.fillBatch(t),s=o.length===t,r=[],l={};if(m.each(o,function(p){var g=p.payload;if(this.beforeSendHook&&!p.orphaned&&(g=this.beforeSendHook(g)),g){g.event&&g.properties&&(g.properties=m.extend({},g.properties,{mp_sent_by_lib_version:Je.LIB_VERSION}));var f=!0,y=p.id;y?(this.itemIdsSentSuccessfully[y]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:p,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[y]}),f=!1):this.reportError("[dupe] found item with no ID",{item:p}),f&&r.push(g)}l[p.id]=g},this),r.length<1){this.resetFlush();return}this.requestInProgress=!0;var c=m.bind(function(p){this.requestInProgress=!1;try{var g=!1;if(n.unloading)this.queue.updatePayloads(l);else if(m.isObject(p)&&p.error==="timeout"&&new Date().getTime()-i>=e)this.reportError("Network timeout; retrying"),this.flush();else if(m.isObject(p)&&(p.httpStatusCode>=500||p.httpStatusCode===429||p.httpStatusCode<=0&&!ur()||p.error==="timeout")){var f=this.flushInterval*2;p.retryAfter&&(f=parseInt(p.retryAfter,10)*1e3||f),f=Math.min(yr,f),this.reportError("Error; retry in "+f+" ms"),this.scheduleFlush(f)}else if(m.isObject(p)&&p.httpStatusCode===413)if(o.length>1){var y=Math.max(1,Math.floor(t/2));this.batchSize=Math.min(this.batchSize,y,o.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",o),this.resetBatchSize(),g=!0;else g=!0;g&&(this.queue.removeItemsByID(m.map(o,function(C){return C.id}),m.bind(function(C){C?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!s?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())},this)),m.each(o,m.bind(function(C){var k=C.id;k?(this.itemIdsSentSuccessfully[k]=this.itemIdsSentSuccessfully[k]||0,this.itemIdsSentSuccessfully[k]++,this.itemIdsSentSuccessfully[k]>5&&this.reportError("[dupe] item ID sent too many times",{item:C,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[k]})):this.reportError("[dupe] found item with no ID while removing",{item:C})},this)))}catch(C){this.reportError("Error handling API response",C),this.resetFlush()}},this),b={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};n.unloading&&(b.transport="sendBeacon"),Qn.log("MIXPANEL REQUEST:",r),this.sendRequest(r,b,c)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},He.prototype.reportError=function(n,e){if(Qn.error.apply(Qn.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(i){Qn.error(i)}};var kn=Ai("recorder"),To=R.CompressionStream,kr={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},wr=new Set([Ge.MouseMove,Ge.MouseInteraction,Ge.Scroll,Ge.ViewportResize,Ge.Input,Ge.TouchMove,Ge.MediaInteraction,Ge.Drag,Ge.Selection]);function Cr(n){return n.type===po.IncrementalSnapshot&&wr.has(n.data.source)}var Ue=function(n){this._mixpanel=n,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=$n,this.recordMinMs=0,this._initBatcher()};Ue.prototype._initBatcher=function(){this.batcher=new He("__mprec",{libConfig:kr,sendRequestFunc:m.bind(this.flushEventsWithOptOut,this),errorReporter:m.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},Ue.prototype.get_config=function(n){return this._mixpanel.get_config(n)},Ue.prototype.startRecording=function(n){if(this._stopRecording!==null){kn.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>$n&&(this.recordMaxMs=$n,kn.critical("record_max_ms cannot be greater than "+$n+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>Wi&&(this.recordMinMs=Wi,kn.critical("record_min_ms cannot be greater than "+Wi+"ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=new Date().getTime(),this.replayId=m.UUID(),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=m.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(m.bind(function(){kn.log("Idle timeout reached, restarting recording."),this.resetRecording()},this),this.get_config("record_idle_timeout_ms"))},this),i=this.get_config("record_block_selector");(i===""||i===null)&&(i=void 0),this._stopRecording=Jn({emit:m.bind(function(t){this.batcher.enqueue(t),Cr(t)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e())},this),blockClass:this.get_config("record_block_class"),blockSelector:i,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),e(),this.maxTimeoutId=setTimeout(m.bind(this.resetRecording,this),this.recordMaxMs)},Ue.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},Ue.prototype.stopRecording=function(){this._stopRecording!==null&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},Ue.prototype.flushEventsWithOptOut=function(n,e,i){this._flushEvents(n,e,i,m.bind(this._onOptOut,this))},Ue.prototype._onOptOut=function(n){n===0&&(this.recEvents=[],this.stopRecording())},Ue.prototype._sendRequest=function(n,e,i,t){var o=m.bind(function(s,r){s.status===200&&this.replayId===n&&this.seqNo++,t({status:0,httpStatusCode:s.status,responseBody:r,retryAfter:s.headers.get("Retry-After")})},this);R.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(e),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:i}).then(function(s){s.json().then(function(r){o(s,r)}).catch(function(r){t({error:r})})}).catch(function(s){t({error:s,httpStatusCode:0})})},Ue.prototype._flushEvents=dn(function(n,e,i){const t=n.length;if(t>0){var o=this.replayId,s=n[0].timestamp;(this.seqNo===0||!this.replayStartTime)&&(this.seqNo!==0&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=s);var r=n[t-1].timestamp-this.replayStartTime,l={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:s/1e3,replay_id:o,replay_length_ms:r,replay_start_time:this.replayStartTime/1e3},c=m.JSONEncode(n),b=this._mixpanel.get_property("$device_id");b&&(l.$device_id=b);var p=this._mixpanel.get_property("$user_id");if(p&&(l.$user_id=p),To){var g=new Blob([c],{type:"application/json"}).stream(),f=g.pipeThrough(new To("gzip"));new Response(f).blob().then(m.bind(function(y){l.format="gzip",this._sendRequest(o,l,y,i)},this))}else l.format="body",this._sendRequest(o,l,c,i)}}),Ue.prototype.reportError=function(n,e){kn.error.apply(kn.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){kn.error(i)}},R.__mp_recorder=Ue;var $e=function(){};$e.prototype.create_properties=function(){},$e.prototype.event_handler=function(){},$e.prototype.after_track_handler=function(){},$e.prototype.init=function(n){return this.mp=n,this},$e.prototype.track=function(n,e,i,t){var o=this,s=m.dom_query(n);if(s.length===0){J.error("The DOM query ("+n+") returned 0 elements");return}return m.each(s,function(r){m.register_event(r,this.override_event,function(l){var c={},b=o.create_properties(i,this),p=o.mp.get_config("track_links_timeout");o.event_handler(l,this,c),window.setTimeout(o.track_callback(t,b,c,!0),p),o.mp.track(e,b,o.track_callback(t,b,c))})},this),!0},$e.prototype.track_callback=function(n,e,i,t){t=t||!1;var o=this;return function(){i.callback_fired||(i.callback_fired=!0,!(n&&n(t,e)===!1)&&o.after_track_handler(e,i,t))}},$e.prototype.create_properties=function(n,e){var i;return typeof n=="function"?i=n(e):i=m.extend({},n),i};var On=function(){this.override_event="click"};m.inherit(On,$e),On.prototype.create_properties=function(n,e){var i=On.superclass.create_properties.apply(this,arguments);return e.href&&(i.url=e.href),i},On.prototype.event_handler=function(n,e,i){i.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",i.href=e.href,i.new_tab||n.preventDefault()},On.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Ei=function(){this.override_event="submit"};m.inherit(Ei,$e),Ei.prototype.event_handler=function(n,e,i){i.element=e,n.preventDefault()},Ei.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var hn="$set",Hn="$set_once",Ke="$unset",wn="$add",Fe="$append",Cn="$union",Ye="$remove",Sr="$delete",Eo={set_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[hn]=t,i},unset_action:function(n){var e={},i=[];return m.isArray(n)||(n=[n]),m.each(n,function(t){this._is_reserved_property(t)||i.push(t)},this),e[Ke]=i,e},set_once_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Hn]=t,i},union_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=m.isArray(o)?o:[o])},this):t[n]=m.isArray(e)?e:[e],i[Cn]=t,i},append_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Fe]=t,i},remove_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Ye]=t,i},delete_action:function(){var n={};return n[Sr]="",n}},ie=function(){};m.extend(ie.prototype,Eo),ie.prototype._init=function(n,e,i){this._mixpanel=n,this._group_key=e,this._group_id=i},ie.prototype.set=Dn(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.set_once=Dn(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.unset=Dn(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),ie.prototype.union=Dn(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),ie.prototype.delete=Dn(function(n){var e=this.delete_action();return this._send_request(e,n)}),ie.prototype.remove=Dn(function(n,e,i){var t=this.remove_action(n,e);return this._send_request(t,i)}),ie.prototype._send_request=function(n,e){n.$group_key=this._group_key,n.$group_id=this._group_id,n.$token=this._get_config("token");var i=m.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:i,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},ie.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},ie.prototype._get_config=function(n){return this._mixpanel.get_config(n)},ie.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},ie.prototype.remove=ie.prototype.remove,ie.prototype.set=ie.prototype.set,ie.prototype.set_once=ie.prototype.set_once,ie.prototype.union=ie.prototype.union,ie.prototype.unset=ie.prototype.unset,ie.prototype.toString=ie.prototype.toString;var D=function(){};m.extend(D.prototype,Eo),D.prototype._init=function(n){this._mixpanel=n},D.prototype.set=cn(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),t[hn]=m.extend({},m.info.people_properties(),t[hn]),this._send_request(t,i)}),D.prototype.set_once=cn(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),D.prototype.unset=cn(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),D.prototype.increment=cn(function(n,e,i){var t={},o={};return m.isObject(n)?(m.each(n,function(s,r){if(!this._is_reserved_property(r))if(isNaN(parseFloat(s))){J.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else o[r]=s},this),i=e):(m.isUndefined(e)&&(e=1),o[n]=e),t[wn]=o,this._send_request(t,i)}),D.prototype.append=cn(function(n,e,i){m.isObject(n)&&(i=e);var t=this.append_action(n,e);return this._send_request(t,i)}),D.prototype.remove=cn(function(n,e,i){m.isObject(n)&&(i=e);var t=this.remove_action(n,e);return this._send_request(t,i)}),D.prototype.union=cn(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),D.prototype.track_charge=cn(function(n,e,i){if(!m.isNumber(n)&&(n=parseFloat(n),isNaN(n))){J.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",m.extend({$amount:n},e),i)}),D.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},D.prototype.delete_user=function(){if(!this._identify_called()){J.error("mixpanel.people.delete_user() requires you to call identify() first");return}var n={$delete:this._mixpanel.get_distinct_id()};return this._send_request(n)},D.prototype.toString=function(){return this._mixpanel.toString()+".people"},D.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var i=this._mixpanel.get_property("$device_id"),t=this._mixpanel.get_property("$user_id"),o=this._mixpanel.get_property("$had_persisted_distinct_id");i&&(n.$device_id=i),t&&(n.$user_id=t),o&&(n.$had_persisted_distinct_id=o);var s=m.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:s,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),m.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),m.truncate(s,255))},D.prototype._get_config=function(n){return this._mixpanel.get_config(n)},D.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},D.prototype._enqueue=function(n){hn in n?this._mixpanel.persistence._add_to_people_queue(hn,n):Hn in n?this._mixpanel.persistence._add_to_people_queue(Hn,n):Ke in n?this._mixpanel.persistence._add_to_people_queue(Ke,n):wn in n?this._mixpanel.persistence._add_to_people_queue(wn,n):Fe in n?this._mixpanel.persistence._add_to_people_queue(Fe,n):Ye in n?this._mixpanel.persistence._add_to_people_queue(Ye,n):Cn in n?this._mixpanel.persistence._add_to_people_queue(Cn,n):J.error("Invalid call to _enqueue():",n)},D.prototype._flush_one_queue=function(n,e,i,t){var o=this,s=m.extend({},this._mixpanel.persistence.load_queue(n)),r=s;!m.isUndefined(s)&&m.isObject(s)&&!m.isEmptyObject(s)&&(o._mixpanel.persistence._pop_from_people_queue(n,s),o._mixpanel.persistence.save(),t&&(r=t(s)),e.call(o,r,function(l,c){l===0&&o._mixpanel.persistence._add_to_people_queue(n,s),m.isUndefined(i)||i(l,c)}))},D.prototype._flush=function(n,e,i,t,o,s,r){var l=this;this._flush_one_queue(hn,this.set,n),this._flush_one_queue(Hn,this.set_once,t),this._flush_one_queue(Ke,this.unset,s,function(S){return m.keys(S)}),this._flush_one_queue(wn,this.increment,e),this._flush_one_queue(Cn,this.union,o);var c=this._mixpanel.persistence.load_queue(Fe);if(!m.isUndefined(c)&&m.isArray(c)&&c.length)for(var b,p=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(Fe,b),m.isUndefined(i)||i(S,M)},g=c.length-1;g>=0;g--)c=this._mixpanel.persistence.load_queue(Fe),b=c.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(b)||l.append(b,p);var f=this._mixpanel.persistence.load_queue(Ye);if(!m.isUndefined(f)&&m.isArray(f)&&f.length)for(var y,C=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(Ye,y),m.isUndefined(r)||r(S,M)},k=f.length-1;k>=0;k--)f=this._mixpanel.persistence.load_queue(Ye),y=f.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(y)||l.remove(y,C)},D.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},D.prototype.set=D.prototype.set,D.prototype.set_once=D.prototype.set_once,D.prototype.unset=D.prototype.unset,D.prototype.increment=D.prototype.increment,D.prototype.append=D.prototype.append,D.prototype.remove=D.prototype.remove,D.prototype.union=D.prototype.union,D.prototype.track_charge=D.prototype.track_charge,D.prototype.clear_charges=D.prototype.clear_charges,D.prototype.delete_user=D.prototype.delete_user,D.prototype.toString=D.prototype.toString;var it="__mps",tt="__mpso",ot="__mpus",st="__mpa",at="__mpap",rt="__mpr",lt="__mpu",Po="$people_distinct_id",Pi="__alias",Xn="__timers",_r=[it,tt,ot,st,at,rt,lt,Po,Pi,Xn],j=function(n){this.props={},this.campaign_params_saved=!1,n.persistence_name?this.name="mp_"+n.persistence_name:this.name="mp_"+n.token+"_mixpanel";var e=n.persistence;e!=="cookie"&&e!=="localStorage"&&(J.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&m.localStorage.is_supported()?this.storage=m.localStorage:this.storage=m.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};j.prototype.properties=function(){var n={};return this.load(),m.each(this.props,function(e,i){m.include(_r,i)||(n[i]=e)}),n},j.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=m.extend({},n))}},j.prototype.upgrade=function(){var n,e;this.storage===m.localStorage?(n=m.cookie.parse(this.name),m.cookie.remove(this.name),m.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===m.cookie&&(e=m.localStorage.parse(this.name),m.localStorage.remove(this.name),e&&this.register_once(e))},j.prototype.save=function(){this.disabled||this.storage.set(this.name,m.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},j.prototype.load_prop=function(n){return this.load(),this.props[n]},j.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},j.prototype.clear=function(){this.remove(),this.props={}},j.prototype.register_once=function(n,e,i){return m.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof i>"u"?this.default_expiry:i,this.load(),m.each(n,function(t,o){(!this.props.hasOwnProperty(o)||this.props[o]===e)&&(this.props[o]=t)},this),this.save(),!0):!1},j.prototype.register=function(n,e){return m.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),m.extend(this.props,n),this.save(),!0):!1},j.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},j.prototype.update_search_keyword=function(n){this.register(m.info.searchInfo(n))},j.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:m.info.referringDomain(n)||"$direct"},"")},j.prototype.get_referrer_info=function(){return m.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},j.prototype.update_config=function(n){this.default_expiry=this.expire_days=n.cookie_expiration,this.set_disabled(n.disable_persistence),this.set_cookie_domain(n.cookie_domain),this.set_cross_site(n.cross_site_cookie),this.set_cross_subdomain(n.cross_subdomain_cookie),this.set_secure(n.secure_cookie)},j.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},j.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},j.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},j.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},j.prototype.get_cross_subdomain=function(){return this.cross_subdomain},j.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},j.prototype._add_to_people_queue=function(n,e){var i=this._get_queue_key(n),t=e[n],o=this._get_or_create_queue(hn),s=this._get_or_create_queue(Hn),r=this._get_or_create_queue(Ke),l=this._get_or_create_queue(wn),c=this._get_or_create_queue(Cn),b=this._get_or_create_queue(Ye,[]),p=this._get_or_create_queue(Fe,[]);i===it?(m.extend(o,t),this._pop_from_people_queue(wn,t),this._pop_from_people_queue(Cn,t),this._pop_from_people_queue(Ke,t)):i===tt?(m.each(t,function(g,f){f in s||(s[f]=g)}),this._pop_from_people_queue(Ke,t)):i===ot?m.each(t,function(g){m.each([o,s,l,c],function(f){g in f&&delete f[g]}),m.each(p,function(f){g in f&&delete f[g]}),r[g]=!0}):i===st?(m.each(t,function(g,f){f in o?o[f]+=g:(f in l||(l[f]=0),l[f]+=g)},this),this._pop_from_people_queue(Ke,t)):i===lt?(m.each(t,function(g,f){m.isArray(g)&&(f in c||(c[f]=[]),c[f]=c[f].concat(g))}),this._pop_from_people_queue(Ke,t)):i===rt?(b.push(t),this._pop_from_people_queue(Fe,t)):i===at&&(p.push(t),this._pop_from_people_queue(Ke,t)),J.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),J.log(e),this.save()},j.prototype._pop_from_people_queue=function(n,e){var i=this.props[this._get_queue_key(n)];m.isUndefined(i)||m.each(e,function(t,o){n===Fe||n===Ye?m.each(i,function(s){s[o]===t&&delete s[o]}):delete i[o]},this)},j.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},j.prototype._get_queue_key=function(n){if(n===hn)return it;if(n===Hn)return tt;if(n===Ke)return ot;if(n===wn)return st;if(n===Fe)return at;if(n===Ye)return rt;if(n===Cn)return lt;J.error("Invalid queue:",n)},j.prototype._get_or_create_queue=function(n,e){var i=this._get_queue_key(n);return e=m.isUndefined(e)?{}:e,this.props[i]||(this.props[i]=e)},j.prototype.set_event_timer=function(n,e){var i=this.load_prop(Xn)||{};i[n]=e,this.props[Xn]=i,this.save()},j.prototype.remove_event_timer=function(n){var e=this.load_prop(Xn)||{},i=e[n];return m.isUndefined(i)||(delete this.props[Xn][n],this.save()),i};var dt,No=function(n,e){throw new Error(n+" not available in this build.")},we,Io=0,Mr=1,Ar=function(n){return n},ei=function(){},Be="mixpanel",Bo="base64",xr="json",ct="$device:",Un=R.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Ro=!Un&&ze.indexOf("MSIE")===-1&&ze.indexOf("Mozilla")===-1,Ni=null;ln.sendBeacon&&(Ni=function(){return ln.sendBeacon.apply(ln,arguments)});var Do={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},Oo={api_host:"https://api-js.mixpanel.com",api_routes:Do,api_method:"POST",api_transport:"XHR",api_payload_format:Bo,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:ei,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:ei,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:30*60*1e3,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:$n,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Ho=!1,x=function(){},ut=function(n,e,i){var t,o=i===Be?we:we[i];if(o&&dt===Io)t=o;else{if(o&&!m.isArray(o)){J.error("You have already initialized "+i);return}t=new x}if(t._cached_groups={},t._init(n,e,i),t.people=new D,t.people._init(t),!t.get_config("skip_first_touch_marketing")){var s=m.info.campaignParams(null),r={},l=!1;m.each(s,function(c,b){r["initial_"+b]=c,c&&(l=!0)}),l&&t.people.set_once(r)}return Je.DEBUG=Je.DEBUG||t.get_config("debug"),!m.isUndefined(o)&&m.isArray(o)&&(t._execute_array.call(t.people,o.people),t._execute_array(o)),t};x.prototype.init=function(n,e,i){if(m.isUndefined(i)){this.report_error("You must name your new library: init(token, config, name)");return}if(i===Be){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var t=ut(n,e,i);return we[i]=t,t._loaded(),t},x.prototype._init=function(n,e,i){e=e||{},this.__loaded=!0,this.config={};var t={};if(!("api_payload_format"in e)){var o=e.api_host||Oo.api_host;o.match(/\.mixpanel\.com/)&&(t.api_payload_format=xr)}if(this.set_config(m.extend({},Oo,t,e,{name:i,token:n,callback_fn:(i===Be?i:Be+"."+i)+"._jsc"})),this._jsc=ei,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!m.localStorage.is_supported(!0)||!Un)this._batch_requests=!1,J.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),m.each(this.get_batcher_configs(),function(c){J.log("Clearing batch queue "+c.queue_key),m.localStorage.remove(c.queue_key)});else if(this.init_batchers(),Ni&&R.addEventListener){var s=m.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);R.addEventListener("pagehide",function(c){c.persisted&&s()}),R.addEventListener("visibilitychange",function(){X.visibilityState==="hidden"&&s()})}}this.persistence=this.cookie=new j(this.config),this.unpersisted_superprops={},this._gdpr_init();var r=m.UUID();this.get_distinct_id()||this.register_once({distinct_id:ct+r,$device_id:r},"");var l=this.get_config("track_pageview");l&&this._init_url_change_tracking(l),this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent")&&this.start_session_recording()},x.prototype.start_session_recording=dn(function(){if(!R.MutationObserver){J.critical("Browser does not support MutationObserver; skipping session recording");return}var n=m.bind(function(){this._recorder=this._recorder||new R.__mp_recorder(this),this._recorder.startRecording()},this);m.isUndefined(R.__mp_recorder)?No(this.get_config("recorder_src"),n):n()}),x.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():J.critical("Session recorder module not loaded")},x.prototype.get_session_recording_properties=function(){var n={};if(this._recorder){var e=this._recorder.replayId;e&&(n.$mp_replay_id=e)}return n},x.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var n=m.info.campaignParams(null);m.each(n,(function(e,i){this.unregister(i)}).bind(this))}},x.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(X.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(m.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(X.referrer)},x.prototype._dom_loaded=function(){m.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||m.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},x.prototype._track_dom=function(n,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!Ho)return this.__dom_loaded_queue.push([n,e]),!1;var i=new n().init(this);return i.track.apply(i,e)},x.prototype._init_url_change_tracking=function(n){var e="",i=this.track_pageview();if(i&&(e=m.info.currentUrl()),m.include(["full-url","url-with-path-and-query-string","url-with-path"],n)){R.addEventListener("popstate",function(){R.dispatchEvent(new Event("mp_locationchange"))}),R.addEventListener("hashchange",function(){R.dispatchEvent(new Event("mp_locationchange"))});var t=R.history.pushState;typeof t=="function"&&(R.history.pushState=function(s,r,l){t.call(R.history,s,r,l),R.dispatchEvent(new Event("mp_locationchange"))});var o=R.history.replaceState;typeof o=="function"&&(R.history.replaceState=function(s,r,l){o.call(R.history,s,r,l),R.dispatchEvent(new Event("mp_locationchange"))}),R.addEventListener("mp_locationchange",(function(){var s=m.info.currentUrl(),r=!1;if(n==="full-url"?r=s!==e:n==="url-with-path-and-query-string"?r=s.split("#")[0]!==e.split("#")[0]:n==="url-with-path"&&(r=s.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0]),r){var l=this.track_pageview();l&&(e=s)}}).bind(this))}},x.prototype._prepare_callback=function(n,e){if(m.isUndefined(n))return null;if(Un){var i=function(r){n(r,e)};return i}else{var t=this._jsc,o=""+Math.floor(Math.random()*1e8),s=this.get_config("callback_fn")+"["+o+"]";return t[o]=function(r){delete t[o],n(r,e)},s}},x.prototype._send_request=function(n,e,i,t){var o=!0;if(Ro)return this.__request_queue.push(arguments),o;var s={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},r=null;!t&&(m.isFunction(i)||typeof i=="string")&&(t=i,i=null),i=m.extend(s,i||{}),Un||(i.method="GET");var l=i.method==="POST",c=Ni&&l&&i.transport.toLowerCase()==="sendbeacon",b=i.verbose;e.verbose&&(b=!0),this.get_config("test")&&(e.test=1),b&&(e.verbose=1),this.get_config("img")&&(e.img=1),Un||(t?e.callback=t:(b||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),l&&(r="data="+encodeURIComponent(e.data),delete e.data),n+="?"+m.HTTPBuildQuery(e);var p=this;if("img"in e){var g=X.createElement("img");g.src=n,X.body.appendChild(g)}else if(c){try{o=Ni(n,r)}catch(M){p.report_error(M),o=!1}try{t&&t(o?1:0)}catch(M){p.report_error(M)}}else if(Un)try{var f=new XMLHttpRequest;f.open(i.method,n,!0);var y=this.get_config("xhr_headers");if(l&&(y["Content-Type"]="application/x-www-form-urlencoded"),m.each(y,function(M,A){f.setRequestHeader(A,M)}),i.timeout_ms&&typeof f.timeout<"u"){f.timeout=i.timeout_ms;var C=new Date().getTime()}f.withCredentials=!0,f.onreadystatechange=function(){if(f.readyState===4)if(f.status===200){if(t)if(b){var M;try{M=m.JSONDecode(f.responseText)}catch(E){if(p.report_error(E),i.ignore_json_errors)M=f.responseText;else return}t(M)}else t(Number(f.responseText))}else{var A;if(f.timeout&&!f.status&&new Date().getTime()-C>=f.timeout?A="timeout":A="Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(A),t)if(b){var _=f.responseHeaders||{};t({status:0,httpStatusCode:f.status,error:A,retryAfter:_["Retry-After"]})}else t(0)}},f.send(r)}catch(M){p.report_error(M),o=!1}else{var k=X.createElement("script");k.type="text/javascript",k.async=!0,k.defer=!0,k.src=n;var S=X.getElementsByTagName("script")[0];S.parentNode.insertBefore(k,S)}return o},x.prototype._execute_array=function(n){var e,i=[],t=[],o=[];m.each(n,function(r){r&&(e=r[0],m.isArray(e)?o.push(r):typeof r=="function"?r.call(this):m.isArray(r)&&e==="alias"?i.push(r):m.isArray(r)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?o.push(r):t.push(r))},this);var s=function(r,l){m.each(r,function(c){if(m.isArray(c[0])){var b=l;m.each(c,function(p){b=b[p[0]].apply(b,p.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};s(i,this),s(t,this),s(o,this)},x.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},x.prototype.get_batcher_configs=function(){var n="__mpq_"+this.get_config("token"),e=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+e.track,queue_key:n+"_ev"},people:{type:"people",endpoint:"/"+e.engage,queue_key:n+"_pp"},groups:{type:"groups",endpoint:"/"+e.groups,queue_key:n+"_gr"}},this._batcher_configs},x.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=m.bind(function(i){return new He(i.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:m.bind(function(t,o,s){this._send_request(this.get_config("api_host")+i.endpoint,this._encode_data_for_request(t),o,this._prepare_callback(s,t))},this),beforeSendHook:m.bind(function(t){return this._run_hook("before_send_"+i.type,t)},this),stopAllBatchingFunc:m.bind(this.stop_batch_senders,this),usePersistence:!0})},this),e=this.get_batcher_configs();this.request_batchers={events:n(e.events),people:n(e.people),groups:n(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},x.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,m.each(this.request_batchers,function(n){n.start()}))},x.prototype.stop_batch_senders=function(){this._batch_requests=!1,m.each(this.request_batchers,function(n){n.stop(),n.clear()})},x.prototype.push=function(n){this._execute_array([n])},x.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},x.prototype._encode_data_for_request=function(n){var e=m.JSONEncode(n);return this.get_config("api_payload_format")===Bo&&(e=m.base64Encode(e)),{data:e}},x.prototype._track_or_batch=function(n,e){var i=m.truncate(n.data,255),t=n.endpoint,o=n.batcher,s=n.should_send_immediately,r=n.send_request_options||{};e=e||ei;var l=!0,c=m.bind(function(){return r.skip_hooks||(i=this._run_hook("before_send_"+n.type,i)),i?(J.log("MIXPANEL REQUEST:"),J.log(i),this._send_request(t,this._encode_data_for_request(i),r,this._prepare_callback(e,i))):null},this);return this._batch_requests&&!s?o.enqueue(i,function(b){b?e(1,i):c()}):l=c(),l&&i},x.prototype.track=dn(function(n,e,i,t){!t&&typeof i=="function"&&(t=i,i=null),i=i||{};var o=i.transport;o&&(i.transport=o);var s=i.send_immediately;if(typeof t!="function"&&(t=ei),m.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){t(0);return}e=m.extend({},e),e.token=this.get_config("token");var r=this.persistence.remove_event_timer(n);if(!m.isUndefined(r)){var l=new Date().getTime()-r;e.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?m.info.marketingParams():{};e=m.extend({},m.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var b=this.get_config("property_blacklist");m.isArray(b)?m.each(b,function(f){delete e[f]}):this.report_error("Invalid value for property_blacklist config: "+b);var p={event:n,properties:e},g=this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:s,send_request_options:i},t);return g}),x.prototype.set_group=dn(function(n,e,i){m.isArray(e)||(e=[e]);var t={};return t[n]=e,this.register(t),this.people.set(n,e,i)}),x.prototype.add_group=dn(function(n,e,i){var t=this.get_property(n),o={};return t===void 0?(o[n]=[e],this.register(o)):t.indexOf(e)===-1&&(t.push(e),o[n]=t,this.register(o)),this.people.union(n,e,i)}),x.prototype.remove_group=dn(function(n,e,i){var t=this.get_property(n);if(t!==void 0){var o=t.indexOf(e);o>-1&&(t.splice(o,1),this.register({group_key:t})),t.length===0&&this.unregister(n)}return this.people.remove(n,e,i)}),x.prototype.track_with_groups=dn(function(n,e,i,t){var o=m.extend({},e||{});return m.each(i,function(s,r){s!=null&&(o[r]=s)}),this.track(n,o,t)}),x.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},x.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},x.prototype.get_group=function(n,e){var i=this._create_map_key(n,e),t=this._cached_groups[i];return(t===void 0||t._group_key!==n||t._group_id!==e)&&(t=new ie,t._init(this,n,e),this._cached_groups[i]=t),t},x.prototype.track_pageview=dn(function(n,e){typeof n!="object"&&(n={}),e=e||{};var i=e.event_name||"$mp_web_page_view",t=m.extend(m.info.mpPageViewProperties(),m.info.campaignParams(),m.info.clickParams()),o=m.extend({},t,n);return this.track(i,o)}),x.prototype.track_links=function(){return this._track_dom.call(this,On,arguments)},x.prototype.track_forms=function(){return this._track_dom.call(this,Ei,arguments)},x.prototype.time_event=function(n){if(m.isUndefined(n)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(n)||this.persistence.set_event_timer(n,new Date().getTime())};var Lr={persistent:!0},ht=function(n){var e;return m.isObject(n)?e=n:m.isUndefined(n)?e={}:e={days:n},m.extend({},Lr,e)};x.prototype.register=function(n,e){var i=ht(e);i.persistent?this.persistence.register(n,i.days):m.extend(this.unpersisted_superprops,n)},x.prototype.register_once=function(n,e,i){var t=ht(i);t.persistent?this.persistence.register_once(n,e,t.days):(typeof e>"u"&&(e="None"),m.each(n,function(o,s){(!this.unpersisted_superprops.hasOwnProperty(s)||this.unpersisted_superprops[s]===e)&&(this.unpersisted_superprops[s]=o)},this))},x.prototype.unregister=function(n,e){e=ht(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},x.prototype._register_single=function(n,e){var i={};i[n]=e,this.register(i)},x.prototype.identify=function(n,e,i,t,o,s,r,l){var c=this.get_distinct_id();if(n&&c!==n){if(typeof n=="string"&&n.indexOf(ct)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var b=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:b},"")}n!==c&&n!==this.get_property(Pi)&&(this.unregister(Pi),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,i,t,o,s,r,l),n!==c&&this.track("$identify",{distinct_id:n,$anon_distinct_id:c},{skip_hooks:!0})},x.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var n=m.UUID();this.register_once({distinct_id:ct+n,$device_id:n},"")},x.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},x.prototype.alias=function(n,e){if(n===this.get_property(Po))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var i=this;return m.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Pi,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){i.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},x.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},x.prototype.set_config=function(n){if(m.isObject(n)){m.extend(this.config,n);var e=n.batch_size;e&&m.each(this.request_batchers,function(i){i.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),Je.DEBUG=Je.DEBUG||this.get_config("debug")}},x.prototype.get_config=function(n){return this.config[n]},x.prototype._run_hook=function(n){var e=(this.config.hooks[n]||Ar).apply(this,rn.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},x.prototype.get_property=function(n){return this.persistence.load_prop([n])},x.prototype.toString=function(){var n=this.get_config("name");return n!==Be&&(n=Be+"."+n),n},x.prototype._event_is_disabled=function(n){return m.isBlockedUA(ze)||this._flags.disable_all_events||m.include(this.__disabled_events,n)},x.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&m.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||m.cookie.get("mp_optout"))&&(m.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},x.prototype._gdpr_update_persistence=function(n){var e;if(n&&n.clear_persistence)e=!0;else if(n&&n.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},x.prototype._gdpr_call_func=function(n,e){return e=m.extend({track:m.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),m.localStorage.is_supported()||(e.persistence_type="cookie"),n(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})},x.prototype.opt_in_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(mr,n),this._gdpr_update_persistence(n)},x.prototype.opt_out_tracking=function(n){n=m.extend({clear_persistence:!0,delete_user:!0},n),n.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(pr,n),this._gdpr_update_persistence(n)},x.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(br,n)},x.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(Co,n)},x.prototype.clear_opt_in_out_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(vr,n),this._gdpr_update_persistence(n)},x.prototype.report_error=function(n,e){J.error.apply(J.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){J.error(i)}},x.prototype.init=x.prototype.init,x.prototype.reset=x.prototype.reset,x.prototype.disable=x.prototype.disable,x.prototype.time_event=x.prototype.time_event,x.prototype.track=x.prototype.track,x.prototype.track_links=x.prototype.track_links,x.prototype.track_forms=x.prototype.track_forms,x.prototype.track_pageview=x.prototype.track_pageview,x.prototype.register=x.prototype.register,x.prototype.register_once=x.prototype.register_once,x.prototype.unregister=x.prototype.unregister,x.prototype.identify=x.prototype.identify,x.prototype.alias=x.prototype.alias,x.prototype.name_tag=x.prototype.name_tag,x.prototype.set_config=x.prototype.set_config,x.prototype.get_config=x.prototype.get_config,x.prototype.get_property=x.prototype.get_property,x.prototype.get_distinct_id=x.prototype.get_distinct_id,x.prototype.toString=x.prototype.toString,x.prototype.opt_out_tracking=x.prototype.opt_out_tracking,x.prototype.opt_in_tracking=x.prototype.opt_in_tracking,x.prototype.has_opted_out_tracking=x.prototype.has_opted_out_tracking,x.prototype.has_opted_in_tracking=x.prototype.has_opted_in_tracking,x.prototype.clear_opt_in_out_tracking=x.prototype.clear_opt_in_out_tracking,x.prototype.get_group=x.prototype.get_group,x.prototype.set_group=x.prototype.set_group,x.prototype.add_group=x.prototype.add_group,x.prototype.remove_group=x.prototype.remove_group,x.prototype.track_with_groups=x.prototype.track_with_groups,x.prototype.start_batch_senders=x.prototype.start_batch_senders,x.prototype.stop_batch_senders=x.prototype.stop_batch_senders,x.prototype.start_session_recording=x.prototype.start_session_recording,x.prototype.stop_session_recording=x.prototype.stop_session_recording,x.prototype.get_session_recording_properties=x.prototype.get_session_recording_properties,x.prototype.DEFAULT_API_ROUTES=Do,j.prototype.properties=j.prototype.properties,j.prototype.update_search_keyword=j.prototype.update_search_keyword,j.prototype.update_referrer_info=j.prototype.update_referrer_info,j.prototype.get_cross_subdomain=j.prototype.get_cross_subdomain,j.prototype.clear=j.prototype.clear;var Kn={},Tr=function(){m.each(Kn,function(n,e){e!==Be&&(we[e]=n)}),we._=m},Er=function(){we.init=function(n,e,i){if(i)return we[i]||(we[i]=Kn[i]=ut(n,e,i),we[i]._loaded()),we[i];var t=we;Kn[Be]?t=Kn[Be]:n&&(t=ut(n,e,Be),t._loaded(),Kn[Be]=t),we=t,dt===Mr&&(R[Be]=we),Tr()}},Pr=function(){function n(){n.done||(n.done=!0,Ho=!0,Ro=!1,m.each(Kn,function(t){t._dom_loaded()}))}function e(){try{X.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(X.addEventListener)X.readyState==="complete"?n():X.addEventListener("DOMContentLoaded",n,!1);else if(X.attachEvent){X.attachEvent("onreadystatechange",n);var i=!1;try{i=R.frameElement===null}catch{}X.documentElement.doScroll&&i&&e()}m.register_event(R,"load",n,!0)};function Nr(n){return No=n,dt=Io,we=new x,Er(),we.init(),Pr(),we}function Ir(n,e){e()}var P=Nr(Ir);const Uo=`<div id="checkoutConfirmationEnd">
766
+ `);var e="",i,t,o=0,s;for(i=t=0,o=n.length,s=0;s<o;s++){var r=n.charCodeAt(s),l=null;r<128?t++:r>127&&r<2048?l=String.fromCharCode(r>>6|192,r&63|128):l=String.fromCharCode(r>>12|224,r>>6&63|128,r&63|128),l!==null&&(t>i&&(e+=n.substring(i,t)),e+=l,i=t=s+1)}return t>i&&(e+=n.substring(i,n.length)),e},m.UUID=function(){var n=function(){var t=1*new Date,o;if(R.performance&&R.performance.now)o=R.performance.now();else for(o=0;t==1*new Date;)o++;return t.toString(16)+Math.floor(o).toString(16)},e=function(){return Math.random().toString(16).replace(".","")},i=function(){var t=ze,o,s,r=[],l=0;function c(b,p){var g,f=0;for(g=0;g<p.length;g++)f|=r[g]<<g*8;return b^f}for(o=0;o<t.length;o++)s=t.charCodeAt(o),r.unshift(s&255),r.length>=4&&(l=c(l,r),r=[]);return r.length>0&&(l=c(l,r)),l.toString(16)};return function(){var t=(Mi.height*Mi.width).toString(16);return n()+"-"+e()+"-"+i()+"-"+t+"-"+n()}}();var wo=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];m.isBlockedUA=function(n){var e;for(n=n.toLowerCase(),e=0;e<wo.length;e++)if(n.indexOf(wo[e])!==-1)return!0;return!1},m.HTTPBuildQuery=function(n,e){var i,t,o=[];return m.isUndefined(e)&&(e="&"),m.each(n,function(s,r){i=encodeURIComponent(s.toString()),t=encodeURIComponent(r),o[o.length]=t+"="+i}),o.join(e)},m.getQueryParam=function(n,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var i="[\\?&]"+e+"=([^&#]*)",t=new RegExp(i),o=t.exec(n);if(o===null||o&&typeof o[1]!="string"&&o[1].length)return"";var s=o[1];try{s=decodeURIComponent(s)}catch{J.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},m.cookie={get:function(n){for(var e=n+"=",i=X.cookie.split(";"),t=0;t<i.length;t++){for(var o=i[t];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(e)===0)return decodeURIComponent(o.substring(e.length,o.length))}return null},parse:function(n){var e;try{e=m.JSONDecode(m.cookie.get(n))||{}}catch{}return e},set_seconds:function(n,e,i,t,o,s,r){var l="",c="",b="";if(r)l="; domain="+r;else if(t){var p=Co(X.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*1e3),c="; expires="+g.toGMTString()}s&&(o=!0,b="; SameSite=None"),o&&(b+="; secure"),X.cookie=n+"="+encodeURIComponent(e)+c+"; path=/"+l+b},set:function(n,e,i,t,o,s,r){var l="",c="",b="";if(r)l="; domain="+r;else if(t){var p=Co(X.location.hostname);l=p?"; domain=."+p:""}if(i){var g=new Date;g.setTime(g.getTime()+i*24*60*60*1e3),c="; expires="+g.toGMTString()}s&&(o=!0,b="; SameSite=None"),o&&(b+="; secure");var f=n+"="+encodeURIComponent(e)+c+"; path=/"+l+b;return X.cookie=f,f},remove:function(n,e,i){m.cookie.set(n,"",-1,e,!1,!1,i)}};var Yi=null,xi=function(n,e){if(Yi!==null&&!e)return Yi;var i=!0;try{n=n||window.localStorage;var t="__mplss_"+Qi(8),o="xyz";n.setItem(t,o),n.getItem(t)!==o&&(i=!1),n.removeItem(t)}catch{i=!1}return Yi=i,i};m.localStorage={is_supported:function(n){var e=xi(null,n);return e||J.error("localStorage unsupported; falling back to cookie store"),e},error:function(n){J.error("localStorage error: "+n)},get:function(n){try{return window.localStorage.getItem(n)}catch(e){m.localStorage.error(e)}return null},parse:function(n){try{return m.JSONDecode(m.localStorage.get(n))||{}}catch{}return null},set:function(n,e){try{window.localStorage.setItem(n,e)}catch(i){m.localStorage.error(i)}},remove:function(n){try{window.localStorage.removeItem(n)}catch(e){m.localStorage.error(e)}}},m.register_event=function(){var n=function(t,o,s,r,l){if(!t){J.error("No valid element provided to register_event");return}if(t.addEventListener&&!r)t.addEventListener(o,s,!!l);else{var c="on"+o,b=t[c];t[c]=e(t,s,b)}};function e(t,o,s){var r=function(l){if(l=l||i(window.event),!!l){var c=!0,b,p;return m.isFunction(s)&&(b=s(l)),p=o.call(t,l),(b===!1||p===!1)&&(c=!1),c}};return r}function i(t){return t&&(t.preventDefault=i.preventDefault,t.stopPropagation=i.stopPropagation),t}return i.preventDefault=function(){this.returnValue=!1},i.stopPropagation=function(){this.cancelBubble=!0},n}();var ar=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');m.dom_query=function(){function n(o){return o.all?o.all:o.getElementsByTagName("*")}var e=/[\t\r\n]/g;function i(o,s){var r=" "+s+" ";return(" "+o.className+" ").replace(e," ").indexOf(r)>=0}function t(o){if(!X.getElementsByTagName)return[];var s=o.split(" "),r,l,c,b,p,g,f,y,C,k,S=[X];for(g=0;g<s.length;g++){if(r=s[g].replace(/^\s+/,"").replace(/\s+$/,""),r.indexOf("#")>-1){l=r.split("#"),c=l[0];var M=l[1],A=X.getElementById(M);if(!A||c&&A.nodeName.toLowerCase()!=c)return[];S=[A];continue}if(r.indexOf(".")>-1){l=r.split("."),c=l[0];var _=l[1];for(c||(c="*"),b=[],p=0,f=0;f<S.length;f++)for(c=="*"?C=n(S[f]):C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];for(S=[],k=0,f=0;f<b.length;f++)b[f].className&&m.isString(b[f].className)&&i(b[f],_)&&(S[k++]=b[f]);continue}var E=r.match(ar);if(E){c=E[1];var N=E[2],G=E[3],z=E[4];for(c||(c="*"),b=[],p=0,f=0;f<S.length;f++)for(c=="*"?C=n(S[f]):C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];S=[],k=0;var U;switch(G){case"=":U=function(V){return V.getAttribute(N)==z};break;case"~":U=function(V){return V.getAttribute(N).match(new RegExp("\\b"+z+"\\b"))};break;case"|":U=function(V){return V.getAttribute(N).match(new RegExp("^"+z+"-?"))};break;case"^":U=function(V){return V.getAttribute(N).indexOf(z)===0};break;case"$":U=function(V){return V.getAttribute(N).lastIndexOf(z)==V.getAttribute(N).length-z.length};break;case"*":U=function(V){return V.getAttribute(N).indexOf(z)>-1};break;default:U=function(V){return V.getAttribute(N)}}for(S=[],k=0,f=0;f<b.length;f++)U(b[f])&&(S[k++]=b[f]);continue}for(c=r,b=[],p=0,f=0;f<S.length;f++)for(C=S[f].getElementsByTagName(c),y=0;y<C.length;y++)b[p++]=C[y];S=b}return S}return function(o){return m.isElement(o)?[o]:m.isObject(o)&&!m.isUndefined(o.length)?o:t.call(this,o)}}();var rr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],lr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];m.info={campaignParams:function(n){var e="",i={};return m.each(rr,function(t){e=m.getQueryParam(X.URL,t),e.length?i[t]=e:n!==void 0&&(i[t]=n)}),i},clickParams:function(){var n="",e={};return m.each(lr,function(i){n=m.getQueryParam(X.URL,i),n.length&&(e[i]=n)}),e},marketingParams:function(){return m.extend(m.info.campaignParams(),m.info.clickParams())},searchEngine:function(n){return n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(n){var e=m.info.searchEngine(n),i=e!="yahoo"?"q":"p",t={};if(e!==null){t.$search_engine=e;var o=m.getQueryParam(n,i);o.length&&(t.mp_keyword=o)}return t},browser:function(n,e,i){return e=e||"",i||m.includes(n," OPR/")?m.includes(n,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":m.includes(n,"IEMobile")||m.includes(n,"WPDesktop")?"Internet Explorer Mobile":m.includes(n,"SamsungBrowser/")?"Samsung Internet":m.includes(n,"Edge")||m.includes(n,"Edg/")?"Microsoft Edge":m.includes(n,"FBIOS")?"Facebook Mobile":m.includes(n,"Chrome")?"Chrome":m.includes(n,"CriOS")?"Chrome iOS":m.includes(n,"UCWEB")||m.includes(n,"UCBrowser")?"UC Browser":m.includes(n,"FxiOS")?"Firefox iOS":m.includes(e,"Apple")?m.includes(n,"Mobile")?"Mobile Safari":"Safari":m.includes(n,"Android")?"Android Mobile":m.includes(n,"Konqueror")?"Konqueror":m.includes(n,"Firefox")?"Firefox":m.includes(n,"MSIE")||m.includes(n,"Trident/")?"Internet Explorer":m.includes(n,"Gecko")?"Mozilla":""},browserVersion:function(n,e,i){var t=m.info.browser(n,e,i),o={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},s=o[t];if(s===void 0)return null;var r=n.match(s);return r?parseFloat(r[r.length-2]):null},os:function(){var n=ze;return/Windows/i.test(n)?/Phone/.test(n)||/WPDesktop/.test(n)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(n)?"iOS":/Android/.test(n)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Mac/i.test(n)?"Mac OS X":/Linux/.test(n)?"Linux":/CrOS/.test(n)?"Chrome OS":""},device:function(n){return/Windows Phone/i.test(n)||/WPDesktop/.test(n)?"Windows Phone":/iPad/.test(n)?"iPad":/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(n)?"BlackBerry":/Android/.test(n)?"Android":""},referringDomain:function(n){var e=n.split("/");return e.length>=3?e[2]:""},currentUrl:function(){return R.location.href},properties:function(n){return typeof n!="object"&&(n={}),m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(ze,ln.vendor,_i),$referrer:X.referrer,$referring_domain:m.info.referringDomain(X.referrer),$device:m.info.device(ze)}),{$current_url:m.info.currentUrl(),$browser_version:m.info.browserVersion(ze,ln.vendor,_i),$screen_height:Mi.height,$screen_width:Mi.width,mp_lib:"web",$lib_version:Je.LIB_VERSION,$insert_id:Qi(),time:m.timestamp()/1e3},m.strip_empty_properties(n))},people_properties:function(){return m.extend(m.strip_empty_properties({$os:m.info.os(),$browser:m.info.browser(ze,ln.vendor,_i)}),{$browser_version:m.info.browserVersion(ze,ln.vendor,_i)})},mpPageViewProperties:function(){return m.strip_empty_properties({current_page_title:X.title,current_domain:R.location.hostname,current_url_path:R.location.pathname,current_url_protocol:R.location.protocol,current_url_search:R.location.search})}};var Qi=function(n){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return n?e.substring(0,n):e},dr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,cr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,Co=function(n){var e=cr,i=n.split("."),t=i[i.length-1];(t.length>4||t==="com"||t==="org")&&(e=dr);var o=n.match(e);return o?o[0]:""},ur=function(){var n=R.navigator.onLine;return m.isUndefined(n)||n},Li=null,Ti=null;typeof JSON<"u"&&(Li=JSON.stringify,Ti=JSON.parse),Li=Li||m.JSONEncode,Ti=Ti||m.JSONDecode,m.toArray=m.toArray,m.isObject=m.isObject,m.JSONEncode=m.JSONEncode,m.JSONDecode=m.JSONDecode,m.isBlockedUA=m.isBlockedUA,m.isEmptyObject=m.isEmptyObject,m.info=m.info,m.info.device=m.info.device,m.info.browser=m.info.browser,m.info.browserVersion=m.info.browserVersion,m.info.properties=m.info.properties;var hr="__mp_opt_in_out_";function mr(n,e){Mo(!0,n,e)}function pr(n,e){Mo(!1,n,e)}function br(n,e){return _o(n,e)==="1"}function So(n,e){if(fr(e))return J.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var i=_o(n,e)==="0";return i&&J.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),i}function dn(n){return nt(n,function(e){return this.get_config(e)})}function cn(n){return nt(n,function(e){return this._get_config(e)})}function Dn(n){return nt(n,function(e){return this._get_config(e)})}function vr(n,e){e=e||{},Xi(e).remove(et(n,e),!!e.crossSubdomainCookie,e.cookieDomain)}function Xi(n){return n=n||{},n.persistenceType==="localStorage"?m.localStorage:m.cookie}function et(n,e){return e=e||{},(e.persistencePrefix||hr)+n}function _o(n,e){return Xi(e).get(et(n,e))}function fr(n){if(n&&n.ignoreDnt)return!1;var e=n&&n.window||R,i=e.navigator||{},t=!1;return m.each([i.doNotTrack,i.msDoNotTrack,e.doNotTrack],function(o){m.includes([!0,1,"1","yes"],o)&&(t=!0)}),t}function Mo(n,e,i){if(!m.isString(e)||!e.length){J.error("gdpr."+(n?"optIn":"optOut")+" called with an invalid token");return}i=i||{},Xi(i).set(et(e,i),n?1:0,m.isNumber(i.cookieExpiration)?i.cookieExpiration:null,!!i.crossSubdomainCookie,!!i.secureCookie,!!i.crossSiteCookie,i.cookieDomain),i.track&&n&&i.track(i.trackEventName||"$opt_in",i.trackProperties,{send_immediately:!0})}function nt(n,e){return function(){var i=!1;try{var t=e.call(this,"token"),o=e.call(this,"ignore_dnt"),s=e.call(this,"opt_out_tracking_persistence_type"),r=e.call(this,"opt_out_tracking_cookie_prefix"),l=e.call(this,"window");t&&(i=So(t,{ignoreDnt:o,persistenceType:s,persistencePrefix:r,window:l}))}catch(b){J.error("Unexpected error when checking tracking opt-out status: "+b)}if(!i)return n.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var gr=Ai("lock"),Ao=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3};Ao.prototype.withLock=function(n,e,i){!i&&typeof e!="function"&&(i=e,e=null);var t=i||new Date().getTime()+"|"+Math.random(),o=new Date().getTime(),s=this.storageKey,r=this.pollIntervalMS,l=this.timeoutMS,c=this.storage,b=s+":X",p=s+":Y",g=s+":Z",f=function(A){e&&e(A)},y=function(A){if(new Date().getTime()-o>l){gr.error("Timeout waiting for mutex on "+s+"; clearing lock. ["+t+"]"),c.removeItem(g),c.removeItem(p),S();return}setTimeout(function(){try{A()}catch(_){f(_)}},r*(Math.random()+.1))},C=function(A,_){A()?_():y(function(){C(A,_)})},k=function(){var A=c.getItem(p);if(A&&A!==t)return!1;if(c.setItem(p,t),c.getItem(p)===t)return!0;if(!xi(c,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},S=function(){c.setItem(b,t),C(k,function(){if(c.getItem(b)===t){M();return}y(function(){if(c.getItem(p)!==t){S();return}C(function(){return!c.getItem(g)},M)})})},M=function(){c.setItem(g,"1");try{n()}finally{c.removeItem(g),c.getItem(p)===t&&c.removeItem(p),c.getItem(b)===t&&c.removeItem(b)}};try{if(xi(c,!0))S();else throw new Error("localStorage support check failed")}catch(A){f(A)}};var xo=Ai("batch"),un=function(n,e){e=e||{},this.storageKey=n,this.storage=e.storage||window.localStorage,this.reportError=e.errorReporter||m.bind(xo.error,xo),this.lock=new Ao(n,{storage:this.storage}),this.usePersistence=e.usePersistence,this.pid=e.pid||null,this.memQueue=[]};un.prototype.enqueue=function(n,e,i){var t={id:Qi(),flushAfter:new Date().getTime()+e*2,payload:n};this.usePersistence?this.lock.withLock(m.bind(function(){var s;try{var r=this.readFromStorage();r.push(t),s=this.saveToStorage(r),s&&this.memQueue.push(t)}catch{this.reportError("Error enqueueing item",n),s=!1}i&&i(s)},this),m.bind(function(s){this.reportError("Error acquiring storage lock",s),i&&i(!1)},this),this.pid):(this.memQueue.push(t),i&&i(!0))},un.prototype.fillBatch=function(n){var e=this.memQueue.slice(0,n);if(this.usePersistence&&e.length<n){var i=this.readFromStorage();if(i.length){var t={};m.each(e,function(r){t[r.id]=!0});for(var o=0;o<i.length;o++){var s=i[o];if(new Date().getTime()>s.flushAfter&&!t[s.id]&&(s.orphaned=!0,e.push(s),e.length>=n))break}}}return e};var Lo=function(n,e){var i=[];return m.each(n,function(t){t.id&&!e[t.id]&&i.push(t)}),i};un.prototype.removeItemsByID=function(n,e){var i={};if(m.each(n,function(o){i[o]=!0}),this.memQueue=Lo(this.memQueue,i),!this.usePersistence)e&&e(!0);else{var t=m.bind(function(){var o;try{var s=this.readFromStorage();if(s=Lo(s,i),o=this.saveToStorage(s),o){s=this.readFromStorage();for(var r=0;r<s.length;r++){var l=s[r];if(l.id&&i[l.id])return this.reportError("Item not removed from storage"),!1}}}catch{this.reportError("Error removing items",n),o=!1}return o},this);this.lock.withLock(function(){var s=t();e&&e(s)},m.bind(function(s){var r=!1;if(this.reportError("Error acquiring storage lock",s),!xi(this.storage,!0)&&(r=t(),!r))try{this.storage.removeItem(this.storageKey)}catch(l){this.reportError("Error clearing queue",l)}e&&e(r)},this),this.pid)}};var To=function(n,e){var i=[];return m.each(n,function(t){var o=t.id;if(o in e){var s=e[o];s!==null&&(t.payload=s,i.push(t))}else i.push(t)}),i};un.prototype.updatePayloads=function(n,e){this.memQueue=To(this.memQueue,n),this.usePersistence?this.lock.withLock(m.bind(function(){var t;try{var o=this.readFromStorage();o=To(o,n),t=this.saveToStorage(o)}catch{this.reportError("Error updating items",n),t=!1}e&&e(t)},this),m.bind(function(t){this.reportError("Error acquiring storage lock",t),e&&e(!1)},this),this.pid):e&&e(!0)},un.prototype.readFromStorage=function(){var n;try{n=this.storage.getItem(this.storageKey),n&&(n=Ti(n),m.isArray(n)||(this.reportError("Invalid storage entry:",n),n=null))}catch(e){this.reportError("Error retrieving queue",e),n=null}return n||[]},un.prototype.saveToStorage=function(n){try{return this.storage.setItem(this.storageKey,Li(n)),!0}catch(e){return this.reportError("Error saving queue",e),!1}},un.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var yr=10*60*1e3,Qn=Ai("batch"),He=function(n,e){this.errorReporter=e.errorReporter,this.queue=new un(n,{errorReporter:m.bind(this.reportError,this),storage:e.storage,usePersistence:e.usePersistence}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=e.flushOnlyOnInterval||!1};He.prototype.enqueue=function(n,e){this.queue.enqueue(n,this.flushInterval,e)},He.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},He.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},He.prototype.clear=function(){this.queue.clear()},He.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},He.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},He.prototype.scheduleFlush=function(n){this.flushInterval=n,this.stopped||(this.timeoutID=setTimeout(m.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},He.prototype.flush=function(n){try{if(this.requestInProgress){Qn.log("Flush: Request already in progress");return}n=n||{};var e=this.libConfig.batch_request_timeout_ms,i=new Date().getTime(),t=this.batchSize,o=this.queue.fillBatch(t),s=o.length===t,r=[],l={};if(m.each(o,function(p){var g=p.payload;if(this.beforeSendHook&&!p.orphaned&&(g=this.beforeSendHook(g)),g){g.event&&g.properties&&(g.properties=m.extend({},g.properties,{mp_sent_by_lib_version:Je.LIB_VERSION}));var f=!0,y=p.id;y?(this.itemIdsSentSuccessfully[y]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:p,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[y]}),f=!1):this.reportError("[dupe] found item with no ID",{item:p}),f&&r.push(g)}l[p.id]=g},this),r.length<1){this.resetFlush();return}this.requestInProgress=!0;var c=m.bind(function(p){this.requestInProgress=!1;try{var g=!1;if(n.unloading)this.queue.updatePayloads(l);else if(m.isObject(p)&&p.error==="timeout"&&new Date().getTime()-i>=e)this.reportError("Network timeout; retrying"),this.flush();else if(m.isObject(p)&&(p.httpStatusCode>=500||p.httpStatusCode===429||p.httpStatusCode<=0&&!ur()||p.error==="timeout")){var f=this.flushInterval*2;p.retryAfter&&(f=parseInt(p.retryAfter,10)*1e3||f),f=Math.min(yr,f),this.reportError("Error; retry in "+f+" ms"),this.scheduleFlush(f)}else if(m.isObject(p)&&p.httpStatusCode===413)if(o.length>1){var y=Math.max(1,Math.floor(t/2));this.batchSize=Math.min(this.batchSize,y,o.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",o),this.resetBatchSize(),g=!0;else g=!0;g&&(this.queue.removeItemsByID(m.map(o,function(C){return C.id}),m.bind(function(C){C?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!s?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())},this)),m.each(o,m.bind(function(C){var k=C.id;k?(this.itemIdsSentSuccessfully[k]=this.itemIdsSentSuccessfully[k]||0,this.itemIdsSentSuccessfully[k]++,this.itemIdsSentSuccessfully[k]>5&&this.reportError("[dupe] item ID sent too many times",{item:C,batchSize:o.length,timesSent:this.itemIdsSentSuccessfully[k]})):this.reportError("[dupe] found item with no ID while removing",{item:C})},this)))}catch(C){this.reportError("Error handling API response",C),this.resetFlush()}},this),b={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};n.unloading&&(b.transport="sendBeacon"),Qn.log("MIXPANEL REQUEST:",r),this.sendRequest(r,b,c)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},He.prototype.reportError=function(n,e){if(Qn.error.apply(Qn.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(n)),this.errorReporter(n,e)}catch(i){Qn.error(i)}};var kn=Ai("recorder"),Eo=R.CompressionStream,kr={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},wr=new Set([Ge.MouseMove,Ge.MouseInteraction,Ge.Scroll,Ge.ViewportResize,Ge.Input,Ge.TouchMove,Ge.MediaInteraction,Ge.Drag,Ge.Selection]);function Cr(n){return n.type===bo.IncrementalSnapshot&&wr.has(n.data.source)}var Ue=function(n){this._mixpanel=n,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=$n,this.recordMinMs=0,this._initBatcher()};Ue.prototype._initBatcher=function(){this.batcher=new He("__mprec",{libConfig:kr,sendRequestFunc:m.bind(this.flushEventsWithOptOut,this),errorReporter:m.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},Ue.prototype.get_config=function(n){return this._mixpanel.get_config(n)},Ue.prototype.startRecording=function(n){if(this._stopRecording!==null){kn.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>$n&&(this.recordMaxMs=$n,kn.critical("record_max_ms cannot be greater than "+$n+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>Wi&&(this.recordMinMs=Wi,kn.critical("record_min_ms cannot be greater than "+Wi+"ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=new Date().getTime(),this.replayId=m.UUID(),n||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var e=m.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(m.bind(function(){kn.log("Idle timeout reached, restarting recording."),this.resetRecording()},this),this.get_config("record_idle_timeout_ms"))},this),i=this.get_config("record_block_selector");(i===""||i===null)&&(i=void 0),this._stopRecording=Jn({emit:m.bind(function(t){this.batcher.enqueue(t),Cr(t)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),e())},this),blockClass:this.get_config("record_block_class"),blockSelector:i,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),e(),this.maxTimeoutId=setTimeout(m.bind(this.resetRecording,this),this.recordMaxMs)},Ue.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},Ue.prototype.stopRecording=function(){this._stopRecording!==null&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},Ue.prototype.flushEventsWithOptOut=function(n,e,i){this._flushEvents(n,e,i,m.bind(this._onOptOut,this))},Ue.prototype._onOptOut=function(n){n===0&&(this.recEvents=[],this.stopRecording())},Ue.prototype._sendRequest=function(n,e,i,t){var o=m.bind(function(s,r){s.status===200&&this.replayId===n&&this.seqNo++,t({status:0,httpStatusCode:s.status,responseBody:r,retryAfter:s.headers.get("Retry-After")})},this);R.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(e),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:i}).then(function(s){s.json().then(function(r){o(s,r)}).catch(function(r){t({error:r})})}).catch(function(s){t({error:s,httpStatusCode:0})})},Ue.prototype._flushEvents=dn(function(n,e,i){const t=n.length;if(t>0){var o=this.replayId,s=n[0].timestamp;(this.seqNo===0||!this.replayStartTime)&&(this.seqNo!==0&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=s);var r=n[t-1].timestamp-this.replayStartTime,l={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:s/1e3,replay_id:o,replay_length_ms:r,replay_start_time:this.replayStartTime/1e3},c=m.JSONEncode(n),b=this._mixpanel.get_property("$device_id");b&&(l.$device_id=b);var p=this._mixpanel.get_property("$user_id");if(p&&(l.$user_id=p),Eo){var g=new Blob([c],{type:"application/json"}).stream(),f=g.pipeThrough(new Eo("gzip"));new Response(f).blob().then(m.bind(function(y){l.format="gzip",this._sendRequest(o,l,y,i)},this))}else l.format="body",this._sendRequest(o,l,c,i)}}),Ue.prototype.reportError=function(n,e){kn.error.apply(kn.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){kn.error(i)}},R.__mp_recorder=Ue;var $e=function(){};$e.prototype.create_properties=function(){},$e.prototype.event_handler=function(){},$e.prototype.after_track_handler=function(){},$e.prototype.init=function(n){return this.mp=n,this},$e.prototype.track=function(n,e,i,t){var o=this,s=m.dom_query(n);if(s.length===0){J.error("The DOM query ("+n+") returned 0 elements");return}return m.each(s,function(r){m.register_event(r,this.override_event,function(l){var c={},b=o.create_properties(i,this),p=o.mp.get_config("track_links_timeout");o.event_handler(l,this,c),window.setTimeout(o.track_callback(t,b,c,!0),p),o.mp.track(e,b,o.track_callback(t,b,c))})},this),!0},$e.prototype.track_callback=function(n,e,i,t){t=t||!1;var o=this;return function(){i.callback_fired||(i.callback_fired=!0,!(n&&n(t,e)===!1)&&o.after_track_handler(e,i,t))}},$e.prototype.create_properties=function(n,e){var i;return typeof n=="function"?i=n(e):i=m.extend({},n),i};var On=function(){this.override_event="click"};m.inherit(On,$e),On.prototype.create_properties=function(n,e){var i=On.superclass.create_properties.apply(this,arguments);return e.href&&(i.url=e.href),i},On.prototype.event_handler=function(n,e,i){i.new_tab=n.which===2||n.metaKey||n.ctrlKey||e.target==="_blank",i.href=e.href,i.new_tab||n.preventDefault()},On.prototype.after_track_handler=function(n,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Ei=function(){this.override_event="submit"};m.inherit(Ei,$e),Ei.prototype.event_handler=function(n,e,i){i.element=e,n.preventDefault()},Ei.prototype.after_track_handler=function(n,e){setTimeout(function(){e.element.submit()},0)};var hn="$set",Hn="$set_once",Ke="$unset",wn="$add",Fe="$append",Cn="$union",Ye="$remove",Sr="$delete",Po={set_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[hn]=t,i},unset_action:function(n){var e={},i=[];return m.isArray(n)||(n=[n]),m.each(n,function(t){this._is_reserved_property(t)||i.push(t)},this),e[Ke]=i,e},set_once_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Hn]=t,i},union_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=m.isArray(o)?o:[o])},this):t[n]=m.isArray(e)?e:[e],i[Cn]=t,i},append_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Fe]=t,i},remove_action:function(n,e){var i={},t={};return m.isObject(n)?m.each(n,function(o,s){this._is_reserved_property(s)||(t[s]=o)},this):t[n]=e,i[Ye]=t,i},delete_action:function(){var n={};return n[Sr]="",n}},ie=function(){};m.extend(ie.prototype,Po),ie.prototype._init=function(n,e,i){this._mixpanel=n,this._group_key=e,this._group_id=i},ie.prototype.set=Dn(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.set_once=Dn(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),ie.prototype.unset=Dn(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),ie.prototype.union=Dn(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),ie.prototype.delete=Dn(function(n){var e=this.delete_action();return this._send_request(e,n)}),ie.prototype.remove=Dn(function(n,e,i){var t=this.remove_action(n,e);return this._send_request(t,i)}),ie.prototype._send_request=function(n,e){n.$group_key=this._group_key,n.$group_id=this._group_id,n.$token=this._get_config("token");var i=m.encodeDates(n);return this._mixpanel._track_or_batch({type:"groups",data:i,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)},ie.prototype._is_reserved_property=function(n){return n==="$group_key"||n==="$group_id"},ie.prototype._get_config=function(n){return this._mixpanel.get_config(n)},ie.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},ie.prototype.remove=ie.prototype.remove,ie.prototype.set=ie.prototype.set,ie.prototype.set_once=ie.prototype.set_once,ie.prototype.union=ie.prototype.union,ie.prototype.unset=ie.prototype.unset,ie.prototype.toString=ie.prototype.toString;var D=function(){};m.extend(D.prototype,Po),D.prototype._init=function(n){this._mixpanel=n},D.prototype.set=cn(function(n,e,i){var t=this.set_action(n,e);return m.isObject(n)&&(i=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),t[hn]=m.extend({},m.info.people_properties(),t[hn]),this._send_request(t,i)}),D.prototype.set_once=cn(function(n,e,i){var t=this.set_once_action(n,e);return m.isObject(n)&&(i=e),this._send_request(t,i)}),D.prototype.unset=cn(function(n,e){var i=this.unset_action(n);return this._send_request(i,e)}),D.prototype.increment=cn(function(n,e,i){var t={},o={};return m.isObject(n)?(m.each(n,function(s,r){if(!this._is_reserved_property(r))if(isNaN(parseFloat(s))){J.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else o[r]=s},this),i=e):(m.isUndefined(e)&&(e=1),o[n]=e),t[wn]=o,this._send_request(t,i)}),D.prototype.append=cn(function(n,e,i){m.isObject(n)&&(i=e);var t=this.append_action(n,e);return this._send_request(t,i)}),D.prototype.remove=cn(function(n,e,i){m.isObject(n)&&(i=e);var t=this.remove_action(n,e);return this._send_request(t,i)}),D.prototype.union=cn(function(n,e,i){m.isObject(n)&&(i=e);var t=this.union_action(n,e);return this._send_request(t,i)}),D.prototype.track_charge=cn(function(n,e,i){if(!m.isNumber(n)&&(n=parseFloat(n),isNaN(n))){J.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",m.extend({$amount:n},e),i)}),D.prototype.clear_charges=function(n){return this.set("$transactions",[],n)},D.prototype.delete_user=function(){if(!this._identify_called()){J.error("mixpanel.people.delete_user() requires you to call identify() first");return}var n={$delete:this._mixpanel.get_distinct_id()};return this._send_request(n)},D.prototype.toString=function(){return this._mixpanel.toString()+".people"},D.prototype._send_request=function(n,e){n.$token=this._get_config("token"),n.$distinct_id=this._mixpanel.get_distinct_id();var i=this._mixpanel.get_property("$device_id"),t=this._mixpanel.get_property("$user_id"),o=this._mixpanel.get_property("$had_persisted_distinct_id");i&&(n.$device_id=i),t&&(n.$user_id=t),o&&(n.$had_persisted_distinct_id=o);var s=m.encodeDates(n);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:s,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(n),m.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),m.truncate(s,255))},D.prototype._get_config=function(n){return this._mixpanel.get_config(n)},D.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},D.prototype._enqueue=function(n){hn in n?this._mixpanel.persistence._add_to_people_queue(hn,n):Hn in n?this._mixpanel.persistence._add_to_people_queue(Hn,n):Ke in n?this._mixpanel.persistence._add_to_people_queue(Ke,n):wn in n?this._mixpanel.persistence._add_to_people_queue(wn,n):Fe in n?this._mixpanel.persistence._add_to_people_queue(Fe,n):Ye in n?this._mixpanel.persistence._add_to_people_queue(Ye,n):Cn in n?this._mixpanel.persistence._add_to_people_queue(Cn,n):J.error("Invalid call to _enqueue():",n)},D.prototype._flush_one_queue=function(n,e,i,t){var o=this,s=m.extend({},this._mixpanel.persistence.load_queue(n)),r=s;!m.isUndefined(s)&&m.isObject(s)&&!m.isEmptyObject(s)&&(o._mixpanel.persistence._pop_from_people_queue(n,s),o._mixpanel.persistence.save(),t&&(r=t(s)),e.call(o,r,function(l,c){l===0&&o._mixpanel.persistence._add_to_people_queue(n,s),m.isUndefined(i)||i(l,c)}))},D.prototype._flush=function(n,e,i,t,o,s,r){var l=this;this._flush_one_queue(hn,this.set,n),this._flush_one_queue(Hn,this.set_once,t),this._flush_one_queue(Ke,this.unset,s,function(S){return m.keys(S)}),this._flush_one_queue(wn,this.increment,e),this._flush_one_queue(Cn,this.union,o);var c=this._mixpanel.persistence.load_queue(Fe);if(!m.isUndefined(c)&&m.isArray(c)&&c.length)for(var b,p=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(Fe,b),m.isUndefined(i)||i(S,M)},g=c.length-1;g>=0;g--)c=this._mixpanel.persistence.load_queue(Fe),b=c.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(b)||l.append(b,p);var f=this._mixpanel.persistence.load_queue(Ye);if(!m.isUndefined(f)&&m.isArray(f)&&f.length)for(var y,C=function(S,M){S===0&&l._mixpanel.persistence._add_to_people_queue(Ye,y),m.isUndefined(r)||r(S,M)},k=f.length-1;k>=0;k--)f=this._mixpanel.persistence.load_queue(Ye),y=f.pop(),l._mixpanel.persistence.save(),m.isEmptyObject(y)||l.remove(y,C)},D.prototype._is_reserved_property=function(n){return n==="$distinct_id"||n==="$token"||n==="$device_id"||n==="$user_id"||n==="$had_persisted_distinct_id"},D.prototype.set=D.prototype.set,D.prototype.set_once=D.prototype.set_once,D.prototype.unset=D.prototype.unset,D.prototype.increment=D.prototype.increment,D.prototype.append=D.prototype.append,D.prototype.remove=D.prototype.remove,D.prototype.union=D.prototype.union,D.prototype.track_charge=D.prototype.track_charge,D.prototype.clear_charges=D.prototype.clear_charges,D.prototype.delete_user=D.prototype.delete_user,D.prototype.toString=D.prototype.toString;var it="__mps",tt="__mpso",ot="__mpus",st="__mpa",at="__mpap",rt="__mpr",lt="__mpu",No="$people_distinct_id",Pi="__alias",Xn="__timers",_r=[it,tt,ot,st,at,rt,lt,No,Pi,Xn],j=function(n){this.props={},this.campaign_params_saved=!1,n.persistence_name?this.name="mp_"+n.persistence_name:this.name="mp_"+n.token+"_mixpanel";var e=n.persistence;e!=="cookie"&&e!=="localStorage"&&(J.critical("Unknown persistence type "+e+"; falling back to cookie"),e=n.persistence="cookie"),e==="localStorage"&&m.localStorage.is_supported()?this.storage=m.localStorage:this.storage=m.cookie,this.load(),this.update_config(n),this.upgrade(),this.save()};j.prototype.properties=function(){var n={};return this.load(),m.each(this.props,function(e,i){m.include(_r,i)||(n[i]=e)}),n},j.prototype.load=function(){if(!this.disabled){var n=this.storage.parse(this.name);n&&(this.props=m.extend({},n))}},j.prototype.upgrade=function(){var n,e;this.storage===m.localStorage?(n=m.cookie.parse(this.name),m.cookie.remove(this.name),m.cookie.remove(this.name,!0),n&&this.register_once(n)):this.storage===m.cookie&&(e=m.localStorage.parse(this.name),m.localStorage.remove(this.name),e&&this.register_once(e))},j.prototype.save=function(){this.disabled||this.storage.set(this.name,m.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},j.prototype.load_prop=function(n){return this.load(),this.props[n]},j.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},j.prototype.clear=function(){this.remove(),this.props={}},j.prototype.register_once=function(n,e,i){return m.isObject(n)?(typeof e>"u"&&(e="None"),this.expire_days=typeof i>"u"?this.default_expiry:i,this.load(),m.each(n,function(t,o){(!this.props.hasOwnProperty(o)||this.props[o]===e)&&(this.props[o]=t)},this),this.save(),!0):!1},j.prototype.register=function(n,e){return m.isObject(n)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),m.extend(this.props,n),this.save(),!0):!1},j.prototype.unregister=function(n){this.load(),n in this.props&&(delete this.props[n],this.save())},j.prototype.update_search_keyword=function(n){this.register(m.info.searchInfo(n))},j.prototype.update_referrer_info=function(n){this.register_once({$initial_referrer:n||"$direct",$initial_referring_domain:m.info.referringDomain(n)||"$direct"},"")},j.prototype.get_referrer_info=function(){return m.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},j.prototype.update_config=function(n){this.default_expiry=this.expire_days=n.cookie_expiration,this.set_disabled(n.disable_persistence),this.set_cookie_domain(n.cookie_domain),this.set_cross_site(n.cross_site_cookie),this.set_cross_subdomain(n.cross_subdomain_cookie),this.set_secure(n.secure_cookie)},j.prototype.set_disabled=function(n){this.disabled=n,this.disabled?this.remove():this.save()},j.prototype.set_cookie_domain=function(n){n!==this.cookie_domain&&(this.remove(),this.cookie_domain=n,this.save())},j.prototype.set_cross_site=function(n){n!==this.cross_site&&(this.cross_site=n,this.remove(),this.save())},j.prototype.set_cross_subdomain=function(n){n!==this.cross_subdomain&&(this.cross_subdomain=n,this.remove(),this.save())},j.prototype.get_cross_subdomain=function(){return this.cross_subdomain},j.prototype.set_secure=function(n){n!==this.secure&&(this.secure=!!n,this.remove(),this.save())},j.prototype._add_to_people_queue=function(n,e){var i=this._get_queue_key(n),t=e[n],o=this._get_or_create_queue(hn),s=this._get_or_create_queue(Hn),r=this._get_or_create_queue(Ke),l=this._get_or_create_queue(wn),c=this._get_or_create_queue(Cn),b=this._get_or_create_queue(Ye,[]),p=this._get_or_create_queue(Fe,[]);i===it?(m.extend(o,t),this._pop_from_people_queue(wn,t),this._pop_from_people_queue(Cn,t),this._pop_from_people_queue(Ke,t)):i===tt?(m.each(t,function(g,f){f in s||(s[f]=g)}),this._pop_from_people_queue(Ke,t)):i===ot?m.each(t,function(g){m.each([o,s,l,c],function(f){g in f&&delete f[g]}),m.each(p,function(f){g in f&&delete f[g]}),r[g]=!0}):i===st?(m.each(t,function(g,f){f in o?o[f]+=g:(f in l||(l[f]=0),l[f]+=g)},this),this._pop_from_people_queue(Ke,t)):i===lt?(m.each(t,function(g,f){m.isArray(g)&&(f in c||(c[f]=[]),c[f]=c[f].concat(g))}),this._pop_from_people_queue(Ke,t)):i===rt?(b.push(t),this._pop_from_people_queue(Fe,t)):i===at&&(p.push(t),this._pop_from_people_queue(Ke,t)),J.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),J.log(e),this.save()},j.prototype._pop_from_people_queue=function(n,e){var i=this.props[this._get_queue_key(n)];m.isUndefined(i)||m.each(e,function(t,o){n===Fe||n===Ye?m.each(i,function(s){s[o]===t&&delete s[o]}):delete i[o]},this)},j.prototype.load_queue=function(n){return this.load_prop(this._get_queue_key(n))},j.prototype._get_queue_key=function(n){if(n===hn)return it;if(n===Hn)return tt;if(n===Ke)return ot;if(n===wn)return st;if(n===Fe)return at;if(n===Ye)return rt;if(n===Cn)return lt;J.error("Invalid queue:",n)},j.prototype._get_or_create_queue=function(n,e){var i=this._get_queue_key(n);return e=m.isUndefined(e)?{}:e,this.props[i]||(this.props[i]=e)},j.prototype.set_event_timer=function(n,e){var i=this.load_prop(Xn)||{};i[n]=e,this.props[Xn]=i,this.save()},j.prototype.remove_event_timer=function(n){var e=this.load_prop(Xn)||{},i=e[n];return m.isUndefined(i)||(delete this.props[Xn][n],this.save()),i};var dt,Io=function(n,e){throw new Error(n+" not available in this build.")},we,Bo=0,Mr=1,Ar=function(n){return n},ei=function(){},Be="mixpanel",Ro="base64",xr="json",ct="$device:",Un=R.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Do=!Un&&ze.indexOf("MSIE")===-1&&ze.indexOf("Mozilla")===-1,Ni=null;ln.sendBeacon&&(Ni=function(){return ln.sendBeacon.apply(ln,arguments)});var Oo={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},Ho={api_host:"https://api-js.mixpanel.com",api_routes:Oo,api_method:"POST",api_transport:"XHR",api_payload_format:Ro,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:ei,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:ei,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:30*60*1e3,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:$n,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Uo=!1,x=function(){},ut=function(n,e,i){var t,o=i===Be?we:we[i];if(o&&dt===Bo)t=o;else{if(o&&!m.isArray(o)){J.error("You have already initialized "+i);return}t=new x}if(t._cached_groups={},t._init(n,e,i),t.people=new D,t.people._init(t),!t.get_config("skip_first_touch_marketing")){var s=m.info.campaignParams(null),r={},l=!1;m.each(s,function(c,b){r["initial_"+b]=c,c&&(l=!0)}),l&&t.people.set_once(r)}return Je.DEBUG=Je.DEBUG||t.get_config("debug"),!m.isUndefined(o)&&m.isArray(o)&&(t._execute_array.call(t.people,o.people),t._execute_array(o)),t};x.prototype.init=function(n,e,i){if(m.isUndefined(i)){this.report_error("You must name your new library: init(token, config, name)");return}if(i===Be){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var t=ut(n,e,i);return we[i]=t,t._loaded(),t},x.prototype._init=function(n,e,i){e=e||{},this.__loaded=!0,this.config={};var t={};if(!("api_payload_format"in e)){var o=e.api_host||Ho.api_host;o.match(/\.mixpanel\.com/)&&(t.api_payload_format=xr)}if(this.set_config(m.extend({},Ho,t,e,{name:i,token:n,callback_fn:(i===Be?i:Be+"."+i)+"._jsc"})),this._jsc=ei,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!m.localStorage.is_supported(!0)||!Un)this._batch_requests=!1,J.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),m.each(this.get_batcher_configs(),function(c){J.log("Clearing batch queue "+c.queue_key),m.localStorage.remove(c.queue_key)});else if(this.init_batchers(),Ni&&R.addEventListener){var s=m.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);R.addEventListener("pagehide",function(c){c.persisted&&s()}),R.addEventListener("visibilitychange",function(){X.visibilityState==="hidden"&&s()})}}this.persistence=this.cookie=new j(this.config),this.unpersisted_superprops={},this._gdpr_init();var r=m.UUID();this.get_distinct_id()||this.register_once({distinct_id:ct+r,$device_id:r},"");var l=this.get_config("track_pageview");l&&this._init_url_change_tracking(l),this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent")&&this.start_session_recording()},x.prototype.start_session_recording=dn(function(){if(!R.MutationObserver){J.critical("Browser does not support MutationObserver; skipping session recording");return}var n=m.bind(function(){this._recorder=this._recorder||new R.__mp_recorder(this),this._recorder.startRecording()},this);m.isUndefined(R.__mp_recorder)?Io(this.get_config("recorder_src"),n):n()}),x.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():J.critical("Session recorder module not loaded")},x.prototype.get_session_recording_properties=function(){var n={};if(this._recorder){var e=this._recorder.replayId;e&&(n.$mp_replay_id=e)}return n},x.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var n=m.info.campaignParams(null);m.each(n,(function(e,i){this.unregister(i)}).bind(this))}},x.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(X.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(m.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(X.referrer)},x.prototype._dom_loaded=function(){m.each(this.__dom_loaded_queue,function(n){this._track_dom.apply(this,n)},this),this.has_opted_out_tracking()||m.each(this.__request_queue,function(n){this._send_request.apply(this,n)},this),delete this.__dom_loaded_queue,delete this.__request_queue},x.prototype._track_dom=function(n,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!Uo)return this.__dom_loaded_queue.push([n,e]),!1;var i=new n().init(this);return i.track.apply(i,e)},x.prototype._init_url_change_tracking=function(n){var e="",i=this.track_pageview();if(i&&(e=m.info.currentUrl()),m.include(["full-url","url-with-path-and-query-string","url-with-path"],n)){R.addEventListener("popstate",function(){R.dispatchEvent(new Event("mp_locationchange"))}),R.addEventListener("hashchange",function(){R.dispatchEvent(new Event("mp_locationchange"))});var t=R.history.pushState;typeof t=="function"&&(R.history.pushState=function(s,r,l){t.call(R.history,s,r,l),R.dispatchEvent(new Event("mp_locationchange"))});var o=R.history.replaceState;typeof o=="function"&&(R.history.replaceState=function(s,r,l){o.call(R.history,s,r,l),R.dispatchEvent(new Event("mp_locationchange"))}),R.addEventListener("mp_locationchange",(function(){var s=m.info.currentUrl(),r=!1;if(n==="full-url"?r=s!==e:n==="url-with-path-and-query-string"?r=s.split("#")[0]!==e.split("#")[0]:n==="url-with-path"&&(r=s.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0]),r){var l=this.track_pageview();l&&(e=s)}}).bind(this))}},x.prototype._prepare_callback=function(n,e){if(m.isUndefined(n))return null;if(Un){var i=function(r){n(r,e)};return i}else{var t=this._jsc,o=""+Math.floor(Math.random()*1e8),s=this.get_config("callback_fn")+"["+o+"]";return t[o]=function(r){delete t[o],n(r,e)},s}},x.prototype._send_request=function(n,e,i,t){var o=!0;if(Do)return this.__request_queue.push(arguments),o;var s={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},r=null;!t&&(m.isFunction(i)||typeof i=="string")&&(t=i,i=null),i=m.extend(s,i||{}),Un||(i.method="GET");var l=i.method==="POST",c=Ni&&l&&i.transport.toLowerCase()==="sendbeacon",b=i.verbose;e.verbose&&(b=!0),this.get_config("test")&&(e.test=1),b&&(e.verbose=1),this.get_config("img")&&(e.img=1),Un||(t?e.callback=t:(b||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),l&&(r="data="+encodeURIComponent(e.data),delete e.data),n+="?"+m.HTTPBuildQuery(e);var p=this;if("img"in e){var g=X.createElement("img");g.src=n,X.body.appendChild(g)}else if(c){try{o=Ni(n,r)}catch(M){p.report_error(M),o=!1}try{t&&t(o?1:0)}catch(M){p.report_error(M)}}else if(Un)try{var f=new XMLHttpRequest;f.open(i.method,n,!0);var y=this.get_config("xhr_headers");if(l&&(y["Content-Type"]="application/x-www-form-urlencoded"),m.each(y,function(M,A){f.setRequestHeader(A,M)}),i.timeout_ms&&typeof f.timeout<"u"){f.timeout=i.timeout_ms;var C=new Date().getTime()}f.withCredentials=!0,f.onreadystatechange=function(){if(f.readyState===4)if(f.status===200){if(t)if(b){var M;try{M=m.JSONDecode(f.responseText)}catch(E){if(p.report_error(E),i.ignore_json_errors)M=f.responseText;else return}t(M)}else t(Number(f.responseText))}else{var A;if(f.timeout&&!f.status&&new Date().getTime()-C>=f.timeout?A="timeout":A="Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(A),t)if(b){var _=f.responseHeaders||{};t({status:0,httpStatusCode:f.status,error:A,retryAfter:_["Retry-After"]})}else t(0)}},f.send(r)}catch(M){p.report_error(M),o=!1}else{var k=X.createElement("script");k.type="text/javascript",k.async=!0,k.defer=!0,k.src=n;var S=X.getElementsByTagName("script")[0];S.parentNode.insertBefore(k,S)}return o},x.prototype._execute_array=function(n){var e,i=[],t=[],o=[];m.each(n,function(r){r&&(e=r[0],m.isArray(e)?o.push(r):typeof r=="function"?r.call(this):m.isArray(r)&&e==="alias"?i.push(r):m.isArray(r)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?o.push(r):t.push(r))},this);var s=function(r,l){m.each(r,function(c){if(m.isArray(c[0])){var b=l;m.each(c,function(p){b=b[p[0]].apply(b,p.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};s(i,this),s(t,this),s(o,this)},x.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},x.prototype.get_batcher_configs=function(){var n="__mpq_"+this.get_config("token"),e=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+e.track,queue_key:n+"_ev"},people:{type:"people",endpoint:"/"+e.engage,queue_key:n+"_pp"},groups:{type:"groups",endpoint:"/"+e.groups,queue_key:n+"_gr"}},this._batcher_configs},x.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var n=m.bind(function(i){return new He(i.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:m.bind(function(t,o,s){this._send_request(this.get_config("api_host")+i.endpoint,this._encode_data_for_request(t),o,this._prepare_callback(s,t))},this),beforeSendHook:m.bind(function(t){return this._run_hook("before_send_"+i.type,t)},this),stopAllBatchingFunc:m.bind(this.stop_batch_senders,this),usePersistence:!0})},this),e=this.get_batcher_configs();this.request_batchers={events:n(e.events),people:n(e.people),groups:n(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},x.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,m.each(this.request_batchers,function(n){n.start()}))},x.prototype.stop_batch_senders=function(){this._batch_requests=!1,m.each(this.request_batchers,function(n){n.stop(),n.clear()})},x.prototype.push=function(n){this._execute_array([n])},x.prototype.disable=function(n){typeof n>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(n)},x.prototype._encode_data_for_request=function(n){var e=m.JSONEncode(n);return this.get_config("api_payload_format")===Ro&&(e=m.base64Encode(e)),{data:e}},x.prototype._track_or_batch=function(n,e){var i=m.truncate(n.data,255),t=n.endpoint,o=n.batcher,s=n.should_send_immediately,r=n.send_request_options||{};e=e||ei;var l=!0,c=m.bind(function(){return r.skip_hooks||(i=this._run_hook("before_send_"+n.type,i)),i?(J.log("MIXPANEL REQUEST:"),J.log(i),this._send_request(t,this._encode_data_for_request(i),r,this._prepare_callback(e,i))):null},this);return this._batch_requests&&!s?o.enqueue(i,function(b){b?e(1,i):c()}):l=c(),l&&i},x.prototype.track=dn(function(n,e,i,t){!t&&typeof i=="function"&&(t=i,i=null),i=i||{};var o=i.transport;o&&(i.transport=o);var s=i.send_immediately;if(typeof t!="function"&&(t=ei),m.isUndefined(n)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(n)){t(0);return}e=m.extend({},e),e.token=this.get_config("token");var r=this.persistence.remove_event_timer(n);if(!m.isUndefined(r)){var l=new Date().getTime()-r;e.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?m.info.marketingParams():{};e=m.extend({},m.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var b=this.get_config("property_blacklist");m.isArray(b)?m.each(b,function(f){delete e[f]}):this.report_error("Invalid value for property_blacklist config: "+b);var p={event:n,properties:e},g=this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:s,send_request_options:i},t);return g}),x.prototype.set_group=dn(function(n,e,i){m.isArray(e)||(e=[e]);var t={};return t[n]=e,this.register(t),this.people.set(n,e,i)}),x.prototype.add_group=dn(function(n,e,i){var t=this.get_property(n),o={};return t===void 0?(o[n]=[e],this.register(o)):t.indexOf(e)===-1&&(t.push(e),o[n]=t,this.register(o)),this.people.union(n,e,i)}),x.prototype.remove_group=dn(function(n,e,i){var t=this.get_property(n);if(t!==void 0){var o=t.indexOf(e);o>-1&&(t.splice(o,1),this.register({group_key:t})),t.length===0&&this.unregister(n)}return this.people.remove(n,e,i)}),x.prototype.track_with_groups=dn(function(n,e,i,t){var o=m.extend({},e||{});return m.each(i,function(s,r){s!=null&&(o[r]=s)}),this.track(n,o,t)}),x.prototype._create_map_key=function(n,e){return n+"_"+JSON.stringify(e)},x.prototype._remove_group_from_cache=function(n,e){delete this._cached_groups[this._create_map_key(n,e)]},x.prototype.get_group=function(n,e){var i=this._create_map_key(n,e),t=this._cached_groups[i];return(t===void 0||t._group_key!==n||t._group_id!==e)&&(t=new ie,t._init(this,n,e),this._cached_groups[i]=t),t},x.prototype.track_pageview=dn(function(n,e){typeof n!="object"&&(n={}),e=e||{};var i=e.event_name||"$mp_web_page_view",t=m.extend(m.info.mpPageViewProperties(),m.info.campaignParams(),m.info.clickParams()),o=m.extend({},t,n);return this.track(i,o)}),x.prototype.track_links=function(){return this._track_dom.call(this,On,arguments)},x.prototype.track_forms=function(){return this._track_dom.call(this,Ei,arguments)},x.prototype.time_event=function(n){if(m.isUndefined(n)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(n)||this.persistence.set_event_timer(n,new Date().getTime())};var Lr={persistent:!0},ht=function(n){var e;return m.isObject(n)?e=n:m.isUndefined(n)?e={}:e={days:n},m.extend({},Lr,e)};x.prototype.register=function(n,e){var i=ht(e);i.persistent?this.persistence.register(n,i.days):m.extend(this.unpersisted_superprops,n)},x.prototype.register_once=function(n,e,i){var t=ht(i);t.persistent?this.persistence.register_once(n,e,t.days):(typeof e>"u"&&(e="None"),m.each(n,function(o,s){(!this.unpersisted_superprops.hasOwnProperty(s)||this.unpersisted_superprops[s]===e)&&(this.unpersisted_superprops[s]=o)},this))},x.prototype.unregister=function(n,e){e=ht(e),e.persistent?this.persistence.unregister(n):delete this.unpersisted_superprops[n]},x.prototype._register_single=function(n,e){var i={};i[n]=e,this.register(i)},x.prototype.identify=function(n,e,i,t,o,s,r,l){var c=this.get_distinct_id();if(n&&c!==n){if(typeof n=="string"&&n.indexOf(ct)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:n})}if(!this.get_property("$device_id")){var b=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:b},"")}n!==c&&n!==this.get_property(Pi)&&(this.unregister(Pi),this.register({distinct_id:n})),this._flags.identify_called=!0,this.people._flush(e,i,t,o,s,r,l),n!==c&&this.track("$identify",{distinct_id:n,$anon_distinct_id:c},{skip_hooks:!0})},x.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var n=m.UUID();this.register_once({distinct_id:ct+n,$device_id:n},"")},x.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},x.prototype.alias=function(n,e){if(n===this.get_property(No))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var i=this;return m.isUndefined(e)&&(e=this.get_distinct_id()),n!==e?(this._register_single(Pi,n),this.track("$create_alias",{alias:n,distinct_id:e},{skip_hooks:!0},function(){i.identify(n)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(n),-1)},x.prototype.name_tag=function(n){this._register_single("mp_name_tag",n)},x.prototype.set_config=function(n){if(m.isObject(n)){m.extend(this.config,n);var e=n.batch_size;e&&m.each(this.request_batchers,function(i){i.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),Je.DEBUG=Je.DEBUG||this.get_config("debug")}},x.prototype.get_config=function(n){return this.config[n]},x.prototype._run_hook=function(n){var e=(this.config.hooks[n]||Ar).apply(this,rn.call(arguments,1));return typeof e>"u"&&(this.report_error(n+" hook did not return a value"),e=null),e},x.prototype.get_property=function(n){return this.persistence.load_prop([n])},x.prototype.toString=function(){var n=this.get_config("name");return n!==Be&&(n=Be+"."+n),n},x.prototype._event_is_disabled=function(n){return m.isBlockedUA(ze)||this._flags.disable_all_events||m.include(this.__disabled_events,n)},x.prototype._gdpr_init=function(){var n=this.get_config("opt_out_tracking_persistence_type")==="localStorage";n&&m.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||m.cookie.get("mp_optout"))&&(m.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},x.prototype._gdpr_update_persistence=function(n){var e;if(n&&n.clear_persistence)e=!0;else if(n&&n.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},x.prototype._gdpr_call_func=function(n,e){return e=m.extend({track:m.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),m.localStorage.is_supported()||(e.persistence_type="cookie"),n(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})},x.prototype.opt_in_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(mr,n),this._gdpr_update_persistence(n)},x.prototype.opt_out_tracking=function(n){n=m.extend({clear_persistence:!0,delete_user:!0},n),n.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(pr,n),this._gdpr_update_persistence(n)},x.prototype.has_opted_in_tracking=function(n){return this._gdpr_call_func(br,n)},x.prototype.has_opted_out_tracking=function(n){return this._gdpr_call_func(So,n)},x.prototype.clear_opt_in_out_tracking=function(n){n=m.extend({enable_persistence:!0},n),this._gdpr_call_func(vr,n),this._gdpr_update_persistence(n)},x.prototype.report_error=function(n,e){J.error.apply(J.error,arguments);try{!e&&!(n instanceof Error)&&(n=new Error(n)),this.get_config("error_reporter")(n,e)}catch(i){J.error(i)}},x.prototype.init=x.prototype.init,x.prototype.reset=x.prototype.reset,x.prototype.disable=x.prototype.disable,x.prototype.time_event=x.prototype.time_event,x.prototype.track=x.prototype.track,x.prototype.track_links=x.prototype.track_links,x.prototype.track_forms=x.prototype.track_forms,x.prototype.track_pageview=x.prototype.track_pageview,x.prototype.register=x.prototype.register,x.prototype.register_once=x.prototype.register_once,x.prototype.unregister=x.prototype.unregister,x.prototype.identify=x.prototype.identify,x.prototype.alias=x.prototype.alias,x.prototype.name_tag=x.prototype.name_tag,x.prototype.set_config=x.prototype.set_config,x.prototype.get_config=x.prototype.get_config,x.prototype.get_property=x.prototype.get_property,x.prototype.get_distinct_id=x.prototype.get_distinct_id,x.prototype.toString=x.prototype.toString,x.prototype.opt_out_tracking=x.prototype.opt_out_tracking,x.prototype.opt_in_tracking=x.prototype.opt_in_tracking,x.prototype.has_opted_out_tracking=x.prototype.has_opted_out_tracking,x.prototype.has_opted_in_tracking=x.prototype.has_opted_in_tracking,x.prototype.clear_opt_in_out_tracking=x.prototype.clear_opt_in_out_tracking,x.prototype.get_group=x.prototype.get_group,x.prototype.set_group=x.prototype.set_group,x.prototype.add_group=x.prototype.add_group,x.prototype.remove_group=x.prototype.remove_group,x.prototype.track_with_groups=x.prototype.track_with_groups,x.prototype.start_batch_senders=x.prototype.start_batch_senders,x.prototype.stop_batch_senders=x.prototype.stop_batch_senders,x.prototype.start_session_recording=x.prototype.start_session_recording,x.prototype.stop_session_recording=x.prototype.stop_session_recording,x.prototype.get_session_recording_properties=x.prototype.get_session_recording_properties,x.prototype.DEFAULT_API_ROUTES=Oo,j.prototype.properties=j.prototype.properties,j.prototype.update_search_keyword=j.prototype.update_search_keyword,j.prototype.update_referrer_info=j.prototype.update_referrer_info,j.prototype.get_cross_subdomain=j.prototype.get_cross_subdomain,j.prototype.clear=j.prototype.clear;var Kn={},Tr=function(){m.each(Kn,function(n,e){e!==Be&&(we[e]=n)}),we._=m},Er=function(){we.init=function(n,e,i){if(i)return we[i]||(we[i]=Kn[i]=ut(n,e,i),we[i]._loaded()),we[i];var t=we;Kn[Be]?t=Kn[Be]:n&&(t=ut(n,e,Be),t._loaded(),Kn[Be]=t),we=t,dt===Mr&&(R[Be]=we),Tr()}},Pr=function(){function n(){n.done||(n.done=!0,Uo=!0,Do=!1,m.each(Kn,function(t){t._dom_loaded()}))}function e(){try{X.documentElement.doScroll("left")}catch{setTimeout(e,1);return}n()}if(X.addEventListener)X.readyState==="complete"?n():X.addEventListener("DOMContentLoaded",n,!1);else if(X.attachEvent){X.attachEvent("onreadystatechange",n);var i=!1;try{i=R.frameElement===null}catch{}X.documentElement.doScroll&&i&&e()}m.register_event(R,"load",n,!0)};function Nr(n){return Io=n,dt=Bo,we=new x,Er(),we.init(),Pr(),we}function Ir(n,e){e()}var P=Nr(Ir);const Ko=`<div id="checkoutConfirmationEnd">
761
767
  <div class="w-full">
762
768
  <div id="otp-content" class=" grid gap-4">
763
769
  <h5 class="text-black" id="otp-message">
@@ -785,11 +791,11 @@ or you can use record.mirror to access the mirror instance during recording.`;le
785
791
  </div>
786
792
  </div>
787
793
  </div>
788
- </div>`;class Ko{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector("#goback-to-merchant");e&&e.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Uo}}class Br{constructor({amount:e,container:i,email:t,encryption:o,planId:s,token:r,currency:l,rdtCode:c,url:b,reference:p,onSuccess:g,callBackUrl:f,metadata:y,localCurrency:C,hidePaymentMethods:k,showPaymentMethods:S,onClose:M,restartTransactionProcess:A,retryingPayment:_}){h(this,"contents");h(this,"cardDetailForm");h(this,"cardOtpValidationForm");h(this,"merchantPlanDetail",{});h(this,"cardPinForm");h(this,"avsForm");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"onSuccess");h(this,"planId","");h(this,"email");h(this,"token");h(this,"amount");h(this,"encryption");h(this,"currency");h(this,"_currentStep");h(this,"activeRef");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"onClose");h(this,"cardResponse");h(this,"cardResponseHeader");h(this,"confirmationEnd");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.currency=l,this.onSuccess=g||(()=>null),this.container=i,this.encryption=o,this.token=r,this.email=t,this.planId=s,this.amount=e,this.rdtCode=c,this.url=b,this.reference=p,this.callBackUrl=f,this.metadata=y,this.localCurrency=C,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=k,this.showPaymentMethods=S,this.onClose=M,this.restartTransactionProcess=A,this.retryingPayment=_,this.isMaxRetriesReached=!1,this.renderCardContent(),P.track("card_opens",{payment_method:"Card"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderCardContent()}async submitCardDetails(e,i){e.preventDefault(),P.track("input_cardDetails",{payment_method:"Card",authentication_type:"PIN"});const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#details-form-button-text"),s=await Ns(JSON.stringify(i),this.encryption);t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{if(this.retryingPayment){const l={channel:"card",reference:this.reference,encryptedCard:s};return si(this.token,l,this.rdtCode,this.url)}else{const l={amount:this.amount,channel:"card",currency:this.currency||"USD",planId:this.planId,customer:{email:this.email},reference:this.reference,encryptedCard:s,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return fs(this.token,l,this.rdtCode,this.url)}})().then(({data:l,headers:c})=>{var b,p,g,f,y,C;if(l.status==="failed")this.currentStep=4,this.reference=l.reference,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.cardResponse=l,this.cardResponseHeader=c,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(!["success","successful"].includes(l.status)&&l.status!=="failed")if(this.cardResponse=l,this.cardResponseHeader=c,l!=null&&l.authorization){if(this.activeRef=l.reference,((b=l==null?void 0:l.authorization)==null?void 0:b.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="3DS"){(g=l==null?void 0:l.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((f=l==null?void 0:l.authorization)==null?void 0:f.redirectUrl);return}if(((y=l==null?void 0:l.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="avs"){this.currentStep=7;return}}else this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Error with Payment");else["success","successful"].includes(l.status)&&(this.currentStep=5,this.cardResponse=l,this.cardResponseHeader=c,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(l,c,"success"))}).catch(l=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),l.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=4,l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue())}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}handlePinRequest(e){if(e.length===4){const i={authorization:{pin:e},reference:this.activeRef};P.track("input_cardPin",{payment_method:"Card",authentication_type:"PIN"}),setTimeout(()=>{const t=this.container.querySelector("#pin-loader"),o=this.container.querySelector("#cancel-payment");t&&(t.innerHTML=`<svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
794
+ </div>`;class jo{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector("#goback-to-merchant");e&&e.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Ko}}class Br{constructor({amount:e,container:i,email:t,encryption:o,planId:s,token:r,currency:l,rdtCode:c,url:b,reference:p,onSuccess:g,callBackUrl:f,metadata:y,localCurrency:C,hidePaymentMethods:k,showPaymentMethods:S,onClose:M,restartTransactionProcess:A,retryingPayment:_}){h(this,"contents");h(this,"cardDetailForm");h(this,"cardOtpValidationForm");h(this,"merchantPlanDetail",{});h(this,"cardPinForm");h(this,"avsForm");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"onSuccess");h(this,"planId","");h(this,"email");h(this,"token");h(this,"amount");h(this,"encryption");h(this,"currency");h(this,"_currentStep");h(this,"activeRef");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"onClose");h(this,"cardResponse");h(this,"cardResponseHeader");h(this,"confirmationEnd");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.currency=l,this.onSuccess=g||(()=>null),this.container=i,this.encryption=o,this.token=r,this.email=t,this.planId=s,this.amount=e,this.rdtCode=c,this.url=b,this.reference=p,this.callBackUrl=f,this.metadata=y,this.localCurrency=C,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.cardResponse={},this.cardResponseHeader={},this.hidePaymentMethods=k,this.showPaymentMethods=S,this.onClose=M,this.restartTransactionProcess=A,this.retryingPayment=_,this.isMaxRetriesReached=!1,this.renderCardContent(),P.track("card_opens",{payment_method:"Card"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderCardContent()}async submitCardDetails(e,i){e.preventDefault(),P.track("input_cardDetails",{payment_method:"Card",authentication_type:"PIN"});const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#details-form-button-text"),s=await Ns(JSON.stringify(i),this.encryption);t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{if(this.retryingPayment){const l={channel:"card",reference:this.reference,encryptedCard:s};return si(this.token,l,this.rdtCode,this.url)}else{const l={amount:this.amount,channel:"card",currency:this.currency||"USD",planId:this.planId,customer:{email:this.email},reference:this.reference,encryptedCard:s,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return gs(this.token,l,this.rdtCode,this.url)}})().then(({data:l,headers:c})=>{var b,p,g,f,y,C;if(l.status==="failed")this.currentStep=4,this.reference=l.reference,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.cardResponse=l,this.cardResponseHeader=c,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(!["success","successful"].includes(l.status)&&l.status!=="failed")if(this.cardResponse=l,this.cardResponseHeader=c,l!=null&&l.authorization){if(this.activeRef=l.reference,((b=l==null?void 0:l.authorization)==null?void 0:b.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="3DS"){(g=l==null?void 0:l.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((f=l==null?void 0:l.authorization)==null?void 0:f.redirectUrl);return}if(((y=l==null?void 0:l.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}if(((C=l==null?void 0:l.authorization)==null?void 0:C.mode)==="avs"){this.currentStep=7;return}}else this.currentStep=4,l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Error with Payment");else["success","successful"].includes(l.status)&&(this.currentStep=5,this.cardResponse=l,this.cardResponseHeader=c,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"}),this.redirectTo(l,c,"success"))}).catch(l=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),l.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=4,l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue())}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}handlePinRequest(e){if(e.length===4){const i={authorization:{pin:e},reference:this.activeRef};P.track("input_cardPin",{payment_method:"Card",authentication_type:"PIN"}),setTimeout(()=>{const t=this.container.querySelector("#pin-loader"),o=this.container.querySelector("#cancel-payment");t&&(t.innerHTML=`<svg class="animate-spin" width="40" height="40" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
789
795
  <path
790
796
  d="M62 32C62 38.6156 59.8132 45.0457 55.78 50.2897C51.7468 55.5336 46.0932 59.2974 39.6992 60.9952C33.3052 62.693 26.5293 62.2297 20.4258 59.6774C14.3224 57.1251 9.2338 52.6268 5.95186 46.8827C2.66993 41.1385 1.37873 34.4707 2.2792 27.9166C3.17967 21.3626 6.22129 15.29 10.9308 10.6438C15.6402 5.9976 21.7534 3.0384 28.3191 2.22668C34.8847 1.41496 41.5345 2.79623 47.2337 6.15557"
791
797
  stroke="black" stroke-width="4" stroke-linejoin="round" />
792
- </svg>`),o&&o.classList.add("hidden"),oi(this.token,i,this.rdtCode,this.url).then(({data:r,headers:l})=>{var c,b,p,g,f;if(r.status==="failed")P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,r.providerMessage?this.warningScreen.setPaymentError(r.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(r.status))this.currentStep=5,this.redirectTo(r,l,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((c=r==null?void 0:r.authorization)==null?void 0:c.mode)==="3DS"){(b=r==null?void 0:r.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((p=r==null?void 0:r.authorization)==null?void 0:p.redirectUrl);return}if(((g=r==null?void 0:r.authorization)==null?void 0:g.mode)==="otp"){this.cardResponse=r,this.currentStep=3;return}if(((f=r==null?void 0:r.authorization)==null?void 0:f.mode)==="avs"){this.currentStep=7;return}}}).catch(r=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),this.currentStep=4,r.message?this.warningScreen.setPaymentError(r.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})},300)}}showLoader(){this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader()}pinErrorStates(e,i,t){const o=this.container.querySelector("#pin-error");o&&(o.innerHTML=e||"Payment Failed"),t&&t.classList.remove("hidden"),i&&(i.innerHTML="")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text"),t=this.container.querySelector(".warning-list");i&&(i.textContent=e),t&&[{text:"Try again with your card",action:"go-to-card"},{text:"Try again with transfer",action:"go-to-transfer"}].forEach(({action:s,text:r})=>{const l=document.createElement("button");l.textContent=r,l.setAttribute("id",s),l.classList.add("warning-button");const c=document.createElement("div");c.appendChild(l),t.appendChild(c)})}validatedAVS(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#avs-form-button-text"),s={authorization:{avs:{state:i==null?void 0:i.state,city:i==null?void 0:i.city,country:i==null?void 0:i.country,address:i==null?void 0:i.address,zipCode:(i==null?void 0:i.code)||"-"}},reference:this.activeRef};P.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),oi(this.token,s,this.rdtCode,this.url).then(({data:l,headers:c})=>{var b,p,g,f,y;if(l.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,c,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((b=l==null?void 0:l.authorization)==null?void 0:b.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="3DS"){(g=l==null?void 0:l.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((f=l==null?void 0:l.authorization)==null?void 0:f.redirectUrl),this.currentStep=6;return}if(((y=l==null?void 0:l.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}}}).catch(l=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}submitOtp(e,i){e.preventDefault();const t={authorization:{otp:i},reference:this.activeRef};this.currentStep=6,this.showLoader(),P.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),oi(this.token,t,this.rdtCode,this.url).then(({data:s,headers:r})=>{var l,c,b,p,g,f;if(s.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.providerMessage?this.warningScreen.setPaymentError(s.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(s.status))["success","successful"].includes(s.status)&&(this.currentStep=5,this.redirectTo(s,r,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=s.reference,((l=s==null?void 0:s.authorization)==null?void 0:l.mode)==="pin"){this.currentStep=2;return}if(((c=s==null?void 0:s.authorization)==null?void 0:c.mode)==="3DS"){(b=s==null?void 0:s.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((p=s==null?void 0:s.authorization)==null?void 0:p.redirectUrl);return}if(((g=s==null?void 0:s.authorization)==null?void 0:g.mode)==="otp"){this.cardResponse=s,this.currentStep=3;return}if(((f=s==null?void 0:s.authorization)==null?void 0:f.mode)==="avs"){this.currentStep=7;return}this.currentStep=9}}).catch(s=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.message?this.warningScreen.setPaymentError(s.message):this.warningScreen.setPaymentError("Payment failed")})}redirectTo3DS(e){const i=window.open(e,"_blank");if(i){P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPayment(({data:o,headers:s})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(o,s,"success")},({data:o})=>{this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert("Please enable popups for this site to complete the authentication.")}async verifyPayment(e,i){try{const t=await vn(this.token,this.activeRef,void 0,this.rdtCode,this.url);t.data.status==="failed"?i(t):["success","successful"].includes(t.data.status)&&e(t)}catch{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}goBackToMerchant(){this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var t,o;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Tt({container:this.contents,onAction:r=>l=>this.submitCardDetails.bind(this)(r,l),merchantName:this.merchantPlanDetail.merchantName}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new Os({container:this.contents,onClose:this.onClose,onAction:r=>this.handlePinRequest.bind(this)(r)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new Rs({container:this.contents,onClose:this.onClose,onAction:r=>l=>this.submitOtp.bind(this)(r,l),otpMessage:((t=this.cardResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new fn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Vn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(o=this.merchantPlanDetail)==null?void 0:o.rate.rate}),this.successScreen.renderComponent();break;case 6:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new Ks({container:this.contents,onAction:r=>l=>this.validatedAVS.bind(this)(r,l)}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var r;this.currentStep=4,this.warningScreen.setPaymentError(((r=this.cardResponse)==null?void 0:r.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"card",callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;case 9:this.confirmationEnd=new Ko({container:this.contents,onAction:r=>{this.currentStep=r},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.confirmationEnd.renderComponent();break;default:this.cardDetailForm=new Tt({container:this.contents,onAction:r=>l=>this.submitCardDetails.bind(this)(r,l),merchantName:this.merchantPlanDetail.merchantName}),this.cardDetailForm.renderContent();break}this.displayButtonText();const s=this.container.querySelector("#card-currency");s&&(s.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800):t==="success"&&this.onSuccess(e)}displayButtonText(e){var t,o,s,r;const i=this.container.querySelector("#details-form-button-text");if(i){const l=this.currency,c=l==="USD"?(o=(t=this.merchantPlanDetail)==null?void 0:t.rate)==null?void 0:o.from:l;e?i.textContent=e:i.textContent=`Continue to pay ${c} ${ke((this.amount||0)*(l==="USD"?(r=(s=this.merchantPlanDetail)==null?void 0:s.rate)==null?void 0:r.rate:1),2)}`}}}const Rr=`<div>
798
+ </svg>`),o&&o.classList.add("hidden"),oi(this.token,i,this.rdtCode,this.url).then(({data:r,headers:l})=>{var c,b,p,g,f;if(r.status==="failed")P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN"}),this.currentStep=4,r.providerMessage?this.warningScreen.setPaymentError(r.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(r.status))this.currentStep=5,this.redirectTo(r,l,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN"});else{if(((c=r==null?void 0:r.authorization)==null?void 0:c.mode)==="3DS"){(b=r==null?void 0:r.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((p=r==null?void 0:r.authorization)==null?void 0:p.redirectUrl);return}if(((g=r==null?void 0:r.authorization)==null?void 0:g.mode)==="otp"){this.cardResponse=r,this.currentStep=3;return}if(((f=r==null?void 0:r.authorization)==null?void 0:f.mode)==="avs"){this.currentStep=7;return}}}).catch(r=>{P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"PIN"}),this.currentStep=4,r.message?this.warningScreen.setPaymentError(r.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()})},300)}}showLoader(){this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader()}pinErrorStates(e,i,t){const o=this.container.querySelector("#pin-error");o&&(o.innerHTML=e||"Payment Failed"),t&&t.classList.remove("hidden"),i&&(i.innerHTML="")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text"),t=this.container.querySelector(".warning-list");i&&(i.textContent=e),t&&[{text:"Try again with your card",action:"go-to-card"},{text:"Try again with transfer",action:"go-to-transfer"}].forEach(({action:s,text:r})=>{const l=document.createElement("button");l.textContent=r,l.setAttribute("id",s),l.classList.add("warning-button");const c=document.createElement("div");c.appendChild(l),t.appendChild(c)})}validatedAVS(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#avs-form-button-text"),s={authorization:{avs:{state:i==null?void 0:i.state,city:i==null?void 0:i.city,country:i==null?void 0:i.country,address:i==null?void 0:i.address,zipCode:(i==null?void 0:i.code)||"-"}},reference:this.activeRef};P.track("input_address",{payment_method:"Card",authentication_type:"AVS"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),oi(this.token,s,this.rdtCode,this.url).then(({data:l,headers:c})=>{var b,p,g,f,y;if(l.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"AVS"}),l.providerMessage?this.warningScreen.setPaymentError(l.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(l.status))["success","successful"].includes(l.status)&&(this.currentStep=5,this.redirectTo(l,c,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"AVS"}));else{if(((b=l==null?void 0:l.authorization)==null?void 0:b.mode)==="pin"){this.currentStep=2;return}if(((p=l==null?void 0:l.authorization)==null?void 0:p.mode)==="3DS"){(g=l==null?void 0:l.authorization)!=null&&g.redirectUrl&&this.redirectTo3DS((f=l==null?void 0:l.authorization)==null?void 0:f.redirectUrl),this.currentStep=6;return}if(((y=l==null?void 0:l.authorization)==null?void 0:y.mode)==="otp"){this.cardResponse=l,this.currentStep=3;return}}}).catch(l=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"AVS"}),l.message?this.warningScreen.setPaymentError(l.message):this.warningScreen.setPaymentError("Payment failed"),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}submitOtp(e,i){e.preventDefault();const t={authorization:{otp:i},reference:this.activeRef};this.currentStep=6,this.showLoader(),P.track("input_cardOTP",{payment_method:"Card",authentication_type:"PIN+0TP"}),oi(this.token,t,this.rdtCode,this.url).then(({data:s,headers:r})=>{var l,c,b,p,g,f;if(s.status==="failed")this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.providerMessage?this.warningScreen.setPaymentError(s.providerMessage):this.warningScreen.setPaymentError("Payment failed");else if(["success","successful","failed"].includes(s.status))["success","successful"].includes(s.status)&&(this.currentStep=5,this.redirectTo(s,r,"success"),P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"PIN+0TP"}));else{if(this.activeRef=s.reference,((l=s==null?void 0:s.authorization)==null?void 0:l.mode)==="pin"){this.currentStep=2;return}if(((c=s==null?void 0:s.authorization)==null?void 0:c.mode)==="3DS"){(b=s==null?void 0:s.authorization)!=null&&b.redirectUrl&&this.redirectTo3DS((p=s==null?void 0:s.authorization)==null?void 0:p.redirectUrl);return}if(((g=s==null?void 0:s.authorization)==null?void 0:g.mode)==="otp"){this.cardResponse=s,this.currentStep=3;return}if(((f=s==null?void 0:s.authorization)==null?void 0:f.mode)==="avs"){this.currentStep=7;return}this.currentStep=9}}).catch(s=>{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"PIN+0TP"}),s.message?this.warningScreen.setPaymentError(s.message):this.warningScreen.setPaymentError("Payment failed")})}redirectTo3DS(e){const i=window.open(e,"_blank");if(i){P.track("auth_redirect",{payment_method:"Card",authentication_type:"3DS"}),this.currentStep=6,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPayment(({data:o,headers:s})=>{this.currentStep=5,P.track("verify_payment",{payment_method:"Card",verification_status:"Success",authentication_type:"3DS"}),this.redirectTo(o,s,"success")},({data:o})=>{this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment transaction failed"),P.track("verify_payment",{payment_method:"Card",verification_status:"Failed",authentication_type:"3DS"})}))},2e3)}else alert("Please enable popups for this site to complete the authentication.")}async verifyPayment(e,i){try{const t=await vn(this.token,this.activeRef,void 0,this.rdtCode,this.url);t.data.status==="failed"?i(t):["success","successful"].includes(t.data.status)&&e(t)}catch{this.currentStep=4,P.track("verify_payment",{payment_method:"Card",verification_status:"Null",authentication_type:"3DS"}),this.warningScreen.setPaymentError("Payment transaction failed"),this.warningScreen.hideReportIssue()}}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.cardResponse=e.data,this.cardResponseHeader=e.headers}catch{this.currentStep=4}}goBackToMerchant(){this.redirectTo(this.cardResponse,this.cardResponseHeader,this.callBackUrl)}renderCardContent(e){var t,o;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.cardDetailForm=new Et({container:this.contents,onAction:r=>l=>this.submitCardDetails.bind(this)(r,l),merchantName:this.merchantPlanDetail.merchantName}),this.cardDetailForm.renderContent();break;case 2:this.cardPinForm=new Os({container:this.contents,onClose:this.onClose,onAction:r=>this.handlePinRequest.bind(this)(r)}),this.cardPinForm.renderComponent();break;case 3:this.cardOtpValidationForm=new Rs({container:this.contents,onClose:this.onClose,onAction:r=>l=>this.submitOtp.bind(this)(r,l),otpMessage:((t=this.cardResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.cardOtpValidationForm.renderComponent();break;case 4:this.warningScreen=new fn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=8}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.successScreen=new Vn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(o=this.merchantPlanDetail)==null?void 0:o.rate.rate}),this.successScreen.renderComponent();break;case 6:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 7:this.avsForm=new Ks({container:this.contents,onAction:r=>l=>this.validatedAVS.bind(this)(r,l)}),this.avsForm.renderComponent();break;case 8:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var r;this.currentStep=4,this.warningScreen.setPaymentError(((r=this.cardResponse)==null?void 0:r.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"card",callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;case 9:this.confirmationEnd=new jo({container:this.contents,onAction:r=>{this.currentStep=r},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.cardResponse,paymentResponseHeaders:this.cardResponseHeader}),this.confirmationEnd.renderComponent();break;default:this.cardDetailForm=new Et({container:this.contents,onAction:r=>l=>this.submitCardDetails.bind(this)(r,l),merchantName:this.merchantPlanDetail.merchantName}),this.cardDetailForm.renderContent();break}this.displayButtonText();const s=this.container.querySelector("#card-currency");s&&(s.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800):t==="success"&&this.onSuccess(e)}displayButtonText(e){var t,o,s,r;const i=this.container.querySelector("#details-form-button-text");if(i){const l=this.currency,c=l==="USD"?(o=(t=this.merchantPlanDetail)==null?void 0:t.rate)==null?void 0:o.from:l;e?i.textContent=e:i.textContent=`Continue to pay ${c} ${ke((this.amount||0)*(l==="USD"?(r=(s=this.merchantPlanDetail)==null?void 0:s.rate)==null?void 0:r.rate:1),2)}`}}}const Rr=`<div>
793
799
  <div class="container-center h-[40vh] hidden" id="loader">
794
800
  <img src="" alt="loader gif" />
795
801
  </div>
@@ -880,14 +886,14 @@ or you can use record.mirror to access the mirror instance during recording.`;le
880
886
  </div>
881
887
  </div>
882
888
  </div>
883
- </div>`;function Dr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var jo={exports:{}};/*!
889
+ </div>`;function Dr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Vo={exports:{}};/*!
884
890
  * Pusher JavaScript Library v8.4.0
885
891
  * https://pusher.com/
886
892
  *
887
893
  * Copyright 2020, Pusher
888
894
  * Released under the MIT licence.
889
- */(function(n,e){(function(t,o){n.exports=o()})(window,function(){return function(i){var t={};function o(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return i[s].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=i,o.c=t,o.d=function(s,r,l){o.o(s,r)||Object.defineProperty(s,r,{enumerable:!0,get:l})},o.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},o.t=function(s,r){if(r&1&&(s=o(s)),r&8||r&4&&typeof s=="object"&&s&&s.__esModule)return s;var l=Object.create(null);if(o.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:s}),r&2&&typeof s!="string")for(var c in s)o.d(l,c,(function(b){return s[b]}).bind(null,c));return l},o.n=function(s){var r=s&&s.__esModule?function(){return s.default}:function(){return s};return o.d(r,"a",r),r},o.o=function(s,r){return Object.prototype.hasOwnProperty.call(s,r)},o.p="",o(o.s=2)}([function(i,t,o){var s=this&&this.__extends||function(){var k=function(S,M){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,_){A.__proto__=_}||function(A,_){for(var E in _)_.hasOwnProperty(E)&&(A[E]=_[E])},k(S,M)};return function(S,M){k(S,M);function A(){this.constructor=S}S.prototype=M===null?Object.create(M):(A.prototype=M.prototype,new A)}}();Object.defineProperty(t,"__esModule",{value:!0});var r=256,l=function(){function k(S){S===void 0&&(S="="),this._paddingCharacter=S}return k.prototype.encodedLength=function(S){return this._paddingCharacter?(S+2)/3*4|0:(S*8+5)/6|0},k.prototype.encode=function(S){for(var M="",A=0;A<S.length-2;A+=3){var _=S[A]<<16|S[A+1]<<8|S[A+2];M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),M+=this._encodeByte(_>>>1*6&63),M+=this._encodeByte(_>>>0*6&63)}var E=S.length-A;if(E>0){var _=S[A]<<16|(E===2?S[A+1]<<8:0);M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),E===2?M+=this._encodeByte(_>>>1*6&63):M+=this._paddingCharacter||"",M+=this._paddingCharacter||""}return M},k.prototype.maxDecodedLength=function(S){return this._paddingCharacter?S/4*3|0:(S*6+7)/8|0},k.prototype.decodedLength=function(S){return this.maxDecodedLength(S.length-this._getPaddingLength(S))},k.prototype.decode=function(S){if(S.length===0)return new Uint8Array(0);for(var M=this._getPaddingLength(S),A=S.length-M,_=new Uint8Array(this.maxDecodedLength(A)),E=0,N=0,G=0,z=0,U=0,V=0,oe=0;N<A-4;N+=4)z=this._decodeChar(S.charCodeAt(N+0)),U=this._decodeChar(S.charCodeAt(N+1)),V=this._decodeChar(S.charCodeAt(N+2)),oe=this._decodeChar(S.charCodeAt(N+3)),_[E++]=z<<2|U>>>4,_[E++]=U<<4|V>>>2,_[E++]=V<<6|oe,G|=z&r,G|=U&r,G|=V&r,G|=oe&r;if(N<A-1&&(z=this._decodeChar(S.charCodeAt(N)),U=this._decodeChar(S.charCodeAt(N+1)),_[E++]=z<<2|U>>>4,G|=z&r,G|=U&r),N<A-2&&(V=this._decodeChar(S.charCodeAt(N+2)),_[E++]=U<<4|V>>>2,G|=V&r),N<A-3&&(oe=this._decodeChar(S.charCodeAt(N+3)),_[E++]=V<<6|oe,G|=oe&r),G!==0)throw new Error("Base64Coder: incorrect characters for decoding");return _},k.prototype._encodeByte=function(S){var M=S;return M+=65,M+=25-S>>>8&6,M+=51-S>>>8&-75,M+=61-S>>>8&-15,M+=62-S>>>8&3,String.fromCharCode(M)},k.prototype._decodeChar=function(S){var M=r;return M+=(42-S&S-44)>>>8&-r+S-43+62,M+=(46-S&S-48)>>>8&-r+S-47+63,M+=(47-S&S-58)>>>8&-r+S-48+52,M+=(64-S&S-91)>>>8&-r+S-65+0,M+=(96-S&S-123)>>>8&-r+S-97+26,M},k.prototype._getPaddingLength=function(S){var M=0;if(this._paddingCharacter){for(var A=S.length-1;A>=0&&S[A]===this._paddingCharacter;A--)M++;if(S.length<4||M>2)throw new Error("Base64Coder: incorrect padding")}return M},k}();t.Coder=l;var c=new l;function b(k){return c.encode(k)}t.encode=b;function p(k){return c.decode(k)}t.decode=p;var g=function(k){s(S,k);function S(){return k!==null&&k.apply(this,arguments)||this}return S.prototype._encodeByte=function(M){var A=M;return A+=65,A+=25-M>>>8&6,A+=51-M>>>8&-75,A+=61-M>>>8&-13,A+=62-M>>>8&49,String.fromCharCode(A)},S.prototype._decodeChar=function(M){var A=r;return A+=(44-M&M-46)>>>8&-r+M-45+62,A+=(94-M&M-96)>>>8&-r+M-95+63,A+=(47-M&M-58)>>>8&-r+M-48+52,A+=(64-M&M-91)>>>8&-r+M-65+0,A+=(96-M&M-123)>>>8&-r+M-97+26,A},S}(l);t.URLSafeCoder=g;var f=new g;function y(k){return f.encode(k)}t.encodeURLSafe=y;function C(k){return f.decode(k)}t.decodeURLSafe=C,t.encodedLength=function(k){return c.encodedLength(k)},t.maxDecodedLength=function(k){return c.maxDecodedLength(k)},t.decodedLength=function(k){return c.decodedLength(k)}},function(i,t,o){Object.defineProperty(t,"__esModule",{value:!0});var s="utf8: invalid string",r="utf8: invalid source encoding";function l(p){for(var g=new Uint8Array(c(p)),f=0,y=0;y<p.length;y++){var C=p.charCodeAt(y);C<128?g[f++]=C:C<2048?(g[f++]=192|C>>6,g[f++]=128|C&63):C<55296?(g[f++]=224|C>>12,g[f++]=128|C>>6&63,g[f++]=128|C&63):(y++,C=(C&1023)<<10,C|=p.charCodeAt(y)&1023,C+=65536,g[f++]=240|C>>18,g[f++]=128|C>>12&63,g[f++]=128|C>>6&63,g[f++]=128|C&63)}return g}t.encode=l;function c(p){for(var g=0,f=0;f<p.length;f++){var y=p.charCodeAt(f);if(y<128)g+=1;else if(y<2048)g+=2;else if(y<55296)g+=3;else if(y<=57343){if(f>=p.length-1)throw new Error(s);f++,g+=4}else throw new Error(s)}return g}t.encodedLength=c;function b(p){for(var g=[],f=0;f<p.length;f++){var y=p[f];if(y&128){var C=void 0;if(y<224){if(f>=p.length)throw new Error(r);var k=p[++f];if((k&192)!==128)throw new Error(r);y=(y&31)<<6|k&63,C=128}else if(y<240){if(f>=p.length-1)throw new Error(r);var k=p[++f],S=p[++f];if((k&192)!==128||(S&192)!==128)throw new Error(r);y=(y&15)<<12|(k&63)<<6|S&63,C=2048}else if(y<248){if(f>=p.length-2)throw new Error(r);var k=p[++f],S=p[++f],M=p[++f];if((k&192)!==128||(S&192)!==128||(M&192)!==128)throw new Error(r);y=(y&15)<<18|(k&63)<<12|(S&63)<<6|M&63,C=65536}else throw new Error(r);if(y<C||y>=55296&&y<=57343)throw new Error(r);if(y>=65536){if(y>1114111)throw new Error(r);y-=65536,g.push(String.fromCharCode(55296|y>>10)),y=56320|y&1023}}g.push(String.fromCharCode(y))}return g.join("")}t.decode=b},function(i,t,o){i.exports=o(3).default},function(i,t,o){o.r(t);class s{constructor(a,d){this.lastId=0,this.prefix=a,this.name=d}create(a){this.lastId++;var d=this.lastId,v=this.prefix+d,w=this.name+"["+d+"]",L=!1,T=function(){L||(a.apply(null,arguments),L=!0)};return this[d]=T,{number:d,id:v,name:w,callback:T}}remove(a){delete this[a.number]}}var r=new s("_pusher_script_","Pusher.ScriptReceivers"),l={VERSION:"8.4.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},c=l;class b{constructor(a){this.options=a,this.receivers=a.receivers||r,this.loading={}}load(a,d,v){var w=this;if(w.loading[a]&&w.loading[a].length>0)w.loading[a].push(v);else{w.loading[a]=[v];var L=H.createScriptRequest(w.getPath(a,d)),T=w.receivers.create(function(I){if(w.receivers.remove(T),w.loading[a]){var O=w.loading[a];delete w.loading[a];for(var Z=function(me){me||L.cleanup()},Y=0;Y<O.length;Y++)O[Y](I,Z)}});L.send(T)}}getRoot(a){var d,v=H.getDocument().location.protocol;return a&&a.useTLS||v==="https:"?d=this.options.cdn_https:d=this.options.cdn_http,d.replace(/\/*$/,"")+"/"+this.options.version}getPath(a,d){return this.getRoot(d)+"/"+a+this.options.suffix+".js"}}var p=new s("_pusher_dependencies","Pusher.DependenciesReceivers"),g=new b({cdn_http:c.cdn_http,cdn_https:c.cdn_https,version:c.VERSION,suffix:c.dependency_suffix,receivers:p});const f={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var C={buildLogSuffix:function(u){const a="See:",d=f.urls[u];if(!d)return"";let v;return d.fullUrl?v=d.fullUrl:d.path&&(v=f.baseUrl+d.path),v?`${a} ${v}`:""}},k;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(k||(k={}));class S extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class _ extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class E extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class N extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class G extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class z extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class U extends Error{constructor(a,d){super(d),this.status=a,Object.setPrototypeOf(this,new.target.prototype)}}var oe=function(u,a,d,v,w){const L=H.createXHR();L.open("POST",d.endpoint,!0),L.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var T in d.headers)L.setRequestHeader(T,d.headers[T]);if(d.headersProvider!=null){let I=d.headersProvider();for(var T in I)L.setRequestHeader(T,I[T])}return L.onreadystatechange=function(){if(L.readyState===4)if(L.status===200){let I,O=!1;try{I=JSON.parse(L.responseText),O=!0}catch{w(new U(200,`JSON returned from ${v.toString()} endpoint was invalid, yet status code was 200. Data was: ${L.responseText}`),null)}O&&w(null,I)}else{let I="";switch(v){case k.UserAuthentication:I=C.buildLogSuffix("authenticationEndpoint");break;case k.ChannelAuthorization:I=`Clients must be authorized to join private or presence channels. ${C.buildLogSuffix("authorizationEndpoint")}`;break}w(new U(L.status,`Unable to retrieve auth string from ${v.toString()} endpoint - received status: ${L.status} from ${d.endpoint}. ${I}`),null)}},L.send(a),L};function fe(u){return Xe(Te(u))}var K=String.fromCharCode,Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=function(u){var a=u.charCodeAt(0);return a<128?u:a<2048?K(192|a>>>6)+K(128|a&63):K(224|a>>>12&15)+K(128|a>>>6&63)+K(128|a&63)},Te=function(u){return u.replace(/[^\x00-\x7F]/g,ue)},Ae=function(u){var a=[0,2,1][u.length%3],d=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),v=[Me.charAt(d>>>18),Me.charAt(d>>>12&63),a>=2?"=":Me.charAt(d>>>6&63),a>=1?"=":Me.charAt(d&63)];return v.join("")},Xe=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,Ae)};class pn{constructor(a,d,v,w){this.clear=d,this.timer=a(()=>{this.timer&&(this.timer=w(this.timer))},v)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var en=pn;function Sn(u){window.clearTimeout(u)}function bn(u){window.clearInterval(u)}class Ee extends en{constructor(a,d){super(setTimeout,Sn,a,function(v){return d(),null})}}class nn extends en{constructor(a,d){super(setInterval,bn,a,function(v){return d(),v})}}var _n={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Ee(0,u)},method(u,...a){var d=Array.prototype.slice.call(arguments,1);return function(v){return v[u].apply(v,d.concat(arguments))}}},re=_n;function be(u,...a){for(var d=0;d<a.length;d++){var v=a[d];for(var w in v)v[w]&&v[w].constructor&&v[w].constructor===Object?u[w]=be(u[w]||{},v[w]):u[w]=v[w]}return u}function Re(){for(var u=["Pusher"],a=0;a<arguments.length;a++)typeof arguments[a]=="string"?u.push(arguments[a]):u.push(Bi(arguments[a]));return u.join(" : ")}function Pe(u,a){var d=Array.prototype.indexOf;if(u===null)return-1;if(d&&u.indexOf===d)return u.indexOf(a);for(var v=0,w=u.length;v<w;v++)if(u[v]===a)return v;return-1}function Ce(u,a){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&a(u[d],d,u)}function qe(u){var a=[];return Ce(u,function(d,v){a.push(v)}),a}function B(u){var a=[];return Ce(u,function(d){a.push(d)}),a}function he(u,a,d){for(var v=0;v<u.length;v++)a.call(d||window,u[v],v,u)}function $(u,a){for(var d=[],v=0;v<u.length;v++)d.push(a(u[v],v,u,d));return d}function ge(u,a){var d={};return Ce(u,function(v,w){d[w]=a(v)}),d}function We(u,a){a=a||function(w){return!!w};for(var d=[],v=0;v<u.length;v++)a(u[v],v,u,d)&&d.push(u[v]);return d}function Q(u,a){var d={};return Ce(u,function(v,w){(a&&a(v,w,u,d)||v)&&(d[w]=v)}),d}function ni(u){var a=[];return Ce(u,function(d,v){a.push([v,d])}),a}function Jo(u,a){for(var d=0;d<u.length;d++)if(a(u[d],d,u))return!0;return!1}function gl(u,a){for(var d=0;d<u.length;d++)if(!a(u[d],d,u))return!1;return!0}function yl(u){return ge(u,function(a){return typeof a=="object"&&(a=Bi(a)),encodeURIComponent(fe(a.toString()))})}function kl(u){var a=Q(u,function(v){return v!==void 0}),d=$(ni(yl(a)),re.method("join","=")).join("&");return d}function wl(u){var a=[],d=[];return function v(w,L){var T,I,O;switch(typeof w){case"object":if(!w)return null;for(T=0;T<a.length;T+=1)if(a[T]===w)return{$ref:d[T]};if(a.push(w),d.push(L),Object.prototype.toString.apply(w)==="[object Array]")for(O=[],T=0;T<w.length;T+=1)O[T]=v(w[T],L+"["+T+"]");else{O={};for(I in w)Object.prototype.hasOwnProperty.call(w,I)&&(O[I]=v(w[I],L+"["+JSON.stringify(I)+"]"))}return O;case"number":case"string":case"boolean":return w}}(u,"$")}function Bi(u){try{return JSON.stringify(u)}catch{return JSON.stringify(wl(u))}}class Cl{constructor(){this.globalLog=a=>{window.console&&window.console.log&&window.console.log(a)}}debug(...a){this.log(this.globalLog,a)}warn(...a){this.log(this.globalLogWarn,a)}error(...a){this.log(this.globalLogError,a)}globalLogWarn(a){window.console&&window.console.warn?window.console.warn(a):this.globalLog(a)}globalLogError(a){window.console&&window.console.error?window.console.error(a):this.globalLogWarn(a)}log(a,...d){var v=Re.apply(this,arguments);_t.log?_t.log(v):_t.logToConsole&&a.bind(this)(v)}}var se=new Cl,Sl=function(u,a,d,v,w){(d.headers!==void 0||d.headersProvider!=null)&&se.warn(`To send headers with the ${v.toString()} request, you must use AJAX, rather than JSONP.`);var L=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var T=u.getDocument(),I=T.createElement("script");u.auth_callbacks[L]=function(Y){w(null,Y)};var O="Pusher.auth_callbacks['"+L+"']";I.src=d.endpoint+"?callback="+encodeURIComponent(O)+"&"+a;var Z=T.getElementsByTagName("head")[0]||T.documentElement;Z.insertBefore(I,Z.firstChild)},_l=Sl;class Ml{constructor(a){this.src=a}send(a){var d=this,v="Error loading "+d.src;d.script=document.createElement("script"),d.script.id=a.id,d.script.src=d.src,d.script.type="text/javascript",d.script.charset="UTF-8",d.script.addEventListener?(d.script.onerror=function(){a.callback(v)},d.script.onload=function(){a.callback(null)}):d.script.onreadystatechange=function(){(d.script.readyState==="loaded"||d.script.readyState==="complete")&&a.callback(null)},d.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(d.errorScript=document.createElement("script"),d.errorScript.id=a.id+"_error",d.errorScript.text=a.name+"('"+v+"');",d.script.async=d.errorScript.async=!1):d.script.async=!0;var w=document.getElementsByTagName("head")[0];w.insertBefore(d.script,w.firstChild),d.errorScript&&w.insertBefore(d.errorScript,d.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class Al{constructor(a,d){this.url=a,this.data=d}send(a){if(!this.request){var d=kl(this.data),v=this.url+"/"+a.number+"?"+d;this.request=H.createScriptRequest(v),this.request.send(a)}}cleanup(){this.request&&this.request.cleanup()}}var xl=function(u,a){return function(d,v){var w="http"+(a?"s":"")+"://",L=w+(u.host||u.options.host)+u.options.path,T=H.createJSONPRequest(L,d),I=H.ScriptReceivers.create(function(O,Z){r.remove(I),T.cleanup(),Z&&Z.host&&(u.host=Z.host),v&&v(O,Z)});T.send(I)}},Ll={name:"jsonp",getAgent:xl},Tl=Ll;function pt(u,a,d){var v=u+(a.useTLS?"s":""),w=a.useTLS?a.hostTLS:a.hostNonTLS;return v+"://"+w+d}function bt(u,a){var d="/app/"+u,v="?protocol="+c.PROTOCOL+"&client=js&version="+c.VERSION+(a?"&"+a:"");return d+v}var El={getInitial:function(u,a){var d=(a.httpPath||"")+bt(u,"flash=false");return pt("ws",a,d)}},Pl={getInitial:function(u,a){var d=(a.httpPath||"/pusher")+bt(u);return pt("http",a,d)}},Nl={getInitial:function(u,a){return pt("http",a,a.httpPath||"/pusher")},getPath:function(u,a){return bt(u)}};class Il{constructor(){this._callbacks={}}get(a){return this._callbacks[vt(a)]}add(a,d,v){var w=vt(a);this._callbacks[w]=this._callbacks[w]||[],this._callbacks[w].push({fn:d,context:v})}remove(a,d,v){if(!a&&!d&&!v){this._callbacks={};return}var w=a?[vt(a)]:qe(this._callbacks);d||v?this.removeCallback(w,d,v):this.removeAllCallbacks(w)}removeCallback(a,d,v){he(a,function(w){this._callbacks[w]=We(this._callbacks[w]||[],function(L){return d&&d!==L.fn||v&&v!==L.context}),this._callbacks[w].length===0&&delete this._callbacks[w]},this)}removeAllCallbacks(a){he(a,function(d){delete this._callbacks[d]},this)}}function vt(u){return"_"+u}class tn{constructor(a){this.callbacks=new Il,this.global_callbacks=[],this.failThrough=a}bind(a,d,v){return this.callbacks.add(a,d,v),this}bind_global(a){return this.global_callbacks.push(a),this}unbind(a,d,v){return this.callbacks.remove(a,d,v),this}unbind_global(a){return a?(this.global_callbacks=We(this.global_callbacks||[],d=>d!==a),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(a,d,v){for(var w=0;w<this.global_callbacks.length;w++)this.global_callbacks[w](a,d);var L=this.callbacks.get(a),T=[];if(v?T.push(d,v):d&&T.push(d),L&&L.length>0)for(var w=0;w<L.length;w++)L[w].fn.apply(L[w].context||window,T);else this.failThrough&&this.failThrough(a,d);return this}}class Bl extends tn{constructor(a,d,v,w,L){super(),this.initialize=H.transportConnectionInitializer,this.hooks=a,this.name=d,this.priority=v,this.key=w,this.options=L,this.state="new",this.timeline=L.timeline,this.activityTimeout=L.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var a=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(a,this.options)}catch(d){return re.defer(()=>{this.onError(d),this.changeState("closed")}),!1}return this.bindListeners(),se.debug("Connecting",{transport:this.name,url:a}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(a){return this.state==="open"?(re.defer(()=>{this.socket&&this.socket.send(a)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(a){this.emit("error",{type:"WebSocketError",error:a}),this.timeline.error(this.buildTimelineMessage({error:a.toString()}))}onClose(a){a?this.changeState("closed",{code:a.code,reason:a.reason,wasClean:a.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(a){this.emit("message",a)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=a=>{this.onError(a)},this.socket.onclose=a=>{this.onClose(a)},this.socket.onmessage=a=>{this.onMessage(a)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(a,d){this.state=a,this.timeline.info(this.buildTimelineMessage({state:a,params:d})),this.emit(a,d)}buildTimelineMessage(a){return be({cid:this.id},a)}}class jn{constructor(a){this.hooks=a}isSupported(a){return this.hooks.isSupported(a)}createConnection(a,d,v,w){return new Bl(this.hooks,a,d,v,w)}}var Rl=new jn({urls:El,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!H.getWebSocketAPI()},isSupported:function(){return!!H.getWebSocketAPI()},getSocket:function(u){return H.createWebSocket(u)}}),$o={urls:Pl,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Yo=be({getSocket:function(u){return H.HTTPFactory.createStreamingSocket(u)}},$o),Qo=be({getSocket:function(u){return H.HTTPFactory.createPollingSocket(u)}},$o),Xo={isSupported:function(){return H.isXHRSupported()}},Dl=new jn(be({},Yo,Xo)),Ol=new jn(be({},Qo,Xo)),Hl={ws:Rl,xhr_streaming:Dl,xhr_polling:Ol},Ri=Hl,Ul=new jn({file:"sockjs",urls:Nl,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,a){return new window.SockJS(u,null,{js_path:g.getPath("sockjs",{useTLS:a.useTLS}),ignore_null_origin:a.ignoreNullOrigin})},beforeOpen:function(u,a){u.send(JSON.stringify({path:a}))}}),es={isSupported:function(u){var a=H.isXDRSupported(u.useTLS);return a}},Kl=new jn(be({},Yo,es)),jl=new jn(be({},Qo,es));Ri.xdr_streaming=Kl,Ri.xdr_polling=jl,Ri.sockjs=Ul;var Vl=Ri;class Gl extends tn{constructor(){super();var a=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){a.emit("online")},!1),window.addEventListener("offline",function(){a.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var zl=new Gl;class Fl{constructor(a,d,v){this.manager=a,this.transport=d,this.minPingDelay=v.minPingDelay,this.maxPingDelay=v.maxPingDelay,this.pingDelay=void 0}createConnection(a,d,v,w){w=be({},w,{activityTimeout:this.pingDelay});var L=this.transport.createConnection(a,d,v,w),T=null,I=function(){L.unbind("open",I),L.bind("closed",O),T=re.now()},O=Z=>{if(L.unbind("closed",O),Z.code===1002||Z.code===1003)this.manager.reportDeath();else if(!Z.wasClean&&T){var Y=re.now()-T;Y<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(Y/2,this.minPingDelay))}};return L.bind("open",I),L}isSupported(a){return this.manager.isAlive()&&this.transport.isSupported(a)}}const ns={decodeMessage:function(u){try{var a=JSON.parse(u.data),d=a.data;if(typeof d=="string")try{d=JSON.parse(a.data)}catch{}var v={event:a.event,channel:a.channel,data:d};return a.user_id&&(v.user_id=a.user_id),v}catch(w){throw{type:"MessageParseError",error:w,data:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var a=ns.decodeMessage(u);if(a.event==="pusher:connection_established"){if(!a.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:a.data.socket_id,activityTimeout:a.data.activity_timeout*1e3}}else{if(a.event==="pusher:error")return{action:this.getCloseAction(a.data),error:this.getCloseError(a.data)};throw"Invalid handshake"}},getCloseAction:function(u){return u.code<4e3?u.code>=1002&&u.code<=1004?"backoff":null:u.code===4e3?"tls_only":u.code<4100?"refused":u.code<4200?"backoff":u.code<4300?"retry":"refused"},getCloseError:function(u){return u.code!==1e3&&u.code!==1001?{type:"PusherError",data:{code:u.code,message:u.reason||u.message}}:null}};var Mn=ns;class ql extends tn{constructor(a,d){super(),this.id=a,this.transport=d,this.activityTimeout=d.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(a){return this.transport.send(a)}send_event(a,d,v){var w={event:a,data:d};return v&&(w.channel=v),se.debug("Event sent",w),this.send(Mn.encodeMessage(w))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var a={message:v=>{var w;try{w=Mn.decodeMessage(v)}catch(L){this.emit("error",{type:"MessageParseError",error:L,data:v.data})}if(w!==void 0){switch(se.debug("Event recd",w),w.event){case"pusher:error":this.emit("error",{type:"PusherError",data:w.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",w)}},activity:()=>{this.emit("activity")},error:v=>{this.emit("error",v)},closed:v=>{d(),v&&v.code&&this.handleCloseEvent(v),this.transport=null,this.emit("closed")}},d=()=>{Ce(a,(v,w)=>{this.transport.unbind(w,v)})};Ce(a,(v,w)=>{this.transport.bind(w,v)})}handleCloseEvent(a){var d=Mn.getCloseAction(a),v=Mn.getCloseError(a);v&&this.emit("error",v),d&&this.emit(d,{action:d,error:v})}}class Wl{constructor(a,d){this.transport=a,this.callback=d,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=a=>{this.unbindListeners();var d;try{d=Mn.processHandshake(a)}catch(v){this.finish("error",{error:v}),this.transport.close();return}d.action==="connected"?this.finish("connected",{connection:new ql(d.id,this.transport),activityTimeout:d.activityTimeout}):(this.finish(d.action,{error:d.error}),this.transport.close())},this.onClosed=a=>{this.unbindListeners();var d=Mn.getCloseAction(a)||"backoff",v=Mn.getCloseError(a);this.finish(d,{error:v})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(a,d){this.callback(be({transport:this.transport,action:a},d))}}class Zl{constructor(a,d){this.timeline=a,this.options=d||{}}send(a,d){this.timeline.isEmpty()||this.timeline.send(H.TimelineTransport.getAgent(this,a),d)}}class ft extends tn{constructor(a,d){super(function(v,w){se.debug("No callbacks on "+a+" for "+v)}),this.name=a,this.pusher=d,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(a,d){return d(null,{auth:""})}trigger(a,d){if(a.indexOf("client-")!==0)throw new S("Event '"+a+"' does not start with 'client-'");if(!this.subscribed){var v=C.buildLogSuffix("triggeringClientEvents");se.warn(`Client event triggered before channel 'subscription_succeeded' event . ${v}`)}return this.pusher.send_event(a,d,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(a){var d=a.event,v=a.data;if(d==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(a);else if(d==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(a);else if(d.indexOf("pusher_internal:")!==0){var w={};this.emit(d,v,w)}}handleSubscriptionSucceededEvent(a){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",a.data)}handleSubscriptionCountEvent(a){a.data.subscription_count&&(this.subscriptionCount=a.data.subscription_count),this.emit("pusher:subscription_count",a.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(a,d)=>{a?(this.subscriptionPending=!1,se.error(a.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:a.message},a instanceof U?{status:a.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:d.auth,channel_data:d.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class gt extends ft{authorize(a,d){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:a},d)}}class Jl{constructor(){this.reset()}get(a){return Object.prototype.hasOwnProperty.call(this.members,a)?{id:a,info:this.members[a]}:null}each(a){Ce(this.members,(d,v)=>{a(this.get(v))})}setMyID(a){this.myID=a}onSubscription(a){this.members=a.presence.hash,this.count=a.presence.count,this.me=this.get(this.myID)}addMember(a){return this.get(a.user_id)===null&&this.count++,this.members[a.user_id]=a.user_info,this.get(a.user_id)}removeMember(a){var d=this.get(a.user_id);return d&&(delete this.members[a.user_id],this.count--),d}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var $l=function(u,a,d,v){function w(L){return L instanceof d?L:new d(function(T){T(L)})}return new(d||(d=Promise))(function(L,T){function I(Y){try{Z(v.next(Y))}catch(me){T(me)}}function O(Y){try{Z(v.throw(Y))}catch(me){T(me)}}function Z(Y){Y.done?L(Y.value):w(Y.value).then(I,O)}Z((v=v.apply(u,a||[])).next())})};class Yl extends gt{constructor(a,d){super(a,d),this.members=new Jl}authorize(a,d){super.authorize(a,(v,w)=>$l(this,void 0,void 0,function*(){if(!v)if(w=w,w.channel_data!=null){var L=JSON.parse(w.channel_data);this.members.setMyID(L.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let T=C.buildLogSuffix("authorizationEndpoint");se.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${T}, or the user should be signed in.`),d("Invalid auth response");return}d(v,w)}))}handleEvent(a){var d=a.event;if(d.indexOf("pusher_internal:")===0)this.handleInternalEvent(a);else{var v=a.data,w={};a.user_id&&(w.user_id=a.user_id),this.emit(d,v,w)}}handleInternalEvent(a){var d=a.event,v=a.data;switch(d){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(a);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(a);break;case"pusher_internal:member_added":var w=this.members.addMember(v);this.emit("pusher:member_added",w);break;case"pusher_internal:member_removed":var L=this.members.removeMember(v);L&&this.emit("pusher:member_removed",L);break}}handleSubscriptionSucceededEvent(a){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(a.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Ql=o(1),yt=o(0);class Xl extends gt{constructor(a,d,v){super(a,d),this.key=null,this.nacl=v}authorize(a,d){super.authorize(a,(v,w)=>{if(v){d(v,w);return}let L=w.shared_secret;if(!L){d(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(yt.decode)(L),delete w.shared_secret,d(null,w)})}trigger(a,d){throw new N("Client events are not currently supported for encrypted channels")}handleEvent(a){var d=a.event,v=a.data;if(d.indexOf("pusher_internal:")===0||d.indexOf("pusher:")===0){super.handleEvent(a);return}this.handleEncryptedEvent(d,v)}handleEncryptedEvent(a,d){if(!this.key){se.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!d.ciphertext||!d.nonce){se.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+d);return}let v=Object(yt.decode)(d.ciphertext);if(v.length<this.nacl.secretbox.overheadLength){se.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${v.length}`);return}let w=Object(yt.decode)(d.nonce);if(w.length<this.nacl.secretbox.nonceLength){se.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${w.length}`);return}let L=this.nacl.secretbox.open(v,w,this.key);if(L===null){se.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(T,I)=>{if(T){se.error(`Failed to make a request to the authEndpoint: ${I}. Unable to fetch new key, so dropping encrypted event`);return}if(L=this.nacl.secretbox.open(v,w,this.key),L===null){se.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(a,this.getDataToEmit(L))});return}this.emit(a,this.getDataToEmit(L))}getDataToEmit(a){let d=Object(Ql.decode)(a);try{return JSON.parse(d)}catch{return d}}}class ed extends tn{constructor(a,d){super(),this.state="initialized",this.connection=null,this.key=a,this.options=d,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var v=H.getNetwork();v.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),v.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(a){return this.connection?this.connection.send(a):!1}send_event(a,d,v){return this.connection?this.connection.send_event(a,d,v):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var a=(d,v)=>{d?this.runner=this.strategy.connect(0,a):v.action==="error"?(this.emit("error",{type:"HandshakeError",error:v.error}),this.timeline.error({handshakeError:v.error})):(this.abortConnecting(),this.handshakeCallbacks[v.action](v))};this.runner=this.strategy.connect(0,a)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var a=this.abandonConnection();a.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(a){this.timeline.info({action:"retry",delay:a}),a>0&&this.emit("connecting_in",Math.round(a/1e3)),this.retryTimer=new Ee(a||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Ee(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Ee(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new Ee(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(a){return be({},a,{message:d=>{this.resetActivityCheck(),this.emit("message",d)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:d=>{this.emit("error",d)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(a){return be({},a,{connected:d=>{this.activityTimeout=Math.min(this.options.activityTimeout,d.activityTimeout,d.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(d.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let a=d=>v=>{v.error&&this.emit("error",{type:"WebSocketError",error:v.error}),d(v)};return{tls_only:a(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:a(()=>{this.disconnect()}),backoff:a(()=>{this.retryIn(1e3)}),retry:a(()=>{this.retryIn(0)})}}setConnection(a){this.connection=a;for(var d in this.connectionCallbacks)this.connection.bind(d,this.connectionCallbacks[d]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var a in this.connectionCallbacks)this.connection.unbind(a,this.connectionCallbacks[a]);var d=this.connection;return this.connection=null,d}}updateState(a,d){var v=this.state;if(this.state=a,v!==a){var w=a;w==="connected"&&(w+=" with new socket ID "+d.socket_id),se.debug("State changed",v+" -> "+w),this.timeline.info({state:a,params:d}),this.emit("state_change",{previous:v,current:a}),this.emit(a,d)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class nd{constructor(){this.channels={}}add(a,d){return this.channels[a]||(this.channels[a]=id(a,d)),this.channels[a]}all(){return B(this.channels)}find(a){return this.channels[a]}remove(a){var d=this.channels[a];return delete this.channels[a],d}disconnect(){Ce(this.channels,function(a){a.disconnect()})}}function id(u,a){if(u.indexOf("private-encrypted-")===0){if(a.config.nacl)return on.createEncryptedChannel(u,a,a.config.nacl);let d="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",v=C.buildLogSuffix("encryptedChannelSupport");throw new N(`${d}. ${v}`)}else{if(u.indexOf("private-")===0)return on.createPrivateChannel(u,a);if(u.indexOf("presence-")===0)return on.createPresenceChannel(u,a);if(u.indexOf("#")===0)throw new M('Cannot create a channel with name "'+u+'".');return on.createChannel(u,a)}}var td={createChannels(){return new nd},createConnectionManager(u,a){return new ed(u,a)},createChannel(u,a){return new ft(u,a)},createPrivateChannel(u,a){return new gt(u,a)},createPresenceChannel(u,a){return new Yl(u,a)},createEncryptedChannel(u,a,d){return new Xl(u,a,d)},createTimelineSender(u,a){return new Zl(u,a)},createHandshake(u,a){return new Wl(u,a)},createAssistantToTheTransportManager(u,a,d){return new Fl(u,a,d)}},on=td;class is{constructor(a){this.options=a||{},this.livesLeft=this.options.lives||1/0}getAssistant(a){return on.createAssistantToTheTransportManager(this,a,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class An{constructor(a,d){this.strategies=a,this.loop=!!d.loop,this.failFast=!!d.failFast,this.timeout=d.timeout,this.timeoutLimit=d.timeoutLimit}isSupported(){return Jo(this.strategies,re.method("isSupported"))}connect(a,d){var v=this.strategies,w=0,L=this.timeout,T=null,I=(O,Z)=>{Z?d(null,Z):(w=w+1,this.loop&&(w=w%v.length),w<v.length?(L&&(L=L*2,this.timeoutLimit&&(L=Math.min(L,this.timeoutLimit))),T=this.tryStrategy(v[w],a,{timeout:L,failFast:this.failFast},I)):d(!0))};return T=this.tryStrategy(v[w],a,{timeout:L,failFast:this.failFast},I),{abort:function(){T.abort()},forceMinPriority:function(O){a=O,T&&T.forceMinPriority(O)}}}tryStrategy(a,d,v,w){var L=null,T=null;return v.timeout>0&&(L=new Ee(v.timeout,function(){T.abort(),w(!0)})),T=a.connect(d,function(I,O){I&&L&&L.isRunning()&&!v.failFast||(L&&L.ensureAborted(),w(I,O))}),{abort:function(){L&&L.ensureAborted(),T.abort()},forceMinPriority:function(I){T.forceMinPriority(I)}}}}class kt{constructor(a){this.strategies=a}isSupported(){return Jo(this.strategies,re.method("isSupported"))}connect(a,d){return od(this.strategies,a,function(v,w){return function(L,T){if(w[v].error=L,L){sd(w)&&d(!0);return}he(w,function(I){I.forceMinPriority(T.transport.priority)}),d(null,T)}})}}function od(u,a,d){var v=$(u,function(w,L,T,I){return w.connect(a,d(L,I))});return{abort:function(){he(v,ad)},forceMinPriority:function(w){he(v,function(L){L.forceMinPriority(w)})}}}function sd(u){return gl(u,function(a){return!!a.error})}function ad(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class rd{constructor(a,d,v){this.strategy=a,this.transports=d,this.ttl=v.ttl||1800*1e3,this.usingTLS=v.useTLS,this.timeline=v.timeline}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.usingTLS,w=ld(v),L=w&&w.cacheSkipCount?w.cacheSkipCount:0,T=[this.strategy];if(w&&w.timestamp+this.ttl>=re.now()){var I=this.transports[w.transport];I&&(["ws","wss"].includes(w.transport)||L>3?(this.timeline.info({cached:!0,transport:w.transport,latency:w.latency}),T.push(new An([I],{timeout:w.latency*2+1e3,failFast:!0}))):L++)}var O=re.now(),Z=T.pop().connect(a,function Y(me,Hi){me?(ts(v),T.length>0?(O=re.now(),Z=T.pop().connect(a,Y)):d(me)):(dd(v,Hi.transport.name,re.now()-O,L),d(null,Hi))});return{abort:function(){Z.abort()},forceMinPriority:function(Y){a=Y,Z&&Z.forceMinPriority(Y)}}}}function wt(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function ld(u){var a=H.getLocalStorage();if(a)try{var d=a[wt(u)];if(d)return JSON.parse(d)}catch{ts(u)}return null}function dd(u,a,d,v){var w=H.getLocalStorage();if(w)try{w[wt(u)]=Bi({timestamp:re.now(),transport:a,latency:d,cacheSkipCount:v})}catch{}}function ts(u){var a=H.getLocalStorage();if(a)try{delete a[wt(u)]}catch{}}class Di{constructor(a,{delay:d}){this.strategy=a,this.options={delay:d}}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.strategy,w,L=new Ee(this.options.delay,function(){w=v.connect(a,d)});return{abort:function(){L.ensureAborted(),w&&w.abort()},forceMinPriority:function(T){a=T,w&&w.forceMinPriority(T)}}}}class ii{constructor(a,d,v){this.test=a,this.trueBranch=d,this.falseBranch=v}isSupported(){var a=this.test()?this.trueBranch:this.falseBranch;return a.isSupported()}connect(a,d){var v=this.test()?this.trueBranch:this.falseBranch;return v.connect(a,d)}}class cd{constructor(a){this.strategy=a}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.strategy.connect(a,function(w,L){L&&v.abort(),d(w,L)});return v}}function ti(u){return function(){return u.isSupported()}}var ud=function(u,a,d){var v={};function w(ps,cc,uc,hc,mc){var bs=d(u,ps,cc,uc,hc,mc);return v[ps]=bs,bs}var L=Object.assign({},a,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),T=Object.assign({},L,{useTLS:!0}),I=Object.assign({},a,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),O={loop:!0,timeout:15e3,timeoutLimit:6e4},Z=new is({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),Y=new is({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),me=w("ws","ws",3,L,Z),Hi=w("wss","ws",3,T,Z),sc=w("sockjs","sockjs",1,I),ls=w("xhr_streaming","xhr_streaming",1,I,Y),ac=w("xdr_streaming","xdr_streaming",1,I,Y),ds=w("xhr_polling","xhr_polling",1,I),rc=w("xdr_polling","xdr_polling",1,I),cs=new An([me],O),lc=new An([Hi],O),dc=new An([sc],O),us=new An([new ii(ti(ls),ls,ac)],O),hs=new An([new ii(ti(ds),ds,rc)],O),ms=new An([new ii(ti(us),new kt([us,new Di(hs,{delay:4e3})]),hs)],O),Mt=new ii(ti(ms),ms,dc),At;return a.useTLS?At=new kt([cs,new Di(Mt,{delay:2e3})]):At=new kt([cs,new Di(lc,{delay:2e3}),new Di(Mt,{delay:5e3})]),new rd(new cd(new ii(ti(me),At,Mt)),v,{ttl:18e5,timeline:a.timeline,useTLS:a.useTLS})},hd=ud,md=function(){var u=this;u.timeline.info(u.buildTimelineMessage({transport:u.name+(u.options.useTLS?"s":"")})),u.hooks.isInitialized()?u.changeState("initialized"):u.hooks.file?(u.changeState("initializing"),g.load(u.hooks.file,{useTLS:u.options.useTLS},function(a,d){u.hooks.isInitialized()?(u.changeState("initialized"),d(!0)):(a&&u.onError(a),u.onClose(),d(!1))})):u.onClose()},pd={getRequest:function(u){var a=new window.XDomainRequest;return a.ontimeout=function(){u.emit("error",new A),u.close()},a.onerror=function(d){u.emit("error",d),u.close()},a.onprogress=function(){a.responseText&&a.responseText.length>0&&u.onChunk(200,a.responseText)},a.onload=function(){a.responseText&&a.responseText.length>0&&u.onChunk(200,a.responseText),u.emit("finished",200),u.close()},a},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}},bd=pd;const vd=256*1024;class fd extends tn{constructor(a,d,v){super(),this.hooks=a,this.method=d,this.url=v}start(a){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},H.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(a)}close(){this.unloader&&(H.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(a,d){for(;;){var v=this.advanceBuffer(d);if(v)this.emit("chunk",{status:a,data:v});else break}this.isBufferTooLong(d)&&this.emit("buffer_too_long")}advanceBuffer(a){var d=a.slice(this.position),v=d.indexOf(`
890
- `);return v!==-1?(this.position+=v+1,d.slice(0,v)):null}isBufferTooLong(a){return this.position===a.length&&a.length>vd}}var Ct;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(Ct||(Ct={}));var xn=Ct,gd=1;class yd{constructor(a,d){this.hooks=a,this.session=ss(1e3)+"/"+Sd(8),this.location=kd(d),this.readyState=xn.CONNECTING,this.openStream()}send(a){return this.sendRaw(JSON.stringify([a]))}ping(){this.hooks.sendHeartbeat(this)}close(a,d){this.onClose(a,d,!0)}sendRaw(a){if(this.readyState===xn.OPEN)try{return H.createSocketRequest("POST",os(wd(this.location,this.session))).start(a),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(a,d,v){this.closeStream(),this.readyState=xn.CLOSED,this.onclose&&this.onclose({code:a,reason:d,wasClean:v})}onChunk(a){if(a.status===200){this.readyState===xn.OPEN&&this.onActivity();var d,v=a.data.slice(0,1);switch(v){case"o":d=JSON.parse(a.data.slice(1)||"{}"),this.onOpen(d);break;case"a":d=JSON.parse(a.data.slice(1)||"[]");for(var w=0;w<d.length;w++)this.onEvent(d[w]);break;case"m":d=JSON.parse(a.data.slice(1)||"null"),this.onEvent(d);break;case"h":this.hooks.onHeartbeat(this);break;case"c":d=JSON.parse(a.data.slice(1)||"[]"),this.onClose(d[0],d[1],!0);break}}}onOpen(a){this.readyState===xn.CONNECTING?(a&&a.hostname&&(this.location.base=Cd(this.location.base,a.hostname)),this.readyState=xn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(a){this.readyState===xn.OPEN&&this.onmessage&&this.onmessage({data:a})}onActivity(){this.onactivity&&this.onactivity()}onError(a){this.onerror&&this.onerror(a)}openStream(){this.stream=H.createSocketRequest("POST",os(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",a=>{this.onChunk(a)}),this.stream.bind("finished",a=>{this.hooks.onFinished(this,a)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(a){re.defer(()=>{this.onError(a),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function kd(u){var a=/([^\?]*)\/*(\??.*)/.exec(u);return{base:a[1],queryString:a[2]}}function wd(u,a){return u.base+"/"+a+"/xhr_send"}function os(u){var a=u.indexOf("?")===-1?"?":"&";return u+a+"t="+ +new Date+"&n="+gd++}function Cd(u,a){var d=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return d[1]+a+d[3]}function ss(u){return H.randomInt(u)}function Sd(u){for(var a=[],d=0;d<u;d++)a.push(ss(32).toString(32));return a.join("")}var _d=yd,Md={getReceiveURL:function(u,a){return u.base+"/"+a+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,a){u.onClose(1006,"Connection interrupted ("+a+")",!1)}},Ad=Md,xd={getReceiveURL:function(u,a){return u.base+"/"+a+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,a){a===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+a+")",!1)}},Ld=xd,Td={getRequest:function(u){var a=H.getXHRAPI(),d=new a;return d.onreadystatechange=d.onprogress=function(){switch(d.readyState){case 3:d.responseText&&d.responseText.length>0&&u.onChunk(d.status,d.responseText);break;case 4:d.responseText&&d.responseText.length>0&&u.onChunk(d.status,d.responseText),u.emit("finished",d.status),u.close();break}},d},abortRequest:function(u){u.onreadystatechange=null,u.abort()}},Ed=Td,Pd={createStreamingSocket(u){return this.createSocket(Ad,u)},createPollingSocket(u){return this.createSocket(Ld,u)},createSocket(u,a){return new _d(u,a)},createXHR(u,a){return this.createRequest(Ed,u,a)},createRequest(u,a,d){return new fd(u,a,d)}},as=Pd;as.createXDR=function(u,a){return this.createRequest(bd,u,a)};var Nd=as,Id={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:r,DependenciesReceivers:p,getDefaultStrategy:hd,Transports:Vl,transportConnectionInitializer:md,HTTPFactory:Nd,TimelineTransport:Tl,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var a=()=>{this.onDocumentBody(u.ready)};window.JSON?a():g.load("json2",{},a)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:oe,jsonp:_l}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,a){return new Al(u,a)},createScriptRequest(u){return new Ml(u)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var u=this.getXHRAPI();return new u},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return zl},createWebSocket(u){var a=this.getWebSocketAPI();return new a(u)},createSocketRequest(u,a){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,a);if(this.isXDRSupported(a.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,a);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var a=u?"https:":"http:",d=this.getProtocol();return!!window.XDomainRequest&&d===a},addUnloadListener(u){window.addEventListener!==void 0?window.addEventListener("unload",u,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",u)},removeUnloadListener(u){window.addEventListener!==void 0?window.removeEventListener("unload",u,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",u)},randomInt(u){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*u)}},H=Id,St;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(St||(St={}));var Oi=St;class Bd{constructor(a,d,v){this.key=a,this.session=d,this.events=[],this.options=v||{},this.sent=0,this.uniqueID=0}log(a,d){a<=this.options.level&&(this.events.push(be({},d,{timestamp:re.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(a){this.log(Oi.ERROR,a)}info(a){this.log(Oi.INFO,a)}debug(a){this.log(Oi.DEBUG,a)}isEmpty(){return this.events.length===0}send(a,d){var v=be({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],a(v,(w,L)=>{w||this.sent++,d&&d(w,L)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Rd{constructor(a,d,v,w){this.name=a,this.priority=d,this.transport=v,this.options=w||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(a,d){if(this.isSupported()){if(this.priority<a)return rs(new _,d)}else return rs(new z,d);var v=!1,w=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),L=null,T=function(){w.unbind("initialized",T),w.connect()},I=function(){L=on.createHandshake(w,function(me){v=!0,Y(),d(null,me)})},O=function(me){Y(),d(me)},Z=function(){Y();var me;me=Bi(w),d(new E(me))},Y=function(){w.unbind("initialized",T),w.unbind("open",I),w.unbind("error",O),w.unbind("closed",Z)};return w.bind("initialized",T),w.bind("open",I),w.bind("error",O),w.bind("closed",Z),w.initialize(),{abort:()=>{v||(Y(),L?L.close():w.close())},forceMinPriority:me=>{v||this.priority<me&&(L?L.close():w.close())}}}}function rs(u,a){return re.defer(function(){a(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Dd}=H;var Od=function(u,a,d,v,w,L){var T=Dd[d];if(!T)throw new G(d);var I=(!u.enabledTransports||Pe(u.enabledTransports,a)!==-1)&&(!u.disabledTransports||Pe(u.disabledTransports,a)===-1),O;return I?(w=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},w),O=new Rd(a,v,L?L.getAssistant(T):T,w)):O=Hd,O},Hd={isSupported:function(){return!1},connect:function(u,a){var d=re.defer(function(){a(new z)});return{abort:function(){d.ensureAborted()},forceMinPriority:function(){}}}};function Ud(u){if(u==null)throw"You must pass an options object";if(u.cluster==null)throw"Options object must provide a cluster";"disableStats"in u&&se.warn("The disableStats option is deprecated in favor of enableStats")}const Kd=(u,a)=>{var d="socket_id="+encodeURIComponent(u.socketId);for(var v in a.params)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(a.params[v]);if(a.paramsProvider!=null){let w=a.paramsProvider();for(var v in w)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(w[v])}return d};var jd=u=>{if(typeof H.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(a,d)=>{const v=Kd(a,u);H.getAuthorizers()[u.transport](H,v,u,k.UserAuthentication,d)}};const Vd=(u,a)=>{var d="socket_id="+encodeURIComponent(u.socketId);d+="&channel_name="+encodeURIComponent(u.channelName);for(var v in a.params)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(a.params[v]);if(a.paramsProvider!=null){let w=a.paramsProvider();for(var v in w)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(w[v])}return d};var Gd=u=>{if(typeof H.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(a,d)=>{const v=Vd(a,u);H.getAuthorizers()[u.transport](H,v,u,k.ChannelAuthorization,d)}};const zd=(u,a,d)=>{const v={authTransport:a.transport,authEndpoint:a.endpoint,auth:{params:a.params,headers:a.headers}};return(w,L)=>{const T=u.channel(w.channelName);d(T,v).authorize(w.socketId,L)}};function Fd(u,a){let d={activityTimeout:u.activityTimeout||c.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||c.httpPath,httpPort:u.httpPort||c.httpPort,httpsPort:u.httpsPort||c.httpsPort,pongTimeout:u.pongTimeout||c.pongTimeout,statsHost:u.statsHost||c.stats_host,unavailableTimeout:u.unavailableTimeout||c.unavailableTimeout,wsPath:u.wsPath||c.wsPath,wsPort:u.wsPort||c.wsPort,wssPort:u.wssPort||c.wssPort,enableStats:$d(u),httpHost:qd(u),useTLS:Jd(u),wsHost:Wd(u),userAuthenticator:Yd(u),channelAuthorizer:Xd(u,a)};return"disabledTransports"in u&&(d.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(d.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(d.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(d.timelineParams=u.timelineParams),"nacl"in u&&(d.nacl=u.nacl),d}function qd(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:c.httpHost}function Wd(u){return u.wsHost?u.wsHost:Zd(u.cluster)}function Zd(u){return`ws-${u}.pusher.com`}function Jd(u){return H.getProtocol()==="https:"?!0:u.forceTLS!==!1}function $d(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}function Yd(u){const a=Object.assign(Object.assign({},c.userAuthentication),u.userAuthentication);return"customHandler"in a&&a.customHandler!=null?a.customHandler:jd(a)}function Qd(u,a){let d;return"channelAuthorization"in u?d=Object.assign(Object.assign({},c.channelAuthorization),u.channelAuthorization):(d={transport:u.authTransport||c.authTransport,endpoint:u.authEndpoint||c.authEndpoint},"auth"in u&&("params"in u.auth&&(d.params=u.auth.params),"headers"in u.auth&&(d.headers=u.auth.headers)),"authorizer"in u&&(d.customHandler=zd(a,d,u.authorizer))),d}function Xd(u,a){const d=Qd(u,a);return"customHandler"in d&&d.customHandler!=null?d.customHandler:Gd(d)}class ec extends tn{constructor(a){super(function(d,v){se.debug(`No callbacks on watchlist events for ${d}`)}),this.pusher=a,this.bindWatchlistInternalEvent()}handleEvent(a){a.data.events.forEach(d=>{this.emit(d.name,d)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",a=>{var d=a.event;d==="pusher_internal:watchlist_events"&&this.handleEvent(a)})}}function nc(){let u,a;return{promise:new Promise((v,w)=>{u=v,a=w}),resolve:u,reject:a}}var ic=nc;class tc extends tn{constructor(a){super(function(d,v){se.debug("No callbacks on user for "+d)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(d,v)=>{if(d){se.warn(`Error during signin: ${d}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:v.auth,user_data:v.user_data})},this.pusher=a,this.pusher.connection.bind("state_change",({previous:d,current:v})=>{d!=="connected"&&v==="connected"&&this._signin(),d==="connected"&&v!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new ec(a),this.pusher.connection.bind("message",d=>{var v=d.event;v==="pusher:signin_success"&&this._onSigninSuccess(d.data),this.serverToUserChannel&&this.serverToUserChannel.name===d.channel&&this.serverToUserChannel.handleEvent(d)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(a){try{this.user_data=JSON.parse(a.user_data)}catch{se.error(`Failed parsing user data after signin: ${a.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){se.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const a=d=>{d.subscriptionPending&&d.subscriptionCancelled?d.reinstateSubscription():!d.subscriptionPending&&this.pusher.connection.state==="connected"&&d.subscribe()};this.serverToUserChannel=new ft(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((d,v)=>{d.indexOf("pusher_internal:")===0||d.indexOf("pusher:")===0||this.emit(d,v)}),a(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:a,resolve:d,reject:v}=ic();a.done=!1;const w=()=>{a.done=!0};a.then(w).catch(w),this.signinDonePromise=a,this._signinDoneResolve=d}}class ye{static ready(){ye.isReady=!0;for(var a=0,d=ye.instances.length;a<d;a++)ye.instances[a].connect()}static getClientFeatures(){return qe(Q({ws:H.Transports.ws},function(a){return a.isSupported({})}))}constructor(a,d){oc(a),Ud(d),this.key=a,this.config=Fd(d,this),this.channels=on.createChannels(),this.global_emitter=new tn,this.sessionID=H.randomInt(1e9),this.timeline=new Bd(this.key,this.sessionID,{cluster:this.config.cluster,features:ye.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Oi.INFO,version:c.VERSION}),this.config.enableStats&&(this.timelineSender=on.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+H.TimelineTransport.name}));var v=w=>H.getDefaultStrategy(this.config,w,Od);this.connection=on.createConnectionManager(this.key,{getStrategy:v,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",w=>{var L=w.event,T=L.indexOf("pusher_internal:")===0;if(w.channel){var I=this.channel(w.channel);I&&I.handleEvent(w)}T||this.global_emitter.emit(w.event,w.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",w=>{se.warn(w)}),ye.instances.push(this),this.timeline.info({instances:ye.instances.length}),this.user=new tc(this),ye.isReady&&this.connect()}channel(a){return this.channels.find(a)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var a=this.connection.isUsingTLS(),d=this.timelineSender;this.timelineSenderTimer=new nn(6e4,function(){d.send(a)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(a,d,v){return this.global_emitter.bind(a,d,v),this}unbind(a,d,v){return this.global_emitter.unbind(a,d,v),this}bind_global(a){return this.global_emitter.bind_global(a),this}unbind_global(a){return this.global_emitter.unbind_global(a),this}unbind_all(a){return this.global_emitter.unbind_all(),this}subscribeAll(){var a;for(a in this.channels.channels)this.channels.channels.hasOwnProperty(a)&&this.subscribe(a)}subscribe(a){var d=this.channels.add(a,this);return d.subscriptionPending&&d.subscriptionCancelled?d.reinstateSubscription():!d.subscriptionPending&&this.connection.state==="connected"&&d.subscribe(),d}unsubscribe(a){var d=this.channels.find(a);d&&d.subscriptionPending?d.cancelSubscription():(d=this.channels.remove(a),d&&d.subscribed&&d.unsubscribe())}send_event(a,d,v){return this.connection.send_event(a,d,v)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}ye.instances=[],ye.isReady=!1,ye.logToConsole=!1,ye.Runtime=H,ye.ScriptReceivers=H.ScriptReceivers,ye.DependenciesReceivers=H.DependenciesReceivers,ye.auth_callbacks=H.auth_callbacks;var _t=t.default=ye;function oc(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}H.setup(ye)}])})})(jo);var Or=jo.exports;const Hr=Dr(Or);class Vo{constructor(e){h(this,"container");h(this,"onAction");h(this,"onFail");h(this,"initialTime");h(this,"timeLeft");h(this,"timerId");h(this,"payment");this.container=e.container,this.onAction=e.onAction,this.onFail=e.onFail,this.initialTime=1800,this.timeLeft=this.initialTime,this.timerId=null}attachListener(){const e=this.container.querySelector("#transfer-acn"),i=this.container.querySelector("#copy-acn"),t=this.container.querySelector("#acn-tooltip"),o=this.container.querySelector("#transfer-amount"),s=this.container.querySelector("#copy-amount"),r=this.container.querySelector("#amount-tooltip"),l=this.container.querySelector("#transfer-button");i&&e&&i.addEventListener("click",()=>{P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Started"}),t&&this.copyToClipboard(e.innerHTML,t)}),s&&o&&s.addEventListener("click",()=>{P.track("copy_transferAmount",{payment_method:"Transfer"}),r&&this.copyToClipboard(o.innerHTML.split(" ")[1].replace(/,/g,""),r)}),l&&l.addEventListener("click",()=>{this.onAction(5)})}startTimer(e){this.stopTimer(),this.timerId=window.setInterval(()=>{if(this.timeLeft>0){this.timeLeft-=1;const i=this.container.querySelector("#time-left");i&&(i.innerHTML=ri(this.timeLeft))}else this.stopTimer(),e==="check"&&this.onAction(2)},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}renderComponent(e){var g,f,y,C,k,S;e&&(this.payment=e),this.container.innerHTML=this.render();const i=this.container.querySelector("#transfer-amount"),t=this.container.querySelector("#transfer-bank"),o=this.container.querySelector("#account-name"),s=this.container.querySelector("#transfer-acn"),r=this.container.querySelector("#time-left"),l=((g=this.payment)==null?void 0:g.currency)||"USD",c=l==="USD"?(f=this.payment)==null?void 0:f.localCurrency:l;if(i&&(i.innerHTML=`${c} ${ke(l==="USD"?(y=this.payment)==null?void 0:y.localAmount:(C=this.payment)==null?void 0:C.amount,2)}`),t&&this.payment.bankDetails&&(t.innerHTML=(k=this.payment.bankDetails)==null?void 0:k.bankName),o&&this.payment.bankDetails&&(o.innerHTML=(S=this.payment.bankDetails)==null?void 0:S.accountName),s&&this.payment.bankDetails&&(s.innerHTML=this.payment.bankDetails.accountNumber),r&&(r.innerHTML=ri(this.initialTime)),this.startTimer("poll"),e.status==="inProgress"){const M="45654f3ce4c9512ea9a4",A="us2";var b=new Hr(M,{cluster:A}),p=b.subscribe(e.reference);p.bind("payment_status",_=>{_.status==="successful"?(clearInterval(this.timerId||void 0),this.onAction(6),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),_!=null&&_.redirectUrl&&setTimeout(()=>{const E=new URL(_.redirectUrl);E.searchParams.append("status",_.status),E.searchParams.append("reference",_.reference),window.location.href=E.toString()},1800)):_.status==="failed"&&(clearInterval(this.timerId||void 0),this.onFail(7,"Transfer failed"),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))})}this.attachListener()}render(){return Rr}}const Ur=`<div id="trasferConfirmationProgress">
895
+ */(function(n,e){(function(t,o){n.exports=o()})(window,function(){return function(i){var t={};function o(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return i[s].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=i,o.c=t,o.d=function(s,r,l){o.o(s,r)||Object.defineProperty(s,r,{enumerable:!0,get:l})},o.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},o.t=function(s,r){if(r&1&&(s=o(s)),r&8||r&4&&typeof s=="object"&&s&&s.__esModule)return s;var l=Object.create(null);if(o.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:s}),r&2&&typeof s!="string")for(var c in s)o.d(l,c,(function(b){return s[b]}).bind(null,c));return l},o.n=function(s){var r=s&&s.__esModule?function(){return s.default}:function(){return s};return o.d(r,"a",r),r},o.o=function(s,r){return Object.prototype.hasOwnProperty.call(s,r)},o.p="",o(o.s=2)}([function(i,t,o){var s=this&&this.__extends||function(){var k=function(S,M){return k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,_){A.__proto__=_}||function(A,_){for(var E in _)_.hasOwnProperty(E)&&(A[E]=_[E])},k(S,M)};return function(S,M){k(S,M);function A(){this.constructor=S}S.prototype=M===null?Object.create(M):(A.prototype=M.prototype,new A)}}();Object.defineProperty(t,"__esModule",{value:!0});var r=256,l=function(){function k(S){S===void 0&&(S="="),this._paddingCharacter=S}return k.prototype.encodedLength=function(S){return this._paddingCharacter?(S+2)/3*4|0:(S*8+5)/6|0},k.prototype.encode=function(S){for(var M="",A=0;A<S.length-2;A+=3){var _=S[A]<<16|S[A+1]<<8|S[A+2];M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),M+=this._encodeByte(_>>>1*6&63),M+=this._encodeByte(_>>>0*6&63)}var E=S.length-A;if(E>0){var _=S[A]<<16|(E===2?S[A+1]<<8:0);M+=this._encodeByte(_>>>3*6&63),M+=this._encodeByte(_>>>2*6&63),E===2?M+=this._encodeByte(_>>>1*6&63):M+=this._paddingCharacter||"",M+=this._paddingCharacter||""}return M},k.prototype.maxDecodedLength=function(S){return this._paddingCharacter?S/4*3|0:(S*6+7)/8|0},k.prototype.decodedLength=function(S){return this.maxDecodedLength(S.length-this._getPaddingLength(S))},k.prototype.decode=function(S){if(S.length===0)return new Uint8Array(0);for(var M=this._getPaddingLength(S),A=S.length-M,_=new Uint8Array(this.maxDecodedLength(A)),E=0,N=0,G=0,z=0,U=0,V=0,oe=0;N<A-4;N+=4)z=this._decodeChar(S.charCodeAt(N+0)),U=this._decodeChar(S.charCodeAt(N+1)),V=this._decodeChar(S.charCodeAt(N+2)),oe=this._decodeChar(S.charCodeAt(N+3)),_[E++]=z<<2|U>>>4,_[E++]=U<<4|V>>>2,_[E++]=V<<6|oe,G|=z&r,G|=U&r,G|=V&r,G|=oe&r;if(N<A-1&&(z=this._decodeChar(S.charCodeAt(N)),U=this._decodeChar(S.charCodeAt(N+1)),_[E++]=z<<2|U>>>4,G|=z&r,G|=U&r),N<A-2&&(V=this._decodeChar(S.charCodeAt(N+2)),_[E++]=U<<4|V>>>2,G|=V&r),N<A-3&&(oe=this._decodeChar(S.charCodeAt(N+3)),_[E++]=V<<6|oe,G|=oe&r),G!==0)throw new Error("Base64Coder: incorrect characters for decoding");return _},k.prototype._encodeByte=function(S){var M=S;return M+=65,M+=25-S>>>8&6,M+=51-S>>>8&-75,M+=61-S>>>8&-15,M+=62-S>>>8&3,String.fromCharCode(M)},k.prototype._decodeChar=function(S){var M=r;return M+=(42-S&S-44)>>>8&-r+S-43+62,M+=(46-S&S-48)>>>8&-r+S-47+63,M+=(47-S&S-58)>>>8&-r+S-48+52,M+=(64-S&S-91)>>>8&-r+S-65+0,M+=(96-S&S-123)>>>8&-r+S-97+26,M},k.prototype._getPaddingLength=function(S){var M=0;if(this._paddingCharacter){for(var A=S.length-1;A>=0&&S[A]===this._paddingCharacter;A--)M++;if(S.length<4||M>2)throw new Error("Base64Coder: incorrect padding")}return M},k}();t.Coder=l;var c=new l;function b(k){return c.encode(k)}t.encode=b;function p(k){return c.decode(k)}t.decode=p;var g=function(k){s(S,k);function S(){return k!==null&&k.apply(this,arguments)||this}return S.prototype._encodeByte=function(M){var A=M;return A+=65,A+=25-M>>>8&6,A+=51-M>>>8&-75,A+=61-M>>>8&-13,A+=62-M>>>8&49,String.fromCharCode(A)},S.prototype._decodeChar=function(M){var A=r;return A+=(44-M&M-46)>>>8&-r+M-45+62,A+=(94-M&M-96)>>>8&-r+M-95+63,A+=(47-M&M-58)>>>8&-r+M-48+52,A+=(64-M&M-91)>>>8&-r+M-65+0,A+=(96-M&M-123)>>>8&-r+M-97+26,A},S}(l);t.URLSafeCoder=g;var f=new g;function y(k){return f.encode(k)}t.encodeURLSafe=y;function C(k){return f.decode(k)}t.decodeURLSafe=C,t.encodedLength=function(k){return c.encodedLength(k)},t.maxDecodedLength=function(k){return c.maxDecodedLength(k)},t.decodedLength=function(k){return c.decodedLength(k)}},function(i,t,o){Object.defineProperty(t,"__esModule",{value:!0});var s="utf8: invalid string",r="utf8: invalid source encoding";function l(p){for(var g=new Uint8Array(c(p)),f=0,y=0;y<p.length;y++){var C=p.charCodeAt(y);C<128?g[f++]=C:C<2048?(g[f++]=192|C>>6,g[f++]=128|C&63):C<55296?(g[f++]=224|C>>12,g[f++]=128|C>>6&63,g[f++]=128|C&63):(y++,C=(C&1023)<<10,C|=p.charCodeAt(y)&1023,C+=65536,g[f++]=240|C>>18,g[f++]=128|C>>12&63,g[f++]=128|C>>6&63,g[f++]=128|C&63)}return g}t.encode=l;function c(p){for(var g=0,f=0;f<p.length;f++){var y=p.charCodeAt(f);if(y<128)g+=1;else if(y<2048)g+=2;else if(y<55296)g+=3;else if(y<=57343){if(f>=p.length-1)throw new Error(s);f++,g+=4}else throw new Error(s)}return g}t.encodedLength=c;function b(p){for(var g=[],f=0;f<p.length;f++){var y=p[f];if(y&128){var C=void 0;if(y<224){if(f>=p.length)throw new Error(r);var k=p[++f];if((k&192)!==128)throw new Error(r);y=(y&31)<<6|k&63,C=128}else if(y<240){if(f>=p.length-1)throw new Error(r);var k=p[++f],S=p[++f];if((k&192)!==128||(S&192)!==128)throw new Error(r);y=(y&15)<<12|(k&63)<<6|S&63,C=2048}else if(y<248){if(f>=p.length-2)throw new Error(r);var k=p[++f],S=p[++f],M=p[++f];if((k&192)!==128||(S&192)!==128||(M&192)!==128)throw new Error(r);y=(y&15)<<18|(k&63)<<12|(S&63)<<6|M&63,C=65536}else throw new Error(r);if(y<C||y>=55296&&y<=57343)throw new Error(r);if(y>=65536){if(y>1114111)throw new Error(r);y-=65536,g.push(String.fromCharCode(55296|y>>10)),y=56320|y&1023}}g.push(String.fromCharCode(y))}return g.join("")}t.decode=b},function(i,t,o){i.exports=o(3).default},function(i,t,o){o.r(t);class s{constructor(a,d){this.lastId=0,this.prefix=a,this.name=d}create(a){this.lastId++;var d=this.lastId,v=this.prefix+d,w=this.name+"["+d+"]",L=!1,T=function(){L||(a.apply(null,arguments),L=!0)};return this[d]=T,{number:d,id:v,name:w,callback:T}}remove(a){delete this[a.number]}}var r=new s("_pusher_script_","Pusher.ScriptReceivers"),l={VERSION:"8.4.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""},c=l;class b{constructor(a){this.options=a,this.receivers=a.receivers||r,this.loading={}}load(a,d,v){var w=this;if(w.loading[a]&&w.loading[a].length>0)w.loading[a].push(v);else{w.loading[a]=[v];var L=H.createScriptRequest(w.getPath(a,d)),T=w.receivers.create(function(I){if(w.receivers.remove(T),w.loading[a]){var O=w.loading[a];delete w.loading[a];for(var Z=function(me){me||L.cleanup()},Y=0;Y<O.length;Y++)O[Y](I,Z)}});L.send(T)}}getRoot(a){var d,v=H.getDocument().location.protocol;return a&&a.useTLS||v==="https:"?d=this.options.cdn_https:d=this.options.cdn_http,d.replace(/\/*$/,"")+"/"+this.options.version}getPath(a,d){return this.getRoot(d)+"/"+a+this.options.suffix+".js"}}var p=new s("_pusher_dependencies","Pusher.DependenciesReceivers"),g=new b({cdn_http:c.cdn_http,cdn_https:c.cdn_https,version:c.VERSION,suffix:c.dependency_suffix,receivers:p});const f={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}};var C={buildLogSuffix:function(u){const a="See:",d=f.urls[u];if(!d)return"";let v;return d.fullUrl?v=d.fullUrl:d.path&&(v=f.baseUrl+d.path),v?`${a} ${v}`:""}},k;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(k||(k={}));class S extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class _ extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class E extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class N extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class G extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class z extends Error{constructor(a){super(a),Object.setPrototypeOf(this,new.target.prototype)}}class U extends Error{constructor(a,d){super(d),this.status=a,Object.setPrototypeOf(this,new.target.prototype)}}var oe=function(u,a,d,v,w){const L=H.createXHR();L.open("POST",d.endpoint,!0),L.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var T in d.headers)L.setRequestHeader(T,d.headers[T]);if(d.headersProvider!=null){let I=d.headersProvider();for(var T in I)L.setRequestHeader(T,I[T])}return L.onreadystatechange=function(){if(L.readyState===4)if(L.status===200){let I,O=!1;try{I=JSON.parse(L.responseText),O=!0}catch{w(new U(200,`JSON returned from ${v.toString()} endpoint was invalid, yet status code was 200. Data was: ${L.responseText}`),null)}O&&w(null,I)}else{let I="";switch(v){case k.UserAuthentication:I=C.buildLogSuffix("authenticationEndpoint");break;case k.ChannelAuthorization:I=`Clients must be authorized to join private or presence channels. ${C.buildLogSuffix("authorizationEndpoint")}`;break}w(new U(L.status,`Unable to retrieve auth string from ${v.toString()} endpoint - received status: ${L.status} from ${d.endpoint}. ${I}`),null)}},L.send(a),L};function fe(u){return Xe(Te(u))}var K=String.fromCharCode,Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=function(u){var a=u.charCodeAt(0);return a<128?u:a<2048?K(192|a>>>6)+K(128|a&63):K(224|a>>>12&15)+K(128|a>>>6&63)+K(128|a&63)},Te=function(u){return u.replace(/[^\x00-\x7F]/g,ue)},Ae=function(u){var a=[0,2,1][u.length%3],d=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),v=[Me.charAt(d>>>18),Me.charAt(d>>>12&63),a>=2?"=":Me.charAt(d>>>6&63),a>=1?"=":Me.charAt(d&63)];return v.join("")},Xe=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,Ae)};class pn{constructor(a,d,v,w){this.clear=d,this.timer=a(()=>{this.timer&&(this.timer=w(this.timer))},v)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}var en=pn;function Sn(u){window.clearTimeout(u)}function bn(u){window.clearInterval(u)}class Ee extends en{constructor(a,d){super(setTimeout,Sn,a,function(v){return d(),null})}}class nn extends en{constructor(a,d){super(setInterval,bn,a,function(v){return d(),v})}}var _n={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Ee(0,u)},method(u,...a){var d=Array.prototype.slice.call(arguments,1);return function(v){return v[u].apply(v,d.concat(arguments))}}},re=_n;function be(u,...a){for(var d=0;d<a.length;d++){var v=a[d];for(var w in v)v[w]&&v[w].constructor&&v[w].constructor===Object?u[w]=be(u[w]||{},v[w]):u[w]=v[w]}return u}function Re(){for(var u=["Pusher"],a=0;a<arguments.length;a++)typeof arguments[a]=="string"?u.push(arguments[a]):u.push(Bi(arguments[a]));return u.join(" : ")}function Pe(u,a){var d=Array.prototype.indexOf;if(u===null)return-1;if(d&&u.indexOf===d)return u.indexOf(a);for(var v=0,w=u.length;v<w;v++)if(u[v]===a)return v;return-1}function Ce(u,a){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&a(u[d],d,u)}function qe(u){var a=[];return Ce(u,function(d,v){a.push(v)}),a}function B(u){var a=[];return Ce(u,function(d){a.push(d)}),a}function he(u,a,d){for(var v=0;v<u.length;v++)a.call(d||window,u[v],v,u)}function $(u,a){for(var d=[],v=0;v<u.length;v++)d.push(a(u[v],v,u,d));return d}function ge(u,a){var d={};return Ce(u,function(v,w){d[w]=a(v)}),d}function We(u,a){a=a||function(w){return!!w};for(var d=[],v=0;v<u.length;v++)a(u[v],v,u,d)&&d.push(u[v]);return d}function Q(u,a){var d={};return Ce(u,function(v,w){(a&&a(v,w,u,d)||v)&&(d[w]=v)}),d}function ni(u){var a=[];return Ce(u,function(d,v){a.push([v,d])}),a}function $o(u,a){for(var d=0;d<u.length;d++)if(a(u[d],d,u))return!0;return!1}function gl(u,a){for(var d=0;d<u.length;d++)if(!a(u[d],d,u))return!1;return!0}function yl(u){return ge(u,function(a){return typeof a=="object"&&(a=Bi(a)),encodeURIComponent(fe(a.toString()))})}function kl(u){var a=Q(u,function(v){return v!==void 0}),d=$(ni(yl(a)),re.method("join","=")).join("&");return d}function wl(u){var a=[],d=[];return function v(w,L){var T,I,O;switch(typeof w){case"object":if(!w)return null;for(T=0;T<a.length;T+=1)if(a[T]===w)return{$ref:d[T]};if(a.push(w),d.push(L),Object.prototype.toString.apply(w)==="[object Array]")for(O=[],T=0;T<w.length;T+=1)O[T]=v(w[T],L+"["+T+"]");else{O={};for(I in w)Object.prototype.hasOwnProperty.call(w,I)&&(O[I]=v(w[I],L+"["+JSON.stringify(I)+"]"))}return O;case"number":case"string":case"boolean":return w}}(u,"$")}function Bi(u){try{return JSON.stringify(u)}catch{return JSON.stringify(wl(u))}}class Cl{constructor(){this.globalLog=a=>{window.console&&window.console.log&&window.console.log(a)}}debug(...a){this.log(this.globalLog,a)}warn(...a){this.log(this.globalLogWarn,a)}error(...a){this.log(this.globalLogError,a)}globalLogWarn(a){window.console&&window.console.warn?window.console.warn(a):this.globalLog(a)}globalLogError(a){window.console&&window.console.error?window.console.error(a):this.globalLogWarn(a)}log(a,...d){var v=Re.apply(this,arguments);_t.log?_t.log(v):_t.logToConsole&&a.bind(this)(v)}}var se=new Cl,Sl=function(u,a,d,v,w){(d.headers!==void 0||d.headersProvider!=null)&&se.warn(`To send headers with the ${v.toString()} request, you must use AJAX, rather than JSONP.`);var L=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var T=u.getDocument(),I=T.createElement("script");u.auth_callbacks[L]=function(Y){w(null,Y)};var O="Pusher.auth_callbacks['"+L+"']";I.src=d.endpoint+"?callback="+encodeURIComponent(O)+"&"+a;var Z=T.getElementsByTagName("head")[0]||T.documentElement;Z.insertBefore(I,Z.firstChild)},_l=Sl;class Ml{constructor(a){this.src=a}send(a){var d=this,v="Error loading "+d.src;d.script=document.createElement("script"),d.script.id=a.id,d.script.src=d.src,d.script.type="text/javascript",d.script.charset="UTF-8",d.script.addEventListener?(d.script.onerror=function(){a.callback(v)},d.script.onload=function(){a.callback(null)}):d.script.onreadystatechange=function(){(d.script.readyState==="loaded"||d.script.readyState==="complete")&&a.callback(null)},d.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(d.errorScript=document.createElement("script"),d.errorScript.id=a.id+"_error",d.errorScript.text=a.name+"('"+v+"');",d.script.async=d.errorScript.async=!1):d.script.async=!0;var w=document.getElementsByTagName("head")[0];w.insertBefore(d.script,w.firstChild),d.errorScript&&w.insertBefore(d.errorScript,d.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class Al{constructor(a,d){this.url=a,this.data=d}send(a){if(!this.request){var d=kl(this.data),v=this.url+"/"+a.number+"?"+d;this.request=H.createScriptRequest(v),this.request.send(a)}}cleanup(){this.request&&this.request.cleanup()}}var xl=function(u,a){return function(d,v){var w="http"+(a?"s":"")+"://",L=w+(u.host||u.options.host)+u.options.path,T=H.createJSONPRequest(L,d),I=H.ScriptReceivers.create(function(O,Z){r.remove(I),T.cleanup(),Z&&Z.host&&(u.host=Z.host),v&&v(O,Z)});T.send(I)}},Ll={name:"jsonp",getAgent:xl},Tl=Ll;function pt(u,a,d){var v=u+(a.useTLS?"s":""),w=a.useTLS?a.hostTLS:a.hostNonTLS;return v+"://"+w+d}function bt(u,a){var d="/app/"+u,v="?protocol="+c.PROTOCOL+"&client=js&version="+c.VERSION+(a?"&"+a:"");return d+v}var El={getInitial:function(u,a){var d=(a.httpPath||"")+bt(u,"flash=false");return pt("ws",a,d)}},Pl={getInitial:function(u,a){var d=(a.httpPath||"/pusher")+bt(u);return pt("http",a,d)}},Nl={getInitial:function(u,a){return pt("http",a,a.httpPath||"/pusher")},getPath:function(u,a){return bt(u)}};class Il{constructor(){this._callbacks={}}get(a){return this._callbacks[vt(a)]}add(a,d,v){var w=vt(a);this._callbacks[w]=this._callbacks[w]||[],this._callbacks[w].push({fn:d,context:v})}remove(a,d,v){if(!a&&!d&&!v){this._callbacks={};return}var w=a?[vt(a)]:qe(this._callbacks);d||v?this.removeCallback(w,d,v):this.removeAllCallbacks(w)}removeCallback(a,d,v){he(a,function(w){this._callbacks[w]=We(this._callbacks[w]||[],function(L){return d&&d!==L.fn||v&&v!==L.context}),this._callbacks[w].length===0&&delete this._callbacks[w]},this)}removeAllCallbacks(a){he(a,function(d){delete this._callbacks[d]},this)}}function vt(u){return"_"+u}class tn{constructor(a){this.callbacks=new Il,this.global_callbacks=[],this.failThrough=a}bind(a,d,v){return this.callbacks.add(a,d,v),this}bind_global(a){return this.global_callbacks.push(a),this}unbind(a,d,v){return this.callbacks.remove(a,d,v),this}unbind_global(a){return a?(this.global_callbacks=We(this.global_callbacks||[],d=>d!==a),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(a,d,v){for(var w=0;w<this.global_callbacks.length;w++)this.global_callbacks[w](a,d);var L=this.callbacks.get(a),T=[];if(v?T.push(d,v):d&&T.push(d),L&&L.length>0)for(var w=0;w<L.length;w++)L[w].fn.apply(L[w].context||window,T);else this.failThrough&&this.failThrough(a,d);return this}}class Bl extends tn{constructor(a,d,v,w,L){super(),this.initialize=H.transportConnectionInitializer,this.hooks=a,this.name=d,this.priority=v,this.key=w,this.options=L,this.state="new",this.timeline=L.timeline,this.activityTimeout=L.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var a=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(a,this.options)}catch(d){return re.defer(()=>{this.onError(d),this.changeState("closed")}),!1}return this.bindListeners(),se.debug("Connecting",{transport:this.name,url:a}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(a){return this.state==="open"?(re.defer(()=>{this.socket&&this.socket.send(a)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(a){this.emit("error",{type:"WebSocketError",error:a}),this.timeline.error(this.buildTimelineMessage({error:a.toString()}))}onClose(a){a?this.changeState("closed",{code:a.code,reason:a.reason,wasClean:a.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(a){this.emit("message",a)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=a=>{this.onError(a)},this.socket.onclose=a=>{this.onClose(a)},this.socket.onmessage=a=>{this.onMessage(a)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(a,d){this.state=a,this.timeline.info(this.buildTimelineMessage({state:a,params:d})),this.emit(a,d)}buildTimelineMessage(a){return be({cid:this.id},a)}}class jn{constructor(a){this.hooks=a}isSupported(a){return this.hooks.isSupported(a)}createConnection(a,d,v,w){return new Bl(this.hooks,a,d,v,w)}}var Rl=new jn({urls:El,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!H.getWebSocketAPI()},isSupported:function(){return!!H.getWebSocketAPI()},getSocket:function(u){return H.createWebSocket(u)}}),Yo={urls:Pl,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Qo=be({getSocket:function(u){return H.HTTPFactory.createStreamingSocket(u)}},Yo),Xo=be({getSocket:function(u){return H.HTTPFactory.createPollingSocket(u)}},Yo),es={isSupported:function(){return H.isXHRSupported()}},Dl=new jn(be({},Qo,es)),Ol=new jn(be({},Xo,es)),Hl={ws:Rl,xhr_streaming:Dl,xhr_polling:Ol},Ri=Hl,Ul=new jn({file:"sockjs",urls:Nl,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,a){return new window.SockJS(u,null,{js_path:g.getPath("sockjs",{useTLS:a.useTLS}),ignore_null_origin:a.ignoreNullOrigin})},beforeOpen:function(u,a){u.send(JSON.stringify({path:a}))}}),ns={isSupported:function(u){var a=H.isXDRSupported(u.useTLS);return a}},Kl=new jn(be({},Qo,ns)),jl=new jn(be({},Xo,ns));Ri.xdr_streaming=Kl,Ri.xdr_polling=jl,Ri.sockjs=Ul;var Vl=Ri;class Gl extends tn{constructor(){super();var a=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){a.emit("online")},!1),window.addEventListener("offline",function(){a.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var zl=new Gl;class Fl{constructor(a,d,v){this.manager=a,this.transport=d,this.minPingDelay=v.minPingDelay,this.maxPingDelay=v.maxPingDelay,this.pingDelay=void 0}createConnection(a,d,v,w){w=be({},w,{activityTimeout:this.pingDelay});var L=this.transport.createConnection(a,d,v,w),T=null,I=function(){L.unbind("open",I),L.bind("closed",O),T=re.now()},O=Z=>{if(L.unbind("closed",O),Z.code===1002||Z.code===1003)this.manager.reportDeath();else if(!Z.wasClean&&T){var Y=re.now()-T;Y<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(Y/2,this.minPingDelay))}};return L.bind("open",I),L}isSupported(a){return this.manager.isAlive()&&this.transport.isSupported(a)}}const is={decodeMessage:function(u){try{var a=JSON.parse(u.data),d=a.data;if(typeof d=="string")try{d=JSON.parse(a.data)}catch{}var v={event:a.event,channel:a.channel,data:d};return a.user_id&&(v.user_id=a.user_id),v}catch(w){throw{type:"MessageParseError",error:w,data:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var a=is.decodeMessage(u);if(a.event==="pusher:connection_established"){if(!a.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:a.data.socket_id,activityTimeout:a.data.activity_timeout*1e3}}else{if(a.event==="pusher:error")return{action:this.getCloseAction(a.data),error:this.getCloseError(a.data)};throw"Invalid handshake"}},getCloseAction:function(u){return u.code<4e3?u.code>=1002&&u.code<=1004?"backoff":null:u.code===4e3?"tls_only":u.code<4100?"refused":u.code<4200?"backoff":u.code<4300?"retry":"refused"},getCloseError:function(u){return u.code!==1e3&&u.code!==1001?{type:"PusherError",data:{code:u.code,message:u.reason||u.message}}:null}};var Mn=is;class ql extends tn{constructor(a,d){super(),this.id=a,this.transport=d,this.activityTimeout=d.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(a){return this.transport.send(a)}send_event(a,d,v){var w={event:a,data:d};return v&&(w.channel=v),se.debug("Event sent",w),this.send(Mn.encodeMessage(w))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var a={message:v=>{var w;try{w=Mn.decodeMessage(v)}catch(L){this.emit("error",{type:"MessageParseError",error:L,data:v.data})}if(w!==void 0){switch(se.debug("Event recd",w),w.event){case"pusher:error":this.emit("error",{type:"PusherError",data:w.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",w)}},activity:()=>{this.emit("activity")},error:v=>{this.emit("error",v)},closed:v=>{d(),v&&v.code&&this.handleCloseEvent(v),this.transport=null,this.emit("closed")}},d=()=>{Ce(a,(v,w)=>{this.transport.unbind(w,v)})};Ce(a,(v,w)=>{this.transport.bind(w,v)})}handleCloseEvent(a){var d=Mn.getCloseAction(a),v=Mn.getCloseError(a);v&&this.emit("error",v),d&&this.emit(d,{action:d,error:v})}}class Wl{constructor(a,d){this.transport=a,this.callback=d,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=a=>{this.unbindListeners();var d;try{d=Mn.processHandshake(a)}catch(v){this.finish("error",{error:v}),this.transport.close();return}d.action==="connected"?this.finish("connected",{connection:new ql(d.id,this.transport),activityTimeout:d.activityTimeout}):(this.finish(d.action,{error:d.error}),this.transport.close())},this.onClosed=a=>{this.unbindListeners();var d=Mn.getCloseAction(a)||"backoff",v=Mn.getCloseError(a);this.finish(d,{error:v})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(a,d){this.callback(be({transport:this.transport,action:a},d))}}class Zl{constructor(a,d){this.timeline=a,this.options=d||{}}send(a,d){this.timeline.isEmpty()||this.timeline.send(H.TimelineTransport.getAgent(this,a),d)}}class ft extends tn{constructor(a,d){super(function(v,w){se.debug("No callbacks on "+a+" for "+v)}),this.name=a,this.pusher=d,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(a,d){return d(null,{auth:""})}trigger(a,d){if(a.indexOf("client-")!==0)throw new S("Event '"+a+"' does not start with 'client-'");if(!this.subscribed){var v=C.buildLogSuffix("triggeringClientEvents");se.warn(`Client event triggered before channel 'subscription_succeeded' event . ${v}`)}return this.pusher.send_event(a,d,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(a){var d=a.event,v=a.data;if(d==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(a);else if(d==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(a);else if(d.indexOf("pusher_internal:")!==0){var w={};this.emit(d,v,w)}}handleSubscriptionSucceededEvent(a){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",a.data)}handleSubscriptionCountEvent(a){a.data.subscription_count&&(this.subscriptionCount=a.data.subscription_count),this.emit("pusher:subscription_count",a.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(a,d)=>{a?(this.subscriptionPending=!1,se.error(a.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:a.message},a instanceof U?{status:a.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:d.auth,channel_data:d.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class gt extends ft{authorize(a,d){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:a},d)}}class Jl{constructor(){this.reset()}get(a){return Object.prototype.hasOwnProperty.call(this.members,a)?{id:a,info:this.members[a]}:null}each(a){Ce(this.members,(d,v)=>{a(this.get(v))})}setMyID(a){this.myID=a}onSubscription(a){this.members=a.presence.hash,this.count=a.presence.count,this.me=this.get(this.myID)}addMember(a){return this.get(a.user_id)===null&&this.count++,this.members[a.user_id]=a.user_info,this.get(a.user_id)}removeMember(a){var d=this.get(a.user_id);return d&&(delete this.members[a.user_id],this.count--),d}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var $l=function(u,a,d,v){function w(L){return L instanceof d?L:new d(function(T){T(L)})}return new(d||(d=Promise))(function(L,T){function I(Y){try{Z(v.next(Y))}catch(me){T(me)}}function O(Y){try{Z(v.throw(Y))}catch(me){T(me)}}function Z(Y){Y.done?L(Y.value):w(Y.value).then(I,O)}Z((v=v.apply(u,a||[])).next())})};class Yl extends gt{constructor(a,d){super(a,d),this.members=new Jl}authorize(a,d){super.authorize(a,(v,w)=>$l(this,void 0,void 0,function*(){if(!v)if(w=w,w.channel_data!=null){var L=JSON.parse(w.channel_data);this.members.setMyID(L.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let T=C.buildLogSuffix("authorizationEndpoint");se.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${T}, or the user should be signed in.`),d("Invalid auth response");return}d(v,w)}))}handleEvent(a){var d=a.event;if(d.indexOf("pusher_internal:")===0)this.handleInternalEvent(a);else{var v=a.data,w={};a.user_id&&(w.user_id=a.user_id),this.emit(d,v,w)}}handleInternalEvent(a){var d=a.event,v=a.data;switch(d){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(a);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(a);break;case"pusher_internal:member_added":var w=this.members.addMember(v);this.emit("pusher:member_added",w);break;case"pusher_internal:member_removed":var L=this.members.removeMember(v);L&&this.emit("pusher:member_removed",L);break}}handleSubscriptionSucceededEvent(a){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(a.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Ql=o(1),yt=o(0);class Xl extends gt{constructor(a,d,v){super(a,d),this.key=null,this.nacl=v}authorize(a,d){super.authorize(a,(v,w)=>{if(v){d(v,w);return}let L=w.shared_secret;if(!L){d(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=Object(yt.decode)(L),delete w.shared_secret,d(null,w)})}trigger(a,d){throw new N("Client events are not currently supported for encrypted channels")}handleEvent(a){var d=a.event,v=a.data;if(d.indexOf("pusher_internal:")===0||d.indexOf("pusher:")===0){super.handleEvent(a);return}this.handleEncryptedEvent(d,v)}handleEncryptedEvent(a,d){if(!this.key){se.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!d.ciphertext||!d.nonce){se.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+d);return}let v=Object(yt.decode)(d.ciphertext);if(v.length<this.nacl.secretbox.overheadLength){se.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${v.length}`);return}let w=Object(yt.decode)(d.nonce);if(w.length<this.nacl.secretbox.nonceLength){se.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${w.length}`);return}let L=this.nacl.secretbox.open(v,w,this.key);if(L===null){se.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(T,I)=>{if(T){se.error(`Failed to make a request to the authEndpoint: ${I}. Unable to fetch new key, so dropping encrypted event`);return}if(L=this.nacl.secretbox.open(v,w,this.key),L===null){se.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(a,this.getDataToEmit(L))});return}this.emit(a,this.getDataToEmit(L))}getDataToEmit(a){let d=Object(Ql.decode)(a);try{return JSON.parse(d)}catch{return d}}}class ed extends tn{constructor(a,d){super(),this.state="initialized",this.connection=null,this.key=a,this.options=d,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var v=H.getNetwork();v.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),v.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(a){return this.connection?this.connection.send(a):!1}send_event(a,d,v){return this.connection?this.connection.send_event(a,d,v):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var a=(d,v)=>{d?this.runner=this.strategy.connect(0,a):v.action==="error"?(this.emit("error",{type:"HandshakeError",error:v.error}),this.timeline.error({handshakeError:v.error})):(this.abortConnecting(),this.handshakeCallbacks[v.action](v))};this.runner=this.strategy.connect(0,a)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var a=this.abandonConnection();a.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(a){this.timeline.info({action:"retry",delay:a}),a>0&&this.emit("connecting_in",Math.round(a/1e3)),this.retryTimer=new Ee(a||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Ee(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Ee(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new Ee(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(a){return be({},a,{message:d=>{this.resetActivityCheck(),this.emit("message",d)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:d=>{this.emit("error",d)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(a){return be({},a,{connected:d=>{this.activityTimeout=Math.min(this.options.activityTimeout,d.activityTimeout,d.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(d.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let a=d=>v=>{v.error&&this.emit("error",{type:"WebSocketError",error:v.error}),d(v)};return{tls_only:a(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:a(()=>{this.disconnect()}),backoff:a(()=>{this.retryIn(1e3)}),retry:a(()=>{this.retryIn(0)})}}setConnection(a){this.connection=a;for(var d in this.connectionCallbacks)this.connection.bind(d,this.connectionCallbacks[d]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var a in this.connectionCallbacks)this.connection.unbind(a,this.connectionCallbacks[a]);var d=this.connection;return this.connection=null,d}}updateState(a,d){var v=this.state;if(this.state=a,v!==a){var w=a;w==="connected"&&(w+=" with new socket ID "+d.socket_id),se.debug("State changed",v+" -> "+w),this.timeline.info({state:a,params:d}),this.emit("state_change",{previous:v,current:a}),this.emit(a,d)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class nd{constructor(){this.channels={}}add(a,d){return this.channels[a]||(this.channels[a]=id(a,d)),this.channels[a]}all(){return B(this.channels)}find(a){return this.channels[a]}remove(a){var d=this.channels[a];return delete this.channels[a],d}disconnect(){Ce(this.channels,function(a){a.disconnect()})}}function id(u,a){if(u.indexOf("private-encrypted-")===0){if(a.config.nacl)return on.createEncryptedChannel(u,a,a.config.nacl);let d="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",v=C.buildLogSuffix("encryptedChannelSupport");throw new N(`${d}. ${v}`)}else{if(u.indexOf("private-")===0)return on.createPrivateChannel(u,a);if(u.indexOf("presence-")===0)return on.createPresenceChannel(u,a);if(u.indexOf("#")===0)throw new M('Cannot create a channel with name "'+u+'".');return on.createChannel(u,a)}}var td={createChannels(){return new nd},createConnectionManager(u,a){return new ed(u,a)},createChannel(u,a){return new ft(u,a)},createPrivateChannel(u,a){return new gt(u,a)},createPresenceChannel(u,a){return new Yl(u,a)},createEncryptedChannel(u,a,d){return new Xl(u,a,d)},createTimelineSender(u,a){return new Zl(u,a)},createHandshake(u,a){return new Wl(u,a)},createAssistantToTheTransportManager(u,a,d){return new Fl(u,a,d)}},on=td;class ts{constructor(a){this.options=a||{},this.livesLeft=this.options.lives||1/0}getAssistant(a){return on.createAssistantToTheTransportManager(this,a,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class An{constructor(a,d){this.strategies=a,this.loop=!!d.loop,this.failFast=!!d.failFast,this.timeout=d.timeout,this.timeoutLimit=d.timeoutLimit}isSupported(){return $o(this.strategies,re.method("isSupported"))}connect(a,d){var v=this.strategies,w=0,L=this.timeout,T=null,I=(O,Z)=>{Z?d(null,Z):(w=w+1,this.loop&&(w=w%v.length),w<v.length?(L&&(L=L*2,this.timeoutLimit&&(L=Math.min(L,this.timeoutLimit))),T=this.tryStrategy(v[w],a,{timeout:L,failFast:this.failFast},I)):d(!0))};return T=this.tryStrategy(v[w],a,{timeout:L,failFast:this.failFast},I),{abort:function(){T.abort()},forceMinPriority:function(O){a=O,T&&T.forceMinPriority(O)}}}tryStrategy(a,d,v,w){var L=null,T=null;return v.timeout>0&&(L=new Ee(v.timeout,function(){T.abort(),w(!0)})),T=a.connect(d,function(I,O){I&&L&&L.isRunning()&&!v.failFast||(L&&L.ensureAborted(),w(I,O))}),{abort:function(){L&&L.ensureAborted(),T.abort()},forceMinPriority:function(I){T.forceMinPriority(I)}}}}class kt{constructor(a){this.strategies=a}isSupported(){return $o(this.strategies,re.method("isSupported"))}connect(a,d){return od(this.strategies,a,function(v,w){return function(L,T){if(w[v].error=L,L){sd(w)&&d(!0);return}he(w,function(I){I.forceMinPriority(T.transport.priority)}),d(null,T)}})}}function od(u,a,d){var v=$(u,function(w,L,T,I){return w.connect(a,d(L,I))});return{abort:function(){he(v,ad)},forceMinPriority:function(w){he(v,function(L){L.forceMinPriority(w)})}}}function sd(u){return gl(u,function(a){return!!a.error})}function ad(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class rd{constructor(a,d,v){this.strategy=a,this.transports=d,this.ttl=v.ttl||1800*1e3,this.usingTLS=v.useTLS,this.timeline=v.timeline}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.usingTLS,w=ld(v),L=w&&w.cacheSkipCount?w.cacheSkipCount:0,T=[this.strategy];if(w&&w.timestamp+this.ttl>=re.now()){var I=this.transports[w.transport];I&&(["ws","wss"].includes(w.transport)||L>3?(this.timeline.info({cached:!0,transport:w.transport,latency:w.latency}),T.push(new An([I],{timeout:w.latency*2+1e3,failFast:!0}))):L++)}var O=re.now(),Z=T.pop().connect(a,function Y(me,Hi){me?(os(v),T.length>0?(O=re.now(),Z=T.pop().connect(a,Y)):d(me)):(dd(v,Hi.transport.name,re.now()-O,L),d(null,Hi))});return{abort:function(){Z.abort()},forceMinPriority:function(Y){a=Y,Z&&Z.forceMinPriority(Y)}}}}function wt(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function ld(u){var a=H.getLocalStorage();if(a)try{var d=a[wt(u)];if(d)return JSON.parse(d)}catch{os(u)}return null}function dd(u,a,d,v){var w=H.getLocalStorage();if(w)try{w[wt(u)]=Bi({timestamp:re.now(),transport:a,latency:d,cacheSkipCount:v})}catch{}}function os(u){var a=H.getLocalStorage();if(a)try{delete a[wt(u)]}catch{}}class Di{constructor(a,{delay:d}){this.strategy=a,this.options={delay:d}}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.strategy,w,L=new Ee(this.options.delay,function(){w=v.connect(a,d)});return{abort:function(){L.ensureAborted(),w&&w.abort()},forceMinPriority:function(T){a=T,w&&w.forceMinPriority(T)}}}}class ii{constructor(a,d,v){this.test=a,this.trueBranch=d,this.falseBranch=v}isSupported(){var a=this.test()?this.trueBranch:this.falseBranch;return a.isSupported()}connect(a,d){var v=this.test()?this.trueBranch:this.falseBranch;return v.connect(a,d)}}class cd{constructor(a){this.strategy=a}isSupported(){return this.strategy.isSupported()}connect(a,d){var v=this.strategy.connect(a,function(w,L){L&&v.abort(),d(w,L)});return v}}function ti(u){return function(){return u.isSupported()}}var ud=function(u,a,d){var v={};function w(bs,cc,uc,hc,mc){var vs=d(u,bs,cc,uc,hc,mc);return v[bs]=vs,vs}var L=Object.assign({},a,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),T=Object.assign({},L,{useTLS:!0}),I=Object.assign({},a,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),O={loop:!0,timeout:15e3,timeoutLimit:6e4},Z=new ts({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),Y=new ts({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),me=w("ws","ws",3,L,Z),Hi=w("wss","ws",3,T,Z),sc=w("sockjs","sockjs",1,I),ds=w("xhr_streaming","xhr_streaming",1,I,Y),ac=w("xdr_streaming","xdr_streaming",1,I,Y),cs=w("xhr_polling","xhr_polling",1,I),rc=w("xdr_polling","xdr_polling",1,I),us=new An([me],O),lc=new An([Hi],O),dc=new An([sc],O),hs=new An([new ii(ti(ds),ds,ac)],O),ms=new An([new ii(ti(cs),cs,rc)],O),ps=new An([new ii(ti(hs),new kt([hs,new Di(ms,{delay:4e3})]),ms)],O),Mt=new ii(ti(ps),ps,dc),At;return a.useTLS?At=new kt([us,new Di(Mt,{delay:2e3})]):At=new kt([us,new Di(lc,{delay:2e3}),new Di(Mt,{delay:5e3})]),new rd(new cd(new ii(ti(me),At,Mt)),v,{ttl:18e5,timeline:a.timeline,useTLS:a.useTLS})},hd=ud,md=function(){var u=this;u.timeline.info(u.buildTimelineMessage({transport:u.name+(u.options.useTLS?"s":"")})),u.hooks.isInitialized()?u.changeState("initialized"):u.hooks.file?(u.changeState("initializing"),g.load(u.hooks.file,{useTLS:u.options.useTLS},function(a,d){u.hooks.isInitialized()?(u.changeState("initialized"),d(!0)):(a&&u.onError(a),u.onClose(),d(!1))})):u.onClose()},pd={getRequest:function(u){var a=new window.XDomainRequest;return a.ontimeout=function(){u.emit("error",new A),u.close()},a.onerror=function(d){u.emit("error",d),u.close()},a.onprogress=function(){a.responseText&&a.responseText.length>0&&u.onChunk(200,a.responseText)},a.onload=function(){a.responseText&&a.responseText.length>0&&u.onChunk(200,a.responseText),u.emit("finished",200),u.close()},a},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}},bd=pd;const vd=256*1024;class fd extends tn{constructor(a,d,v){super(),this.hooks=a,this.method=d,this.url=v}start(a){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},H.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(a)}close(){this.unloader&&(H.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(a,d){for(;;){var v=this.advanceBuffer(d);if(v)this.emit("chunk",{status:a,data:v});else break}this.isBufferTooLong(d)&&this.emit("buffer_too_long")}advanceBuffer(a){var d=a.slice(this.position),v=d.indexOf(`
896
+ `);return v!==-1?(this.position+=v+1,d.slice(0,v)):null}isBufferTooLong(a){return this.position===a.length&&a.length>vd}}var Ct;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(Ct||(Ct={}));var xn=Ct,gd=1;class yd{constructor(a,d){this.hooks=a,this.session=as(1e3)+"/"+Sd(8),this.location=kd(d),this.readyState=xn.CONNECTING,this.openStream()}send(a){return this.sendRaw(JSON.stringify([a]))}ping(){this.hooks.sendHeartbeat(this)}close(a,d){this.onClose(a,d,!0)}sendRaw(a){if(this.readyState===xn.OPEN)try{return H.createSocketRequest("POST",ss(wd(this.location,this.session))).start(a),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(a,d,v){this.closeStream(),this.readyState=xn.CLOSED,this.onclose&&this.onclose({code:a,reason:d,wasClean:v})}onChunk(a){if(a.status===200){this.readyState===xn.OPEN&&this.onActivity();var d,v=a.data.slice(0,1);switch(v){case"o":d=JSON.parse(a.data.slice(1)||"{}"),this.onOpen(d);break;case"a":d=JSON.parse(a.data.slice(1)||"[]");for(var w=0;w<d.length;w++)this.onEvent(d[w]);break;case"m":d=JSON.parse(a.data.slice(1)||"null"),this.onEvent(d);break;case"h":this.hooks.onHeartbeat(this);break;case"c":d=JSON.parse(a.data.slice(1)||"[]"),this.onClose(d[0],d[1],!0);break}}}onOpen(a){this.readyState===xn.CONNECTING?(a&&a.hostname&&(this.location.base=Cd(this.location.base,a.hostname)),this.readyState=xn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(a){this.readyState===xn.OPEN&&this.onmessage&&this.onmessage({data:a})}onActivity(){this.onactivity&&this.onactivity()}onError(a){this.onerror&&this.onerror(a)}openStream(){this.stream=H.createSocketRequest("POST",ss(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",a=>{this.onChunk(a)}),this.stream.bind("finished",a=>{this.hooks.onFinished(this,a)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(a){re.defer(()=>{this.onError(a),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function kd(u){var a=/([^\?]*)\/*(\??.*)/.exec(u);return{base:a[1],queryString:a[2]}}function wd(u,a){return u.base+"/"+a+"/xhr_send"}function ss(u){var a=u.indexOf("?")===-1?"?":"&";return u+a+"t="+ +new Date+"&n="+gd++}function Cd(u,a){var d=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return d[1]+a+d[3]}function as(u){return H.randomInt(u)}function Sd(u){for(var a=[],d=0;d<u;d++)a.push(as(32).toString(32));return a.join("")}var _d=yd,Md={getReceiveURL:function(u,a){return u.base+"/"+a+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,a){u.onClose(1006,"Connection interrupted ("+a+")",!1)}},Ad=Md,xd={getReceiveURL:function(u,a){return u.base+"/"+a+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,a){a===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+a+")",!1)}},Ld=xd,Td={getRequest:function(u){var a=H.getXHRAPI(),d=new a;return d.onreadystatechange=d.onprogress=function(){switch(d.readyState){case 3:d.responseText&&d.responseText.length>0&&u.onChunk(d.status,d.responseText);break;case 4:d.responseText&&d.responseText.length>0&&u.onChunk(d.status,d.responseText),u.emit("finished",d.status),u.close();break}},d},abortRequest:function(u){u.onreadystatechange=null,u.abort()}},Ed=Td,Pd={createStreamingSocket(u){return this.createSocket(Ad,u)},createPollingSocket(u){return this.createSocket(Ld,u)},createSocket(u,a){return new _d(u,a)},createXHR(u,a){return this.createRequest(Ed,u,a)},createRequest(u,a,d){return new fd(u,a,d)}},rs=Pd;rs.createXDR=function(u,a){return this.createRequest(bd,u,a)};var Nd=rs,Id={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:r,DependenciesReceivers:p,getDefaultStrategy:hd,Transports:Vl,transportConnectionInitializer:md,HTTPFactory:Nd,TimelineTransport:Tl,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var a=()=>{this.onDocumentBody(u.ready)};window.JSON?a():g.load("json2",{},a)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:oe,jsonp:_l}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,a){return new Al(u,a)},createScriptRequest(u){return new Ml(u)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var u=this.getXHRAPI();return new u},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return zl},createWebSocket(u){var a=this.getWebSocketAPI();return new a(u)},createSocketRequest(u,a){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,a);if(this.isXDRSupported(a.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,a);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var a=u?"https:":"http:",d=this.getProtocol();return!!window.XDomainRequest&&d===a},addUnloadListener(u){window.addEventListener!==void 0?window.addEventListener("unload",u,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",u)},removeUnloadListener(u){window.addEventListener!==void 0?window.removeEventListener("unload",u,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",u)},randomInt(u){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*u)}},H=Id,St;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(St||(St={}));var Oi=St;class Bd{constructor(a,d,v){this.key=a,this.session=d,this.events=[],this.options=v||{},this.sent=0,this.uniqueID=0}log(a,d){a<=this.options.level&&(this.events.push(be({},d,{timestamp:re.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(a){this.log(Oi.ERROR,a)}info(a){this.log(Oi.INFO,a)}debug(a){this.log(Oi.DEBUG,a)}isEmpty(){return this.events.length===0}send(a,d){var v=be({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],a(v,(w,L)=>{w||this.sent++,d&&d(w,L)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Rd{constructor(a,d,v,w){this.name=a,this.priority=d,this.transport=v,this.options=w||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(a,d){if(this.isSupported()){if(this.priority<a)return ls(new _,d)}else return ls(new z,d);var v=!1,w=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),L=null,T=function(){w.unbind("initialized",T),w.connect()},I=function(){L=on.createHandshake(w,function(me){v=!0,Y(),d(null,me)})},O=function(me){Y(),d(me)},Z=function(){Y();var me;me=Bi(w),d(new E(me))},Y=function(){w.unbind("initialized",T),w.unbind("open",I),w.unbind("error",O),w.unbind("closed",Z)};return w.bind("initialized",T),w.bind("open",I),w.bind("error",O),w.bind("closed",Z),w.initialize(),{abort:()=>{v||(Y(),L?L.close():w.close())},forceMinPriority:me=>{v||this.priority<me&&(L?L.close():w.close())}}}}function ls(u,a){return re.defer(function(){a(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Dd}=H;var Od=function(u,a,d,v,w,L){var T=Dd[d];if(!T)throw new G(d);var I=(!u.enabledTransports||Pe(u.enabledTransports,a)!==-1)&&(!u.disabledTransports||Pe(u.disabledTransports,a)===-1),O;return I?(w=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},w),O=new Rd(a,v,L?L.getAssistant(T):T,w)):O=Hd,O},Hd={isSupported:function(){return!1},connect:function(u,a){var d=re.defer(function(){a(new z)});return{abort:function(){d.ensureAborted()},forceMinPriority:function(){}}}};function Ud(u){if(u==null)throw"You must pass an options object";if(u.cluster==null)throw"Options object must provide a cluster";"disableStats"in u&&se.warn("The disableStats option is deprecated in favor of enableStats")}const Kd=(u,a)=>{var d="socket_id="+encodeURIComponent(u.socketId);for(var v in a.params)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(a.params[v]);if(a.paramsProvider!=null){let w=a.paramsProvider();for(var v in w)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(w[v])}return d};var jd=u=>{if(typeof H.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(a,d)=>{const v=Kd(a,u);H.getAuthorizers()[u.transport](H,v,u,k.UserAuthentication,d)}};const Vd=(u,a)=>{var d="socket_id="+encodeURIComponent(u.socketId);d+="&channel_name="+encodeURIComponent(u.channelName);for(var v in a.params)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(a.params[v]);if(a.paramsProvider!=null){let w=a.paramsProvider();for(var v in w)d+="&"+encodeURIComponent(v)+"="+encodeURIComponent(w[v])}return d};var Gd=u=>{if(typeof H.getAuthorizers()[u.transport]>"u")throw`'${u.transport}' is not a recognized auth transport`;return(a,d)=>{const v=Vd(a,u);H.getAuthorizers()[u.transport](H,v,u,k.ChannelAuthorization,d)}};const zd=(u,a,d)=>{const v={authTransport:a.transport,authEndpoint:a.endpoint,auth:{params:a.params,headers:a.headers}};return(w,L)=>{const T=u.channel(w.channelName);d(T,v).authorize(w.socketId,L)}};function Fd(u,a){let d={activityTimeout:u.activityTimeout||c.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||c.httpPath,httpPort:u.httpPort||c.httpPort,httpsPort:u.httpsPort||c.httpsPort,pongTimeout:u.pongTimeout||c.pongTimeout,statsHost:u.statsHost||c.stats_host,unavailableTimeout:u.unavailableTimeout||c.unavailableTimeout,wsPath:u.wsPath||c.wsPath,wsPort:u.wsPort||c.wsPort,wssPort:u.wssPort||c.wssPort,enableStats:$d(u),httpHost:qd(u),useTLS:Jd(u),wsHost:Wd(u),userAuthenticator:Yd(u),channelAuthorizer:Xd(u,a)};return"disabledTransports"in u&&(d.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(d.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(d.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(d.timelineParams=u.timelineParams),"nacl"in u&&(d.nacl=u.nacl),d}function qd(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:c.httpHost}function Wd(u){return u.wsHost?u.wsHost:Zd(u.cluster)}function Zd(u){return`ws-${u}.pusher.com`}function Jd(u){return H.getProtocol()==="https:"?!0:u.forceTLS!==!1}function $d(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}function Yd(u){const a=Object.assign(Object.assign({},c.userAuthentication),u.userAuthentication);return"customHandler"in a&&a.customHandler!=null?a.customHandler:jd(a)}function Qd(u,a){let d;return"channelAuthorization"in u?d=Object.assign(Object.assign({},c.channelAuthorization),u.channelAuthorization):(d={transport:u.authTransport||c.authTransport,endpoint:u.authEndpoint||c.authEndpoint},"auth"in u&&("params"in u.auth&&(d.params=u.auth.params),"headers"in u.auth&&(d.headers=u.auth.headers)),"authorizer"in u&&(d.customHandler=zd(a,d,u.authorizer))),d}function Xd(u,a){const d=Qd(u,a);return"customHandler"in d&&d.customHandler!=null?d.customHandler:Gd(d)}class ec extends tn{constructor(a){super(function(d,v){se.debug(`No callbacks on watchlist events for ${d}`)}),this.pusher=a,this.bindWatchlistInternalEvent()}handleEvent(a){a.data.events.forEach(d=>{this.emit(d.name,d)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",a=>{var d=a.event;d==="pusher_internal:watchlist_events"&&this.handleEvent(a)})}}function nc(){let u,a;return{promise:new Promise((v,w)=>{u=v,a=w}),resolve:u,reject:a}}var ic=nc;class tc extends tn{constructor(a){super(function(d,v){se.debug("No callbacks on user for "+d)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(d,v)=>{if(d){se.warn(`Error during signin: ${d}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:v.auth,user_data:v.user_data})},this.pusher=a,this.pusher.connection.bind("state_change",({previous:d,current:v})=>{d!=="connected"&&v==="connected"&&this._signin(),d==="connected"&&v!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new ec(a),this.pusher.connection.bind("message",d=>{var v=d.event;v==="pusher:signin_success"&&this._onSigninSuccess(d.data),this.serverToUserChannel&&this.serverToUserChannel.name===d.channel&&this.serverToUserChannel.handleEvent(d)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(a){try{this.user_data=JSON.parse(a.user_data)}catch{se.error(`Failed parsing user data after signin: ${a.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){se.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const a=d=>{d.subscriptionPending&&d.subscriptionCancelled?d.reinstateSubscription():!d.subscriptionPending&&this.pusher.connection.state==="connected"&&d.subscribe()};this.serverToUserChannel=new ft(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((d,v)=>{d.indexOf("pusher_internal:")===0||d.indexOf("pusher:")===0||this.emit(d,v)}),a(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:a,resolve:d,reject:v}=ic();a.done=!1;const w=()=>{a.done=!0};a.then(w).catch(w),this.signinDonePromise=a,this._signinDoneResolve=d}}class ye{static ready(){ye.isReady=!0;for(var a=0,d=ye.instances.length;a<d;a++)ye.instances[a].connect()}static getClientFeatures(){return qe(Q({ws:H.Transports.ws},function(a){return a.isSupported({})}))}constructor(a,d){oc(a),Ud(d),this.key=a,this.config=Fd(d,this),this.channels=on.createChannels(),this.global_emitter=new tn,this.sessionID=H.randomInt(1e9),this.timeline=new Bd(this.key,this.sessionID,{cluster:this.config.cluster,features:ye.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Oi.INFO,version:c.VERSION}),this.config.enableStats&&(this.timelineSender=on.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+H.TimelineTransport.name}));var v=w=>H.getDefaultStrategy(this.config,w,Od);this.connection=on.createConnectionManager(this.key,{getStrategy:v,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",w=>{var L=w.event,T=L.indexOf("pusher_internal:")===0;if(w.channel){var I=this.channel(w.channel);I&&I.handleEvent(w)}T||this.global_emitter.emit(w.event,w.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",w=>{se.warn(w)}),ye.instances.push(this),this.timeline.info({instances:ye.instances.length}),this.user=new tc(this),ye.isReady&&this.connect()}channel(a){return this.channels.find(a)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var a=this.connection.isUsingTLS(),d=this.timelineSender;this.timelineSenderTimer=new nn(6e4,function(){d.send(a)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(a,d,v){return this.global_emitter.bind(a,d,v),this}unbind(a,d,v){return this.global_emitter.unbind(a,d,v),this}bind_global(a){return this.global_emitter.bind_global(a),this}unbind_global(a){return this.global_emitter.unbind_global(a),this}unbind_all(a){return this.global_emitter.unbind_all(),this}subscribeAll(){var a;for(a in this.channels.channels)this.channels.channels.hasOwnProperty(a)&&this.subscribe(a)}subscribe(a){var d=this.channels.add(a,this);return d.subscriptionPending&&d.subscriptionCancelled?d.reinstateSubscription():!d.subscriptionPending&&this.connection.state==="connected"&&d.subscribe(),d}unsubscribe(a){var d=this.channels.find(a);d&&d.subscriptionPending?d.cancelSubscription():(d=this.channels.remove(a),d&&d.subscribed&&d.unsubscribe())}send_event(a,d,v){return this.connection.send_event(a,d,v)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}ye.instances=[],ye.isReady=!1,ye.logToConsole=!1,ye.Runtime=H,ye.ScriptReceivers=H.ScriptReceivers,ye.DependenciesReceivers=H.DependenciesReceivers,ye.auth_callbacks=H.auth_callbacks;var _t=t.default=ye;function oc(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}H.setup(ye)}])})})(Vo);var Or=Vo.exports;const Hr=Dr(Or);class Go{constructor(e){h(this,"container");h(this,"onAction");h(this,"onFail");h(this,"initialTime");h(this,"timeLeft");h(this,"timerId");h(this,"payment");this.container=e.container,this.onAction=e.onAction,this.onFail=e.onFail,this.initialTime=1800,this.timeLeft=this.initialTime,this.timerId=null}attachListener(){const e=this.container.querySelector("#transfer-acn"),i=this.container.querySelector("#copy-acn"),t=this.container.querySelector("#acn-tooltip"),o=this.container.querySelector("#transfer-amount"),s=this.container.querySelector("#copy-amount"),r=this.container.querySelector("#amount-tooltip"),l=this.container.querySelector("#transfer-button");i&&e&&i.addEventListener("click",()=>{P.track("copy_transferBank",{payment_method:"Transfer",payment_process:"Payment Started"}),t&&this.copyToClipboard(e.innerHTML,t)}),s&&o&&s.addEventListener("click",()=>{P.track("copy_transferAmount",{payment_method:"Transfer"}),r&&this.copyToClipboard(o.innerHTML.split(" ")[1].replace(/,/g,""),r)}),l&&l.addEventListener("click",()=>{this.onAction(5)})}startTimer(e){this.stopTimer(),this.timerId=window.setInterval(()=>{if(this.timeLeft>0){this.timeLeft-=1;const i=this.container.querySelector("#time-left");i&&(i.innerHTML=ri(this.timeLeft))}else this.stopTimer(),e==="check"&&this.onAction(2)},1e3)}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}renderComponent(e){var g,f,y,C,k,S;e&&(this.payment=e),this.container.innerHTML=this.render();const i=this.container.querySelector("#transfer-amount"),t=this.container.querySelector("#transfer-bank"),o=this.container.querySelector("#account-name"),s=this.container.querySelector("#transfer-acn"),r=this.container.querySelector("#time-left"),l=((g=this.payment)==null?void 0:g.currency)||"USD",c=l==="USD"?(f=this.payment)==null?void 0:f.localCurrency:l;if(i&&(i.innerHTML=`${c} ${ke(l==="USD"?(y=this.payment)==null?void 0:y.localAmount:(C=this.payment)==null?void 0:C.amount,2)}`),t&&this.payment.bankDetails&&(t.innerHTML=(k=this.payment.bankDetails)==null?void 0:k.bankName),o&&this.payment.bankDetails&&(o.innerHTML=(S=this.payment.bankDetails)==null?void 0:S.accountName),s&&this.payment.bankDetails&&(s.innerHTML=this.payment.bankDetails.accountNumber),r&&(r.innerHTML=ri(this.initialTime)),this.startTimer("poll"),e.status==="inProgress"){const M="45654f3ce4c9512ea9a4",A="us2";var b=new Hr(M,{cluster:A}),p=b.subscribe(e.reference);p.bind("payment_status",_=>{_.status==="successful"?(clearInterval(this.timerId||void 0),this.onAction(6),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Success"}),_!=null&&_.redirectUrl&&setTimeout(()=>{const E=new URL(_.redirectUrl);E.searchParams.append("status",_.status),E.searchParams.append("reference",_.reference),window.location.href=E.toString()},1800)):_.status==="failed"&&(clearInterval(this.timerId||void 0),this.onFail(7,"Transfer failed"),P.track("verify_payment",{payment_method:"Transfer",verification_status:"Failed"}))})}this.attachListener()}render(){return Rr}}const Ur=`<div id="trasferConfirmationProgress">
891
897
  <div>
892
898
  <div>
893
899
  <div class=" grid grid-rows-[auto_1fr] gap-4 mx-5">
@@ -991,7 +997,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
991
997
  </div> -->
992
998
  </div>
993
999
  </div>
994
- </div>`;class Vr{constructor(e){h(this,"container");this.container=e.container}attachListeners(){}renderComponent(){this.container.innerHTML=this.render()}render(){return jr}}class Gr{constructor({amount:e,closeModal:i,container:t,email:o,token:s,currency:r,rdtCode:l,url:c,reference:b,callBackUrl:p,metadata:g,localCurrency:f,disablePaymentMethods:y,restartTransactionProcess:C,hidePaymentMethods:k,retryingPayment:S}){h(this,"container");h(this,"contents");h(this,"closeModal");h(this,"email");h(this,"transferDetails");h(this,"transferConfirmationProgress");h(this,"transferConfirmationEnd");h(this,"transferExpired");h(this,"mainLoader");h(this,"warningScreen");h(this,"successScreen");h(this,"merchantPlanDetail",{});h(this,"token");h(this,"currency");h(this,"amount");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"_currentStep");h(this,"activeRef");h(this,"paymentResponse");h(this,"timerId");h(this,"abortController",null);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"transactionIssuesScreen");h(this,"disablePaymentMethods");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"hidePaymentMethods");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.currency=r,this.container=t,this.contents=this.container.querySelector("#payment-content-view"),this.closeModal=i,this.token=s,this.email=o,this.amount=e,this.rdtCode=l,this.url=c,this.reference=b,this._currentStep=1,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this.disablePaymentMethods=y,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=C,this.hidePaymentMethods=k,this.retryingPayment=S,this.isMaxRetriesReached=!1,this.renderTransferContent(),this.paymentResponse={},this.activeRef="",this.timerId=null,this.mainLoader=new Ie(this.contents),P.track("transfer_opens",{payment_method:"Transfer"}),this.mainLoader.mountLoader("25dvh"),this.currentStep===1&&(this.abortController=new AbortController,this.createTransfer()),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransferContent(),e===1&&this.createTransfer()}attachInputListeners(){const e=this.container.querySelector("#transfer-try-again"),i=this.container.querySelector("#transfer-sent"),t=this.container.querySelector(".success-button");e&&e.addEventListener("click",()=>{this.currentStep=1}),i&&i.addEventListener("click",()=>{this.abortController&&(this.abortController.abort(),this.currentStep=5)}),t&&t.addEventListener("click",()=>{this.closeModal(),P.track("checkout_closes")})}onSentVerify(e){e!==2?this.abortController&&(this.abortController.abort(),this.currentStep=e):this.currentStep=2}async verifyTransfer(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=7}}async createTransfer(){requestAnimationFrame(()=>{const e=this.container.querySelector("#loader"),i=this.container.querySelector("#details-content");i&&(this.mainLoader=new Ie(this.contents),this.mainLoader.mountLoader("25dvh"),i.classList.add("hidden")),P.track("start_transferProcess",{payment_method:"Transfer"}),(()=>{if(this.retryingPayment){const o={channel:"bank_transfer",reference:this.reference};return si(this.token,o,this.rdtCode,this.url)}else{const o={amount:this.amount,channel:"bank_transfer",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return xt(this.token,o,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"?(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("stop_transferProcess",{payment_method:"Transfer",verification_status:"Failed"})):(e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden")),this.activeRef=o.reference,this.paymentResponse=o,o.bankDetails&&o.bankDetails.accountNumber?(this.transferDetails=new Vo({container:this.contents,onAction:r=>{this.onSentVerify.bind(this)(r)},onFail:(r,l)=>{this.currentStep=r,r===7&&l&&this.warningScreen.setPaymentError(l)}}),this.transferDetails.renderComponent(this.paymentResponse||o)):(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Error fetching bank details")))}).catch(o=>{P.track("verify_payment",{payment_method:"Transfer",verification_status:"Null"}),o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyTransfer(),this.currentStep=7,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=7,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()})})}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderTransferContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.isMobile&&this.hidePaymentMethods(),this.currentStep!==1?(i==null||i.classList.add("hidden"),this.disablePaymentMethods("bank_transfer")):i==null||i.addEventListener("click",()=>{this.restartTransactionProcess()}),this.contents){switch(this.currentStep){case 1:this.transferDetails=new Vo({container:this.contents,onAction:o=>{this.onSentVerify.bind(this)(o)},onFail:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)}});break;case 2:this.transferExpired=new Vr({container:this.contents}),this.transferExpired.renderComponent();break;case 5:this.transferConfirmationProgress=new Kr({container:this.contents,onAction:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)},ref:this.activeRef,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(o,s)=>{this.paymentResponse=o,this.paymentResponseHeaders=s}}),this.transferConfirmationProgress.renderComponent(this.paymentResponse);break;case 6:this.successScreen=new Vn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 7:this.warningScreen=new fn({container:this.contents,onReportIssue:()=>this.currentStep=8,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render();break;case 8:this.transferConfirmationEnd=new Ko({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transferConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var o;this.currentStep=7,this.warningScreen.setPaymentError(((o=this.paymentResponse)==null?void 0:o.providerMessage)||"Payment failed")},token:this.token,rdtCode:this.rdtCode,url:this.url,paymentChannel:"bank_transfer",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}stopProgressBar(){const e=this.container.querySelector(".progress-bar");e&&(e.style.animationPlayState="paused")}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}destroyTimer(){this.stopTimer()}stopPolling(){this.abortController&&this.abortController.abort()}}function Go(){return function(n,e){let i=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:()=>i,set:s=>{i=s}})}}class te extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}}class Qe extends Error{constructor(e){super(e),this.name="AuthorizationError"}}class mt{constructor(e){h(this,"token");h(this,"baseurl","https://api.spotflow.co/api/v1");h(this,"headers");h(this,"rdtCode");h(this,"url");h(this,"getHeaders",(e,i)=>{if(!e)throw new Qe("Missing authorization token");const t=new Headers;return t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${e}`),i&&t.append("Spotflow-Payment-Code",i),t});this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.headers=this.getHeaders(this.token,this.rdtCode)}}class zo extends mt{constructor(e){super(e)}async createCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createUssdPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return{data:await i.json(),headers:i.headers}}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async validateCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/validate`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async authorizeCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/authorize`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createTransferPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async verifyPayment(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/payments/verify?reference=${e}`,{method:"GET",headers:this.headers,signal:i});if(!t.ok){const s=await t.json();throw s.message?new te(s.message,t.status):new te("Network response was not ok",t.status)}return{data:await t.json(),headers:t.headers}}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Qe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class zr extends mt{constructor(e){super(e)}async getMerchantConfig(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/checkout-configurations?currency=${i}&planId=${e||""}`,{headers:this.headers,method:"GET"});if(!t.ok){const o=await t.json();throw o.message?new te(o.message,t.status):new te("Network response was not ok",t.status)}return t.json()}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Qe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class Fr extends mt{constructor(e){super(e)}async getBankList(){try{const e=await fetch(`${ve(this.baseurl,this.url)}/banks?ussd=true`,{headers:this.headers,method:"GET"});if(!e.ok){const i=await e.json();throw i.message?new te(i.message,e.status):new te("Network response was not ok",e.status)}return e.json()}catch(e){throw e instanceof te?(li.showToast(e.message,"error",9e3),console.error(`FetchError: ${e.message} (status: ${e.status})`)):e instanceof Qe?console.error(`AuthorizationError: ${e.message}`):console.error(`Unexpected error: ${e}`),e}}}const qr=`<form id="ussdBanks">
1000
+ </div>`;class Vr{constructor(e){h(this,"container");this.container=e.container}attachListeners(){}renderComponent(){this.container.innerHTML=this.render()}render(){return jr}}class Gr{constructor({amount:e,closeModal:i,container:t,email:o,token:s,currency:r,rdtCode:l,url:c,reference:b,callBackUrl:p,metadata:g,localCurrency:f,disablePaymentMethods:y,restartTransactionProcess:C,hidePaymentMethods:k,retryingPayment:S}){h(this,"container");h(this,"contents");h(this,"closeModal");h(this,"email");h(this,"transferDetails");h(this,"transferConfirmationProgress");h(this,"transferConfirmationEnd");h(this,"transferExpired");h(this,"mainLoader");h(this,"warningScreen");h(this,"successScreen");h(this,"merchantPlanDetail",{});h(this,"token");h(this,"currency");h(this,"amount");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"_currentStep");h(this,"activeRef");h(this,"paymentResponse");h(this,"timerId");h(this,"abortController",null);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"transactionIssuesScreen");h(this,"disablePaymentMethods");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"hidePaymentMethods");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.currency=r,this.container=t,this.contents=this.container.querySelector("#payment-content-view"),this.closeModal=i,this.token=s,this.email=o,this.amount=e,this.rdtCode=l,this.url=c,this.reference=b,this._currentStep=1,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this.disablePaymentMethods=y,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=C,this.hidePaymentMethods=k,this.retryingPayment=S,this.isMaxRetriesReached=!1,this.renderTransferContent(),this.paymentResponse={},this.activeRef="",this.timerId=null,this.mainLoader=new Ie(this.contents),P.track("transfer_opens",{payment_method:"Transfer"}),this.mainLoader.mountLoader("25dvh"),this.currentStep===1&&(this.abortController=new AbortController,this.createTransfer()),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderTransferContent(),e===1&&this.createTransfer()}attachInputListeners(){const e=this.container.querySelector("#transfer-try-again"),i=this.container.querySelector("#transfer-sent"),t=this.container.querySelector(".success-button");e&&e.addEventListener("click",()=>{this.currentStep=1}),i&&i.addEventListener("click",()=>{this.abortController&&(this.abortController.abort(),this.currentStep=5)}),t&&t.addEventListener("click",()=>{this.closeModal(),P.track("checkout_closes")})}onSentVerify(e){e!==2?this.abortController&&(this.abortController.abort(),this.currentStep=e):this.currentStep=2}async verifyTransfer(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=7}}async createTransfer(){requestAnimationFrame(()=>{const e=this.container.querySelector("#loader"),i=this.container.querySelector("#details-content");i&&(this.mainLoader=new Ie(this.contents),this.mainLoader.mountLoader("25dvh"),i.classList.add("hidden")),P.track("start_transferProcess",{payment_method:"Transfer"}),(()=>{if(this.retryingPayment){const o={channel:"bank_transfer",reference:this.reference};return si(this.token,o,this.rdtCode,this.url)}else{const o={amount:this.amount,channel:"bank_transfer",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return xt(this.token,o,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"?(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("stop_transferProcess",{payment_method:"Transfer",verification_status:"Failed"})):(e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden")),this.activeRef=o.reference,this.paymentResponse=o,o.bankDetails&&o.bankDetails.accountNumber?(this.transferDetails=new Go({container:this.contents,onAction:r=>{this.onSentVerify.bind(this)(r)},onFail:(r,l)=>{this.currentStep=r,r===7&&l&&this.warningScreen.setPaymentError(l)}}),this.transferDetails.renderComponent(this.paymentResponse||o)):(this.currentStep=7,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Error fetching bank details")))}).catch(o=>{P.track("verify_payment",{payment_method:"Transfer",verification_status:"Null"}),o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyTransfer(),this.currentStep=7,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=7,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()})})}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderTransferContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.isMobile&&this.hidePaymentMethods(),this.currentStep!==1?(i==null||i.classList.add("hidden"),this.disablePaymentMethods("bank_transfer")):i==null||i.addEventListener("click",()=>{this.restartTransactionProcess()}),this.contents){switch(this.currentStep){case 1:this.transferDetails=new Go({container:this.contents,onAction:o=>{this.onSentVerify.bind(this)(o)},onFail:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)}});break;case 2:this.transferExpired=new Vr({container:this.contents}),this.transferExpired.renderComponent();break;case 5:this.transferConfirmationProgress=new Kr({container:this.contents,onAction:(o,s)=>{this.currentStep=o,o===7&&s&&this.warningScreen.setPaymentError(s)},ref:this.activeRef,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(o,s)=>{this.paymentResponse=o,this.paymentResponseHeaders=s}}),this.transferConfirmationProgress.renderComponent(this.paymentResponse);break;case 6:this.successScreen=new Vn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 7:this.warningScreen=new fn({container:this.contents,onReportIssue:()=>this.currentStep=8,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render();break;case 8:this.transferConfirmationEnd=new jo({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transferConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var o;this.currentStep=7,this.warningScreen.setPaymentError(((o=this.paymentResponse)==null?void 0:o.providerMessage)||"Payment failed")},token:this.token,rdtCode:this.rdtCode,url:this.url,paymentChannel:"bank_transfer",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}stopTimer(){this.timerId!==null&&(clearInterval(this.timerId),this.timerId=null)}stopProgressBar(){const e=this.container.querySelector(".progress-bar");e&&(e.style.animationPlayState="paused")}copyToClipboard(e,i){navigator.clipboard.writeText(e).then(()=>{i.innerHTML="Copied!"}).catch(()=>{i.innerHTML="Failed to copy"})}destroyTimer(){this.stopTimer()}stopPolling(){this.abortController&&this.abortController.abort()}}function zo(){return function(n,e){let i=n[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:()=>i,set:s=>{i=s}})}}class te extends Error{constructor(e,i){super(e),this.status=i,this.name="FetchError"}}class Qe extends Error{constructor(e){super(e),this.name="AuthorizationError"}}class mt{constructor(e){h(this,"token");h(this,"baseurl","https://api.spotflow.co/api/v1");h(this,"headers");h(this,"rdtCode");h(this,"url");h(this,"getHeaders",(e,i)=>{if(!e)throw new Qe("Missing authorization token");const t=new Headers;return t.append("Content-Type","application/json"),t.append("Authorization",`Bearer ${e}`),i&&t.append("Spotflow-Payment-Code",i),t});this.token=e.token,this.rdtCode=e.rdtCode,this.url=e.url,this.headers=this.getHeaders(this.token,this.rdtCode)}}class Fo extends mt{constructor(e){super(e)}async createCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createUssdPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return{data:await i.json(),headers:i.headers}}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async validateCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/validate`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async authorizeCardPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments/authorize`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async createTransferPayment(e){try{const i=await fetch(`${ve(this.baseurl,this.url)}/payments`,{method:"POST",headers:this.headers,body:JSON.stringify(e)});if(!i.ok){const o=await i.json();throw o.message?new te(o.message,i.status):new te("Network response was not ok",i.status)}return await i.json()}catch(i){throw i instanceof te?console.error(`FetchError: ${i.message} (status: ${i.status})`):i instanceof Qe?console.error(`AuthorizationError: ${i.message}`):console.error(`Unexpected error: ${i}`),i}}async verifyPayment(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/payments/verify?reference=${e}`,{method:"GET",headers:this.headers,signal:i});if(!t.ok){const s=await t.json();throw s.message?new te(s.message,t.status):new te("Network response was not ok",t.status)}return{data:await t.json(),headers:t.headers}}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Qe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class zr extends mt{constructor(e){super(e)}async getMerchantConfig(e,i){try{const t=await fetch(`${ve(this.baseurl,this.url)}/checkout-configurations?currency=${i}&planId=${e||""}`,{headers:this.headers,method:"GET"});if(!t.ok){const o=await t.json();throw o.message?new te(o.message,t.status):new te("Network response was not ok",t.status)}return t.json()}catch(t){throw t instanceof te?console.error(`FetchError: ${t.message} (status: ${t.status})`):t instanceof Qe?console.error(`AuthorizationError: ${t.message}`):console.error(`Unexpected error: ${t}`),t}}}class Fr extends mt{constructor(e){super(e)}async getBankList(){try{const e=await fetch(`${ve(this.baseurl,this.url)}/banks?ussd=true`,{headers:this.headers,method:"GET"});if(!e.ok){const i=await e.json();throw i.message?new te(i.message,e.status):new te("Network response was not ok",e.status)}return e.json()}catch(e){throw e instanceof te?(li.showToast(e.message,"error",9e3),console.error(`FetchError: ${e.message} (status: ${e.status})`)):e instanceof Qe?console.error(`AuthorizationError: ${e.message}`):console.error(`Unexpected error: ${e}`),e}}}const qr=`<form id="ussdBanks">
995
1001
  <div>
996
1002
  <h5 class="text-grey-400 font-semibold text-sm">Please choose your bank to begin payment</h5>
997
1003
  <div class="mt-2">
@@ -1026,7 +1032,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1026
1032
  </div>
1027
1033
  </div>
1028
1034
  </div>
1029
- </form>`;class Fo{constructor(e){h(this,"container");h(this,"bank_service");h(this,"bank_list");h(this,"onAction");h(this,"selectedBank");h(this,"currency");h(this,"localCurrency");h(this,"rate");h(this,"amount");this.container=e.container,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.bank_list=[],this.bank_service=new Fr({token:e.merchantKey,rdtCode:e.rdtCode,url:e.url}),this.selectedBank={code:"",name:""},this.onAction=e.onAction?e.onAction:()=>null}attachListerner(){const e=document.getElementById("bank-search-input"),i=document.querySelectorAll(".select-option-tag"),t=document.querySelector("#ussd-bank-button"),o=document.querySelector("#ussdBanks");e&&e.addEventListener("change",s=>{var r,l;if(s.stopPropagation(),this.selectedBank={code:e.value,name:((l=(r=this.bank_list.filter(c=>c.code==e.value))==null?void 0:r[0])==null?void 0:l.name)||""},this.validateForm())t&&t.removeAttribute("disabled");else if(t){if(t.disabled)return;t.setAttribute("disabled","")}}),i&&Array.from(i).forEach(r=>{r.addEventListener("click",function(l){P.track("select_bank",{payment_method:"USSD"}),l.stopPropagation()})}),o&&o.addEventListener("submit",s=>{s.preventDefault(),this.onAction(this.selectedBank)})}validateForm(){return!!this.selectedBank.code}displayButtonText(e){const i=this.container.querySelector("#ussd-bank-button-text");i&&(this.localCurrency&&this.localCurrency!==this.currency?i.textContent=`Continue to pay ${this.localCurrency} ${ke((this.amount||0)*(this.rate||1),2)}`:i.textContent=`Continue to pay ${this.currency} ${ke(this.amount||0,2)}`)}renderContent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#bank-search-input");if(e){const i=new Option("Select your bank","",!0,!0);i.disabled=!0,e.appendChild(i),e.classList.remove("text-tone-100"),e.classList.add("text-tone-50")}this.bank_service.getBankList().then(i=>{this.bank_list=i,e&&i.forEach(t=>{const o=new Option(t.name,t.code);e.appendChild(o),e.classList.remove("text-tone-50"),e.classList.add("text-tone-100")})}),this.displayButtonText(),this.attachListerner()}render(){return qr}}const Wr=`<div id="viewCode">
1035
+ </form>`;class qo{constructor(e){h(this,"container");h(this,"bank_service");h(this,"bank_list");h(this,"onAction");h(this,"selectedBank");h(this,"currency");h(this,"localCurrency");h(this,"rate");h(this,"amount");this.container=e.container,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.bank_list=[],this.bank_service=new Fr({token:e.merchantKey,rdtCode:e.rdtCode,url:e.url}),this.selectedBank={code:"",name:""},this.onAction=e.onAction?e.onAction:()=>null}attachListerner(){const e=document.getElementById("bank-search-input"),i=document.querySelectorAll(".select-option-tag"),t=document.querySelector("#ussd-bank-button"),o=document.querySelector("#ussdBanks");e&&e.addEventListener("change",s=>{var r,l;if(s.stopPropagation(),this.selectedBank={code:e.value,name:((l=(r=this.bank_list.filter(c=>c.code==e.value))==null?void 0:r[0])==null?void 0:l.name)||""},this.validateForm())t&&t.removeAttribute("disabled");else if(t){if(t.disabled)return;t.setAttribute("disabled","")}}),i&&Array.from(i).forEach(r=>{r.addEventListener("click",function(l){P.track("select_bank",{payment_method:"USSD"}),l.stopPropagation()})}),o&&o.addEventListener("submit",s=>{s.preventDefault(),this.onAction(this.selectedBank)})}validateForm(){return!!this.selectedBank.code}displayButtonText(e){const i=this.container.querySelector("#ussd-bank-button-text");i&&(this.localCurrency&&this.localCurrency!==this.currency?i.textContent=`Continue to pay ${this.localCurrency} ${ke((this.amount||0)*(this.rate||1),2)}`:i.textContent=`Continue to pay ${this.currency} ${ke(this.amount||0,2)}`)}renderContent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#bank-search-input");if(e){const i=new Option("Select your bank","",!0,!0);i.disabled=!0,e.appendChild(i),e.classList.remove("text-tone-100"),e.classList.add("text-tone-50")}this.bank_service.getBankList().then(i=>{this.bank_list=i,e&&i.forEach(t=>{const o=new Option(t.name,t.code);e.appendChild(o),e.classList.remove("text-tone-50"),e.classList.add("text-tone-100")})}),this.displayButtonText(),this.attachListerner()}render(){return qr}}const Wr=`<div id="viewCode">
1030
1036
  <div class="grid gap-4">
1031
1037
  <div class="text-center">
1032
1038
  <div class="md:w-4/5 mx-auto grid gap-3">
@@ -1063,7 +1069,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1063
1069
  payment</button>
1064
1070
  </div>
1065
1071
  </div>
1066
- </div>`;class Zr{constructor(e){h(this,"container");h(this,"selected");h(this,"secret");h(this,"onAction");h(this,"paymentService");h(this,"currency");h(this,"amount");h(this,"ussd_detail");h(this,"reference");h(this,"email");h(this,"abortController");h(this,"activeRef","");h(this,"pageLoader");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"onError");this.container=e.container,this.selected=e.selected,this.onAction=e.onAction,this.secret=e.secret,this.abortController=new AbortController,this.paymentService=new zo({token:this.secret,rdtCode:e.rdtCode,url:e.url}),this.currency=e.currency,this.amount=e.amount||0,this.email=e.email,this.reference=e.reference,this.callBackUrl=e.callBackUrl,this.metadata=e.metadata,this.localCurrency=e.localCurrency,this.onError=e.onError??(()=>null),this.pageLoader=new Ie(this.container),this.pageLoader.mountLoader("25dvh"),this.pageLoader.updateMessage("Fetching selected bank code detail")}makePayment(){var e;P.track("start_ussdProcess",{payment_method:"USSD"}),this.paymentService.createUssdPayment({amount:this.amount,currency:this.currency,channel:"ussd",customer:{email:this.email},bank:{code:((e=this.selected)==null?void 0:e.code)||""},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0}).then(({data:i,headers:t})=>{var o;if(this.ussd_detail=i.ussd,this.activeRef=i.reference||"",i.status==="failed"){this.onError(i.providerMessage||"Payment failed"),P.track("stop_ussdProcess",{payment_method:"USSD"});const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl&&setTimeout(()=>{const r=new URL(this.callBackUrl);r.searchParams.append("status",i.status),r.searchParams.append("reference",i.reference),window.location.href=r.toString()},1800);return}else if(i.status!=="success")if(i.ussd){this.container.innerHTML=this.render();const s=this.container.querySelectorAll(".bank-dial-code"),r=this.container.querySelector("#bank-dial-code");r&&(r.innerHTML=((o=i==null?void 0:i.ussd)==null?void 0:o.paymentCode)||"");const l=this.container.querySelector("#bank-name-ussd");l&&(l.innerHTML=this.selected.name),Array.from(s).forEach(b=>{var p;b.innerHTML=((p=i==null?void 0:i.ussd)==null?void 0:p.code)||""}),this.attachListener();return}else if(i.providerMessage){this.onError(i.providerMessage);return}else{this.onError("Unable to fetch bank details");return}this.container.innerHTML=this.render(),this.attachListener()}).catch(i=>{i!=null&&i.message?this.onError(i.message):this.onError("Payment failed")})}attachListener(){const e=this.container.querySelectorAll(".copy-code-button"),i=this.container.querySelectorAll(".copy-code-button-1"),t=this.container.querySelector("#bank-completed-payment");Array.from(e).forEach(r=>{r.addEventListener("click",l=>{var c;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((c=this.ussd_detail)==null?void 0:c.code)||"")})}),Array.from(i).forEach(r=>{r.addEventListener("click",l=>{var c;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((c=this.ussd_detail)==null?void 0:c.code)||"")})}),t&&t.addEventListener("click",r=>{r.preventDefault(),this.onAction(this.selected,this.activeRef)})}verifyPayment(){let e;this.abortController?e=this.abortController.signal:e=new AbortController().signal,console.log({signal:e})}renderComponent(){this.makePayment(),this.attachListener()}render(){return Wr}}var Jr=Object.defineProperty,$r=(n,e,i,t)=>{for(var o=void 0,s=n.length-1,r;s>=0;s--)(r=n[s])&&(o=r(e,i,o)||o);return o&&Jr(e,i,o),o};class qo{constructor({container:e,onSuccess:i,secret:t,amount:o,currency:s,email:r,reference:l,rdtCode:c,url:b,callBackUrl:p,metadata:g,localCurrency:f,hidePaymentMethods:y,showPaymentMethods:C,disablePaymentMethods:k}){h(this,"contents");h(this,"selectedCode");h(this,"secret");h(this,"amount");h(this,"currency");h(this,"email");h(this,"pageLoader");h(this,"reference");h(this,"onSuccess");h(this,"warningScreen");h(this,"bankDetail");h(this,"viewUssdCode");h(this,"_currentStep");h(this,"container");h(this,"paymentService");h(this,"successScreen");h(this,"activeRef","");h(this,"abortController");h(this,"_retry_count",10);h(this,"intervalPayment");h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"merchantDetails");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");this.onSuccess=i||(()=>null),this.container=e,this.secret=t,this.amount=o,this.currency=s,this.reference=l,this.email=r,this.rdtCode=c,this.url=b,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this.merchantDetails={},this.hidePaymentMethods=y,this.showPaymentMethods=C,this.disablePaymentMethods=k,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.paymentService=new zo({token:this.secret,rdtCode:this.rdtCode,url:this.url}),P.track("ussd_opens",{payment_method:"USSD"})}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderUssdContent()}onCodeSelect(e){this.selectedCode=e||"",this.currentStep=2}validate(){let e;if(this.abortController?e=this.abortController.signal:(this.abortController=new AbortController,e=this.abortController.signal),this._retry_count<=0){clearInterval(this.intervalPayment),this.currentStep=3,P.track("verify_payment",{payment_method:"USSD",verification_status:"In Progress"});return}this.paymentService.verifyPayment(this.activeRef,e||this.abortController.signal).then(({data:i,headers:t})=>{i.status==="failed"?(this.currentStep=3,clearInterval(this.intervalPayment),this.redirectTo(i,t,"failed")):["successful","failed"].includes(i.status)?i.status==="inProgress"?this._retry_count-=1:["success","successful"].includes(i.status)&&(this.currentStep=5,clearInterval(this.intervalPayment),P.track("verify_payment",{payment_method:"USSD",verification_status:"Success"}),this.redirectTo(i,t,"success")):this._retry_count-=1}).catch(i=>{i.message?this.warningScreen.setPaymentError(i.message):this.warningScreen.setPaymentError("Payment failed"),this.currentStep=3,clearInterval(this.intervalPayment),P.track("verify_payment",{payment_method:"USSD",verification_status:"Failed"})})}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800):t==="success"&&this.onSuccess(e)}renderUssdContent(e){var i;if(e&&(this.merchantDetails=e),this.currentStep===3||this.currentStep===5?this.hidePaymentMethods():this.showPaymentMethods(),this.currentStep===2&&this.disablePaymentMethods("ussd"),this.currentStep!==1){const t=document.getElementById("go-back");t&&(t.classList.remove("flex","items-center","gap-2","mb-2"),t.innerHTML="")}switch(this.currentStep){case 1:this.bankDetail=new Fo({container:this.contents,merchantKey:this.secret,onAction:this.onCodeSelect.bind(this),rdtCode:this.rdtCode,url:this.url,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate,amount:this.amount}),this.bankDetail.renderContent();break;case 2:this.viewUssdCode=new Zr({container:this.contents,onAction:(t,o)=>{this.activeRef=o,this.currentStep=4,this.intervalPayment=setInterval(()=>{this.validate()},5e3)},selected:this.selectedCode||{},secret:this.secret,amount:this.amount,currency:this.currency,email:this.email||"",onError:t=>{this.currentStep=3,this.warningScreen.setPaymentError(t)},reference:this.reference,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency}),this.viewUssdCode.renderComponent();break;case 3:this.contents.innerHTML=Et,this.warningScreen=new fn({container:this.contents});break;case 4:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader("25vh"),this.pageLoader.updateMessage("We are confirming transaction status. This might take a few seconds.","Please do not refresh this page");break;case 5:this.successScreen=new Vn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantDetails)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;default:this.bankDetail=new Fo({container:this.contents,merchantKey:this.secret,onAction:this.onCodeSelect.bind(this),rdtCode:this.rdtCode,url:this.url,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate,amount:this.amount}),this.bankDetail.renderContent();break}}handleSelectChange(e){setTimeout(()=>{this.currentStep=2},400),this.currentStep=2}}$r([Go(),Go()],qo.prototype,"selectedCode");const Yr={NGN:"Nigerian Naira",USD:"US Dollar",GHS:"Ghanaian Cedi",GBP:"Pounds",ZAF:"South African Rand",USDT:"Tether",KSH:"Kenyan Shilling"},Qr=n=>n==null?void 0:n.replace(/_/g," ");function Xr(n){return n.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}const Ii=n=>{if(n){const e=Qr(n);return Xr(e)}return""},el=`<div>
1072
+ </div>`;class Zr{constructor(e){h(this,"container");h(this,"selected");h(this,"secret");h(this,"onAction");h(this,"paymentService");h(this,"currency");h(this,"amount");h(this,"ussd_detail");h(this,"reference");h(this,"email");h(this,"abortController");h(this,"activeRef","");h(this,"pageLoader");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"onError");this.container=e.container,this.selected=e.selected,this.onAction=e.onAction,this.secret=e.secret,this.abortController=new AbortController,this.paymentService=new Fo({token:this.secret,rdtCode:e.rdtCode,url:e.url}),this.currency=e.currency,this.amount=e.amount||0,this.email=e.email,this.reference=e.reference,this.callBackUrl=e.callBackUrl,this.metadata=e.metadata,this.localCurrency=e.localCurrency,this.onError=e.onError??(()=>null),this.pageLoader=new Ie(this.container),this.pageLoader.mountLoader("25dvh"),this.pageLoader.updateMessage("Fetching selected bank code detail")}makePayment(){var e;P.track("start_ussdProcess",{payment_method:"USSD"}),this.paymentService.createUssdPayment({amount:this.amount,currency:this.currency,channel:"ussd",customer:{email:this.email},bank:{code:((e=this.selected)==null?void 0:e.code)||""},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0}).then(({data:i,headers:t})=>{var o;if(this.ussd_detail=i.ussd,this.activeRef=i.reference||"",i.status==="failed"){this.onError(i.providerMessage||"Payment failed"),P.track("stop_ussdProcess",{payment_method:"USSD"});const s=t.get("spf-redirect-url");this.callBackUrl=s||this.callBackUrl,this.callBackUrl&&setTimeout(()=>{const r=new URL(this.callBackUrl);r.searchParams.append("status",i.status),r.searchParams.append("reference",i.reference),window.location.href=r.toString()},1800);return}else if(i.status!=="success")if(i.ussd){this.container.innerHTML=this.render();const s=this.container.querySelectorAll(".bank-dial-code"),r=this.container.querySelector("#bank-dial-code");r&&(r.innerHTML=((o=i==null?void 0:i.ussd)==null?void 0:o.paymentCode)||"");const l=this.container.querySelector("#bank-name-ussd");l&&(l.innerHTML=this.selected.name),Array.from(s).forEach(b=>{var p;b.innerHTML=((p=i==null?void 0:i.ussd)==null?void 0:p.code)||""}),this.attachListener();return}else if(i.providerMessage){this.onError(i.providerMessage);return}else{this.onError("Unable to fetch bank details");return}this.container.innerHTML=this.render(),this.attachListener()}).catch(i=>{i!=null&&i.message?this.onError(i.message):this.onError("Payment failed")})}attachListener(){const e=this.container.querySelectorAll(".copy-code-button"),i=this.container.querySelectorAll(".copy-code-button-1"),t=this.container.querySelector("#bank-completed-payment");Array.from(e).forEach(r=>{r.addEventListener("click",l=>{var c;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((c=this.ussd_detail)==null?void 0:c.code)||"")})}),Array.from(i).forEach(r=>{r.addEventListener("click",l=>{var c;P.track("copy_ussdCode",{payment_method:"USSD"}),window.navigator.clipboard.writeText(((c=this.ussd_detail)==null?void 0:c.code)||"")})}),t&&t.addEventListener("click",r=>{r.preventDefault(),this.onAction(this.selected,this.activeRef)})}verifyPayment(){let e;this.abortController?e=this.abortController.signal:e=new AbortController().signal,console.log({signal:e})}renderComponent(){this.makePayment(),this.attachListener()}render(){return Wr}}var Jr=Object.defineProperty,$r=(n,e,i,t)=>{for(var o=void 0,s=n.length-1,r;s>=0;s--)(r=n[s])&&(o=r(e,i,o)||o);return o&&Jr(e,i,o),o};class Wo{constructor({container:e,onSuccess:i,secret:t,amount:o,currency:s,email:r,reference:l,rdtCode:c,url:b,callBackUrl:p,metadata:g,localCurrency:f,hidePaymentMethods:y,showPaymentMethods:C,disablePaymentMethods:k}){h(this,"contents");h(this,"selectedCode");h(this,"secret");h(this,"amount");h(this,"currency");h(this,"email");h(this,"pageLoader");h(this,"reference");h(this,"onSuccess");h(this,"warningScreen");h(this,"bankDetail");h(this,"viewUssdCode");h(this,"_currentStep");h(this,"container");h(this,"paymentService");h(this,"successScreen");h(this,"activeRef","");h(this,"abortController");h(this,"_retry_count",10);h(this,"intervalPayment");h(this,"rdtCode");h(this,"url");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"merchantDetails");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");this.onSuccess=i||(()=>null),this.container=e,this.secret=t,this.amount=o,this.currency=s,this.reference=l,this.email=r,this.rdtCode=c,this.url=b,this.callBackUrl=p,this.metadata=g,this.localCurrency=f,this.merchantDetails={},this.hidePaymentMethods=y,this.showPaymentMethods=C,this.disablePaymentMethods=k,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.paymentService=new Fo({token:this.secret,rdtCode:this.rdtCode,url:this.url}),P.track("ussd_opens",{payment_method:"USSD"})}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderUssdContent()}onCodeSelect(e){this.selectedCode=e||"",this.currentStep=2}validate(){let e;if(this.abortController?e=this.abortController.signal:(this.abortController=new AbortController,e=this.abortController.signal),this._retry_count<=0){clearInterval(this.intervalPayment),this.currentStep=3,P.track("verify_payment",{payment_method:"USSD",verification_status:"In Progress"});return}this.paymentService.verifyPayment(this.activeRef,e||this.abortController.signal).then(({data:i,headers:t})=>{i.status==="failed"?(this.currentStep=3,clearInterval(this.intervalPayment),this.redirectTo(i,t,"failed")):["successful","failed"].includes(i.status)?i.status==="inProgress"?this._retry_count-=1:["success","successful"].includes(i.status)&&(this.currentStep=5,clearInterval(this.intervalPayment),P.track("verify_payment",{payment_method:"USSD",verification_status:"Success"}),this.redirectTo(i,t,"success")):this._retry_count-=1}).catch(i=>{i.message?this.warningScreen.setPaymentError(i.message):this.warningScreen.setPaymentError("Payment failed"),this.currentStep=3,clearInterval(this.intervalPayment),P.track("verify_payment",{payment_method:"USSD",verification_status:"Failed"})})}redirectTo(e,i,t){const o=i.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status",e.status),s.searchParams.append("reference",e.reference),window.location.href=s.toString()},1800):t==="success"&&this.onSuccess(e)}renderUssdContent(e){var i;if(e&&(this.merchantDetails=e),this.currentStep===3||this.currentStep===5?this.hidePaymentMethods():this.showPaymentMethods(),this.currentStep===2&&this.disablePaymentMethods("ussd"),this.currentStep!==1){const t=document.getElementById("go-back");t&&(t.classList.remove("flex","items-center","gap-2","mb-2"),t.innerHTML="")}switch(this.currentStep){case 1:this.bankDetail=new qo({container:this.contents,merchantKey:this.secret,onAction:this.onCodeSelect.bind(this),rdtCode:this.rdtCode,url:this.url,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate,amount:this.amount}),this.bankDetail.renderContent();break;case 2:this.viewUssdCode=new Zr({container:this.contents,onAction:(t,o)=>{this.activeRef=o,this.currentStep=4,this.intervalPayment=setInterval(()=>{this.validate()},5e3)},selected:this.selectedCode||{},secret:this.secret,amount:this.amount,currency:this.currency,email:this.email||"",onError:t=>{this.currentStep=3,this.warningScreen.setPaymentError(t)},reference:this.reference,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency}),this.viewUssdCode.renderComponent();break;case 3:this.contents.innerHTML=Pt,this.warningScreen=new fn({container:this.contents});break;case 4:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader("25vh"),this.pageLoader.updateMessage("We are confirming transaction status. This might take a few seconds.","Please do not refresh this page");break;case 5:this.successScreen=new Vn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantDetails)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;default:this.bankDetail=new qo({container:this.contents,merchantKey:this.secret,onAction:this.onCodeSelect.bind(this),rdtCode:this.rdtCode,url:this.url,currency:this.currency,localCurrency:this.localCurrency,rate:e==null?void 0:e.rate.rate,amount:this.amount}),this.bankDetail.renderContent();break}}handleSelectChange(e){setTimeout(()=>{this.currentStep=2},400),this.currentStep=2}}$r([zo(),zo()],Wo.prototype,"selectedCode");const Yr={NGN:"Nigerian Naira",USD:"US Dollar",GHS:"Ghanaian Cedi",GBP:"Pounds",ZAF:"South African Rand",USDT:"Tether",KSH:"Kenyan Shilling"},Qr=n=>n==null?void 0:n.replace(/_/g," ");function Xr(n){return n.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}const Ii=n=>{if(n){const e=Qr(n);return Xr(e)}return""},el=`<div>
1067
1073
  <button id="go-back" class="md:hidden" aria-label="Go back">
1068
1074
  </button>
1069
1075
  </div>
@@ -1301,7 +1307,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1301
1307
 
1302
1308
  <div class="relative w-full">
1303
1309
  <!-- <span class="absolute text-xs left-0 top-1 text-grey-100 pt-1 pb-1 px-3 tracking-[0.5px]">Mobile number</span> -->
1304
- <div class="flex border border-tone-40 rounded-lg">
1310
+ <div class="flex border border-tone-40 rounded-lg" id="phone-number-container">
1305
1311
  <div class="grow relative flex gap-2">
1306
1312
  <div class="relative flex w-full">
1307
1313
  <div class="absolute left-0 top-1/2 -translate-y-2/4 border-r py-4 pl-4 pr-2 border-tone-40">
@@ -1313,6 +1319,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1313
1319
  </div>
1314
1320
  </div>
1315
1321
  </div>
1322
+ <div id="phone-number-error" class="text-sm text-error font-semibold mt-2 hidden"></div>
1316
1323
  </div>
1317
1324
 
1318
1325
  </div>
@@ -1345,10 +1352,10 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1345
1352
  Ghana Revenue Authority (GRA).
1346
1353
  </div>
1347
1354
  </div>
1348
- </form>`;class rl{constructor(e){h(this,"container");h(this,"payment");h(this,"warningError");h(this,"pageLoader");h(this,"localCurrency");h(this,"rate");h(this,"amount");h(this,"onAction");h(this,"switchScreen");h(this,"merchantKey");h(this,"rdtCode");h(this,"url");h(this,"currency");h(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.switchScreen=e.switchScreen,this.url=e.url,this.merchantKey=e.merchantKey,this.rdtCode=e.rdtCode,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new fn({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}validateForm(){const e=this.container.querySelector("#phone-number-input"),i=this.container.querySelector("#network-search-input"),t=this.container.querySelector(".details-form-button");if(!e||!i||!t)return;const o=e.value.length>0&&i.value.length>0;t.disabled=!o}attachListener(){const e=document.querySelector("#mobile-money-form"),i=document.querySelector("#pci-dss"),t=this.container.querySelector("#phone-number-input"),o=this.container.querySelector("#network-search-input"),s=this.container.querySelector(".details-form-button");s&&(s.disabled=!0),t&&o&&(t.addEventListener("input",r=>{const l=r.target;l.value=l.value.replace(/\D/g,""),this.validateForm()}),o.addEventListener("change",()=>this.validateForm())),i&&i.classList.add("hidden"),!(!o||!t||!s)&&e&&e.addEventListener("submit",r=>{r.preventDefault();const l=t.value,c=o.value;this.onAction(r)({code:c,phoneNumber:l}),P.track("start_payment",{payment_method:"Mobile Money"})})}displayButtonText(e){const i=this.container.querySelector("#mobile-money-button-text");i&&(this.localCurrency&&this.localCurrency!==this.currency?i.textContent=`Continue to pay ${this.localCurrency} ${ke((this.amount||0)*(this.rate||1),2)}`:i.textContent=`Continue to to pay ${this.currency} ${ke(this.amount||0,2)}`)}renderComponent(e){this.container.innerHTML=this.render();const i=this.container.querySelector("#network-search-input");if(i){const r=new Option("Select your network","",!0,!0);r.disabled=!0,i.appendChild(r),i.classList.remove("text-tone-100"),i.classList.add("text-tone-50"),i&&e.forEach(l=>{const c=new Option(l.name,l.code);i.appendChild(c),i.classList.remove("text-tone-50"),i.classList.add("text-tone-100")})}const t=this.container.querySelector("#region-code"),o=this.localCurrency?this.localCurrency:this.currency,s=Ss.find(r=>r.name===o);if(t){t.innerHTML=`
1355
+ </form>`;class rl{constructor(e){h(this,"container");h(this,"payment");h(this,"warningError");h(this,"pageLoader");h(this,"localCurrency");h(this,"rate");h(this,"amount");h(this,"onAction");h(this,"switchScreen");h(this,"merchantKey");h(this,"rdtCode");h(this,"url");h(this,"currency");h(this,"restartTransactionProcess");this.container=e.container,this.onAction=e.onAction,this.switchScreen=e.switchScreen,this.url=e.url,this.merchantKey=e.merchantKey,this.rdtCode=e.rdtCode,this.currency=e.currency,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new fn({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}validateForm(){const e=this.container.querySelector("#phone-number-input"),i=this.container.querySelector("#network-search-input"),t=this.container.querySelector(".details-form-button"),o=this.container.querySelector("#phone-number-container"),s=this.container.querySelector("#phone-number-error");if(!e||!i||!t)return;const r=this.localCurrency?this.localCurrency:this.currency,l=Tt.find(c=>c.name===r);e.value.length>Number((l==null?void 0:l.length)||"9")?(o&&(o.classList.remove("border-tone-40"),o.classList.add("border-[#D62020]"),e.classList.remove("text-tone-100"),e.classList.add("text-[#D62020]")),s&&(s.classList.remove("hidden"),s.classList.add("block"),s.innerHTML="Please enter a valid Ghana Mobile Money number.")):(o&&(o.classList.remove("border-[#D62020]"),o.classList.add("border-tone-40"),e.classList.remove("text-[#D62020]"),e.classList.add("text-tone-100")),s&&(s.classList.remove("block"),s.classList.add("hidden"))),e.value.length>0&&e.value.length===Number((l==null?void 0:l.length)||"9")&&i.value?t.disabled=!1:t.disabled=!0}attachListener(){const e=document.querySelector("#mobile-money-form"),i=document.querySelector("#pci-dss"),t=this.container.querySelector("#phone-number-input"),o=this.container.querySelector("#network-search-input"),s=this.container.querySelector(".details-form-button");s&&(s.disabled=!0),t&&o&&(t.addEventListener("input",r=>{const l=r.target;l.value=l.value.replace(/\D/g,""),this.validateForm()}),o.addEventListener("change",()=>this.validateForm())),i&&i.classList.add("hidden"),!(!o||!t||!s)&&e&&e.addEventListener("submit",r=>{r.preventDefault();const l=`0${t.value}`,c=o.value;this.onAction(r)({code:c,phoneNumber:l}),P.track("start_payment",{payment_method:"Mobile Money"})})}displayButtonText(e){const i=this.container.querySelector("#mobile-money-button-text");i&&(this.localCurrency&&this.localCurrency!==this.currency?i.textContent=`Continue to pay ${this.localCurrency} ${ke((this.amount||0)*(this.rate||1),2)}`:i.textContent=`Continue to to pay ${this.currency} ${ke(this.amount||0,2)}`)}renderComponent(e){this.container.innerHTML=this.render();const i=this.container.querySelector("#network-search-input");if(i){const r=new Option("Select your network","",!0,!0);r.disabled=!0,i.appendChild(r),i.classList.remove("text-tone-100"),i.classList.add("text-tone-50"),i&&e.forEach(l=>{const c=new Option(l.name,l.code);i.appendChild(c),i.classList.remove("text-tone-50"),i.classList.add("text-tone-100")})}const t=this.container.querySelector("#region-code"),o=this.localCurrency?this.localCurrency:this.currency,s=Tt.find(r=>r.name===o);if(t){t.innerHTML=`
1349
1356
  ${s==null?void 0:s.icon}
1350
1357
  <span class="text-tone-100 text-sm font-semibold">${s==null?void 0:s.dialCode}</span>
1351
- `;const r=t.querySelector("svg");r&&(r.setAttribute("width","20"),r.setAttribute("height","20"))}this.displayButtonText(),this.attachListener()}renderContent(){this.switchScreen(2),ys(this.merchantKey,this.currency,this.rdtCode,this.url,this.localCurrency).then(e=>{this.renderComponent(e)}).catch(e=>{this.switchScreen(5),e.message?this.warningError.setPaymentError(e.message):this.warningError.setPaymentError("Unable to fetch network providers at this time.")})}render(){return al}}const ll=`<div id="checkoutMobileOtp">
1358
+ `;const r=t.querySelector("svg");r&&(r.setAttribute("width","20"),r.setAttribute("height","20"))}this.displayButtonText(),this.attachListener()}renderContent(){this.switchScreen(2),ks(this.merchantKey,this.currency,this.rdtCode,this.url,this.localCurrency).then(e=>{this.renderComponent(e)}).catch(e=>{this.switchScreen(5),e.message?this.warningError.setPaymentError(e.message):this.warningError.setPaymentError("Unable to fetch network providers at this time.")})}render(){return al}}const ll=`<div id="checkoutMobileOtp">
1352
1359
  <div class="w-full">
1353
1360
  <div id="otp-content" class=" grid gap-4">
1354
1361
  <h5 class="text-black" id="otp-message">
@@ -1391,7 +1398,7 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1391
1398
  <path
1392
1399
  d="M62 32C62 38.6156 59.8132 45.0457 55.78 50.2897C51.7468 55.5336 46.0932 59.2974 39.6992 60.9952C33.3052 62.693 26.5293 62.2297 20.4258 59.6774C14.3224 57.1251 9.2338 52.6268 5.95186 46.8827C2.66993 41.1385 1.37873 34.4707 2.2792 27.9166C3.17967 21.3626 6.22129 15.29 10.9308 10.6438C15.6402 5.9976 21.7534 3.0384 28.3191 2.22668C34.8847 1.41496 41.5345 2.79623 47.2337 6.15557"
1393
1400
  stroke="black" stroke-width="4" stroke-linejoin="round" />
1394
- </svg>`),t&&t.classList.add("hidden"),i&&i.setAttribute("disabled","true"),e&&(e.value="",this.momoOtp="",e.setAttribute("disabled","true")),this.onClose(!1)})}handleOtpInput(e,i){const t=e.target,o=e.data;o&&this.momoOtp.length<6?this.momoOtp+=o:e.inputType==="deleteContentBackward"&&(this.momoOtp=this.momoOtp.slice(0,-1)),t.value="*".repeat(this.momoOtp.length),this.momoOtp.length>=6&&i&&i.removeAttribute("disabled");const s=this.container.querySelector("#otp-error");this.momoOtp.length<6&&(i&&i.setAttribute("disabled","true"),s&&(s.innerHTML=""))}renderComponent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#otp-message");e&&(e.innerHTML=this.otpMessage),this.attachListener()}render(){return ll}}class cl{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector(".details-form-button");e&&e.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Uo}}class ul{constructor({container:e,merchantKey:i,localCurrency:t,metadata:o,callBackUrl:s,rdtCode:r,reference:l,onSuccess:c,url:b,email:p,amount:g,token:f,currency:y,disablePaymentMethods:C,hidePaymentMethods:k,showPaymentMethods:S,onClose:M,restartTransactionProcess:A,retryingPayment:_}){h(this,"contents");h(this,"mobileMoneyForm");h(this,"mobileMoneyValidationForm");h(this,"onSuccess");h(this,"mobileMoneyConfirmation");h(this,"mobileMoneyConfirmationEnd");h(this,"transactionIssuesScreen");h(this,"container");h(this,"pageLoader");h(this,"mainLoader");h(this,"_currentStep");h(this,"successScreen");h(this,"email");h(this,"activeRef");h(this,"warningScreen");h(this,"amount");h(this,"url");h(this,"reference");h(this,"metadata");h(this,"currency");h(this,"localCurrency");h(this,"token");h(this,"callBackUrl");h(this,"rdtCode");h(this,"merchantDetails");h(this,"onClose");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");h(this,"paymentResponse");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.container=e,this.onSuccess=c||(()=>null),this.token=f,this.currency=y,this.amount=g,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.activeRef="",this.token=i,this.email=p,this.metadata=o,this.localCurrency=t,this.callBackUrl=s,this.localCurrency=t,this.rdtCode=r,this.url=b,this.reference=l,this.merchantDetails={},this.disablePaymentMethods=C,this.hidePaymentMethods=k,this.showPaymentMethods=S,this.onClose=M,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=A,this.retryingPayment=_,this.isMaxRetriesReached=!1,P.track("mobile_money_opens",{payment_method:"Mobile Money"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderMobileMoneyContent()}attachInputListeners(){}async createMobileMoney(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text");t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{if(this.retryingPayment){const r={channel:"mobile_money",reference:this.reference,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber}};return si(this.token,r,this.rdtCode,this.url)}else{const r={amount:this.amount,channel:"mobile_money",currency:this.currency||"USD",customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return gs(this.token,r,this.rdtCode,this.url)}})().then(({data:r,headers:l})=>{var c;if(this.paymentResponse=r,this.paymentResponseHeaders=l,r.status==="failed"){this.currentStep=5,r.providerMessage?this.warningScreen.setPaymentError(r.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("start_payment",{payment_method:"Mobile Money",verification_status:"Failed"});return}else if(((c=r==null?void 0:r.authorization)==null?void 0:c.mode)==="otp"){this.activeRef=r.reference,this.currentStep=6;return}else this.currentStep=3}).catch(r=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Null"}),r.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=5,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=5,r.message?this.warningScreen.setPaymentError(r.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}showLoader(){this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader()}submitOtp(e,i){e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text"),s={authorization:{otp:i},reference:this.activeRef};P.track("input_MobileMoneyOTP",{payment_method:"Mobile Money",authentication_type:"0TP"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),oi(this.token,s,this.rdtCode,this.url).then(({data:l})=>{l.status==="failed"?(this.activeRef=l.reference,this.currentStep=3):["success","successful","failed"].includes(l.status)?["success","successful"].includes(l.status)&&(this.activeRef=l.reference,this.currentStep=3):(this.activeRef=l.reference,this.currentStep=3)}).catch(l=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"});const c=this.container.querySelector("#otp-error");l.code==="invalid_otp"?c&&(c.innerHTML=l.message):this.currentStep=3}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=5}}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderMobileMoneyContent(e){var i,t;if(e&&(this.merchantDetails=e),this.currentStep===3&&this.disablePaymentMethods("mobile_money"),this.currentStep!==1){const o=document.getElementById("go-back");o&&(o.classList.remove("flex","items-center","gap-2","mb-2"),o.innerHTML="")}switch(this.currentStep===6?this.hidePaymentMethods():this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.currentStep){case 1:this.mobileMoneyForm=new rl({container:this.contents,merchantKey:this.token,url:this.url,onAction:o=>s=>this.createMobileMoney.bind(this)(o,s),ref:this.activeRef,switchScreen:o=>{this.currentStep=o},rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.mobileMoneyForm.renderContent();break;case 2:this.mainLoader=new Ie(this.contents),this.mainLoader.mountLoader("25dvh"),this.mainLoader.updateMessage("Please wait");break;case 3:this.mobileMoneyConfirmation=new sl({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(o,s)=>{this.paymentResponse=o,this.paymentResponseHeaders=s}}),this.mobileMoneyConfirmation.renderComponent();break;case 4:this.successScreen=new Vn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantDetails)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;case 5:this.warningScreen=new fn({container:this.contents,onReportIssue:()=>this.currentStep=9,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 6:this.mobileMoneyValidationForm=new dl({container:this.contents,onClose:this.onClose,onAction:o=>s=>this.submitOtp.bind(this)(o,s),otpMessage:((t=this.paymentResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.mobileMoneyValidationForm.renderComponent();break;case 7:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 8:this.mobileMoneyConfirmationEnd=new cl({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.mobileMoneyConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var o;this.currentStep=5,this.warningScreen.setPaymentError(((o=this.paymentResponse)==null?void 0:o.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"mobile_money",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}const hl=`<div id="eft-authenticate-container">
1401
+ </svg>`),t&&t.classList.add("hidden"),i&&i.setAttribute("disabled","true"),e&&(e.value="",this.momoOtp="",e.setAttribute("disabled","true")),this.onClose(!1)})}handleOtpInput(e,i){const t=e.target,o=e.data;o&&this.momoOtp.length<6?this.momoOtp+=o:e.inputType==="deleteContentBackward"&&(this.momoOtp=this.momoOtp.slice(0,-1)),t.value="*".repeat(this.momoOtp.length),this.momoOtp.length>=6&&i&&i.removeAttribute("disabled");const s=this.container.querySelector("#otp-error");this.momoOtp.length<6&&(i&&i.setAttribute("disabled","true"),s&&(s.innerHTML=""))}renderComponent(){this.container.innerHTML=this.render();const e=this.container.querySelector("#otp-message");e&&(e.innerHTML=this.otpMessage),this.attachListener()}render(){return ll}}class cl{constructor(e){h(this,"container");h(this,"onAction");h(this,"callBackUrl");h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.container=e.container,this.onAction=e.onAction,this.callBackUrl=e.callBackUrl,this.paymentResponse=e.paymentResponse,this.paymentResponseHeaders=e.paymentResponseHeaders}attachListeners(){const e=this.container.querySelector(".details-form-button");e&&e.addEventListener("click",()=>{sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)})}renderComponent(){this.container.innerHTML=this.render(),this.attachListeners()}render(){return Ko}}class ul{constructor({container:e,merchantKey:i,localCurrency:t,metadata:o,callBackUrl:s,rdtCode:r,reference:l,onSuccess:c,url:b,email:p,amount:g,token:f,currency:y,disablePaymentMethods:C,hidePaymentMethods:k,showPaymentMethods:S,onClose:M,restartTransactionProcess:A,retryingPayment:_}){h(this,"contents");h(this,"mobileMoneyForm");h(this,"mobileMoneyValidationForm");h(this,"onSuccess");h(this,"mobileMoneyConfirmation");h(this,"mobileMoneyConfirmationEnd");h(this,"transactionIssuesScreen");h(this,"container");h(this,"pageLoader");h(this,"mainLoader");h(this,"_currentStep");h(this,"successScreen");h(this,"email");h(this,"activeRef");h(this,"warningScreen");h(this,"amount");h(this,"url");h(this,"reference");h(this,"metadata");h(this,"currency");h(this,"localCurrency");h(this,"token");h(this,"callBackUrl");h(this,"rdtCode");h(this,"merchantDetails");h(this,"onClose");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"disablePaymentMethods");h(this,"paymentResponse");h(this,"paymentResponseHeaders");h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);this.container=e,this.onSuccess=c||(()=>null),this.token=f,this.currency=y,this.amount=g,this.contents=this.container.querySelector("#payment-content-view"),this._currentStep=1,this.activeRef="",this.token=i,this.email=p,this.metadata=o,this.localCurrency=t,this.callBackUrl=s,this.localCurrency=t,this.rdtCode=r,this.url=b,this.reference=l,this.merchantDetails={},this.disablePaymentMethods=C,this.hidePaymentMethods=k,this.showPaymentMethods=S,this.onClose=M,this.paymentResponse={},this.paymentResponseHeaders={},this.restartTransactionProcess=A,this.retryingPayment=_,this.isMaxRetriesReached=!1,P.track("mobile_money_opens",{payment_method:"Mobile Money"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderMobileMoneyContent()}attachInputListeners(){}async createMobileMoney(e,i){e.stopPropagation(),e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text");t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),(()=>{if(this.retryingPayment){const r={channel:"mobile_money",reference:this.reference,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber}};return si(this.token,r,this.rdtCode,this.url)}else{const r={amount:this.amount,channel:"mobile_money",currency:this.currency||"USD",customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,mobileMoney:{code:i.code,phoneNumber:i.phoneNumber},...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return ys(this.token,r,this.rdtCode,this.url)}})().then(({data:r,headers:l})=>{var c;if(this.paymentResponse=r,this.paymentResponseHeaders=l,r.status==="failed"){this.currentStep=5,r.providerMessage?this.warningScreen.setPaymentError(r.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("start_payment",{payment_method:"Mobile Money",verification_status:"Failed"});return}else if(((c=r==null?void 0:r.authorization)==null?void 0:c.mode)==="otp"){this.activeRef=r.reference,this.currentStep=6;return}else this.currentStep=3}).catch(r=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Null"}),r.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=5,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=5,r.message?this.warningScreen.setPaymentError(r.message):this.warningScreen.setPaymentError("Payment failed")),this.warningScreen.hideReportIssue()}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}showLoader(){this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader()}submitOtp(e,i){e.preventDefault();const t=this.container.querySelector(".spinner"),o=this.container.querySelector("#mobile-money-button-text"),s={authorization:{otp:i},reference:this.activeRef};P.track("input_MobileMoneyOTP",{payment_method:"Mobile Money",authentication_type:"0TP"}),t&&o&&(t.classList.remove("hidden"),o.classList.add("hidden")),oi(this.token,s,this.rdtCode,this.url).then(({data:l})=>{l.status==="failed"?(this.activeRef=l.reference,this.currentStep=3):["success","successful","failed"].includes(l.status)?["success","successful"].includes(l.status)&&(this.activeRef=l.reference,this.currentStep=3):(this.activeRef=l.reference,this.currentStep=3)}).catch(l=>{P.track("verify_payment",{payment_method:"Mobile Money",verification_status:"Failed",authentication_type:"OTP"});const c=this.container.querySelector("#otp-error");l.code==="invalid_otp"?c&&(c.innerHTML=l.message):this.currentStep=3}).finally(()=>{t&&o&&(t.classList.add("hidden"),o.classList.remove("hidden"))})}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers}catch{this.currentStep=5}}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}renderMobileMoneyContent(e){var i,t;if(e&&(this.merchantDetails=e),this.currentStep===3&&this.disablePaymentMethods("mobile_money"),this.currentStep!==1){const o=document.getElementById("go-back");o&&(o.classList.remove("flex","items-center","gap-2","mb-2"),o.innerHTML="")}switch(this.currentStep===6?this.hidePaymentMethods():this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.currentStep){case 1:this.mobileMoneyForm=new rl({container:this.contents,merchantKey:this.token,url:this.url,onAction:o=>s=>this.createMobileMoney.bind(this)(o,s),ref:this.activeRef,switchScreen:o=>{this.currentStep=o},rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.mobileMoneyForm.renderContent();break;case 2:this.mainLoader=new Ie(this.contents),this.mainLoader.mountLoader("25dvh"),this.mainLoader.updateMessage("Please wait");break;case 3:this.mobileMoneyConfirmation=new sl({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,setPaymentResponses:(o,s)=>{this.paymentResponse=o,this.paymentResponseHeaders=s}}),this.mobileMoneyConfirmation.renderComponent();break;case 4:this.successScreen=new Vn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(i=this.merchantDetails)==null?void 0:i.rate.rate}),this.successScreen.renderComponent();break;case 5:this.warningScreen=new fn({container:this.contents,onReportIssue:()=>this.currentStep=9,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this)}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 6:this.mobileMoneyValidationForm=new dl({container:this.contents,onClose:this.onClose,onAction:o=>s=>this.submitOtp.bind(this)(o,s),otpMessage:((t=this.paymentResponse)==null?void 0:t.providerMessage)||"Please enter your OTP sent to your phone"}),this.mobileMoneyValidationForm.renderComponent();break;case 7:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 8:this.mobileMoneyConfirmationEnd=new cl({container:this.contents,onAction:o=>{this.currentStep=o},ref:this.reference,onSuccess:this.onSuccess.bind(this),token:this.token,rdtCode:this.rdtCode,url:this.url,callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.mobileMoneyConfirmationEnd.renderComponent();break;case 9:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var o;this.currentStep=5,this.warningScreen.setPaymentError(((o=this.paymentResponse)==null?void 0:o.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"mobile_money",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break}this.attachInputListeners()}}const hl=`<div id="eft-authenticate-container">
1395
1402
  <div class="pt-3">
1396
1403
  <div class="container-center">
1397
1404
  <svg width="98" height="32" viewBox="0 0 98 32" fill="none" xmlns="http://www.w3.org/2000/svg"
@@ -1428,12 +1435,12 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1428
1435
  </div>
1429
1436
  </div>
1430
1437
 
1431
- </div>`;class Wo{constructor(e){h(this,"container");h(this,"payment");h(this,"warningError");h(this,"pageLoader");h(this,"localCurrency");h(this,"rate");h(this,"amount");h(this,"merchantKey");h(this,"rdtCode");h(this,"url");h(this,"currency");h(this,"onAction");h(this,"restartTransactionProcess");this.container=e.container,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.url=e.url,this.merchantKey=e.merchantKey,this.rdtCode=e.rdtCode,this.currency=e.currency,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new fn({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}attachListener(){const e=this.container.querySelector("#authenticate-btn");e&&e.addEventListener("click",()=>{this.onAction(),P.track("start_payment",{payment_method:"EFT"})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return hl}}class ml{constructor({amount:e,container:i,email:t,token:o,currency:s,rdtCode:r,url:l,reference:c,callBackUrl:b,metadata:p,localCurrency:g,hidePaymentMethods:f,showPaymentMethods:y,restartTransactionProcess:C,retryingPayment:k}){h(this,"contents");h(this,"eftAuthenticate");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"email");h(this,"token");h(this,"amount");h(this,"currency");h(this,"_currentStep");h(this,"activeRef");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"merchantPlanDetail",{});h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.currency=s,this.container=i,this.token=o,this.email=t,this.amount=e,this.rdtCode=r,this.url=l,this.reference=c,this.callBackUrl=b,this.metadata=p,this.localCurrency=g,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=f,this.showPaymentMethods=y,this.restartTransactionProcess=C,this.retryingPayment=k,this.isMaxRetriesReached=!1,this.paymentResponse={},this.paymentResponseHeaders={},this.renderEftContent(),P.track("eft_opens",{payment_method:"EFT"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderEftContent()}showLoader(){this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text");i&&(i.textContent=e)}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}async createEftPayment(){const e=this.container.querySelector(".spinner"),i=this.container.querySelector("#authenticate-button-text");e&&i&&(e.classList.remove("hidden"),i.classList.add("hidden")),(()=>{if(this.retryingPayment){const o={channel:"eft",reference:this.reference};return si(this.token,o,this.rdtCode,this.url)}else{const o={amount:this.amount,channel:"eft",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return xt(this.token,o,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{var r,l,c;if(this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"){this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("start_payment",{payment_method:"EFT",verification_status:"Failed"});return}else if(((r=o==null?void 0:o.authorization)==null?void 0:r.mode)==="redirect"){this.activeRef=o.reference,(l=o==null?void 0:o.authorization)!=null&&l.redirectUrl&&this.redirectToOzow((c=o==null?void 0:o.authorization)==null?void 0:c.redirectUrl);return}else this.currentStep=4,o!=null&&o.providerMessage?this.warningScreen.setPaymentError(o==null?void 0:o.providerMessage):this.warningScreen.setPaymentError("Unable to get redirect URL")}).catch(o=>{o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=4,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed"))}).finally(()=>{e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden"))})}redirectToOzow(e){const i=window.open(e,"_blank");if(i){P.track("auth_redirect",{payment_method:"EFT",authentication_type:"Redirect",verification_status:"In Progress"}),this.currentStep=3,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPaymentProcess())},2e3)}}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers;const i=this.paymentResponse.status;i==="successful"?(this.currentStep=2,P.track("verify_payment",{payment_method:"EFT",verification_status:"Success"}),sn(this.paymentResponse,this.paymentResponseHeaders,"success")):i==="failed"?(this.currentStep=4,P.track("verify_payment",{payment_method:"EFT",verification_status:"Failed"}),this.paymentResponse.providerMessage?this.warningScreen.setPaymentError(this.paymentResponse.providerMessage):this.warningScreen.setPaymentError("Payment failed")):i==="cancelled"&&(this.isMaxRetriesReached=!0,this.currentStep=4,this.warningScreen.setPaymentError("Payment Cancelled","You have cancelled the payment. Go back to merchant website to start the payment process again.","Go back to Merchant"))}catch{this.currentStep=4,this.warningScreen.setPaymentError("Payment failed")}}renderEftContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.eftAuthenticate=new Wo({container:this.contents,merchantKey:this.token,url:this.url,onAction:this.createEftPayment.bind(this),ref:this.activeRef,rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break;case 2:this.successScreen=new Vn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 3:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 4:this.warningScreen=new fn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=5}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var s;this.currentStep=4,this.warningScreen.setPaymentError(((s=this.paymentResponse)==null?void 0:s.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"eft",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;default:this.eftAuthenticate=new Wo({container:this.contents,merchantKey:this.token,url:this.url,onAction:this.createEftPayment.bind(this),ref:this.activeRef,rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break}const o=this.container.querySelector("#card-currency");o&&(o.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}}class pl{constructor({container:e,email:i,phoneNumber:t,code:o,encryption:s,merchantKey:r,modalContainer:l,amount:c,planId:b,rdtCode:p,url:g,reference:f,callBackUrl:y,metadata:C,localCurrency:k,closePayment:S}){h(this,"validChannels",[]);h(this,"disabledChannels",[]);h(this,"selectedChannel");h(this,"modalContainer");h(this,"currentPaymentMethod");h(this,"mainLayout");h(this,"mainHeader");h(this,"mainFooter");h(this,"merchantPlanDetail",{});h(this,"mainScreen");h(this,"currency");h(this,"card");h(this,"transfer");h(this,"ussd");h(this,"mobileMoney");h(this,"eft");h(this,"encryption");h(this,"merchantKey");h(this,"planId");h(this,"email");h(this,"phoneNumber");h(this,"code");h(this,"amount",0);h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"isMobile",!1);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"closePayment");h(this,"retryingPayment");this.validChannels=[],this.disabledChannels=[],this.selectedChannel="",this.modalContainer=l,this.encryption=s,this.planId=b||"",this.merchantKey=r,this.email=i,this.phoneNumber=t,this.code=o,this.amount=c||0,this.rdtCode=p||"",this.url=g||"",this.reference=f,this.mainLayout=e,this.callBackUrl=y,this.metadata=C||{},this.localCurrency=k||"",this.isMobile=window.matchMedia("(max-width: 767px)").matches,this.currentPaymentMethod="",this.currency="",this.closePayment=S,this.retryingPayment=!1}mountScreen(e,i,t,o){var r,l;t&&(this.validChannels=t),o&&(this.disabledChannels=o),this.mainLayout.innerHTML=this.render(),this.merchantPlanDetail=e,this.currency=i;const s=(l=(r=this.merchantPlanDetail.plan)==null?void 0:r.pricingOptions)==null?void 0:l.find(c=>c.currency===this.currency);this.amount=(s==null?void 0:s.amount)||this.amount,this.mainHeader=new nl({container:document.getElementById("main-header"),email:this.email,amount:this.amount,metadata:this.metadata,currency:this.currency,localCurrency:this.localCurrency,merchantDetail:e,onAction:this.switchTab.bind(this),isMobile:this.isMobile,onClose:c=>{this.closeBTN.bind(this)(c)},currentPaymentMethod:this.currentPaymentMethod}),this.mainHeader.renderComponent(),this.mainFooter=new tl({container:document.getElementById("main-footer")}),this.mainFooter.renderComponent(),this.setupPaymentMethodButtons(),this.selectedChannel&&(this.currentPaymentMethod=this.selectedChannel),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.renderPaymentMethodContent(),this.setCurrentPaymentMethod(this.currentPaymentMethod)}setupPaymentMethodButtons(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>{t.removeAttribute("disabled"),t.classList.remove("hidden","disabled","limit-exceeded");const o=t.querySelector(".disabled-indicator");o&&t.removeChild(o)});const i=[...this.validChannels,...this.disabledChannels];e.forEach(t=>{const o=t.getAttribute("data-name");o&&!i.includes(o)&&t.classList.add("hidden")}),this.disabledChannels.forEach(t=>{const o=Array.from(e).find(s=>s.getAttribute("data-name")===t);if(o){o.setAttribute("disabled","true"),o.classList.add("disabled","limit-exceeded"),o.setAttribute("title","Transaction amount exceeds limit for this payment method");const s=document.createElement("span");s.classList.add("disabled-indicator"),s.style.fontSize="10px",s.style.color="#FF5733",s.style.display="block",o.appendChild(s)}})}attachListeners(){const e=document.getElementById("go-back"),i=document.getElementById("select-payment-method-text");this.isMobile&&(this.currentPaymentMethod?(e&&(e.classList.add("flex","items-center","gap-2","mb-2"),e.innerHTML=` <svg width="9" height="18" viewBox="0 0 9 18" fill="none" xmlns="http://www.w3.org/2000/svg">
1438
+ </div>`;class Zo{constructor(e){h(this,"container");h(this,"payment");h(this,"warningError");h(this,"pageLoader");h(this,"localCurrency");h(this,"rate");h(this,"amount");h(this,"merchantKey");h(this,"rdtCode");h(this,"url");h(this,"currency");h(this,"onAction");h(this,"restartTransactionProcess");this.container=e.container,this.localCurrency=e.localCurrency,this.rate=e.rate,this.amount=e.amount,this.url=e.url,this.merchantKey=e.merchantKey,this.rdtCode=e.rdtCode,this.currency=e.currency,this.onAction=e.onAction,this.restartTransactionProcess=e.restartTransactionProcess,this.warningError=new fn({container:this.container,onAction:this.restartTransactionProcess.bind(this)})}attachListener(){const e=this.container.querySelector("#authenticate-btn");e&&e.addEventListener("click",()=>{this.onAction(),P.track("start_payment",{payment_method:"EFT"})})}renderComponent(){this.container.innerHTML=this.render(),this.attachListener()}render(){return hl}}class ml{constructor({amount:e,container:i,email:t,token:o,currency:s,rdtCode:r,url:l,reference:c,callBackUrl:b,metadata:p,localCurrency:g,hidePaymentMethods:f,showPaymentMethods:y,restartTransactionProcess:C,retryingPayment:k}){h(this,"contents");h(this,"eftAuthenticate");h(this,"successScreen");h(this,"pageLoader");h(this,"warningScreen");h(this,"transactionIssuesScreen");h(this,"container");h(this,"email");h(this,"token");h(this,"amount");h(this,"currency");h(this,"_currentStep");h(this,"activeRef");h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"hidePaymentMethods");h(this,"showPaymentMethods");h(this,"merchantPlanDetail",{});h(this,"restartTransactionProcess");h(this,"retryingPayment");h(this,"isMaxRetriesReached");h(this,"isMobile",!1);h(this,"paymentResponse");h(this,"paymentResponseHeaders");this.currency=s,this.container=i,this.token=o,this.email=t,this.amount=e,this.rdtCode=r,this.url=l,this.reference=c,this.callBackUrl=b,this.metadata=p,this.localCurrency=g,this._currentStep=1,this.activeRef="",this.contents=this.container.querySelector("#payment-content-view"),this.hidePaymentMethods=f,this.showPaymentMethods=y,this.restartTransactionProcess=C,this.retryingPayment=k,this.isMaxRetriesReached=!1,this.paymentResponse={},this.paymentResponseHeaders={},this.renderEftContent(),P.track("eft_opens",{payment_method:"EFT"}),this.isMobile=window.matchMedia("(max-width: 767px)").matches}get currentStep(){return this._currentStep}set currentStep(e){this._currentStep=e,this.renderEftContent()}showLoader(){this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment")}setPaymentError(e){const i=this.container.querySelector("#payment-warning-text");i&&(i.textContent=e)}goBackToMerchant(){sn(this.paymentResponse,this.paymentResponseHeaders,this.callBackUrl)}async createEftPayment(){const e=this.container.querySelector(".spinner"),i=this.container.querySelector("#authenticate-button-text");e&&i&&(e.classList.remove("hidden"),i.classList.add("hidden")),(()=>{if(this.retryingPayment){const o={channel:"eft",reference:this.reference};return si(this.token,o,this.rdtCode,this.url)}else{const o={amount:this.amount,channel:"eft",currency:this.currency,customer:{email:this.email},reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,...this.localCurrency&&{localCurrency:this.localCurrency},isCheckout:!0};return xt(this.token,o,this.rdtCode,this.url)}})().then(({data:o,headers:s})=>{var r,l,c;if(this.paymentResponse=o,this.paymentResponseHeaders=s,o.status==="failed"){this.currentStep=4,o.providerMessage?this.warningScreen.setPaymentError(o.providerMessage):this.warningScreen.setPaymentError("Payment failed"),P.track("start_payment",{payment_method:"EFT",verification_status:"Failed"});return}else if(((r=o==null?void 0:o.authorization)==null?void 0:r.mode)==="redirect"){this.activeRef=o.reference,(l=o==null?void 0:o.authorization)!=null&&l.redirectUrl&&this.redirectToOzow((c=o==null?void 0:o.authorization)==null?void 0:c.redirectUrl);return}else this.currentStep=4,o!=null&&o.providerMessage?this.warningScreen.setPaymentError(o==null?void 0:o.providerMessage):this.warningScreen.setPaymentError("Unable to get redirect URL")}).catch(o=>{o.code==="payment_max_retry_attempts"?(this.isMaxRetriesReached=!0,this.verifyPaymentProcess(),this.currentStep=4,this.warningScreen.setPaymentError("Maximum retries","You have reached the maximum number of retries allowed. Go back to merchant website to start the payment process again.","Go back to Merchant")):(this.currentStep=4,o.message?this.warningScreen.setPaymentError(o.message):this.warningScreen.setPaymentError("Payment failed"))}).finally(()=>{e&&i&&(e.classList.add("hidden"),i.classList.remove("hidden"))})}redirectToOzow(e){const i=window.open(e,"_blank");if(i){P.track("auth_redirect",{payment_method:"EFT",authentication_type:"Redirect",verification_status:"In Progress"}),this.currentStep=3,this.showLoader();const t=setInterval(()=>{i.closed&&(clearInterval(t),this.verifyPaymentProcess())},2e3)}}async verifyPaymentProcess(){try{const e=await vn(this.token,this.reference,void 0,this.rdtCode,this.url);this.paymentResponse=e.data,this.paymentResponseHeaders=e.headers;const i=this.paymentResponse.status;i==="successful"?(this.currentStep=2,P.track("verify_payment",{payment_method:"EFT",verification_status:"Success"}),sn(this.paymentResponse,this.paymentResponseHeaders,"success")):i==="failed"?(this.currentStep=4,P.track("verify_payment",{payment_method:"EFT",verification_status:"Failed"}),this.paymentResponse.providerMessage?this.warningScreen.setPaymentError(this.paymentResponse.providerMessage):this.warningScreen.setPaymentError("Payment failed")):i==="cancelled"&&(this.isMaxRetriesReached=!0,this.currentStep=4,this.warningScreen.setPaymentError("Payment Cancelled","You have cancelled the payment. Go back to merchant website to start the payment process again.","Go back to Merchant"))}catch{this.currentStep=4,this.warningScreen.setPaymentError("Payment failed")}}renderEftContent(e){var t;e&&(this.merchantPlanDetail=e);const i=document.getElementById("go-back");if(this.currentStep!==1?(this.hidePaymentMethods(),i==null||i.classList.add("hidden")):this.showPaymentMethods(),this.isMobile&&this.hidePaymentMethods(),this.contents){switch(this.currentStep){case 1:this.eftAuthenticate=new Zo({container:this.contents,merchantKey:this.token,url:this.url,onAction:this.createEftPayment.bind(this),ref:this.activeRef,rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break;case 2:this.successScreen=new Vn({container:this.contents,amount:this.amount,currency:this.currency,localCurrency:this.localCurrency,rate:(t=this.merchantPlanDetail)==null?void 0:t.rate.rate}),this.successScreen.renderComponent();break;case 3:this.pageLoader=new Ie(this.contents),this.pageLoader.mountLoader(),this.pageLoader.updateMessage("Verifying Payment");break;case 4:this.warningScreen=new fn({container:this.contents,onAction:this.isMaxRetriesReached?this.goBackToMerchant.bind(this):this.restartTransactionProcess.bind(this),onReportIssue:()=>this.currentStep=5}),this.contents.innerHTML=this.warningScreen.render(),this.warningScreen.attachListener();break;case 5:this.transactionIssuesScreen=new di({container:this.contents,onAction:()=>{var s;this.currentStep=4,this.warningScreen.setPaymentError(((s=this.paymentResponse)==null?void 0:s.providerMessage)||"Payment failed")},url:this.url,rdtCode:this.rdtCode,token:this.token,paymentChannel:"eft",callBackUrl:this.callBackUrl,paymentResponse:this.paymentResponse,paymentResponseHeaders:this.paymentResponseHeaders}),this.transactionIssuesScreen.renderTransactionIssuesComponent();break;default:this.eftAuthenticate=new Zo({container:this.contents,merchantKey:this.token,url:this.url,onAction:this.createEftPayment.bind(this),ref:this.activeRef,rdtCode:this.rdtCode,currency:this.currency,localCurrency:this.localCurrency,amount:this.amount,rate:e==null?void 0:e.rate.rate,restartTransactionProcess:this.restartTransactionProcess.bind(this)}),this.eftAuthenticate.renderComponent();break}const o=this.container.querySelector("#card-currency");o&&(o.textContent=`${this.localCurrency?this.localCurrency:this.currency} Card`)}}}class pl{constructor({container:e,email:i,phoneNumber:t,code:o,encryption:s,merchantKey:r,modalContainer:l,amount:c,planId:b,rdtCode:p,url:g,reference:f,callBackUrl:y,metadata:C,localCurrency:k,closePayment:S}){h(this,"validChannels",[]);h(this,"disabledChannels",[]);h(this,"selectedChannel");h(this,"modalContainer");h(this,"currentPaymentMethod");h(this,"mainLayout");h(this,"mainHeader");h(this,"mainFooter");h(this,"merchantPlanDetail",{});h(this,"mainScreen");h(this,"currency");h(this,"card");h(this,"transfer");h(this,"ussd");h(this,"mobileMoney");h(this,"eft");h(this,"encryption");h(this,"merchantKey");h(this,"planId");h(this,"email");h(this,"phoneNumber");h(this,"code");h(this,"amount",0);h(this,"rdtCode");h(this,"url");h(this,"reference");h(this,"isMobile",!1);h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");h(this,"closePayment");h(this,"retryingPayment");this.validChannels=[],this.disabledChannels=[],this.selectedChannel="",this.modalContainer=l,this.encryption=s,this.planId=b||"",this.merchantKey=r,this.email=i,this.phoneNumber=t,this.code=o,this.amount=c||0,this.rdtCode=p||"",this.url=g||"",this.reference=f,this.mainLayout=e,this.callBackUrl=y,this.metadata=C||{},this.localCurrency=k||"",this.isMobile=window.matchMedia("(max-width: 767px)").matches,this.currentPaymentMethod="",this.currency="",this.closePayment=S,this.retryingPayment=!1}mountScreen(e,i,t,o){var r,l;t&&(this.validChannels=t),o&&(this.disabledChannels=o),this.mainLayout.innerHTML=this.render(),this.merchantPlanDetail=e,this.currency=i;const s=(l=(r=this.merchantPlanDetail.plan)==null?void 0:r.pricingOptions)==null?void 0:l.find(c=>c.currency===this.currency);this.amount=(s==null?void 0:s.amount)||this.amount,this.mainHeader=new nl({container:document.getElementById("main-header"),email:this.email,amount:this.amount,metadata:this.metadata,currency:this.currency,localCurrency:this.localCurrency,merchantDetail:e,onAction:this.switchTab.bind(this),isMobile:this.isMobile,onClose:c=>{this.closeBTN.bind(this)(c)},currentPaymentMethod:this.currentPaymentMethod}),this.mainHeader.renderComponent(),this.mainFooter=new tl({container:document.getElementById("main-footer")}),this.mainFooter.renderComponent(),this.setupPaymentMethodButtons(),this.selectedChannel&&(this.currentPaymentMethod=this.selectedChannel),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.renderPaymentMethodContent(),this.setCurrentPaymentMethod(this.currentPaymentMethod)}setupPaymentMethodButtons(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>{t.removeAttribute("disabled"),t.classList.remove("hidden","disabled","limit-exceeded");const o=t.querySelector(".disabled-indicator");o&&t.removeChild(o)});const i=[...this.validChannels,...this.disabledChannels];e.forEach(t=>{const o=t.getAttribute("data-name");o&&!i.includes(o)&&t.classList.add("hidden")}),this.disabledChannels.forEach(t=>{const o=Array.from(e).find(s=>s.getAttribute("data-name")===t);if(o){o.setAttribute("disabled","true"),o.classList.add("disabled","limit-exceeded"),o.setAttribute("title","Transaction amount exceeds limit for this payment method");const s=document.createElement("span");s.classList.add("disabled-indicator"),s.style.fontSize="10px",s.style.color="#FF5733",s.style.display="block",o.appendChild(s)}})}attachListeners(){const e=document.getElementById("go-back"),i=document.getElementById("select-payment-method-text");this.isMobile&&(this.currentPaymentMethod?(e&&(e.classList.add("flex","items-center","gap-2","mb-2"),e.innerHTML=` <svg width="9" height="18" viewBox="0 0 9 18" fill="none" xmlns="http://www.w3.org/2000/svg">
1432
1439
  <path d="M7.99984 16.9201L1.47984 10.4001C0.709844 9.63008 0.709844 8.37008 1.47984 7.60008L7.99984 1.08008" stroke="#0D0716" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
1433
1440
  </svg>
1434
1441
  <span class="text-tone-100 font-semibold">
1435
1442
  Go back
1436
- </span>`),i&&(i.innerHTML="Selected")):(e&&(e.classList.remove("flex","items-center","gap-2","mb-2"),e.innerHTML=""),i&&(i.innerHTML="Select your preferred")))}closeBTN(e){(()=>{this.cleanup(),e?(P.track("checkout_closes"),this.closeModal()):this.closePayment()})()}updatePaymentMethodView(e,i,t,o){switch(this.currentPaymentMethod){case"card":return this.card=new Br({container:this.modalContainer,amount:t,currency:o,token:e,email:i,planId:this.planId,rdtCode:this.rdtCode,url:this.url,reference:this.reference,encryption:this.encryption,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("card"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"bank_transfer":return this.transfer=new Gr({amount:t,currency:o,closeModal:this.closeModal.bind(this),token:e,container:this.modalContainer,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),hidePaymentMethods:this.hidePaymentMethods.bind(this),retryingPayment:this.retryingPayment});case"ussd":return this.ussd=new qo({container:this.modalContainer,amount:t,currency:o,secret:this.merchantKey,rdtCode:this.rdtCode,url:this.url,email:this.email,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closeModal:()=>this.closeModal(),switchTab:s=>this.switchTab.bind(s),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)}});case"mobile_money":return this.mobileMoney=new ul({container:this.modalContainer,email:this.email,currency:o,rdtCode:this.rdtCode,url:this.url,token:e,amount:this.amount,metadata:this.metadata,localCurrency:this.localCurrency,phoneNumber:this.phoneNumber,code:this.code,callBackUrl:this.callBackUrl,merchantKey:this.merchantKey,reference:this.reference,closeModal:()=>this.closeModal(),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"eft":return this.eft=new ml({container:this.modalContainer,amount:t,currency:o,token:e,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("eft"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});default:return null}}renderPaymentMethodContent(){return(()=>{switch(this.currentPaymentMethod){case"card":return this.card.renderCardContent(this.merchantPlanDetail);case"bank_transfer":return this.transfer.renderTransferContent(this.merchantPlanDetail);case"ussd":return this.ussd.renderUssdContent(this.merchantPlanDetail);case"mobile_money":return this.mobileMoney.renderMobileMoneyContent(this.merchantPlanDetail);case"eft":return this.eft.renderEftContent(this.merchantPlanDetail);default:return this.defaultToEmptyContainer()}})()}setCurrentPaymentMethod(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.classList.remove("active"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.classList.add("active")}setToDefaultEmptyContainer(){this.currentPaymentMethod="",this.retryingPayment=!0,this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.switchTab(""),this.showPaymentMethods(),this.setupPaymentMethodButtons(),this.renderPaymentMethodContent(),P.track("retry_payment")}defaultToEmptyContainer(){const e=document.querySelector("#payment-content-view");e.innerHTML=""}switchTab(e){this.currentPaymentMethod===e&&e!==""||(this.currentPaymentMethod==="bank_transfer"&&this.currentPaymentMethod!==e&&this.setToDefaultEmptyContainer(),this.setCurrentPaymentMethod(e),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.showPaymentMethods(),this.renderPaymentMethodContent(),this.attachListeners(),this.isMobile&&(document.querySelectorAll(".tab-button").forEach(t=>{const o=t.getAttribute("data-name");this.disabledChannels.includes(o)||t.removeAttribute("disabled")}),e?document.querySelectorAll(".tab-button").forEach(o=>{o.getAttribute("data-name")!==e&&o.classList.add("hidden")}):document.querySelectorAll(".tab-button").forEach(o=>{const s=o.getAttribute("data-name");[...this.validChannels,...this.disabledChannels].includes(s)&&o.classList.remove("hidden")})))}disablePaymentMethods(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.setAttribute("disabled","true"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.removeAttribute("disabled")}enablePaymentMethods(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>{const o=t.getAttribute("data-name");o&&!this.disabledChannels.includes(o)&&t.removeAttribute("disabled")});const i=Array.from(e).find(t=>t.getAttribute("data-name")===this.currentPaymentMethod);i&&!this.disabledChannels.includes(this.currentPaymentMethod)&&i.removeAttribute("disabled")}hidePaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.add("hidden")}showPaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.remove("hidden")}cleanup(){this.transfer&&this.transfer.destroyTimer()}closeModal(e){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),e&&e()}setupParent(e){e&&e()}render(){return vs}}class Zo{constructor(e){h(this,"container");this.container=e}renderContent(e){var t;this.container.innerHTML=this.render();const i=document.getElementById("error-action-container");e&&i&&(i.classList.remove("hidden"),(t=i.querySelector("#go-back"))==null||t.addEventListener("click",()=>{window.location.href=e}))}render(){return`
1443
+ </span>`),i&&(i.innerHTML="Selected")):(e&&(e.classList.remove("flex","items-center","gap-2","mb-2"),e.innerHTML=""),i&&(i.innerHTML="Select your preferred")))}closeBTN(e){(()=>{this.cleanup(),e?(P.track("checkout_closes"),this.closeModal()):this.closePayment()})()}updatePaymentMethodView(e,i,t,o){switch(this.currentPaymentMethod){case"card":return this.card=new Br({container:this.modalContainer,amount:t,currency:o,token:e,email:i,planId:this.planId,rdtCode:this.rdtCode,url:this.url,reference:this.reference,encryption:this.encryption,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("card"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"bank_transfer":return this.transfer=new Gr({amount:t,currency:o,closeModal:this.closeModal.bind(this),token:e,container:this.modalContainer,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),hidePaymentMethods:this.hidePaymentMethods.bind(this),retryingPayment:this.retryingPayment});case"ussd":return this.ussd=new Wo({container:this.modalContainer,amount:t,currency:o,secret:this.merchantKey,rdtCode:this.rdtCode,url:this.url,email:this.email,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closeModal:()=>this.closeModal(),switchTab:s=>this.switchTab.bind(s),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)}});case"mobile_money":return this.mobileMoney=new ul({container:this.modalContainer,email:this.email,currency:o,rdtCode:this.rdtCode,url:this.url,token:e,amount:this.amount,metadata:this.metadata,localCurrency:this.localCurrency,phoneNumber:this.phoneNumber,code:this.code,callBackUrl:this.callBackUrl,merchantKey:this.merchantKey,reference:this.reference,closeModal:()=>this.closeModal(),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),disablePaymentMethods:s=>{this.disablePaymentMethods.bind(this)(s)},onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});case"eft":return this.eft=new ml({container:this.modalContainer,amount:t,currency:o,token:e,email:i,rdtCode:this.rdtCode,url:this.url,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,switchTab:()=>this.switchTab("eft"),hidePaymentMethods:this.hidePaymentMethods.bind(this),showPaymentMethods:this.showPaymentMethods.bind(this),onClose:s=>{this.closeBTN.bind(this)(s)},restartTransactionProcess:this.setToDefaultEmptyContainer.bind(this),retryingPayment:this.retryingPayment});default:return null}}renderPaymentMethodContent(){return(()=>{switch(this.currentPaymentMethod){case"card":return this.card.renderCardContent(this.merchantPlanDetail);case"bank_transfer":return this.transfer.renderTransferContent(this.merchantPlanDetail);case"ussd":return this.ussd.renderUssdContent(this.merchantPlanDetail);case"mobile_money":return this.mobileMoney.renderMobileMoneyContent(this.merchantPlanDetail);case"eft":return this.eft.renderEftContent(this.merchantPlanDetail);default:return this.defaultToEmptyContainer()}})()}setCurrentPaymentMethod(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.classList.remove("active"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.classList.add("active")}setToDefaultEmptyContainer(){this.currentPaymentMethod="",this.retryingPayment=!0,this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.switchTab(""),this.showPaymentMethods(),this.setupPaymentMethodButtons(),this.renderPaymentMethodContent(),P.track("retry_payment")}defaultToEmptyContainer(){const e=document.querySelector("#payment-content-view");e.innerHTML=""}switchTab(e){this.currentPaymentMethod===e&&e!==""||(this.currentPaymentMethod==="bank_transfer"&&this.currentPaymentMethod!==e&&this.setToDefaultEmptyContainer(),this.setCurrentPaymentMethod(e),this.updatePaymentMethodView(this.merchantKey,this.email,this.amount,this.currency),this.cleanup(),this.showPaymentMethods(),this.renderPaymentMethodContent(),this.attachListeners(),this.isMobile&&(document.querySelectorAll(".tab-button").forEach(t=>{const o=t.getAttribute("data-name");this.disabledChannels.includes(o)||t.removeAttribute("disabled")}),e?document.querySelectorAll(".tab-button").forEach(o=>{o.getAttribute("data-name")!==e&&o.classList.add("hidden")}):document.querySelectorAll(".tab-button").forEach(o=>{const s=o.getAttribute("data-name");[...this.validChannels,...this.disabledChannels].includes(s)&&o.classList.remove("hidden")})))}disablePaymentMethods(e){this.currentPaymentMethod=e;const i=document.querySelectorAll(".tab-button");i.forEach(o=>o.setAttribute("disabled","true"));const t=Array.from(i).find(o=>o.getAttribute("data-name")===e);t&&t.removeAttribute("disabled")}enablePaymentMethods(){const e=document.querySelectorAll(".tab-button");e.forEach(t=>{const o=t.getAttribute("data-name");o&&!this.disabledChannels.includes(o)&&t.removeAttribute("disabled")});const i=Array.from(e).find(t=>t.getAttribute("data-name")===this.currentPaymentMethod);i&&!this.disabledChannels.includes(this.currentPaymentMethod)&&i.removeAttribute("disabled")}hidePaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.add("hidden")}showPaymentMethods(){const e=document.querySelector("#payment-methods-container");e&&e.classList.remove("hidden")}cleanup(){this.transfer&&this.transfer.destroyTimer()}closeModal(e){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),e&&e()}setupParent(e){e&&e()}render(){return fs}}class Jo{constructor(e){h(this,"container");this.container=e}renderContent(e){var t;this.container.innerHTML=this.render();const i=document.getElementById("error-action-container");e&&i&&(i.classList.remove("hidden"),(t=i.querySelector("#go-back"))==null||t.addEventListener("click",()=>{window.location.href=e}))}render(){return`
1437
1444
  <div class="box-container">
1438
1445
 
1439
1446
  <div class="container-center h-[40vh] hidden mx-auto" id="shared-error-container">
@@ -1467,4 +1474,4 @@ or you can use record.mirror to access the mirror instance during recording.`;le
1467
1474
 
1468
1475
  </div>
1469
1476
  </div>
1470
- `}}class fl{constructor(){h(this,"modalContainer");h(this,"mainLayout");h(this,"encryption");h(this,"mainScreen");h(this,"merchantConfigService");h(this,"mainError");h(this,"mainLoader");h(this,"merchantPlanDetail",{});h(this,"merchantKey");h(this,"planId");h(this,"email");h(this,"amount");h(this,"rdtCode");h(this,"url");h(this,"phoneNumber");h(this,"code");h(this,"reference");h(this,"currency");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");this.merchantKey="",this.email="",this.amount=0,this.planId="",this.encryption="",this.phoneNumber="",this.code="",this.modalContainer=document.createElement("div"),this.rdtCode="",this.reference="",this.currency="",this.url="",this.callBackUrl="",this.metadata={},this.localCurrency="",this.modalContainer.innerHTML=Ln,P.init("11162d9a0801daeaf786f1200cd3112b",{debug:!1}),document.body.appendChild(this.modalContainer);const i=document.getElementById("main-layout-container-screen");if(!i)throw new Error("SDK Layout not available");this.mainLayout=i}closePayment(){const e={reference:this.reference};ks(this.merchantKey,e,this.rdtCode,this.url).then(({headers:t})=>{const o=t.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status","cancelled"),s.searchParams.append("reference",this.reference),window.location.href=s.toString()},1800):this.closeModal(),P.track("canel_payment",{verification_status:"Cancelled"}),P.track("checkout_closes")}).catch(t=>{li.showToast(t.message,"error")})}getDeviceType(){const e=navigator.userAgent;return/mobile/i.test(e)?"Mobile":/tablet/i.test(e)?"Tablet":"Desktop"}setup(e){const{email:i,encryptionKey:t,merchantKey:o,planId:s,amount:r,rdtCode:l,reference:c,currency:b,url:p,callBackUrl:g,metadata:f,localCurrency:y}=e;if(this.merchantKey=o||"",this.email=i||"",this.amount=r||0,this.encryption=t||"",this.planId=s||"",this.rdtCode=l||"",this.reference=c||Ms(),this.url=p||"",this.callBackUrl=g||"",this.metadata=f||{},!o||!i)throw this.mainError=new Zo(this.mainLayout),this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error("Merchant key or email is required");this.currency=b||"",this.merchantConfigService=new zr({token:this.merchantKey,rdtCode:this.rdtCode,url:this.url}),this.localCurrency=y||"",this.mainScreen=new pl({container:this.mainLayout,modalContainer:this.modalContainer,merchantKey:o,email:i,encryption:this.encryption,planId:this.planId,amount:this.amount,rdtCode:this.rdtCode,url:this.url,phoneNumber:this.phoneNumber,code:this.code,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closePayment:this.closePayment.bind(this)}),this.mainLoader=new Ie(this.mainLayout),this.mainError=new Zo(this.mainLayout),this.mainLoader.mountLoader(),this.getPlanDetails()}getAvailableChannels(){var s,r;const e=((s=this.merchantPlanDetail)==null?void 0:s.paymentMethods)??[],i=((r=this.merchantPlanDetail)==null?void 0:r.limits)??[],t=[],o=[];return e.forEach(l=>{const c=i.find(b=>b.channel===l);!c||this.amount<=c.amount?t.push(l):o.push(l)}),{validChannels:t,disabledChannels:o}}async getPlanDetails(){const e=this.currency==="USD"?this.localCurrency:this.currency;this.merchantConfigService.getMerchantConfig(this.planId,e).then(i=>{var s;this.merchantPlanDetail=i,P.register({device_type:this.getDeviceType(),session_id:this.reference,env:"Test",checkout_env:this.rdtCode?"Redirect":"SDK",merchant:this.merchantPlanDetail.merchantName}),P.track("checkout_opens");const{validChannels:t,disabledChannels:o}=this.getAvailableChannels();if(t.length===0||t[0]==="ussd"&&t.length===1){const r=new vl(this.mainLayout);this.mainError=r;let l=0;throw(s=this.merchantPlanDetail)!=null&&s.limits&&this.merchantPlanDetail.limits.length>0&&(l=Math.max(...this.merchantPlanDetail.limits.map(c=>c.amount))),r.setLimitInfo(e,l),this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error("Transaction limit reached")}i.rate?this.mainScreen.mountScreen(this.merchantPlanDetail,this.currency,t,o):(this.mainError.renderContent(this.callBackUrl),this.showErrorIcon())}).catch(i=>{throw this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error(i)})}showErrorIcon(){var i;const e=this.mainLayout.querySelector("#shared-error-container");e&&(e.classList.remove("hidden"),e.parentElement.classList.add("mx-auto"),e.classList.add("flex","flex-col","items-center","gap-2"),(i=e.querySelector("img"))==null||i.setAttribute("src",bl))}closeModal(){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),this.mainScreen.closeModal()}}Ne.CheckoutForm=fl,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})});
1477
+ `}}class fl{constructor(){h(this,"modalContainer");h(this,"mainLayout");h(this,"encryption");h(this,"mainScreen");h(this,"merchantConfigService");h(this,"mainError");h(this,"mainLoader");h(this,"merchantPlanDetail",{});h(this,"merchantKey");h(this,"planId");h(this,"email");h(this,"amount");h(this,"rdtCode");h(this,"url");h(this,"phoneNumber");h(this,"code");h(this,"reference");h(this,"currency");h(this,"callBackUrl");h(this,"metadata");h(this,"localCurrency");this.merchantKey="",this.email="",this.amount=0,this.planId="",this.encryption="",this.phoneNumber="",this.code="",this.modalContainer=document.createElement("div"),this.rdtCode="",this.reference="",this.currency="",this.url="",this.callBackUrl="",this.metadata={},this.localCurrency="",this.modalContainer.innerHTML=Ln,P.init("11162d9a0801daeaf786f1200cd3112b",{debug:!1}),document.body.appendChild(this.modalContainer);const i=document.getElementById("main-layout-container-screen");if(!i)throw new Error("SDK Layout not available");this.mainLayout=i}closePayment(){const e={reference:this.reference};ws(this.merchantKey,e,this.rdtCode,this.url).then(({headers:t})=>{const o=t.get("spf-redirect-url");this.callBackUrl=o||this.callBackUrl,this.callBackUrl?setTimeout(()=>{const s=new URL(this.callBackUrl);s.searchParams.append("status","cancelled"),s.searchParams.append("reference",this.reference),window.location.href=s.toString()},1800):this.closeModal(),P.track("canel_payment",{verification_status:"Cancelled"}),P.track("checkout_closes")}).catch(t=>{li.showToast(t.message,"error")})}getDeviceType(){const e=navigator.userAgent;return/mobile/i.test(e)?"Mobile":/tablet/i.test(e)?"Tablet":"Desktop"}setup(e){const{email:i,encryptionKey:t,merchantKey:o,planId:s,amount:r,rdtCode:l,reference:c,currency:b,url:p,callBackUrl:g,metadata:f,localCurrency:y}=e;if(this.merchantKey=o||"",this.email=i||"",this.amount=r||0,this.encryption=t||"",this.planId=s||"",this.rdtCode=l||"",this.reference=c||Ms(),this.url=p||"",this.callBackUrl=g||"",this.metadata=f||{},!o||!i)throw this.mainError=new Jo(this.mainLayout),this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error("Merchant key or email is required");this.currency=b||"",this.merchantConfigService=new zr({token:this.merchantKey,rdtCode:this.rdtCode,url:this.url}),this.localCurrency=y||"",this.mainScreen=new pl({container:this.mainLayout,modalContainer:this.modalContainer,merchantKey:o,email:i,encryption:this.encryption,planId:this.planId,amount:this.amount,rdtCode:this.rdtCode,url:this.url,phoneNumber:this.phoneNumber,code:this.code,reference:this.reference,callBackUrl:this.callBackUrl,metadata:this.metadata,localCurrency:this.localCurrency,closePayment:this.closePayment.bind(this)}),this.mainLoader=new Ie(this.mainLayout),this.mainError=new Jo(this.mainLayout),this.mainLoader.mountLoader(),this.getPlanDetails()}getAvailableChannels(){var s,r;const e=((s=this.merchantPlanDetail)==null?void 0:s.paymentMethods)??[],i=((r=this.merchantPlanDetail)==null?void 0:r.limits)??[],t=[],o=[];return e.forEach(l=>{const c=i.find(b=>b.channel===l);!c||this.amount<=c.amount?t.push(l):o.push(l)}),{validChannels:t,disabledChannels:o}}async getPlanDetails(){const e=this.currency==="USD"?this.localCurrency:this.currency;this.merchantConfigService.getMerchantConfig(this.planId,e).then(i=>{var s;this.merchantPlanDetail=i,P.register({device_type:this.getDeviceType(),session_id:this.reference,env:"Test",checkout_env:this.rdtCode?"Redirect":"SDK",merchant:this.merchantPlanDetail.merchantName}),P.track("checkout_opens");const{validChannels:t,disabledChannels:o}=this.getAvailableChannels();if(t.length===0||t[0]==="ussd"&&t.length===1){const r=new vl(this.mainLayout);this.mainError=r;let l=0;throw(s=this.merchantPlanDetail)!=null&&s.limits&&this.merchantPlanDetail.limits.length>0&&(l=Math.max(...this.merchantPlanDetail.limits.map(c=>c.amount))),r.setLimitInfo(e,l),this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error("Transaction limit reached")}i.rate?this.mainScreen.mountScreen(this.merchantPlanDetail,this.currency,t,o):(this.mainError.renderContent(this.callBackUrl),this.showErrorIcon())}).catch(i=>{throw this.mainError.renderContent(this.callBackUrl),this.showErrorIcon(),new Error(i)})}showErrorIcon(){var i;const e=this.mainLayout.querySelector("#shared-error-container");e&&(e.classList.remove("hidden"),e.parentElement.classList.add("mx-auto"),e.classList.add("flex","flex-col","items-center","gap-2"),(i=e.querySelector("img"))==null||i.setAttribute("src",bl))}closeModal(){this.modalContainer&&this.modalContainer.parentNode&&document.body.removeChild(this.modalContainer),this.mainScreen.closeModal()}}Ne.CheckoutForm=fl,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})});