@alviere/ui 0.8.1 → 0.9.0

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.
@@ -0,0 +1,2 @@
1
+ var AlviereWebComponents=function(e){"use strict";var t,r,a,n,o,i,l,s,c,u,v,d,p,f,h,g,m,b,y,_=Object.defineProperty,w=e=>{throw TypeError(e)},C=(e,t,r)=>((e,t,r)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),x=(e,t,r)=>t.has(e)||w("Cannot "+r),E=(e,t,r)=>(x(e,t,"read from private field"),r?r.call(e):t.get(e)),S=(e,t,r)=>t.has(e)?w("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),k=(e,t,r,a)=>(x(e,t,"write to private field"),a?a.call(e,r):t.set(e,r),r),T=(e,t,r)=>(x(e,t,"access private method"),r),A="undefined"!=typeof document?document.currentScript:null;const I={};function B(){return!("undefined"==typeof window||!window.location.search.includes("debug=true"))||(void 0==={url:A&&"SCRIPT"===A.tagName.toUpperCase()&&A.src||new URL("web-components.js",document.baseURI).href}||!I)&&(!("undefined"==typeof process||!process.env)&&"true"===process.env.VITE_DEBUG)}const N={logger:"UI_LOGGER",debug:(e,...t)=>{B()},info:(e,...t)=>{B()},warn:(e,...t)=>{B()},error:(e,...t)=>{B()}};function R(e){return e&&"function"==typeof e.getLogger?e.getLogger():N}let z=null,L=!1,D={};function U(){if(D.disableAutoInject||window.ALVIERE_DISABLE_AUTO_TOKENS)return void N.debug("[Alviere] Auto-token injection disabled");if(L||document.querySelector("style[data-alviere-tokens]"))return;const e='@layer alviere-defaults {\n :root {\n --alv-color-primary: #227e9e;\n --alv-color-primary-hover: #1b6680;\n --alv-color-primary-active: #145164;\n --alv-color-primary-light: #e8f4f8;\n --alv-color-primary-light-hover: #d1e8f0;\n --alv-color-on-primary: #ffffff;\n --alv-color-success: #436b1d;\n --alv-color-success-light: #d4edda;\n --alv-color-success-border: #c3e6cb;\n --alv-color-success-text: #155724;\n --alv-color-on-success: #ffffff;\n --alv-color-success-rgb: 67, 107, 29;\n --alv-color-error: #b3311f;\n --alv-color-error-light: #f8d7da;\n --alv-color-error-border: #f5c6cb;\n --alv-color-error-text: #721c24;\n --alv-color-on-error: #ffffff;\n --alv-color-error-rgb: 179, 49, 31;\n --alv-color-warning: #ffc107;\n --alv-color-warning-light: #fff3cd;\n --alv-color-warning-border: #ffeaa7;\n --alv-color-warning-text: #856404;\n --alv-color-on-warning: #000000;\n --alv-color-info: #175db8;\n --alv-color-info-light: #d1ecf1;\n --alv-color-info-border: #bee5eb;\n --alv-color-info-text: #0c5460;\n --alv-color-on-info: #ffffff;\n --alv-color-gray-50: #fafafa;\n --alv-color-gray-100: #f4f4f5;\n --alv-color-gray-200: #e4e4e7;\n --alv-color-gray-300: #d4d4d8;\n --alv-color-gray-400: #a1a1aa;\n --alv-color-gray-500: #71717a;\n --alv-color-gray-600: #52525b;\n --alv-color-gray-700: #3f3f46;\n --alv-color-gray-800: #27272a;\n --alv-color-gray-900: #18181b;\n --alv-color-surface: #ffffff;\n --alv-color-surface-secondary: #f9fafb;\n --alv-color-surface-tertiary: #f4f4f5;\n --alv-color-surface-elevated: #ffffff;\n --alv-color-text-primary: #18181b;\n --alv-color-text-secondary: #52525b;\n --alv-color-text-tertiary: #71717a;\n --alv-color-text-disabled: #a1a1aa;\n --alv-color-text-on-primary: #ffffff;\n --alv-color-text-on-surface: #18181b;\n --alv-color-border: #e4e4e7;\n --alv-color-border-hover: #d4d4d8;\n --alv-color-border-focus: #227e9e;\n --alv-color-border-error: #b3311f;\n --alv-color-border-success: #436b1d;\n --alv-color-background: #ffffff;\n --alv-color-background-disabled: #f4f4f5;\n --alv-color-background-hover: #f9fafb;\n --alv-color-background-active: #f4f4f5;\n}\n\n:root {\n --alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;\n --alv-font-family-grotesque: "Darker Grotesque", sans-serif;\n --alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;\n --alv-font-size-3xs: 0.625rem;\n --alv-font-size-2xs: 0.75rem;\n --alv-font-size-xs: 1rem;\n --alv-font-size-sm: 1.125rem;\n --alv-font-size-base: 1.25rem;\n --alv-font-size-lg: 1.5rem;\n --alv-font-size-xl: 1.75rem;\n --alv-font-weight-light: 300;\n --alv-font-weight-normal: 400;\n --alv-font-weight-medium: 500;\n --alv-font-weight-semibold: 600;\n --alv-font-weight-bold: 700;\n --alv-line-height-tight: 1.25;\n --alv-line-height-normal: 1.5;\n --alv-line-height-relaxed: 1.75;\n}\n\n:root {\n --alv-spacing-xs: 0.25rem;\n --alv-spacing-sm: 0.5rem;\n --alv-spacing-md: 1rem;\n --alv-spacing-lg: 1.5rem;\n --alv-spacing-xl: 2rem;\n --alv-spacing-2xl: 3rem;\n --alv-spacing-3xl: 4rem;\n}\n\n:root {\n --alv-border-radius-none: 0;\n --alv-border-radius-sm: 0.125rem;\n --alv-border-radius: 0.25rem;\n --alv-border-radius-md: 0.375rem;\n --alv-border-radius-lg: 0.5rem;\n --alv-border-radius-xl: 0.75rem;\n --alv-border-radius-2xl: 1rem;\n --alv-border-radius-full: 9999px;\n}\n\n:root {\n --alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n --alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n --alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);\n --alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n --alv-shadow-none: none;\n}\n\n:root {\n --alv-transition-fast: 150ms ease-in-out;\n --alv-transition-normal: 250ms ease-in-out;\n --alv-transition-slow: 350ms ease-in-out;\n --alv-transition-none: none;\n}\n\n:root {\n --alv-input-height-sm: 2.5rem;\n --alv-input-height: 3.25rem;\n --alv-input-height-lg: 3.75rem;\n --alv-input-padding-x: 0.75rem;\n --alv-input-padding-y: 0.5rem;\n --alv-input-border-color: var(--alv-color-border);\n --alv-input-border-hover: var(--alv-color-border-hover);\n --alv-input-border-focus: var(--alv-color-border-focus);\n --alv-input-bg: var(--alv-color-background);\n --alv-input-bg-disabled: var(--alv-color-background-disabled);\n}\n\n:root {\n --alv-z-dropdown: 1000;\n --alv-z-sticky: 1020;\n --alv-z-fixed: 1030;\n --alv-z-modal-backdrop: 1040;\n --alv-z-modal: 1050;\n --alv-z-popover: 1060;\n --alv-z-tooltip: 1070;\n}\n\n:root {\n --alv-button-primary-bg: var(--alv-color-primary);\n --alv-button-primary-bg-hover: var(--alv-color-primary-hover);\n --alv-button-primary-bg-active: var(--alv-color-primary-active);\n --alv-button-primary-text: var(--alv-color-on-primary);\n --alv-button-primary-border: var(--alv-color-primary);\n --alv-button-secondary-bg: transparent;\n --alv-button-secondary-bg-hover: var(--alv-color-primary-light);\n --alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);\n --alv-button-secondary-text: var(--alv-color-primary);\n --alv-button-secondary-border: var(--alv-color-primary);\n --alv-button-tertiary-bg: transparent;\n --alv-button-tertiary-bg-hover: var(--alv-color-gray-100);\n --alv-button-tertiary-bg-active: var(--alv-color-gray-200);\n --alv-button-tertiary-text: var(--alv-color-text-primary);\n --alv-button-tertiary-border: transparent;\n --alv-button-link-bg: transparent;\n --alv-button-link-bg-hover: transparent;\n --alv-button-link-bg-active: transparent;\n --alv-button-link-text: var(--alv-color-primary);\n --alv-button-link-text-hover: var(--alv-color-primary-hover);\n --alv-button-link-border: transparent;\n}\n\n:root {\n --alv-spinner-color: var(--alv-color-text-primary);\n --alv-spinner-size-sm: 1rem;\n --alv-spinner-size-md: 1.5rem;\n --alv-spinner-size-lg: 4rem;\n --alv-spinner-stroke-width: 2px;\n}\n\n:root {\n --alv-timeline-color: var(--alv-color-gray-600);\n --alv-timeline-completed-color: var(--alv-color-success);\n --alv-timeline-error-color: var(--alv-color-error);\n --alv-timeline-pending-color: var(--alv-color-gray-400);\n --alv-timeline-step-size-sm: 1.25rem;\n --alv-timeline-step-size-md: 2rem;\n --alv-timeline-step-size-lg: 2.5rem;\n --alv-timeline-connector-width: 3px;\n --alv-timeline-font-size: var(--alv-font-size-base);\n}\n\n:root {\n --alv-badge-primary-bg: var(--alv-color-primary);\n --alv-badge-primary-text: var(--alv-color-on-primary);\n --alv-badge-secondary-bg: var(--alv-color-gray-200);\n --alv-badge-secondary-text: var(--alv-color-text-primary);\n --alv-badge-success-bg: var(--alv-color-success);\n --alv-badge-success-text: var(--alv-color-on-success);\n --alv-badge-error-bg: var(--alv-color-error);\n --alv-badge-error-text: var(--alv-color-on-error);\n --alv-badge-warning-bg: var(--alv-color-warning);\n --alv-badge-warning-text: var(--alv-color-on-warning);\n --alv-badge-info-bg: var(--alv-color-info);\n --alv-badge-info-text: var(--alv-color-on-info);\n}\n\n:root {\n --alv-list-bg: var(--alv-color-surface);\n --alv-list-border: var(--alv-color-border);\n --alv-list-item-bg: transparent;\n --alv-list-item-bg-hover: var(--alv-color-background-hover);\n --alv-list-item-bg-active: var(--alv-color-background-active);\n --alv-list-item-text: var(--alv-color-text-primary);\n --alv-list-item-text-secondary: var(--alv-color-text-secondary);\n}\n\n:root {\n --alv-radio-border: var(--alv-color-border);\n --alv-radio-border-hover: var(--alv-color-border-hover);\n --alv-radio-border-focus: var(--alv-color-border-focus);\n --alv-radio-bg: var(--alv-color-background);\n --alv-radio-checked-bg: var(--alv-color-primary);\n --alv-radio-checked-border: var(--alv-color-primary);\n --alv-radio-text: var(--alv-color-text-primary);\n --alv-radio-text-disabled: var(--alv-color-text-disabled);\n}\n}';try{if(!("adoptedStyleSheets"in document))throw new Error("Constructable Stylesheets not supported");{z=new CSSStyleSheet,z.replaceSync(e);const t=document.adoptedStyleSheets||[];document.adoptedStyleSheets=[...t,z],N.debug("[Alviere] Design tokens injected via Constructable Stylesheets (layered)")}}catch(t){const r=document.createElement("style");r.setAttribute("data-alviere-tokens",""),r.textContent=e,document.head.appendChild(r),N.debug("[Alviere] Design tokens injected via <style> tag (layered fallback)")}L=!0}function P(e){if(z&&"adoptedStyleSheets"in e)try{const t=e.adoptedStyleSheets||[];e.adoptedStyleSheets=[...t,z]}catch(t){N.warn("[Alviere] Failed to adopt tokens in Shadow DOM:",t)}}var V;"undefined"!=typeof window&&(window.ALVIERE_TOKENS_CONFIG&&(V=window.ALVIERE_TOKENS_CONFIG,D={...D,...V},V.customTokens&&"undefined"!=typeof document&&(Object.entries(V.customTokens).forEach(([e,t])=>{document.documentElement.style.setProperty(e,t)}),N.debug("[Alviere] Applied custom tokens:",Object.keys(V.customTokens))),L&&(V.customTokens||V.theme)&&(N.debug("[Alviere] Re-injecting tokens with new configuration"),function(){const e=document.querySelector("style[data-alviere-tokens]");if(e&&e.remove(),z&&"adoptedStyleSheets"in document){const e=document.adoptedStyleSheets||[];document.adoptedStyleSheets=e.filter(e=>e!==z)}z=null,L=!1}(),U())),U());class M{constructor(){this.registered=new Set,this.components=new Map}static getInstance(){return this.instance||(this.instance=new M),this.instance}wrapWithTokenAdoption(e){return class extends e{constructor(){if(super(),this.shadowRoot)P(this.shadowRoot);else{const e=new MutationObserver(()=>{this.shadowRoot&&(P(this.shadowRoot),e.disconnect())});e.observe(this,{childList:!0,subtree:!0})}}}}register(e,t){if(N.debug(`🔍 Registering web component ${e}`,this.registered),this.registered.has(e))return N.warn(`Web Component ${e} is already registered by Alviere, skipping...`),!1;if(window.customElements.get(e))return N.warn(`Web component '${e}' is already registered globally, skipping...`),!1;if("undefined"==typeof window||!window.customElements)return N.warn("Web Components not supported in this environment"),!1;if(this.registered.has(e))return N.warn(`Web component ${e} is already registered`),!1;if(!t.element)return N.warn(`Component ${e} does not have an element property`),!1;try{const r=this.wrapWithTokenAdoption(t.element);return window.customElements.define(e,r),this.registered.add(e),this.components.set(e,t),N.debug(`✅ Web component ${e} registered successfully with token adoption`),!0}catch(r){return N.error(`❌ Failed to register web component ${e}:`,r),!1}}registerAll(e){e.forEach(({name:e,component:t})=>{this.register(e,t)})}isRegistered(e){return this.registered.has(e)}getRegisteredComponents(){return Array.from(this.registered)}getComponent(e){return this.components.get(e)}clear(){this.registered.clear(),this.components.clear()}}const O=M.getInstance();"undefined"!=typeof window&&((t=window.__svelte??(window.__svelte={})).v??(t.v=new Set)).add("5");const j="[!",q={},F=Symbol(),K=!1;var $=Array.isArray,H=Array.prototype.indexOf,G=Array.from,W=Object.keys,Y=Object.defineProperty,Q=Object.getOwnPropertyDescriptor,J=Object.getOwnPropertyDescriptors,X=Object.prototype,Z=Array.prototype,ee=Object.getPrototypeOf,te=Object.isExtensible;const re=()=>{};function ae(e){for(var t=0;t<e.length;t++)e[t]()}const ne=16,oe=32,ie=64,le=256,se=512,ce=1024,ue=2048,ve=4096,de=8192,pe=16384,fe=32768,he=65536,ge=1<<17,me=1<<19,be=1<<20,ye=1<<21,_e=1<<22,we=1<<23,Ce=Symbol("$state"),xe=Symbol("legacy props"),Ee=Symbol(""),Se=new class extends Error{constructor(){super(...arguments),C(this,"name","StaleReactionError"),C(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function ke(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let Te,Ae=!1;function Ie(e){Ae=e}function Be(e){if(null===e)throw q;return Te=e}function Ne(){return Be($t(Te))}function Re(e){if(Ae){if(null!==$t(Te))throw q;Te=e}}function ze(e=1){if(Ae){for(var t=e,r=Te;t--;)r=$t(r);Te=r}}function Le(){for(var e=0,t=Te;;){if(8===t.nodeType){var r=t.data;if("]"===r){if(0===e)return t;e-=1}else"["!==r&&r!==j||(e+=1)}var a=$t(t);t.remove(),t=a}}function De(e){if(!e||8!==e.nodeType)throw q;return e.data}function Ue(e){return e===this.v}function Pe(e,t){return e!=e?t==t:e!==t||null!==e&&"object"==typeof e||"function"==typeof e}function Ve(e){return!Pe(e,this.v)}let Me=null;function Oe(e){Me=e}function je(e,t=!1,r){Me={p:Me,c:null,e:null,s:e,x:null,l:null}}function qe(e){var t=Me,r=t.e;if(null!==r)for(var a of(t.e=null,r))er(a);return void 0!==e&&(t.x=e),Me=t.p,e??{}}const Fe=new WeakMap;function Ke(e,t){for(;null!==t;){if(128&t.f)try{return void t.b.error(e)}catch(r){e=r}t=t.parent}throw e instanceof Error&&$e(e),e}function $e(e){const t=Fe.get(e);t&&(Y(e,"message",{value:t.message}),Y(e,"stack",{value:t.stack}))}const He="undefined"==typeof requestIdleCallback?e=>setTimeout(e,1):requestIdleCallback;let Ge=[],We=[];function Ye(){var e=Ge;Ge=[],ae(e)}function Qe(){var e=We;We=[],ae(e)}function Je(e){0===Ge.length&&queueMicrotask(Ye),Ge.push(e)}function Xe(){Ge.length>0&&Ye(),We.length>0&&Qe()}function Ze(){for(var e=xr.b;null!==e&&!e.has_pending_snippet();)e=e.parent;return null===e&&function(){throw new Error("https://svelte.dev/e/await_outside_boundary")}(),e}function et(e){var t=2050,r=null!==_r&&2&_r.f?_r:null;null===xr||null!==r&&0!==(r.f&le)?t|=le:xr.f|=me;return{ctx:Me,deps:null,effects:null,equals:Ue,f:t,fn:e,reactions:null,rv:0,v:F,wv:0,parent:r??xr,ac:null}}function tt(e,t){let r=xr;null===r&&function(){throw new Error("https://svelte.dev/e/async_derived_orphan")}();var a=r.b,n=void 0,o=Tt(F),i=null,l=!_r;return function(e){Jt(4718592,e,!0)}(()=>{try{var t=e()}catch(v){t=Promise.reject(v)}var r=()=>t;n=(null==i?void 0:i.then(r,r))??Promise.resolve(t),i=n;var s=ut,c=a.pending;l&&(a.update_pending_count(1),c||s.increment());const u=(e,t=void 0)=>{i=null,c||s.activate(),t?t!==Se&&(o.f|=we,Nt(o,t)):(0!==(o.f&we)&&(o.f^=we),Nt(o,e)),l&&(a.update_pending_count(-1),c||s.decrement()),st()};if(n.then(u,e=>u(null,e||"unknown")),s)return()=>{queueMicrotask(()=>s.neuter())}}),new Promise(e=>{!function t(r){function a(){r===n?e(o):t(n)}r.then(a,a)}(n)})}function rt(e){const t=et(e);return kr(t),t}function at(e){const t=et(e);return t.equals=Ve,t}function nt(e){var t=e.effects;if(null!==t){e.effects=null;for(var r=0;r<t.length;r+=1)sr(t[r])}}function ot(e){var t,r=xr;Er(function(e){for(var t=e.parent;null!==t;){if(!(2&t.f))return t;t=t.parent}return null}(e));try{nt(e),t=Vr(e)}finally{Er(r)}return t}function it(e){var t=ot(e);(e.equals(t)||(e.v=t,e.wv=Dr()),br)||(null!==dt?dt.set(e,e.v):Hr(e,!Lr&&0===(e.f&le)||null===e.deps?ce:ve))}function lt(e,t,r){const a=et;if(0!==t.length){var n,o,i,l=ut,s=xr,c=(n=xr,o=_r,i=Me,function(){Er(n),Cr(o),Oe(i)}),u=Ze();Promise.all(t.map(e=>tt(e))).then(t=>{null==l||l.activate(),c();try{r([...e.map(a),...t])}catch(n){0===(s.f&pe)&&Ke(n,s)}null==l||l.deactivate(),st()}).catch(e=>{u.error(e)})}else r(e.map(a))}function st(){Er(null),Cr(null),Oe(null)}const ct=new Set;let ut=null,vt=null,dt=null,pt=new Set,ft=[];function ht(){const e=ft.shift();ft.length>0&&queueMicrotask(ht),e()}let gt=[],mt=null,bt=!1,yt=!1;r=new WeakMap,a=new WeakMap,n=new WeakMap,o=new WeakMap,i=new WeakMap,l=new WeakMap,s=new WeakMap,c=new WeakMap,u=new WeakMap,v=new WeakMap,d=new WeakMap,p=new WeakMap,f=new WeakSet,h=function(e){var t;e.f^=ce;for(var r=e.first;null!==r;){var a=r.f,n=!!(96&a);if(!(n&&0!==(a&ce)||0!==(a&de)||this.skipped_effects.has(r))&&null!==r.fn){if(n)r.f^=ce;else if(0===(a&ce))if(4&a)E(this,u).push(r);else if(0!==(a&_e)){((null==(t=r.b)?void 0:t.pending)?E(this,s):E(this,l)).push(r)}else Ur(r)&&(0!==(r.f&ne)&&E(this,v).push(r),jr(r));var o=r.first;if(null!==o){r=o;continue}}var i=r.parent;for(r=r.next;null===r&&null!==i;)r=i.next,i=i.parent}},g=function(e){for(const t of e){(0!==(t.f&ue)?E(this,d):E(this,p)).push(t),Hr(t,ce)}e.length=0},m=function(){if(!E(this,i))for(const e of E(this,a))e();E(this,a).clear()};let _t=class e{constructor(){S(this,f),C(this,"current",new Map),S(this,r,new Map),S(this,a,new Set),S(this,n,0),S(this,o,null),S(this,i,!1),S(this,l,[]),S(this,s,[]),S(this,c,[]),S(this,u,[]),S(this,v,[]),S(this,d,[]),S(this,p,[]),C(this,"skipped_effects",new Set)}process(e){var t;gt=[],vt=null;var a=null;if(ct.size>1){a=new Map,dt=new Map;for(const[e,t]of this.current)a.set(e,{v:e.v,wv:e.wv}),e.v=t;for(const e of ct)if(e!==this)for(const[t,n]of E(e,r))a.has(t)||(a.set(t,{v:t.v,wv:t.wv}),t.v=n)}for(const r of e)T(this,f,h).call(this,r);if(0===E(this,l).length&&0===E(this,n)){T(this,f,m).call(this);var i=E(this,c),d=E(this,u);k(this,c,[]),k(this,u,[]),k(this,v,[]),vt=ut,ut=null,Et(i),Et(d),null===ut?ut=this:ct.delete(this),null==(t=E(this,o))||t.resolve()}else T(this,f,g).call(this,E(this,c)),T(this,f,g).call(this,E(this,u)),T(this,f,g).call(this,E(this,v));if(a){for(const[e,{v:t,wv:r}]of a)e.wv<=r&&(e.v=t);dt=null}for(const r of E(this,l))jr(r);for(const r of E(this,s))jr(r);k(this,l,[]),k(this,s,[])}capture(e,t){E(this,r).has(e)||E(this,r).set(e,t),this.current.set(e,e.v)}activate(){ut=this}deactivate(){ut=null,vt=null;for(const e of pt)if(pt.delete(e),e(),null!==ut)break}neuter(){k(this,i,!0)}flush(){gt.length>0?Ct():T(this,f,m).call(this),ut===this&&(0===E(this,n)&&ct.delete(this),this.deactivate())}increment(){k(this,n,E(this,n)+1)}decrement(){if(k(this,n,E(this,n)-1),0===E(this,n)){for(const e of E(this,d))Hr(e,ue),St(e);for(const e of E(this,p))Hr(e,ve),St(e);k(this,c,[]),k(this,u,[]),this.flush()}else this.deactivate()}add_callback(e){E(this,a).add(e)}settled(){return(E(this,o)??k(this,o,{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t})).promise;var e,t}static ensure(){if(null===ut){const t=ut=new e;ct.add(ut),yt||e.enqueue(()=>{ut===t&&t.flush()})}return ut}static enqueue(e){0===ft.length&&queueMicrotask(ht),ft.unshift(e)}};function wt(e){var t=yt;yt=!0;try{for(;;){if(Xe(),0===gt.length&&(null==ut||ut.flush(),0===gt.length))return void(mt=null);Ct()}}finally{yt=t}}function Ct(){var e=gr;bt=!0;try{var t=0;for(mr(!0);gt.length>0;){var r=_t.ensure();if(t++>1e3)K,xt();r.process(gt),kt.clear()}}finally{bt=!1,mr(e),mt=null}}function xt(){try{!function(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}()}catch(e){Ke(e,mt)}}function Et(e){var t=e.length;if(0!==t){for(var r=0;r<t;){var a=e[r++];if(!(24576&a.f)&&Ur(a)){var n=ut?ut.current.size:0;if(jr(a),null===a.deps&&null===a.first&&null===a.nodes_start&&(null===a.teardown&&null===a.ac?ur(a):a.fn=null),null!==ut&&ut.current.size>n&&0!==(a.f&be))break}}for(;r<t;)St(e[r++])}}function St(e){for(var t=mt=e;null!==t.parent;){var r=(t=t.parent).f;if(bt&&t===xr&&0!==(r&ne))return;if(96&r){if(0===(r&ce))return;t.f^=ce}}gt.push(t)}const kt=new Map;function Tt(e,t){return{f:0,v:e,reactions:null,equals:Ue,rv:0,wv:0}}function At(e,t){const r=Tt(e);return kr(r),r}function It(e,t=!1,r=!0){const a=Tt(e);return t||(a.equals=Ve),a}function Bt(e,t,r=!1){return null===_r||wr&&0===(_r.f&ge)||!(4325394&_r.f)||(null==Sr?void 0:Sr.includes(e))||function(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}(),Nt(e,r?Dt(t):t)}function Nt(e,t){if(!e.equals(t)){var r=e.v;br?kt.set(e,t):kt.set(e,r),e.v=t,_t.ensure().capture(e,r),2&e.f&&(0!==(e.f&ue)&&ot(e),Hr(e,0===(e.f&le)?ce:ve)),e.wv=Dr(),Lt(e,ue),null===xr||0===(xr.f&ce)||96&xr.f||(null===Ir?function(e){Ir=e}([e]):Ir.push(e))}return t}function Rt(e,t=1){var r=qr(e),a=1===t?r++:r--;return Bt(e,r),a}function zt(e){Bt(e,e.v+1)}function Lt(e,t){var r=e.reactions;if(null!==r)for(var a=r.length,n=0;n<a;n++){var o=r[n],i=o.f,l=0===(i&ue);l&&Hr(o,t),2&i?Lt(o,ve):l&&St(o)}}function Dt(e){if("object"!=typeof e||null===e||Ce in e)return e;const t=ee(e);if(t!==X&&t!==Z)return e;var r=new Map,a=$(e),n=At(0),o=Rr,i=e=>{if(Rr===o)return e();var t=_r,r=Rr;Cr(null),zr(o);var a=e();return Cr(t),zr(r),a};return a&&r.set("length",At(e.length)),new Proxy(e,{defineProperty(e,t,a){"value"in a&&!1!==a.configurable&&!1!==a.enumerable&&!1!==a.writable||function(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}();var n=r.get(t);return void 0===n?n=i(()=>{var e=At(a.value);return r.set(t,e),e}):Bt(n,a.value,!0),!0},deleteProperty(e,t){var a=r.get(t);if(void 0===a){if(t in e){const e=i(()=>At(F));r.set(t,e),zt(n)}}else Bt(a,F),zt(n);return!0},get(t,a,n){var o;if(a===Ce)return e;var l=r.get(a),s=a in t;if(void 0!==l||s&&!(null==(o=Q(t,a))?void 0:o.writable)||(l=i(()=>At(Dt(s?t[a]:F))),r.set(a,l)),void 0!==l){var c=qr(l);return c===F?void 0:c}return Reflect.get(t,a,n)},getOwnPropertyDescriptor(e,t){var a=Reflect.getOwnPropertyDescriptor(e,t);if(a&&"value"in a){var n=r.get(t);n&&(a.value=qr(n))}else if(void 0===a){var o=r.get(t),i=null==o?void 0:o.v;if(void 0!==o&&i!==F)return{enumerable:!0,configurable:!0,value:i,writable:!0}}return a},has(e,t){var a;if(t===Ce)return!0;var n=r.get(t),o=void 0!==n&&n.v!==F||Reflect.has(e,t);if((void 0!==n||null!==xr&&(!o||(null==(a=Q(e,t))?void 0:a.writable)))&&(void 0===n&&(n=i(()=>At(o?Dt(e[t]):F)),r.set(t,n)),qr(n)===F))return!1;return o},set(e,t,o,l){var s,c=r.get(t),u=t in e;if(a&&"length"===t)for(var v=o;v<c.v;v+=1){var d=r.get(v+"");void 0!==d?Bt(d,F):v in e&&(d=i(()=>At(F)),r.set(v+"",d))}void 0===c?u&&!(null==(s=Q(e,t))?void 0:s.writable)||(Bt(c=i(()=>At(void 0)),Dt(o)),r.set(t,c)):(u=c.v!==F,Bt(c,i(()=>Dt(o))));var p=Reflect.getOwnPropertyDescriptor(e,t);if((null==p?void 0:p.set)&&p.set.call(l,o),!u){if(a&&"string"==typeof t){var f=r.get("length"),h=Number(t);Number.isInteger(h)&&h>=f.v&&Bt(f,h+1)}zt(n)}return!0},ownKeys(e){qr(n);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return void 0===t||t.v!==F});for(var[a,o]of r)o.v===F||a in e||t.push(a);return t},setPrototypeOf(){!function(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}()}})}function Ut(e){try{if(null!==e&&"object"==typeof e&&Ce in e)return e[Ce]}catch{}return e}function Pt(e,t){return Object.is(Ut(e),Ut(t))}var Vt,Mt,Ot,jt;function qt(){if(void 0===Vt){Vt=window,Mt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;Ot=Q(t,"firstChild").get,jt=Q(t,"nextSibling").get,te(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),te(r)&&(r.__t=void 0)}}function Ft(e=""){return document.createTextNode(e)}function Kt(e){return Ot.call(e)}function $t(e){return jt.call(e)}function Ht(e,t){if(!Ae)return Kt(e);var r=Kt(Te);if(null===r)r=Te.appendChild(Ft());else if(t&&3!==r.nodeType){var a=Ft();return null==r||r.before(a),Be(a),a}return Be(r),r}function Gt(e,t){if(!Ae){var r=Kt(e);return r instanceof Comment&&""===r.data?$t(r):r}return Te}function Wt(e,t=1,r=!1){let a=Ae?Te:e;for(var n;t--;)n=a,a=$t(a);if(!Ae)return a;if(r&&3!==(null==a?void 0:a.nodeType)){var o=Ft();return null===a?null==n||n.after(o):a.before(o),Be(o),o}return Be(a),a}function Yt(e){e.textContent=""}function Qt(e){null===xr&&null===_r&&function(){throw new Error("https://svelte.dev/e/effect_orphan")}(),null!==_r&&0!==(_r.f&le)&&null===xr&&function(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}(),br&&function(){throw new Error("https://svelte.dev/e/effect_in_teardown")}()}function Jt(e,t,r,a=!0){var n=xr;null!==n&&0!==(n.f&de)&&(e|=de);var o={ctx:Me,deps:null,nodes_start:null,nodes_end:null,f:e|ue,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(r)try{jr(o),o.f|=fe}catch(l){throw sr(o),l}else null!==t&&St(o);if(!(r&&null===o.deps&&null===o.first&&null===o.nodes_start&&null===o.teardown&&0===(o.f&me))&&a&&(null!==n&&function(e,t){var r=t.last;null===r?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}(o,n),null!==_r&&2&_r.f&&0===(e&ie))){var i=_r;(i.effects??(i.effects=[])).push(o)}return o}function Xt(e){const t=Jt(8,null,!1);return Hr(t,ce),t.teardown=e,t}function Zt(e){Qt();var t=xr.f;if(!(!_r&&0!==(t&oe)&&0===(t&fe)))return er(e);var r=Me;(r.e??(r.e=[])).push(e)}function er(e){return Jt(1048580,e,!1)}function tr(e){return Jt(4,e,!1)}function rr(e,t=0){return Jt(8|t,e,!0)}function ar(e,t=[],r=[]){lt(t,r,t=>{Jt(8,()=>e(...t.map(qr)),!0)})}function nr(e,t=0){return Jt(ne|t,e,!0)}function or(e,t=!0){return Jt(oe,e,!0,t)}function ir(e){var t=e.teardown;if(null!==t){const e=br,r=_r;yr(!0),Cr(null);try{t.call(null)}finally{yr(e),Cr(r)}}}function lr(e,t=!1){var r,a=e.first;for(e.first=e.last=null;null!==a;){null==(r=a.ac)||r.abort(Se);var n=a.next;0!==(a.f&ie)?a.parent=null:sr(a,t),a=n}}function sr(e,t=!0){var r=!1;(t||262144&e.f)&&null!==e.nodes_start&&null!==e.nodes_end&&(cr(e.nodes_start,e.nodes_end),r=!0),lr(e,t&&!r),Or(e,0),Hr(e,pe);var a=e.transitions;if(null!==a)for(const o of a)o.stop();ir(e);var n=e.parent;null!==n&&null!==n.first&&ur(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function cr(e,t){for(;null!==e;){var r=e===t?null:$t(e);e.remove(),e=r}}function ur(e){var t=e.parent,r=e.prev,a=e.next;null!==r&&(r.next=a),null!==a&&(a.prev=r),null!==t&&(t.first===e&&(t.first=a),t.last===e&&(t.last=r))}function vr(e,t){var r=[];pr(e,r,!0),dr(r,()=>{sr(e),t&&t()})}function dr(e,t){var r=e.length;if(r>0){var a=()=>--r||t();for(var n of e)n.out(a)}else t()}function pr(e,t,r){if(0===(e.f&de)){if(e.f^=de,null!==e.transitions)for(const a of e.transitions)(a.is_global||r)&&t.push(a);for(var a=e.first;null!==a;){var n=a.next;pr(a,t,!!(0!==(a.f&he)||0!==(a.f&oe))&&r),a=n}}}function fr(e){hr(e,!0)}function hr(e,t){if(0!==(e.f&de)){e.f^=de,0===(e.f&ce)&&(Hr(e,ue),St(e));for(var r=e.first;null!==r;){var a=r.next;hr(r,!!(0!==(r.f&he)||0!==(r.f&oe))&&t),r=a}if(null!==e.transitions)for(const r of e.transitions)(r.is_global||t)&&r.in()}}let gr=!1;function mr(e){gr=e}let br=!1;function yr(e){br=e}let _r=null,wr=!1;function Cr(e){_r=e}let xr=null;function Er(e){xr=e}let Sr=null;function kr(e){null!==_r&&(null===Sr?Sr=[e]:Sr.push(e))}let Tr=null,Ar=0,Ir=null;let Br=1,Nr=0,Rr=Nr;function zr(e){Rr=e}let Lr=!1;function Dr(){return++Br}function Ur(e){var t,r=e.f;if(0!==(r&ue))return!0;if(0!==(r&ve)){var a=e.deps,n=0!==(r&le);if(null!==a){var o,i,l=0!==(r&se),s=n&&null!==xr&&!Lr,c=a.length;if((l||s)&&(null===xr||0===(xr.f&pe))){var u=e,v=u.parent;for(o=0;o<c;o++)i=a[o],!l&&(null==(t=null==i?void 0:i.reactions)?void 0:t.includes(u))||(i.reactions??(i.reactions=[])).push(u);l&&(u.f^=se),s&&null!==v&&0===(v.f&le)&&(u.f^=le)}for(o=0;o<c;o++)if(Ur(i=a[o])&&it(i),i.wv>e.wv)return!0}n&&(null===xr||Lr)||Hr(e,ce)}return!1}function Pr(e,t,r=!0){var a=e.reactions;if(null!==a&&!(null==Sr?void 0:Sr.includes(e)))for(var n=0;n<a.length;n++){var o=a[n];2&o.f?Pr(o,t,!1):t===o&&(r?Hr(o,ue):0!==(o.f&ce)&&Hr(o,ve),St(o))}}function Vr(e){var t,r=Tr,a=Ar,n=Ir,o=_r,i=Lr,l=Sr,s=Me,c=wr,u=Rr,v=e.f;Tr=null,Ar=0,Ir=null,Lr=0!==(v&le)&&(wr||!gr||null===_r),_r=96&v?null:e,Sr=null,Oe(e.ctx),wr=!1,Rr=++Nr,null!==e.ac&&(e.ac.abort(Se),e.ac=null);try{e.f|=ye;var d=(0,e.fn)(),p=e.deps;if(null!==Tr){var f;if(Or(e,Ar),null!==p&&Ar>0)for(p.length=Ar+Tr.length,f=0;f<Tr.length;f++)p[Ar+f]=Tr[f];else e.deps=p=Tr;if(!Lr||2&v&&null!==e.reactions)for(f=Ar;f<p.length;f++)((t=p[f]).reactions??(t.reactions=[])).push(e)}else null!==p&&Ar<p.length&&(Or(e,Ar),p.length=Ar);if(!(null===Ir||wr||null===p||6146&e.f))for(f=0;f<Ir.length;f++)Pr(Ir[f],e);return null!==o&&o!==e&&(Nr++,null!==Ir&&(null===n?n=Ir:n.push(...Ir))),0!==(e.f&we)&&(e.f^=we),d}catch(h){return function(e){var t=xr;if(null===t)return _r.f|=we,e;if(0===(t.f&fe)){if(!(128&t.f))throw!t.parent&&e instanceof Error&&$e(e),e;t.b.error(e)}else Ke(e,t)}(h)}finally{e.f^=ye,Tr=r,Ar=a,Ir=n,_r=o,Lr=i,Sr=l,Oe(s),wr=c,Rr=u}}function Mr(e,t){let r=t.reactions;if(null!==r){var a=H.call(r,e);if(-1!==a){var n=r.length-1;0===n?r=t.reactions=null:(r[a]=r[n],r.pop())}}null===r&&2&t.f&&(null===Tr||!Tr.includes(t))&&(Hr(t,ve),768&t.f||(t.f^=se),nt(t),Or(t,0))}function Or(e,t){var r=e.deps;if(null!==r)for(var a=t;a<r.length;a++)Mr(e,r[a])}function jr(e){var t=e.f;if(0===(t&pe)){Hr(e,ce);var r=xr,a=gr;xr=e,gr=!0;try{0!==(t&ne)?function(e){for(var t=e.first;null!==t;){var r=t.next;0===(t.f&oe)&&sr(t),t=r}}(e):lr(e),ir(e);var n=Vr(e);e.teardown="function"==typeof n?n:null,e.wv=Br}finally{gr=a,xr=r}}}function qr(e){var t=!!(2&e.f);if(null===_r||wr){if(t&&null===e.deps&&null===e.effects){var r=e,a=r.parent;null!==a&&0===(a.f&le)&&(r.f^=le)}}else if(!(null!==xr&&0!==(xr.f&pe))&&!(null==Sr?void 0:Sr.includes(e))){var n=_r.deps;if(0!==(_r.f&ye))e.rv<Nr&&(e.rv=Nr,null===Tr&&null!==n&&n[Ar]===e?Ar++:null===Tr?Tr=[e]:Lr&&Tr.includes(e)||Tr.push(e));else{(_r.deps??(_r.deps=[])).push(e);var o=e.reactions;null===o?e.reactions=[_r]:o.includes(_r)||o.push(_r)}}if(br){if(kt.has(e))return kt.get(e);if(t){var i=(r=e).v;return(0===(r.f&ce)&&null!==r.reactions||Fr(r))&&(i=ot(r)),kt.set(r,i),i}}else if(t){if(r=e,null==dt?void 0:dt.has(r))return dt.get(r);Ur(r)&&it(r)}if(0!==(e.f&we))throw e.v;return e.v}function Fr(e){if(e.v===F)return!0;if(null===e.deps)return!1;for(const t of e.deps){if(kt.has(t))return!0;if(2&t.f&&Fr(t))return!0}return!1}function Kr(e){var t=wr;try{return wr=!0,e()}finally{wr=t}}const $r=-7169;function Hr(e,t){e.f=e.f&$r|t}function Gr(e,t){if(t){const t=document.body;e.autofocus=!0,Je(()=>{document.activeElement===t&&e.focus()})}}let Wr=!1;function Yr(){Wr||(Wr=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const r of e.target.elements)null==(t=r.__on_r)||t.call(r)})},{capture:!0}))}function Qr(e){var t=_r,r=xr;Cr(null),Er(null);try{return e()}finally{Cr(t),Er(r)}}function Jr(e,t,r,a=r){e.addEventListener(t,()=>Qr(r));const n=e.__on_r;e.__on_r=n?()=>{n(),a(!0)}:()=>a(!0),Yr()}const Xr=new Set,Zr=new Set;function ea(e,t,r,a={}){function n(e){if(a.capture||aa.call(t,e),!e.cancelBubble)return Qr(()=>null==r?void 0:r.call(this,e))}return e.startsWith("pointer")||e.startsWith("touch")||"wheel"===e?Je(()=>{t.addEventListener(e,n,a)}):t.addEventListener(e,n,a),n}function ta(e,t,r,a,n){var o={capture:a,passive:n},i=ea(e,t,r,o);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Xt(()=>{t.removeEventListener(e,i,o)})}function ra(e){for(var t=0;t<e.length;t++)Xr.add(e[t]);for(var r of Zr)r(e)}function aa(e){var t,r=this,a=r.ownerDocument,n=e.type,o=(null==(t=e.composedPath)?void 0:t.call(e))||[],i=o[0]||e.target,l=0,s=e.__root;if(s){var c=o.indexOf(s);if(-1!==c&&(r===document||r===window))return void(e.__root=r);var u=o.indexOf(r);if(-1===u)return;c<=u&&(l=c)}if((i=o[l]||e.target)!==r){Y(e,"currentTarget",{configurable:!0,get:()=>i||a});var v=_r,d=xr;Cr(null),Er(null);try{for(var p,f=[];null!==i;){var h=i.assignedSlot||i.parentNode||i.host||null;try{var g=i["__"+n];if(null!=g&&(!i.disabled||e.target===i))if($(g)){var[m,...b]=g;m.apply(i,[e,...b])}else g.call(i,e)}catch(y){p?f.push(y):p=y}if(e.cancelBubble||h===r||null===h)break;i=h}if(p){for(let e of f)queueMicrotask(()=>{throw e});throw p}}finally{e.__root=r,delete e.currentTarget,Cr(v),Er(d)}}}function na(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","\x3c!----\x3e"),t.content}function oa(e,t){var r=xr;null===r.nodes_start&&(r.nodes_start=e,r.nodes_end=t)}function ia(e,t){var r,a=!!(1&t),n=!!(2&t),o=!e.startsWith("<!>");return()=>{if(Ae)return oa(Te,null),Te;void 0===r&&(r=na(o?e:"<!>"+e),a||(r=Kt(r)));var t=n||Mt?document.importNode(r,!0):r.cloneNode(!0);a?oa(Kt(t),t.lastChild):oa(t,t);return t}}function la(e,t,r="svg"){var a,n=`<${r}>${!e.startsWith("<!>")?e:"<!>"+e}</${r}>`;return()=>{if(Ae)return oa(Te,null),Te;if(!a){var e=na(n);a=Kt(Kt(e))}var t=a.cloneNode(!0);return oa(t,t),t}}function sa(e,t){return la(e,0,"svg")}function ca(e=""){if(!Ae){var t=Ft(e+"");return oa(t,t),t}var r=Te;return 3!==r.nodeType&&(r.before(r=Ft()),Be(r)),oa(r,r),r}function ua(){if(Ae)return oa(Te,null),Te;var e=document.createDocumentFragment(),t=document.createComment(""),r=Ft();return e.append(t,r),oa(t,r),e}function va(e,t){if(Ae)return xr.nodes_end=Te,void Ne();null!==e&&e.before(t)}function da(e){return e.endsWith("capture")&&"gotpointercapture"!==e&&"lostpointercapture"!==e}const pa=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function fa(e){return pa.includes(e)}const ha={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function ga(e){return e=e.toLowerCase(),ha[e]??e}const ma=["touchstart","touchmove"];function ba(e){return ma.includes(e)}const ya=["textarea","script","style","title"];let _a=!0;function wa(e){_a=e}function Ca(e,t){var r=null==t?"":"object"==typeof t?t+"":t;r!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=r,e.nodeValue=r+"")}function xa(e,t){return ka(e,t)}function Ea(e,t){qt(),t.intro=t.intro??!1;const r=t.target,a=Ae,n=Te;try{for(var o=Kt(r);o&&(8!==o.nodeType||"["!==o.data);)o=$t(o);if(!o)throw q;Ie(!0),Be(o),Ne();const a=ka(e,{...t,anchor:o});if(null===Te||8!==Te.nodeType||"]"!==Te.data)throw q;return Ie(!1),a}catch(i){if(i===q)return!1===t.recover&&function(){throw new Error("https://svelte.dev/e/hydration_failed")}(),qt(),Yt(r),Ie(!1),xa(e,t);throw i}finally{Ie(a),Be(n)}}const Sa=new Map;function ka(e,{target:t,anchor:r,props:a={},events:n,context:o,intro:i=!0}){qt();var l=new Set,s=e=>{for(var r=0;r<e.length;r++){var a=e[r];if(!l.has(a)){l.add(a);var n=ba(a);t.addEventListener(a,aa,{passive:n});var o=Sa.get(a);void 0===o?(document.addEventListener(a,aa,{passive:n}),Sa.set(a,1)):Sa.set(a,o+1)}}};s(G(Xr)),Zr.add(s);var c=void 0,u=function(e){_t.ensure();const t=Jt(ie,e,!0);return(e={})=>new Promise(r=>{e.outro?vr(t,()=>{sr(t),r(void 0)}):(sr(t),r(void 0))})}(()=>{var u=r??t.appendChild(Ft());return or(()=>{o&&(je({}),Me.c=o);n&&(a.$$events=n),Ae&&oa(u,null),_a=i,c=e(u,a)||{},_a=!0,Ae&&(xr.nodes_end=Te),o&&qe()}),()=>{var e;for(var a of l){t.removeEventListener(a,aa);var n=Sa.get(a);0===--n?(document.removeEventListener(a,aa),Sa.delete(a)):Sa.set(a,n)}Zr.delete(s),u!==r&&(null==(e=u.parentNode)||e.removeChild(u))}});return Ta.set(c,u),c}let Ta=new WeakMap;function Aa(e){null===Me&&ke(),Zt(()=>{const t=Kr(e);if("function"==typeof t)return t})}function Ia(){const e=Me;return null===e&&ke(),(t,r,a)=>{var n;const o=null==(n=e.s.$$events)?void 0:n[t];if(o){const n=$(o)?o.slice():[o],i=function(e,t,{bubbles:r=!1,cancelable:a=!1}={}){return new CustomEvent(e,{detail:t,bubbles:r,cancelable:a})}(t,r,a);for(const t of n)t.call(e.x,i);return!i.defaultPrevented}return!0}}function Ba(e,t,r=!1){Ae&&Ne();var a=e,n=null,o=null,i=F,l=!1;const s=(e,t=!0)=>{l=!0,v(t,e)};var c=null;function u(){null!==c&&(c.lastChild.remove(),a.before(c),c=null);var e=i?n:o,t=i?o:n;e&&fr(e),t&&vr(t,()=>{i?o=null:n=null})}const v=(e,t)=>{if(i===(i=e))return;let r=!1;if(Ae){const e=De(a)===j;!!i===e&&(Be(a=Le()),Ie(!1),r=!0)}var l=!1,s=a;i?n??(n=t&&or(()=>t(s))):o??(o=t&&or(()=>t(s))),u(),r&&Ie(!0)};nr(()=>{l=!1,t(s),l||v(null,null)},r?he:0),Ae&&(a=Te)}function Na(e,t){return t}function Ra(e,t,r,a,n,o=null){var i=e,l={flags:t,items:new Map,first:null};if(!!(4&t)){var s=e;i=Ae?Be(Kt(s)):s.appendChild(Ft())}Ae&&Ne();var c,u,v=null,d=!1,p=new Map,f=at(()=>{var e=r();return $(e)?e:null==e?[]:G(e)});function h(){!function(e,t,r,a,n,o,i,l,s){var c,u,v,d,p,f,h,g,m,b,y=!!(8&i),_=!!(3&i),w=t.length,C=r.items,x=r.first,E=x,S=null,k=[],T=[];if(y)for(b=0;b<w;b+=1)g=l(h=t[b],b),void 0!==(m=C.get(g))&&(null==(c=m.a)||c.measure(),(f??(f=new Set)).add(m));for(b=0;b<w;b+=1)if(g=l(h=t[b],b),void 0!==(m=C.get(g))){if(_&&za(m,h,b,i),0!==(m.e.f&de)&&(fr(m.e),y&&(null==(u=m.a)||u.unfix(),(f??(f=new Set)).delete(m))),m!==E){if(void 0!==p&&p.has(m)){if(k.length<T.length){var A,I=T[0];S=I.prev;var B=k[0],N=k[k.length-1];for(A=0;A<k.length;A+=1)Da(k[A],I,n);for(A=0;A<T.length;A+=1)p.delete(T[A]);Ua(r,B.prev,N.next),Ua(r,S,B),Ua(r,N,I),E=I,S=N,b-=1,k=[],T=[]}else p.delete(m),Da(m,E,n),Ua(r,m.prev,m.next),Ua(r,m,null===S?r.first:S.next),Ua(r,S,m),S=m;continue}for(k=[],T=[];null!==E&&E.k!==g;)0===(E.e.f&de)&&(p??(p=new Set)).add(E),T.push(E),E=E.next;if(null===E)continue;m=E}k.push(m),S=m,E=m.next}else{var R=a.get(g);if(void 0!==R){a.delete(g),C.set(g,R);var z=S?S.next:E;Ua(r,S,R),Ua(r,R,z),Da(R,z,n),S=R}else{S=La(E?E.e.nodes_start:n,r,S,null===S?r.first:S.next,h,g,b,o,i,s)}C.set(g,S),k=[],T=[],E=S.next}if(null!==E||void 0!==p){for(var L=void 0===p?[]:G(p);null!==E;)0===(E.e.f&de)&&L.push(E),E=E.next;var D=L.length;if(D>0){var U=4&i&&0===w?n:null;if(y){for(b=0;b<D;b+=1)null==(v=L[b].a)||v.measure();for(b=0;b<D;b+=1)null==(d=L[b].a)||d.fix()}!function(e,t,r){for(var a=e.items,n=[],o=t.length,i=0;i<o;i++)pr(t[i].e,n,!0);var l=o>0&&0===n.length&&null!==r;if(l){var s=r.parentNode;Yt(s),s.append(r),a.clear(),Ua(e,t[0].prev,t[o-1].next)}dr(n,()=>{for(var r=0;r<o;r++){var n=t[r];l||(a.delete(n.k),Ua(e,n.prev,n.next)),sr(n.e,!l)}})}(r,L,U)}}y&&Je(()=>{var e;if(void 0!==f)for(m of f)null==(e=m.a)||e.apply()});for(var P of(e.first=r.first&&r.first.e,e.last=S&&S.e,a.values()))sr(P.e);a.clear()}(u,c,l,p,i,n,t,a,r),null!==o&&(0===c.length?v?fr(v):v=or(()=>o(i)):null!==v&&vr(v,()=>{v=null}))}nr(()=>{u??(u=xr);var e=(c=qr(f)).length;if(d&&0===e)return;d=0===e;let s=!1;Ae&&(De(i)===j!==(0===e)&&(Be(i=Le()),Ie(!1),s=!0));if(Ae){for(var p,g=null,m=0;m<e;m++){if(8===Te.nodeType&&"]"===Te.data){i=Te,s=!0,Ie(!1);break}var b=c[m],y=a(b,m);p=La(Te,l,g,null,b,y,m,n,t,r),l.items.set(y,p),g=p}e>0&&Be(Le())}Ae?0===e&&o&&(v=or(()=>o(i))):h();s&&Ie(!0),qr(f)}),Ae&&(i=Te)}function za(e,t,r,a){1&a&&Nt(e.v,t),2&a?Nt(e.i,r):e.i=r}function La(e,t,r,a,n,o,i,l,s,c,u){var v=!!(1&s)?!(16&s)?It(n,!1,!1):Tt(n):n,d=2&s?Tt(i):i,p={i:d,v:v,k:o,a:null,e:null,prev:r,next:a};try{if(null===e)document.createDocumentFragment().append(e=Ft());return p.e=or(()=>l(e,v,d,c),Ae),p.e.prev=r&&r.e,p.e.next=a&&a.e,null===r?u||(t.first=p):(r.next=p,r.e.next=p.e),null!==a&&(a.prev=p,a.e.prev=p.e),p}finally{}}function Da(e,t,r){for(var a=e.next?e.next.e.nodes_start:r,n=t?t.e.nodes_start:r,o=e.e.nodes_start;null!==o&&o!==a;){var i=$t(o);n.before(o),o=i}}function Ua(e,t,r){null===t?e.first=r:(t.next=r,t.e.next=r&&r.e),null!==r&&(r.prev=t,r.e.prev=t&&t.e)}function Pa(e,t,r=!1,a=!1,n=!1){var o=e,i="";ar(()=>{var e=xr;if(i!==(i=t()??"")){if(null!==e.nodes_start&&(cr(e.nodes_start,e.nodes_end),e.nodes_start=e.nodes_end=null),""!==i){if(Ae){Te.data;for(var n=Ne(),l=n;null!==n&&(8!==n.nodeType||""!==n.data);)l=n,n=$t(n);if(null===n)throw q;return oa(Te,l),void(o=Be(n))}var s=i+"";r?s=`<svg>${s}</svg>`:a&&(s=`<math>${s}</math>`);var c=na(s);if((r||a)&&(c=Kt(c)),oa(Kt(c),c.lastChild),r||a)for(;Kt(c);)o.before(Kt(c));else o.before(c)}}else Ae&&Ne()})}function Va(e,t,r,a,n){var o;Ae&&Ne();var i=null==(o=t.$$slots)?void 0:o[r],l=!1;!0===i&&(i=t["default"===r?"children":r],l=!0),void 0===i||i(e,l?()=>a:a)}function Ma(e,t,r,a,n,o){let i=Ae;var l,s;Ae&&Ne();var c=null;Ae&&1===Te.nodeType&&(c=Te,Ne());var u,v=Ae?Te:e;nr(()=>{const e=t()||null;var r="svg"===e?"http://www.w3.org/2000/svg":null;e!==l&&(u&&(null===e?vr(u,()=>{u=null,s=null}):e===s?fr(u):(sr(u),wa(!1))),e&&e!==s&&(u=or(()=>{if(oa(c=Ae?c:r?document.createElementNS(r,e):document.createElement(e),c),a){Ae&&(n=e,ya.includes(n))&&c.append(document.createComment(""));var t=Ae?Kt(c):c.appendChild(Ft());Ae&&(null===t?Ie(!1):Be(t)),a(c,t)}var n;xr.nodes_end=c,v.before(c)})),(l=e)&&(s=l),wa(!0))},he),i&&(Ie(!0),Be(v))}function Oa(e,t){tr(()=>{var r=e.getRootNode(),a=r.host?r:r.head??r.ownerDocument.head;if(!a.querySelector("#"+t.hash)){const e=document.createElement("style");e.id=t.hash,e.textContent=t.code,a.appendChild(e)}})}function ja(e,t){var r,a=void 0;nr(()=>{a!==(a=t())&&(r&&(sr(r),r=null),a&&(r=or(()=>{tr(()=>a(e))})))})}function qa(e){var t,r,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=qa(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function Fa(e){return"object"==typeof e?function(){for(var e,t,r=0,a="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=qa(e))&&(a&&(a+=" "),a+=t);return a}(e):e??""}const Ka=[..." \t\n\r\f \v\ufeff"];function $a(e,t=!1){var r=t?" !important;":";",a="";for(var n in e){var o=e[n];null!=o&&""!==o&&(a+=" "+n+": "+o+r)}return a}function Ha(e){return"-"!==e[0]||"-"!==e[1]?e.toLowerCase():e}function Ga(e,t,r,a,n,o){var i=e.__className;if(Ae||i!==r||void 0===i){var l=function(e,t,r){var a=null==e?"":""+e;if(t&&(a=a?a+" "+t:t),r)for(var n in r)if(r[n])a=a?a+" "+n:n;else if(a.length)for(var o=n.length,i=0;(i=a.indexOf(n,i))>=0;){var l=i+o;0!==i&&!Ka.includes(a[i-1])||l!==a.length&&!Ka.includes(a[l])?i=l:a=(0===i?"":a.substring(0,i))+a.substring(l+1)}return""===a?null:a}(r,a,o);Ae&&l===e.getAttribute("class")||(null==l?e.removeAttribute("class"):t?e.className=l:e.setAttribute("class",l)),e.__className=r}else if(o&&n!==o)for(var s in o){var c=!!o[s];null!=n&&c===!!n[s]||e.classList.toggle(s,c)}return o}function Wa(e,t={},r,a){for(var n in r){var o=r[n];t[n]!==o&&(null==r[n]?e.style.removeProperty(n):e.style.setProperty(n,o,a))}}function Ya(e,t,r,a){var n=e.__style;if(Ae||n!==t){var o=function(e,t){if(t){var r,a,n="";if(Array.isArray(t)?(r=t[0],a=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var o=!1,i=0,l=!1,s=[];r&&s.push(...Object.keys(r).map(Ha)),a&&s.push(...Object.keys(a).map(Ha));var c=0,u=-1;const t=e.length;for(var v=0;v<t;v++){var d=e[v];if(l?"/"===d&&"*"===e[v-1]&&(l=!1):o?o===d&&(o=!1):"/"===d&&"*"===e[v+1]?l=!0:'"'===d||"'"===d?o=d:"("===d?i++:")"===d&&i--,!l&&!1===o&&0===i)if(":"===d&&-1===u)u=v;else if(";"===d||v===t-1){if(-1!==u){var p=Ha(e.substring(c,u).trim());s.includes(p)||(";"!==d&&v++,n+=" "+e.substring(c,v).trim()+";")}c=v+1,u=-1}}}return r&&(n+=$a(r)),a&&(n+=$a(a,!0)),""===(n=n.trim())?null:n}return null==e?null:String(e)}(t,a);Ae&&o===e.getAttribute("style")||(null==o?e.removeAttribute("style"):e.style.cssText=o),e.__style=t}else a&&(Array.isArray(a)?(Wa(e,null==r?void 0:r[0],a[0]),Wa(e,null==r?void 0:r[1],a[1],"important")):Wa(e,r,a));return a}function Qa(e,t,r=!1){if(e.multiple){if(null==t)return;if(!$(t))return;for(var a of e.options)a.selected=t.includes(Xa(a))}else{for(a of e.options){if(Pt(Xa(a),t))return void(a.selected=!0)}r&&void 0===t||(e.selectedIndex=-1)}}function Ja(e){var t=new MutationObserver(()=>{Qa(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Xt(()=>{t.disconnect()})}function Xa(e){return"__value"in e?e.__value:e.value}const Za=Symbol("class"),en=Symbol("style"),tn=Symbol("is custom element"),rn=Symbol("is html");function an(e){if(Ae){var t,r=!1,a=()=>{if(!r){if(r=!0,e.hasAttribute("value")){var t=e.value;sn(e,"value",null),e.value=t}if(e.hasAttribute("checked")){var a=e.checked;sn(e,"checked",null),e.checked=a}}};e.__on_r=a,t=a,0===We.length&&He(Qe),We.push(t),Yr()}}function nn(e,t){var r=vn(e);r.value!==(r.value=t??void 0)&&(e.value!==t||0===t&&"PROGRESS"===e.nodeName)&&(e.value=t??"")}function on(e,t){var r=vn(e);r.checked!==(r.checked=t??void 0)&&(e.checked=t)}function ln(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function sn(e,t,r,a){var n=vn(e);Ae&&(n[t]=e.getAttribute(t),"src"===t||"srcset"===t||"href"===t&&"LINK"===e.nodeName)||n[t]!==(n[t]=r)&&("loading"===t&&(e[Ee]=r),null==r?e.removeAttribute(t):"string"!=typeof r&&pn(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function cn(e,t,r){var a=_r,n=xr;let o=Ae;Ae&&Ie(!1),Cr(null),Er(null);try{"style"!==t&&(dn.has(e.nodeName)||!customElements||customElements.get(e.tagName.toLowerCase())?pn(e).includes(t):r&&"object"==typeof r)?e[t]=r:sn(e,t,null==r?r:String(r))}finally{Cr(a),Er(n),o&&Ie(!0)}}function un(e,t,r=[],a=[],n,o=!1){lt(r,a,r=>{var a=void 0,i={},l="SELECT"===e.nodeName,s=!1;if(nr(()=>{var c=t(...r.map(qr)),u=function(e,t,r,a){var n=vn(e),o=n[tn],i=!n[rn];let l=Ae&&o;l&&Ie(!1);var s=t||{},c="OPTION"===e.tagName;for(var u in t)u in r||(r[u]=null);r.class?r.class=Fa(r.class):r.class=null,r[en]&&(r.style??(r.style=null));var v=pn(e);for(const m in r){let l=r[m];if(c&&"value"===m&&null==l)e.value=e.__value="",s[m]=l;else if("class"!==m)if("style"!==m){var d=s[m];if(l!==d||void 0===l&&e.hasAttribute(m)){s[m]=l;var p=m[0]+m[1];if("$$"!==p)if("on"===p){const t={},r="$$"+m;let a=m.slice(2);var f=fa(a);if(da(a)&&(a=a.slice(0,-7),t.capture=!0),!f&&d){if(null!=l)continue;e.removeEventListener(a,s[r],t),s[r]=null}if(null!=l)if(f)e[`__${a}`]=l,ra([a]);else{let n=function(e){s[m].call(this,e)};s[r]=ea(a,e,n,t)}else f&&(e[`__${a}`]=void 0)}else if("style"===m)sn(e,m,l);else if("autofocus"===m)Gr(e,Boolean(l));else if(o||"__value"!==m&&("value"!==m||null==l))if("selected"===m&&c)ln(e,l);else{var h=m;i||(h=ga(h));var g="defaultValue"===h||"defaultChecked"===h;if(null!=l||o||g)g||v.includes(h)&&(o||"string"!=typeof l)?e[h]=l:"function"!=typeof l&&sn(e,h,l);else if(n[m]=null,"value"===h||"checked"===h){let r=e;const a=void 0===t;if("value"===h){let e=r.defaultValue;r.removeAttribute(h),r.defaultValue=e,r.value=r.__value=a?e:null}else{let e=r.defaultChecked;r.removeAttribute(h),r.defaultChecked=e,r.checked=!!a&&e}}else e.removeAttribute(m)}else e.value=e.__value=l}}else Ya(e,l,null==t?void 0:t[en],r[en]),s[m]=l,s[en]=r[en];else Ga(e,"http://www.w3.org/1999/xhtml"===e.namespaceURI,l,a,null==t?void 0:t[Za],r[Za]),s[m]=l,s[Za]=r[Za]}return l&&Ie(!0),s}(e,a,c,n,o);s&&l&&"value"in c&&Qa(e,c.value);for(let e of Object.getOwnPropertySymbols(i))c[e]||sr(i[e]);for(let t of Object.getOwnPropertySymbols(c)){var v=c[t];"@attach"!==t.description||a&&v===a[t]||(i[t]&&sr(i[t]),i[t]=or(()=>ja(e,()=>v))),u[t]=v}a=u}),l){var c=e;tr(()=>{Qa(c,a.value,!0),Ja(c)})}s=!0})}function vn(e){return e.__attributes??(e.__attributes={[tn]:e.nodeName.includes("-"),[rn]:"http://www.w3.org/1999/xhtml"===e.namespaceURI})}var dn=new Map;function pn(e){var t,r=dn.get(e.nodeName);if(r)return r;dn.set(e.nodeName,r=[]);for(var a=e,n=Element.prototype;n!==a;){for(var o in t=J(a))t[o].set&&r.push(o);a=ee(a)}return r}const fn={tick:e=>requestAnimationFrame(e),now:()=>performance.now(),tasks:new Set};function hn(){const e=fn.now();fn.tasks.forEach(t=>{t.c(e)||(fn.tasks.delete(t),t.f())}),0!==fn.tasks.size&&fn.tick(hn)}function gn(e,t){Qr(()=>{e.dispatchEvent(new CustomEvent(t))})}function mn(e){if("float"===e)return"cssFloat";if("offset"===e)return"cssOffset";if(e.startsWith("--"))return e;const t=e.split("-");return 1===t.length?t[0]:t[0]+t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}function bn(e){const t={},r=e.split(";");for(const a of r){const[e,r]=a.split(":");if(!e||void 0===r)break;t[mn(e.trim())]=r.trim()}return t}const yn=e=>e;function _n(e,t,r,a){var n,o,i,l=!!(1&e),s=!!(2&e),c=!!(4&e),u=l&&s?"both":l?"in":"out",v=t.inert,d=t.style.overflow;function p(){return Qr(()=>n??(n=r()(t,(null==a?void 0:a())??{},{direction:u})))}var f={is_global:c,in(){var e;if(t.inert=v,!l)return null==i||i.abort(),void(null==(e=null==i?void 0:i.reset)||e.call(i));s||null==o||o.abort(),gn(t,"introstart"),o=wn(t,p(),i,1,()=>{gn(t,"introend"),null==o||o.abort(),o=n=void 0,t.style.overflow=d})},out(e){if(!s)return null==e||e(),void(n=void 0);t.inert=!0,gn(t,"outrostart"),i=wn(t,p(),o,0,()=>{gn(t,"outroend"),null==e||e()})},stop:()=>{null==o||o.abort(),null==i||i.abort()}},h=xr;if((h.transitions??(h.transitions=[])).push(f),l&&_a){var g=c;if(!g){for(var m=h.parent;m&&0!==(m.f&he);)for(;(m=m.parent)&&0===(m.f&ne););g=!m||0!==(m.f&fe)}g&&tr(()=>{Kr(()=>f.in())})}}function wn(e,t,r,a,n){var o=1===a;if("function"==typeof t){var i,l=!1;return Je(()=>{if(!l){var s=t({direction:o?"in":"out"});i=wn(e,s,r,a,n)}}),{abort:()=>{l=!0,null==i||i.abort()},deactivate:()=>i.deactivate(),reset:()=>i.reset(),t:()=>i.t()}}if(null==r||r.deactivate(),!(null==t?void 0:t.duration))return n(),{abort:re,deactivate:re,reset:re,t:()=>a};const{delay:s=0,css:c,tick:u,easing:v=yn}=t;var d=[];if(o&&void 0===r&&(u&&u(0,1),c)){var p=bn(c(0,1));d.push(p,p)}var f=()=>1-a,h=e.animate(d,{duration:s,fill:"forwards"});return h.onfinish=()=>{h.cancel();var o=(null==r?void 0:r.t())??1-a;null==r||r.abort();var i=a-o,l=t.duration*Math.abs(i),s=[];if(l>0){var d=!1;if(c)for(var p=Math.ceil(l/(1e3/60)),g=0;g<=p;g+=1){var m=o+i*v(g/p),b=bn(c(m,1-m));s.push(b),d||(d="hidden"===b.overflow)}d&&(e.style.overflow="hidden"),f=()=>{var e=h.currentTime;return o+i*v(e/l)},u&&function(e){let t;0===fn.tasks.size&&fn.tick(hn),new Promise(r=>{fn.tasks.add(t={c:e,f:r})})}(()=>{if("running"!==h.playState)return!1;var e=f();return u(e,1-e),!0})}(h=e.animate(s,{duration:l,fill:"forwards"})).onfinish=()=>{f=()=>a,null==u||u(a,1-a),n()}},{abort:()=>{h&&(h.cancel(),h.effect=null,h.onfinish=re)},deactivate:()=>{n=re},reset:()=>{0===a&&(null==u||u(1,0))},t:()=>f()}}function Cn(e,t,r=t){var a=new WeakSet;Jr(e,"input",n=>{var o=n?e.defaultValue:e.value;if(o=xn(e)?En(o):o,r(o),null!==ut&&a.add(ut),o!==(o=t())){var i=e.selectionStart,l=e.selectionEnd;e.value=o??"",null!==l&&(e.selectionStart=i,e.selectionEnd=Math.min(l,e.value.length))}}),(Ae&&e.defaultValue!==e.value||null==Kr(t)&&e.value)&&(r(xn(e)?En(e.value):e.value),null!==ut&&a.add(ut)),rr(()=>{var r=t();if(e===document.activeElement){var n=vt??ut;if(a.has(n))return}xn(e)&&r===En(e.value)||("date"!==e.type||r||e.value)&&r!==e.value&&(e.value=r??"")})}function xn(e){var t=e.type;return"number"===t||"range"===t}function En(e){return""===e?null:+e}function Sn(e,t){return e===t||(null==e?void 0:e[Ce])===t}function kn(e={},t,r,a){return tr(()=>{var a,n;return rr(()=>{a=n,n=[],Kr(()=>{e!==r(...n)&&(t(e,...n),a&&Sn(r(...a),e)&&t(null,...a))})}),()=>{Je(()=>{n&&Sn(r(...n),e)&&t(null,...n)})}}),e}function Tn(e,t,r){if(null==e)return t(void 0),re;const a=Kr(()=>e.subscribe(t,r));return a.unsubscribe?()=>a.unsubscribe():a}const An=[];let In,Bn=!1,Nn=Symbol();function Rn(e,t,r){const a=r[t]??(r[t]={store:null,source:It(void 0),unsubscribe:re});if(a.store!==e&&!(Nn in r))if(a.unsubscribe(),a.store=e??null,null==e)a.source.v=void 0,a.unsubscribe=re;else{var n=!0;a.unsubscribe=Tn(e,e=>{n?a.source.v=e:Bt(a.source,e)}),n=!1}return e&&Nn in r?function(e){let t;return Tn(e,e=>t=e)(),t}(e):qr(a.source)}function zn(e,t,r,a){var n,o,i,l=!!(8&r),s=!!(16&r),c=a,u=!0,v=()=>(u&&(u=!1,c=s?Kr(a):a),c);if(l){var d=Ce in e||xe in e;o=(null==(n=Q(e,t))?void 0:n.set)??(d&&t in e?r=>e[t]=r:void 0)}var p,f=!1;if(l?[i,f]=function(e){var t=Bn;try{return Bn=!1,[e(),Bn]}finally{Bn=t}}(()=>e[t]):i=e[t],void 0===i&&void 0!==a&&(i=v(),o&&(!function(){throw new Error("https://svelte.dev/e/props_invalid_value")}(),o(i))),p=()=>{var r=e[t];return void 0===r?v():(u=!0,r)},!(4&r))return p;if(o){var h=e.$$legacy;return function(e,t){return arguments.length>0?((!t||h||f)&&o(t?p():e),e):p()}}var g=!1,m=(1&r?et:at)(()=>(g=!1,p()));l&&qr(m);var b=xr;return function(e,t){if(arguments.length>0){const r=t?qr(m):l?Dt(e):e;return Bt(m,r),g=!0,void 0!==c&&(c=r),e}return br&&g||0!==(b.f&pe)?m.v:qr(m)}}class Ln{constructor(e){var t;S(this,b),S(this,y);var r=new Map,a=(e,t)=>{var a=It(t,!1,!1);return r.set(e,a),a};const n=new Proxy({...e.props||{},$$events:{}},{get:(e,t)=>qr(r.get(t)??a(t,Reflect.get(e,t))),has:(e,t)=>t===xe||(qr(r.get(t)??a(t,Reflect.get(e,t))),Reflect.has(e,t)),set:(e,t,n)=>(Bt(r.get(t)??a(t,n),n),Reflect.set(e,t,n))});k(this,y,(e.hydrate?Ea:xa)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:e.intro??!1,recover:e.recover})),(null==(t=null==e?void 0:e.props)?void 0:t.$$host)&&!1!==e.sync||wt(),k(this,b,n.$$events);for(const o of Object.keys(E(this,y)))"$set"!==o&&"$destroy"!==o&&"$on"!==o&&Y(this,o,{get(){return E(this,y)[o]},set(e){E(this,y)[o]=e},enumerable:!0});E(this,y).$set=e=>{Object.assign(n,e)},E(this,y).$destroy=()=>{!function(e,t){const r=Ta.get(e);r?(Ta.delete(e),r(t)):Promise.resolve()}(E(this,y))}}$set(e){E(this,y).$set(e)}$on(e,t){E(this,b)[e]=E(this,b)[e]||[];const r=(...e)=>t.call(this,...e);return E(this,b)[e].push(r),()=>{E(this,b)[e]=E(this,b)[e].filter(e=>e!==r)}}$destroy(){E(this,y).$destroy()}}function Dn(e,t,r,a){var n;const o=null==(n=r[e])?void 0:n.type;if(t="Boolean"===o&&"boolean"!=typeof t?null!=t:t,!a||!r[e])return t;if("toAttribute"===a)switch(o){case"Object":case"Array":return null==t?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return null==t?null:t;default:return t}else switch(o){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":default:return t;case"Number":return null!=t?+t:t}}function Un(e,t,r,a,n,o){let i=class extends In{constructor(){super(e,r,n),this.$$p_d=t}static get observedAttributes(){return W(t).map(e=>(t[e].attribute||e).toLowerCase())}};return W(t).forEach(e=>{Y(i.prototype,e,{get(){return this.$$c&&e in this.$$c?this.$$c[e]:this.$$d[e]},set(r){var a;r=Dn(e,r,t),this.$$d[e]=r;var n=this.$$c;n&&((null==(a=Q(n,e))?void 0:a.get)?n[e]=r:n.$set({[e]:r}))}})}),a.forEach(e=>{Y(i.prototype,e,{get(){var t;return null==(t=this.$$c)?void 0:t[e]}})}),e.element=i,i}b=new WeakMap,y=new WeakMap,"function"==typeof HTMLElement&&(In=class extends HTMLElement{constructor(e,t,r){super(),C(this,"$$ctor"),C(this,"$$s"),C(this,"$$c"),C(this,"$$cn",!1),C(this,"$$d",{}),C(this,"$$r",!1),C(this,"$$p_d",{}),C(this,"$$l",{}),C(this,"$$l_u",new Map),C(this,"$$me"),this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const r=this.$$c.$on(e,t);this.$$l_u.set(t,r)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const e=this.$$l_u.get(t);e&&(e(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(e){return t=>{const r=document.createElement("slot");"default"!==e&&(r.name=e),va(t,r)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const r={},a=function(e){const t={};return e.childNodes.forEach(e=>{t[e.slot||"default"]=!0}),t}(this);for(const e of this.$$s)e in a&&("default"!==e||this.$$d.children?r[e]=t(e):(this.$$d.children=t(e),r.default=!0));for(const e of this.attributes){const t=this.$$g_p(e.name);t in this.$$d||(this.$$d[t]=Dn(t,e.value,this.$$p_d,"toProp"))}for(const e in this.$$p_d)e in this.$$d||void 0===this[e]||(this.$$d[e]=this[e],delete this[e]);this.$$c=(e={component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}},new Ln(e)),this.$$me=function(e){_t.ensure();const t=Jt(ie,e,!0);return()=>{sr(t)}}(()=>{rr(()=>{var e;this.$$r=!0;for(const t of W(this.$$c)){if(!(null==(e=this.$$p_d[t])?void 0:e.reflect))continue;this.$$d[t]=this.$$c[t];const r=Dn(t,this.$$d[t],this.$$p_d,"toAttribute");null==r?this.removeAttribute(this.$$p_d[t].attribute||t):this.setAttribute(this.$$p_d[t].attribute||t,r)}this.$$r=!1})});for(const e in this.$$l)for(const t of this.$$l[e]){const r=this.$$c.$on(e,t);this.$$l_u.set(t,r)}this.$$l={}}var e}attributeChangedCallback(e,t,r){var a;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Dn(e,r,this.$$p_d,"toProp"),null==(a=this.$$c)||a.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return W(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});var Pn,Vn,Mn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function On(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}),r}function jn(){return Vn?Pn:(Vn=1,Pn={options:{usePureJavaScript:!1}})}var qn,Fn,Kn,$n,Hn,Gn={exports:{}};function Wn(){if(Kn)return Gn.exports;Kn=1;var e=jn(),t=function(){if(Fn)return qn;Fn=1;var e={};qn=e;var t={};return e.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var a="";if(e instanceof Uint8Array){var n=0,o=t.length,i=t.charAt(0),l=[0];for(n=0;n<e.length;++n){for(var s=0,c=e[n];s<l.length;++s)c+=l[s]<<8,l[s]=c%o,c=c/o|0;for(;c>0;)l.push(c%o),c=c/o|0}for(n=0;0===e[n]&&n<e.length-1;++n)a+=i;for(n=l.length-1;n>=0;--n)a+=t[l[n]]}else a=function(e,t){var r=0,a=t.length,n=t.charAt(0),o=[0];for(r=0;r<e.length();++r){for(var i=0,l=e.at(r);i<o.length;++i)l+=o[i]<<8,o[i]=l%a,l=l/a|0;for(;l>0;)o.push(l%a),l=l/a|0}var s="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)s+=n;for(r=o.length-1;r>=0;--r)s+=t[o[r]];return s}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");a=a.match(u).join("\r\n")}return a},e.decode=function(e,r){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof r)throw new TypeError('"alphabet" must be a string.');var a=t[r];if(!a){a=t[r]=[];for(var n=0;n<r.length;++n)a[r.charCodeAt(n)]=n}e=e.replace(/\s/g,"");var o=r.length,i=r.charAt(0),l=[0];for(n=0;n<e.length;n++){var s=a[e.charCodeAt(n)];if(void 0===s)return;for(var c=0,u=s;c<l.length;++c)u+=l[c]*o,l[c]=255&u,u>>=8;for(;u>0;)l.push(255&u),u>>=8}for(var v=0;e[v]===i&&v<e.length-1;++v)l.push(0);return"undefined"!=typeof Buffer?Buffer.from(l.reverse()):new Uint8Array(l.reverse())},qn}(),r=Gn.exports=e.util=e.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function n(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(r.isArrayBuffer(e)||r.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(o){for(var a=0;a<t.length;++a)this.putByte(t[a])}}else(e instanceof n||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return r.nextTick=process.nextTick,void("function"==typeof setImmediate?r.setImmediate=setImmediate:r.setImmediate=r.nextTick);if("function"==typeof setImmediate)return r.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(r.nextTick=function(e){return setImmediate(e)});if(r.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){let a=function(r){if(r.source===window&&r.data===e){r.stopPropagation();var a=t.slice();t.length=0,a.forEach(function(e){e()})}};var e="forge.setImmediate",t=[];r.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",a,!0)}if("undefined"!=typeof MutationObserver){var a=Date.now(),n=!0,o=document.createElement("div");t=[];new MutationObserver(function(){var e=t.slice();t.length=0,e.forEach(function(e){e()})}).observe(o,{attributes:!0});var i=r.setImmediate;r.setImmediate=function(e){Date.now()-a>15?(a=Date.now(),i(e)):(t.push(e),1===t.length&&o.setAttribute("a",n=!n))}}r.nextTick=r.setImmediate}(),r.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,r.globalScope=r.isNodejs?Mn:"undefined"==typeof self?window:self,r.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},r.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},r.isArrayBufferView=function(e){return e&&r.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},r.ByteBuffer=n,r.ByteStringBuffer=n;r.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},r.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},r.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},r.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},r.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},r.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},r.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(r.encodeUtf8(e))},r.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},r.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},r.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},r.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},r.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},r.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},r.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},r.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},r.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},r.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},r.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},r.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},r.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},r.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},r.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},r.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},r.ByteStringBuffer.prototype.getInt=function(e){a(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},r.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},r.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},r.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},r.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},r.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},r.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},r.ByteStringBuffer.prototype.copy=function(){var e=r.createBuffer(this.data);return e.read=this.read,e},r.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},r.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},r.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},r.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},r.ByteStringBuffer.prototype.toString=function(){return r.decodeUtf8(this.bytes())},r.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var a=r.isArrayBuffer(e),n=r.isArrayBufferView(e);if(a||n)return this.data=a?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},r.DataBuffer.prototype.length=function(){return this.write-this.read},r.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},r.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),a=new Uint8Array(this.length()+t);return a.set(r),this.data=new DataView(a.buffer),this},r.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},r.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},r.DataBuffer.prototype.putBytes=function(e,t){if(r.isArrayBufferView(e)){var a=(n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-n.byteOffset;return this.accommodate(a),new Uint8Array(this.data.buffer,this.write).set(n),this.write+=a,this}if(r.isArrayBuffer(e)){var n=new Uint8Array(e);return this.accommodate(n.byteLength),new Uint8Array(this.data.buffer).set(n,this.write),this.write+=n.byteLength,this}if(e instanceof r.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&r.isArrayBufferView(e.data)){n=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(n.byteLength),new Uint8Array(e.data.byteLength,this.write).set(n),this.write+=n.byteLength,this}if(e instanceof r.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var o;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),o=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.hex.decode(e,o,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),o=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.base64.decode(e,o,this.write),this;if("utf8"===t&&(e=r.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.raw.decode(o),this;if("utf16"===t)return this.accommodate(2*e.length),o=new Uint16Array(this.data.buffer,this.write),this.write+=r.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},r.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},r.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},r.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},r.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},r.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},r.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},r.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},r.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},r.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},r.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},r.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},r.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},r.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},r.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},r.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},r.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},r.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},r.DataBuffer.prototype.getInt=function(e){a(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},r.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},r.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},r.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},r.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},r.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},r.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},r.DataBuffer.prototype.copy=function(){return new r.DataBuffer(this)},r.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},r.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},r.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},r.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},r.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return r.binary.raw.encode(t);if("hex"===e)return r.binary.hex.encode(t);if("base64"===e)return r.binary.base64.encode(t);if("utf8"===e)return r.text.utf8.decode(t);if("utf16"===e)return r.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},r.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=r.encodeUtf8(e)),new r.ByteBuffer(e)},r.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},r.xorBytes=function(e,t,r){for(var a="",n="",o="",i=0,l=0;r>0;--r,++i)n=e.charCodeAt(i)^t.charCodeAt(i),l>=10&&(a+=o,o="",l=0),o+=String.fromCharCode(n),++l;return a+=o},r.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},r.bytesToHex=function(e){return r.createBuffer(e).toHex()},r.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";r.encode64=function(e,t){for(var r,a,n,i="",l="",s=0;s<e.length;)r=e.charCodeAt(s++),a=e.charCodeAt(s++),n=e.charCodeAt(s++),i+=o.charAt(r>>2),i+=o.charAt((3&r)<<4|a>>4),isNaN(a)?i+="==":(i+=o.charAt((15&a)<<2|n>>6),i+=isNaN(n)?"=":o.charAt(63&n)),t&&i.length>t&&(l+=i.substr(0,t)+"\r\n",i=i.substr(t));return l+=i},r.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,a,n,o="",l=0;l<e.length;)t=i[e.charCodeAt(l++)-43],r=i[e.charCodeAt(l++)-43],a=i[e.charCodeAt(l++)-43],n=i[e.charCodeAt(l++)-43],o+=String.fromCharCode(t<<2|r>>4),64!==a&&(o+=String.fromCharCode((15&r)<<4|a>>2),64!==n&&(o+=String.fromCharCode((3&a)<<6|n)));return o},r.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},r.decodeUtf8=function(e){return decodeURIComponent(escape(e))},r.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:t.encode,decode:t.decode}},r.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},r.binary.raw.decode=function(e,t,r){var a=t;a||(a=new Uint8Array(e.length));for(var n=r=r||0,o=0;o<e.length;++o)a[n++]=e.charCodeAt(o);return t?n-r:a},r.binary.hex.encode=r.bytesToHex,r.binary.hex.decode=function(e,t,r){var a=t;a||(a=new Uint8Array(Math.ceil(e.length/2)));var n=0,o=r=r||0;for(1&e.length&&(n=1,a[o++]=parseInt(e[0],16));n<e.length;n+=2)a[o++]=parseInt(e.substr(n,2),16);return t?o-r:a},r.binary.base64.encode=function(e,t){for(var r,a,n,i="",l="",s=0;s<e.byteLength;)r=e[s++],a=e[s++],n=e[s++],i+=o.charAt(r>>2),i+=o.charAt((3&r)<<4|a>>4),isNaN(a)?i+="==":(i+=o.charAt((15&a)<<2|n>>6),i+=isNaN(n)?"=":o.charAt(63&n)),t&&i.length>t&&(l+=i.substr(0,t)+"\r\n",i=i.substr(t));return l+=i},r.binary.base64.decode=function(e,t,r){var a,n,o,l,s=t;s||(s=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c<e.length;)a=i[e.charCodeAt(c++)-43],n=i[e.charCodeAt(c++)-43],o=i[e.charCodeAt(c++)-43],l=i[e.charCodeAt(c++)-43],s[u++]=a<<2|n>>4,64!==o&&(s[u++]=(15&n)<<4|o>>2,64!==l&&(s[u++]=(3&o)<<6|l));return t?u-r:s.subarray(0,u)},r.binary.base58.encode=function(e,t){return r.binary.baseN.encode(e,l,t)},r.binary.base58.decode=function(e,t){return r.binary.baseN.decode(e,l,t)},r.text={utf8:{},utf16:{}},r.text.utf8.encode=function(e,t,a){e=r.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var o=a=a||0,i=0;i<e.length;++i)n[o++]=e.charCodeAt(i);return t?o-a:n},r.text.utf8.decode=function(e){return r.decodeUtf8(String.fromCharCode.apply(null,e))},r.text.utf16.encode=function(e,t,r){var a=t;a||(a=new Uint8Array(2*e.length));for(var n=new Uint16Array(a.buffer),o=r=r||0,i=r,l=0;l<e.length;++l)n[i++]=e.charCodeAt(l),o+=2;return t?o-r:a},r.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},r.deflate=function(e,t,a){if(t=r.decode64(e.deflate(r.encode64(t)).rval),a){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4)}return t},r.inflate=function(e,t,a){var n=e.inflate(r.encode64(t)).rval;return null===n?null:r.decode64(n)};var s=function(e,t,a){if(!e)throw new Error("WebStorage not available.");var n;if(null===a?n=e.removeItem(t):(a=r.encode64(JSON.stringify(a)),n=e.setItem(t,a)),void 0!==n&&!0!==n.rval){var o=new Error(n.error.message);throw o.id=n.error.id,o.name=n.error.name,o}},c=function(e,t){if(!e)throw new Error("WebStorage not available.");var a=e.getItem(t);if(e.init)if(null===a.rval){if(a.error){var n=new Error(a.error.message);throw n.id=a.error.id,n.name=a.error.name,n}a=null}else a=a.rval;return null!==a&&(a=JSON.parse(r.decode64(a))),a},u=function(e,t,r,a){var n=c(e,t);null===n&&(n={}),n[r]=a,s(e,t,n)},v=function(e,t,r){var a=c(e,t);return null!==a&&(a=r in a?a[r]:null),a},d=function(e,t,r){var a=c(e,t);if(null!==a&&r in a){delete a[r];var n=!0;for(var o in a){n=!1;break}n&&(a=null),s(e,t,a)}},p=function(e,t){s(e,t,null)},f=function(e,t,r){var a,n=null;void 0===r&&(r=["web","flash"]);var o=!1,i=null;for(var l in r){a=r[l];try{if("flash"===a||"both"===a){if(null===t[0])throw new Error("Flash local storage not available.");n=e.apply(this,t),o="flash"===a}"web"!==a&&"both"!==a||(t[0]=localStorage,n=e.apply(this,t),o=!0)}catch(s){i=s}if(o)break}if(!o)throw i;return n};return r.setItem=function(e,t,r,a,n){f(u,arguments,n)},r.getItem=function(e,t,r,a){return f(v,arguments,a)},r.removeItem=function(e,t,r,a){f(d,arguments,a)},r.clearItems=function(e,t,r){f(p,arguments,r)},r.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},r.format=function(e){for(var t,r,a=/%./g,n=0,o=[],i=0;t=a.exec(e);){(r=e.substring(i,a.lastIndex-2)).length>0&&o.push(r),i=a.lastIndex;var l=t[0][1];switch(l){case"s":case"o":n<arguments.length?o.push(arguments[1+n++]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+l+"?>")}}return o.push(e.substring(i)),o.join("")},r.formatNumber=function(e,t,r,a){var n=e,o=isNaN(t=Math.abs(t))?2:t,i=void 0===r?",":r,l=void 0===a?".":a,s=n<0?"-":"",c=parseInt(n=Math.abs(+n||0).toFixed(o),10)+"",u=c.length>3?c.length%3:0;return s+(u?c.substr(0,u)+l:"")+c.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+l)+(o?i+Math.abs(n-c).toFixed(o).slice(2):"")},r.formatSize=function(e){return e=e>=1073741824?r.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?r.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?r.formatNumber(e/1024,0)+" KiB":r.formatNumber(e,0)+" bytes"},r.bytesFromIP=function(e){return-1!==e.indexOf(".")?r.bytesFromIPv4(e):-1!==e.indexOf(":")?r.bytesFromIPv6(e):null},r.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=r.createBuffer(),a=0;a<e.length;++a){var n=parseInt(e[a],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},r.bytesFromIPv6=function(e){for(var t=0,a=2*(8-(e=e.split(":").filter(function(e){return 0===e.length&&++t,!0})).length+t),n=r.createBuffer(),o=0;o<8;++o)if(e[o]&&0!==e[o].length){var i=r.hexToBytes(e[o]);i.length<2&&n.putByte(0),n.putBytes(i)}else n.fillWithByte(0,a),a=0;return n.getBytes()},r.bytesToIP=function(e){return 4===e.length?r.bytesToIPv4(e):16===e.length?r.bytesToIPv6(e):null},r.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},r.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],a=[],n=0,o=0;o<e.length;o+=2){for(var i=r.bytesToHex(e[o]+e[o+1]);"0"===i[0]&&"0"!==i;)i=i.substr(1);if("0"===i){var l=a[a.length-1],s=t.length;l&&s===l.end+1?(l.end=s,l.end-l.start>a[n].end-a[n].start&&(n=a.length-1)):a.push({start:s,end:s})}t.push(i)}if(a.length>0){var c=a[n];c.end-c.start>0&&(t.splice(c.start,c.end-c.start+1,""),0===c.start&&t.unshift(""),7===c.end&&t.push(""))}return t.join(":")},r.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in r&&!e.update)return t(null,r.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return r.cores=navigator.hardwareConcurrency,t(null,r.cores);if("undefined"==typeof Worker)return r.cores=1,t(null,r.cores);if("undefined"==typeof Blob)return r.cores=2,t(null,r.cores);var a=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){var t=Date.now(),r=t+4;self.postMessage({st:t,et:r})})}.toString(),")()"],{type:"application/javascript"}));!function e(n,o,i){if(0===o){var l=Math.floor(n.reduce(function(e,t){return e+t},0)/n.length);return r.cores=Math.max(1,l),URL.revokeObjectURL(a),t(null,r.cores)}!function(e,t){for(var r=[],n=[],o=0;o<e;++o){var i=new Worker(a);i.addEventListener("message",function(a){if(n.push(a.data),n.length===e){for(var o=0;o<e;++o)r[o].terminate();t(null,n)}}),r.push(i)}for(o=0;o<e;++o)r[o].postMessage(o)}(i,function(t,r){n.push(function(e,t){for(var r=[],a=0;a<e;++a)for(var n=t[a],o=r[a]=[],i=0;i<e;++i)if(a!==i){var l=t[i];(n.st>l.st&&n.st<l.et||l.st>n.st&&l.st<n.et)&&o.push(i)}return r.reduce(function(e,t){return Math.max(e,t.length)},0)}(i,r)),e(n,o-1,i)})}([],5,16)},Gn.exports}function Yn(){if(Hn)return $n;Hn=1;var e=jn();Wn(),$n=e.cipher=e.cipher||{},e.cipher.algorithms=e.cipher.algorithms||{},e.cipher.createCipher=function(t,r){var a=t;if("string"==typeof a&&(a=e.cipher.getAlgorithm(a))&&(a=a()),!a)throw new Error("Unsupported algorithm: "+t);return new e.cipher.BlockCipher({algorithm:a,key:r,decrypt:!1})},e.cipher.createDecipher=function(t,r){var a=t;if("string"==typeof a&&(a=e.cipher.getAlgorithm(a))&&(a=a()),!a)throw new Error("Unsupported algorithm: "+t);return new e.cipher.BlockCipher({algorithm:a,key:r,decrypt:!0})},e.cipher.registerAlgorithm=function(t,r){t=t.toUpperCase(),e.cipher.algorithms[t]=r},e.cipher.getAlgorithm=function(t){return(t=t.toUpperCase())in e.cipher.algorithms?e.cipher.algorithms[t]:null};var t=e.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};return t.prototype.start=function(t){t=t||{};var r={};for(var a in t)r[a]=t[a];r.decrypt=this._decrypt,this._finish=!1,this._input=e.util.createBuffer(),this.output=t.output||e.util.createBuffer(),this.mode.start(r)},t.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},t.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))},$n}var Qn,Jn,Xn,Zn={exports:{}};function eo(){if(Qn)return Zn.exports;Qn=1;var e=jn();Wn(),e.cipher=e.cipher||{};var t=Zn.exports=e.cipher.modes=e.cipher.modes||{};function r(t,r){if("string"==typeof t&&(t=e.util.createBuffer(t)),e.util.isArray(t)&&t.length>4){var a=t;t=e.util.createBuffer();for(var n=0;n<a.length;++n)t.putByte(a[n])}if(t.length()<r)throw new Error("Invalid IV length; got "+t.length()+" bytes and expected "+r+" bytes.");if(!e.util.isArray(t)){var o=[],i=r/4;for(n=0;n<i;++n)o.push(t.getInt32());t=o}return t}function a(e){e[e.length-1]=e[e.length-1]+1&4294967295}function n(e){return[e/4294967296|0,4294967295&e]}return t.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.ecb.prototype.start=function(e){},t.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._outBlock[a])},t.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._outBlock[a])},t.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),a=e.at(r-1);return!(a>this.blockSize<<2)&&(e.truncate(a),!0)},t.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},t.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=this._prev[a]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._outBlock[a]);this._prev=this._outBlock},t.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(a=0;a<this._ints;++a)t.putInt32(this._prev[a]^this._outBlock[a]);this._prev=this._inBlock.slice(0)},t.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),a=e.at(r-1);return!(a>this.blockSize<<2)&&(e.truncate(a),!0)},t.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},t.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.cfb.prototype.encrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32()^this._outBlock[n],t.putInt32(this._inBlock[n]);else{var o=(this.blockSize-a)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32()^this._outBlock[n],this._partialOutput.putInt32(this._partialBlock[n]);if(o>0)e.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},t.cfb.prototype.decrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32(),t.putInt32(this._inBlock[n]^this._outBlock[n]);else{var o=(this.blockSize-a)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[n]^this._outBlock[n]);if(o>0)e.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},t.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},t.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ofb.prototype.encrypt=function(e,t,r){var a=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]),this._inBlock[n]=this._outBlock[n];else{var o=(this.blockSize-a)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(o>0)e.read-=this.blockSize;else for(n=0;n<this._ints;++n)this._inBlock[n]=this._outBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},t.ofb.prototype.decrypt=t.ofb.prototype.encrypt,t.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0},t.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)t.putInt32(e.getInt32()^this._outBlock[o]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(i>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},t.ctr.prototype.decrypt=t.ctr.prototype.encrypt,t.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=e.util.createBuffer(),this._partialBytes=0,this._R=3774873600},t.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var r,o=e.util.createBuffer(t.iv);if(this._cipherLength=0,r="additionalData"in t?e.util.createBuffer(t.additionalData):e.util.createBuffer(),this._tagLength="tagLength"in t?t.tagLength:128,this._tag=null,t.decrypt&&(this._tag=e.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=o.length();if(12===i)this._j0=[o.getInt32(),o.getInt32(),o.getInt32(),1];else{for(this._j0=[0,0,0,0];o.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[o.getInt32(),o.getInt32(),o.getInt32(),o.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(n(8*i)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,r=e.util.createBuffer(r),this._aDataLength=n(8*r.length());var l=r.length()%this.blockSize;for(l&&r.fillWithByte(0,this.blockSize-l),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},t.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var o=0;o<this._ints;++o)t.putInt32(this._outBlock[o]^=e.getInt32());this._cipherLength+=this.blockSize}else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(i<=0||r){if(r){var l=n%this.blockSize;this._cipherLength+=l,this._partialOutput.truncate(this.blockSize-l)}else this._cipherLength+=this.blockSize;for(o=0;o<this._ints;++o)this._outBlock[o]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},t.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var o=0;o<this._ints;++o)t.putInt32(this._outBlock[o]^this._hashBlock[o]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},t.gcm.prototype.afterFinish=function(t,r){var a=!0;r.decrypt&&r.overflow&&t.truncate(this.blockSize-r.overflow),this.tag=e.util.createBuffer();var o=this._aDataLength.concat(n(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,o);var i=[];this.cipher.encrypt(this._j0,i);for(var l=0;l<this._ints;++l)this.tag.putInt32(this._s[l]^i[l]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),r.decrypt&&this.tag.bytes()!==this._tag&&(a=!1),a},t.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],a=t.slice(0),n=0;n<128;++n){e[n/32|0]&1<<31-n%32&&(r[0]^=a[0],r[1]^=a[1],r[2]^=a[2],r[3]^=a[3]),this.pow(a,a)}return r},t.gcm.prototype.pow=function(e,t){for(var r=1&e[3],a=3;a>0;--a)t[a]=e[a]>>>1|(1&e[a-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},t.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var a=e[r/8|0]>>>4*(7-r%8)&15,n=this._m[r][a];t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]}return t},t.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},t.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,a=4*r,n=16*r,o=new Array(n),i=0;i<n;++i){var l=[0,0,0,0],s=(a-1-i%a)*t;l[i/a|0]=1<<t-1<<s,o[i]=this.generateSubHashTable(this.multiply(l,e),t)}return o},t.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,a=r>>>1,n=new Array(r);n[a]=e.slice(0);for(var o=a>>>1;o>0;)this.pow(n[2*o],n[o]=[]),o>>=1;for(o=2;o<a;){for(var i=1;i<o;++i){var l=n[o],s=n[i];n[o+i]=[l[0]^s[0],l[1]^s[1],l[2]^s[2],l[3]^s[3]]}o*=2}for(n[0]=[0,0,0,0],o=a+1;o<r;++o){var c=n[o^a];n[o]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return n},Zn.exports}function to(){if(Xn)return Jn;Xn=1;var e=jn();function t(t,r){e.cipher.registerAlgorithm(t,function(){return new e.aes.Algorithm(t,r)})}Yn(),eo(),Wn(),Jn=e.aes=e.aes||{},e.aes.startEncrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!1,mode:a});return n.start(t),n},e.aes.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},e.aes.startDecrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!0,mode:a});return n.start(t),n},e.aes.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},e.aes.Algorithm=function(e,t){l||c();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return v(r._w,e,t,!1)},decrypt:function(e,t){return v(r._w,e,t,!0)}}}),r._init=!1},e.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var r,a=t.key;if("string"!=typeof a||16!==a.length&&24!==a.length&&32!==a.length){if(e.util.isArray(a)&&(16===a.length||24===a.length||32===a.length)){r=a,a=e.util.createBuffer();for(var n=0;n<r.length;++n)a.putByte(r[n])}}else a=e.util.createBuffer(a);if(!e.util.isArray(a)){r=a,a=[];var o=r.length();if(16===o||24===o||32===o){o>>>=2;for(n=0;n<o;++n)a.push(r.getInt32())}}if(!e.util.isArray(a)||4!==a.length&&6!==a.length&&8!==a.length)throw new Error("Invalid key parameter.");var i=this.mode.name,l=-1!==["CFB","OFB","CTR","GCM"].indexOf(i);this._w=u(a,t.decrypt&&!l),this._init=!0}},e.aes._expandKey=function(e,t){return l||c(),u(e,t)},e.aes._updateBlock=v,t("AES-ECB",e.cipher.modes.ecb),t("AES-CBC",e.cipher.modes.cbc),t("AES-CFB",e.cipher.modes.cfb),t("AES-OFB",e.cipher.modes.ofb),t("AES-CTR",e.cipher.modes.ctr),t("AES-GCM",e.cipher.modes.gcm);var r,a,n,o,i,l=!1,s=4;function c(){l=!0,n=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;r=new Array(256),a=new Array(256),o=new Array(4),i=new Array(4);for(t=0;t<4;++t)o[t]=new Array(256),i[t]=new Array(256);var s,c,u,v,d,p,f,h=0,g=0;for(t=0;t<256;++t){v=(v=g^g<<1^g<<2^g<<3^g<<4)>>8^255&v^99,r[h]=v,a[v]=h,p=(d=e[v])<<24^v<<16^v<<8^v^d,f=((s=e[h])^(c=e[s])^(u=e[c]))<<24^(h^u)<<16^(h^c^u)<<8^h^s^u;for(var m=0;m<4;++m)o[m][h]=p,i[m][v]=f,p=p<<24|p>>>8,f=f<<24|f>>>8;0===h?h=g=1:(h=s^e[e[e[s^u]]],g^=e[e[g]])}}function u(e,t){for(var a,o=e.slice(0),l=1,c=o.length,u=s*(c+6+1),v=c;v<u;++v)a=o[v-1],v%c===0?(a=r[a>>>16&255]<<24^r[a>>>8&255]<<16^r[255&a]<<8^r[a>>>24]^n[l]<<24,l++):c>6&&v%c===4&&(a=r[a>>>24]<<24^r[a>>>16&255]<<16^r[a>>>8&255]<<8^r[255&a]),o[v]=o[v-c]^a;if(t){for(var d,p=i[0],f=i[1],h=i[2],g=i[3],m=o.slice(0),b=(v=0,(u=o.length)-s);v<u;v+=s,b-=s)if(0===v||v===u-s)m[v]=o[b],m[v+1]=o[b+3],m[v+2]=o[b+2],m[v+3]=o[b+1];else for(var y=0;y<s;++y)d=o[b+y],m[v+(3&-y)]=p[r[d>>>24]]^f[r[d>>>16&255]]^h[r[d>>>8&255]]^g[r[255&d]];o=m}return o}function v(e,t,n,l){var s,c,u,v,d,p,f,h,g,m,b,y,_=e.length/4-1;l?(s=i[0],c=i[1],u=i[2],v=i[3],d=a):(s=o[0],c=o[1],u=o[2],v=o[3],d=r),p=t[0]^e[0],f=t[l?3:1]^e[1],h=t[2]^e[2],g=t[l?1:3]^e[3];for(var w=3,C=1;C<_;++C)m=s[p>>>24]^c[f>>>16&255]^u[h>>>8&255]^v[255&g]^e[++w],b=s[f>>>24]^c[h>>>16&255]^u[g>>>8&255]^v[255&p]^e[++w],y=s[h>>>24]^c[g>>>16&255]^u[p>>>8&255]^v[255&f]^e[++w],g=s[g>>>24]^c[p>>>16&255]^u[f>>>8&255]^v[255&h]^e[++w],p=m,f=b,h=y;n[0]=d[p>>>24]<<24^d[f>>>16&255]<<16^d[h>>>8&255]<<8^d[255&g]^e[++w],n[l?3:1]=d[f>>>24]<<24^d[h>>>16&255]<<16^d[g>>>8&255]<<8^d[255&p]^e[++w],n[2]=d[h>>>24]<<24^d[g>>>16&255]<<16^d[p>>>8&255]<<8^d[255&f]^e[++w],n[l?1:3]=d[g>>>24]<<24^d[p>>>16&255]<<16^d[f>>>8&255]<<8^d[255&h]^e[++w]}function d(t){var r,a="AES-"+((t=t||{}).mode||"CBC").toUpperCase(),n=(r=t.decrypt?e.cipher.createDecipher(a,t.key):e.cipher.createCipher(a,t.key)).start;return r.start=function(t,a){var o=null;a instanceof e.util.ByteBuffer&&(o=a,a={}),(a=a||{}).output=o,a.iv=t,n.call(r,a)},r}return Jn}var ro,ao,no={exports:{}},oo={exports:{}},io={exports:{}};function lo(){if(ro)return io.exports;ro=1;var e=jn();e.pki=e.pki||{};var t=io.exports=e.pki.oids=e.oids=e.oids||{};function r(e,r){t[e]=r,t[r]=e}function a(e,r){t[e]=r}return r("1.2.840.113549.1.1.1","rsaEncryption"),r("1.2.840.113549.1.1.4","md5WithRSAEncryption"),r("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),r("1.2.840.113549.1.1.7","RSAES-OAEP"),r("1.2.840.113549.1.1.8","mgf1"),r("1.2.840.113549.1.1.9","pSpecified"),r("1.2.840.113549.1.1.10","RSASSA-PSS"),r("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),r("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),r("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),r("1.3.101.112","EdDSA25519"),r("1.2.840.10040.4.3","dsa-with-sha1"),r("1.3.14.3.2.7","desCBC"),r("1.3.14.3.2.26","sha1"),r("1.3.14.3.2.29","sha1WithRSASignature"),r("2.16.840.1.101.3.4.2.1","sha256"),r("2.16.840.1.101.3.4.2.2","sha384"),r("2.16.840.1.101.3.4.2.3","sha512"),r("2.16.840.1.101.3.4.2.4","sha224"),r("2.16.840.1.101.3.4.2.5","sha512-224"),r("2.16.840.1.101.3.4.2.6","sha512-256"),r("1.2.840.113549.2.2","md2"),r("1.2.840.113549.2.5","md5"),r("1.2.840.113549.1.7.1","data"),r("1.2.840.113549.1.7.2","signedData"),r("1.2.840.113549.1.7.3","envelopedData"),r("1.2.840.113549.1.7.4","signedAndEnvelopedData"),r("1.2.840.113549.1.7.5","digestedData"),r("1.2.840.113549.1.7.6","encryptedData"),r("1.2.840.113549.1.9.1","emailAddress"),r("1.2.840.113549.1.9.2","unstructuredName"),r("1.2.840.113549.1.9.3","contentType"),r("1.2.840.113549.1.9.4","messageDigest"),r("1.2.840.113549.1.9.5","signingTime"),r("1.2.840.113549.1.9.6","counterSignature"),r("1.2.840.113549.1.9.7","challengePassword"),r("1.2.840.113549.1.9.8","unstructuredAddress"),r("1.2.840.113549.1.9.14","extensionRequest"),r("1.2.840.113549.1.9.20","friendlyName"),r("1.2.840.113549.1.9.21","localKeyId"),r("1.2.840.113549.1.9.22.1","x509Certificate"),r("1.2.840.113549.1.12.10.1.1","keyBag"),r("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),r("1.2.840.113549.1.12.10.1.3","certBag"),r("1.2.840.113549.1.12.10.1.4","crlBag"),r("1.2.840.113549.1.12.10.1.5","secretBag"),r("1.2.840.113549.1.12.10.1.6","safeContentsBag"),r("1.2.840.113549.1.5.13","pkcs5PBES2"),r("1.2.840.113549.1.5.12","pkcs5PBKDF2"),r("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),r("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),r("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),r("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),r("1.2.840.113549.2.7","hmacWithSHA1"),r("1.2.840.113549.2.8","hmacWithSHA224"),r("1.2.840.113549.2.9","hmacWithSHA256"),r("1.2.840.113549.2.10","hmacWithSHA384"),r("1.2.840.113549.2.11","hmacWithSHA512"),r("1.2.840.113549.3.7","des-EDE3-CBC"),r("2.16.840.1.101.3.4.1.2","aes128-CBC"),r("2.16.840.1.101.3.4.1.22","aes192-CBC"),r("2.16.840.1.101.3.4.1.42","aes256-CBC"),r("2.5.4.3","commonName"),r("2.5.4.4","surname"),r("2.5.4.5","serialNumber"),r("2.5.4.6","countryName"),r("2.5.4.7","localityName"),r("2.5.4.8","stateOrProvinceName"),r("2.5.4.9","streetAddress"),r("2.5.4.10","organizationName"),r("2.5.4.11","organizationalUnitName"),r("2.5.4.12","title"),r("2.5.4.13","description"),r("2.5.4.15","businessCategory"),r("2.5.4.17","postalCode"),r("2.5.4.42","givenName"),r("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),r("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),r("2.16.840.1.113730.1.1","nsCertType"),r("2.16.840.1.113730.1.13","nsComment"),a("2.5.29.1","authorityKeyIdentifier"),a("2.5.29.2","keyAttributes"),a("2.5.29.3","certificatePolicies"),a("2.5.29.4","keyUsageRestriction"),a("2.5.29.5","policyMapping"),a("2.5.29.6","subtreesConstraint"),a("2.5.29.7","subjectAltName"),a("2.5.29.8","issuerAltName"),a("2.5.29.9","subjectDirectoryAttributes"),a("2.5.29.10","basicConstraints"),a("2.5.29.11","nameConstraints"),a("2.5.29.12","policyConstraints"),a("2.5.29.13","basicConstraints"),r("2.5.29.14","subjectKeyIdentifier"),r("2.5.29.15","keyUsage"),a("2.5.29.16","privateKeyUsagePeriod"),r("2.5.29.17","subjectAltName"),r("2.5.29.18","issuerAltName"),r("2.5.29.19","basicConstraints"),a("2.5.29.20","cRLNumber"),a("2.5.29.21","cRLReason"),a("2.5.29.22","expirationDate"),a("2.5.29.23","instructionCode"),a("2.5.29.24","invalidityDate"),a("2.5.29.25","cRLDistributionPoints"),a("2.5.29.26","issuingDistributionPoint"),a("2.5.29.27","deltaCRLIndicator"),a("2.5.29.28","issuingDistributionPoint"),a("2.5.29.29","certificateIssuer"),a("2.5.29.30","nameConstraints"),r("2.5.29.31","cRLDistributionPoints"),r("2.5.29.32","certificatePolicies"),a("2.5.29.33","policyMappings"),a("2.5.29.34","policyConstraints"),r("2.5.29.35","authorityKeyIdentifier"),a("2.5.29.36","policyConstraints"),r("2.5.29.37","extKeyUsage"),a("2.5.29.46","freshestCRL"),a("2.5.29.54","inhibitAnyPolicy"),r("1.3.6.1.4.1.11129.2.4.2","timestampList"),r("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),r("1.3.6.1.5.5.7.3.1","serverAuth"),r("1.3.6.1.5.5.7.3.2","clientAuth"),r("1.3.6.1.5.5.7.3.3","codeSigning"),r("1.3.6.1.5.5.7.3.4","emailProtection"),r("1.3.6.1.5.5.7.3.8","timeStamping"),io.exports}function so(){if(ao)return oo.exports;ao=1;var e=jn();Wn(),lo();var t=oo.exports=e.asn1=e.asn1||{};function r(e,t,r){if(r>t){var a=new Error("Too few bytes to parse DER.");throw a.available=e.length(),a.remaining=t,a.requested=r,a}}t.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},t.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},t.create=function(r,a,n,o,i){if(e.util.isArray(o)){for(var l=[],s=0;s<o.length;++s)void 0!==o[s]&&l.push(o[s]);o=l}var c={tagClass:r,type:a,constructed:n,composed:n||e.util.isArray(o),value:o};return i&&"bitStringContents"in i&&(c.bitStringContents=i.bitStringContents,c.original=t.copy(c)),c},t.copy=function(r,a){var n;if(e.util.isArray(r)){n=[];for(var o=0;o<r.length;++o)n.push(t.copy(r[o],a));return n}return"string"==typeof r?r:(n={tagClass:r.tagClass,type:r.type,constructed:r.constructed,composed:r.composed,value:t.copy(r.value,a)},a&&!a.excludeBitStringContents&&(n.bitStringContents=r.bitStringContents),n)},t.equals=function(r,a,n){if(e.util.isArray(r)){if(!e.util.isArray(a))return!1;if(r.length!==a.length)return!1;for(var o=0;o<r.length;++o)if(!t.equals(r[o],a[o]))return!1;return!0}if(typeof r!=typeof a)return!1;if("string"==typeof r)return r===a;var i=r.tagClass===a.tagClass&&r.type===a.type&&r.constructed===a.constructed&&r.composed===a.composed&&t.equals(r.value,a.value);return n&&n.includeBitStringContents&&(i=i&&r.bitStringContents===a.bitStringContents),i},t.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};function a(e,n,o,i){var l;r(e,n,2);var s=e.getByte();n--;var c=192&s,u=31&s;l=e.length();var v,d,p=function(e,t){var a=e.getByte();if(t--,128!==a){var n;if(128&a){var o=127&a;r(e,t,o),n=e.getInt(o<<3)}else n=a;if(n<0)throw new Error("Negative length: "+n);return n}}(e,n);if(n-=l-e.length(),void 0!==p&&p>n){if(i.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=e.length(),f.remaining=n,f.requested=p,f}p=n}var h=!(32&~s);if(h)if(v=[],void 0===p)for(;;){if(r(e,n,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),n-=2;break}l=e.length(),v.push(a(e,n,o+1,i)),n-=l-e.length()}else for(;p>0;)l=e.length(),v.push(a(e,p,o+1,i)),n-=l-e.length(),p-=l-e.length();if(void 0===v&&c===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&(d=e.bytes(p)),void 0===v&&i.decodeBitStrings&&c===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&p>1){var g=e.read,m=n,b=0;if(u===t.Type.BITSTRING&&(r(e,n,1),b=e.getByte(),n--),0===b)try{l=e.length();var y=a(e,n,o+1,{strict:!0,decodeBitStrings:!0}),_=l-e.length();n-=_,u==t.Type.BITSTRING&&_++;var w=y.tagClass;_!==p||w!==t.Class.UNIVERSAL&&w!==t.Class.CONTEXT_SPECIFIC||(v=[y])}catch(x){}void 0===v&&(e.read=g,n=m)}if(void 0===v){if(void 0===p){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=n}if(u===t.Type.BMPSTRING)for(v="";p>0;p-=2)r(e,n,2),v+=String.fromCharCode(e.getInt16()),n-=2;else v=e.getBytes(p),n-=p}var C=void 0===d?null:{bitStringContents:d};return t.create(c,u,h,v,C)}t.fromDer=function(t,r){void 0===r&&(r={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"==typeof r&&(r={strict:r,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in r||(r.strict=!0),"parseAllBytes"in r||(r.parseAllBytes=!0),"decodeBitStrings"in r||(r.decodeBitStrings=!0),"string"==typeof t&&(t=e.util.createBuffer(t));var n=t.length(),o=a(t,t.length(),0,r);if(r.parseAllBytes&&0!==t.length()){var i=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=n,i.remaining=t.length(),i}return o},t.toDer=function(r){var a=e.util.createBuffer(),n=r.tagClass|r.type,o=e.util.createBuffer(),i=!1;if("bitStringContents"in r&&(i=!0,r.original&&(i=t.equals(r,r.original))),i)o.putBytes(r.bitStringContents);else if(r.composed){r.constructed?n|=32:o.putByte(0);for(var l=0;l<r.value.length;++l)void 0!==r.value[l]&&o.putBuffer(t.toDer(r.value[l]))}else if(r.type===t.Type.BMPSTRING)for(l=0;l<r.value.length;++l)o.putInt16(r.value.charCodeAt(l));else!(r.type===t.Type.INTEGER&&r.value.length>1)||(0!==r.value.charCodeAt(0)||128&r.value.charCodeAt(1))&&(255!==r.value.charCodeAt(0)||128&~r.value.charCodeAt(1))?o.putBytes(r.value):o.putBytes(r.value.substr(1));if(a.putByte(n),o.length()<=127)a.putByte(127&o.length());else{var s=o.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);a.putByte(128|c.length);for(l=c.length-1;l>=0;--l)a.putByte(c.charCodeAt(l))}return a.putBuffer(o),a},t.oidToDer=function(t){var r,a,n,o,i=t.split("."),l=e.util.createBuffer();l.putByte(40*parseInt(i[0],10)+parseInt(i[1],10));for(var s=2;s<i.length;++s){r=!0,a=[],n=parseInt(i[s],10);do{o=127&n,n>>>=7,r||(o|=128),a.push(o),r=!1}while(n>0);for(var c=a.length-1;c>=0;--c)l.putByte(a[c])}return l},t.derToOid=function(t){var r;"string"==typeof t&&(t=e.util.createBuffer(t));var a=t.getByte();r=Math.floor(a/40)+"."+a%40;for(var n=0;t.length()>0;)n<<=7,128&(a=t.getByte())?n+=127&a:(r+="."+(n+a),n=0);return r},t.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var a=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),l=0;if(e.length>11){var s=e.charAt(10),c=10;"+"!==s&&"-"!==s&&(l=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,a,n),t.setUTCHours(o,i,l,0),c&&("+"===(s=e.charAt(c))||"-"===s)){var u=60*parseInt(e.substr(c+1,2),10)+parseInt(e.substr(c+4,2),10);u*=6e4,"+"===s?t.setTime(+t-u):t.setTime(+t+u)}return t},t.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),a=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),l=parseInt(e.substr(12,2),10),s=0,c=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var v=e.length-5,d=e.charAt(v);"+"!==d&&"-"!==d||(c=60*parseInt(e.substr(v+1,2),10)+parseInt(e.substr(v+4,2),10),c*=6e4,"+"===d&&(c*=-1),u=!0);return"."===e.charAt(14)&&(s=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,a,n),t.setUTCHours(o,i,l,s),t.setTime(+t+c)):(t.setFullYear(r,a,n),t.setHours(o,i,l,s)),t},t.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var a=0;a<r.length;++a)r[a].length<2&&(t+="0"),t+=r[a];return t+="Z"},t.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var a=0;a<r.length;++a)r[a].length<2&&(t+="0"),t+=r[a];return t+="Z"},t.integerToDer=function(t){var r=e.util.createBuffer();if(t>=-128&&t<128)return r.putSignedInt(t,8);if(t>=-32768&&t<32768)return r.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return r.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return r.putSignedInt(t,32);var a=new Error("Integer too large; max is 32-bits.");throw a.integer=t,a},t.derToInteger=function(t){"string"==typeof t&&(t=e.util.createBuffer(t));var r=8*t.length();if(r>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(r)},t.validate=function(r,a,n,o){var i=!1;if(r.tagClass!==a.tagClass&&void 0!==a.tagClass||r.type!==a.type&&void 0!==a.type)o&&(r.tagClass!==a.tagClass&&o.push("["+a.name+'] Expected tag class "'+a.tagClass+'", got "'+r.tagClass+'"'),r.type!==a.type&&o.push("["+a.name+'] Expected type "'+a.type+'", got "'+r.type+'"'));else if(r.constructed===a.constructed||void 0===a.constructed){if(i=!0,a.value&&e.util.isArray(a.value))for(var l=0,s=0;i&&s<a.value.length;++s)i=a.value[s].optional||!1,r.value[l]&&((i=t.validate(r.value[l],a.value[s],n,o))?++l:a.value[s].optional&&(i=!0)),!i&&o&&o.push("["+a.name+'] Tag class "'+a.tagClass+'", type "'+a.type+'" expected value length "'+a.value.length+'", got "'+r.value.length+'"');if(i&&n&&(a.capture&&(n[a.capture]=r.value),a.captureAsn1&&(n[a.captureAsn1]=r),a.captureBitStringContents&&"bitStringContents"in r&&(n[a.captureBitStringContents]=r.bitStringContents),a.captureBitStringValue&&"bitStringContents"in r))if(r.bitStringContents.length<2)n[a.captureBitStringValue]="";else{if(0!==r.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");n[a.captureBitStringValue]=r.bitStringContents.slice(1)}}else o&&o.push("["+a.name+'] Expected constructed "'+a.constructed+'", got "'+r.constructed+'"');return i};var n=/[^\\u0000-\\u00ff]/;return t.prettyPrint=function(r,a,o){var i="";o=o||2,(a=a||0)>0&&(i+="\n");for(var l="",s=0;s<a*o;++s)l+=" ";switch(i+=l+"Tag: ",r.tagClass){case t.Class.UNIVERSAL:i+="Universal:";break;case t.Class.APPLICATION:i+="Application:";break;case t.Class.CONTEXT_SPECIFIC:i+="Context-Specific:";break;case t.Class.PRIVATE:i+="Private:"}if(r.tagClass===t.Class.UNIVERSAL)switch(i+=r.type,r.type){case t.Type.NONE:i+=" (None)";break;case t.Type.BOOLEAN:i+=" (Boolean)";break;case t.Type.INTEGER:i+=" (Integer)";break;case t.Type.BITSTRING:i+=" (Bit string)";break;case t.Type.OCTETSTRING:i+=" (Octet string)";break;case t.Type.NULL:i+=" (Null)";break;case t.Type.OID:i+=" (Object Identifier)";break;case t.Type.ODESC:i+=" (Object Descriptor)";break;case t.Type.EXTERNAL:i+=" (External or Instance of)";break;case t.Type.REAL:i+=" (Real)";break;case t.Type.ENUMERATED:i+=" (Enumerated)";break;case t.Type.EMBEDDED:i+=" (Embedded PDV)";break;case t.Type.UTF8:i+=" (UTF8)";break;case t.Type.ROID:i+=" (Relative Object Identifier)";break;case t.Type.SEQUENCE:i+=" (Sequence)";break;case t.Type.SET:i+=" (Set)";break;case t.Type.PRINTABLESTRING:i+=" (Printable String)";break;case t.Type.IA5String:i+=" (IA5String (ASCII))";break;case t.Type.UTCTIME:i+=" (UTC time)";break;case t.Type.GENERALIZEDTIME:i+=" (Generalized time)";break;case t.Type.BMPSTRING:i+=" (BMP String)"}else i+=r.type;if(i+="\n",i+=l+"Constructed: "+r.constructed+"\n",r.composed){var c=0,u="";for(s=0;s<r.value.length;++s)void 0!==r.value[s]&&(c+=1,u+=t.prettyPrint(r.value[s],a+1,o),s+1<r.value.length&&(u+=","));i+=l+"Sub values: "+c+u}else{if(i+=l+"Value: ",r.type===t.Type.OID){var v=t.derToOid(r.value);i+=v,e.pki&&e.pki.oids&&v in e.pki.oids&&(i+=" ("+e.pki.oids[v]+") ")}if(r.type===t.Type.INTEGER)try{i+=t.derToInteger(r.value)}catch(p){i+="0x"+e.util.bytesToHex(r.value)}else if(r.type===t.Type.BITSTRING){if(r.value.length>1?i+="0x"+e.util.bytesToHex(r.value.slice(1)):i+="(none)",r.value.length>0){var d=r.value.charCodeAt(0);1==d?i+=" (1 unused bit shown)":d>1&&(i+=" ("+d+" unused bits shown)")}}else if(r.type===t.Type.OCTETSTRING)n.test(r.value)||(i+="("+r.value+") "),i+="0x"+e.util.bytesToHex(r.value);else if(r.type===t.Type.UTF8)try{i+=e.util.decodeUtf8(r.value)}catch(f){if("URI malformed"!==f.message)throw f;i+="0x"+e.util.bytesToHex(r.value)+" (malformed UTF8)"}else r.type===t.Type.PRINTABLESTRING||r.type===t.Type.IA5String?i+=r.value:n.test(r.value)?i+="0x"+e.util.bytesToHex(r.value):0===r.value.length?i+="[null]":i+=r.value}return i},oo.exports}var co,uo,vo,po={exports:{}};function fo(){if(uo)return co;uo=1;var e=jn();return co=e.md=e.md||{},e.md.algorithms=e.md.algorithms||{},co}function ho(){if(vo)return po.exports;vo=1;var e=jn();return fo(),Wn(),(po.exports=e.hmac=e.hmac||{}).create=function(){var t=null,r=null,a=null,n=null,o={start:function(o,i){if(null!==o)if("string"==typeof o){if(!((o=o.toLowerCase())in e.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');r=e.md.algorithms[o].create()}else r=o;if(null===i)i=t;else{if("string"==typeof i)i=e.util.createBuffer(i);else if(e.util.isArray(i)){var l=i;i=e.util.createBuffer();for(var s=0;s<l.length;++s)i.putByte(l[s])}var c=i.length();c>r.blockLength&&(r.start(),r.update(i.bytes()),i=r.digest()),a=e.util.createBuffer(),n=e.util.createBuffer(),c=i.length();for(s=0;s<c;++s){l=i.at(s);a.putByte(54^l),n.putByte(92^l)}if(c<r.blockLength)for(l=r.blockLength-c,s=0;s<l;++s)a.putByte(54),n.putByte(92);t=i,a=a.bytes(),n=n.bytes()}r.start(),r.update(a)},update:function(e){r.update(e)},getMac:function(){var e=r.digest().bytes();return r.start(),r.update(n),r.update(e),r.digest()}};return o.digest=o.getMac,o},po.exports}var go,mo={exports:{}};function bo(){if(go)return mo.exports;go=1;var e=jn();fo(),Wn();var t=mo.exports=e.md5=e.md5||{};e.md.md5=e.md.algorithms.md5=t,t.create=function(){i||function(){r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],n=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],o=new Array(64);for(var t=0;t<64;++t)o[t]=Math.floor(4294967296*Math.abs(Math.sin(t+1)));i=!0}();var t=null,s=e.util.createBuffer(),c=new Array(16),u={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){u.messageLength=0,u.fullMessageLength=u.messageLength64=[];for(var r=u.messageLengthSize/4,a=0;a<r;++a)u.fullMessageLength.push(0);return s=e.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},u}};return u.start(),u.update=function(r,a){"utf8"===a&&(r=e.util.encodeUtf8(r));var n=r.length;u.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var o=u.fullMessageLength.length-1;o>=0;--o)u.fullMessageLength[o]+=n[1],n[1]=n[0]+(u.fullMessageLength[o]/4294967296>>>0),u.fullMessageLength[o]=u.fullMessageLength[o]>>>0,n[0]=n[1]/4294967296>>>0;return s.putBytes(r),l(t,c,s),(s.read>2048||0===s.length())&&s.compact(),u},u.digest=function(){var a=e.util.createBuffer();a.putBytes(s.bytes());var n=u.fullMessageLength[u.fullMessageLength.length-1]+u.messageLengthSize&u.blockLength-1;a.putBytes(r.substr(0,u.blockLength-n));for(var o,i=0,v=u.fullMessageLength.length-1;v>=0;--v)i=(o=8*u.fullMessageLength[v]+i)/4294967296>>>0,a.putInt32Le(o>>>0);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3};l(d,c,a);var p=e.util.createBuffer();return p.putInt32Le(d.h0),p.putInt32Le(d.h1),p.putInt32Le(d.h2),p.putInt32Le(d.h3),p},u};var r=null,a=null,n=null,o=null,i=!1;function l(e,t,r){for(var i,l,s,c,u,v,d,p=r.length();p>=64;){for(l=e.h0,s=e.h1,c=e.h2,u=e.h3,d=0;d<16;++d)t[d]=r.getInt32Le(),i=l+(u^s&(c^u))+o[d]+t[d],l=u,u=c,c=s,s+=i<<(v=n[d])|i>>>32-v;for(;d<32;++d)i=l+(c^u&(s^c))+o[d]+t[a[d]],l=u,u=c,c=s,s+=i<<(v=n[d])|i>>>32-v;for(;d<48;++d)i=l+(s^c^u)+o[d]+t[a[d]],l=u,u=c,c=s,s+=i<<(v=n[d])|i>>>32-v;for(;d<64;++d)i=l+(c^(s|~u))+o[d]+t[a[d]],l=u,u=c,c=s,s+=i<<(v=n[d])|i>>>32-v;e.h0=e.h0+l|0,e.h1=e.h1+s|0,e.h2=e.h2+c|0,e.h3=e.h3+u|0,p-=64}}return mo.exports}var yo,_o={exports:{}};function wo(){if(yo)return _o.exports;yo=1;var e=jn();Wn();var t=_o.exports=e.pem=e.pem||{};function r(e){for(var t=e.name+": ",r=[],a=function(e,t){return" "+t},n=0;n<e.values.length;++n)r.push(e.values[n].replace(/^(\S+\r\n)/,a));t+=r.join(",")+"\r\n";var o=0,i=-1;for(n=0;n<t.length;++n,++o)if(o>65&&-1!==i){var l=t[i];","===l?(++i,t=t.substr(0,i)+"\r\n "+t.substr(i)):t=t.substr(0,i)+"\r\n"+l+t.substr(i+1),o=n-i-1,i=-1,++n}else" "!==t[n]&&"\t"!==t[n]&&","!==t[n]||(i=n);return t}function a(e){return e.replace(/^\s+/,"")}return t.encode=function(t,a){a=a||{};var n,o="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(o+=r(n={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(o+=r(n={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(n={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&n.values.push(t.dekInfo.parameters),o+=r(n)),t.headers)for(var i=0;i<t.headers.length;++i)o+=r(t.headers[i]);return t.procType&&(o+="\r\n"),o+=e.util.encode64(t.body,a.maxline||64)+"\r\n",o+="-----END "+t.type+"-----\r\n"},t.decode=function(t){for(var r,n=[],o=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,i=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,l=/\r?\n/;r=o.exec(t);){var s=r[1];"NEW CERTIFICATE REQUEST"===s&&(s="CERTIFICATE REQUEST");var c={type:s,procType:null,contentDomain:null,dekInfo:null,headers:[],body:e.util.decode64(r[3])};if(n.push(c),r[2]){for(var u=r[2].split(l),v=0;r&&v<u.length;){for(var d=u[v].replace(/\s+$/,""),p=v+1;p<u.length;++p){var f=u[p];if(!/\s/.test(f[0]))break;d+=f,v=p}if(r=d.match(i)){for(var h={name:r[1],values:[]},g=r[2].split(","),m=0;m<g.length;++m)h.values.push(a(g[m]));if(c.procType)if(c.contentDomain||"Content-Domain"!==h.name)if(c.dekInfo||"DEK-Info"!==h.name)c.headers.push(h);else{if(0===h.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');c.dekInfo={algorithm:g[0],parameters:g[1]||null}}else c.contentDomain=g[0]||"";else{if("Proc-Type"!==h.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==h.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');c.procType={version:g[0],type:g[1]}}}++v}if("ENCRYPTED"===c.procType&&!c.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===n.length)throw new Error("Invalid PEM formatted message.");return n},_o.exports}var Co,xo,Eo={exports:{}};function So(){if(xo)return Co;xo=1;var e=jn();function t(t,r){e.cipher.registerAlgorithm(t,function(){return new e.des.Algorithm(t,r)})}Yn(),eo(),Wn(),Co=e.des=e.des||{},e.des.startEncrypting=function(e,t,r,a){var n=v({key:e,output:r,decrypt:!1,mode:a||(null===t?"ECB":"CBC")});return n.start(t),n},e.des.createEncryptionCipher=function(e,t){return v({key:e,output:null,decrypt:!1,mode:t})},e.des.startDecrypting=function(e,t,r,a){var n=v({key:e,output:r,decrypt:!0,mode:a||(null===t?"ECB":"CBC")});return n.start(t),n},e.des.createDecryptionCipher=function(e,t){return v({key:e,output:null,decrypt:!0,mode:t})},e.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return u(r._keys,e,t,!1)},decrypt:function(e,t){return u(r._keys,e,t,!0)}}}),r._init=!1},e.des.Algorithm.prototype.initialize=function(t){if(!this._init){var r=e.util.createBuffer(t.key);if(0===this.name.indexOf("3DES")&&24!==r.length())throw new Error("Invalid Triple-DES key size: "+8*r.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],a=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],o=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],i=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],s=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],v=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],f=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],h=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,m=[],b=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],y=0,_=0;_<g;_++){var w=e.getInt32(),C=e.getInt32();w^=(t=252645135&(w>>>4^C))<<4,w^=t=65535&((C^=t)>>>-16^w),w^=(t=858993459&(w>>>2^(C^=t<<-16)))<<2,w^=t=65535&((C^=t)>>>-16^w),w^=(t=1431655765&(w>>>1^(C^=t<<-16)))<<1,w^=t=16711935&((C^=t)>>>8^w),t=(w^=(t=1431655765&(w>>>1^(C^=t<<8)))<<1)<<8|(C^=t)>>>20&240,w=C<<24|C<<8&16711680|C>>>8&65280|C>>>24&240,C=t;for(var x=0;x<b.length;++x){b[x]?(w=w<<2|w>>>26,C=C<<2|C>>>26):(w=w<<1|w>>>27,C=C<<1|C>>>27),C&=-15;var E=r[(w&=-15)>>>28]|a[w>>>24&15]|n[w>>>20&15]|o[w>>>16&15]|i[w>>>12&15]|l[w>>>8&15]|s[w>>>4&15],S=c[C>>>28]|u[C>>>24&15]|v[C>>>20&15]|d[C>>>16&15]|p[C>>>12&15]|f[C>>>8&15]|h[C>>>4&15];t=65535&(S>>>16^E),m[y++]=E^t,m[y++]=S^t<<16}}return m}(r),this._init=!0}},t("DES-ECB",e.cipher.modes.ecb),t("DES-CBC",e.cipher.modes.cbc),t("DES-CFB",e.cipher.modes.cfb),t("DES-OFB",e.cipher.modes.ofb),t("DES-CTR",e.cipher.modes.ctr),t("3DES-ECB",e.cipher.modes.ecb),t("3DES-CBC",e.cipher.modes.cbc),t("3DES-CFB",e.cipher.modes.cfb),t("3DES-OFB",e.cipher.modes.ofb),t("3DES-CTR",e.cipher.modes.ctr);var r=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],a=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],n=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],o=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],i=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],s=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],c=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function u(e,t,u,v){var d,p,f=32===e.length?3:9;d=3===f?v?[30,-2,-2]:[0,32,2]:v?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var h=t[0],g=t[1];h^=(p=252645135&(h>>>4^g))<<4,h^=(p=65535&(h>>>16^(g^=p)))<<16,h^=p=858993459&((g^=p)>>>2^h),h^=p=16711935&((g^=p<<2)>>>8^h),h=(h^=(p=1431655765&(h>>>1^(g^=p<<8)))<<1)<<1|h>>>31,g=(g^=p)<<1|g>>>31;for(var m=0;m<f;m+=3){for(var b=d[m+1],y=d[m+2],_=d[m];_!=b;_+=y){var w=g^e[_],C=(g>>>4|g<<28)^e[_+1];p=h,h=g,g=p^(a[w>>>24&63]|o[w>>>16&63]|l[w>>>8&63]|c[63&w]|r[C>>>24&63]|n[C>>>16&63]|i[C>>>8&63]|s[63&C])}p=h,h=g,g=p}g=g>>>1|g<<31,g^=p=1431655765&((h=h>>>1|h<<31)>>>1^g),g^=(p=16711935&(g>>>8^(h^=p<<1)))<<8,g^=(p=858993459&(g>>>2^(h^=p)))<<2,g^=p=65535&((h^=p)>>>16^g),g^=p=252645135&((h^=p<<16)>>>4^g),h^=p<<4,u[0]=h,u[1]=g}function v(t){var r,a="DES-"+((t=t||{}).mode||"CBC").toUpperCase(),n=(r=t.decrypt?e.cipher.createDecipher(a,t.key):e.cipher.createCipher(a,t.key)).start;return r.start=function(t,a){var o=null;a instanceof e.util.ByteBuffer&&(o=a,a={}),(a=a||{}).output=o,a.iv=t,n.call(r,a)},r}return Co}const ko=On(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var To,Ao;function Io(){if(Ao)return To;Ao=1;var e=jn();ho(),fo(),Wn();var t,r=e.pkcs5=e.pkcs5||{};return e.util.isNodejs&&!e.options.usePureJavaScript&&(t=ko),To=e.pbkdf2=r.pbkdf2=function(r,a,n,o,i,l){if("function"==typeof i&&(l=i,i=null),e.util.isNodejs&&!e.options.usePureJavaScript&&t.pbkdf2&&(null===i||"object"!=typeof i)&&(t.pbkdf2Sync.length>4||!i||"sha1"===i))return"string"!=typeof i&&(i="sha1"),r=Buffer.from(r,"binary"),a=Buffer.from(a,"binary"),l?4===t.pbkdf2Sync.length?t.pbkdf2(r,a,n,o,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):t.pbkdf2(r,a,n,o,i,function(e,t){if(e)return l(e);l(null,t.toString("binary"))}):4===t.pbkdf2Sync.length?t.pbkdf2Sync(r,a,n,o).toString("binary"):t.pbkdf2Sync(r,a,n,o,i).toString("binary");if(null==i&&(i="sha1"),"string"==typeof i){if(!(i in e.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=e.md[i].create()}var s=i.digestLength;if(o>4294967295*s){var c=new Error("Derived key is too long.");if(l)return l(c);throw c}var u=Math.ceil(o/s),v=o-(u-1)*s,d=e.hmac.create();d.start(i,r);var p,f,h,g="";if(!l){for(var m=1;m<=u;++m){d.start(null,null),d.update(a),d.update(e.util.int32ToBytes(m)),p=h=d.digest().getBytes();for(var b=2;b<=n;++b)d.start(null,null),d.update(h),f=d.digest().getBytes(),p=e.util.xorBytes(p,f,s),h=f;g+=m<u?p:p.substr(0,v)}return g}m=1;function y(){if(m>u)return l(null,g);d.start(null,null),d.update(a),d.update(e.util.int32ToBytes(m)),p=h=d.digest().getBytes(),b=2,_()}function _(){if(b<=n)return d.start(null,null),d.update(h),f=d.digest().getBytes(),p=e.util.xorBytes(p,f,s),h=f,++b,e.util.setImmediate(_);g+=m<u?p:p.substr(0,v),++m,y()}y()}}var Bo,No={exports:{}},Ro={exports:{}};function zo(){if(Bo)return Ro.exports;Bo=1;var e=jn();fo(),Wn();var t=Ro.exports=e.sha256=e.sha256||{};e.md.sha256=e.md.algorithms.sha256=t,t.create=function(){a||(r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],a=!0);var t=null,i=e.util.createBuffer(),l=new Array(64),s={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){s.messageLength=0,s.fullMessageLength=s.messageLength64=[];for(var r=s.messageLengthSize/4,a=0;a<r;++a)s.fullMessageLength.push(0);return i=e.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},s}};return s.start(),s.update=function(r,a){"utf8"===a&&(r=e.util.encodeUtf8(r));var n=r.length;s.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var c=s.fullMessageLength.length-1;c>=0;--c)s.fullMessageLength[c]+=n[1],n[1]=n[0]+(s.fullMessageLength[c]/4294967296>>>0),s.fullMessageLength[c]=s.fullMessageLength[c]>>>0,n[0]=n[1]/4294967296>>>0;return i.putBytes(r),o(t,l,i),(i.read>2048||0===i.length())&&i.compact(),s},s.digest=function(){var a=e.util.createBuffer();a.putBytes(i.bytes());var n,c=s.fullMessageLength[s.fullMessageLength.length-1]+s.messageLengthSize&s.blockLength-1;a.putBytes(r.substr(0,s.blockLength-c));for(var u=8*s.fullMessageLength[0],v=0;v<s.fullMessageLength.length-1;++v)u+=(n=8*s.fullMessageLength[v+1])/4294967296>>>0,a.putInt32(u>>>0),u=n>>>0;a.putInt32(u);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};o(d,l,a);var p=e.util.createBuffer();return p.putInt32(d.h0),p.putInt32(d.h1),p.putInt32(d.h2),p.putInt32(d.h3),p.putInt32(d.h4),p.putInt32(d.h5),p.putInt32(d.h6),p.putInt32(d.h7),p},s};var r=null,a=!1,n=null;function o(e,t,r){for(var a,o,i,l,s,c,u,v,d,p,f,h,g,m=r.length();m>=64;){for(s=0;s<16;++s)t[s]=r.getInt32();for(;s<64;++s)a=((a=t[s-2])>>>17|a<<15)^(a>>>19|a<<13)^a>>>10,o=((o=t[s-15])>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,t[s]=a+t[s-7]+o+t[s-16]|0;for(c=e.h0,u=e.h1,v=e.h2,d=e.h3,p=e.h4,f=e.h5,h=e.h6,g=e.h7,s=0;s<64;++s)i=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),l=c&u|v&(c^u),a=g+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(h^p&(f^h))+n[s]+t[s],g=h,h=f,f=p,p=d+a>>>0,d=v,v=u,u=c,c=a+(o=i+l)>>>0;e.h0=e.h0+c|0,e.h1=e.h1+u|0,e.h2=e.h2+v|0,e.h3=e.h3+d|0,e.h4=e.h4+p|0,e.h5=e.h5+f|0,e.h6=e.h6+h|0,e.h7=e.h7+g|0,m-=64}}return Ro.exports}var Lo,Do,Uo,Po,Vo,Mo,Oo={exports:{}};function jo(){if(Lo)return Oo.exports;Lo=1;var e=jn();Wn();var t=null;return!e.util.isNodejs||e.options.usePureJavaScript||process.versions["node-webkit"]||(t=ko),(Oo.exports=e.prng=e.prng||{}).create=function(r){for(var a={plugin:r,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=r.md,o=new Array(32),i=0;i<32;++i)o[i]=n.create();function l(){if(a.pools[0].messageLength>=32)return s();var e=32-a.pools[0].messageLength<<5;a.collect(a.seedFileSync(e)),s()}function s(){a.reseeds=4294967295===a.reseeds?0:a.reseeds+1;var e=a.plugin.md.create();e.update(a.keyBytes);for(var t=1,r=0;r<32;++r)a.reseeds%t===0&&(e.update(a.pools[r].digest().getBytes()),a.pools[r].start()),t<<=1;a.keyBytes=e.digest().getBytes(),e.start(),e.update(a.keyBytes);var n=e.digest().getBytes();a.key=a.plugin.formatKey(a.keyBytes),a.seed=a.plugin.formatSeed(n),a.generated=0}function c(t){var r=null,a=e.util.globalScope,n=a.crypto||a.msCrypto;n&&n.getRandomValues&&(r=function(e){return n.getRandomValues(e)});var o=e.util.createBuffer();if(r)for(;o.length()<t;){var i=Math.max(1,Math.min(t-o.length(),65536)/4),l=new Uint32Array(Math.floor(i));try{r(l);for(var s=0;s<l.length;++s)o.putInt32(l[s])}catch(p){if(!("undefined"!=typeof QuotaExceededError&&p instanceof QuotaExceededError))throw p}}if(o.length()<t)for(var c,u,v,d=Math.floor(65536*Math.random());o.length()<t;){u=16807*(65535&d),u+=(32767&(c=16807*(d>>16)))<<16,d=4294967295&(u=(2147483647&(u+=c>>15))+(u>>31));for(s=0;s<3;++s)v=d>>>(s<<3),v^=Math.floor(256*Math.random()),o.putByte(255&v)}return o.getBytes(t)}return a.pools=o,a.pool=0,a.generate=function(t,r){if(!r)return a.generateSync(t);var n=a.plugin.cipher,o=a.plugin.increment,i=a.plugin.formatKey,l=a.plugin.formatSeed,c=e.util.createBuffer();a.key=null,function u(v){if(v)return r(v);if(c.length()>=t)return r(null,c.getBytes(t));a.generated>1048575&&(a.key=null);if(null===a.key)return e.util.nextTick(function(){!function(e){if(a.pools[0].messageLength>=32)return s(),e();var t=32-a.pools[0].messageLength<<5;a.seedFile(t,function(t,r){if(t)return e(t);a.collect(r),s(),e()})}(u)});var d=n(a.key,a.seed);a.generated+=d.length,c.putBytes(d),a.key=i(n(a.key,o(a.seed))),a.seed=l(n(a.key,a.seed)),e.util.setImmediate(u)}()},a.generateSync=function(t){var r=a.plugin.cipher,n=a.plugin.increment,o=a.plugin.formatKey,i=a.plugin.formatSeed;a.key=null;for(var s=e.util.createBuffer();s.length()<t;){a.generated>1048575&&(a.key=null),null===a.key&&l();var c=r(a.key,a.seed);a.generated+=c.length,s.putBytes(c),a.key=o(r(a.key,n(a.seed))),a.seed=i(r(a.key,a.seed))}return s.getBytes(t)},t?(a.seedFile=function(e,r){t.randomBytes(e,function(e,t){if(e)return r(e);r(null,t.toString())})},a.seedFileSync=function(e){return t.randomBytes(e).toString()}):(a.seedFile=function(e,t){try{t(null,c(e))}catch(r){t(r)}},a.seedFileSync=c),a.collect=function(e){for(var t=e.length,r=0;r<t;++r)a.pools[a.pool].update(e.substr(r,1)),a.pool=31===a.pool?0:a.pool+1},a.collectInt=function(e,t){for(var r="",n=0;n<t;n+=8)r+=String.fromCharCode(e>>n&255);a.collect(r)},a.registerWorker=function(e){if(e===self)a.seedFile=function(e,t){self.addEventListener("message",function e(r){var a=r.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",e),t(a.forge.prng.err,a.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",function(t){var r=t.data;r.forge&&r.forge.prng&&a.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})})}},a},Oo.exports}function qo(){if(Do)return No.exports;Do=1;var e=jn();return to(),zo(),jo(),Wn(),e.random&&e.random.getBytes?No.exports=e.random:function(t){var r={},a=new Array(4),n=e.util.createBuffer();function o(){var t=e.prng.create(r);return t.getBytes=function(e,r){return t.generate(e,r)},t.getBytesSync=function(e){return t.generate(e)},t}r.formatKey=function(t){var r=e.util.createBuffer(t);return(t=new Array(4))[0]=r.getInt32(),t[1]=r.getInt32(),t[2]=r.getInt32(),t[3]=r.getInt32(),e.aes._expandKey(t,!1)},r.formatSeed=function(t){var r=e.util.createBuffer(t);return(t=new Array(4))[0]=r.getInt32(),t[1]=r.getInt32(),t[2]=r.getInt32(),t[3]=r.getInt32(),t},r.cipher=function(t,r){return e.aes._updateBlock(t,r,a,!1),n.putInt32(a[0]),n.putInt32(a[1]),n.putInt32(a[2]),n.putInt32(a[3]),n.getBytes()},r.increment=function(e){return++e[3],e},r.md=e.md.sha256;var i=o(),l=null,s=e.util.globalScope,c=s.crypto||s.msCrypto;if(c&&c.getRandomValues&&(l=function(e){return c.getRandomValues(e)}),e.options.usePureJavaScript||!e.util.isNodejs&&!l){if(i.collectInt(+new Date,32),"undefined"!=typeof navigator){var u="";for(var v in navigator)try{"string"==typeof navigator[v]&&(u+=navigator[v])}catch(d){}i.collect(u),u=null}t&&(t().mousemove(function(e){i.collectInt(e.clientX,16),i.collectInt(e.clientY,16)}),t().keypress(function(e){i.collectInt(e.charCode,8)}))}if(e.random)for(var v in i)e.random[v]=i[v];else e.random=i;e.random.createInstance=o,No.exports=e.random}("undefined"!=typeof jQuery?jQuery:null),No.exports}function Fo(){if(Po)return Uo;Po=1;var e=jn();Wn();var t=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],r=[1,2,3,5],a=function(e,t){return e<<t&65535|(65535&e)>>16-t},n=function(e,t){return(65535&e)>>t|e<<16-t&65535};Uo=e.rc2=e.rc2||{},e.rc2.expandKey=function(r,a){"string"==typeof r&&(r=e.util.createBuffer(r)),a=a||128;var n,o=r,i=r.length(),l=a,s=Math.ceil(l/8),c=255>>(7&l);for(n=i;n<128;n++)o.putByte(t[o.at(n-1)+o.at(n-i)&255]);for(o.setAt(128-s,t[o.at(128-s)&c]),n=127-s;n>=0;n--)o.setAt(n,t[o.at(n+1)^o.at(n+s)]);return o};var o=function(t,o,i){var l,s,c,u,v=!1,d=null,p=null,f=null,h=[];for(t=e.rc2.expandKey(t,o),c=0;c<64;c++)h.push(t.getInt16Le());i?(l=function(e){for(c=0;c<4;c++)e[c]+=h[u]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=a(e[c],r[c]),u++},s=function(e){for(c=0;c<4;c++)e[c]+=h[63&e[(c+3)%4]]}):(l=function(e){for(c=3;c>=0;c--)e[c]=n(e[c],r[c]),e[c]-=h[u]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),u--},s=function(e){for(c=3;c>=0;c--)e[c]-=h[63&e[(c+3)%4]]});var g=function(e){var t=[];for(c=0;c<4;c++){var r=d.getInt16Le();null!==f&&(i?r^=f.getInt16Le():f.putInt16Le(r)),t.push(65535&r)}u=i?0:63;for(var a=0;a<e.length;a++)for(var n=0;n<e[a][0];n++)e[a][1](t);for(c=0;c<4;c++)null!==f&&(i?f.putInt16Le(t[c]):t[c]^=f.getInt16Le()),p.putInt16Le(t[c])},m=null;return m={start:function(t,r){t&&"string"==typeof t&&(t=e.util.createBuffer(t)),v=!1,d=e.util.createBuffer(),p=r||new e.util.createBuffer,f=t,m.output=p},update:function(e){for(v||d.putBuffer(e);d.length()>=8;)g([[5,l],[1,s],[6,l],[1,s],[5,l]])},finish:function(e){var t=!0;if(i)if(e)t=e(8,d,!i);else{var r=8===d.length()?8:8-d.length();d.fillWithByte(r,r)}if(t&&(v=!0,m.update()),!i&&(t=0===d.length()))if(e)t=e(8,p,!i);else{var a=p.length(),n=p.at(a-1);n>a?t=!1:p.truncate(n)}return t}}};return e.rc2.startEncrypting=function(t,r,a){var n=e.rc2.createEncryptionCipher(t,128);return n.start(r,a),n},e.rc2.createEncryptionCipher=function(e,t){return o(e,t,!0)},e.rc2.startDecrypting=function(t,r,a){var n=e.rc2.createDecryptionCipher(t,128);return n.start(r,a),n},e.rc2.createDecryptionCipher=function(e,t){return o(e,t,!1)},Uo}function Ko(){if(Mo)return Vo;Mo=1;var e,t=jn();function r(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function a(){return new r(null)}function n(e,t,r,a,n,o){for(var i=16383&t,l=t>>14;--o>=0;){var s=16383&this.data[e],c=this.data[e++]>>14,u=l*s+c*i;n=((s=i*s+((16383&u)<<14)+r.data[a]+n)>>28)+(u>>14)+l*c,r.data[a++]=268435455&s}return n}Vo=t.jsbn=t.jsbn||{},t.jsbn.BigInteger=r,"undefined"==typeof navigator?(r.prototype.am=n,e=28):"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(e,t,r,a,n,o){for(var i=32767&t,l=t>>15;--o>=0;){var s=32767&this.data[e],c=this.data[e++]>>15,u=l*s+c*i;n=((s=i*s+((32767&u)<<15)+r.data[a]+(1073741823&n))>>>30)+(u>>>15)+l*c+(n>>>30),r.data[a++]=1073741823&s}return n},e=30):"Netscape"!=navigator.appName?(r.prototype.am=function(e,t,r,a,n,o){for(;--o>=0;){var i=t*this.data[e++]+r.data[a]+n;n=Math.floor(i/67108864),r.data[a++]=67108863&i}return n},e=26):(r.prototype.am=n,e=28),r.prototype.DB=e,r.prototype.DM=(1<<e)-1,r.prototype.DV=1<<e;r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-e,r.prototype.F2=2*e-52;var o,i,l=new Array;for(o="0".charCodeAt(0),i=0;i<=9;++i)l[o++]=i;for(o="a".charCodeAt(0),i=10;i<36;++i)l[o++]=i;for(o="A".charCodeAt(0),i=10;i<36;++i)l[o++]=i;function s(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function c(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function u(e){var t=a();return t.fromInt(e),t}function v(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function d(e){this.m=e}function p(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function f(e,t){return e&t}function h(e,t){return e|t}function g(e,t){return e^t}function m(e,t){return e&~t}function b(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function y(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function _(){}function w(e){return e}function C(e){this.r2=a(),this.q3=a(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}d.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},d.prototype.revert=function(e){return e},d.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},d.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},d.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},p.prototype.convert=function(e){var t=a();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(r.ZERO)>0&&this.m.subTo(t,t),t},p.prototype.revert=function(e){var t=a();return e.copyTo(t),this.reduce(t),t},p.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],a=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,a,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},p.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},p.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},r.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},r.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},r.prototype.fromString=function(e,t){var a;if(16==t)a=4;else if(8==t)a=3;else if(256==t)a=8;else if(2==t)a=1;else if(32==t)a=5;else{if(4!=t)return void this.fromRadix(e,t);a=2}this.t=0,this.s=0;for(var n=e.length,o=!1,i=0;--n>=0;){var l=8==a?255&e[n]:c(e,n);l<0?"-"==e.charAt(n)&&(o=!0):(o=!1,0==i?this.data[this.t++]=l:i+a>this.DB?(this.data[this.t-1]|=(l&(1<<this.DB-i)-1)<<i,this.data[this.t++]=l>>this.DB-i):this.data[this.t-1]|=l<<i,(i+=a)>=this.DB&&(i-=this.DB))}8==a&&128&e[0]&&(this.s=-1,i>0&&(this.data[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),o&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},r.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},r.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},r.prototype.lShiftTo=function(e,t){var r,a=e%this.DB,n=this.DB-a,o=(1<<n)-1,i=Math.floor(e/this.DB),l=this.s<<a&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+i+1]=this.data[r]>>n|l,l=(this.data[r]&o)<<a;for(r=i-1;r>=0;--r)t.data[r]=0;t.data[i]=l,t.t=this.t+i+1,t.s=this.s,t.clamp()},r.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var a=e%this.DB,n=this.DB-a,o=(1<<a)-1;t.data[0]=this.data[r]>>a;for(var i=r+1;i<this.t;++i)t.data[i-r-1]|=(this.data[i]&o)<<n,t.data[i-r]=this.data[i]>>a;a>0&&(t.data[this.t-r-1]|=(this.s&o)<<n),t.t=this.t-r,t.clamp()}},r.prototype.subTo=function(e,t){for(var r=0,a=0,n=Math.min(e.t,this.t);r<n;)a+=this.data[r]-e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;if(e.t<this.t){for(a-=e.s;r<this.t;)a+=this.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=this.s}else{for(a+=this.s;r<e.t;)a-=e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a-=e.s}t.s=a<0?-1:0,a<-1?t.data[r++]=this.DV+a:a>0&&(t.data[r++]=a),t.t=r,t.clamp()},r.prototype.multiplyTo=function(e,t){var a=this.abs(),n=e.abs(),o=a.t;for(t.t=o+n.t;--o>=0;)t.data[o]=0;for(o=0;o<n.t;++o)t.data[o+a.t]=a.am(0,n.data[o],t,o,0,a.t);t.s=0,t.clamp(),this.s!=e.s&&r.ZERO.subTo(t,t)},r.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var a=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,a,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},r.prototype.divRemTo=function(e,t,n){var o=e.abs();if(!(o.t<=0)){var i=this.abs();if(i.t<o.t)return null!=t&&t.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=a());var l=a(),s=this.s,c=e.s,u=this.DB-v(o.data[o.t-1]);u>0?(o.lShiftTo(u,l),i.lShiftTo(u,n)):(o.copyTo(l),i.copyTo(n));var d=l.t,p=l.data[d-1];if(0!=p){var f=p*(1<<this.F1)+(d>1?l.data[d-2]>>this.F2:0),h=this.FV/f,g=(1<<this.F1)/f,m=1<<this.F2,b=n.t,y=b-d,_=null==t?a():t;for(l.dlShiftTo(y,_),n.compareTo(_)>=0&&(n.data[n.t++]=1,n.subTo(_,n)),r.ONE.dlShiftTo(d,_),_.subTo(l,l);l.t<d;)l.data[l.t++]=0;for(;--y>=0;){var w=n.data[--b]==p?this.DM:Math.floor(n.data[b]*h+(n.data[b-1]+m)*g);if((n.data[b]+=l.am(0,w,n,y,0,d))<w)for(l.dlShiftTo(y,_),n.subTo(_,n);n.data[b]<--w;)n.subTo(_,n)}null!=t&&(n.drShiftTo(d,t),s!=c&&r.ZERO.subTo(t,t)),n.t=d,n.clamp(),u>0&&n.rShiftTo(u,n),s<0&&r.ZERO.subTo(n,n)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},r.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},r.prototype.exp=function(e,t){if(e>4294967295||e<1)return r.ONE;var n=a(),o=a(),i=t.convert(this),l=v(e)-1;for(i.copyTo(n);--l>=0;)if(t.sqrTo(n,o),(e&1<<l)>0)t.mulTo(o,i,n);else{var s=n;n=o,o=s}return t.revert(n)},r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,a=(1<<t)-1,n=!1,o="",i=this.t,l=this.DB-i*this.DB%t;if(i-- >0)for(l<this.DB&&(r=this.data[i]>>l)>0&&(n=!0,o=s(r));i>=0;)l<t?(r=(this.data[i]&(1<<l)-1)<<t-l,r|=this.data[--i]>>(l+=this.DB-t)):(r=this.data[i]>>(l-=t)&a,l<=0&&(l+=this.DB,--i)),r>0&&(n=!0),n&&(o+=s(r));return n?o:"0"},r.prototype.negate=function(){var e=a();return r.ZERO.subTo(this,e),e},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+v(this.data[this.t-1]^this.s&this.DM)},r.prototype.mod=function(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t},r.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new d(t):new p(t),this.exp(e,r)},r.ZERO=u(0),r.ONE=u(1),_.prototype.convert=w,_.prototype.revert=w,_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},_.prototype.sqrTo=function(e,t){e.squareTo(t)},C.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=a();return e.copyTo(t),this.reduce(t),t},C.prototype.revert=function(e){return e},C.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},C.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},C.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var x=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],E=(1<<26)/x[x.length-1];return r.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},r.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=u(r),o=a(),i=a(),l="";for(this.divRemTo(n,o,i);o.signum()>0;)l=(r+i.intValue()).toString(e).substr(1)+l,o.divRemTo(n,o,i);return i.intValue().toString(e)+l},r.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var a=this.chunkSize(t),n=Math.pow(t,a),o=!1,i=0,l=0,s=0;s<e.length;++s){var u=c(e,s);u<0?"-"==e.charAt(s)&&0==this.signum()&&(o=!0):(l=t*l+u,++i>=a&&(this.dMultiply(n),this.dAddOffset(l,0),i=0,l=0))}i>0&&(this.dMultiply(Math.pow(t,i)),this.dAddOffset(l,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(e,t,a){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,a),this.testBit(e-1)||this.bitwiseTo(r.ONE.shiftLeft(e-1),h,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(r.ONE.shiftLeft(e-1),this);else{var n=new Array,o=7&e;n.length=1+(e>>3),t.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}},r.prototype.bitwiseTo=function(e,t,r){var a,n,o=Math.min(e.t,this.t);for(a=0;a<o;++a)r.data[a]=t(this.data[a],e.data[a]);if(e.t<this.t){for(n=e.s&this.DM,a=o;a<this.t;++a)r.data[a]=t(this.data[a],n);r.t=this.t}else{for(n=this.s&this.DM,a=o;a<e.t;++a)r.data[a]=t(n,e.data[a]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},r.prototype.changeBit=function(e,t){var a=r.ONE.shiftLeft(e);return this.bitwiseTo(a,t,a),a},r.prototype.addTo=function(e,t){for(var r=0,a=0,n=Math.min(e.t,this.t);r<n;)a+=this.data[r]+e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;if(e.t<this.t){for(a+=e.s;r<this.t;)a+=this.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=this.s}else{for(a+=this.s;r<e.t;)a+=e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=e.s}t.s=a<0?-1:0,a>0?t.data[r++]=a:a<-1&&(t.data[r++]=this.DV+a),t.t=r,t.clamp()},r.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},r.prototype.multiplyLowerTo=function(e,t,r){var a,n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;for(a=r.t-this.t;n<a;++n)r.data[n+this.t]=this.am(0,e.data[n],r,n,0,this.t);for(a=Math.min(e.t,t);n<a;++n)this.am(0,e.data[n],r,n,0,t-n);r.clamp()},r.prototype.multiplyUpperTo=function(e,t,r){--t;var a=r.t=this.t+e.t-t;for(r.s=0;--a>=0;)r.data[a]=0;for(a=Math.max(t-this.t,0);a<e.t;++a)r.data[this.t+a-t]=this.am(t-a,e.data[a],r,0,0,this.t+a-t);r.clamp(),r.drShiftTo(1,r)},r.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var a=this.t-1;a>=0;--a)r=(t*r+this.data[a])%e;return r},r.prototype.millerRabin=function(e){var t=this.subtract(r.ONE),a=t.getLowestSetBit();if(a<=0)return!1;for(var n,o=t.shiftRight(a),i={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},l=0;l<e;++l){do{n=new r(this.bitLength(),i)}while(n.compareTo(r.ONE)<=0||n.compareTo(t)>=0);var s=n.modPow(o,this);if(0!=s.compareTo(r.ONE)&&0!=s.compareTo(t)){for(var c=1;c++<a&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0},r.prototype.clone=function(){var e=a();return this.copyTo(e),e},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},r.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,a=this.DB-e*this.DB%8,n=0;if(e-- >0)for(a<this.DB&&(r=this.data[e]>>a)!=(this.s&this.DM)>>a&&(t[n++]=r|this.s<<this.DB-a);e>=0;)a<8?(r=(this.data[e]&(1<<a)-1)<<8-a,r|=this.data[--e]>>(a+=this.DB-8)):(r=this.data[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),128&r&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t},r.prototype.equals=function(e){return 0==this.compareTo(e)},r.prototype.min=function(e){return this.compareTo(e)<0?this:e},r.prototype.max=function(e){return this.compareTo(e)>0?this:e},r.prototype.and=function(e){var t=a();return this.bitwiseTo(e,f,t),t},r.prototype.or=function(e){var t=a();return this.bitwiseTo(e,h,t),t},r.prototype.xor=function(e){var t=a();return this.bitwiseTo(e,g,t),t},r.prototype.andNot=function(e){var t=a();return this.bitwiseTo(e,m,t),t},r.prototype.not=function(){for(var e=a(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},r.prototype.shiftLeft=function(e){var t=a();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},r.prototype.shiftRight=function(e){var t=a();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},r.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+b(this.data[e]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=y(this.data[r]^t);return e},r.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this.data[t]&1<<e%this.DB)},r.prototype.setBit=function(e){return this.changeBit(e,h)},r.prototype.clearBit=function(e){return this.changeBit(e,m)},r.prototype.flipBit=function(e){return this.changeBit(e,g)},r.prototype.add=function(e){var t=a();return this.addTo(e,t),t},r.prototype.subtract=function(e){var t=a();return this.subTo(e,t),t},r.prototype.multiply=function(e){var t=a();return this.multiplyTo(e,t),t},r.prototype.divide=function(e){var t=a();return this.divRemTo(e,t,null),t},r.prototype.remainder=function(e){var t=a();return this.divRemTo(e,null,t),t},r.prototype.divideAndRemainder=function(e){var t=a(),r=a();return this.divRemTo(e,t,r),new Array(t,r)},r.prototype.modPow=function(e,t){var r,n,o=e.bitLength(),i=u(1);if(o<=0)return i;r=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new d(t):t.isEven()?new C(t):new p(t);var l=new Array,s=3,c=r-1,f=(1<<r)-1;if(l[1]=n.convert(this),r>1){var h=a();for(n.sqrTo(l[1],h);s<=f;)l[s]=a(),n.mulTo(h,l[s-2],l[s]),s+=2}var g,m,b=e.t-1,y=!0,_=a();for(o=v(e.data[b])-1;b>=0;){for(o>=c?g=e.data[b]>>o-c&f:(g=(e.data[b]&(1<<o+1)-1)<<c-o,b>0&&(g|=e.data[b-1]>>this.DB+o-c)),s=r;!(1&g);)g>>=1,--s;if((o-=s)<0&&(o+=this.DB,--b),y)l[g].copyTo(i),y=!1;else{for(;s>1;)n.sqrTo(i,_),n.sqrTo(_,i),s-=2;s>0?n.sqrTo(i,_):(m=i,i=_,_=m),n.mulTo(_,l[g],i)}for(;b>=0&&!(e.data[b]&1<<o);)n.sqrTo(i,_),m=i,i=_,_=m,--o<0&&(o=this.DB-1,--b)}return n.revert(i)},r.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return r.ZERO;for(var a=e.clone(),n=this.clone(),o=u(1),i=u(0),l=u(0),s=u(1);0!=a.signum();){for(;a.isEven();)a.rShiftTo(1,a),t?(o.isEven()&&i.isEven()||(o.addTo(this,o),i.subTo(e,i)),o.rShiftTo(1,o)):i.isEven()||i.subTo(e,i),i.rShiftTo(1,i);for(;n.isEven();)n.rShiftTo(1,n),t?(l.isEven()&&s.isEven()||(l.addTo(this,l),s.subTo(e,s)),l.rShiftTo(1,l)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);a.compareTo(n)>=0?(a.subTo(n,a),t&&o.subTo(l,o),i.subTo(s,i)):(n.subTo(a,n),t&&l.subTo(o,l),s.subTo(i,s))}return 0!=n.compareTo(r.ONE)?r.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s},r.prototype.pow=function(e){return this.exp(e,new _)},r.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var a=t;t=r,r=a}var n=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(n<o&&(o=n),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=x[x.length-1]){for(t=0;t<x.length;++t)if(r.data[0]==x[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<x.length;){for(var a=x[t],n=t+1;n<x.length&&a<E;)a*=x[n++];for(a=r.modInt(a);t<n;)if(a%x[t++]==0)return!1}return r.millerRabin(e)},Vo}var $o,Ho,Go={exports:{}},Wo={exports:{}};function Yo(){if($o)return Wo.exports;$o=1;var e=jn();fo(),Wn();var t=Wo.exports=e.sha1=e.sha1||{};e.md.sha1=e.md.algorithms.sha1=t,t.create=function(){a||(r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),64),a=!0);var t=null,o=e.util.createBuffer(),i=new Array(80),l={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var r=l.messageLengthSize/4,a=0;a<r;++a)l.fullMessageLength.push(0);return o=e.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},l}};return l.start(),l.update=function(r,a){"utf8"===a&&(r=e.util.encodeUtf8(r));var s=r.length;l.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var c=l.fullMessageLength.length-1;c>=0;--c)l.fullMessageLength[c]+=s[1],s[1]=s[0]+(l.fullMessageLength[c]/4294967296>>>0),l.fullMessageLength[c]=l.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return o.putBytes(r),n(t,i,o),(o.read>2048||0===o.length())&&o.compact(),l},l.digest=function(){var a=e.util.createBuffer();a.putBytes(o.bytes());var s,c=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize&l.blockLength-1;a.putBytes(r.substr(0,l.blockLength-c));for(var u=8*l.fullMessageLength[0],v=0;v<l.fullMessageLength.length-1;++v)u+=(s=8*l.fullMessageLength[v+1])/4294967296>>>0,a.putInt32(u>>>0),u=s>>>0;a.putInt32(u);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};n(d,i,a);var p=e.util.createBuffer();return p.putInt32(d.h0),p.putInt32(d.h1),p.putInt32(d.h2),p.putInt32(d.h3),p.putInt32(d.h4),p},l};var r=null,a=!1;function n(e,t,r){for(var a,n,o,i,l,s,c,u=r.length();u>=64;){for(n=e.h0,o=e.h1,i=e.h2,l=e.h3,s=e.h4,c=0;c<16;++c)a=r.getInt32(),t[c]=a,a=(n<<5|n>>>27)+(l^o&(i^l))+s+1518500249+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;for(;c<20;++c)a=(a=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|a>>>31,t[c]=a,a=(n<<5|n>>>27)+(l^o&(i^l))+s+1518500249+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;for(;c<32;++c)a=(a=t[c-3]^t[c-8]^t[c-14]^t[c-16])<<1|a>>>31,t[c]=a,a=(n<<5|n>>>27)+(o^i^l)+s+1859775393+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;for(;c<40;++c)a=(a=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|a>>>30,t[c]=a,a=(n<<5|n>>>27)+(o^i^l)+s+1859775393+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;for(;c<60;++c)a=(a=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|a>>>30,t[c]=a,a=(n<<5|n>>>27)+(o&i|l&(o^i))+s+2400959708+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;for(;c<80;++c)a=(a=t[c-6]^t[c-16]^t[c-28]^t[c-32])<<2|a>>>30,t[c]=a,a=(n<<5|n>>>27)+(o^i^l)+s+3395469782+a,s=l,l=i,i=(o<<30|o>>>2)>>>0,o=n,n=a;e.h0=e.h0+n|0,e.h1=e.h1+o|0,e.h2=e.h2+i|0,e.h3=e.h3+l|0,e.h4=e.h4+s|0,u-=64}}return Wo.exports}function Qo(){if(Ho)return Go.exports;Ho=1;var e=jn();Wn(),qo(),Yo();var t=Go.exports=e.pkcs1=e.pkcs1||{};function r(t,r,a){a||(a=e.md.sha1.create());for(var n="",o=Math.ceil(r/a.digestLength),i=0;i<o;++i){var l=String.fromCharCode(i>>24&255,i>>16&255,i>>8&255,255&i);a.start(),a.update(t+l),n+=a.digest().getBytes()}return n.substring(0,r)}return t.encode_rsa_oaep=function(t,a,n){var o,i,l,s;"string"==typeof n?(o=n,i=arguments[3]||void 0,l=arguments[4]||void 0):n&&(o=n.label||void 0,i=n.seed||void 0,l=n.md||void 0,n.mgf1&&n.mgf1.md&&(s=n.mgf1.md)),l?l.start():l=e.md.sha1.create(),s||(s=l);var c=Math.ceil(t.n.bitLength()/8),u=c-2*l.digestLength-2;if(a.length>u)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=a.length,g.maxLength=u,g;o||(o=""),l.update(o,"raw");for(var v=l.digest(),d="",p=u-a.length,f=0;f<p;f++)d+="\0";var h=v.getBytes()+d+""+a;if(i){if(i.length!==l.digestLength){var g;throw(g=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=i.length,g.digestLength=l.digestLength,g}}else i=e.random.getBytes(l.digestLength);var m=r(i,c-l.digestLength-1,s),b=e.util.xorBytes(h,m,h.length),y=r(b,l.digestLength,s);return"\0"+e.util.xorBytes(i,y,i.length)+b},t.decode_rsa_oaep=function(t,a,n){var o,i,l;"string"==typeof n?(o=n,i=arguments[3]||void 0):n&&(o=n.label||void 0,i=n.md||void 0,n.mgf1&&n.mgf1.md&&(l=n.mgf1.md));var s=Math.ceil(t.n.bitLength()/8);if(a.length!==s)throw(m=new Error("RSAES-OAEP encoded message length is invalid.")).length=a.length,m.expectedLength=s,m;if(void 0===i?i=e.md.sha1.create():i.start(),l||(l=i),s<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");o||(o=""),i.update(o,"raw");for(var c=i.digest().getBytes(),u=a.charAt(0),v=a.substring(1,i.digestLength+1),d=a.substring(1+i.digestLength),p=r(d,i.digestLength,l),f=r(e.util.xorBytes(v,p,v.length),s-i.digestLength-1,l),h=e.util.xorBytes(d,f,d.length),g=h.substring(0,i.digestLength),m="\0"!==u,b=0;b<i.digestLength;++b)m|=c.charAt(b)!==g.charAt(b);for(var y=1,_=i.digestLength,w=i.digestLength;w<h.length;w++){var C=h.charCodeAt(w);m|=C&(y?65534:0),_+=y&=1&C^1}if(m||1!==h.charCodeAt(_))throw new Error("Invalid RSAES-OAEP padding.");return h.substring(_+1)},Go.exports}var Jo,Xo,Zo,ei,ti,ri={exports:{}};function ai(){if(Jo)return ri.exports;Jo=1;var e=jn();return Wn(),Ko(),qo(),function(){if(e.prime)ri.exports=e.prime;else{var t=ri.exports=e.prime=e.prime||{},r=e.jsbn.BigInteger,a=[6,4,2,4,2,4,6,2],n=new r(null);n.fromInt(30);var o=function(e,t){return e|t};t.generateProbablePrime=function(t,a,n){"function"==typeof a&&(n=a,a={});var o=(a=a||{}).algorithm||"PRIMEINC";"string"==typeof o&&(o={name:o}),o.options=o.options||{};var l=a.prng||e.random,c={nextBytes:function(e){for(var t=l.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===o.name)return function(t,a,n,o){if("workers"in n)return function(t,a,n,o){if("undefined"==typeof Worker)return i(t,a,n,o);var l=s(t,a),c=n.workers,u=n.workLoad||100,v=30*u/8,d=n.workerScript||"forge/prime.worker.js";if(-1===c)return e.util.estimateCores(function(e,t){e&&(t=2),c=t-1,p()});function p(){c=Math.max(1,c);for(var e=[],n=0;n<c;++n)e[n]=new Worker(d);for(n=0;n<c;++n)e[n].addEventListener("message",p);var i=!1;function p(n){if(!i){var c=n.data;if(c.found){for(var d=0;d<e.length;++d)e[d].terminate();return i=!0,o(null,new r(c.prime,16))}l.bitLength()>t&&(l=s(t,a));var p=l.toString(16);n.target.postMessage({hex:p,workLoad:u}),l.dAddOffset(v,0)}}}p()}(t,a,n,o);return i(t,a,n,o)}(t,c,o.options,n);throw new Error("Invalid prime generation algorithm: "+o.name)}}function i(e,t,r,a){var n=s(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(n.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var i=10;"maxBlockTime"in r&&(i=r.maxBlockTime),l(n,e,t,0,o,i,a)}function l(t,r,n,o,i,c,u){var v=+new Date;do{if(t.bitLength()>r&&(t=s(r,n)),t.isProbablePrime(i))return u(null,t);t.dAddOffset(a[o++%8],0)}while(c<0||+new Date-v<c);e.util.setImmediate(function(){l(t,r,n,o,i,c,u)})}function s(e,t){var a=new r(e,t),i=e-1;return a.testBit(i)||a.bitwiseTo(r.ONE.shiftLeft(i),o,a),a.dAddOffset(31-a.mod(n).byteValue(),0),a}}(),ri.exports}function ni(){if(Zo)return Xo;Zo=1;var e=jn();if(so(),Ko(),lo(),Qo(),ai(),qo(),Wn(),void 0===t)var t=e.jsbn.BigInteger;var r=e.util.isNodejs?ko:null,a=e.asn1,n=e.util;e.pki=e.pki||{},Xo=e.pki.rsa=e.rsa=e.rsa||{};var o=e.pki,i=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},s={name:"RSAPrivateKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},c={name:"RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},u=e.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},v={name:"DigestInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},d=function(e){var t;if(!(e.algorithm in o.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=o.oids[e.algorithm];var n=a.oidToDer(t).getBytes(),i=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]),l=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);l.value.push(a.create(a.Class.UNIVERSAL,a.Type.OID,!1,n)),l.value.push(a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,""));var s=a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(l),i.value.push(s),a.toDer(i).getBytes()},p=function(r,a,n){if(n)return r.modPow(a.e,a.n);if(!a.p||!a.q)return r.modPow(a.d,a.n);var o;a.dP||(a.dP=a.d.mod(a.p.subtract(t.ONE))),a.dQ||(a.dQ=a.d.mod(a.q.subtract(t.ONE))),a.qInv||(a.qInv=a.q.modInverse(a.p));do{o=new t(e.util.bytesToHex(e.random.getBytes(a.n.bitLength()/8)),16)}while(o.compareTo(a.n)>=0||!o.gcd(a.n).equals(t.ONE));for(var i=(r=r.multiply(o.modPow(a.e,a.n)).mod(a.n)).mod(a.p).modPow(a.dP,a.p),l=r.mod(a.q).modPow(a.dQ,a.q);i.compareTo(l)<0;)i=i.add(a.p);var s=i.subtract(l).multiply(a.qInv).mod(a.p).multiply(a.q).add(l);return s=s.multiply(o.modInverse(a.n)).mod(a.n)};function f(t,r,a){var n=e.util.createBuffer(),o=Math.ceil(r.n.bitLength()/8);if(t.length>o-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=t.length,i.max=o-11,i}n.putByte(0),n.putByte(a);var l,s=o-3-t.length;if(0===a||1===a){l=0===a?0:255;for(var c=0;c<s;++c)n.putByte(l)}else for(;s>0;){var u=0,v=e.random.getBytes(s);for(c=0;c<s;++c)0===(l=v.charCodeAt(c))?++u:n.putByte(l);s=u}return n.putByte(0),n.putBytes(t),n}function h(t,r,a,n){var o=Math.ceil(r.n.bitLength()/8),i=e.util.createBuffer(t),l=i.getByte(),s=i.getByte();if(0!==l||a&&0!==s&&1!==s||!a&&2!=s||a&&0===s&&void 0===n)throw new Error("Encryption block is invalid.");var c=0;if(0===s){c=o-3-n;for(var u=0;u<c;++u)if(0!==i.getByte())throw new Error("Encryption block is invalid.")}else if(1===s)for(c=0;i.length()>1;){if(255!==i.getByte()){--i.read;break}++c}else if(2===s)for(c=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++c}if(0!==i.getByte()||c!==o-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function g(t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var a=e.util.hexToBytes(r);return!(a.length>1)||(0!==a.charCodeAt(0)||128&a.charCodeAt(1))&&(255!==a.charCodeAt(0)||128&~a.charCodeAt(1))?a:a.substr(1)}function m(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function b(t){return e.util.isNodejs&&"function"==typeof r[t]}function y(e){return void 0!==n.globalScope&&"object"==typeof n.globalScope.crypto&&"object"==typeof n.globalScope.crypto.subtle&&"function"==typeof n.globalScope.crypto.subtle[e]}function _(e){return void 0!==n.globalScope&&"object"==typeof n.globalScope.msCrypto&&"object"==typeof n.globalScope.msCrypto.subtle&&"function"==typeof n.globalScope.msCrypto.subtle[e]}function w(t){for(var r=e.util.hexToBytes(t.toString(16)),a=new Uint8Array(r.length),n=0;n<r.length;++n)a[n]=r.charCodeAt(n);return a}return o.rsa.encrypt=function(r,a,n){var o,i=n,l=Math.ceil(a.n.bitLength()/8);!1!==n&&!0!==n?(i=2===n,o=f(r,a,n)):(o=e.util.createBuffer()).putBytes(r);for(var s=new t(o.toHex(),16),c=p(s,a,i).toString(16),u=e.util.createBuffer(),v=l-Math.ceil(c.length/2);v>0;)u.putByte(0),--v;return u.putBytes(e.util.hexToBytes(c)),u.getBytes()},o.rsa.decrypt=function(r,a,n,o){var i=Math.ceil(a.n.bitLength()/8);if(r.length!==i){var l=new Error("Encrypted message length is invalid.");throw l.length=r.length,l.expected=i,l}var s=new t(e.util.createBuffer(r).toHex(),16);if(s.compareTo(a.n)>=0)throw new Error("Encrypted message is invalid.");for(var c=p(s,a,n).toString(16),u=e.util.createBuffer(),v=i-Math.ceil(c.length/2);v>0;)u.putByte(0),--v;return u.putBytes(e.util.hexToBytes(c)),!1!==o?h(u.getBytes(),a,n):u.getBytes()},o.rsa.createKeyPairGenerationState=function(r,a,n){"string"==typeof r&&(r=parseInt(r,10)),r=r||2048;var o,i=(n=n||{}).prng||e.random,l={nextBytes:function(e){for(var t=i.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},s=n.algorithm||"PRIMEINC";if("PRIMEINC"!==s)throw new Error("Invalid key generation algorithm: "+s);return(o={algorithm:s,state:0,bits:r,rng:l,eInt:a||65537,e:new t(null),p:null,q:null,qBits:r>>1,pBits:r-(r>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},o.rsa.stepKeyPairGenerationState=function(e,r){"algorithm"in e||(e.algorithm="PRIMEINC");var a=new t(null);a.fromInt(30);for(var n,l=0,s=function(e,t){return e|t},c=+new Date,u=0;null===e.keys&&(r<=0||u<r);){if(0===e.state){var v=null===e.p?e.pBits:e.qBits,d=v-1;0===e.pqState?(e.num=new t(v,e.rng),e.num.testBit(d)||e.num.bitwiseTo(t.ONE.shiftLeft(d),s,e.num),e.num.dAddOffset(31-e.num.mod(a).byteValue(),0),l=0,++e.pqState):1===e.pqState?e.num.bitLength()>v?e.pqState=0:e.num.isProbablePrime(m(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(i[l++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(t.ONE).gcd(e.e).compareTo(t.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(t.ONE),e.q1=e.q.subtract(t.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(t.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var p=e.e.modInverse(e.phi);e.keys={privateKey:o.rsa.setPrivateKey(e.n,e.e,p,e.p,e.q,p.mod(e.p1),p.mod(e.q1),e.q.modInverse(e.p)),publicKey:o.rsa.setPublicKey(e.n,e.e)}}u+=(n=+new Date)-c,c=n}return null!==e.keys},o.rsa.generateKeyPair=function(i,l,s,c){if(1===arguments.length?"object"==typeof i?(s=i,i=void 0):"function"==typeof i&&(c=i,i=void 0):2===arguments.length?"number"==typeof i?"function"==typeof l?(c=l,l=void 0):"number"!=typeof l&&(s=l,l=void 0):(s=i,c=l,i=void 0,l=void 0):3===arguments.length&&("number"==typeof l?"function"==typeof s&&(c=s,s=void 0):(c=s,s=l,l=void 0)),s=s||{},void 0===i&&(i=s.bits||2048),void 0===l&&(l=s.e||65537),!e.options.usePureJavaScript&&!s.prng&&i>=256&&i<=16384&&(65537===l||3===l))if(c){if(b("generateKeyPair"))return r.generateKeyPair("rsa",{modulusLength:i,publicExponent:l,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(e,t,r){if(e)return c(e);c(null,{privateKey:o.privateKeyFromPem(r),publicKey:o.publicKeyFromPem(t)})});if(y("generateKey")&&y("exportKey"))return n.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:i,publicExponent:w(l),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return n.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){c(e)}).then(function(t){if(t){var r=o.privateKeyFromAsn1(a.fromDer(e.util.createBuffer(t)));c(null,{privateKey:r,publicKey:o.setRsaPublicKey(r.n,r.e)})}});if(_("generateKey")&&_("exportKey")){var u=n.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:i,publicExponent:w(l),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(t){var r=t.target.result,i=n.globalScope.msCrypto.subtle.exportKey("pkcs8",r.privateKey);i.oncomplete=function(t){var r=t.target.result,n=o.privateKeyFromAsn1(a.fromDer(e.util.createBuffer(r)));c(null,{privateKey:n,publicKey:o.setRsaPublicKey(n.n,n.e)})},i.onerror=function(e){c(e)}},void(u.onerror=function(e){c(e)})}}else if(b("generateKeyPairSync")){var v=r.generateKeyPairSync("rsa",{modulusLength:i,publicExponent:l,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:o.privateKeyFromPem(v.privateKey),publicKey:o.publicKeyFromPem(v.publicKey)}}var d=o.rsa.createKeyPairGenerationState(i,l,s);if(!c)return o.rsa.stepKeyPairGenerationState(d,0),d.keys;!function(r,a,n){"function"==typeof a&&(n=a,a={});a=a||{};var i={algorithm:{name:a.algorithm||"PRIMEINC",options:{workers:a.workers||2,workLoad:a.workLoad||100,workerScript:a.workerScript}}};"prng"in a&&(i.prng=a.prng);function l(){s(r.pBits,function(e,t){return e?n(e):(r.p=t,null!==r.q?c(e,r.q):void s(r.qBits,c))})}function s(t,r){e.prime.generateProbablePrime(t,i,r)}function c(e,a){if(e)return n(e);if(r.q=a,r.p.compareTo(r.q)<0){var i=r.p;r.p=r.q,r.q=i}if(0!==r.p.subtract(t.ONE).gcd(r.e).compareTo(t.ONE))return r.p=null,void l();if(0!==r.q.subtract(t.ONE).gcd(r.e).compareTo(t.ONE))return r.q=null,void s(r.qBits,c);if(r.p1=r.p.subtract(t.ONE),r.q1=r.q.subtract(t.ONE),r.phi=r.p1.multiply(r.q1),0!==r.phi.gcd(r.e).compareTo(t.ONE))return r.p=r.q=null,void l();if(r.n=r.p.multiply(r.q),r.n.bitLength()!==r.bits)return r.q=null,void s(r.qBits,c);var u=r.e.modInverse(r.phi);r.keys={privateKey:o.rsa.setPrivateKey(r.n,r.e,u,r.p,r.q,u.mod(r.p1),u.mod(r.q1),r.q.modInverse(r.p)),publicKey:o.rsa.setPublicKey(r.n,r.e)},n(null,r.keys)}l()}(d,s,c)},o.setRsaPublicKey=o.rsa.setPublicKey=function(t,r){var n={n:t,e:r,encrypt:function(t,r,a){if("string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===r)r={encode:function(e,t,r){return f(e,t,2).getBytes()}};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={encode:function(t,r){return e.pkcs1.encode_rsa_oaep(r,t,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(r))r={encode:function(e){return e}};else if("string"==typeof r)throw new Error('Unsupported encryption scheme: "'+r+'".');var i=r.encode(t,n,!0);return o.rsa.encrypt(i,n,!0)},verify:function(t,r,i,l){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===l&&(l={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in l||(l._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(t,r){r=h(r,n,!0);var o=a.fromDer(r,{parseAllBytes:l._parseAllDigestBytes}),i={},s=[];if(!a.validate(o,v,i,s))throw(c=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=s,c;var c,u=a.derToOid(i.algorithmIdentifier);if(u!==e.oids.md2&&u!==e.oids.md5&&u!==e.oids.sha1&&u!==e.oids.sha224&&u!==e.oids.sha256&&u!==e.oids.sha384&&u!==e.oids.sha512&&u!==e.oids["sha512-224"]&&u!==e.oids["sha512-256"])throw(c=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=u,c;if((u===e.oids.md2||u===e.oids.md5)&&!("parameters"in i))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return t===i.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=h(t,n,!0))}});var s=o.rsa.decrypt(r,n,!0,!1);return i.verify(t,s,n.n.bitLength())}};return n},o.setRsaPrivateKey=o.rsa.setPrivateKey=function(t,r,a,n,i,l,s,c){var u={n:t,e:r,d:a,p:n,q:i,dP:l,dQ:s,qInv:c,decrypt:function(t,r,a){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5");var n=o.rsa.decrypt(t,u,!1,!1);if("RSAES-PKCS1-V1_5"===r)r={decode:h};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={decode:function(t,r){return e.pkcs1.decode_rsa_oaep(r,t,a)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(r))throw new Error('Unsupported encryption scheme: "'+r+'".');r={decode:function(e){return e}}}return r.decode(n,u,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:d},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var a=t.encode(e,u.n.bitLength());return o.rsa.encrypt(a,u,r)}};return u},o.wrapRsaPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(e).getBytes())])},o.privateKeyFromAsn1=function(r){var n,i,c,u,v,d,p,f,h={},g=[];if(a.validate(r,l,h,g)&&(r=a.fromDer(e.util.createBuffer(h.privateKey))),h={},g=[],!a.validate(r,s,h,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m}return n=e.util.createBuffer(h.privateKeyModulus).toHex(),i=e.util.createBuffer(h.privateKeyPublicExponent).toHex(),c=e.util.createBuffer(h.privateKeyPrivateExponent).toHex(),u=e.util.createBuffer(h.privateKeyPrime1).toHex(),v=e.util.createBuffer(h.privateKeyPrime2).toHex(),d=e.util.createBuffer(h.privateKeyExponent1).toHex(),p=e.util.createBuffer(h.privateKeyExponent2).toHex(),f=e.util.createBuffer(h.privateKeyCoefficient).toHex(),o.setRsaPrivateKey(new t(n,16),new t(i,16),new t(c,16),new t(u,16),new t(v,16),new t(d,16),new t(p,16),new t(f,16))},o.privateKeyToAsn1=o.privateKeyToRSAPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.e)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.d)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.p)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.q)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.dP)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.dQ)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.qInv))])},o.publicKeyFromAsn1=function(r){var n={},i=[];if(a.validate(r,u,n,i)){var l,s=a.derToOid(n.publicKeyOid);if(s!==o.oids.rsaEncryption)throw(l=new Error("Cannot read public key. Unknown OID.")).oid=s,l;r=n.rsaPublicKey}if(i=[],!a.validate(r,c,n,i))throw(l=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=i,l;var v=e.util.createBuffer(n.publicKeyModulus).toHex(),d=e.util.createBuffer(n.publicKeyExponent).toHex();return o.setRsaPublicKey(new t(v,16),new t(d,16))},o.publicKeyToAsn1=o.publicKeyToSubjectPublicKeyInfo=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(o.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,[o.publicKeyToRSAPublicKey(e)])])},o.publicKeyToRSAPublicKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,g(e.e))])},Xo}function oi(){if(ti)return ei;ti=1;var e=jn();if(to(),so(),So(),fo(),lo(),Io(),wo(),qo(),Fo(),ni(),Wn(),void 0===t)var t=e.jsbn.BigInteger;var r=e.asn1,a=e.pki=e.pki||{};ei=a.pbe=e.pbe=e.pbe||{};var n=a.oids,o={name:"EncryptedPrivateKeyInfo",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},i={name:"PBES2Algorithms",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"iterations"}]};function s(e,t){return e.start().update(t).digest().getBytes()}function c(e){var t;if(e){if(!(t=a.oids[r.derToOid(e)])){var n=new Error("Unsupported PRF OID.");throw n.oid=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}}else t="hmacWithSHA1";return u(t)}function u(t){var r=e.md;switch(t){case"hmacWithSHA224":r=e.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=t,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!r||!(t in r))throw new Error("Unknown hash algorithm: "+t);return r[t].create()}return a.encryptPrivateKeyInfo=function(t,o,i){(i=i||{}).saltSize=i.saltSize||8,i.count=i.count||2048,i.algorithm=i.algorithm||"aes128",i.prfAlgorithm=i.prfAlgorithm||"sha1";var l,s,c,v=e.random.getBytesSync(i.saltSize),d=i.count,p=r.integerToDer(d);if(0===i.algorithm.indexOf("aes")||"des"===i.algorithm){var f,h,g;switch(i.algorithm){case"aes128":l=16,f=16,h=n["aes128-CBC"],g=e.aes.createEncryptionCipher;break;case"aes192":l=24,f=16,h=n["aes192-CBC"],g=e.aes.createEncryptionCipher;break;case"aes256":l=32,f=16,h=n["aes256-CBC"],g=e.aes.createEncryptionCipher;break;case"des":l=8,f=8,h=n.desCBC,g=e.des.createEncryptionCipher;break;default:throw(C=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,C}var m="hmacWith"+i.prfAlgorithm.toUpperCase(),b=u(m),y=e.pkcs5.pbkdf2(o,v,d,l,b),_=e.random.getBytesSync(f);(x=g(y)).start(_),x.update(r.toDer(t)),x.finish(),c=x.output.getBytes();var w=function(t,n,o,i){var l=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,t),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,n.getBytes())]);"hmacWithSHA1"!==i&&l.value.push(r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,e.util.hexToBytes(o.toString(16))),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.oids[i]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]));return l}(v,p,l,m);s=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(n.pkcs5PBES2).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(n.pkcs5PBKDF2).getBytes()),w]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(h).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,_)])])])}else{var C;if("3des"!==i.algorithm)throw(C=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,C;l=24;var x,E=new e.util.ByteBuffer(v);y=a.pbe.generatePkcs12Key(o,E,1,d,l),_=a.pbe.generatePkcs12Key(o,E,2,d,l);(x=e.des.createEncryptionCipher(y)).start(_),x.update(r.toDer(t)),x.finish(),c=x.output.getBytes(),s=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(n["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,v),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,p.getBytes())])])}return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[s,r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,c)])},a.decryptPrivateKeyInfo=function(t,n){var i=null,l={},s=[];if(!r.validate(t,o,l,s)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=s,c}var u=r.derToOid(l.encryptionOid),v=a.pbe.getCipher(u,l.encryptionParams,n),d=e.util.createBuffer(l.encryptedData);return v.update(d),v.finish()&&(i=r.fromDer(v.output)),i},a.encryptedPrivateKeyToPem=function(t,a){var n={type:"ENCRYPTED PRIVATE KEY",body:r.toDer(t).getBytes()};return e.pem.encode(n,{maxline:a})},a.encryptedPrivateKeyFromPem=function(t){var a=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==a.type){var n=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw n.headerType=a.type,n}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return r.fromDer(a.body)},a.encryptRsaPrivateKey=function(t,n,o){if(!(o=o||{}).legacy){var i=a.wrapRsaPrivateKey(a.privateKeyToAsn1(t));return i=a.encryptPrivateKeyInfo(i,n,o),a.encryptedPrivateKeyToPem(i)}var l,s,c,u;switch(o.algorithm){case"aes128":l="AES-128-CBC",c=16,s=e.random.getBytesSync(16),u=e.aes.createEncryptionCipher;break;case"aes192":l="AES-192-CBC",c=24,s=e.random.getBytesSync(16),u=e.aes.createEncryptionCipher;break;case"aes256":l="AES-256-CBC",c=32,s=e.random.getBytesSync(16),u=e.aes.createEncryptionCipher;break;case"3des":l="DES-EDE3-CBC",c=24,s=e.random.getBytesSync(8),u=e.des.createEncryptionCipher;break;case"des":l="DES-CBC",c=8,s=e.random.getBytesSync(8),u=e.des.createEncryptionCipher;break;default:var v=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+o.algorithm+'".');throw v.algorithm=o.algorithm,v}var d=u(e.pbe.opensslDeriveBytes(n,s.substr(0,8),c));d.start(s),d.update(r.toDer(a.privateKeyToAsn1(t))),d.finish();var p={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:l,parameters:e.util.bytesToHex(s).toUpperCase()},body:d.output.getBytes()};return e.pem.encode(p)},a.decryptRsaPrivateKey=function(t,n){var o=null,i=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var l,s;switch(i.dekInfo.algorithm){case"DES-CBC":l=8,s=e.des.createDecryptionCipher;break;case"DES-EDE3-CBC":l=24,s=e.des.createDecryptionCipher;break;case"AES-128-CBC":l=16,s=e.aes.createDecryptionCipher;break;case"AES-192-CBC":l=24,s=e.aes.createDecryptionCipher;break;case"AES-256-CBC":l=32,s=e.aes.createDecryptionCipher;break;case"RC2-40-CBC":l=5,s=function(t){return e.rc2.createDecryptionCipher(t,40)};break;case"RC2-64-CBC":l=8,s=function(t){return e.rc2.createDecryptionCipher(t,64)};break;case"RC2-128-CBC":l=16,s=function(t){return e.rc2.createDecryptionCipher(t,128)};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c}var u=e.util.hexToBytes(i.dekInfo.parameters),v=s(e.pbe.opensslDeriveBytes(n,u.substr(0,8),l));if(v.start(u),v.update(e.util.createBuffer(i.body)),!v.finish())return o;o=v.output.getBytes()}else o=i.body;return null!==(o="ENCRYPTED PRIVATE KEY"===i.type?a.decryptPrivateKeyInfo(r.fromDer(o),n):r.fromDer(o))&&(o=a.privateKeyFromAsn1(o)),o},a.pbe.generatePkcs12Key=function(t,r,a,n,o,i){var l,s;if(null==i){if(!("sha1"in e.md))throw new Error('"sha1" hash algorithm unavailable.');i=e.md.sha1.create()}var c=i.digestLength,u=i.blockLength,v=new e.util.ByteBuffer,d=new e.util.ByteBuffer;if(null!=t){for(s=0;s<t.length;s++)d.putInt16(t.charCodeAt(s));d.putInt16(0)}var p=d.length(),f=r.length(),h=new e.util.ByteBuffer;h.fillWithByte(a,u);var g=u*Math.ceil(f/u),m=new e.util.ByteBuffer;for(s=0;s<g;s++)m.putByte(r.at(s%f));var b=u*Math.ceil(p/u),y=new e.util.ByteBuffer;for(s=0;s<b;s++)y.putByte(d.at(s%p));var _=m;_.putBuffer(y);for(var w=Math.ceil(o/c),C=1;C<=w;C++){var x=new e.util.ByteBuffer;x.putBytes(h.bytes()),x.putBytes(_.bytes());for(var E=0;E<n;E++)i.start(),i.update(x.getBytes()),x=i.digest();var S=new e.util.ByteBuffer;for(s=0;s<u;s++)S.putByte(x.at(s%c));var k=Math.ceil(f/u)+Math.ceil(p/u),T=new e.util.ByteBuffer;for(l=0;l<k;l++){var A=new e.util.ByteBuffer(_.getBytes(u)),I=511;for(s=S.length()-1;s>=0;s--)I>>=8,I+=S.at(s)+A.at(s),A.setAt(s,255&I);T.putBuffer(A)}_=T,v.putBuffer(x)}return v.truncate(v.length()-o),v},a.pbe.getCipher=function(e,t,r){switch(e){case a.oids.pkcs5PBES2:return a.pbe.getCipherForPBES2(e,t,r);case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case a.oids["pbewithSHAAnd40BitRC2-CBC"]:return a.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},a.pbe.getCipherForPBES2=function(t,n,o){var l,s={},u=[];if(!r.validate(n,i,s,u))throw(l=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=u,l;if((t=r.derToOid(s.kdfOid))!==a.oids.pkcs5PBKDF2)throw(l=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,l.supportedOids=["pkcs5PBKDF2"],l;if((t=r.derToOid(s.encOid))!==a.oids["aes128-CBC"]&&t!==a.oids["aes192-CBC"]&&t!==a.oids["aes256-CBC"]&&t!==a.oids["des-EDE3-CBC"]&&t!==a.oids.desCBC)throw(l=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,l.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],l;var v,d,p=s.kdfSalt,f=e.util.createBuffer(s.kdfIterationCount);switch(f=f.getInt(f.length()<<3),a.oids[t]){case"aes128-CBC":v=16,d=e.aes.createDecryptionCipher;break;case"aes192-CBC":v=24,d=e.aes.createDecryptionCipher;break;case"aes256-CBC":v=32,d=e.aes.createDecryptionCipher;break;case"des-EDE3-CBC":v=24,d=e.des.createDecryptionCipher;break;case"desCBC":v=8,d=e.des.createDecryptionCipher}var h=c(s.prfOid),g=e.pkcs5.pbkdf2(o,p,f,v,h),m=s.encIv,b=d(g);return b.start(m),b},a.pbe.getCipherForPKCS12PBE=function(t,n,o){var i={},s=[];if(!r.validate(n,l,i,s))throw(h=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=s,h;var u,v,d,p=e.util.createBuffer(i.salt),f=e.util.createBuffer(i.iterations);switch(f=f.getInt(f.length()<<3),t){case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,v=8,d=e.des.startDecrypting;break;case a.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,v=8,d=function(t,r){var a=e.rc2.createDecryptionCipher(t,40);return a.start(r,null),a};break;default:var h;throw(h=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,h}var g=c(i.prfOid),m=a.pbe.generatePkcs12Key(o,p,1,f,u,g);return g.start(),d(m,a.pbe.generatePkcs12Key(o,p,2,f,v,g))},a.pbe.opensslDeriveBytes=function(t,r,a,n){if(null==n){if(!("md5"in e.md))throw new Error('"md5" hash algorithm unavailable.');n=e.md.md5.create()}null===r&&(r="");for(var o=[s(n,t+r)],i=16,l=1;i<a;++l,i+=16)o.push(s(n,o[l-1]+t+r));return o.join("").substr(0,a)},ei}var ii,li={exports:{}},si={exports:{}};function ci(){if(ii)return si.exports;ii=1;var e=jn();so(),Wn();var t=e.asn1,r=si.exports=e.pkcs7asn1=e.pkcs7asn1||{};e.pkcs7=e.pkcs7||{},e.pkcs7.asn1=r;var a={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};r.contentInfoValidator=a;var n={name:"EncryptedContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};r.envelopedDataValidator={name:"EnvelopedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(n)},r.encryptedDataValidator={name:"EncryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"}].concat(n)};var o={name:"SignerInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};return r.signedDataValidator={name:"SignedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},a,{name:"SignedData.Certificates",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,capture:"signerInfos",optional:!0,value:[o]}]},r.recipientInfoValidator={name:"RecipientInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]},si.exports}var ui,vi,di,pi={exports:{}},fi={exports:{}};function hi(){if(ui)return fi.exports;ui=1;var e=jn();return Wn(),e.mgf=e.mgf||{},(fi.exports=e.mgf.mgf1=e.mgf1=e.mgf1||{}).create=function(t){return{generate:function(r,a){for(var n=new e.util.ByteBuffer,o=Math.ceil(a/t.digestLength),i=0;i<o;i++){var l=new e.util.ByteBuffer;l.putInt32(i),t.start(),t.update(r+l.getBytes()),n.putBuffer(t.digest())}return n.truncate(n.length()-a),n.getBytes()}}},fi.exports}var gi,mi,bi,yi,_i,wi,Ci,xi={exports:{}};function Ei(){if(gi)return xi.exports;gi=1;var e=jn();return qo(),Wn(),(xi.exports=e.pss=e.pss||{}).create=function(t){3===arguments.length&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var r,a=t.md,n=t.mgf,o=a.digestLength,i=t.salt||null;if("string"==typeof i&&(i=e.util.createBuffer(i)),"saltLength"in t)r=t.saltLength;else{if(null===i)throw new Error("Salt length not specified or specific salt not given.");r=i.length()}if(null!==i&&i.length()!==r)throw new Error("Given salt length does not match length of given salt.");var l=t.prng||e.random,s={encode:function(t,s){var c,u,v=s-1,d=Math.ceil(v/8),p=t.digest().getBytes();if(d<o+r+2)throw new Error("Message is too long to encrypt.");u=null===i?l.getBytesSync(r):i.bytes();var f=new e.util.ByteBuffer;f.fillWithByte(0,8),f.putBytes(p),f.putBytes(u),a.start(),a.update(f.getBytes());var h=a.digest().getBytes(),g=new e.util.ByteBuffer;g.fillWithByte(0,d-r-o-2),g.putByte(1),g.putBytes(u);var m=g.getBytes(),b=d-o-1,y=n.generate(h,b),_="";for(c=0;c<b;c++)_+=String.fromCharCode(m.charCodeAt(c)^y.charCodeAt(c));var w=65280>>8*d-v&255;return(_=String.fromCharCode(_.charCodeAt(0)&~w)+_.substr(1))+h+String.fromCharCode(188)},verify:function(t,i,l){var s,c=l-1,u=Math.ceil(c/8);if(i=i.substr(-u),u<o+r+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==i.charCodeAt(u-1))throw new Error("Encoded message does not end in 0xBC.");var v=u-o-1,d=i.substr(0,v),p=i.substr(v,o),f=65280>>8*u-c&255;if(0!==(d.charCodeAt(0)&f))throw new Error("Bits beyond keysize not zero as expected.");var h=n.generate(p,v),g="";for(s=0;s<v;s++)g+=String.fromCharCode(d.charCodeAt(s)^h.charCodeAt(s));g=String.fromCharCode(g.charCodeAt(0)&~f)+g.substr(1);var m=u-o-r-2;for(s=0;s<m;s++)if(0!==g.charCodeAt(s))throw new Error("Leftmost octets not zero as expected");if(1!==g.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var b=g.substr(-r),y=new e.util.ByteBuffer;return y.fillWithByte(0,8),y.putBytes(t),y.putBytes(b),a.start(),a.update(y.getBytes()),p===a.digest().getBytes()}};return s},xi.exports}function Si(){if(mi)return pi.exports;mi=1;var e=jn();to(),so(),So(),fo(),function(){if(di)return vi;di=1;var e=jn();hi(),vi=e.mgf=e.mgf||{},e.mgf.mgf1=e.mgf1}(),lo(),wo(),Ei(),ni(),Wn();var t=e.asn1,r=pi.exports=e.pki=e.pki||{},a=r.oids,n={};n.CN=a.commonName,n.commonName="CN",n.C=a.countryName,n.countryName="C",n.L=a.localityName,n.localityName="L",n.ST=a.stateOrProvinceName,n.stateOrProvinceName="ST",n.O=a.organizationName,n.organizationName="O",n.OU=a.organizationalUnitName,n.organizationalUnitName="OU",n.E=a.emailAddress,n.emailAddress="E";var o=e.pki.rsa.publicKeyValidator,i={name:"Certificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},o,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},l={name:"rsapss",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},s={name:"CertificationRequestInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},o,{name:"CertificationRequestInfo.attributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0}]}]}]},c={name:"CertificationRequest",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[s,{name:"CertificationRequest.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function u(e,t){"string"==typeof t&&(t={shortName:t});for(var r,a=null,n=0;null===a&&n<e.attributes.length;++n)r=e.attributes[n],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(a=r);return a}r.RDNAttributesAsArray=function(e,r){for(var o,i,l,s=[],c=0;c<e.value.length;++c){o=e.value[c];for(var u=0;u<o.value.length;++u)l={},i=o.value[u],l.type=t.derToOid(i.value[0].value),l.value=i.value[1].value,l.valueTagClass=i.value[1].type,l.type in a&&(l.name=a[l.type],l.name in n&&(l.shortName=n[l.name])),r&&(r.update(l.type),r.update(l.value)),s.push(l)}return s},r.CRIAttributesAsArray=function(e){for(var o=[],i=0;i<e.length;++i)for(var l=e[i],s=t.derToOid(l.value[0].value),c=l.value[1].value,u=0;u<c.length;++u){var v={};if(v.type=s,v.value=c[u].value,v.valueTagClass=c[u].type,v.type in a&&(v.name=a[v.type],v.name in n&&(v.shortName=n[v.name])),v.type===a.extensionRequest){v.extensions=[];for(var d=0;d<v.value.length;++d)v.extensions.push(r.certificateExtensionFromAsn1(v.value[d]))}o.push(v)}return o};var v=function(e,r,n){var o={};if(e!==a["RSASSA-PSS"])return o;n&&(o={hash:{algorithmOid:a.sha1},mgf:{algorithmOid:a.mgf1,hash:{algorithmOid:a.sha1}},saltLength:20});var i={},s=[];if(!t.validate(r,l,i,s)){var c=new Error("Cannot read RSASSA-PSS parameter block.");throw c.errors=s,c}return void 0!==i.hashOid&&(o.hash=o.hash||{},o.hash.algorithmOid=t.derToOid(i.hashOid)),void 0!==i.maskGenOid&&(o.mgf=o.mgf||{},o.mgf.algorithmOid=t.derToOid(i.maskGenOid),o.mgf.hash=o.mgf.hash||{},o.mgf.hash.algorithmOid=t.derToOid(i.maskGenHashOid)),void 0!==i.saltLength&&(o.saltLength=i.saltLength.charCodeAt(0)),o},d=function(t){switch(a[t.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return e.md.sha1.create();case"md5WithRSAEncryption":return e.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return e.md.sha256.create();case"sha384WithRSAEncryption":return e.md.sha384.create();case"sha512WithRSAEncryption":return e.md.sha512.create();default:var r=new Error("Could not compute "+t.type+" digest. Unknown signature OID.");throw r.signatureOid=t.signatureOid,r}},p=function(t){var r,n=t.certificate;switch(n.signatureOid){case a.sha1WithRSAEncryption:case a.sha1WithRSASignature:break;case a["RSASSA-PSS"]:var o,i,l;if(void 0===(o=a[n.signatureParameters.mgf.hash.algorithmOid])||void 0===e.md[o])throw(l=new Error("Unsupported MGF hash function.")).oid=n.signatureParameters.mgf.hash.algorithmOid,l.name=o,l;if(void 0===(i=a[n.signatureParameters.mgf.algorithmOid])||void 0===e.mgf[i])throw(l=new Error("Unsupported MGF function.")).oid=n.signatureParameters.mgf.algorithmOid,l.name=i,l;if(i=e.mgf[i].create(e.md[o].create()),void 0===(o=a[n.signatureParameters.hash.algorithmOid])||void 0===e.md[o])throw(l=new Error("Unsupported RSASSA-PSS hash function.")).oid=n.signatureParameters.hash.algorithmOid,l.name=o,l;r=e.pss.create(e.md[o].create(),i,n.signatureParameters.saltLength)}return n.publicKey.verify(t.md.digest().getBytes(),t.signature,r)};function f(r){for(var a,n,o=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),i=r.attributes,l=0;l<i.length;++l){var s=(a=i[l]).value,c=t.Type.PRINTABLESTRING;"valueTagClass"in a&&(c=a.valueTagClass)===t.Type.UTF8&&(s=e.util.encodeUtf8(s)),n=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.type).getBytes()),t.create(t.Class.UNIVERSAL,c,!1,s)])]),o.value.push(n)}return o}function h(e){for(var o,i=0;i<e.length;++i){if(void 0===(o=e[i]).name&&(o.type&&o.type in r.oids?o.name=r.oids[o.type]:o.shortName&&o.shortName in n&&(o.name=r.oids[n[o.shortName]])),void 0===o.type){if(!o.name||!(o.name in r.oids))throw(s=new Error("Attribute type not specified.")).attribute=o,s;o.type=r.oids[o.name]}if(void 0===o.shortName&&o.name&&o.name in n&&(o.shortName=n[o.name]),o.type===a.extensionRequest&&(o.valueConstructed=!0,o.valueTagClass=t.Type.SEQUENCE,!o.value&&o.extensions)){o.value=[];for(var l=0;l<o.extensions.length;++l)o.value.push(r.certificateExtensionToAsn1(g(o.extensions[l])))}var s;if(void 0===o.value)throw(s=new Error("Attribute value not specified.")).attribute=o,s}}function g(n,o){if(o=o||{},void 0===n.name&&n.id&&n.id in r.oids&&(n.name=r.oids[n.id]),void 0===n.id){if(!n.name||!(n.name in r.oids))throw(w=new Error("Extension ID not specified.")).extension=n,w;n.id=r.oids[n.name]}if(void 0!==n.value)return n;if("keyUsage"===n.name){var i=0,l=0,s=0;n.digitalSignature&&(l|=128,i=7),n.nonRepudiation&&(l|=64,i=6),n.keyEncipherment&&(l|=32,i=5),n.dataEncipherment&&(l|=16,i=4),n.keyAgreement&&(l|=8,i=3),n.keyCertSign&&(l|=4,i=2),n.cRLSign&&(l|=2,i=1),n.encipherOnly&&(l|=1,i=0),n.decipherOnly&&(s|=128,i=7);var c=String.fromCharCode(i);0!==s?c+=String.fromCharCode(l)+String.fromCharCode(s):0!==l&&(c+=String.fromCharCode(l)),n.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c)}else if("basicConstraints"===n.name)n.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),n.cA&&n.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in n&&n.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(n.pathLenConstraint).getBytes()));else if("extKeyUsage"===n.name){n.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);var u=n.value.value;for(var v in n)!0===n[v]&&(v in a?u.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a[v]).getBytes())):-1!==v.indexOf(".")&&u.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(v).getBytes())))}else if("nsCertType"===n.name){i=0,l=0;n.client&&(l|=128,i=7),n.server&&(l|=64,i=6),n.email&&(l|=32,i=5),n.objsign&&(l|=16,i=4),n.reserved&&(l|=8,i=3),n.sslCA&&(l|=4,i=2),n.emailCA&&(l|=2,i=1),n.objCA&&(l|=1,i=0);c=String.fromCharCode(i);0!==l&&(c+=String.fromCharCode(l)),n.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c)}else if("subjectAltName"===n.name||"issuerAltName"===n.name){n.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);for(var d=0;d<n.altNames.length;++d){c=(b=n.altNames[d]).value;if(7===b.type&&b.ip){if(null===(c=e.util.bytesFromIP(b.ip)))throw(w=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=n,w}else 8===b.type&&(c=b.oid?t.oidToDer(t.oidToDer(b.oid)):t.oidToDer(c));n.value.value.push(t.create(t.Class.CONTEXT_SPECIFIC,b.type,!1,c))}}else if("nsComment"===n.name&&o.cert){if(!/^[\x00-\x7F]*$/.test(n.comment)||n.comment.length<1||n.comment.length>128)throw new Error('Invalid "nsComment" content.');n.value=t.create(t.Class.UNIVERSAL,t.Type.IA5STRING,!1,n.comment)}else if("subjectKeyIdentifier"===n.name&&o.cert){var p=o.cert.generateSubjectKeyIdentifier();n.subjectKeyIdentifier=p.toHex(),n.value=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===n.name&&o.cert){n.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);u=n.value.value;if(n.keyIdentifier){var h=!0===n.keyIdentifier?o.cert.generateSubjectKeyIdentifier().getBytes():n.keyIdentifier;u.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!1,h))}if(n.authorityCertIssuer){var g=[t.create(t.Class.CONTEXT_SPECIFIC,4,!0,[f(!0===n.authorityCertIssuer?o.cert.issuer:n.authorityCertIssuer)])];u.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,g))}if(n.serialNumber){var m=e.util.hexToBytes(!0===n.serialNumber?o.cert.serialNumber:n.serialNumber);u.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===n.name){n.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);u=n.value.value;var b,y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),_=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d<n.altNames.length;++d){c=(b=n.altNames[d]).value;if(7===b.type&&b.ip){if(null===(c=e.util.bytesFromIP(b.ip)))throw(w=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=n,w}else 8===b.type&&(c=b.oid?t.oidToDer(t.oidToDer(b.oid)):t.oidToDer(c));_.value.push(t.create(t.Class.CONTEXT_SPECIFIC,b.type,!1,c))}y.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[_])),u.push(y)}var w;if(void 0===n.value)throw(w=new Error("Extension value not specified.")).extension=n,w;return n}function m(e,r){if(e===a["RSASSA-PSS"]){var n=[];return void 0!==r.hash.algorithmOid&&n.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])),void 0!==r.mgf.algorithmOid&&n.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])])),void 0!==r.saltLength&&n.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.saltLength).getBytes())])),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,n)}return t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")}function b(r){var a=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===r.attributes.length)return a;for(var n=r.attributes,o=0;o<n.length;++o){var i=n[o],l=i.value,s=t.Type.UTF8;"valueTagClass"in i&&(s=i.valueTagClass),s===t.Type.UTF8&&(l=e.util.encodeUtf8(l));var c=!1;"valueConstructed"in i&&(c=i.valueConstructed);var u=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(i.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,s,c,l)])]);a.value.push(u)}return a}r.certificateFromPem=function(a,n,o){var i=e.pem.decode(a)[0];if("CERTIFICATE"!==i.type&&"X509 CERTIFICATE"!==i.type&&"TRUSTED CERTIFICATE"!==i.type){var l=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw l.headerType=i.type,l}if(i.procType&&"ENCRYPTED"===i.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=t.fromDer(i.body,o);return r.certificateFromAsn1(s,n)},r.certificateToPem=function(a,n){var o={type:"CERTIFICATE",body:t.toDer(r.certificateToAsn1(a)).getBytes()};return e.pem.encode(o,{maxline:n})},r.publicKeyFromPem=function(a){var n=e.pem.decode(a)[0];if("PUBLIC KEY"!==n.type&&"RSA PUBLIC KEY"!==n.type){var o=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var i=t.fromDer(n.body);return r.publicKeyFromAsn1(i)},r.publicKeyToPem=function(a,n){var o={type:"PUBLIC KEY",body:t.toDer(r.publicKeyToAsn1(a)).getBytes()};return e.pem.encode(o,{maxline:n})},r.publicKeyToRSAPublicKeyPem=function(a,n){var o={type:"RSA PUBLIC KEY",body:t.toDer(r.publicKeyToRSAPublicKey(a)).getBytes()};return e.pem.encode(o,{maxline:n})},r.getPublicKeyFingerprint=function(a,n){var o,i=(n=n||{}).md||e.md.sha1.create();switch(n.type||"RSAPublicKey"){case"RSAPublicKey":o=t.toDer(r.publicKeyToRSAPublicKey(a)).getBytes();break;case"SubjectPublicKeyInfo":o=t.toDer(r.publicKeyToAsn1(a)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+n.type+'".')}i.start(),i.update(o);var l=i.digest();if("hex"===n.encoding){var s=l.toHex();return n.delimiter?s.match(/.{2}/g).join(n.delimiter):s}if("binary"===n.encoding)return l.getBytes();if(n.encoding)throw new Error('Unknown encoding "'+n.encoding+'".');return l},r.certificationRequestFromPem=function(a,n,o){var i=e.pem.decode(a)[0];if("CERTIFICATE REQUEST"!==i.type){var l=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw l.headerType=i.type,l}if(i.procType&&"ENCRYPTED"===i.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=t.fromDer(i.body,o);return r.certificationRequestFromAsn1(s,n)},r.certificationRequestToPem=function(a,n){var o={type:"CERTIFICATE REQUEST",body:t.toDer(r.certificationRequestToAsn1(a)).getBytes()};return e.pem.encode(o,{maxline:n})},r.createCertificate=function(){var n={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return n.siginfo.algorithmOid=null,n.validity={},n.validity.notBefore=new Date,n.validity.notAfter=new Date,n.issuer={},n.issuer.getField=function(e){return u(n.issuer,e)},n.issuer.addField=function(e){h([e]),n.issuer.attributes.push(e)},n.issuer.attributes=[],n.issuer.hash=null,n.subject={},n.subject.getField=function(e){return u(n.subject,e)},n.subject.addField=function(e){h([e]),n.subject.attributes.push(e)},n.subject.attributes=[],n.subject.hash=null,n.extensions=[],n.publicKey=null,n.md=null,n.setSubject=function(e,t){h(e),n.subject.attributes=e,delete n.subject.uniqueId,t&&(n.subject.uniqueId=t),n.subject.hash=null},n.setIssuer=function(e,t){h(e),n.issuer.attributes=e,delete n.issuer.uniqueId,t&&(n.issuer.uniqueId=t),n.issuer.hash=null},n.setExtensions=function(e){for(var t=0;t<e.length;++t)g(e[t],{cert:n});n.extensions=e},n.getExtension=function(e){"string"==typeof e&&(e={name:e});for(var t,r=null,a=0;null===r&&a<n.extensions.length;++a)t=n.extensions[a],(e.id&&t.id===e.id||e.name&&t.name===e.name)&&(r=t);return r},n.sign=function(o,i){n.md=i||e.md.sha1.create();var l=a[n.md.algorithm+"WithRSAEncryption"];if(!l){var s=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw s.algorithm=n.md.algorithm,s}n.signatureOid=n.siginfo.algorithmOid=l,n.tbsCertificate=r.getTBSCertificate(n);var c=t.toDer(n.tbsCertificate);n.md.update(c.getBytes()),n.signature=o.sign(n.md)},n.verify=function(e){var a=!1;if(!n.issued(e)){var o=e.issuer,i=n.subject,l=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw l.expectedIssuer=i.attributes,l.actualIssuer=o.attributes,l}var s=e.md;if(null===s){s=d({signatureOid:e.signatureOid,type:"certificate"});var c=e.tbsCertificate||r.getTBSCertificate(e),u=t.toDer(c);s.update(u.getBytes())}return null!==s&&(a=p({certificate:n,md:s,signature:e.signature})),a},n.isIssuer=function(e){var t=!1,r=n.issuer,a=e.subject;if(r.hash&&a.hash)t=r.hash===a.hash;else if(r.attributes.length===a.attributes.length){var o,i;t=!0;for(var l=0;t&&l<r.attributes.length;++l)o=r.attributes[l],i=a.attributes[l],o.type===i.type&&o.value===i.value||(t=!1)}return t},n.issued=function(e){return e.isIssuer(n)},n.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(n.publicKey,{type:"RSAPublicKey"})},n.verifySubjectKeyIdentifier=function(){for(var t=a.subjectKeyIdentifier,r=0;r<n.extensions.length;++r){var o=n.extensions[r];if(o.id===t){var i=n.generateSubjectKeyIdentifier().getBytes();return e.util.hexToBytes(o.subjectKeyIdentifier)===i}}return!1},n},r.certificateFromAsn1=function(a,n){var o={},l=[];if(!t.validate(a,i,o,l)){var s=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw s.errors=l,s}if(t.derToOid(o.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=r.createCertificate();c.version=o.certVersion?o.certVersion.charCodeAt(0):0;var p=e.util.createBuffer(o.certSerialNumber);c.serialNumber=p.toHex(),c.signatureOid=e.asn1.derToOid(o.certSignatureOid),c.signatureParameters=v(c.signatureOid,o.certSignatureParams,!0),c.siginfo.algorithmOid=e.asn1.derToOid(o.certinfoSignatureOid),c.siginfo.parameters=v(c.siginfo.algorithmOid,o.certinfoSignatureParams,!1),c.signature=o.certSignature;var f=[];if(void 0!==o.certValidity1UTCTime&&f.push(t.utcTimeToDate(o.certValidity1UTCTime)),void 0!==o.certValidity2GeneralizedTime&&f.push(t.generalizedTimeToDate(o.certValidity2GeneralizedTime)),void 0!==o.certValidity3UTCTime&&f.push(t.utcTimeToDate(o.certValidity3UTCTime)),void 0!==o.certValidity4GeneralizedTime&&f.push(t.generalizedTimeToDate(o.certValidity4GeneralizedTime)),f.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=f[0],c.validity.notAfter=f[1],c.tbsCertificate=o.tbsCertificate,n){c.md=d({signatureOid:c.signatureOid,type:"certificate"});var g=t.toDer(c.tbsCertificate);c.md.update(g.getBytes())}var m=e.md.sha1.create(),b=t.toDer(o.certIssuer);m.update(b.getBytes()),c.issuer.getField=function(e){return u(c.issuer,e)},c.issuer.addField=function(e){h([e]),c.issuer.attributes.push(e)},c.issuer.attributes=r.RDNAttributesAsArray(o.certIssuer),o.certIssuerUniqueId&&(c.issuer.uniqueId=o.certIssuerUniqueId),c.issuer.hash=m.digest().toHex();var y=e.md.sha1.create(),_=t.toDer(o.certSubject);return y.update(_.getBytes()),c.subject.getField=function(e){return u(c.subject,e)},c.subject.addField=function(e){h([e]),c.subject.attributes.push(e)},c.subject.attributes=r.RDNAttributesAsArray(o.certSubject),o.certSubjectUniqueId&&(c.subject.uniqueId=o.certSubjectUniqueId),c.subject.hash=y.digest().toHex(),o.certExtensions?c.extensions=r.certificateExtensionsFromAsn1(o.certExtensions):c.extensions=[],c.publicKey=r.publicKeyFromAsn1(o.subjectPublicKeyInfo),c},r.certificateExtensionsFromAsn1=function(e){for(var t=[],a=0;a<e.value.length;++a)for(var n=e.value[a],o=0;o<n.value.length;++o)t.push(r.certificateExtensionFromAsn1(n.value[o]));return t},r.certificateExtensionFromAsn1=function(r){var n={};if(n.id=t.derToOid(r.value[0].value),n.critical=!1,r.value[1].type===t.Type.BOOLEAN?(n.critical=0!==r.value[1].value.charCodeAt(0),n.value=r.value[2].value):n.value=r.value[1].value,n.id in a)if(n.name=a[n.id],"keyUsage"===n.name){var o=0,i=0;(s=t.fromDer(n.value)).value.length>1&&(o=s.value.charCodeAt(1),i=s.value.length>2?s.value.charCodeAt(2):0),n.digitalSignature=!(128&~o),n.nonRepudiation=!(64&~o),n.keyEncipherment=!(32&~o),n.dataEncipherment=!(16&~o),n.keyAgreement=!(8&~o),n.keyCertSign=!(4&~o),n.cRLSign=!(2&~o),n.encipherOnly=!(1&~o),n.decipherOnly=!(128&~i)}else if("basicConstraints"===n.name){(s=t.fromDer(n.value)).value.length>0&&s.value[0].type===t.Type.BOOLEAN?n.cA=0!==s.value[0].value.charCodeAt(0):n.cA=!1;var l=null;s.value.length>0&&s.value[0].type===t.Type.INTEGER?l=s.value[0].value:s.value.length>1&&(l=s.value[1].value),null!==l&&(n.pathLenConstraint=t.derToInteger(l))}else if("extKeyUsage"===n.name)for(var s=t.fromDer(n.value),c=0;c<s.value.length;++c){var u=t.derToOid(s.value[c].value);u in a?n[a[u]]=!0:n[u]=!0}else if("nsCertType"===n.name){o=0;(s=t.fromDer(n.value)).value.length>1&&(o=s.value.charCodeAt(1)),n.client=!(128&~o),n.server=!(64&~o),n.email=!(32&~o),n.objsign=!(16&~o),n.reserved=!(8&~o),n.sslCA=!(4&~o),n.emailCA=!(2&~o),n.objCA=!(1&~o)}else if("subjectAltName"===n.name||"issuerAltName"===n.name){var v;n.altNames=[];s=t.fromDer(n.value);for(var d=0;d<s.value.length;++d){var p={type:(v=s.value[d]).type,value:v.value};switch(n.altNames.push(p),v.type){case 1:case 2:case 6:break;case 7:p.ip=e.util.bytesToIP(v.value);break;case 8:p.oid=t.derToOid(v.value)}}}else if("subjectKeyIdentifier"===n.name){s=t.fromDer(n.value);n.subjectKeyIdentifier=e.util.bytesToHex(s.value)}return n},r.certificationRequestFromAsn1=function(a,n){var o={},i=[];if(!t.validate(a,c,o,i)){var l=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw l.errors=i,l}if(t.derToOid(o.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var s=r.createCertificationRequest();if(s.version=o.csrVersion?o.csrVersion.charCodeAt(0):0,s.signatureOid=e.asn1.derToOid(o.csrSignatureOid),s.signatureParameters=v(s.signatureOid,o.csrSignatureParams,!0),s.siginfo.algorithmOid=e.asn1.derToOid(o.csrSignatureOid),s.siginfo.parameters=v(s.siginfo.algorithmOid,o.csrSignatureParams,!1),s.signature=o.csrSignature,s.certificationRequestInfo=o.certificationRequestInfo,n){s.md=d({signatureOid:s.signatureOid,type:"certification request"});var p=t.toDer(s.certificationRequestInfo);s.md.update(p.getBytes())}var f=e.md.sha1.create();return s.subject.getField=function(e){return u(s.subject,e)},s.subject.addField=function(e){h([e]),s.subject.attributes.push(e)},s.subject.attributes=r.RDNAttributesAsArray(o.certificationRequestInfoSubject,f),s.subject.hash=f.digest().toHex(),s.publicKey=r.publicKeyFromAsn1(o.subjectPublicKeyInfo),s.getAttribute=function(e){return u(s,e)},s.addAttribute=function(e){h([e]),s.attributes.push(e)},s.attributes=r.CRIAttributesAsArray(o.certificationRequestInfoAttributes||[]),s},r.createCertificationRequest=function(){var n={version:0,signatureOid:null,signature:null,siginfo:{}};return n.siginfo.algorithmOid=null,n.subject={},n.subject.getField=function(e){return u(n.subject,e)},n.subject.addField=function(e){h([e]),n.subject.attributes.push(e)},n.subject.attributes=[],n.subject.hash=null,n.publicKey=null,n.attributes=[],n.getAttribute=function(e){return u(n,e)},n.addAttribute=function(e){h([e]),n.attributes.push(e)},n.md=null,n.setSubject=function(e){h(e),n.subject.attributes=e,n.subject.hash=null},n.setAttributes=function(e){h(e),n.attributes=e},n.sign=function(o,i){n.md=i||e.md.sha1.create();var l=a[n.md.algorithm+"WithRSAEncryption"];if(!l){var s=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw s.algorithm=n.md.algorithm,s}n.signatureOid=n.siginfo.algorithmOid=l,n.certificationRequestInfo=r.getCertificationRequestInfo(n);var c=t.toDer(n.certificationRequestInfo);n.md.update(c.getBytes()),n.signature=o.sign(n.md)},n.verify=function(){var e=!1,a=n.md;if(null===a){a=d({signatureOid:n.signatureOid,type:"certification request"});var o=n.certificationRequestInfo||r.getCertificationRequestInfo(n),i=t.toDer(o);a.update(i.getBytes())}return null!==a&&(e=p({certificate:n,md:a,signature:n.signature})),e},n};var y=new Date("1950-01-01T00:00:00Z"),_=new Date("2050-01-01T00:00:00Z");function w(e){return e>=y&&e<_?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(e)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(e))}return r.getTBSCertificate=function(a){var n=w(a.validity.notBefore),o=w(a.validity.notAfter),i=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(a.version).getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(a.serialNumber)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.siginfo.algorithmOid).getBytes()),m(a.siginfo.algorithmOid,a.siginfo.parameters)]),f(a.issuer),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,o]),f(a.subject),r.publicKeyToAsn1(a.publicKey)]);return a.issuer.uniqueId&&i.value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+a.issuer.uniqueId)])),a.subject.uniqueId&&i.value.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+a.subject.uniqueId)])),a.extensions.length>0&&i.value.push(r.certificateExtensionsToAsn1(a.extensions)),i},r.getCertificationRequestInfo=function(e){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),f(e.subject),r.publicKeyToAsn1(e.publicKey),b(e)])},r.distinguishedNameToAsn1=function(e){return f(e)},r.certificateToAsn1=function(e){var a=e.tbsCertificate||r.getTBSCertificate(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[a,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.certificateExtensionsToAsn1=function(e){var a=t.create(t.Class.CONTEXT_SPECIFIC,3,!0,[]),n=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);a.value.push(n);for(var o=0;o<e.length;++o)n.value.push(r.certificateExtensionToAsn1(e[o]));return a},r.certificateExtensionToAsn1=function(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.id).getBytes())),e.critical&&r.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255)));var a=e.value;return"string"!=typeof e.value&&(a=t.toDer(a).getBytes()),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,a)),r},r.certificationRequestToAsn1=function(e){var a=e.certificationRequestInfo||r.getCertificationRequestInfo(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[a,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.createCaStore=function(a){var n={certs:{}};function o(e){return i(e),n.certs[e.hash]||null}function i(t){if(!t.hash){var a=e.md.sha1.create();t.attributes=r.RDNAttributesAsArray(f(t),a),t.hash=a.digest().toHex()}}if(n.getIssuer=function(e){return o(e.issuer)},n.addCertificate=function(t){if("string"==typeof t&&(t=e.pki.certificateFromPem(t)),i(t.subject),!n.hasCertificate(t))if(t.subject.hash in n.certs){var r=n.certs[t.subject.hash];e.util.isArray(r)||(r=[r]),r.push(t),n.certs[t.subject.hash]=r}else n.certs[t.subject.hash]=t},n.hasCertificate=function(a){"string"==typeof a&&(a=e.pki.certificateFromPem(a));var n=o(a.subject);if(!n)return!1;e.util.isArray(n)||(n=[n]);for(var i=t.toDer(r.certificateToAsn1(a)).getBytes(),l=0;l<n.length;++l){if(i===t.toDer(r.certificateToAsn1(n[l])).getBytes())return!0}return!1},n.listAllCertificates=function(){var t=[];for(var r in n.certs)if(n.certs.hasOwnProperty(r)){var a=n.certs[r];if(e.util.isArray(a))for(var o=0;o<a.length;++o)t.push(a[o]);else t.push(a)}return t},n.removeCertificate=function(a){var l;if("string"==typeof a&&(a=e.pki.certificateFromPem(a)),i(a.subject),!n.hasCertificate(a))return null;var s=o(a.subject);if(!e.util.isArray(s))return l=n.certs[a.subject.hash],delete n.certs[a.subject.hash],l;for(var c=t.toDer(r.certificateToAsn1(a)).getBytes(),u=0;u<s.length;++u){c===t.toDer(r.certificateToAsn1(s[u])).getBytes()&&(l=s[u],s.splice(u,1))}return 0===s.length&&delete n.certs[a.subject.hash],l},a)for(var l=0;l<a.length;++l){var s=a[l];n.addCertificate(s)}return n},r.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},r.verifyCertificateChain=function(t,a,n){"function"==typeof n&&(n={verify:n}),n=n||{};var o=(a=a.slice(0)).slice(0),i=n.validityCheckDate;void 0===i&&(i=new Date);var l=!0,s=null,c=0;do{var u=a.shift(),v=null,d=!1;if(i&&(i<u.validity.notBefore||i>u.validity.notAfter)&&(s={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:i}),null===s){if(null===(v=a[0]||t.getIssuer(u))&&u.isIssuer(u)&&(d=!0,v=u),v){var p=v;e.util.isArray(p)||(p=[p]);for(var f=!1;!f&&p.length>0;){v=p.shift();try{f=v.verify(u)}catch(C){}}f||(s={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}null!==s||v&&!d||t.hasCertificate(u)||(s={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}if(null===s&&v&&!u.isIssuer(v)&&(s={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate}),null===s)for(var h={keyUsage:!0,basicConstraints:!0},g=0;null===s&&g<u.extensions.length;++g){var m=u.extensions[g];m.critical&&!(m.name in h)&&(s={message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}if(null===s&&(!l||0===a.length&&(!v||d))){var b=u.getExtension("basicConstraints"),y=u.getExtension("keyUsage");if(null!==y&&(y.keyCertSign&&null!==b||(s={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:r.certificateError.bad_certificate})),null!==s||null===b||b.cA||(s={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),null===s&&null!==y&&"pathLenConstraint"in b)c-1>b.pathLenConstraint&&(s={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate})}var _=null===s||s.error,w=n.verify?n.verify(_,c,o):_;if(!0!==w)throw!0===_&&(s={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate}),(w||0===w)&&("object"!=typeof w||e.util.isArray(w)?"string"==typeof w&&(s.error=w):(w.message&&(s.message=w.message),w.error&&(s.error=w.error))),s;s=null,l=!1,++c}while(a.length>0);return!0},pi.exports}function ki(){if(bi)return li.exports;bi=1;var e=jn();so(),ho(),lo(),ci(),oi(),qo(),ni(),Yo(),Wn(),Si();var t=e.asn1,r=e.pki,a=li.exports=e.pkcs12=e.pkcs12||{},n={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},o={name:"PFX",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},n,{name:"PFX.macData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},i={name:"SafeBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},l={name:"Attribute",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,capture:"values"}]},s={name:"CertBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:t.Class.UNIVERSAL,type:t.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function c(e,t,r,a){for(var n=[],o=0;o<e.length;o++)for(var i=0;i<e[o].safeBags.length;i++){var l=e[o].safeBags[i];void 0!==a&&l.type!==a||(null!==t?void 0!==l.attributes[t]&&l.attributes[t].indexOf(r)>=0&&n.push(l):n.push(l))}return n}function u(t){if(t.composed||t.constructed){for(var r=e.util.createBuffer(),a=0;a<t.value.length;++a)r.putBytes(t.value[a].value);t.composed=t.constructed=!1,t.value=r.getBytes()}return t}function v(a,n){var o={},i=[];if(!t.validate(a,e.pkcs7.asn1.encryptedDataValidator,o,i))throw(l=new Error("Cannot read EncryptedContentInfo.")).errors=i,l;var l,s=t.derToOid(o.contentType);if(s!==r.oids.data)throw(l=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.")).oid=s,l;s=t.derToOid(o.encAlgorithm);var c=r.pbe.getCipher(s,o.encParameter,n),v=u(o.encryptedContentAsn1),d=e.util.createBuffer(v.value);if(c.update(d),!c.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return c.output.getBytes()}function d(e,a,n){if(!a&&0===e.length)return[];if((e=t.fromDer(e,a)).tagClass!==t.Class.UNIVERSAL||e.type!==t.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var o=[],l=0;l<e.value.length;l++){var c=e.value[l],u={},v=[];if(!t.validate(c,i,u,v))throw(m=new Error("Cannot read SafeBag.")).errors=v,m;var d,f,h={type:t.derToOid(u.bagId),attributes:p(u.bagAttributes)};o.push(h);var g=u.bagValue.value[0];switch(h.type){case r.oids.pkcs8ShroudedKeyBag:if(null===(g=r.decryptPrivateKeyInfo(g,n)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case r.oids.keyBag:try{h.key=r.privateKeyFromAsn1(g)}catch(b){h.key=null,h.asn1=g}continue;case r.oids.certBag:d=s,f=function(){if(t.derToOid(u.certId)!==r.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=t.derToOid(u.certId),e}var n=t.fromDer(u.cert,a);try{h.cert=r.certificateFromAsn1(n,!0)}catch(b){h.cert=null,h.asn1=n}};break;default:var m;throw(m=new Error("Unsupported PKCS#12 SafeBag type.")).oid=h.type,m}if(void 0!==d&&!t.validate(g,d,u,v))throw(m=new Error("Cannot read PKCS#12 "+d.name)).errors=v,m;f()}return o}function p(e){var a={};if(void 0!==e)for(var n=0;n<e.length;++n){var o={},i=[];if(!t.validate(e[n],l,o,i)){var s=new Error("Cannot read PKCS#12 BagAttribute.");throw s.errors=i,s}var c=t.derToOid(o.oid);if(void 0!==r.oids[c]){a[r.oids[c]]=[];for(var u=0;u<o.values.length;++u)a[r.oids[c]].push(o.values[u].value)}}return a}return a.pkcs12FromAsn1=function(i,l,s){"string"==typeof l?(s=l,l=!0):void 0===l&&(l=!0);var p={};if(!t.validate(i,o,p,[]))throw(f=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.")).errors=f,f;var f,h={version:p.version.charCodeAt(0),safeContents:[],getBags:function(t){var r,a={};return"localKeyId"in t?r=t.localKeyId:"localKeyIdHex"in t&&(r=e.util.hexToBytes(t.localKeyIdHex)),void 0===r&&!("friendlyName"in t)&&"bagType"in t&&(a[t.bagType]=c(h.safeContents,null,null,t.bagType)),void 0!==r&&(a.localKeyId=c(h.safeContents,"localKeyId",r,t.bagType)),"friendlyName"in t&&(a.friendlyName=c(h.safeContents,"friendlyName",t.friendlyName,t.bagType)),a},getBagsByFriendlyName:function(e,t){return c(h.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return c(h.safeContents,"localKeyId",e,t)}};if(3!==p.version.charCodeAt(0))throw(f=new Error("PKCS#12 PFX of version other than 3 not supported.")).version=p.version.charCodeAt(0),f;if(t.derToOid(p.contentType)!==r.oids.data)throw(f=new Error("Only PKCS#12 PFX in password integrity mode supported.")).oid=t.derToOid(p.contentType),f;var g=p.content.value[0];if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(g=u(g),p.mac){var m=null,b=0,y=t.derToOid(p.macAlgorithm);switch(y){case r.oids.sha1:m=e.md.sha1.create(),b=20;break;case r.oids.sha256:m=e.md.sha256.create(),b=32;break;case r.oids.sha384:m=e.md.sha384.create(),b=48;break;case r.oids.sha512:m=e.md.sha512.create(),b=64;break;case r.oids.md5:m=e.md.md5.create(),b=16}if(null===m)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+y);var _=new e.util.ByteBuffer(p.macSalt),w="macIterations"in p?parseInt(e.util.bytesToHex(p.macIterations),16):1,C=a.generateKey(s,_,3,w,b,m),x=e.hmac.create();if(x.start(m,C),x.update(g.value),x.getMac().getBytes()!==p.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return function(e,a,o,i){if(a=t.fromDer(a,o),a.tagClass!==t.Class.UNIVERSAL||a.type!==t.Type.SEQUENCE||!0!==a.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var l=0;l<a.value.length;l++){var s=a.value[l],c={},p=[];if(!t.validate(s,n,c,p))throw(m=new Error("Cannot read ContentInfo.")).errors=p,m;var f={encrypted:!1},h=null,g=c.content.value[0];switch(t.derToOid(c.contentType)){case r.oids.data:if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");h=u(g).value;break;case r.oids.encryptedData:h=v(g,i),f.encrypted=!0;break;default:var m;throw(m=new Error("Unsupported PKCS#12 contentType.")).contentType=t.derToOid(c.contentType),m}f.safeBags=d(h,o,i),e.safeContents.push(f)}}(h,g.value,l,s),h},a.toPkcs12Asn1=function(n,o,i,l){(l=l||{}).saltSize=l.saltSize||8,l.count=l.count||2048,l.algorithm=l.algorithm||l.encAlgorithm||"aes128","useMac"in l||(l.useMac=!0),"localKeyId"in l||(l.localKeyId=null),"generateLocalKeyId"in l||(l.generateLocalKeyId=!0);var s,c=l.localKeyId;if(null!==c)c=e.util.hexToBytes(c);else if(l.generateLocalKeyId)if(o){var u=e.util.isArray(o)?o[0]:o;"string"==typeof u&&(u=r.certificateFromPem(u)),(T=e.md.sha1.create()).update(t.toDer(r.certificateToAsn1(u)).getBytes()),c=T.digest().getBytes()}else c=e.random.getBytes(20);var v=[];null!==c&&v.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.localKeyId).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,c)])])),"friendlyName"in l&&v.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.friendlyName).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.BMPSTRING,!1,l.friendlyName)])])),v.length>0&&(s=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,v));var d=[],p=[];null!==o&&(p=e.util.isArray(o)?o:[o]);for(var f=[],h=0;h<p.length;++h){"string"==typeof(o=p[h])&&(o=r.certificateFromPem(o));var g=0===h?s:void 0,m=r.certificateToAsn1(o),b=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.certBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.x509Certificate).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(m).getBytes())])])]),g]);f.push(b)}if(f.length>0){var y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,f),_=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(y).getBytes())])]);d.push(_)}var w=null;if(null!==n){var C=r.wrapRsaPrivateKey(r.privateKeyToAsn1(n));w=null===i?t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.keyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[C]),s]):t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.pkcs8ShroudedKeyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[r.encryptPrivateKeyInfo(C,i,l)]),s]);var x=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[w]),E=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(x).getBytes())])]);d.push(E)}var S,k=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,d);if(l.useMac){var T=e.md.sha1.create(),A=new e.util.ByteBuffer(e.random.getBytes(l.saltSize)),I=l.count,B=(n=a.generateKey(i,A,3,I,20),e.hmac.create());B.start(T,n),B.update(t.toDer(k).getBytes());var N=B.getMac();S=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.sha1).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,N.getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,A.getBytes()),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(I).getBytes())])}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(3).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(k).getBytes())])]),S])},a.generateKey=e.pbe.generatePkcs12Key,li.exports}function Ti(){if(yi)return Eo.exports;yi=1;var e=jn();so(),lo(),oi(),wo(),Io(),ki(),Ei(),ni(),Wn(),Si();var t=e.asn1,r=Eo.exports=e.pki=e.pki||{};return r.pemToDer=function(t){var r=e.pem.decode(t)[0];if(r.procType&&"ENCRYPTED"===r.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return e.util.createBuffer(r.body)},r.privateKeyFromPem=function(a){var n=e.pem.decode(a)[0];if("PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type){var o=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var i=t.fromDer(n.body);return r.privateKeyFromAsn1(i)},r.privateKeyToPem=function(a,n){var o={type:"RSA PRIVATE KEY",body:t.toDer(r.privateKeyToAsn1(a)).getBytes()};return e.pem.encode(o,{maxline:n})},r.privateKeyInfoToPem=function(r,a){var n={type:"PRIVATE KEY",body:t.toDer(r).getBytes()};return e.pem.encode(n,{maxline:a})},Eo.exports}function Ai(){if(wi)return _i;wi=1;var e=jn();so(),ho(),bo(),wo(),Ti(),qo(),Yo(),Wn();var t=function(t,r,a,n){var o=e.util.createBuffer(),i=t.length>>1,l=i+(1&t.length),s=t.substr(0,l),c=t.substr(i,l),u=e.util.createBuffer(),v=e.hmac.create();a=r+a;var d=Math.ceil(n/16),p=Math.ceil(n/20);v.start("MD5",s);var f=e.util.createBuffer();u.putBytes(a);for(var h=0;h<d;++h)v.start(null,null),v.update(u.getBytes()),u.putBuffer(v.digest()),v.start(null,null),v.update(u.bytes()+a),f.putBuffer(v.digest());v.start("SHA1",c);var g=e.util.createBuffer();u.clear(),u.putBytes(a);for(h=0;h<p;++h)v.start(null,null),v.update(u.getBytes()),u.putBuffer(v.digest()),v.start(null,null),v.update(u.bytes()+a),g.putBuffer(v.digest());return o.putBytes(e.util.xorBytes(f.getBytes(),g.getBytes(),n)),o},r=function(t,r,a){var n=!1;try{var o=t.deflate(r.fragment.getBytes());r.fragment=e.util.createBuffer(o),r.length=o.length,n=!0}catch(i){}return n},a=function(t,r,a){var n=!1;try{var o=t.inflate(r.fragment.getBytes());r.fragment=e.util.createBuffer(o),r.length=o.length,n=!0}catch(i){}return n},n=function(t,r){var a=0;switch(r){case 1:a=t.getByte();break;case 2:a=t.getInt16();break;case 3:a=t.getInt24();break;case 4:a=t.getInt32()}return e.util.createBuffer(t.getBytes(a))},o=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},i={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};i.SupportedVersions=[i.Versions.TLS_1_1,i.Versions.TLS_1_0],i.Version=i.SupportedVersions[0],i.MaxFragment=15360,i.ConnectionEnd={server:0,client:1},i.PRFAlgorithm={tls_prf_sha256:0},i.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},i.CipherType={stream:0,block:1,aead:2},i.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},i.CompressionMethod={none:0,deflate:1},i.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},i.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},i.Alert={},i.Alert.Level={warning:1,fatal:2},i.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},i.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},i.CipherSuites={},i.getCipherSuite=function(e){var t=null;for(var r in i.CipherSuites){var a=i.CipherSuites[r];if(a.id[0]===e.charCodeAt(0)&&a.id[1]===e.charCodeAt(1)){t=a;break}}return t},i.handleUnexpected=function(e,t){!e.open&&e.entity===i.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unexpected_message}})},i.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(i.queue(e,i.createAlert(e,{level:i.Alert.Level.warning,description:i.Alert.Description.no_renegotiation})),i.flush(e)),e.process()},i.parseHelloMessage=function(t,r,a){var o=null,l=t.entity===i.ConnectionEnd.client;if(a<38)t.error(t,{message:l?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});else{var s=r.fragment,c=s.length();if(o={version:{major:s.getByte(),minor:s.getByte()},random:e.util.createBuffer(s.getBytes(32)),session_id:n(s,1),extensions:[]},l?(o.cipher_suite=s.getBytes(2),o.compression_method=s.getByte()):(o.cipher_suites=n(s,2),o.compression_methods=n(s,1)),(c=a-(c-s.length()))>0){for(var u=n(s,2);u.length()>0;)o.extensions.push({type:[u.getByte(),u.getByte()],data:n(u,2)});if(!l)for(var v=0;v<o.extensions.length;++v){var d=o.extensions[v];if(0===d.type[0]&&0===d.type[1])for(var p=n(d.data,2);p.length()>0;){if(0!==p.getByte())break;t.session.extensions.server_name.serverNameList.push(n(p,2).getBytes())}}}if(t.session.version&&(o.version.major!==t.session.version.major||o.version.minor!==t.session.version.minor))return t.error(t,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}});if(l)t.session.cipherSuite=i.getCipherSuite(o.cipher_suite);else for(var f=e.util.createBuffer(o.cipher_suites.bytes());f.length()>0&&(t.session.cipherSuite=i.getCipherSuite(f.getBytes(2)),null===t.session.cipherSuite););if(null===t.session.cipherSuite)return t.error(t,{message:"No cipher suites in common.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.handshake_failure},cipherSuite:e.util.bytesToHex(o.cipher_suite)});t.session.compressionMethod=l?o.compression_method:i.CompressionMethod.none}return o},i.createSecurityParameters=function(e,t){var r=e.entity===i.ConnectionEnd.client,a=t.random.bytes(),n=r?e.session.sp.client_random:a,o=r?a:i.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:i.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:n,server_random:o}},i.handleServerHello=function(e,t,r){var a=i.parseHelloMessage(e,t,r);if(!e.fail){if(!(a.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}});e.version.minor=a.version.minor,e.session.version=e.version;var n=a.session_id.bytes();n.length>0&&n===e.session.id?(e.expect=v,e.session.resuming=!0,e.session.sp.server_random=a.random.bytes()):(e.expect=l,e.session.resuming=!1,i.createSecurityParameters(e,a)),e.session.id=n,e.process()}},i.handleClientHello=function(t,r,a){var n=i.parseHelloMessage(t,r,a);if(!t.fail){var o=n.session_id.bytes(),l=null;if(t.sessionCache&&(null===(l=t.sessionCache.getSession(o))?o="":(l.version.major!==n.version.major||l.version.minor>n.version.minor)&&(l=null,o="")),0===o.length&&(o=e.random.getBytes(32)),t.session.id=o,t.session.clientHelloVersion=n.version,t.session.sp={},l)t.version=t.session.version=l.version,t.session.sp=l.sp;else{for(var s,c=1;c<i.SupportedVersions.length&&!((s=i.SupportedVersions[c]).minor<=n.version.minor);++c);t.version={major:s.major,minor:s.minor},t.session.version=t.version}null!==l?(t.expect=b,t.session.resuming=!0,t.session.sp.client_random=n.random.bytes()):(t.expect=!1!==t.verifyClient?h:g,t.session.resuming=!1,i.createSecurityParameters(t,n)),t.open=!0,i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createServerHello(t)})),t.session.resuming?(i.queue(t,i.createRecord(t,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),t.state.pending=i.createConnectionState(t),t.state.current.write=t.state.pending.write,i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createFinished(t)}))):(i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createCertificate(t)})),t.fail||(i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createServerKeyExchange(t)})),!1!==t.verifyClient&&i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createCertificateRequest(t)})),i.queue(t,i.createRecord(t,{type:i.ContentType.handshake,data:i.createServerHelloDone(t)})))),i.flush(t),t.process()}},i.handleCertificate=function(t,r,a){if(a<3)return t.error(t,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var o,l,c=r.fragment,u={certificate_list:n(c,3)},v=[];try{for(;u.certificate_list.length()>0;)o=n(u.certificate_list,3),l=e.asn1.fromDer(o),o=e.pki.certificateFromAsn1(l,!0),v.push(o)}catch(p){return t.error(t,{message:"Could not parse certificate list.",cause:p,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate}})}var d=t.entity===i.ConnectionEnd.client;!d&&!0!==t.verifyClient||0!==v.length?0===v.length?t.expect=d?s:g:(d?t.session.serverCertificate=v[0]:t.session.clientCertificate=v[0],i.verifyCertificateChain(t,v)&&(t.expect=d?s:g)):t.error(t,{message:d?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}}),t.process()},i.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unsupported_certificate}});e.expect=c,e.process()},i.handleClientKeyExchange=function(t,r,a){if(a<48)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unsupported_certificate}});var o=r.fragment,l={enc_pre_master_secret:n(o,2).getBytes()},s=null;if(t.getPrivateKey)try{s=t.getPrivateKey(t,t.session.serverCertificate),s=e.pki.privateKeyFromPem(s)}catch(v){t.error(t,{message:"Could not get private key.",cause:v,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}})}if(null===s)return t.error(t,{message:"No private key set.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}});try{var c=t.session.sp;c.pre_master_secret=s.decrypt(l.enc_pre_master_secret);var u=t.session.clientHelloVersion;if(u.major!==c.pre_master_secret.charCodeAt(0)||u.minor!==c.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(v){c.pre_master_secret=e.random.getBytes(48)}t.expect=b,null!==t.session.clientCertificate&&(t.expect=m),t.process()},i.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var a=t.fragment,o={certificate_types:n(a,1),certificate_authorities:n(a,2)};e.session.certificateRequest=o,e.expect=u,e.process()},i.handleCertificateVerify=function(t,r,a){if(a<2)return t.error(t,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var o=r.fragment;o.read-=4;var l=o.bytes();o.read+=4;var s={signature:n(o,2).getBytes()},c=e.util.createBuffer();c.putBuffer(t.session.md5.digest()),c.putBuffer(t.session.sha1.digest()),c=c.getBytes();try{if(!t.session.clientCertificate.publicKey.verify(c,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");t.session.md5.update(l),t.session.sha1.update(l)}catch(u){return t.error(t,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.handshake_failure}})}t.expect=b,t.process()},i.handleServerHelloDone=function(t,r,a){if(a>0)return t.error(t,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.record_overflow}});if(null===t.serverCertificate){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.insufficient_security}},o=t.verify(t,n.alert.description,0,[]);if(!0!==o)return(o||0===o)&&("object"!=typeof o||e.util.isArray(o)?"number"==typeof o&&(n.alert.description=o):(o.message&&(n.message=o.message),o.alert&&(n.alert.description=o.alert))),t.error(t,n)}null!==t.session.certificateRequest&&(r=i.createRecord(t,{type:i.ContentType.handshake,data:i.createCertificate(t)}),i.queue(t,r)),r=i.createRecord(t,{type:i.ContentType.handshake,data:i.createClientKeyExchange(t)}),i.queue(t,r),t.expect=f;var l=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&i.queue(e,i.createRecord(e,{type:i.ContentType.handshake,data:i.createCertificateVerify(e,t)})),i.queue(e,i.createRecord(e,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),e.state.pending=i.createConnectionState(e),e.state.current.write=e.state.pending.write,i.queue(e,i.createRecord(e,{type:i.ContentType.handshake,data:i.createFinished(e)})),e.expect=v,i.flush(e),e.process()};if(null===t.session.certificateRequest||null===t.session.clientCertificate)return l(t,null);i.getClientSignature(t,l)},i.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.illegal_parameter}});var r=e.entity===i.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=i.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?d:y,e.process()},i.handleFinished=function(r,a,n){var o=a.fragment;o.read-=4;var l=o.bytes();o.read+=4;var s=a.fragment.getBytes();(o=e.util.createBuffer()).putBuffer(r.session.md5.digest()),o.putBuffer(r.session.sha1.digest());var c=r.entity===i.ConnectionEnd.client,u=c?"server finished":"client finished",v=r.session.sp;if((o=t(v.master_secret,u,o.getBytes(),12)).getBytes()!==s)return r.error(r,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.decrypt_error}});r.session.md5.update(l),r.session.sha1.update(l),(r.session.resuming&&c||!r.session.resuming&&!c)&&(i.queue(r,i.createRecord(r,{type:i.ContentType.change_cipher_spec,data:i.createChangeCipherSpec()})),r.state.current.write=r.state.pending.write,r.state.pending=null,i.queue(r,i.createRecord(r,{type:i.ContentType.handshake,data:i.createFinished(r)}))),r.expect=c?p:_,r.handshaking=!1,++r.handshakes,r.peerCertificate=c?r.session.serverCertificate:r.session.clientCertificate,i.flush(r),r.isConnected=!0,r.connected(r),r.process()},i.handleAlert=function(e,t){var r,a=t.fragment,n={level:a.getByte(),description:a.getByte()};switch(n.description){case i.Alert.Description.close_notify:r="Connection closed.";break;case i.Alert.Description.unexpected_message:r="Unexpected message.";break;case i.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case i.Alert.Description.decryption_failed:r="Decryption failed.";break;case i.Alert.Description.record_overflow:r="Record overflow.";break;case i.Alert.Description.decompression_failure:r="Decompression failed.";break;case i.Alert.Description.handshake_failure:r="Handshake failure.";break;case i.Alert.Description.bad_certificate:r="Bad certificate.";break;case i.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case i.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case i.Alert.Description.certificate_expired:r="Certificate expired.";break;case i.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case i.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case i.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case i.Alert.Description.access_denied:r="Access denied.";break;case i.Alert.Description.decode_error:r="Decode error.";break;case i.Alert.Description.decrypt_error:r="Decrypt error.";break;case i.Alert.Description.export_restriction:r="Export restriction.";break;case i.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case i.Alert.Description.insufficient_security:r="Insufficient security.";break;case i.Alert.Description.internal_error:r="Internal error.";break;case i.Alert.Description.user_canceled:r="User canceled.";break;case i.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(n.description===i.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===i.ConnectionEnd.client?"server":"client",alert:n}),e.process()},i.handleHandshake=function(t,r){var a=r.fragment,n=a.getByte(),o=a.getInt24();if(o>a.length())return t.fragmented=r,r.fragment=e.util.createBuffer(),a.read-=4,t.process();t.fragmented=null,a.read-=4;var l=a.bytes(o+4);a.read+=4,n in D[t.entity][t.expect]?(t.entity!==i.ConnectionEnd.server||t.open||t.fail||(t.handshaking=!0,t.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:e.md.md5.create(),sha1:e.md.sha1.create()}),n!==i.HandshakeType.hello_request&&n!==i.HandshakeType.certificate_verify&&n!==i.HandshakeType.finished&&(t.session.md5.update(l),t.session.sha1.update(l)),D[t.entity][t.expect][n](t,r,o)):i.handleUnexpected(t,r)},i.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},i.handleHeartbeat=function(t,r){var a=r.fragment,n=a.getByte(),o=a.getInt16(),l=a.getBytes(o);if(n===i.HeartbeatMessageType.heartbeat_request){if(t.handshaking||o>l.length)return t.process();i.queue(t,i.createRecord(t,{type:i.ContentType.heartbeat,data:i.createHeartbeat(i.HeartbeatMessageType.heartbeat_response,l)})),i.flush(t)}else if(n===i.HeartbeatMessageType.heartbeat_response){if(l!==t.expectedHeartbeatPayload)return t.process();t.heartbeatReceived&&t.heartbeatReceived(t,e.util.createBuffer(l))}t.process()};var l=1,s=2,c=3,u=4,v=5,d=6,p=7,f=8,h=1,g=2,m=3,b=4,y=5,_=6,w=i.handleUnexpected,C=i.handleChangeCipherSpec,x=i.handleAlert,E=i.handleHandshake,S=i.handleApplicationData,k=i.handleHeartbeat,T=[];T[i.ConnectionEnd.client]=[[w,x,E,w,k],[w,x,E,w,k],[w,x,E,w,k],[w,x,E,w,k],[w,x,E,w,k],[C,x,w,w,k],[w,x,E,w,k],[w,x,E,S,k],[w,x,E,w,k]],T[i.ConnectionEnd.server]=[[w,x,E,w,k],[w,x,E,w,k],[w,x,E,w,k],[w,x,E,w,k],[C,x,w,w,k],[w,x,E,w,k],[w,x,E,S,k],[w,x,E,w,k]];var A=i.handleHelloRequest,I=i.handleServerHello,B=i.handleCertificate,N=i.handleServerKeyExchange,R=i.handleCertificateRequest,z=i.handleServerHelloDone,L=i.handleFinished,D=[];D[i.ConnectionEnd.client]=[[w,w,I,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[A,w,w,w,w,w,w,w,w,w,w,B,N,R,z,w,w,w,w,w,w],[A,w,w,w,w,w,w,w,w,w,w,w,N,R,z,w,w,w,w,w,w],[A,w,w,w,w,w,w,w,w,w,w,w,w,R,z,w,w,w,w,w,w],[A,w,w,w,w,w,w,w,w,w,w,w,w,w,z,w,w,w,w,w,w],[A,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[A,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,L],[A,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[A,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w]];var U=i.handleClientHello,P=i.handleClientKeyExchange,V=i.handleCertificateVerify;D[i.ConnectionEnd.server]=[[w,U,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,B,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,P,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,V,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,L],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w]],i.generateKeys=function(e,r){var a=t,n=r.client_random+r.server_random;e.session.resuming||(r.master_secret=a(r.pre_master_secret,"master secret",n,48).bytes(),r.pre_master_secret=null),n=r.server_random+r.client_random;var o=2*r.mac_key_length+2*r.enc_key_length,l=e.version.major===i.Versions.TLS_1_0.major&&e.version.minor===i.Versions.TLS_1_0.minor;l&&(o+=2*r.fixed_iv_length);var s=a(r.master_secret,"key expansion",n,o),c={client_write_MAC_key:s.getBytes(r.mac_key_length),server_write_MAC_key:s.getBytes(r.mac_key_length),client_write_key:s.getBytes(r.enc_key_length),server_write_key:s.getBytes(r.enc_key_length)};return l&&(c.client_write_IV=s.getBytes(r.fixed_iv_length),c.server_write_IV=s.getBytes(r.fixed_iv_length)),c},i.createConnectionState=function(e){var t=e.entity===i.ConnectionEnd.client,n=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},o={read:n(),write:n()};if(o.read.update=function(e,t){return o.read.cipherFunction(t,o.read)?o.read.compressFunction(e,t,o.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_record_mac}}),!e.fail},o.write.update=function(e,t){return o.write.compressFunction(e,t,o.write)?o.write.cipherFunction(t,o.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}}),!e.fail},e.session){var l=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(l),l.keys=i.generateKeys(e,l),o.read.macKey=t?l.keys.server_write_MAC_key:l.keys.client_write_MAC_key,o.write.macKey=t?l.keys.client_write_MAC_key:l.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(o,e,l),l.compression_algorithm){case i.CompressionMethod.none:break;case i.CompressionMethod.deflate:o.read.compressFunction=a,o.write.compressFunction=r;break;default:throw new Error("Unsupported compression algorithm.")}}return o},i.createRandom=function(){var t=new Date,r=+t+6e4*t.getTimezoneOffset(),a=e.util.createBuffer();return a.putInt32(r),a.putBytes(e.random.getBytes(28)),a},i.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},i.createAlert=function(t,r){var a=e.util.createBuffer();return a.putByte(r.level),a.putByte(r.description),i.createRecord(t,{type:i.ContentType.alert,data:a})},i.createClientHello=function(t){t.session.clientHelloVersion={major:t.version.major,minor:t.version.minor};for(var r=e.util.createBuffer(),a=0;a<t.cipherSuites.length;++a){var n=t.cipherSuites[a];r.putByte(n.id[0]),r.putByte(n.id[1])}var l=r.length(),s=e.util.createBuffer();s.putByte(i.CompressionMethod.none);var c=s.length(),u=e.util.createBuffer();if(t.virtualHost){var v=e.util.createBuffer();v.putByte(0),v.putByte(0);var d=e.util.createBuffer();d.putByte(0),o(d,2,e.util.createBuffer(t.virtualHost));var p=e.util.createBuffer();o(p,2,d),o(v,2,p),u.putBuffer(v)}var f=u.length();f>0&&(f+=2);var h=t.session.id,g=h.length+1+2+4+28+2+l+1+c+f,m=e.util.createBuffer();return m.putByte(i.HandshakeType.client_hello),m.putInt24(g),m.putByte(t.version.major),m.putByte(t.version.minor),m.putBytes(t.session.sp.client_random),o(m,1,e.util.createBuffer(h)),o(m,2,r),o(m,1,s),f>0&&o(m,2,u),m},i.createServerHello=function(t){var r=t.session.id,a=r.length+1+2+4+28+2+1,n=e.util.createBuffer();return n.putByte(i.HandshakeType.server_hello),n.putInt24(a),n.putByte(t.version.major),n.putByte(t.version.minor),n.putBytes(t.session.sp.server_random),o(n,1,e.util.createBuffer(r)),n.putByte(t.session.cipherSuite.id[0]),n.putByte(t.session.cipherSuite.id[1]),n.putByte(t.session.compressionMethod),n},i.createCertificate=function(t){var r,a=t.entity===i.ConnectionEnd.client,n=null;t.getCertificate&&(r=a?t.session.certificateRequest:t.session.extensions.server_name.serverNameList,n=t.getCertificate(t,r));var l=e.util.createBuffer();if(null!==n)try{e.util.isArray(n)||(n=[n]);for(var s=null,c=0;c<n.length;++c){var u=e.pem.decode(n[c])[0];if("CERTIFICATE"!==u.type&&"X509 CERTIFICATE"!==u.type&&"TRUSTED CERTIFICATE"!==u.type){var v=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw v.headerType=u.type,v}if(u.procType&&"ENCRYPTED"===u.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var d=e.util.createBuffer(u.body);null===s&&(s=e.asn1.fromDer(d.bytes(),!1));var p=e.util.createBuffer();o(p,3,d),l.putBuffer(p)}n=e.pki.certificateFromAsn1(s),a?t.session.clientCertificate=n:t.session.serverCertificate=n}catch(g){return t.error(t,{message:"Could not send certificate list.",cause:g,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate}})}var f=3+l.length(),h=e.util.createBuffer();return h.putByte(i.HandshakeType.certificate),h.putInt24(f),o(h,3,l),h},i.createClientKeyExchange=function(t){var r=e.util.createBuffer();r.putByte(t.session.clientHelloVersion.major),r.putByte(t.session.clientHelloVersion.minor),r.putBytes(e.random.getBytes(46));var a=t.session.sp;a.pre_master_secret=r.getBytes();var n=(r=t.session.serverCertificate.publicKey.encrypt(a.pre_master_secret)).length+2,o=e.util.createBuffer();return o.putByte(i.HandshakeType.client_key_exchange),o.putInt24(n),o.putInt16(r.length),o.putBytes(r),o},i.createServerKeyExchange=function(t){return e.util.createBuffer()},i.getClientSignature=function(t,r){var a=e.util.createBuffer();a.putBuffer(t.session.md5.digest()),a.putBuffer(t.session.sha1.digest()),a=a.getBytes(),t.getSignature=t.getSignature||function(t,r,a){var n=null;if(t.getPrivateKey)try{n=t.getPrivateKey(t,t.session.clientCertificate),n=e.pki.privateKeyFromPem(n)}catch(o){t.error(t,{message:"Could not get private key.",cause:o,send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}})}null===n?t.error(t,{message:"No private key set.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.internal_error}}):r=n.sign(r,null),a(t,r)},t.getSignature(t,a,r)},i.createCertificateVerify=function(t,r){var a=r.length+2,n=e.util.createBuffer();return n.putByte(i.HandshakeType.certificate_verify),n.putInt24(a),n.putInt16(r.length),n.putBytes(r),n},i.createCertificateRequest=function(t){var r=e.util.createBuffer();r.putByte(1);var a=e.util.createBuffer();for(var n in t.caStore.certs){var l=t.caStore.certs[n],s=e.pki.distinguishedNameToAsn1(l.subject),c=e.asn1.toDer(s);a.putInt16(c.length()),a.putBuffer(c)}var u=1+r.length()+2+a.length(),v=e.util.createBuffer();return v.putByte(i.HandshakeType.certificate_request),v.putInt24(u),o(v,1,r),o(v,2,a),v},i.createServerHelloDone=function(t){var r=e.util.createBuffer();return r.putByte(i.HandshakeType.server_hello_done),r.putInt24(0),r},i.createChangeCipherSpec=function(){var t=e.util.createBuffer();return t.putByte(1),t},i.createFinished=function(r){var a=e.util.createBuffer();a.putBuffer(r.session.md5.digest()),a.putBuffer(r.session.sha1.digest());var n=r.entity===i.ConnectionEnd.client,o=r.session.sp,l=n?"client finished":"server finished";a=t(o.master_secret,l,a.getBytes(),12);var s=e.util.createBuffer();return s.putByte(i.HandshakeType.finished),s.putInt24(a.length()),s.putBuffer(a),s},i.createHeartbeat=function(t,r,a){void 0===a&&(a=r.length);var n=e.util.createBuffer();n.putByte(t),n.putInt16(a),n.putBytes(r);var o=n.length(),i=Math.max(16,o-a-3);return n.putBytes(e.random.getBytes(i)),n},i.queue=function(t,r){if(r&&(0!==r.fragment.length()||r.type!==i.ContentType.handshake&&r.type!==i.ContentType.alert&&r.type!==i.ContentType.change_cipher_spec)){if(r.type===i.ContentType.handshake){var a=r.fragment.bytes();t.session.md5.update(a),t.session.sha1.update(a),a=null}var n;if(r.fragment.length()<=i.MaxFragment)n=[r];else{n=[];for(var o=r.fragment.bytes();o.length>i.MaxFragment;)n.push(i.createRecord(t,{type:r.type,data:e.util.createBuffer(o.slice(0,i.MaxFragment))})),o=o.slice(i.MaxFragment);o.length>0&&n.push(i.createRecord(t,{type:r.type,data:e.util.createBuffer(o)}))}for(var l=0;l<n.length&&!t.fail;++l){var s=n[l];t.state.current.write.update(t,s)&&t.records.push(s)}}},i.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var M=function(t){switch(t){case!0:return!0;case e.pki.certificateError.bad_certificate:return i.Alert.Description.bad_certificate;case e.pki.certificateError.unsupported_certificate:return i.Alert.Description.unsupported_certificate;case e.pki.certificateError.certificate_revoked:return i.Alert.Description.certificate_revoked;case e.pki.certificateError.certificate_expired:return i.Alert.Description.certificate_expired;case e.pki.certificateError.certificate_unknown:return i.Alert.Description.certificate_unknown;case e.pki.certificateError.unknown_ca:return i.Alert.Description.unknown_ca;default:return i.Alert.Description.bad_certificate}};for(var O in i.verifyCertificateChain=function(t,r){try{var a={};for(var n in t.verifyOptions)a[n]=t.verifyOptions[n];a.verify=function(r,a,n){M(r);var o=t.verify(t,r,a,n);if(!0!==o){if("object"==typeof o&&!e.util.isArray(o)){var l=new Error("The application rejected the certificate.");throw l.send=!0,l.alert={level:i.Alert.Level.fatal,description:i.Alert.Description.bad_certificate},o.message&&(l.message=o.message),o.alert&&(l.alert.description=o.alert),l}o!==r&&(o=function(t){switch(t){case!0:return!0;case i.Alert.Description.bad_certificate:return e.pki.certificateError.bad_certificate;case i.Alert.Description.unsupported_certificate:return e.pki.certificateError.unsupported_certificate;case i.Alert.Description.certificate_revoked:return e.pki.certificateError.certificate_revoked;case i.Alert.Description.certificate_expired:return e.pki.certificateError.certificate_expired;case i.Alert.Description.certificate_unknown:return e.pki.certificateError.certificate_unknown;case i.Alert.Description.unknown_ca:return e.pki.certificateError.unknown_ca;default:return e.pki.certificateError.bad_certificate}}(o))}return o},e.pki.verifyCertificateChain(t.caStore,r,a)}catch(l){var o=l;("object"!=typeof o||e.util.isArray(o))&&(o={send:!0,alert:{level:i.Alert.Level.fatal,description:M(l)}}),"send"in o||(o.send=!0),"alert"in o||(o.alert={level:i.Alert.Level.fatal,description:M(o.error)}),t.error(t,o)}return!t.fail},i.createSessionCache=function(t,r){var a=null;if(t&&t.getSession&&t.setSession&&t.order)a=t;else{for(var n in(a={}).cache=t||{},a.capacity=Math.max(r||100,1),a.order=[],t)a.order.length<=r?a.order.push(n):delete t[n];a.getSession=function(t){var r=null,n=null;if(t?n=e.util.bytesToHex(t):a.order.length>0&&(n=a.order[0]),null!==n&&n in a.cache)for(var o in r=a.cache[n],delete a.cache[n],a.order)if(a.order[o]===n){a.order.splice(o,1);break}return r},a.setSession=function(t,r){if(a.order.length===a.capacity){var n=a.order.shift();delete a.cache[n]}n=e.util.bytesToHex(t);a.order.push(n),a.cache[n]=r}}return a},i.createConnection=function(t){var r=null;r=t.caStore?e.util.isArray(t.caStore)?e.pki.createCaStore(t.caStore):t.caStore:e.pki.createCaStore();var a=t.cipherSuites||null;if(null===a)for(var n in a=[],i.CipherSuites)a.push(i.CipherSuites[n]);var o=t.server?i.ConnectionEnd.server:i.ConnectionEnd.client,l=t.sessionCache?i.createSessionCache(t.sessionCache):null,s={version:{major:i.Version.major,minor:i.Version.minor},entity:o,sessionId:t.sessionId,caStore:r,sessionCache:l,cipherSuites:a,connected:t.connected,virtualHost:t.virtualHost||null,verifyClient:t.verifyClient||!1,verify:t.verify||function(e,t,r,a){return t},verifyOptions:t.verifyOptions||{},getCertificate:t.getCertificate||null,getPrivateKey:t.getPrivateKey||null,getSignature:t.getSignature||null,input:e.util.createBuffer(),tlsData:e.util.createBuffer(),data:e.util.createBuffer(),tlsDataReady:t.tlsDataReady,dataReady:t.dataReady,heartbeatReceived:t.heartbeatReceived,closed:t.closed,error:function(e,r){r.origin=r.origin||(e.entity===i.ConnectionEnd.client?"client":"server"),r.send&&(i.queue(e,i.createAlert(e,r.alert)),i.flush(e));var a=!1!==r.fatal;a&&(e.fail=!0),t.error(e,r),a&&e.close(!1)},deflate:t.deflate||null,inflate:t.inflate||null,reset:function(e){s.version={major:i.Version.major,minor:i.Version.minor},s.record=null,s.session=null,s.peerCertificate=null,s.state={pending:null,current:null},s.expect=(s.entity,i.ConnectionEnd.client,0),s.fragmented=null,s.records=[],s.open=!1,s.handshakes=0,s.handshaking=!1,s.isConnected=!1,s.fail=!(e||void 0===e),s.input.clear(),s.tlsData.clear(),s.data.clear(),s.state.current=i.createConnectionState(s)}};s.reset();return s.handshake=function(t){if(s.entity!==i.ConnectionEnd.client)s.error(s,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(s.handshaking)s.error(s,{message:"Handshake already in progress.",fatal:!1});else{s.fail&&!s.open&&0===s.handshakes&&(s.fail=!1),s.handshaking=!0;var r=null;(t=t||"").length>0&&(s.sessionCache&&(r=s.sessionCache.getSession(t)),null===r&&(t="")),0===t.length&&s.sessionCache&&null!==(r=s.sessionCache.getSession())&&(t=r.id),s.session={id:t,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:e.md.md5.create(),sha1:e.md.sha1.create()},r&&(s.version=r.version,s.session.sp=r.sp),s.session.sp.client_random=i.createRandom().getBytes(),s.open=!0,i.queue(s,i.createRecord(s,{type:i.ContentType.handshake,data:i.createClientHello(s)})),i.flush(s)}},s.process=function(t){var r,a,n,o,l=0;return t&&s.input.putBytes(t),s.fail||(null!==s.record&&s.record.ready&&s.record.fragment.isEmpty()&&(s.record=null),null===s.record&&(l=function(t){var r=0,a=t.input,n=a.length();if(n<5)r=5-n;else{t.record={type:a.getByte(),version:{major:a.getByte(),minor:a.getByte()},length:a.getInt16(),fragment:e.util.createBuffer(),ready:!1};var o=t.record.version.major===t.version.major;o&&t.session&&t.session.version&&(o=t.record.version.minor===t.version.minor),o||t.error(t,{message:"Incompatible TLS version.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.protocol_version}})}return r}(s)),s.fail||null===s.record||s.record.ready||(l=function(e){var t=0,r=e.input,a=r.length();return a<e.record.length?t=e.record.length-a:(e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact(),e.state.current.read.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:i.Alert.Level.fatal,description:i.Alert.Description.unexpected_message}})),e.record.ready=!0)),t}(s)),!s.fail&&null!==s.record&&s.record.ready&&(r=s,a=s.record,n=a.type-i.ContentType.change_cipher_spec,o=T[r.entity][r.expect],n in o?o[n](r,a):i.handleUnexpected(r,a))),l},s.prepare=function(t){return i.queue(s,i.createRecord(s,{type:i.ContentType.application_data,data:e.util.createBuffer(t)})),i.flush(s)},s.prepareHeartbeatRequest=function(t,r){return t instanceof e.util.ByteBuffer&&(t=t.bytes()),void 0===r&&(r=t.length),s.expectedHeartbeatPayload=t,i.queue(s,i.createRecord(s,{type:i.ContentType.heartbeat,data:i.createHeartbeat(i.HeartbeatMessageType.heartbeat_request,t,r)})),i.flush(s)},s.close=function(e){if(!s.fail&&s.sessionCache&&s.session){var t={id:s.session.id,version:s.session.version,sp:s.session.sp};t.sp.keys=null,s.sessionCache.setSession(t.id,t)}s.open&&(s.open=!1,s.input.clear(),(s.isConnected||s.handshaking)&&(s.isConnected=s.handshaking=!1,i.queue(s,i.createAlert(s,{level:i.Alert.Level.warning,description:i.Alert.Description.close_notify})),i.flush(s)),s.closed(s)),s.reset(e)},s},_i=e.tls=e.tls||{},i)"function"!=typeof i[O]&&(e.tls[O]=i[O]);return e.tls.prf_tls1=t,e.tls.hmac_sha1=function(t,r,a){var n=e.hmac.create();n.start("SHA1",t);var o=e.util.createBuffer();return o.putInt32(r[0]),o.putInt32(r[1]),o.putByte(a.type),o.putByte(a.version.major),o.putByte(a.version.minor),o.putInt16(a.length),o.putBytes(a.fragment.bytes()),n.update(o.getBytes()),n.digest().getBytes()},e.tls.createSessionCache=i.createSessionCache,e.tls.createConnection=i.createConnection,_i}function Ii(){if(Ci)return no.exports;Ci=1;var e=jn();to(),Ai();var t=no.exports=e.tls;function r(r,n,o){var l=n.entity===e.tls.ConnectionEnd.client;r.read.cipherState={init:!1,cipher:e.cipher.createDecipher("AES-CBC",l?o.keys.server_write_key:o.keys.client_write_key),iv:l?o.keys.server_write_IV:o.keys.client_write_IV},r.write.cipherState={init:!1,cipher:e.cipher.createCipher("AES-CBC",l?o.keys.client_write_key:o.keys.server_write_key),iv:l?o.keys.client_write_IV:o.keys.server_write_IV},r.read.cipherFunction=i,r.write.cipherFunction=a,r.read.macLength=r.write.macLength=o.mac_length,r.read.macFunction=r.write.macFunction=t.hmac_sha1}function a(r,a){var o,i=!1,l=a.macFunction(a.macKey,a.sequenceNumber,r);r.fragment.putBytes(l),a.updateSequenceNumber(),o=r.version.minor===t.Versions.TLS_1_0.minor?a.cipherState.init?null:a.cipherState.iv:e.random.getBytesSync(16),a.cipherState.init=!0;var s=a.cipherState.cipher;return s.start({iv:o}),r.version.minor>=t.Versions.TLS_1_1.minor&&s.output.putBytes(o),s.update(r.fragment),s.finish(n)&&(r.fragment=s.output,r.length=r.fragment.length(),i=!0),i}function n(e,t,r){if(!r){var a=e-t.length()%e;t.fillWithByte(a-1,a)}return!0}function o(e,t,r){var a=!0;if(r){for(var n=t.length(),o=t.last(),i=n-1-o;i<n-1;++i)a=a&&t.at(i)==o;a&&t.truncate(o+1)}return a}function i(r,a){var n,i=!1;n=r.version.minor===t.Versions.TLS_1_0.minor?a.cipherState.init?null:a.cipherState.iv:r.fragment.getBytes(16),a.cipherState.init=!0;var l=a.cipherState.cipher;l.start({iv:n}),l.update(r.fragment),i=l.finish(o);var s=a.macLength,c=e.random.getBytesSync(s),u=l.output.length();u>=s?(r.fragment=l.output.getBytes(u-s),c=l.output.getBytes(s)):r.fragment=l.output.getBytes(),r.fragment=e.util.createBuffer(r.fragment),r.length=r.fragment.length();var v=a.macFunction(a.macKey,a.sequenceNumber,r);return a.updateSequenceNumber(),i=function(t,r,a){var n=e.hmac.create();return n.start("SHA1",t),n.update(r),r=n.digest().getBytes(),n.start(null,null),n.update(a),a=n.digest().getBytes(),r===a}(a.macKey,c,v)&&i,i}return t.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},t.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},no.exports}var Bi,Ni={exports:{}};function Ri(){if(Bi)return Ni.exports;Bi=1;var e=jn();fo(),Wn();var t=Ni.exports=e.sha512=e.sha512||{};e.md.sha512=e.md.algorithms.sha512=t;var r=e.sha384=e.sha512.sha384=e.sha512.sha384||{};r.create=function(){return t.create("SHA-384")},e.md.sha384=e.md.algorithms.sha384=r,e.sha512.sha256=e.sha512.sha256||{create:function(){return t.create("SHA-512/256")}},e.md["sha512/256"]=e.md.algorithms["sha512/256"]=e.sha512.sha256,e.sha512.sha224=e.sha512.sha224||{create:function(){return t.create("SHA-512/224")}},e.md["sha512/224"]=e.md.algorithms["sha512/224"]=e.sha512.sha224,t.create=function(t){if(n||(a=String.fromCharCode(128),a+=e.util.fillString(String.fromCharCode(0),128),o=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(i={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],i["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],i["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],i["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],n=!0),void 0===t&&(t="SHA-512"),!(t in i))throw new Error("Invalid SHA-512 algorithm: "+t);for(var r=i[t],s=null,c=e.util.createBuffer(),u=new Array(80),v=0;v<80;++v)u[v]=new Array(2);var d=64;switch(t){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var p={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){p.messageLength=0,p.fullMessageLength=p.messageLength128=[];for(var t=p.messageLengthSize/4,a=0;a<t;++a)p.fullMessageLength.push(0);c=e.util.createBuffer(),s=new Array(r.length);for(a=0;a<r.length;++a)s[a]=r[a].slice(0);return p}};return p.start(),p.update=function(t,r){"utf8"===r&&(t=e.util.encodeUtf8(t));var a=t.length;p.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var n=p.fullMessageLength.length-1;n>=0;--n)p.fullMessageLength[n]+=a[1],a[1]=a[0]+(p.fullMessageLength[n]/4294967296>>>0),p.fullMessageLength[n]=p.fullMessageLength[n]>>>0,a[0]=a[1]/4294967296>>>0;return c.putBytes(t),l(s,u,c),(c.read>2048||0===c.length())&&c.compact(),p},p.digest=function(){var r=e.util.createBuffer();r.putBytes(c.bytes());var n,o=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize&p.blockLength-1;r.putBytes(a.substr(0,p.blockLength-o));for(var i=8*p.fullMessageLength[0],v=0;v<p.fullMessageLength.length-1;++v)i+=(n=8*p.fullMessageLength[v+1])/4294967296>>>0,r.putInt32(i>>>0),i=n>>>0;r.putInt32(i);var d=new Array(s.length);for(v=0;v<s.length;++v)d[v]=s[v].slice(0);l(d,u,r);var f,h=e.util.createBuffer();f="SHA-512"===t?d.length:"SHA-384"===t?d.length-2:d.length-4;for(v=0;v<f;++v)h.putInt32(d[v][0]),v===f-1&&"SHA-512/224"===t||h.putInt32(d[v][1]);return h},p};var a=null,n=!1,o=null,i=null;function l(e,t,r){for(var a,n,i,l,s,c,u,v,d,p,f,h,g,m,b,y,_,w,C,x,E,S,k,T,A,I,B,N,R,z,L,D,U,P=r.length();P>=128;){for(B=0;B<16;++B)t[B][0]=r.getInt32()>>>0,t[B][1]=r.getInt32()>>>0;for(;B<80;++B)a=(((N=(z=t[B-2])[0])>>>19|(R=z[1])<<13)^(R>>>29|N<<3)^N>>>6)>>>0,n=((N<<13|R>>>19)^(R<<3|N>>>29)^(N<<26|R>>>6))>>>0,i=(((N=(D=t[B-15])[0])>>>1|(R=D[1])<<31)^(N>>>8|R<<24)^N>>>7)>>>0,l=((N<<31|R>>>1)^(N<<24|R>>>8)^(N<<25|R>>>7))>>>0,L=t[B-7],U=t[B-16],R=n+L[1]+l+U[1],t[B][0]=a+L[0]+i+U[0]+(R/4294967296>>>0)>>>0,t[B][1]=R>>>0;for(f=e[0][0],h=e[0][1],g=e[1][0],m=e[1][1],b=e[2][0],y=e[2][1],_=e[3][0],w=e[3][1],C=e[4][0],x=e[4][1],E=e[5][0],S=e[5][1],k=e[6][0],T=e[6][1],A=e[7][0],I=e[7][1],B=0;B<80;++B)u=((C>>>14|x<<18)^(C>>>18|x<<14)^(x>>>9|C<<23))>>>0,v=(k^C&(E^k))>>>0,s=((f>>>28|h<<4)^(h>>>2|f<<30)^(h>>>7|f<<25))>>>0,c=((f<<4|h>>>28)^(h<<30|f>>>2)^(h<<25|f>>>7))>>>0,d=(f&g|b&(f^g))>>>0,p=(h&m|y&(h^m))>>>0,R=I+(((C<<18|x>>>14)^(C<<14|x>>>18)^(x<<23|C>>>9))>>>0)+((T^x&(S^T))>>>0)+o[B][1]+t[B][1],a=A+u+v+o[B][0]+t[B][0]+(R/4294967296>>>0)>>>0,n=R>>>0,i=s+d+((R=c+p)/4294967296>>>0)>>>0,l=R>>>0,A=k,I=T,k=E,T=S,E=C,S=x,C=_+a+((R=w+n)/4294967296>>>0)>>>0,x=R>>>0,_=b,w=y,b=g,y=m,g=f,m=h,f=a+i+((R=n+l)/4294967296>>>0)>>>0,h=R>>>0;R=e[0][1]+h,e[0][0]=e[0][0]+f+(R/4294967296>>>0)>>>0,e[0][1]=R>>>0,R=e[1][1]+m,e[1][0]=e[1][0]+g+(R/4294967296>>>0)>>>0,e[1][1]=R>>>0,R=e[2][1]+y,e[2][0]=e[2][0]+b+(R/4294967296>>>0)>>>0,e[2][1]=R>>>0,R=e[3][1]+w,e[3][0]=e[3][0]+_+(R/4294967296>>>0)>>>0,e[3][1]=R>>>0,R=e[4][1]+x,e[4][0]=e[4][0]+C+(R/4294967296>>>0)>>>0,e[4][1]=R>>>0,R=e[5][1]+S,e[5][0]=e[5][0]+E+(R/4294967296>>>0)>>>0,e[5][1]=R>>>0,R=e[6][1]+T,e[6][0]=e[6][0]+k+(R/4294967296>>>0)>>>0,e[6][1]=R>>>0,R=e[7][1]+I,e[7][0]=e[7][0]+A+(R/4294967296>>>0)>>>0,e[7][1]=R>>>0,P-=128}}return Ni.exports}var zi,Li,Di,Ui,Pi,Vi,Mi,Oi,ji={};function qi(){if(Di)return Li;Di=1;var e=jn();Ko(),qo(),Ri(),Wn();var t=function(){if(zi)return ji;zi=1;var e=jn();so();var t=e.asn1;return ji.privateKeyValidator={name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},ji.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]},ji}(),r=t.publicKeyValidator,a=t.privateKeyValidator;if(void 0===n)var n=e.jsbn.BigInteger;var o=e.util.ByteBuffer,i="undefined"==typeof Buffer?Uint8Array:Buffer;e.pki=e.pki||{},Li=e.pki.ed25519=e.ed25519=e.ed25519||{};var l=e.ed25519;function s(e){var t=e.message;if(t instanceof Uint8Array||t instanceof i)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new o(t,r)}else if(!(t instanceof o))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var a=new i(t.length()),n=0;n<a.length;++n)a[n]=t.at(n);return a}l.constants={},l.constants.PUBLIC_KEY_BYTE_LENGTH=32,l.constants.PRIVATE_KEY_BYTE_LENGTH=64,l.constants.SEED_BYTE_LENGTH=32,l.constants.SIGN_BYTE_LENGTH=64,l.constants.HASH_BYTE_LENGTH=64,l.generateKeyPair=function(t){var r=(t=t||{}).seed;if(void 0===r)r=e.random.getBytesSync(l.constants.SEED_BYTE_LENGTH);else if("string"==typeof r){if(r.length!==l.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+l.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(r instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');r=s({message:r,encoding:"binary"});for(var a=new i(l.constants.PUBLIC_KEY_BYTE_LENGTH),n=new i(l.constants.PRIVATE_KEY_BYTE_LENGTH),o=0;o<32;++o)n[o]=r[o];return function(e,t){var r,a=[R(),R(),R(),R()],n=m(t,32);for(n[0]&=248,n[31]&=127,n[31]|=64,A(a,n),C(e,a),r=0;r<32;++r)t[r+32]=e[r]}(a,n),{publicKey:a,privateKey:n}},l.privateKeyFromAsn1=function(t){var r={},n=[];if(!e.asn1.validate(t,a,r,n)){var o=new Error("Invalid Key.");throw o.errors=n,o}var i=e.asn1.derToOid(r.privateKeyOid),l=e.oids.EdDSA25519;if(i!==l)throw new Error('Invalid OID "'+i+'"; OID must be "'+l+'".');var c=r.privateKey;return{privateKeyBytes:s({message:e.asn1.fromDer(c).value,encoding:"binary"})}},l.publicKeyFromAsn1=function(t){var a={},n=[];if(!e.asn1.validate(t,r,a,n)){var o=new Error("Invalid Key.");throw o.errors=n,o}var i=e.asn1.derToOid(a.publicKeyOid),c=e.oids.EdDSA25519;if(i!==c)throw new Error('Invalid OID "'+i+'"; OID must be "'+c+'".');var u=a.ed25519PublicKey;if(u.length!==l.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return s({message:u,encoding:"binary"})},l.publicKeyFromPrivateKey=function(e){var t=s({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==l.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+l.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new i(l.constants.PUBLIC_KEY_BYTE_LENGTH),a=0;a<r.length;++a)r[a]=t[32+a];return r},l.sign=function(e){var t=s(e=e||{}),r=s({message:e.privateKey,encoding:"binary"});if(r.length===l.constants.SEED_BYTE_LENGTH)r=l.generateKeyPair({seed:r}).privateKey;else if(r.length!==l.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+l.constants.SEED_BYTE_LENGTH+" or "+l.constants.PRIVATE_KEY_BYTE_LENGTH);var a=new i(l.constants.SIGN_BYTE_LENGTH+t.length);!function(e,t,r,a){var n,o,i=new Float64Array(64),l=[R(),R(),R(),R()],s=m(a,32);s[0]&=248,s[31]&=127,s[31]|=64;var c=r+64;for(n=0;n<r;++n)e[64+n]=t[n];for(n=0;n<32;++n)e[32+n]=s[32+n];var u=m(e.subarray(32),r+32);for(y(u),A(l,u),C(e,l),n=32;n<64;++n)e[n]=a[n];var v=m(e,r+64);for(y(v),n=32;n<64;++n)i[n]=0;for(n=0;n<32;++n)i[n]=u[n];for(n=0;n<32;++n)for(o=0;o<32;o++)i[n+o]+=v[n]*s[o];b(e.subarray(32),i)}(a,t,t.length,r);for(var n=new i(l.constants.SIGN_BYTE_LENGTH),o=0;o<n.length;++o)n[o]=a[o];return n},l.verify=function(e){var t=s(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=s({message:e.signature,encoding:"binary"});if(r.length!==l.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+l.constants.SIGN_BYTE_LENGTH);var a=s({message:e.publicKey,encoding:"binary"});if(a.length!==l.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+l.constants.PUBLIC_KEY_BYTE_LENGTH);var n,o=new i(l.constants.SIGN_BYTE_LENGTH+t.length),d=new i(l.constants.SIGN_BYTE_LENGTH+t.length);for(n=0;n<l.constants.SIGN_BYTE_LENGTH;++n)o[n]=r[n];for(n=0;n<t.length;++n)o[n+l.constants.SIGN_BYTE_LENGTH]=t[n];return function(e,t,r,a){var n,o=new i(32),l=[R(),R(),R(),R()],s=[R(),R(),R(),R()];if(r<64)return-1;if(function(e,t){var r=R(),a=R(),n=R(),o=R(),i=R(),l=R(),s=R();I(e[2],u),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),D(n,e[1]),U(o,n,v),L(n,n,e[2]),z(o,e[2],o),D(i,o),D(l,i),U(s,l,i),U(r,s,n),U(r,r,o),function(e,t){var r,a=R();for(r=0;r<16;++r)a[r]=t[r];for(r=250;r>=0;--r)D(a,a),1!==r&&U(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}(r,r),U(r,r,n),U(r,r,o),U(r,r,o),U(e[0],r,o),D(a,e[0]),U(a,a,o),E(a,n)&&U(e[0],e[0],g);if(D(a,e[0]),U(a,a,o),E(a,n))return-1;k(e[0])===t[31]>>7&&L(e[0],c,e[0]);return U(e[3],e[0],e[1]),0}(s,a))return-1;for(n=0;n<r;++n)e[n]=t[n];for(n=0;n<32;++n)e[n+32]=a[n];var d=m(e,r);if(y(d),T(l,s,d),A(s,t.subarray(32)),_(l,s),C(o,l),r-=64,S(t,0,o,0)){for(n=0;n<r;++n)e[n]=0;return-1}for(n=0;n<r;++n)e[n]=t[n+64];return r}(d,o,o.length,a)>=0};var c=R(),u=R([1]),v=R([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=R([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),p=R([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),f=R([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),h=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),g=R([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(t,r){var a=e.md.sha512.create(),n=new o(t);a.update(n.getBytes(r),"binary");var s=a.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(s,"binary");for(var c=new i(l.constants.HASH_BYTE_LENGTH),u=0;u<64;++u)c[u]=s.charCodeAt(u);return c}function b(e,t){var r,a,n,o;for(a=63;a>=32;--a){for(r=0,n=a-32,o=a-12;n<o;++n)t[n]+=r-16*t[a]*h[n-(a-32)],r=t[n]+128>>8,t[n]-=256*r;t[n]+=r,t[a]=0}for(r=0,n=0;n<32;++n)t[n]+=r-(t[31]>>4)*h[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;++n)t[n]-=r*h[n];for(a=0;a<32;++a)t[a+1]+=t[a]>>8,e[a]=255&t[a]}function y(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;b(e,t)}function _(e,t){var r=R(),a=R(),n=R(),o=R(),i=R(),l=R(),s=R(),c=R(),u=R();L(r,e[1],e[0]),L(u,t[1],t[0]),U(r,r,u),z(a,e[0],e[1]),z(u,t[0],t[1]),U(a,a,u),U(n,e[3],t[3]),U(n,n,d),U(o,e[2],t[2]),z(o,o,o),L(i,a,r),L(l,o,n),z(s,o,n),z(c,a,r),U(e[0],i,l),U(e[1],c,s),U(e[2],s,l),U(e[3],i,c)}function w(e,t,r){for(var a=0;a<4;++a)N(e[a],t[a],r)}function C(e,t){var r=R(),a=R(),n=R();!function(e,t){var r,a=R();for(r=0;r<16;++r)a[r]=t[r];for(r=253;r>=0;--r)D(a,a),2!==r&&4!==r&&U(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}(n,t[2]),U(r,t[0],n),U(a,t[1],n),x(e,a),e[31]^=k(r)<<7}function x(e,t){var r,a,n,o=R(),i=R();for(r=0;r<16;++r)i[r]=t[r];for(B(i),B(i),B(i),a=0;a<2;++a){for(o[0]=i[0]-65517,r=1;r<15;++r)o[r]=i[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=i[15]-32767-(o[14]>>16&1),n=o[15]>>16&1,o[14]&=65535,N(i,o,1-n)}for(r=0;r<16;r++)e[2*r]=255&i[r],e[2*r+1]=i[r]>>8}function E(e,t){var r=new i(32),a=new i(32);return x(r,e),x(a,t),S(r,0,a,0)}function S(e,t,r,a){return function(e,t,r,a,n){var o,i=0;for(o=0;o<n;++o)i|=e[t+o]^r[a+o];return(1&i-1>>>8)-1}(e,t,r,a,32)}function k(e){var t=new i(32);return x(t,e),1&t[0]}function T(e,t,r){var a,n;for(I(e[0],c),I(e[1],u),I(e[2],u),I(e[3],c),n=255;n>=0;--n)w(e,t,a=r[n/8|0]>>(7&n)&1),_(t,e),_(e,e),w(e,t,a)}function A(e,t){var r=[R(),R(),R(),R()];I(r[0],p),I(r[1],f),I(r[2],u),U(r[3],p,f),T(e,r,t)}function I(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function B(e){var t,r,a=1;for(t=0;t<16;++t)r=e[t]+a+65535,a=Math.floor(r/65536),e[t]=r-65536*a;e[0]+=a-1+37*(a-1)}function N(e,t,r){for(var a,n=~(r-1),o=0;o<16;++o)a=n&(e[o]^t[o]),e[o]^=a,t[o]^=a}function R(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function z(e,t,r){for(var a=0;a<16;++a)e[a]=t[a]+r[a]}function L(e,t,r){for(var a=0;a<16;++a)e[a]=t[a]-r[a]}function D(e,t){U(e,t,t)}function U(e,t,r){var a,n,o=0,i=0,l=0,s=0,c=0,u=0,v=0,d=0,p=0,f=0,h=0,g=0,m=0,b=0,y=0,_=0,w=0,C=0,x=0,E=0,S=0,k=0,T=0,A=0,I=0,B=0,N=0,R=0,z=0,L=0,D=0,U=r[0],P=r[1],V=r[2],M=r[3],O=r[4],j=r[5],q=r[6],F=r[7],K=r[8],$=r[9],H=r[10],G=r[11],W=r[12],Y=r[13],Q=r[14],J=r[15];o+=(a=t[0])*U,i+=a*P,l+=a*V,s+=a*M,c+=a*O,u+=a*j,v+=a*q,d+=a*F,p+=a*K,f+=a*$,h+=a*H,g+=a*G,m+=a*W,b+=a*Y,y+=a*Q,_+=a*J,i+=(a=t[1])*U,l+=a*P,s+=a*V,c+=a*M,u+=a*O,v+=a*j,d+=a*q,p+=a*F,f+=a*K,h+=a*$,g+=a*H,m+=a*G,b+=a*W,y+=a*Y,_+=a*Q,w+=a*J,l+=(a=t[2])*U,s+=a*P,c+=a*V,u+=a*M,v+=a*O,d+=a*j,p+=a*q,f+=a*F,h+=a*K,g+=a*$,m+=a*H,b+=a*G,y+=a*W,_+=a*Y,w+=a*Q,C+=a*J,s+=(a=t[3])*U,c+=a*P,u+=a*V,v+=a*M,d+=a*O,p+=a*j,f+=a*q,h+=a*F,g+=a*K,m+=a*$,b+=a*H,y+=a*G,_+=a*W,w+=a*Y,C+=a*Q,x+=a*J,c+=(a=t[4])*U,u+=a*P,v+=a*V,d+=a*M,p+=a*O,f+=a*j,h+=a*q,g+=a*F,m+=a*K,b+=a*$,y+=a*H,_+=a*G,w+=a*W,C+=a*Y,x+=a*Q,E+=a*J,u+=(a=t[5])*U,v+=a*P,d+=a*V,p+=a*M,f+=a*O,h+=a*j,g+=a*q,m+=a*F,b+=a*K,y+=a*$,_+=a*H,w+=a*G,C+=a*W,x+=a*Y,E+=a*Q,S+=a*J,v+=(a=t[6])*U,d+=a*P,p+=a*V,f+=a*M,h+=a*O,g+=a*j,m+=a*q,b+=a*F,y+=a*K,_+=a*$,w+=a*H,C+=a*G,x+=a*W,E+=a*Y,S+=a*Q,k+=a*J,d+=(a=t[7])*U,p+=a*P,f+=a*V,h+=a*M,g+=a*O,m+=a*j,b+=a*q,y+=a*F,_+=a*K,w+=a*$,C+=a*H,x+=a*G,E+=a*W,S+=a*Y,k+=a*Q,T+=a*J,p+=(a=t[8])*U,f+=a*P,h+=a*V,g+=a*M,m+=a*O,b+=a*j,y+=a*q,_+=a*F,w+=a*K,C+=a*$,x+=a*H,E+=a*G,S+=a*W,k+=a*Y,T+=a*Q,A+=a*J,f+=(a=t[9])*U,h+=a*P,g+=a*V,m+=a*M,b+=a*O,y+=a*j,_+=a*q,w+=a*F,C+=a*K,x+=a*$,E+=a*H,S+=a*G,k+=a*W,T+=a*Y,A+=a*Q,I+=a*J,h+=(a=t[10])*U,g+=a*P,m+=a*V,b+=a*M,y+=a*O,_+=a*j,w+=a*q,C+=a*F,x+=a*K,E+=a*$,S+=a*H,k+=a*G,T+=a*W,A+=a*Y,I+=a*Q,B+=a*J,g+=(a=t[11])*U,m+=a*P,b+=a*V,y+=a*M,_+=a*O,w+=a*j,C+=a*q,x+=a*F,E+=a*K,S+=a*$,k+=a*H,T+=a*G,A+=a*W,I+=a*Y,B+=a*Q,N+=a*J,m+=(a=t[12])*U,b+=a*P,y+=a*V,_+=a*M,w+=a*O,C+=a*j,x+=a*q,E+=a*F,S+=a*K,k+=a*$,T+=a*H,A+=a*G,I+=a*W,B+=a*Y,N+=a*Q,R+=a*J,b+=(a=t[13])*U,y+=a*P,_+=a*V,w+=a*M,C+=a*O,x+=a*j,E+=a*q,S+=a*F,k+=a*K,T+=a*$,A+=a*H,I+=a*G,B+=a*W,N+=a*Y,R+=a*Q,z+=a*J,y+=(a=t[14])*U,_+=a*P,w+=a*V,C+=a*M,x+=a*O,E+=a*j,S+=a*q,k+=a*F,T+=a*K,A+=a*$,I+=a*H,B+=a*G,N+=a*W,R+=a*Y,z+=a*Q,L+=a*J,_+=(a=t[15])*U,i+=38*(C+=a*V),l+=38*(x+=a*M),s+=38*(E+=a*O),c+=38*(S+=a*j),u+=38*(k+=a*q),v+=38*(T+=a*F),d+=38*(A+=a*K),p+=38*(I+=a*$),f+=38*(B+=a*H),h+=38*(N+=a*G),g+=38*(R+=a*W),m+=38*(z+=a*Y),b+=38*(L+=a*Q),y+=38*(D+=a*J),o=(a=(o+=38*(w+=a*P))+(n=1)+65535)-65536*(n=Math.floor(a/65536)),i=(a=i+n+65535)-65536*(n=Math.floor(a/65536)),l=(a=l+n+65535)-65536*(n=Math.floor(a/65536)),s=(a=s+n+65535)-65536*(n=Math.floor(a/65536)),c=(a=c+n+65535)-65536*(n=Math.floor(a/65536)),u=(a=u+n+65535)-65536*(n=Math.floor(a/65536)),v=(a=v+n+65535)-65536*(n=Math.floor(a/65536)),d=(a=d+n+65535)-65536*(n=Math.floor(a/65536)),p=(a=p+n+65535)-65536*(n=Math.floor(a/65536)),f=(a=f+n+65535)-65536*(n=Math.floor(a/65536)),h=(a=h+n+65535)-65536*(n=Math.floor(a/65536)),g=(a=g+n+65535)-65536*(n=Math.floor(a/65536)),m=(a=m+n+65535)-65536*(n=Math.floor(a/65536)),b=(a=b+n+65535)-65536*(n=Math.floor(a/65536)),y=(a=y+n+65535)-65536*(n=Math.floor(a/65536)),_=(a=_+n+65535)-65536*(n=Math.floor(a/65536)),o=(a=(o+=n-1+37*(n-1))+(n=1)+65535)-65536*(n=Math.floor(a/65536)),i=(a=i+n+65535)-65536*(n=Math.floor(a/65536)),l=(a=l+n+65535)-65536*(n=Math.floor(a/65536)),s=(a=s+n+65535)-65536*(n=Math.floor(a/65536)),c=(a=c+n+65535)-65536*(n=Math.floor(a/65536)),u=(a=u+n+65535)-65536*(n=Math.floor(a/65536)),v=(a=v+n+65535)-65536*(n=Math.floor(a/65536)),d=(a=d+n+65535)-65536*(n=Math.floor(a/65536)),p=(a=p+n+65535)-65536*(n=Math.floor(a/65536)),f=(a=f+n+65535)-65536*(n=Math.floor(a/65536)),h=(a=h+n+65535)-65536*(n=Math.floor(a/65536)),g=(a=g+n+65535)-65536*(n=Math.floor(a/65536)),m=(a=m+n+65535)-65536*(n=Math.floor(a/65536)),b=(a=b+n+65535)-65536*(n=Math.floor(a/65536)),y=(a=y+n+65535)-65536*(n=Math.floor(a/65536)),_=(a=_+n+65535)-65536*(n=Math.floor(a/65536)),o+=n-1+37*(n-1),e[0]=o,e[1]=i,e[2]=l,e[3]=s,e[4]=c,e[5]=u,e[6]=v,e[7]=d,e[8]=p,e[9]=f,e[10]=h,e[11]=g,e[12]=m,e[13]=b,e[14]=y,e[15]=_}return Li}var Fi,Ki={exports:{}};function $i(){if(Fi)return Ki.exports;Fi=1;var e=jn();to(),so(),So(),lo(),wo(),ci(),qo(),Wn(),Si();var t=e.asn1,r=Ki.exports=e.pkcs7=e.pkcs7||{};function a(a){var n={},o=[];if(!t.validate(a,r.asn1.recipientInfoValidator,n,o)){var i=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw i.errors=o,i}return{version:n.version.charCodeAt(0),issuer:e.pki.RDNAttributesAsArray(n.issuer),serialNumber:e.util.createBuffer(n.serial).toHex(),encryptedContent:{algorithm:t.derToOid(n.encAlgorithm),parameter:n.encParameter?n.encParameter.value:void 0,content:n.encKey}}}function n(r){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[e.pki.distinguishedNameToAsn1({attributes:r.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(r.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.encryptedContent.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.encryptedContent.content)])}function o(e){for(var t=[],r=0;r<e.length;++r)t.push(n(e[r]));return t}function i(r){var a=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[e.pki.distinguishedNameToAsn1({attributes:r.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,e.util.hexToBytes(r.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.digestAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])]);if(r.authenticatedAttributesAsn1&&a.value.push(r.authenticatedAttributesAsn1),a.value.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.signatureAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),a.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.signature)),r.unauthenticatedAttributes.length>0){for(var n=t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o<r.unauthenticatedAttributes.length;++o){var i=r.unauthenticatedAttributes[o];n.values.push(l(i))}a.value.push(n)}return a}function l(r){var a;if(r.type===e.pki.oids.contentType)a=t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.value).getBytes());else if(r.type===e.pki.oids.messageDigest)a=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.value.bytes());else if(r.type===e.pki.oids.signingTime){var n=new Date("1950-01-01T00:00:00Z"),o=new Date("2050-01-01T00:00:00Z"),i=r.value;if("string"==typeof i){var l=Date.parse(i);i=isNaN(l)?13===i.length?t.utcTimeToDate(i):t.generalizedTimeToDate(i):new Date(l)}a=i>=n&&i<o?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(i)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(i))}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[a])])}function s(r,a,n){var o={};if(!t.validate(a,n,o,[])){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw i.errors=i,i}if(t.derToOid(o.contentType)!==e.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(o.encryptedContent){var l="";if(e.util.isArray(o.encryptedContent))for(var s=0;s<o.encryptedContent.length;++s){if(o.encryptedContent[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");l+=o.encryptedContent[s].value}else l=o.encryptedContent;r.encryptedContent={algorithm:t.derToOid(o.encAlgorithm),parameter:e.util.createBuffer(o.encParameter.value),content:e.util.createBuffer(l)}}if(o.content){l="";if(e.util.isArray(o.content))for(s=0;s<o.content.length;++s){if(o.content[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");l+=o.content[s].value}else l=o.content;r.content=e.util.createBuffer(l)}return r.version=o.version.charCodeAt(0),r.rawCapture=o,o}function c(t){if(void 0===t.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===t.content){var r;switch(t.encryptedContent.algorithm){case e.pki.oids["aes128-CBC"]:case e.pki.oids["aes192-CBC"]:case e.pki.oids["aes256-CBC"]:r=e.aes.createDecryptionCipher(t.encryptedContent.key);break;case e.pki.oids.desCBC:case e.pki.oids["des-EDE3-CBC"]:r=e.des.createDecryptionCipher(t.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+t.encryptedContent.algorithm)}if(r.start(t.encryptedContent.parameter),r.update(t.encryptedContent.content),!r.finish())throw new Error("Symmetric decryption failed.");t.content=r.output}}return r.messageFromPem=function(a){var n=e.pem.decode(a)[0];if("PKCS7"!==n.type){var o=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var i=t.fromDer(n.body);return r.messageFromAsn1(i)},r.messageToPem=function(r,a){var n={type:"PKCS7",body:t.toDer(r.toAsn1()).getBytes()};return e.pem.encode(n,{maxline:a})},r.messageFromAsn1=function(a){var n={},o=[];if(!t.validate(a,r.asn1.contentInfoValidator,n,o)){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw i.errors=o,i}var l,s=t.derToOid(n.contentType);switch(s){case e.pki.oids.envelopedData:l=r.createEnvelopedData();break;case e.pki.oids.encryptedData:l=r.createEncryptedData();break;case e.pki.oids.signedData:l=r.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return l.fromAsn1(n.content.value[0]),l},r.createSignedData=function(){var a=null;return a={type:e.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(s(a,t,r.asn1.signedDataValidator),a.certificates=[],a.crls=[],a.digestAlgorithmIdentifiers=[],a.contentInfo=null,a.signerInfos=[],a.rawCapture.certificates)for(var n=a.rawCapture.certificates.value,o=0;o<n.length;++o)a.certificates.push(e.pki.certificateFromAsn1(n[o]))},toAsn1:function(){a.contentInfo||a.sign();for(var r=[],n=0;n<a.certificates.length;++n)r.push(e.pki.certificateToAsn1(a.certificates[n]));var o=[],i=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(a.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,a.digestAlgorithmIdentifiers),a.contentInfo])]);return r.length>0&&i.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,r)),o.length>0&&i.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,o)),i.value[0].value.push(t.create(t.Class.UNIVERSAL,t.Type.SET,!0,a.signerInfos)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.type).getBytes()),i])},addSigner:function(t){var r=t.issuer,n=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=e.pki.certificateFromPem(o)),r=o.issuer.attributes,n=o.serialNumber}var i=t.key;if(!i)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof i&&(i=e.pki.privateKeyFromPem(i));var l=t.digestAlgorithm||e.pki.oids.sha1;switch(l){case e.pki.oids.sha1:case e.pki.oids.sha256:case e.pki.oids.sha384:case e.pki.oids.sha512:case e.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+l)}var s=t.authenticatedAttributes||[];if(s.length>0){for(var c=!1,u=!1,v=0;v<s.length;++v){var d=s[v];if(c||d.type!==e.pki.oids.contentType){if(u||d.type!==e.pki.oids.messageDigest);else if(u=!0,c)break}else if(c=!0,u)break}if(!c||!u)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}a.signers.push({key:i,version:1,issuer:r,serialNumber:n,digestAlgorithm:l,signatureAlgorithm:e.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:s,unauthenticatedAttributes:[]})},sign:function(r){var n;(r=r||{},"object"!=typeof a.content||null===a.contentInfo)&&(a.contentInfo=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.pki.oids.data).getBytes())]),"content"in a&&(a.content instanceof e.util.ByteBuffer?n=a.content.bytes():"string"==typeof a.content&&(n=e.util.encodeUtf8(a.content)),r.detached?a.detachedContent=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n):a.contentInfo.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n)]))));0!==a.signers.length&&function(r){var n;n=a.detachedContent?a.detachedContent:(n=a.contentInfo.value[1]).value[0];if(!n)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var o=t.derToOid(a.contentInfo.value[0].value),s=t.toDer(n);for(var c in s.getByte(),t.getBerValueLength(s),s=s.getBytes(),r)r[c].start().update(s);for(var u=new Date,v=0;v<a.signers.length;++v){var d=a.signers[v];if(0===d.authenticatedAttributes.length){if(o!==e.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{d.authenticatedAttributesAsn1=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var p=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[]),f=0;f<d.authenticatedAttributes.length;++f){var h=d.authenticatedAttributes[f];h.type===e.pki.oids.messageDigest?h.value=r[d.digestAlgorithm].digest():h.type===e.pki.oids.signingTime&&(h.value||(h.value=u)),p.value.push(l(h)),d.authenticatedAttributesAsn1.value.push(l(h))}s=t.toDer(p).getBytes(),d.md.start().update(s)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}a.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(i(e[r]));return t}(a.signers)}(function(){for(var r={},n=0;n<a.signers.length;++n){var o=a.signers[n];(i=o.digestAlgorithm)in r||(r[i]=e.md[e.pki.oids[i]].create()),0===o.authenticatedAttributes.length?o.md=r[i]:o.md=e.md[e.pki.oids[i]].create()}for(var i in a.digestAlgorithmIdentifiers=[],r)a.digestAlgorithmIdentifiers.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(i).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]));return r}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=e.pki.certificateFromPem(t)),a.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},r.createEncryptedData=function(){var t=null;return t={type:e.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:e.pki.oids["aes256-CBC"]},fromAsn1:function(e){s(t,e,r.asn1.encryptedDataValidator)},decrypt:function(e){void 0!==e&&(t.encryptedContent.key=e),c(t)}}},r.createEnvelopedData=function(){var n=null;return n={type:e.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:e.pki.oids["aes256-CBC"]},fromAsn1:function(e){var t=s(n,e,r.asn1.envelopedDataValidator);n.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(a(e[r]));return t}(t.recipientInfos.value)},toAsn1:function(){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n.type).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(n.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,o(n.recipients)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,(r=n.encryptedContent,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.pki.oids.data).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.algorithm).getBytes()),r.parameter?t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.parameter.getBytes()):void 0]),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.content.getBytes())])]))])])]);var r},findRecipient:function(e){for(var t=e.issuer.attributes,r=0;r<n.recipients.length;++r){var a=n.recipients[r],o=a.issuer;if(a.serialNumber===e.serialNumber&&o.length===t.length){for(var i=!0,l=0;l<t.length;++l)if(o[l].type!==t[l].type||o[l].value!==t[l].value){i=!1;break}if(i)return a}}return null},decrypt:function(t,r){if(void 0===n.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case e.pki.oids.rsaEncryption:case e.pki.oids.desCBC:var a=r.decrypt(t.encryptedContent.content);n.encryptedContent.key=e.util.createBuffer(a);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}c(n)},addRecipient:function(t){n.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:e.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===n.encryptedContent.content){var a,o,i;switch(r=r||n.encryptedContent.algorithm,t=t||n.encryptedContent.key,r){case e.pki.oids["aes128-CBC"]:a=16,o=16,i=e.aes.createEncryptionCipher;break;case e.pki.oids["aes192-CBC"]:a=24,o=16,i=e.aes.createEncryptionCipher;break;case e.pki.oids["aes256-CBC"]:a=32,o=16,i=e.aes.createEncryptionCipher;break;case e.pki.oids["des-EDE3-CBC"]:a=24,o=8,i=e.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=e.util.createBuffer(e.random.getBytes(a));else if(t.length()!=a)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+a+".");n.encryptedContent.algorithm=r,n.encryptedContent.key=t,n.encryptedContent.parameter=e.util.createBuffer(e.random.getBytes(o));var l=i(t);if(l.start(n.encryptedContent.parameter.copy()),l.update(n.content),!l.finish())throw new Error("Symmetric encryption failed.");n.encryptedContent.content=l.output}for(var s=0;s<n.recipients.length;++s){var c=n.recipients[s];if(void 0===c.encryptedContent.content){if(c.encryptedContent.algorithm!==e.pki.oids.rsaEncryption)throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm);c.encryptedContent.content=c.encryptedContent.key.encrypt(n.encryptedContent.key.data)}}}}},Ki.exports}var Hi,Gi,Wi,Yi={exports:{}};var Qi=(Wi||(Wi=1,Gi=jn(),to(),Ii(),so(),Yn(),So(),qi(),ho(),function(){if(Pi)return Ui;Pi=1;var e=jn();Wn(),qo(),Ko(),Ui=e.kem=e.kem||{};var t=e.jsbn.BigInteger;function r(t,r,a,n){t.generate=function(t,o){for(var i=new e.util.ByteBuffer,l=Math.ceil(o/n)+a,s=new e.util.ByteBuffer,c=a;c<l;++c){s.putInt32(c),r.start(),r.update(t+s.getBytes());var u=r.digest();i.putBytes(u.getBytes(n))}return i.truncate(i.length()-o),i.getBytes()}}e.kem.rsa={},e.kem.rsa.create=function(r,a){var n=(a=a||{}).prng||e.random;return{encrypt:function(a,o){var i,l=Math.ceil(a.n.bitLength()/8);do{i=new t(e.util.bytesToHex(n.getBytesSync(l)),16).mod(a.n)}while(i.compareTo(t.ONE)<=0);var s=l-(i=e.util.hexToBytes(i.toString(16))).length;return s>0&&(i=e.util.fillString(String.fromCharCode(0),s)+i),{encapsulation:a.encrypt(i,"NONE"),key:r.generate(i,o)}},decrypt:function(e,t,a){var n=e.decrypt(t,"NONE");return r.generate(n,a)}}},e.kem.kdf1=function(e,t){r(this,e,0,t||e.digestLength)},e.kem.kdf2=function(e,t){r(this,e,1,t||e.digestLength)}}(),function(){if(Mi)return Vi;Mi=1;var e=jn();Wn(),Vi=e.log=e.log||{},e.log.levels=["none","error","warning","info","debug","verbose","max"];var t={},r=[],a=null;e.log.LEVEL_LOCKED=2,e.log.NO_LEVEL_CHECK=4,e.log.INTERPOLATE=8;for(var n=0;n<e.log.levels.length;++n){var o=e.log.levels[n];t[o]={index:n,name:o.toUpperCase()}}e.log.logMessage=function(a){for(var n=t[a.level].index,o=0;o<r.length;++o){var i=r[o];i.flags&e.log.NO_LEVEL_CHECK?i.f(a):n<=t[i.level].index&&i.f(i,a)}},e.log.prepareStandard=function(e){"standard"in e||(e.standard=t[e.level].name+" ["+e.category+"] "+e.message)},e.log.prepareFull=function(t){if(!("full"in t)){var r=[t.message];r=r.concat([]),t.full=e.util.format.apply(this,r)}},e.log.prepareStandardFull=function(t){"standardFull"in t||(e.log.prepareStandard(t),t.standardFull=t.standard)};var i=["error","warning","info","debug","verbose"];for(n=0;n<i.length;++n)(function(t){e.log[t]=function(r,a){var n=Array.prototype.slice.call(arguments).slice(2),o={timestamp:new Date,level:t,category:r,message:a,arguments:n};e.log.logMessage(o)}})(i[n]);if(e.log.makeLogger=function(t){var r={flags:0,f:t};return e.log.setLevel(r,"none"),r},e.log.setLevel=function(t,r){var a=!1;if(t&&!(t.flags&e.log.LEVEL_LOCKED))for(var n=0;n<e.log.levels.length;++n)if(r==e.log.levels[n]){t.level=r,a=!0;break}return a},e.log.lock=function(t,r){void 0===r||r?t.flags|=e.log.LEVEL_LOCKED:t.flags&=~e.log.LEVEL_LOCKED},e.log.addLogger=function(e){r.push(e)},"undefined"!=typeof console&&"log"in console){var l;if(console.error&&console.warn&&console.info&&console.debug){var s={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},c=function(t,r){e.log.prepareStandard(r);var a=s[r.level],n=[r.standard];n=n.concat(r.arguments.slice()),a.apply(console,n)};l=e.log.makeLogger(c)}else c=function(t,r){e.log.prepareStandardFull(r)},l=e.log.makeLogger(c);e.log.setLevel(l,"debug"),e.log.addLogger(l),a=l}else console={log:function(){}};if(null!==a&&"undefined"!=typeof window&&window.location){var u=new URL(window.location.href).searchParams;u.has("console.level")&&e.log.setLevel(a,u.get("console.level").slice(-1)[0]),u.has("console.lock")&&"true"==u.get("console.lock").slice(-1)[0]&&e.log.lock(a)}e.log.consoleLogger=a}(),Oi||(Oi=1,fo(),bo(),Yo(),zo(),Ri()),hi(),Io(),wo(),Qo(),ki(),$i(),Ti(),ai(),jo(),Ei(),qo(),Fo(),function(){if(Hi)return Yi.exports;Hi=1;var e=jn();to(),ho(),bo(),Yo(),Wn();var t=Yi.exports=e.ssh=e.ssh||{};function r(t,r){var a=r.toString(16);a[0]>="8"&&(a="00"+a);var n=e.util.hexToBytes(a);t.putInt32(n.length),t.putBytes(n)}function a(e,t){e.putInt32(t.length),e.putString(t)}function n(){for(var t=e.md.sha1.create(),r=arguments.length,a=0;a<r;++a)t.update(arguments[a]);return t.digest()}t.privateKeyToPutty=function(t,o,i){var l="ssh-rsa",s=""===(o=o||"")?"none":"aes256-cbc",c="PuTTY-User-Key-File-2: "+l+"\r\n";c+="Encryption: "+s+"\r\n",c+="Comment: "+(i=i||"")+"\r\n";var u=e.util.createBuffer();a(u,l),r(u,t.e),r(u,t.n);var v=e.util.encode64(u.bytes(),64),d=Math.floor(v.length/66)+1;c+="Public-Lines: "+d+"\r\n",c+=v;var p,f=e.util.createBuffer();if(r(f,t.d),r(f,t.p),r(f,t.q),r(f,t.qInv),o){var h=f.length()+16-1;h-=h%16;var g=n(f.bytes());g.truncate(g.length()-h+f.length()),f.putBuffer(g);var m=e.util.createBuffer();m.putBuffer(n("\0\0\0\0",o)),m.putBuffer(n("\0\0\0",o));var b=e.aes.createEncryptionCipher(m.truncate(8),"CBC");b.start(e.util.createBuffer().fillWithByte(0,16)),b.update(f.copy()),b.finish();var y=b.output;y.truncate(16),p=e.util.encode64(y.bytes(),64)}else p=e.util.encode64(f.bytes(),64);c+="\r\nPrivate-Lines: "+(d=Math.floor(p.length/66)+1)+"\r\n",c+=p;var _=n("putty-private-key-file-mac-key",o),w=e.util.createBuffer();a(w,l),a(w,s),a(w,i),w.putInt32(u.length()),w.putBuffer(u),w.putInt32(f.length()),w.putBuffer(f);var C=e.hmac.create();return C.start("sha1",_),C.update(w.bytes()),c+"\r\nPrivate-MAC: "+C.digest().toHex()+"\r\n"},t.publicKeyToOpenSSH=function(t,n){var o="ssh-rsa";n=n||"";var i=e.util.createBuffer();return a(i,o),r(i,t.e),r(i,t.n),o+" "+e.util.encode64(i.bytes())+" "+n},t.privateKeyToOpenSSH=function(t,r){return r?e.pki.encryptRsaPrivateKey(t,r,{legacy:!0,algorithm:"aes128"}):e.pki.privateKeyToPem(t)},t.getPublicKeyFingerprint=function(t,n){var o=(n=n||{}).md||e.md.md5.create(),i=e.util.createBuffer();a(i,"ssh-rsa"),r(i,t.e),r(i,t.n),o.start(),o.update(i.getBytes());var l=o.digest();if("hex"===n.encoding){var s=l.toHex();return n.delimiter?s.match(/.{2}/g).join(n.delimiter):s}if("binary"===n.encoding)return l.getBytes();if(n.encoding)throw new Error('Unknown encoding "'+n.encoding+'".');return l},Yi.exports}(),Ai(),Wn()),Gi);class Ji{constructor(e){this.logger="CORE_LOGGER",this.isDebug=e}debug(e){this.isDebug&&console.debug}warning(e){this.isDebug&&console.warn}warn(e){this.warning(e)}info(e){this.isDebug&&console.info}error(e){this.isDebug&&console.error}isDebugEnabled(){return this.isDebug}}let Xi={domain:"https://api.dev.alviere.com",access_token:"",certificate:{id:"",public_key:""}};function Zi(e){Xi={...Xi,...e}}function el(e){if("undefined"!=typeof window&&window.VITE_DEBUG){return window[`VITE_${e}`]}}function tl(){if(Xi.domain&&Xi.certificate)return;const e={},t=el("ALVIERE_DOMAIN"),r=el("CERTIFICATE");if(t&&(e.domain=t),r)try{const t=JSON.parse(r);t&&"string"==typeof t.id&&"string"==typeof t.public_key&&(e.certificate={id:t.id,public_key:t.public_key})}catch{}(e.domain||e.certificate)&&Zi(e)}const rl=()=>(Xi.domain||tl(),Xi.domain),al=()=>(Xi.certificate||tl(),Xi.certificate.public_key.replace(/\\n/g,"").replace(/\r\n/g,"").replace(/\n/g,"").replace(/\r/g,"").trim()),nl=()=>(Xi.certificate||tl(),Xi.certificate.id);rl(),al(),nl();class ol{constructor(e){var t;this.logger=e,this.rsa_key=al(),this.key=this.generate_key(),this.nonce=this.generate_nonce(),null==(t=this.logger)||t.debug("🔐 Cryptor initialized")}async encrypt(e){var t,r;const a=(new TextEncoder).encode(JSON.stringify(e)),n={name:"AES-GCM",iv:this.nonce},o=await this.import_key(),i=await crypto.subtle.encrypt(n,o,a),l=this.bufferToStr(i),s=btoa(l),c=this.bufferToStr(this.key),u=btoa(c),v=this.bufferToStr(this.nonce),d=btoa(v);null==(t=this.logger)||t.debug(`🔐 RSA_KEY: ${this.rsa_key.substring(0,50)}...`);const p=Qi.pki.publicKeyFromPem(this.rsa_key).encrypt(u+"::"+d),f={p:s,k:btoa(p),i:nl()};return null==(r=this.logger)||r.debug(`🔐 ENCRYPTED_REQUEST: p=${f.p.substring(0,20)}..., i=${f.i}`),f}async decrypt(e){var t;const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:this.nonce},await this.import_key(),Uint8Array.from(atob(e.p),e=>e.charCodeAt(0))),a=(new TextDecoder).decode(r);return null==(t=this.logger)||t.debug(`🔐 DECRYPTED: ${a}`),JSON.parse(a)}generate_key(){return crypto.getRandomValues(new Uint8Array(32))}generate_nonce(){return crypto.getRandomValues(new Uint8Array(12))}async import_key(){return await crypto.subtle.importKey("raw",this.key,{name:"AES-GCM"},!0,["encrypt","decrypt"])}async rsa_encrypt(e){var t,r;null==(t=this.logger)||t.debug(`🔐 RSA_ENCRYPT: Data to encrypt: ${e.substring(0,50)}...`),null==(r=this.logger)||r.debug(`🔐 RSA_KEY: ${this.rsa_key.substring(0,50)}...`);const a=Qi.pki.publicKeyFromPem(this.rsa_key);return btoa(a.encrypt(e))}bufferToStr(e){return Array.from(new Uint8Array(e)).map(e=>String.fromCharCode(e)).join("")}}class il{constructor(e){this.logger=e}credit_card_name(e){return this.logger.debug(`🔐 CREDIT_CARD_NAME: ${e}`),e&&"string"==typeof e?0===e.trim().length?"Card holder name cannot be empty.":null:"Card holder name cannot be empty."}credit_card_number(e){if(!e||"string"!=typeof e)return"Please enter a valid card number.";return/^(?:4[0-9]{12}(?:[0-9]{3})?)$/.test(e.replace(/\s/g,""))||/^(?:5[1-5][0-9]{14})$/.test(e.replace(/\s/g,""))||/^(?:3[47][0-9]{13})$/.test(e.replace(/\s/g,""))||/^(?:6(?:011|5[0-9][0-9])[0-9]{12})$/.test(e.replace(/\s/g,""))?null:(this.logger.debug("🔐 card number is not a recognized brand"),"Please enter a valid card number.")}credit_card_expiry_date(e){if(!e||"string"!=typeof e)return"Expiry date cannot be empty.";if(0===e.trim().length)return"Expiry date cannot be empty.";return/^(0[1-9]|1[0-2])\/?([0-9]{4}|[0-9]{2})$/.test(e)?null:"Please enter a valid expiry date."}credit_card_sec_code(e){if(!e||"string"!=typeof e)return"Security code cannot be empty.";if(0===e.trim().length)return"Security code cannot be empty.";return/^[0-9]{3,4}$/.test(e)?null:"Please enter a valid security code."}credit_card_zip_code(e){return e&&"string"==typeof e?0===e.trim().length?"Zip code cannot be empty.":null:"Zip code cannot be empty."}credit_card_pin(e){if(!e||"string"!=typeof e)return"PIN cannot be empty.";if(0===e.trim().length)return"PIN cannot be empty.";return/^[0-9]{4}$/.test(e)?null:"Please enter a valid PIN."}is_valid_uuid(e){if(!e||"string"!=typeof e)return"UUID cannot be empty.";if(0===e.trim().length)return"UUID cannot be empty.";return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)?null:"Please enter a valid UUID."}required(e,t){return null==e||"string"==typeof e&&0===e.trim().length?t?`${t} is required.`:"This field is required.":null}email(e){if(!e||"string"!=typeof e)return"Please enter a valid email address.";const t=e.trim();if(t.includes(".."))return"Please enter a valid email address.";return/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/.test(t)?null:"Please enter a valid email address."}phone(e){if(!e||"string"!=typeof e)return"Please enter a valid phone number.";if(!e.startsWith("+"))return"Phone number must start with country code (e.g., +1)";const t=e.substring(1),r=t.match(/^(\d{1,3})/);if(!r)return"Invalid country code format";const a=r[1],n=t.substring(a.length);if(n.length<7)return"Phone number too short";const o=a.length+n.length;return o<10||o>15?"Phone number must be between 10 and 15 digits total":null}date(e,t="YYYY-MM-DD"){if(!e||"string"!=typeof e)return"Please enter a valid date.";const r=/^([0-9]{4})-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/;if(!r.test(e))return"Please enter a valid date in YYYY-MM-DD format";const[,a,n,o]=e.match(r)||[],i=parseInt(a),l=parseInt(n),s=parseInt(o);if(!this.isValidCalendarDate(i,l,s))return"Invalid date - this date does not exist";const c=new Date(e);return c>new Date?"Date cannot be in the future":c<new Date("1900-01-01")?"Date cannot be before 1900":null}isValidCalendarDate(e,t,r){const a=new Date(e,t-1,r);return a.getFullYear()===e&&a.getMonth()===t-1&&a.getDate()===r}min_length(e,t,r){return e&&"string"==typeof e?e.length<t?r?`${r} must be at least ${t} characters long.`:`Must be at least ${t} characters long.`:null:r?`${r} is required.`:"This field is required."}max_length(e,t,r){return e&&"string"==typeof e&&e.length>t?r?`${r} must be no more than ${t} characters long.`:`Must be no more than ${t} characters long.`:null}pattern(e,t,r){return e&&"string"==typeof e&&t.test(e)?null:r||"Please enter a valid value."}numeric(e,t){return e&&"string"==typeof e?/^\d+$/.test(e.trim())?null:t?`${t} must contain only numbers.`:"Must contain only numbers.":t?`${t} is required.`:"This field is required."}alphabetic(e,t){return e&&"string"==typeof e?/^[a-zA-Z\s]+$/.test(e.trim())?null:t?`${t} must contain only letters and spaces.`:"Must contain only letters and spaces.":t?`${t} is required.`:"This field is required."}alphanumeric(e,t){return e&&"string"==typeof e?/^[a-zA-Z0-9\s]+$/.test(e.trim())?null:t?`${t} must contain only letters, numbers, and spaces.`:"Must contain only letters, numbers, and spaces.":t?`${t} is required.`:"This field is required."}url(e){if(!e||"string"!=typeof e)return"Please enter a valid URL.";const t=e.trim();try{const e=new URL(t);return""===e.hostname||e.hostname.startsWith(".")||e.hostname.endsWith(".")?"Please enter a valid URL.":null}catch{return"Please enter a valid URL."}}postal_code(e,t="US"){if(!e||"string"!=typeof e)return"Please enter a valid postal code.";const r=e.trim();switch(t.toUpperCase()){case"US":if(!/^\d{5}(-\d{4})?$/.test(r))return"Please enter a valid US ZIP code (e.g., 12345 or 12345-6789).";break;case"CA":if(!/^[A-Za-z]\d[A-Za-z] \d[A-Za-z]\d$/.test(r))return"Please enter a valid Canadian postal code (e.g., A1A 1A1).";break;case"UK":case"GB":if(!/^[A-Za-z]{1,2}\d[A-Za-z\d]?\s\d[A-Za-z]{2}$/.test(r))return"Please enter a valid UK postal code (e.g., SW1A 1AA).";break;default:if(!/^[A-Za-z0-9\s-]{3,10}$/.test(r))return"Please enter a valid postal code."}return null}}class ll extends Error{constructor(e,t,r){super(`Alcore API Error ${e}: ${t}`),this.name="AlcoreApiError",this.errorCode=e,this.errorDescription=t,this.statusCode=r,Error.captureStackTrace&&Error.captureStackTrace(this,ll)}isErrorCode(e){return this.errorCode===e}isAnyErrorCode(e){return e.includes(this.errorCode)}}const sl="000000",cl="100011",ul="100012",vl="100013",dl="100014",pl="100015",fl="100016",hl="100017",gl="100300",ml="100301",bl="100302",yl="100303",_l="100304",wl="100305",Cl="100306",xl="110000",El="110001",Sl="110002",kl="110004",Tl="115000",Al="115001",Il="320129",Bl="320104",Nl={[wl]:"Invalid authentication token. Please log in again.",[Cl]:"Authentication failed. Please check your credentials and try again.",[xl]:"Session not found. Please log in again.",[El]:"Parent account not found.",[Sl]:"Resource not found.",[kl]:"Account type not supported.",[gl]:"Invalid request payload. Please check your request and try again.",[ml]:"Invalid request payload field. Please check your request and try again.",[bl]:"Invalid path parameter. Please check your request and try again.",[yl]:"Invalid header. Please check your request and try again.",[_l]:"Invalid query parameter. Please check your request and try again.",[cl]:"Unprocessable encrypted data. Please check your request and try again.",[ul]:"Wrong encrypted endpoint. Please check your request and try again.",[vl]:"Undecryptable data at endpoint. Please check your request and try again.",[dl]:"Decrypted data unusable at endpoint. Please check your request and try again.",[pl]:"Wrong decrypted endpoint. Please check your request and try again.",[fl]:"Wrong version or endpoint. Please check your request and try again.",[hl]:"Operation halted. Please check your request and try again.",[Tl]:"Underlying API Error. ",[Al]:"Account status not active. Please check your request and try again.",[Il]:"Used Account can't be used to create a child account.",[Bl]:"Parent account not allowed. Please check your request and try again."},Rl=[wl,Cl,xl,cl,ul,vl,hl,sl,Tl,Al,Il,Bl];class zl{constructor(e,t,r){this.endpoint="/alcore",this.jwt=e,this.cryptor=t,this.domain=rl(),this.logger=r,this.logger.debug(`🔐 AlcoreBase initialized with domain: ${this.domain}`)}async send(e,t,r){const a={method:e,endpoint:t,payload:JSON.stringify(r)};let n;this.logger.debug("🌐 AlcoreBase: Preparing to send request"),this.logger.debug("🌐 Method: "+e),this.logger.debug("🌐 Endpoint: "+t),this.logger.debug("🌐 Domain: "+(this.domain||"undefined")),this.logger.debug("🌐 JWT Token: "+(this.jwt?"✅ Present":"❌ Missing")),this.logger.debug("🌐 Payload size: "+JSON.stringify(r).length+" chars"),this.logger.debug(this.jwt),this.logger.debug("DATA TO SEND before encrypt"),this.logger.debug(r);try{n=await this.cryptor.encrypt(a),this.logger.debug("🔐 Encryption successful")}catch(i){throw this.logger.debug("❌ Encryption failed: "+(i instanceof Error?i.message:"Unknown error")),i}this.logger.debug("BASE GATEWAY: posting to "+this.endpoint),this.logger.debug(n);const o=this.domain+this.endpoint;this.logger.debug("🌐 Full URL: "+o);try{const e=await fetch(o,{method:"post",headers:{"Content-Type":"application/json",Authorization:"Bearer "+this.jwt,Version:"2021-11-18"},body:JSON.stringify(n)});if(this.logger.debug("🌐 Response received - Status: "+e.status+" "+e.statusText),this.logger.debug("🌐 Response OK: "+e.ok),!e.ok){let t=await e.json();throw t.p&&(t=await this.decrypt(t)),this.logger.debug("❌ API Error - Code: "+t.error_code+", Description: "+t.error_description),new ll(500===e.status?Tl:t.error_code,Nl[t.error_code],e.status)}return e}catch(l){throw this.logger.debug("❌ Fetch failed: "+(l instanceof Error?l.message:"Unknown error")),l}}async decrypt(e){return this.cryptor.decrypt(e)}}function Ll(e){if(e&&"object"==typeof e&&("error_code"in e||"error_description"in e)){const t=e.error_description||"Unknown API error",r=e.error_code||"UNKNOWN";throw new Error(`${r}: ${t}`)}return e}function Dl(e){try{const t=e.split(".");if(3!==t.length)return null;const r=t[1],a=atob(r.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(a)}catch(t){return null}}function Ul(e){const t=Dl(e);return t?{domain:t.api_domain||"https://api.dev.alviere.com"}:{}}function Pl(e){const t=Dl(e);return t&&t.sub||null}class Vl extends zl{constructor(e,t,r){super(e,t,r)}async add_card(e,t){const r=`/accounts/${e}/payment-methods/cards`,a=await this.send("POST",r,t),n=await a.json();return Ll(await this.decrypt(n))}async add_bank_account(e,t){const r=`/accounts/${e}/payment-methods/bank-accounts`,a=await this.send("POST",r,t),n=await a.json();return Ll(await this.decrypt(n))}async get_bank_accounts(e){const t=`/accounts/${e}/payment-methods/bank-accounts`,r=await this.send("GET",t,{}),a=await r.json();return Ll(await this.decrypt(a))}async delete_bank_account(e,t){const r=`/accounts/${e}/payment-methods/bank-accounts/${t}`;return Ll(await this.send("DELETE",r,{}))}}class Ml extends zl{constructor(e,t,r){super(e,t,r)}async listWallets(e,t){const r=`/accounts/${e}/wallets${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),n=await a.json();return Ll(await this.decrypt(n))}async loadFunds(e,t){const r=`/wallets/${e}/load`,a=await this.send("POST",r,t),n=await a.json();return Ll(await this.decrypt(n))}}class Ol extends zl{constructor(e,t,r){super(e,t,r)}async createPaymentInstrument(e){const t=await this.send("POST","/payments/payment-instruments",e),r=await t.json();return Ll(await this.decrypt(r))}async getPaymentInstrument(e){const t=`/payments/payment-instruments/${e}`,r=await this.send("GET",t,{}),a=await r.json();return Ll(await this.decrypt(a))}async deletePaymentInstrument(e){const t=`/payments/payment-instruments/${e}`;await this.send("DELETE",t,{})}async debitFunds(e){const t=await this.send("POST","/payments/debit",e),r=await t.json();return Ll(await this.decrypt(r))}async listCards(e,t){const r=`/accounts/${e}/payment-methods/cards${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),n=await a.json();return Ll(await this.decrypt(n))}}class jl extends zl{constructor(e,t,r){super(e,t,r),this.logger.debug("🔐 AccountsGateway initialized")}async createAccount(e){const t=await this.send("POST","/accounts",e),r=await t.json();return Ll(await this.decrypt(r))}async getAccount(e){const t=`/accounts/${e}`,r=await this.send("GET",t,{}),a=await r.json();return Ll(await this.decrypt(a))}async updateAccount(e,t){const r=`/accounts/${e}`,a=await this.send("PUT",r,t),n=await a.json();return Ll(await this.decrypt(n))}async deleteAccount(e){const t=`/accounts/${e}`;await this.send("DELETE",t,{})}async listAccounts(e){const t=`/accounts${e?"?"+new URLSearchParams(Object.entries(e).filter(([e,t])=>void 0!==t)):""}`,r=await this.send("GET",t,{}),a=await r.json();return Ll(await this.decrypt(a))}async activateAccount(e){const t=`/accounts/${e}/activate`;await this.send("POST",t,{})}async deactivateAccount(e){const t=`/accounts/${e}/deactivate`;await this.send("POST",t,{})}async manageOnboarding(e,t){const r=`/accounts/${e}/onboarding`;await this.send("POST",r,{action:t})}async createAddress(e,t){const r=`/accounts/${e}/addresses`,a=await this.send("POST",r,t),n=await a.json();return Ll(await this.decrypt(n))}async getAddresses(e,t){const r=`/accounts/${e}/addresses${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),n=await a.json();return Ll(await this.decrypt(n))}async updateAddress(e,t,r){const a=`/accounts/${e}/addresses/${t}`,n=await this.send("PUT",a,r),o=await n.json();return Ll(await this.decrypt(o))}async deleteAddress(e,t){const r=`/accounts/${e}/addresses/${t}`;await this.send("DELETE",r,{})}async createDossier(e,t){const r=`/accounts/${e}/dossiers`,a=await this.send("POST",r,t),n=await a.json();return Ll(await this.decrypt(n))}async getDossiers(e,t){const r=`/accounts/${e}/dossiers${t?"?"+new URLSearchParams(Object.entries(t).filter(([e,t])=>void 0!==t)):""}`,a=await this.send("GET",r,{}),n=await a.json();return Ll(await this.decrypt(n))}async getDossier(e,t){const r=`/accounts/${e}/dossiers/${t}`,a=await this.send("GET",r,{}),n=await a.json();return Ll(await this.decrypt(n))}async updateDossier(e,t,r){const a=`/accounts/${e}/dossiers/${t}`,n=await this.send("PUT",a,r),o=await n.json();return Ll(await this.decrypt(o))}async replaceDossier(e,t,r){const a=`/accounts/${e}/dossiers/${t}`,n=await this.send("PATCH",a,r),o=await n.json();return Ll(await this.decrypt(o))}async deleteDossier(e,t){const r=`/accounts/${e}/dossiers/${t}`;await this.send("DELETE",r,{})}}class ql extends zl{constructor(e,t,r){super(e,t,r),this.logger.debug("🔐 AuthGateway initialized")}async generateScopedToken(e){this.logger.debug("🔐 AuthGateway: Generating scoped token"),this.logger.debug("🌐 Endpoint: /v3/auth"),this.logger.debug("🌐 Account UUID: "+e.account_uuid);const t=await this.send("POST","/v3/auth",e),r=await this.decrypt(await t.json());return this.logger.debug("✅ Scoped token generated successfully"),r}}class Fl{constructor(e){this.gateway=e}async listWallets(e,t){return this.gateway.listWallets(e,t)}async loadFunds(e,t){return this.gateway.loadFunds(e,t)}}class Kl{constructor(e){this.gateway=e}async createPaymentInstrument(e){return this.gateway.createPaymentInstrument(e)}async getPaymentInstrument(e){return this.gateway.getPaymentInstrument(e)}async deletePaymentInstrument(e){return this.gateway.deletePaymentInstrument(e)}async debitFunds(e){return this.gateway.debitFunds(e)}async listCards(e,t){return this.gateway.listCards(e,t)}}class $l{constructor(e){this.gateway=e}async createAccount(e){return this.gateway.createAccount(e)}async getAccount(e){return this.gateway.getAccount(e)}async updateAccount(e,t){return this.gateway.updateAccount(e,t)}async deleteAccount(e){return this.gateway.deleteAccount(e)}async listAccounts(e){return this.gateway.listAccounts(e)}async activateAccount(e){return this.gateway.activateAccount(e)}async deactivateAccount(e){return this.gateway.deactivateAccount(e)}async manageOnboarding(e,t){return this.gateway.manageOnboarding(e,t)}async createAddress(e,t){return this.gateway.createAddress(e,t)}async getAddresses(e,t){return this.gateway.getAddresses(e,t)}async updateAddress(e,t,r){return this.gateway.updateAddress(e,t,r)}async deleteAddress(e,t){return this.gateway.deleteAddress(e,t)}async createDossier(e,t){return this.gateway.createDossier(e,t)}async getDossiers(e,t){return this.gateway.getDossiers(e,t)}async getDossier(e,t){return this.gateway.getDossier(e,t)}async updateDossier(e,t,r){return this.gateway.updateDossier(e,t,r)}async replaceDossier(e,t,r){return this.gateway.replaceDossier(e,t,r)}async deleteDossier(e,t){return this.gateway.deleteDossier(e,t)}}class Hl{constructor(e,t){this.gateway=e,this.logger=t}async processAddCard(e,t){this.logger.debug("PaymentProcessor: Starting add card processing"),this.logger.debug("PaymentProcessor: Request data: "+JSON.stringify(t,null,2));try{const r=await this.gateway.add_card(e,t);return this.logger.debug("PaymentProcessor: Add card processing completed successfully"),r}catch(r){throw this.logger.debug("PaymentProcessor: Add card processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(r)),r}}validateRequest(e){const t=["external_id","pan","exp_year","exp_month","postal_code","security_code"];for(const r of t)if(!e[r])throw new Error(`Missing required field: ${r}`);this.logger.debug("PaymentProcessor: Request validation passed")}async processAddCardWithValidation(e,t){return this.logger.debug("PaymentProcessor: Starting add card processing with validation"),this.validateRequest(t),await this.processAddCard(e,t)}async processAddBankAccount(e,t){this.logger.debug("PaymentProcessor: Starting add bank account processing"),this.logger.debug("PaymentProcessor: Request data: "+JSON.stringify(t,null,2));try{const r=await this.gateway.add_bank_account(e,t);return this.logger.debug("PaymentProcessor: Add bank account processing completed successfully"),r}catch(r){throw this.logger.debug("PaymentProcessor: Add bank account processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(r)),r}}validateBankAccountRequest(e){const t=["external_id","country","currency","bank_account_details"];for(const r of t)if(!e[r])throw new Error(`Missing required field: ${r}`);this.logger.debug("PaymentProcessor: Bank account request validation passed")}async processAddBankAccountWithValidation(e,t){return this.logger.debug("PaymentProcessor: Starting add bank account processing with validation"),this.validateBankAccountRequest(t),await this.processAddBankAccount(e,t)}async processGetBankAccounts(e){this.logger.debug("PaymentProcessor: Starting get bank accounts processing");try{const t=await this.gateway.get_bank_accounts(e);return this.logger.debug("PaymentProcessor: Get bank accounts processing completed successfully"),t}catch(t){throw this.logger.debug("PaymentProcessor: Get bank accounts processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(t)),t}}async processDeleteBankAccount(e,t){this.logger.debug("PaymentProcessor: Starting delete bank account processing");try{const r=await this.gateway.delete_bank_account(e,t);return this.logger.debug("PaymentProcessor: Delete bank account processing completed successfully"),r}catch(r){throw this.logger.debug("PaymentProcessor: Delete bank account processing failed"),this.logger.debug("PaymentProcessor: Error details: "+JSON.stringify(r)),r}}}class Gl{constructor(e){this.gateway=e}async getBankInfo(e){return this.gateway.getBankInfo(e)}}class Wl extends zl{constructor(e,t,r){super(e,t,r),this.logger.debug("🔐 BankInfoGateway initialized")}async getBankInfo(e){const t=`/bank-info?routing_number=${e}`,r=await this.send("GET",t,{}),a=await r.json();return Ll(await this.decrypt(a))}}class Yl{constructor(e={}){if(this.authToken="",this.business_uuid="",this.account_uuid="",this.cryptor=null,this.gateways=new Map,this.jwt=e.jwt||"",this.debug=e.debug||!1,this.publicCertificate=e.publicCertificate||"",this.publicCertificateId=e.publicCertificateId||"",this.business_uuid=e.business_uuid||"",this.logger=new Ji(this.debug),this.logger.debug(`🔐 AlviereCore constructor called with config: ${JSON.stringify(e)}`),this.jwt){const t=Ul(this.jwt);e.jwt&&Zi({...t,certificate:{id:this.publicCertificateId,public_key:this.publicCertificate}});const r=Pl(this.jwt);r?(this.account_uuid=r,this.logger.debug(`🔐 Extracted account_uuid from JWT sub field: ${this.account_uuid}`)):this.logger.debug("⚠️ No account_uuid found in JWT sub field"),this.authToken=this.jwt,this.logger.debug("🔐 Using JWT as auth token for API authentication")}e.alviere&&Zi(e.alviere)}configure(e){const t=e.jwt&&e.jwt!==this.jwt;if(e.jwt){this.jwt=e.jwt;const t=Ul(e.jwt);t.domain&&Zi(t);const r=Pl(e.jwt);this.logger.debug(`🔐 Extracted account_uuid from JWT sub field: ${r}`),r?(this.account_uuid=r,this.logger.debug(`🔐 Updated account_uuid from JWT sub field: ${this.account_uuid}`)):this.logger.debug("⚠️ No account_uuid found in new JWT sub field"),this.authToken=this.jwt,this.logger.debug("🔐 Updated JWT as auth token for API authentication")}return void 0!==e.business_uuid&&(this.business_uuid=e.business_uuid,this.logger.debug(`🔐 Updated business_uuid: ${this.business_uuid}`)),"boolean"==typeof e.debug&&e.debug!==this.debug&&(this.debug=e.debug,this.logger=new Ji(this.debug),this.logger.debug("🔐 Debug mode changed to: "+this.debug)),t&&(this.logger.debug("🔐 JWT changed - clearing gateway cache and cryptor"),this.gateways.clear(),this.cryptor=null),e.alviere&&Zi(e.alviere),this}getOrCreateCryptor(){if(!this.cryptor){const e=al();if(!e||""===e.trim())throw new Error('🔐 Cryptor initialization failed: RSA public key not available. Please ensure JWT is configured with a valid RSA key before attempting encryption operations. Call alviereCore.configure({ jwt: "your-jwt-with-rsa-key" }) first.');this.logger.debug("🔐 Creating Cryptor instance with RSA key"),this.cryptor=new ol(this.logger)}return this.cryptor}createPaymentsGateway(){return this.gateways.has("payments")||this.gateways.set("payments",new Vl(this.authToken,this.getOrCreateCryptor(),this.logger)),this.gateways.get("payments")}createPaymentsService(){const e=this.createPaymentsGateway();return new Hl(e,this.logger)}createWalletsService(){return this.gateways.has("wallets")||this.gateways.set("wallets",new Ml(this.authToken,this.getOrCreateCryptor(),this.logger)),new Fl(this.gateways.get("wallets"))}createPaymentInstrumentsService(){return this.gateways.has("paymentInstruments")||this.gateways.set("paymentInstruments",new Ol(this.authToken,this.getOrCreateCryptor(),this.logger)),new Kl(this.gateways.get("paymentInstruments"))}createAccountsService(){return this.gateways.has("accounts")||this.gateways.set("accounts",new jl(this.authToken,this.getOrCreateCryptor(),this.logger)),new $l(this.gateways.get("accounts"))}createAuthGateway(){if(!this.gateways.has("auth")){if(!this.cryptor)throw new Error("Cryptor not initialized. Cannot create AuthGateway.");this.gateways.set("auth",new ql(this.authToken,this.cryptor,this.logger))}return this.gateways.get("auth")}createBankInfoService(){return this.gateways.has("bankInfo")||this.gateways.set("bankInfo",new Wl(this.authToken,this.getOrCreateCryptor(),this.logger)),new Gl(this.gateways.get("bankInfo"))}async generateScopedToken(e,t=!0){this.logger.debug(`🔐 Generating scoped token for account: ${e}`),this.logger.debug(`🔐 Auto-update: ${t}`);const r=this.createAuthGateway(),a=await r.generateScopedToken({account_uuid:e});return this.logger.debug("✅ Scoped token generated successfully"),t&&a.access_token&&(this.logger.debug("🔄 Auto-updating SDK with new scoped token"),this.configure({jwt:a.access_token})),a.access_token}getLogger(){return this.logger}getCryptor(){return this.getOrCreateCryptor()}clearCache(){this.gateways.clear()}getAccountUuid(){return this.account_uuid}getBusinessUuid(){return this.business_uuid}isFirstTimeUser(){if(!this.account_uuid||!this.business_uuid)return this.logger.debug("🔐 Cannot determine first-time user status: missing account_uuid or business_uuid"),!1;const e=this.account_uuid===this.business_uuid;return this.logger.debug(`🔐 First-time user check: ${e} (account: ${this.account_uuid}, business: ${this.business_uuid})`),e}isScopedToPayee(){return!(!this.account_uuid||!this.business_uuid)&&this.account_uuid!==this.business_uuid}static createValidator(e=!1){const t=new Ji(e);return new il(t)}static createLogger(e=!1){return new Ji(e)}static createCryptor(e){return new ol(e)}}const Ql=Yl.createValidator();function Jl(e){let t=At(null),r=At(!1),a=At(!1),n=At("neutral"),o=At("");const i=rt(()=>()=>e.validationState&&"neutral"!==e.validationState?e.validationState:qr(a)?qr(n):"neutral"),l=rt(()=>()=>e.errorMessage?e.errorMessage:qr(o)),s=rt(()=>()=>"valid"===qr(i)()),c=rt(()=>()=>"invalid"===qr(i)()),u=rt(()=>()=>qr(a)&&"neutral"!==qr(i)());function v(t){if(!e.required&&(""===t||null==t))return{isValid:!0,error:null};if(e.required){const r=Ql.required(t,e.label);if(r)return{isValid:!1,error:r}}return e.customValidator?e.customValidator(t):{isValid:!0,error:null}}return{state:{get inputElement(){return qr(t)},set inputElement(e){Bt(t,e,!0)},get isFocused(){return qr(r)},get hasInteracted(){return qr(a)},get validationState(){return qr(i)()},get errorMessage(){return qr(l)()},get isValid(){return qr(s)()},get hasError(){return qr(c)()},get shouldShowValidation(){return qr(u)()},get validationError(){return qr(l)()},get localValue(){return e.value},get isReady(){return null!==qr(t)}},handlers:{handleFocus:function(t){Bt(r,!0),e.onFocus&&e.onFocus(t)},handleBlur:function(t){if(Bt(r,!1),Bt(a,!0),qr(a)){const t=v(e.value);Bt(n,t.isValid?"valid":"invalid",!0),Bt(o,t.error||"",!0)}e.onBlur&&e.onBlur(t)},handleInput:function(t){if(Bt(a,!0),qr(a)){const t=v(e.value);Bt(n,t.isValid?"valid":"invalid",!0),Bt(o,t.error||"",!0)}e.onInput&&e.onInput(t)},handleChange:function(t){e.onChange&&e.onChange(t)}},actions:{markAsInteracted:function(){Bt(a,!0)},resetValidation:function(){Bt(a,!1),Bt(n,"neutral"),Bt(o,"")},forceValidation:function(){Bt(a,!0);const t=v(e.value);return Bt(n,t.isValid?"valid":"invalid",!0),Bt(o,t.error||"",!0),t},validateValue:v},computed:{get effectiveValidationState(){return qr(i)()},get effectiveErrorMessage(){return qr(l)()},get isValid(){return qr(s)()},get hasError(){return qr(c)()},get shouldShowValidation(){return qr(u)()}},metadata:{componentName:e.componentName||"UnknownComponent",componentType:e.componentType||"general",version:"2.0.0"}}}const Xl={email:(e,t)=>Ql.email(e,t),phone:(e,t)=>Ql.phone(e,t),url:(e,t)=>Ql.url(e,t),numeric:(e,t)=>Ql.numeric(e,t),alphabetic:(e,t)=>Ql.alphabetic(e,t),alphanumeric:(e,t)=>Ql.alphanumeric(e,t),pattern:(e,t,r)=>Ql.pattern(e,t,r),minLength:(e,t,r)=>Ql.min_length(e,t,r),maxLength:(e,t,r)=>Ql.max_length(e,t,r),postalCode:(e,t,r)=>Ql.postal_code(e,t,r),creditCardNumber:(e,t)=>Ql.credit_card_number(e,t),creditCardSecCode:(e,t)=>Ql.credit_card_sec_code(e,t),creditCardExpiryDate:(e,t)=>Ql.credit_card_expiry_date(e,t),date:(e,t)=>Ql.date(e,t)},Zl={bubbles:!0,composed:!0,cancelable:!1};class es{static dispatch(e,t,r,a=Zl){if(!e||"undefined"==typeof window||!window.customElements)return!1;const n=new CustomEvent(t,{detail:r,bubbles:a.bubbles??Zl.bubbles,composed:a.composed??Zl.composed,cancelable:a.cancelable??Zl.cancelable}),o=this.findWebComponentHost(e);return!!o&&(o.dispatchEvent(n),!0)}static findWebComponentHost(e){const t=e.getRootNode();if(t instanceof ShadowRoot&&t.host)return t.host;let r=e;for(;r&&r.parentElement;)if(r=r.parentElement,r.tagName.includes("-"))return r;return e}static createEventName(e,t){return`${e}-${t}`}}function ts(e){return{dispatch:(t,r,a)=>es.dispatch(e,t,r,a),createEventName:(e,t)=>es.createEventName(e,t)}}const rs="text-input",as="text-change",ns="text-focus",os="text-blur",is="card-pan-input",ls="card-pan-change",ss="card-pan-focus",cs="card-pan-blur",us="card-cvv-input",vs="card-cvv-change",ds="card-cvv-focus",ps="card-cvv-blur",fs="card-exp-input",hs="card-exp-change",gs="card-exp-focus",ms="card-exp-blur",bs="phone-input",ys="phone-change",_s="phone-focus",ws="phone-blur",Cs="search-select-input",xs="search-select-change",Es="search-select-open",Ss="search-select-close",ks="form-success",Ts="form-error",As="form-submit",Is="form-reset",Bs="flow-step-complete",Ns="flow-step-error",Rs="flow-complete",zs="flow-reset",Ls="account",Ds="payment-method";const Us=new class{validate(e){const{value:t,schema:r,fieldName:a}=e,n=[];if(r.required){const e=Ql.required(t,a);if(e){const t="string"==typeof r.required?r.required:e;return n.push(t),{isValid:!1,errors:n,firstError:n[0]}}}if(!t||""===t.trim())return{isValid:!0,errors:[],firstError:void 0};if(r.email){const e=Ql.email(t);if(e){const t="string"==typeof r.email?r.email:e;n.push(t)}}if(r.phone){const e=Ql.phone(t);if(e){const t="string"==typeof r.phone?r.phone:e;n.push(t)}}if(r.url){const e=Ql.url(t);if(e){const t="string"==typeof r.url?r.url:e;n.push(t)}}if(r.numeric){const e=Ql.numeric(t,a);if(e){const t="string"==typeof r.numeric?r.numeric:e;n.push(t)}}if(r.alphabetic){const e=Ql.alphabetic(t,a);if(e){const t="string"==typeof r.alphabetic?r.alphabetic:e;n.push(t)}}if(r.alphanumeric){const e=Ql.alphanumeric(t,a);if(e){const t="string"==typeof r.alphanumeric?r.alphanumeric:e;n.push(t)}}if(r.uuid){const e=Ql.is_valid_uuid(t);if(e){const t="string"==typeof r.uuid?r.uuid:e;n.push(t)}}if(r.pattern){const e=this.validatePattern(t,r.pattern);e&&n.push(e)}if(void 0!==r.minLength){const e=this.validateMinLength(t,r.minLength,a);e&&n.push(e)}if(void 0!==r.maxLength){const e=this.validateMaxLength(t,r.maxLength,a);e&&n.push(e)}if(r.postalCode){const e=this.validatePostalCode(t,r.postalCode);e&&n.push(e)}if(r.date){const e=this.validateDate(t,r.date);e&&n.push(e)}if(r.match){const a=this.validateMatch(t,r.match,e);a&&n.push(a)}return{isValid:0===n.length,errors:n,firstError:n.length>0?n[0]:void 0}}validatePattern(e,t){return Ql.pattern(e,t.regex,t.message)}validateMinLength(e,t,r){if("number"==typeof t)return Ql.min_length(e,t,r);const a=Ql.min_length(e,t.value,r);return a&&t.message?t.message:a}validateMaxLength(e,t,r){if("number"==typeof t)return Ql.max_length(e,t,r);const a=Ql.max_length(e,t.value,r);return a&&t.message?t.message:a}validatePostalCode(e,t){if("boolean"==typeof t)return Ql.postal_code(e);if("string"==typeof t)return Ql.postal_code(e,t);const r=Ql.postal_code(e,t.country);return r&&t.message?t.message:r}validateDate(e,t){if("boolean"==typeof t)return Ql.date(e);if("string"==typeof t)return t;const r=Ql.date(e,t.format);return r&&t.message?t.message:r}validateMatch(e,t,r){let a;return t.fieldRef?"function"==typeof t.fieldRef?a=t.fieldRef():t.fieldRef&&"value"in t.fieldRef&&(a=t.fieldRef.value||""):t.fieldId&&r.getMatchFieldValue&&(a=r.getMatchFieldValue(t.fieldId)),void 0===a?null:e!==a?t.message||"Values do not match":null}};function Ps(e,t,r,a){return Us.validate({value:e,schema:t,fieldName:r,getMatchFieldValue:a})}var Vs=ia('<span class="alviere-card-pan-input__required svelte-1k23f9f">*</span>'),Ms=ia('<label class="alviere-card-pan-input__label svelte-1k23f9f"> <!></label>'),Os=ia('<div class="alviere-card-pan-input__card-icon svelte-1k23f9f"><!></div>'),js=ia('<div class="alviere-card-pan-input__error svelte-1k23f9f" role="alert"> </div>'),qs=ia('<div><!> <div><input type="text" inputmode="numeric" class="alviere-card-pan-input__input svelte-1k23f9f" spellcheck="false" maxlength="23"/> <!></div> <!></div>');const Fs={hash:"svelte-1k23f9f",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-card-pan-input.svelte-1k23f9f {position:relative;width:100%;}.alviere-card-pan-input__label.svelte-1k23f9f {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-card-pan-input__required.svelte-1k23f9f {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-card-pan-input__error.svelte-1k23f9f {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-card-pan-input__wrapper.svelte-1k23f9f {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-card-pan-input__wrapper--focused.svelte-1k23f9f {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-card-pan-input__wrapper--disabled.svelte-1k23f9f {background:#f4f4f5;cursor:not-allowed;}.alviere-card-pan-input__wrapper--readonly.svelte-1k23f9f {background:#f4f4f5;cursor:default;}.alviere-card-pan-input__wrapper--valid.svelte-1k23f9f {border-color:#436b1d;}.alviere-card-pan-input__wrapper--invalid.svelte-1k23f9f {border-color:#b3311f;}.alviere-card-pan-input__input.svelte-1k23f9f {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-card-pan-input__input.svelte-1k23f9f::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;}.alviere-card-pan-input__input.svelte-1k23f9f:disabled {cursor:not-allowed;color:#52525b;}.alviere-card-pan-input__input.svelte-1k23f9f:read-only {cursor:default;color:#3f3f46;}.alviere-card-pan-input__validation-messages.svelte-1k23f9f {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-card-pan-input--sm.svelte-1k23f9f .alviere-card-pan-input__wrapper:where(.svelte-1k23f9f) {min-height:2.5rem;}.alviere-card-pan-input--sm.svelte-1k23f9f .alviere-card-pan-input__input:where(.svelte-1k23f9f) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-card-pan-input--sm.svelte-1k23f9f .alviere-card-pan-input__label:where(.svelte-1k23f9f) {font-size:1rem;}.alviere-card-pan-input--md.svelte-1k23f9f .alviere-card-pan-input__wrapper:where(.svelte-1k23f9f) {min-height:3.25rem;}.alviere-card-pan-input--md.svelte-1k23f9f .alviere-card-pan-input__input:where(.svelte-1k23f9f) {font-size:1rem;}.alviere-card-pan-input--lg.svelte-1k23f9f .alviere-card-pan-input__wrapper:where(.svelte-1k23f9f) {min-height:3.75rem;}.alviere-card-pan-input--lg.svelte-1k23f9f .alviere-card-pan-input__input:where(.svelte-1k23f9f) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-card-pan-input--lg.svelte-1k23f9f .alviere-card-pan-input__label:where(.svelte-1k23f9f) {font-size:1.25rem;}.alviere-card-pan-input.svelte-1k23f9f:focus-within .alviere-card-pan-input__wrapper:where(.svelte-1k23f9f):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-card-pan-input__input.svelte-1k23f9f::placeholder {font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-card-pan-input__card-icon.svelte-1k23f9f {display:flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;margin-right:2rem;opacity:0.8;}.alviere-card-pan-input__card-icon.svelte-1k23f9f svg {width:100%;height:100%;fill:currentColor;display:block;}'};function Ks(e,t){je(t,!0),Oa(e,Fs);let r=zn(t,"value",15,""),a=zn(t,"label",15,"Card Number"),n=zn(t,"placeholder",15,"Card number"),o=zn(t,"disabled",15,!1),i=zn(t,"required",15,!1),l=zn(t,"readonly",15,!1),s=zn(t,"size",15,"md"),c=zn(t,"id",15,""),u=zn(t,"name",15,""),v=zn(t,"autocomplete",15,"cc-number"),d=zn(t,"validationState",15,"neutral"),p=zn(t,"errorMessage",15,""),f=zn(t,"helpText",15,""),h=zn(t,"validationSchema",31,()=>Dt({}));const g=Jl({value:r(),required:i(),disabled:o(),readonly:l(),validationState:d(),errorMessage:p(),helpText:f(),label:a(),validationSchema:h(),componentName:"CardPanInput",componentType:"card",customValidator:e=>{const t=e.replace(/\s/g,""),r=Xl.creditCardNumber(t);if(r)return{isValid:!1,error:r};const n=Ps(t,h(),a());return{isValid:n.isValid,error:n.firstError}}}),m=[{name:"Visa",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Visa</title><path d="M9.112 8.262L5.97 15.758H3.92L2.374 9.775c-.094-.368-.175-.503-.461-.658C1.447 8.864.677 8.627 0 8.479l.046-.217h3.3a.904.904 0 01.894.764l.817 4.338 2.018-5.102zm8.033 5.049c.008-1.979-2.736-2.088-2.717-2.972.006-.269.262-.555.822-.628a3.66 3.66 0 011.913.336l.34-1.59a5.207 5.207 0 00-1.814-.333c-1.917 0-3.266 1.02-3.278 2.479-.012 1.079.963 1.68 1.698 2.04.756.367 1.01.603 1.006.931-.005.504-.602.725-1.16.734-.975.015-1.54-.263-1.992-.473l-.351 1.642c.453.208 1.289.39 2.156.398 2.037 0 3.37-1.006 3.377-2.564m5.061 2.447H24l-1.565-7.496h-1.656a.883.883 0 00-.826.55l-2.909 6.946h2.036l.405-1.12h2.488zm-2.163-2.656l1.02-2.815.588 2.815zm-8.16-4.84l-1.603 7.496H8.34l1.605-7.496z"/></svg>',pattern:/^4/,gaps:[4,8,12],lengths:[16,18,19],code:"visa"},{name:"Mastercard",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>MasterCard</title><path d="M11.343 18.031c.058.049.12.098.181.146-1.177.783-2.59 1.238-4.107 1.238C3.32 19.416 0 16.096 0 12c0-4.095 3.32-7.416 7.416-7.416 1.518 0 2.931.456 4.105 1.238-.06.051-.12.098-.165.15C9.6 7.489 8.595 9.688 8.595 12c0 2.311 1.001 4.51 2.748 6.031zm5.241-13.447c-1.52 0-2.931.456-4.105 1.238.06.051.12.098.165.15C14.4 7.489 15.405 9.688 15.405 12c0 2.31-1.001 4.507-2.748 6.031-.058.049-.12.098-.181.146 1.177.783 2.588 1.238 4.107 1.238C20.68 19.416 24 16.096 24 12c0-4.094-3.32-7.416-7.416-7.416zM12 6.174c-.096.075-.189.15-.28.231C10.156 7.764 9.169 9.765 9.169 12c0 2.236.987 4.236 2.551 5.595.09.08.185.158.28.232.096-.074.189-.152.28-.232 1.563-1.359 2.551-3.359 2.551-5.595 0-2.235-.987-4.236-2.551-5.595-.09-.08-.184-.156-.28-.231z"/></svg>',pattern:/^5[1-5]|^2[2-7]/,gaps:[4,8,12],lengths:[16],code:"mastercard"},{name:"American Express",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>American Express</title><path d="M16.015 14.378c0-.32-.135-.496-.344-.622-.21-.12-.464-.135-.81-.135h-1.543v2.82h.675v-1.027h.72c.24 0 .39.024.478.125.12.13.104.38.104.55v.35h.66v-.555c-.002-.25-.017-.376-.108-.516-.06-.08-.18-.18-.33-.234l.02-.008c.18-.072.48-.297.48-.747zm-.87.407l-.028-.002c-.09.053-.195.058-.33.058h-.81v-.63h.824c.12 0 .24 0 .33.05.098.048.156.147.15.255 0 .12-.045.215-.134.27zM20.297 15.837H19v.6h1.304c.676 0 1.05-.278 1.05-.884 0-.28-.066-.448-.187-.582-.153-.133-.392-.193-.73-.207l-.376-.015c-.104 0-.18 0-.255-.03-.09-.03-.15-.105-.15-.21 0-.09.017-.166.09-.21.083-.046.177-.066.272-.06h1.23v-.602h-1.35c-.704 0-.958.437-.958.84 0 .9.776.855 1.407.87.104 0 .18.015.225.06.046.03.082.106.082.18 0 .077-.035.15-.08.18-.06.053-.15.07-.277.07zM0 0v10.096L.81 8.22h1.75l.225.464V8.22h2.043l.45 1.02.437-1.013h6.502c.295 0 .56.057.756.236v-.23h1.787v.23c.307-.17.686-.23 1.12-.23h2.606l.24.466v-.466h1.918l.254.465v-.466h1.858v3.948H20.87l-.36-.6v.585h-2.353l-.256-.63h-.583l-.27.614h-1.213c-.48 0-.84-.104-1.08-.24v.24h-2.89v-.884c0-.12-.03-.12-.105-.135h-.105v1.036H6.067v-.48l-.21.48H4.69l-.202-.48v.465H2.235l-.256-.624H1.4l-.256.624H0V24h23.786v-7.108c-.27.135-.613.18-.973.18H21.09v-.255c-.21.165-.57.255-.914.255H14.71v-.9c0-.12-.018-.12-.12-.12h-.075v1.022h-1.8v-1.066c-.298.136-.643.15-.928.136h-.214v.915h-2.18l-.54-.617-.57.6H4.742v-3.93h3.61l.518.602.554-.6h2.412c.28 0 .74.03.942.225v-.24h2.177c.202 0 .644.045.903.225v-.24h3.265v.24c.163-.164.508-.24.803-.24h1.89v.24c.194-.15.464-.24.84-.24h1.176V0H0zM21.156 14.955c.004.005.006.012.01.016.01.01.024.01.032.02l-.042-.035zM23.828 13.082h.065v.555h-.065zM23.865 15.03v-.005c-.03-.025-.046-.048-.075-.07-.15-.153-.39-.215-.764-.225l-.36-.012c-.12 0-.194-.007-.27-.03-.09-.03-.15-.105-.15-.21 0-.09.03-.16.09-.204.076-.045.15-.05.27-.05h1.223v-.588h-1.283c-.69 0-.96.437-.96.84 0 .9.78.855 1.41.87.104 0 .18.015.224.06.046.03.076.106.076.18 0 .07-.034.138-.09.18-.045.056-.136.07-.27.07h-1.288v.605h1.287c.42 0 .734-.118.9-.36h.03c.09-.134.135-.3.135-.523 0-.24-.045-.39-.135-.526zM18.597 14.208v-.583h-2.235V16.458h2.235v-.585h-1.57v-.57h1.533v-.584h-1.532v-.51M13.51 8.787h.685V11.6h-.684zM13.126 9.543l-.007.006c0-.314-.13-.5-.34-.624-.217-.125-.47-.135-.81-.135H10.43v2.82h.674v-1.034h.72c.24 0 .39.03.487.12.122.136.107.378.107.548v.354h.677v-.553c0-.25-.016-.375-.11-.516-.09-.107-.202-.19-.33-.237.172-.07.472-.3.472-.75zm-.855.396h-.015c-.09.054-.195.056-.33.056H11.1v-.623h.825c.12 0 .24.004.33.05.09.04.15.128.15.25s-.047.22-.134.266zM15.92 9.373h.632v-.6h-.644c-.464 0-.804.105-1.02.33-.286.3-.362.69-.362 1.11 0 .512.123.833.36 1.074.232.238.645.31.97.31h.78l.255-.627h1.39l.262.627h1.36v-2.11l1.272 2.11h.95l.002.002V8.786h-.684v1.963l-1.18-1.96h-1.02V11.4L18.11 8.744h-1.004l-.943 2.22h-.3c-.177 0-.362-.03-.468-.134-.125-.15-.186-.36-.186-.662 0-.285.08-.51.194-.63.133-.135.272-.165.516-.165zm1.668-.108l.464 1.118v.002h-.93l.466-1.12zM2.38 10.97l.254.628H4V9.393l.972 2.205h.584l.973-2.202.015 2.202h.69v-2.81H6.118l-.807 1.904-.876-1.905H3.343v2.663L2.205 8.787h-.997L.01 11.597h.72l.26-.626h1.39zm-.688-1.705l.46 1.118-.003.002h-.915l.457-1.12zM11.856 13.62H9.714l-.85.923-.825-.922H5.346v2.82H8l.855-.932.824.93h1.302v-.94h.838c.6 0 1.17-.164 1.17-.945l-.006-.003c0-.78-.598-.93-1.128-.93zM7.67 15.853l-.014-.002H6.02v-.557h1.47v-.574H6.02v-.51H7.7l.733.82-.764.824zm2.642.33l-1.03-1.147 1.03-1.108v2.253zm1.553-1.258h-.885v-.717h.885c.24 0 .42.098.42.344 0 .243-.15.372-.42.372zM9.967 9.373v-.586H7.73V11.6h2.237v-.58H8.4v-.564h1.527V9.88H8.4v-.507"/></svg>',pattern:/^3[47]/,gaps:[4,10],lengths:[15],code:"amex"},{name:"Discover",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Discover</title><path d="M14.58 12a2.023 2.023 0 1 1-2.025-2.023h.002c1.118 0 2.023.906 2.023 2.023zm-5.2-2.001c-1.124 0-2.025.884-2.025 1.99 0 1.118.878 1.984 2.007 1.984.319 0 .593-.063.93-.221v-.873c-.296.297-.559.416-.895.416-.747 0-1.277-.542-1.277-1.312 0-.73.547-1.306 1.243-1.306.354 0 .622.126.93.428v-.873a1.898 1.898 0 0 0-.913-.233zm-3.352 1.545c-.445-.165-.576-.273-.576-.479 0-.239.233-.422.553-.422.222 0 .405.091.598.308l.388-.508a1.665 1.665 0 0 0-1.117-.422c-.673 0-1.186.467-1.186 1.089 0 .524.239.792.936 1.043.291.103.438.171.513.217a.456.456 0 0 1 .222.394c0 .308-.245.536-.576.536-.354 0-.639-.177-.809-.507l-.479.461c.342.502.752.724 1.317.724.771 0 1.311-.513 1.311-1.249-.002-.603-.252-.876-1.095-1.185zM24 10.3a.29.29 0 0 1-.288.291.29.29 0 0 1-.291-.291v-.003A.29.29 0 1 1 24 10.3zm-.059.001a.235.235 0 0 0-.231-.239.234.234 0 0 0-.232.239c0 .132.104.239.232.239a.235.235 0 0 0 .231-.239zM3.472 13.887h.742v-3.803h-.742v3.803zm12.702-1.248l-1.014-2.554h-.81l1.614 3.9h.399l1.643-3.9h-.804l-1.028 2.554zm2.166 1.248h2.104v-.644h-1.362v-1.027h1.312v-.644h-1.312v-.844h1.362v-.644H18.34v3.803zm5.409-3.557l.11.138h-.097l-.094-.13v.13h-.08v-.334h.107c.081 0 .126.036.126.103.001.046-.025.08-.072.093zm-.006-.092c0-.029-.021-.043-.06-.043h-.014v.087h.014c.039 0 .06-.014.06-.044zm-1.228 2.047l1.197 1.602H22.8l-1.027-1.528h-.097v1.528h-.741v-3.803h1.1c.855 0 1.346.411 1.346 1.123 0 .583-.308.965-.866 1.078zm.103-1.038c0-.37-.251-.563-.713-.563h-.228v1.152h.217c.473-.001.724-.207.724-.589zm-19.487.742a1.91 1.91 0 0 1-.69 1.46c-.365.303-.781.439-1.357.439H.001v-3.803H1.09c1.202 0 2.041.781 2.041 1.904zm-.764-.006c0-.364-.154-.718-.411-.947-.245-.222-.536-.308-1.015-.308H.742v2.515h.199c.479 0 .782-.092 1.015-.302.256-.228.411-.593.411-.958z"/></svg>',pattern:/^6(?:011|5)/,gaps:[4,8,12],lengths:[16],code:"discover"},{name:"Diners Club",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Diners Club</title><path d="M16.506 11.982a6.026 6.026 0 0 0-3.866-5.618V17.6a6.025 6.025 0 0 0 3.866-5.618zM8.33 17.598V6.365a6.03 6.03 0 0 0-3.863 5.617 6.028 6.028 0 0 0 3.863 5.616zm2.156-15.113A9.497 9.497 0 0 0 .99 11.982a9.495 9.495 0 0 0 9.495 9.494c5.245 0 9.495-4.25 9.496-9.494a9.499 9.499 0 0 0-9.496-9.497Zm-.023 19.888C4.723 22.4 0 17.75 0 12.09 0 5.905 4.723 1.626 10.463 1.627h2.69C18.822 1.627 24 5.903 24 12.09c0 5.658-5.176 10.283-10.848 10.283"/></svg>',pattern:/^3[0689]/,gaps:[4,10],lengths:[14],code:"diners"},{name:"JCB",icon:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>JCB</title><path d="M13.05 9.8643c.9723.0736 1.7257.3671 2.3545.6843v-1.31s-1.2577-.3162-2.4408-.368c-4.1256-.1849-5.295 1.4344-5.295 3.1292 0 1.6947 1.1694 3.3145 5.295 3.1296 1.1831-.0536 2.4408-.3694 2.4408-.3694v-1.3086c-.6193.3081-1.3826.6107-2.3545.683-1.6793.1272-2.6898-.6907-2.6898-2.1342 0-1.4448 1.0105-2.2613 2.6898-2.1354m7.685 4.1223c-.0513.0105-.1581.02-.215.02h-1.8005V12.376H20.52c.0568 0 .1636.01.2149.02a.8056.8056 0 01.6325.7951c0 .4162-.2872.721-.6325.796zm-2.0155-4.0374h1.6325c.059 0 .1454.0077.1772.0137.3376.0572.6256.3307.6256.7392 0 .409-.288.6815-.626.7392a1.571 1.571 0 01-.1773.0137h-1.6311V9.9506zm3.4994 1.9856v-.0364c.9133-.1331 1.4149-.726 1.4149-1.4199 0-.8828-.7343-1.3916-1.7293-1.4416-.0772-.0032-.203-.011-.3044-.011h-5.3323v5.9467h5.7548c1.13 0 1.9774-.6043 1.9774-1.5466 0-.8701-.7724-1.4222-1.781-1.4917zm-17.8644.6788c0 .8787-.5906 1.5311-1.6656 1.5311-.917 0-1.8174-.2726-2.6889-.6938V14.76s1.4021.383 3.191.383c2.9714 0 3.8374-1.125 3.8374-2.529V9.0266H4.3541v3.5876Z"/></svg>',pattern:/^35/,gaps:[4,8,12],lengths:[16],code:"jcb"}];let b=At(null),y=rt(()=>ts(g.state.inputElement));function _(){return{value:qr(w),rawValue:qr(w),isValid:g.state.isValid,validationState:g.state.validationState,errorMessage:g.state.errorMessage,hasInteracted:g.state.hasInteracted,cardType:qr(b),formattedValue:qr(C)}}const w=rt(()=>r().replace(/\s/g,"")),C=rt(()=>function(e){const t=e.replace(/\D/g,""),r=x(t);if(!r)return t.replace(/(\d{4})/g,"$1 ").trim();let a="",n=0;for(const o of r.gaps)n<t.length&&(a+=t.slice(n,o)+" ",n=o);n<t.length&&(a+=t.slice(n));return a.trim()}(qr(w)));function x(e){for(const t of m)if(t.pattern.test(e))return t;return null}Zt(()=>{Bt(b,x(qr(w)),!0)});var E=qs(),S=Ht(E),k=e=>{var t=Ms(),r=Ht(t),n=Wt(r),o=e=>{va(e,Vs())};Ba(n,e=>{i()&&e(o)}),Re(t),ar(()=>{sn(t,"for",c()),Ca(r,`${a()??""} `)}),va(e,t)};Ba(S,e=>{a()&&e(k)});var T=Wt(S,2);let A;var I=Ht(T);an(I),I.__input=function(e){const t=e.target.value.replace(/\D/g,""),a=(null===qr(b)||void 0===qr(b)?void 0:qr(b).lengths[0])||19,n=t.slice(0,a);r(n),g.handlers.handleInput(e),qr(y).dispatch(is,_())},I.__change=function(e){g.handlers.handleChange(e),qr(y).dispatch(ls,_())},kn(I,e=>g.state.inputElement=e,()=>{var e;return null==(e=null==g?void 0:g.state)?void 0:e.inputElement});var B=Wt(I,2),N=e=>{var t=Os();Pa(Ht(t),()=>qr(b).icon),Re(t),ar(()=>sn(t,"title",qr(b).name)),va(e,t)};Ba(B,e=>{qr(b)&&e(N)}),Re(T);var R=Wt(T,2),z=e=>{var t=js(),r=Ht(t,!0);Re(t),ar(()=>{sn(t,"id",`${c()??""}-error`),Ca(r,g.computed.effectiveErrorMessage)}),va(e,t)};return Ba(R,e=>{g.computed.hasError&&e(z)}),Re(E),ar(e=>{Ga(E,1,`alviere-card-pan-input alviere-card-pan-input--${s()??""}`,"svelte-1k23f9f"),A=Ga(T,1,"alviere-card-pan-input__wrapper svelte-1k23f9f",null,A,e),sn(I,"id",c()),sn(I,"name",u()),sn(I,"placeholder",n()),I.disabled=o(),I.required=i(),I.readOnly=l(),sn(I,"autocomplete",v()),nn(I,qr(C)),sn(I,"aria-describedby",g.computed.hasError?`${c()}-error`:void 0)},[()=>({"alviere-card-pan-input__wrapper--focused":g.state.isFocused,"alviere-card-pan-input__wrapper--disabled":o(),"alviere-card-pan-input__wrapper--valid":"valid"===g.computed.effectiveValidationState,"alviere-card-pan-input__wrapper--invalid":"invalid"===g.computed.effectiveValidationState})]),ta("focus",I,function(e){g.handlers.handleFocus(e),qr(y).dispatch(ss,_())}),ta("blur",I,function(e){g.handlers.handleBlur(e),qr(y).dispatch(cs,_())}),va(e,E),qe({focus:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.blur()},isValid:function(){return g.state.isValid},getValidationError:function(){return g.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),g.state.inputElement&&(g.state.inputElement.value="")},select:function(){const e=g.state.inputElement;e&&"select"in e&&e.select()},setSelectionRange:function(e,t){const r=g.state.inputElement;r&&"setSelectionRange"in r&&r.setSelectionRange(e,t)},getCardType:function(){return qr(b)},getComponentMetadata:function(){return{name:"CardPanInput",type:"card",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getCardType"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Card Number"){a(e),wt()},get placeholder(){return n()},set placeholder(e="Card number"){n(e),wt()},get disabled(){return o()},set disabled(e=!1){o(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e="cc-number"){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()}})}function $s(e,t,r){qr(t).dispatch(vs,r())}ra(["input","change"]),customElements.define("alviere-card-pan-input",Un(Ks,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getCardType","getComponentMetadata"],!0));var Hs=ia('<span class="alviere-cvv-input__required svelte-1tfzsip">*</span>'),Gs=ia('<label class="alviere-cvv-input__label svelte-1tfzsip"> <!></label>'),Ws=ia('<div class="alviere-cvv-input__code-type svelte-1tfzsip"> </div>'),Ys=ia('<div class="alviere-cvv-input__error svelte-1tfzsip" role="alert"> </div>'),Qs=ia('<div><!> <div><input type="text" inputmode="numeric" class="alviere-cvv-input__input svelte-1tfzsip" spellcheck="false"/> <!></div> <!></div>');const Js={hash:"svelte-1tfzsip",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-cvv-input.svelte-1tfzsip {position:relative;width:100%;}.alviere-cvv-input__label.svelte-1tfzsip {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-cvv-input__required.svelte-1tfzsip {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-cvv-input__error.svelte-1tfzsip {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-cvv-input__wrapper.svelte-1tfzsip {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-cvv-input__wrapper--focused.svelte-1tfzsip {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-cvv-input__wrapper--disabled.svelte-1tfzsip {background:#f4f4f5;cursor:not-allowed;}.alviere-cvv-input__wrapper--readonly.svelte-1tfzsip {background:#f4f4f5;cursor:default;}.alviere-cvv-input__wrapper--valid.svelte-1tfzsip {border-color:#436b1d;}.alviere-cvv-input__wrapper--invalid.svelte-1tfzsip {border-color:#b3311f;}.alviere-cvv-input__input.svelte-1tfzsip {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-cvv-input__input.svelte-1tfzsip::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;}.alviere-cvv-input__input.svelte-1tfzsip:disabled {cursor:not-allowed;color:#52525b;}.alviere-cvv-input__input.svelte-1tfzsip:read-only {cursor:default;color:#3f3f46;}.alviere-cvv-input__validation-messages.svelte-1tfzsip {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-cvv-input--sm.svelte-1tfzsip .alviere-cvv-input__wrapper:where(.svelte-1tfzsip) {min-height:2.5rem;}.alviere-cvv-input--sm.svelte-1tfzsip .alviere-cvv-input__input:where(.svelte-1tfzsip) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-cvv-input--sm.svelte-1tfzsip .alviere-cvv-input__label:where(.svelte-1tfzsip) {font-size:1rem;}.alviere-cvv-input--md.svelte-1tfzsip .alviere-cvv-input__wrapper:where(.svelte-1tfzsip) {min-height:3.25rem;}.alviere-cvv-input--md.svelte-1tfzsip .alviere-cvv-input__input:where(.svelte-1tfzsip) {font-size:1rem;}.alviere-cvv-input--lg.svelte-1tfzsip .alviere-cvv-input__wrapper:where(.svelte-1tfzsip) {min-height:3.75rem;}.alviere-cvv-input--lg.svelte-1tfzsip .alviere-cvv-input__input:where(.svelte-1tfzsip) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-cvv-input--lg.svelte-1tfzsip .alviere-cvv-input__label:where(.svelte-1tfzsip) {font-size:1.25rem;}.alviere-cvv-input.svelte-1tfzsip:focus-within .alviere-cvv-input__wrapper:where(.svelte-1tfzsip):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-cvv-input__input.svelte-1tfzsip {text-align:center;letter-spacing:0.125em;}.alviere-cvv-input__input.svelte-1tfzsip::placeholder {letter-spacing:0.125em;}.alviere-cvv-input__code-type.svelte-1tfzsip {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#f4f4f5;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;font-weight:600;text-transform:uppercase;letter-spacing:0.05em;}.alviere-cvv-input--sm.svelte-1tfzsip .alviere-cvv-input__code-type:where(.svelte-1tfzsip) {font-size:1rem;padding:0.125rem 0.375rem;}.alviere-cvv-input--lg.svelte-1tfzsip .alviere-cvv-input__code-type:where(.svelte-1tfzsip) {font-size:1.125rem;padding:0.375rem 0.625rem;}.alviere-cvv-input.svelte-1tfzsip .alviere-cvv-input__input:where(.svelte-1tfzsip) {user-select:none;}'};function Xs(e,t){je(t,!0),Oa(e,Js);let r=zn(t,"value",15,""),a=zn(t,"label",15,"Security Code"),n=zn(t,"placeholder",15,"123"),o=zn(t,"disabled",15,!1),i=zn(t,"required",15,!1),l=zn(t,"readonly",15,!1),s=zn(t,"size",15,"md"),c=zn(t,"id",15,""),u=zn(t,"name",15,""),v=zn(t,"autocomplete",15,"cc-csc"),d=zn(t,"validationState",15,"neutral"),p=zn(t,"errorMessage",15,""),f=zn(t,"helpText",15,""),h=zn(t,"validationSchema",31,()=>Dt({})),g=zn(t,"cardType",15,"");const m=Jl({value:r(),required:i(),disabled:o(),readonly:l(),validationState:d(),errorMessage:p(),helpText:f(),label:a(),validationSchema:h(),componentName:"CardCVVInput",componentType:"cvv",customValidator:e=>{const t=Xl.cvv(e,g());if(t)return{isValid:!1,error:t};const r=Ps(e,h(),a());return{isValid:r.isValid,error:r.firstError}}});let b=At(""),y=rt(()=>ts(m.state.inputElement));function _(){return{value:qr(b),rawValue:qr(b),isValid:m.state.isValid,validationState:m.state.validationState,errorMessage:m.state.errorMessage,hasInteracted:m.state.hasInteracted,cardType:g()?{name:g(),icon:"",pattern:/.*/,gaps:[],lengths:[],code:g().toLowerCase()}:null,expectedLength:qr(C)().max}}let w=rt(()=>()=>{switch(g().toLowerCase()){case"amex":case"american express":return 4;default:return 3}}),C=rt(()=>()=>{switch(g().toLowerCase()){case"amex":case"american express":return{min:4,max:4};default:return{min:3,max:3}}}),x=rt(()=>()=>{switch(g().toLowerCase()){case"amex":case"american express":case"discover":return"CID";case"mastercard":return"CVC";default:return"CVV"}});Zt(()=>{if(g()){const e=qr(C)();n("1".repeat(e.max)),qr(b)&&(isValidState=validateCvv(qr(b)))}});var E=Qs(),S=Ht(E),k=e=>{var t=Gs(),r=Ht(t),n=Wt(r),o=e=>{va(e,Hs())};Ba(n,e=>{i()&&e(o)}),Re(t),ar(()=>{sn(t,"for",c()),Ca(r,`${a()??""} `)}),va(e,t)};Ba(S,e=>{a()&&e(k)});var T=Wt(S,2);let A;var I=Ht(T);an(I),I.__input=function(e){const t=e.target,a=t.value;m.actions.markAsInteracted();const n=a.replace(/\D/g,"").slice(0,qr(w)());Bt(b,n,!0),r(n),t.value=n,isValidState=validateCvv(n),qr(y).dispatch(us,_())},I.__change=[$s,y,_],kn(I,e=>m.state.inputElement=e,()=>{var e;return null==(e=null==m?void 0:m.state)?void 0:e.inputElement});var B=Wt(I,2),N=e=>{var t=Ws(),r=Ht(t,!0);Re(t),ar((e,a)=>{sn(t,"title",`${e??""} for ${g()??""}`),Ca(r,a)},[()=>qr(x)(),()=>qr(x)()]),va(e,t)};Ba(B,e=>{"CVV"!==qr(x)()&&e(N)}),Re(T);var R=Wt(T,2),z=e=>{var t=Ys(),r=Ht(t,!0);Re(t),ar(()=>{sn(t,"id",`${c()??""}-error`),Ca(r,m.computed.effectiveErrorMessage)}),va(e,t)};return Ba(R,e=>{m.computed.hasError&&e(z)}),Re(E),ar((e,t,a)=>{Ga(E,1,`alviere-cvv-input alviere-cvv-input--${s()??""}`,"svelte-1tfzsip"),A=Ga(T,1,"alviere-cvv-input__wrapper svelte-1tfzsip",null,A,e),sn(I,"id",c()),sn(I,"name",u()),sn(I,"placeholder",n()),I.disabled=o(),I.required=i(),I.readOnly=l(),sn(I,"autocomplete",v()),nn(I,r()),sn(I,"maxlength",t),sn(I,"aria-describedby",m.computed.hasError?`${c()}-error`:void 0),sn(I,"aria-label",`${a??""} security code`)},[()=>({"alviere-cvv-input__wrapper--focused":m.state.isFocused,"alviere-cvv-input__wrapper--disabled":o(),"alviere-cvv-input__wrapper--valid":"valid"===m.computed.effectiveValidationState,"alviere-cvv-input__wrapper--invalid":"invalid"===m.computed.effectiveValidationState}),()=>qr(w)(),()=>qr(x)()]),ta("focus",I,function(){m.handlers.handleFocus(),qr(y).dispatch(ds,_())}),ta("blur",I,function(){m.handlers.handleBlur(),qr(y).dispatch(ps,_())}),va(e,E),qe({focus:function(){var e;null===(e=m.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=m.state.inputElement)||void 0===e||e.blur()},isValid:function(){return m.state.isValid},getValidationError:function(){return m.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),Bt(b,""),isValidState=!1,m.state.inputElement&&(m.state.inputElement.value="")},select:function(){m.state.inputElement&&"select"in m.state.inputElement&&m.state.inputElement.select()},setSelectionRange:function(e,t){m.state.inputElement&&"setSelectionRange"in m.state.inputElement&&m.state.inputElement.setSelectionRange(e,t)},getExpectedLength:function(){return qr(C)()},isValidCvv:function(){return isValidState},getComponentMetadata:function(){return{name:"CardCVVInput",type:"cvv",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getExpectedLength","isValidCvv"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Security Code"){a(e),wt()},get placeholder(){return n()},set placeholder(e="123"){n(e),wt()},get disabled(){return o()},set disabled(e=!1){o(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e="cc-csc"){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()},get cardType(){return g()},set cardType(e=""){g(e),wt()}})}function Zs(e,t,r){qr(t).dispatch(hs,r())}ra(["input","change"]),customElements.define("alviere-card-cvv-input",Un(Xs,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},cardType:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getExpectedLength","isValidCvv","getComponentMetadata"],!0));var ec=ia('<span class="alviere-exp-input__required svelte-1ffesfg">*</span>'),tc=ia('<label class="alviere-exp-input__label svelte-1ffesfg"> <!></label>'),rc=ia('<div class="alviere-exp-input__error svelte-1ffesfg" role="alert"> </div>'),ac=ia('<div><!> <div><input type="text" inputmode="numeric" maxlength="5" class="alviere-exp-input__input svelte-1ffesfg" spellcheck="false" aria-label="Card expiry date (MM/YY format)"/> <div class="alviere-exp-input__format-hint svelte-1ffesfg" title="MM/YY format">MM/YY</div></div> <!></div>');const nc={hash:"svelte-1ffesfg",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-exp-input.svelte-1ffesfg {position:relative;width:100%;}.alviere-exp-input__label.svelte-1ffesfg {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-exp-input__required.svelte-1ffesfg {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-exp-input__error.svelte-1ffesfg {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-exp-input__wrapper.svelte-1ffesfg {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-exp-input__wrapper--focused.svelte-1ffesfg {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-exp-input__wrapper--disabled.svelte-1ffesfg {background:#f4f4f5;cursor:not-allowed;}.alviere-exp-input__wrapper--readonly.svelte-1ffesfg {background:#f4f4f5;cursor:default;}.alviere-exp-input__wrapper--valid.svelte-1ffesfg {border-color:#436b1d;}.alviere-exp-input__wrapper--invalid.svelte-1ffesfg {border-color:#b3311f;}.alviere-exp-input__input.svelte-1ffesfg {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-exp-input__input.svelte-1ffesfg::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;}.alviere-exp-input__input.svelte-1ffesfg:disabled {cursor:not-allowed;color:#52525b;}.alviere-exp-input__input.svelte-1ffesfg:read-only {cursor:default;color:#3f3f46;}.alviere-exp-input__validation-messages.svelte-1ffesfg {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-exp-input--sm.svelte-1ffesfg .alviere-exp-input__wrapper:where(.svelte-1ffesfg) {min-height:2.5rem;}.alviere-exp-input--sm.svelte-1ffesfg .alviere-exp-input__input:where(.svelte-1ffesfg) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-exp-input--sm.svelte-1ffesfg .alviere-exp-input__label:where(.svelte-1ffesfg) {font-size:1rem;}.alviere-exp-input--md.svelte-1ffesfg .alviere-exp-input__wrapper:where(.svelte-1ffesfg) {min-height:3.25rem;}.alviere-exp-input--md.svelte-1ffesfg .alviere-exp-input__input:where(.svelte-1ffesfg) {font-size:1rem;}.alviere-exp-input--lg.svelte-1ffesfg .alviere-exp-input__wrapper:where(.svelte-1ffesfg) {min-height:3.75rem;}.alviere-exp-input--lg.svelte-1ffesfg .alviere-exp-input__input:where(.svelte-1ffesfg) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-exp-input--lg.svelte-1ffesfg .alviere-exp-input__label:where(.svelte-1ffesfg) {font-size:1.25rem;}.alviere-exp-input.svelte-1ffesfg:focus-within .alviere-exp-input__wrapper:where(.svelte-1ffesfg):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-exp-input__input.svelte-1ffesfg {text-align:center;letter-spacing:0.1em;min-width:4rem;}.alviere-exp-input__input.svelte-1ffesfg::placeholder {letter-spacing:0.1em;opacity:0.7;}.alviere-exp-input__format-hint.svelte-1ffesfg {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#f4f4f5;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;color:#52525b;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;letter-spacing:0.05em;opacity:0.8;}.alviere-exp-input--sm.svelte-1ffesfg .alviere-exp-input__format-hint:where(.svelte-1ffesfg) {font-size:1rem;padding:0.125rem 0.375rem;}.alviere-exp-input--lg.svelte-1ffesfg .alviere-exp-input__format-hint:where(.svelte-1ffesfg) {font-size:1.125rem;padding:0.375rem 0.625rem;}.alviere-exp-input__wrapper--focused.svelte-1ffesfg .alviere-exp-input__format-hint:where(.svelte-1ffesfg) {opacity:0.5;transform:scale(0.9);transition:opacity 150ms ease-in-out, transform 150ms ease-in-out;}.alviere-exp-input__validation-icon.svelte-1ffesfg {\n animation: svelte-1ffesfg-fadeIn 0.2s ease-in-out;}\n@keyframes svelte-1ffesfg-fadeIn {\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}'};function oc(e,t){je(t,!0),Oa(e,nc);let r=zn(t,"value",15,""),a=zn(t,"label",15,"Expiry Date"),n=zn(t,"placeholder",15,"MM/YY"),o=zn(t,"disabled",15,!1),i=zn(t,"required",15,!1),l=zn(t,"readonly",15,!1),s=zn(t,"size",15,"md"),c=zn(t,"id",15,""),u=zn(t,"name",15,""),v=zn(t,"autocomplete",15,"cc-exp"),d=zn(t,"validationState",15,"neutral"),p=zn(t,"errorMessage",15,""),f=zn(t,"helpText",15,""),h=zn(t,"validationSchema",31,()=>Dt({}));const g=Jl({value:r(),required:i(),disabled:o(),readonly:l(),validationState:d(),errorMessage:p(),helpText:f(),label:a(),validationSchema:h(),componentName:"CardExpInput",componentType:"expiry",customValidator:e=>{const t=Xl.creditCardExpiry(e);if(t)return{isValid:!1,error:t};const r=Ps(e,h(),a());return{isValid:r.isValid,error:r.firstError}}});let m=At(""),b=rt(()=>ts(g.state.inputElement));function y(){return{value:r(),rawValue:qr(m),isValid:g.state.isValid,validationState:g.state.validationState,errorMessage:g.state.errorMessage,hasInteracted:g.state.hasInteracted,month:qr(_)(),year:qr(w)(),formattedValue:r()}}let _=rt(()=>()=>{const e=qr(m).replace(/\D/g,"");return e.length>=2?e.slice(0,2):""}),w=rt(()=>()=>{const e=qr(m).replace(/\D/g,"");return e.length>=3?e.slice(2,4):""});function C(e,t){setTimeout(()=>{e.setSelectionRange(t,t)},0)}var x=ac(),E=Ht(x),S=e=>{var t=tc(),r=Ht(t),n=Wt(r),o=e=>{va(e,ec())};Ba(n,e=>{i()&&e(o)}),Re(t),ar(()=>{sn(t,"for",c()),Ca(r,`${a()??""} `)}),va(e,t)};Ba(E,e=>{a()&&e(S)});var k=Wt(E,2);let T;var A=Ht(k);an(A),A.__input=function(e){const t=e.target,a=t.value,n=t.selectionStart||0;g.actions.markAsInteracted();const o=function(e){const t=e.replace(/\D/g,"");return 0===t.length?"":t.length<=2?t:t.length<=4?`${t.slice(0,2)}/${t.slice(2)}`:`${t.slice(0,2)}/${t.slice(2,4)}`}(a),i=a.replace(/\D/g,"");Bt(m,i,!0),r(o),t.value=o;let l=n;3===i.length&&4===o.length&&3===n&&(l=4),i.length>=3&&2===n&&o.includes("/")&&(l=4),C(t,Math.min(l,o.length)),isValidState=validateExpiry(o),qr(b).dispatch(fs,y())},A.__keydown=function(e){const t=e.target,a=t.selectionStart||0,n=t.value;if("Backspace"===e.key&&3===a&&"/"===n[2]){e.preventDefault();const a=n.slice(0,2);return t.value=a,r(a),Bt(m,a.replace(/\D/g,""),!0),C(t,2),void(isValidState=validateExpiry(a))}n.length>=5&&"Backspace"!==e.key&&"Delete"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key&&"Tab"!==e.key&&e.preventDefault()},A.__change=[Zs,b,y],kn(A,e=>g.state.inputElement=e,()=>{var e;return null==(e=null==g?void 0:g.state)?void 0:e.inputElement}),ze(2),Re(k);var I=Wt(k,2),B=e=>{var t=rc(),r=Ht(t,!0);Re(t),ar(()=>{sn(t,"id",`${c()??""}-error`),Ca(r,g.computed.effectiveErrorMessage)}),va(e,t)};return Ba(I,e=>{g.computed.hasError&&e(B)}),Re(x),ar(e=>{Ga(x,1,`alviere-exp-input alviere-exp-input--${s()??""}`,"svelte-1ffesfg"),T=Ga(k,1,"alviere-exp-input__wrapper svelte-1ffesfg",null,T,e),sn(A,"id",c()),sn(A,"name",u()),sn(A,"placeholder",n()),A.disabled=o(),A.required=i(),A.readOnly=l(),sn(A,"autocomplete",v()),nn(A,r()),sn(A,"aria-describedby",g.computed.hasError?`${c()}-error`:void 0)},[()=>({"alviere-exp-input__wrapper--focused":g.state.isFocused,"alviere-exp-input__wrapper--disabled":o(),"alviere-exp-input__wrapper--valid":"valid"===g.computed.effectiveValidationState,"alviere-exp-input__wrapper--invalid":"invalid"===g.computed.effectiveValidationState})]),ta("focus",A,function(){g.handlers.handleFocus(),qr(b).dispatch(gs,y())}),ta("blur",A,function(){g.handlers.handleBlur(),qr(b).dispatch(ms,y())}),va(e,x),qe({focus:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=g.state.inputElement)||void 0===e||e.blur()},isValid:function(){return g.state.isValid},getValidationError:function(){return g.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),Bt(m,""),isValidState=!1,g.state.inputElement&&(g.state.inputElement.value="")},select:function(){g.state.inputElement&&"select"in g.state.inputElement&&g.state.inputElement.select()},setSelectionRange:function(e,t){g.state.inputElement&&"setSelectionRange"in g.state.inputElement&&g.state.inputElement.setSelectionRange(e,t)},getMonth:function(){return qr(_)()},getYear:function(){return qr(w)()},getExpiryDate:function(){return{month:qr(_)(),year:qr(w)()}},isValidExpiry:function(){return isValidState},getComponentMetadata:function(){return{name:"CardExpInput",type:"expiry",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getMonth","getYear","getExpiryDate","isValidExpiry"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Expiry Date"){a(e),wt()},get placeholder(){return n()},set placeholder(e="MM/YY"){n(e),wt()},get disabled(){return o()},set disabled(e=!1){o(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e="cc-exp"){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()}})}function ic(e,t,r,a={}){const{buttonSelectors:n=[],delay:o=0}=a;return function(e,t,r={}){const{enabled:a=!0,excludeSelectors:n=[],excludeElements:o=[],delay:i=0}=r;Zt(()=>{if(a&&e&&"undefined"!=typeof window){const t=e.getRootNode(),a=[];return document.addEventListener("click",r),a.push({target:document,handler:r}),t&&t!==document&&(t.addEventListener("click",r),a.push({target:t,handler:r})),()=>{a.forEach(({target:e,handler:t})=>{e.removeEventListener("click",t)})}}function r(r){const a=r.target;a&&(a===e||e.contains(a)||n.some(e=>a.closest(e))||o.some(e=>e&&(a===e||e.contains(a)))||(i>0?setTimeout(t,i):t()))}})}(t,r,{enabled:e,excludeElements:[t],excludeSelectors:n,delay:o})}ra(["input","keydown","change"]),customElements.define("alviere-card-exp-input",Un(oc,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getMonth","getYear","getExpiryDate","isValidExpiry","getComponentMetadata"],!0));const lc={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},sc=([e,t,r])=>{const a=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(t).forEach(e=>{a.setAttribute(e,String(t[e]))}),(null==r?void 0:r.length)&&r.forEach(e=>{const t=sc(e);a.appendChild(t)}),a},cc=(e,t={})=>{const r={...lc,...t};return sc(["svg",r,e])},uc=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]],vc=[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]],dc=[["path",{d:"M20 6 9 17l-5-5"}]],pc=[["path",{d:"m6 9 6 6 6-6"}]],fc=[["path",{d:"m9 18 6-6-6-6"}]],hc=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]],gc=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]],mc=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]],bc=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var yc=ia('<label class="alviere-text-input__label svelte-g5bopv"> </label>'),_c=ia('<textarea class="alviere-text-input__textarea svelte-g5bopv" spellcheck="true"></textarea>'),wc=ia('<input class="alviere-text-input__input svelte-g5bopv" spellcheck="true"/>'),Cc=(e,t)=>{e.stopPropagation(),Bt(t,!qr(t))},xc=sa('<svg height="1.5em" width="1.5em" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><path d="m2.707 1.293 7.17 7.17.002.002 1.504 1.504 7.21 7.21-.001-.001 4.115 4.115-1.414 1.414-4.297-4.296C15.485 19.434 13.82 20 12 20c-2.959 0-5.461-1.46-7.51-3.85a16.59 16.59 0 0 1-1.796-2.56 12.546 12.546 0 0 1-.613-1.197L1.91 12l.17-.395c.11-.252.315-.668.618-1.195.5-.872 1.1-1.743 1.803-2.56.3-.349.614-.68.94-.993l-4.15-4.149zM6.856 8.27l-.256.252c-.199.2-.393.411-.581.63a14.7 14.7 0 0 0-1.843 2.718l-.069.13.145.275.179.322c.439.768.966 1.538 1.578 2.252C7.711 16.835 9.71 18 12 18c1.222 0 2.358-.334 3.426-.962l.123-.076-1.517-1.516A4 4 0 0 1 8.553 9.97zM12 4c2.959 0 5.461 1.46 7.51 3.849a16.59 16.59 0 0 1 1.796 2.56l.208.375c.126.234.228.437.306.603l.1.219.169.395-.17.395a12.7 12.7 0 0 1-.548 1.073c-.37.655-.8 1.318-1.292 1.963l-.302.385-1.553-1.26a14.947 14.947 0 0 0 1.404-2.07l.16-.289.104-.201-.144-.273-.178-.322a14.613 14.613 0 0 0-1.58-2.252C16.289 7.165 14.291 6 12.001 6c-.478 0-.942.05-1.395.151l-.337.085-.537-1.927A8.409 8.409 0 0 1 12 4zm-1.933 7.482-.036.166a2 2 0 0 0 2.321 2.321l.164-.038z" fill="currentcolor" fill-rule="evenodd"></path></svg>'),Ec=sa('<svg height="1.5em" width="1.5em" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><path d="M12 4c4.278 0 7.61 2.667 10 8-2.39 5.333-5.722 8-10 8s-7.61-2.667-10-8c2.39-5.333 5.722-8 10-8zm0 2c-4.41 0-6.707 4.479-7.699 5.999C5.295 13.518 7.604 18 12 18c4.41 0 6.707-4.479 7.699-5.999C18.705 10.482 16.396 6 12 6zm0 2c2.176 0 3.945 1.794 3.945 4s-1.77 4-3.945 4c-2.176 0-3.945-1.794-3.945-4S9.825 8 12 8zm0 2c-1.088 0-1.973.897-1.973 2s.885 2 1.973 2 1.973-.897 1.973-2-.885-2-1.973-2z" fill="currentcolor" fill-rule="evenodd"></path></svg>'),Sc=ia('<button type="button" class="alviere-text-input__reveal-button svelte-g5bopv"><!></button>'),kc=ia('<div class="alviere-text-input__character-count svelte-g5bopv"> </div>'),Tc=ia('<div class="alviere-text-input__required svelte-g5bopv">Required</div>'),Ac=ia('<div class="alviere-text-input__help svelte-g5bopv"><!> </div>'),Ic=ia('<div class="alviere-text-input__error svelte-g5bopv" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),Bc=ia('<div><div><!> <!> <!> <!> <!></div> <div class="alviere-text-input__validation-messages svelte-g5bopv"><!> <!></div></div>');const Nc={hash:"svelte-g5bopv",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-text-input.svelte-g5bopv {position:relative;width:100%;}.alviere-text-input__label.svelte-g5bopv {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-text-input__required.svelte-g5bopv {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-text-input__error.svelte-g5bopv {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-text-input__wrapper.svelte-g5bopv {position:relative;display:flex;align-items:flex-start;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-text-input__wrapper--focused.svelte-g5bopv {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-text-input__wrapper--focused.svelte-g5bopv .alviere-text-input__label:where(.svelte-g5bopv) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-text-input__wrapper--focused.svelte-g5bopv .alviere-text-input__input:where(.svelte-g5bopv)::placeholder {opacity:1;}.alviere-text-input__wrapper--dirty.svelte-g5bopv .alviere-text-input__label:where(.svelte-g5bopv) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-text-input__wrapper--disabled.svelte-g5bopv {background:#f4f4f5;cursor:not-allowed;}.alviere-text-input__wrapper--readonly.svelte-g5bopv {background:#f4f4f5;cursor:default;}.alviere-text-input__wrapper--valid.svelte-g5bopv {border-color:#436b1d;}.alviere-text-input__wrapper--invalid.svelte-g5bopv {border-color:#b3311f;}.alviere-text-input__input.svelte-g5bopv {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-text-input__input.svelte-g5bopv::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-text-input__input.svelte-g5bopv:disabled {cursor:not-allowed;color:#52525b;}.alviere-text-input__input.svelte-g5bopv:read-only {cursor:default;color:#3f3f46;}.alviere-text-input__validation-messages.svelte-g5bopv {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-text-input--sm.svelte-g5bopv .alviere-text-input__wrapper:where(.svelte-g5bopv) {min-height:2.5rem;}.alviere-text-input--sm.svelte-g5bopv .alviere-text-input__input:where(.svelte-g5bopv) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-text-input--sm.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-text-input--sm.svelte-g5bopv .alviere-text-input__label:where(.svelte-g5bopv) {font-size:1rem;}.alviere-text-input--md.svelte-g5bopv .alviere-text-input__wrapper:where(.svelte-g5bopv) {min-height:3.25rem;}.alviere-text-input--md.svelte-g5bopv .alviere-text-input__input:where(.svelte-g5bopv) {font-size:1rem;}.alviere-text-input--md.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {font-size:1.25rem;}.alviere-text-input--lg.svelte-g5bopv .alviere-text-input__wrapper:where(.svelte-g5bopv) {min-height:3.75rem;}.alviere-text-input--lg.svelte-g5bopv .alviere-text-input__input:where(.svelte-g5bopv) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-text-input--lg.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-text-input--lg.svelte-g5bopv .alviere-text-input__label:where(.svelte-g5bopv) {font-size:1.25rem;}.alviere-text-input.svelte-g5bopv:focus-within .alviere-text-input__wrapper:where(.svelte-g5bopv):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-text-input__wrapper--textarea.svelte-g5bopv {align-items:stretch;}.alviere-text-input__input.svelte-g5bopv, .alviere-text-input__textarea.svelte-g5bopv {resize:none;}.alviere-text-input__textarea.svelte-g5bopv {min-height:2.5rem;line-height:1.75rem;resize:vertical;}.alviere-text-input__character-count.svelte-g5bopv {position:absolute;bottom:0.25rem;right:0.25rem;font-size:1rem;color:#71717a;background:rgba(255, 255, 255, 0.9);padding:0.125rem 0.25rem;border-radius:0.125rem;pointer-events:none;}.alviere-text-input__help.svelte-g5bopv {margin-top:0.25rem;font-size:0.75rem;color:#71717a;line-height:1.25;display:flex;align-items:flex-start;gap:0.25rem;}.alviere-text-input__help.svelte-g5bopv svg {width:1rem;height:1rem;}.alviere-text-input__wrapper--textarea.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {min-height:3rem;padding-bottom:1.5rem;}.alviere-text-input__wrapper--textarea.alviere-text-input--sm.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {min-height:2.5rem;}.alviere-text-input__wrapper--textarea.alviere-text-input--lg.svelte-g5bopv .alviere-text-input__textarea:where(.svelte-g5bopv) {min-height:4rem;}.alviere-text-input__character-count.svelte-g5bopv {font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;font-weight:500;opacity:0.8;transition:opacity 150ms ease-in-out;}.alviere-text-input__wrapper--focused.svelte-g5bopv .alviere-text-input__character-count:where(.svelte-g5bopv) {opacity:1;}.alviere-text-input__wrapper--textarea--valid.svelte-g5bopv::after, .alviere-text-input__wrapper--textarea--invalid.svelte-g5bopv::after {top:0.5rem;transform:none;}.alviere-text-input__reveal-button.svelte-g5bopv {background:transparent;border:none;cursor:pointer;padding:0;margin:0;position:absolute;right:0.5rem;top:50%;transform:translateY(-50%);color:#71717a;}'};function Rc(e,t){je(t,!0),Oa(e,Nc);let r=zn(t,"value",15,""),a=zn(t,"label",15,""),n=zn(t,"placeholder",15,""),o=zn(t,"disabled",15,!1),i=zn(t,"required",15,!1),l=zn(t,"readonly",15,!1),s=zn(t,"size",15,"md"),c=zn(t,"id",15,""),u=zn(t,"name",15,""),v=zn(t,"autocomplete",15,""),d=zn(t,"validationState",15,"neutral"),p=zn(t,"errorMessage",15,""),f=zn(t,"helpText",15,""),h=zn(t,"validationSchema",31,()=>Dt({})),g=zn(t,"sensitive",15,!1),m=zn(t,"maxlength",15,void 0),b=zn(t,"minlength",15,void 0),y=zn(t,"oninput",15),_=zn(t,"onchange",15),w=zn(t,"onfocus",15),C=zn(t,"onblur",15),x=zn(t,"type",15,"text"),E=zn(t,"rows",15,3),S=zn(t,"cols",15,void 0),k=zn(t,"resize",15,"vertical"),T=zn(t,"blockPaste",15,!1);const A=Jl({get value(){return r()},required:i(),disabled:o(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),get validationSchema(){return h()},componentName:"TextInput",componentType:"text",customValidator:e=>{const t=Ps(e,h(),a(),e=>{var t;if(null===(t=h().match)||void 0===t?void 0:t.fieldRef){const e=h().match.fieldRef;if("function"==typeof e)return e();if(e&&"value"in e)return e.value||""}if(e&&"undefined"!=typeof document){const t=document.getElementById(e);if(t&&"value"in t)return t.value||""}return""});return{isValid:t.isValid,error:t.firstError}}}),I=cc(hc);let B=rt(()=>()=>r().length),R=At(!1),z=rt(()=>ts(A.state.inputElement));function L(){return{value:r(),rawValue:r(),isValid:A.state.isValid,validationState:A.state.validationState,errorMessage:A.state.errorMessage,characterCount:r().length,maxLength:m(),hasInteracted:A.state.hasInteracted}}function D(e){var t;const a=e.target.value;if(r(a),A.handlers.handleInput(e),c()&&(null===(t=h().match)||void 0===t?void 0:t.fieldId)){const e=new CustomEvent("field-value-changed",{detail:{fieldId:c(),value:a},bubbles:!0,composed:!0});"undefined"!=typeof document&&document.dispatchEvent(e)}qr(z).dispatch(rs,L()),y()&&(N.info("TextInput: oninput",e),y()(e))}function U(e){if(T())return e.preventDefault(),!1}function P(e){A.handlers.handleChange(e),qr(z).dispatch(as,L()),_()&&_()(e)}function V(e){A.handlers.handleFocus(e),qr(z).dispatch(ns,L()),w()&&w()(e)}function M(e){A.handlers.handleBlur(e),qr(z).dispatch(os,L()),C()&&C()(e)}Zt(()=>{ic(g()&&qr(R),A.state.inputElement,()=>{Bt(R,!1)},{buttonSelectors:[".alviere-text-input__reveal-button"]})}),Zt(()=>{var e;if("undefined"!=typeof window&&window.customElements){const r=null===(e=A.state.inputElement)||void 0===e?void 0:e.getRootNode(),a=null==r?void 0:r.host;if(a){const e=a.getAttributeNames(),r=a.getAttribute("validation-schema");if(r)try{h(JSON.parse(r))}catch(t){}const n={};e.includes("validate-email")&&(n.email=!0),e.includes("validate-phone")&&(n.phone=!0),e.includes("validate-url")&&(n.url=!0),e.includes("validate-numeric")&&(n.numeric=!0),e.includes("validate-alphabetic")&&(n.alphabetic=!0),e.includes("validate-alphanumeric")&&(n.alphanumeric=!0);const o=a.getAttribute("validate-postal-code");o&&(n.postalCode={country:o});const i=a.getAttribute("validate-pattern");if(i)try{n.pattern={regex:new RegExp(i)}}catch(t){}const l=a.getAttribute("validate-min-length");l&&(n.minLength=parseInt(l,10));const s=a.getAttribute("validate-max-length");if(s&&(n.maxLength=parseInt(s,10)),Object.keys(n).length>0&&0===Object.keys(h()).length&&h(n),e.includes("help-text")&&f(a.getAttribute("help-text")||""),e.includes("error-message")&&p(a.getAttribute("error-message")||""),e.includes("max-length")){const e=a.getAttribute("max-length");e&&m(parseInt(e,10))}if(e.includes("min-length")){const e=a.getAttribute("min-length");e&&b(parseInt(e,10))}}}}),Zt(()=>{if(h().match&&A.state.hasInteracted&&(h().match.fieldRef,h().match.fieldId&&"undefined"!=typeof document)){const e=e=>{var t,r;if((null===(t=e.detail)||void 0===t?void 0:t.fieldId)===(null===(r=h().match)||void 0===r?void 0:r.fieldId)&&A.state.inputElement){const e=new Event("input",{bubbles:!0});A.handlers.handleInput(e)}};return document.addEventListener("field-value-changed",e),()=>{document.removeEventListener("field-value-changed",e)}}});var O=Bc(),j=Ht(O);let q;var F=Ht(j),K=e=>{var t=yc(),r=Ht(t,!0);Re(t),ar(()=>{sn(t,"for",c()),Ca(r,a())}),va(e,t)};Ba(F,e=>{a()&&e(K)});var $=Wt(F,2),H=e=>{var t,a=_c();t=a,Ae&&null!==Kt(t)&&Yt(t),a.__input=D,a.__change=P,kn(a,e=>A.state.inputElement=e,()=>{var e;return null==(e=null==A?void 0:A.state)?void 0:e.inputElement}),ar(()=>{sn(a,"id",c()),sn(a,"name",u()),sn(a,"placeholder",n()),a.disabled=o(),a.readOnly=l(),a.required=i(),sn(a,"rows",E()),sn(a,"cols",S()),sn(a,"maxlength",m()),sn(a,"minlength",b()),sn(a,"autocomplete",v()||null),Ya(a,`resize: ${k()??""}`),sn(a,"aria-invalid","invalid"===A.computed.effectiveValidationState),sn(a,"aria-describedby",A.state.errorMessage?`${c()}-error`:f()?`${c()}-help`:void 0)}),ta("focus",a,V),ta("blur",a,M),ta("paste",a,U),Cn(a,r),va(e,a)},G=e=>{var t=wc();an(t),t.__input=D,t.__change=P,kn(t,e=>A.state.inputElement=e,()=>{var e;return null==(e=null==A?void 0:A.state)?void 0:e.inputElement}),ar(()=>{sn(t,"id",c()),sn(t,"name",u()),sn(t,"placeholder",A.state.isFocused?n():""),t.disabled=o(),t.readOnly=l(),t.required=i(),sn(t,"maxlength",m()),sn(t,"minlength",b()),sn(t,"autocomplete",v()||null),sn(t,"type",g()&&!qr(R)?"password":"text"),sn(t,"aria-invalid","invalid"===A.computed.effectiveValidationState),sn(t,"aria-describedby",A.state.errorMessage?`${c()}-error`:f()?`${c()}-help`:void 0)}),ta("focus",t,V),ta("blur",t,M),ta("paste",t,U),Cn(t,r),va(e,t)};Ba($,e=>{"textarea"===x()?e(H):e(G,!1)});var W=Wt($,2),Y=e=>{var t=Sc();t.__click=[Cc,R];var r=Ht(t),a=e=>{va(e,xc())},n=e=>{va(e,Ec())};Ba(r,e=>{qr(R)?e(a):e(n,!1)}),Re(t),va(e,t)};Ba(W,e=>{g()&&e(Y)});var Q=Wt(W,2),J=e=>{var t=kc(),r=Ht(t);Re(t),ar(()=>Ca(r,`${qr(B)??""}/${m()??""}`)),va(e,t)};Ba(Q,e=>{m()&&"textarea"===x()&&e(J)});var X=Wt(Q,2),Z=e=>{va(e,Tc())};Ba(X,e=>{i()&&"neutral"===A.computed.effectiveValidationState&&e(Z)}),Re(j);var ee=Wt(j,2),te=Ht(ee),re=e=>{var t=Ac(),r=Ht(t);Pa(r,()=>I.outerHTML);var a=Wt(r);Re(t),ar(()=>{sn(t,"id",`${c()??""}-help`),Ca(a,` ${f()??""}`)}),va(e,t)};Ba(te,e=>{f()&&!A.computed.hasError&&e(re)});var ae=Wt(te,2),ne=e=>{var t=Ic(),r=Wt(Ht(t));Re(t),ar(()=>{sn(t,"id",`${c()??""}-error`),Ca(r,` ${A.state.errorMessage??""}`)}),va(e,t)};return Ba(ae,e=>{"invalid"===A.state.validationState&&e(ne)}),Re(ee),Re(O),ar(e=>{Ga(O,1,`alviere-text-input alviere-text-input--${s()??""}`,"svelte-g5bopv"),q=Ga(j,1,"alviere-text-input__wrapper svelte-g5bopv",null,q,e)},[()=>({"alviere-text-input__wrapper--focused":A.state.isFocused,"alviere-text-input__wrapper--disabled":o(),"alviere-text-input__wrapper--readonly":l(),"alviere-text-input__wrapper--valid":"valid"===A.computed.effectiveValidationState,"alviere-text-input__wrapper--invalid":"invalid"===A.computed.effectiveValidationState,"alviere-text-input__wrapper--textarea":"textarea"===x(),"alviere-text-input__wrapper--dirty":""!==r()})]),va(e,O),qe({focus:function(){var e;null===(e=A.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=A.state.inputElement)||void 0===e||e.blur()},isValid:function(){return A.state.isValid},getValidationError:function(){return A.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),A.state.inputElement&&(A.state.inputElement.value="")},select:function(){const e=A.state.inputElement;e&&"select"in e&&e.select()},setSelectionRange:function(e,t){const r=A.state.inputElement;r&&"setSelectionRange"in r&&r.setSelectionRange(e,t)},getComponentMetadata:function(){return{name:"TextInput",type:"text",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!1,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e=""){a(e),wt()},get placeholder(){return n()},set placeholder(e=""){n(e),wt()},get disabled(){return o()},set disabled(e=!1){o(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e=""){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()},get sensitive(){return g()},set sensitive(e=!1){g(e),wt()},get maxlength(){return m()},set maxlength(e=void 0){m(e),wt()},get minlength(){return b()},set minlength(e=void 0){b(e),wt()},get oninput(){return y()},set oninput(e){y(e),wt()},get onchange(){return _()},set onchange(e){_(e),wt()},get onfocus(){return w()},set onfocus(e){w(e),wt()},get onblur(){return C()},set onblur(e){C(e),wt()},get type(){return x()},set type(e="text"){x(e),wt()},get rows(){return E()},set rows(e=3){E(e),wt()},get cols(){return S()},set cols(e=void 0){S(e),wt()},get resize(){return k()},set resize(e="vertical"){k(e),wt()},get blockPaste(){return T()},set blockPaste(e=!1){T(e),wt()}})}function zc(e){/[\d+]/.test(e.key)||["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)||e.preventDefault()}ra(["input","change","click"]),customElements.define("alviere-text-input",Un(Rc,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},sensitive:{},maxlength:{},minlength:{},oninput:{},onchange:{},onfocus:{},onblur:{},type:{},rows:{},cols:{},resize:{},blockPaste:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getComponentMetadata"],!0));var Lc=ia('<label class="alviere-phone-input__label svelte-1fmnaq1"> </label>'),Dc=ia('<span class="alviere-phone-input__character-count svelte-1fmnaq1"> </span>'),Uc=ia('<div class="alviere-phone-input__required svelte-1fmnaq1">Required</div>'),Pc=ia('<div class="alviere-phone-input__error svelte-1fmnaq1" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),Vc=ia('<div><div><!> <input type="tel"/> <!></div> <div class="alviere-phone-input__validation-messages svelte-1fmnaq1"><!> <!></div></div>');const Mc={hash:"svelte-1fmnaq1",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-phone-input.svelte-1fmnaq1 {position:relative;width:100%;}.alviere-phone-input__label.svelte-1fmnaq1 {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-phone-input__required.svelte-1fmnaq1 {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-phone-input__error.svelte-1fmnaq1 {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-phone-input__wrapper.svelte-1fmnaq1 {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-text-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-phone-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-date-of-birth-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-search-select__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-currency-input__label:where(.svelte-1fmnaq1) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-text-input__input:where(.svelte-1fmnaq1)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-phone-input__input:where(.svelte-1fmnaq1)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-date-of-birth-input__input:where(.svelte-1fmnaq1)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-search-select__input:where(.svelte-1fmnaq1)::placeholder,\n.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-currency-input__input:where(.svelte-1fmnaq1)::placeholder {opacity:1;}.alviere-phone-input__wrapper--dirty.svelte-1fmnaq1 .alviere-text-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--dirty.svelte-1fmnaq1 .alviere-phone-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--dirty.svelte-1fmnaq1 .alviere-date-of-birth-input__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--dirty.svelte-1fmnaq1 .alviere-search-select__label:where(.svelte-1fmnaq1),\n.alviere-phone-input__wrapper--dirty.svelte-1fmnaq1 .alviere-currency-input__label:where(.svelte-1fmnaq1) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-phone-input__wrapper--disabled.svelte-1fmnaq1 {background:#f4f4f5;cursor:not-allowed;}.alviere-phone-input__wrapper--readonly.svelte-1fmnaq1 {background:#f4f4f5;cursor:default;}.alviere-phone-input__wrapper--valid.svelte-1fmnaq1 {border-color:#436b1d;}.alviere-phone-input__wrapper--invalid.svelte-1fmnaq1 {border-color:#b3311f;}.alviere-phone-input__input.svelte-1fmnaq1 {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-phone-input__input.svelte-1fmnaq1::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-phone-input__input.svelte-1fmnaq1:disabled {cursor:not-allowed;color:#52525b;}.alviere-phone-input__input.svelte-1fmnaq1:read-only {cursor:default;color:#3f3f46;}.alviere-phone-input__validation-messages.svelte-1fmnaq1 {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-phone-input--sm.svelte-1fmnaq1 .alviere-phone-input__wrapper:where(.svelte-1fmnaq1) {min-height:2.5rem;}.alviere-phone-input--sm.svelte-1fmnaq1 .alviere-phone-input__input:where(.svelte-1fmnaq1) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-phone-input--sm.svelte-1fmnaq1 .alviere-phone-input__textarea:where(.svelte-1fmnaq1) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-phone-input--sm.svelte-1fmnaq1 .alviere-phone-input__label:where(.svelte-1fmnaq1) {font-size:1rem;}.alviere-phone-input--md.svelte-1fmnaq1 .alviere-phone-input__wrapper:where(.svelte-1fmnaq1) {min-height:3.25rem;}.alviere-phone-input--md.svelte-1fmnaq1 .alviere-phone-input__input:where(.svelte-1fmnaq1) {font-size:1rem;}.alviere-phone-input--md.svelte-1fmnaq1 .alviere-phone-input__textarea:where(.svelte-1fmnaq1) {font-size:1.25rem;}.alviere-phone-input--lg.svelte-1fmnaq1 .alviere-phone-input__wrapper:where(.svelte-1fmnaq1) {min-height:3.75rem;}.alviere-phone-input--lg.svelte-1fmnaq1 .alviere-phone-input__input:where(.svelte-1fmnaq1) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-phone-input--lg.svelte-1fmnaq1 .alviere-phone-input__textarea:where(.svelte-1fmnaq1) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-phone-input--lg.svelte-1fmnaq1 .alviere-phone-input__label:where(.svelte-1fmnaq1) {font-size:1.25rem;}.alviere-phone-input.svelte-1fmnaq1:focus-within .alviere-phone-input__wrapper:where(.svelte-1fmnaq1):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-phone-input__character-count.svelte-1fmnaq1 {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#f4f4f5;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;color:#52525b;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;letter-spacing:0.05em;opacity:0.8;}.alviere-exp-input--sm.svelte-1fmnaq1 .alviere-phone-input__character-count:where(.svelte-1fmnaq1) {font-size:1rem;padding:0.125rem 0.375rem;}.alviere-exp-input--lg.svelte-1fmnaq1 .alviere-phone-input__character-count:where(.svelte-1fmnaq1) {font-size:1.125rem;padding:0.375rem 0.625rem;}.alviere-phone-input__wrapper--focused.svelte-1fmnaq1 .alviere-phone-input__character-count:where(.svelte-1fmnaq1) {opacity:1;}.alviere-phone-input__success-message.svelte-1fmnaq1 {margin-top:0.25rem;font-size:1.125rem;color:#436b1d;line-height:1.25;}'};function Oc(e,t){je(t,!0),Oa(e,Mc);let r=zn(t,"value",15,""),a=zn(t,"label",15,"Phone Number"),n=zn(t,"placeholder",15,"Enter phone number"),o=zn(t,"disabled",15,!1),i=zn(t,"required",15,!1),l=zn(t,"readonly",15,!1),s=zn(t,"size",15,"md"),c=zn(t,"id",15,""),u=zn(t,"name",15,""),v=zn(t,"autocomplete",15,"tel"),d=zn(t,"validationState",15,"neutral"),p=zn(t,"errorMessage",15,""),f=zn(t,"helpText",15,""),h=zn(t,"validationSchema",31,()=>Dt({})),g=zn(t,"oninput",15),m=zn(t,"onchange",15),b=zn(t,"onfocus",15),y=zn(t,"onblur",15);const _=Jl({get value(){return r()},required:i(),disabled:o(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),validationSchema:h(),componentName:"PhoneInput",componentType:"phone",customValidator:e=>{const t=Xl.phone(e);if(t)return{isValid:!1,error:t};const r=Ps(e,h(),a());return{isValid:r.isValid,error:r.firstError}}});let w=rt(()=>r().length),C=rt(()=>ts(_.state.inputElement));function x(){return{value:r(),rawValue:r(),isValid:_.state.isValid,validationState:_.state.validationState,errorMessage:_.state.errorMessage,hasInteracted:_.state.hasInteracted,formattedValue:r(),countryCode:E(r())}}function E(e){if(!e||!e.startsWith("+"))return;const t=e.match(/^\+(\d{1,3})/);return t?t[1]:void 0}Aa(()=>{_.state.inputElement}),Zt(()=>{Bt(w,r().length)});const S=rt(()=>["alviere-phone-input__wrapper",""!==r()?"alviere-phone-input__wrapper--dirty":"",_.state.isFocused?"alviere-phone-input__wrapper--focused":"","invalid"===_.computed.effectiveValidationState?"alviere-phone-input__wrapper--invalid":"","valid"===_.computed.effectiveValidationState?"alviere-phone-input__wrapper--valid":"",o()?"alviere-phone-input__wrapper--disabled":""].filter(Boolean).join(" "));var k=Vc(),T=Ht(k),A=Ht(T),I=e=>{var t=Lc(),r=Ht(t,!0);Re(t),ar(()=>{sn(t,"for",c()||"phone-input"),Ca(r,a())}),va(e,t)};Ba(A,e=>{a()&&e(I)});var B=Wt(A,2);an(B),B.__input=function(e){N.info("PhoneInput: handleInput",e);const t=e.target;let a=t.value;if(a&&!a.startsWith("+")&&(a="+"+a),a.startsWith("+")){const e=a.substring(1);a="+"+e.replace(/[^\d]/g,"")}a.length>20&&(a=a.substring(0,20)),r(a),t.value=a,_.handlers.handleInput(e),qr(C).dispatch(bs,x()),g()&&(N.info("PhoneInput: oninput",e),g()(e))},B.__change=function(e){_.handlers.handleChange(e),N.info("PhoneInput: handleChange",e),qr(C).dispatch(ys,x()),m()&&m()({detail:{value:r()}})},B.__keydown=[zc],kn(B,e=>_.state.inputElement=e,()=>{var e;return null==(e=null==_?void 0:_.state)?void 0:e.inputElement});var R=Wt(B,2),z=e=>{var t=Dc(),r=Ht(t);Re(t),ar(()=>Ca(r,`${qr(w)??""}/20`)),va(e,t)};Ba(R,e=>{qr(w)>0&&e(z)}),Re(T);var L=Wt(T,2),D=Ht(L),U=e=>{va(e,Uc())};Ba(D,e=>{i()&&"neutral"===_.computed.effectiveValidationState&&e(U)});var P=Wt(D,2),V=e=>{var t=Pc(),r=Wt(Ht(t));Re(t),ar(()=>{sn(t,"id",`${c()||"pohne-input"}-error`),Ca(r,` ${_.state.errorMessage??""}`)}),va(e,t)};return Ba(P,e=>{"invalid"===_.state.validationState&&e(V)}),Re(L),Re(k),ar(()=>{Ga(k,1,`alviere-phone-input alviere-phone-input--${s()??""}`,"svelte-1fmnaq1"),Ga(T,1,Fa(qr(S)),"svelte-1fmnaq1"),sn(B,"id",c()||"phone-input"),sn(B,"name",u()),sn(B,"placeholder",_.state.isFocused?n():""),nn(B,r()),B.required=i(),B.disabled=o(),B.readOnly=l(),sn(B,"autocomplete",v()),Ga(B,1,`alviere-phone-input__input alviere-phone-input__input--${s()??""}`,"svelte-1fmnaq1"),sn(B,"aria-describedby",_.state.errorMessage?`${c()||"phone-input"}-error`:void 0)}),ta("focus",B,function(){_.handlers.handleFocus(),qr(C).dispatch(_s,x()),b()&&b()(event)}),ta("blur",B,function(e){_.handlers.handleBlur(e),qr(C).dispatch(ws,x()),y()&&y()(e)}),va(e,k),qe({focus:function(){var e;null===(e=_.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=_.state.inputElement)||void 0===e||e.blur()},isValid:function(){return _.state.isValid},getValidationError:function(){return _.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),_.state.inputElement&&(_.state.inputElement.value="")},select:function(){_.state.inputElement&&"select"in _.state.inputElement&&_.state.inputElement.select()},setSelectionRange:function(e,t){_.state.inputElement&&"setSelectionRange"in _.state.inputElement&&_.state.inputElement.setSelectionRange(e,t)},getFormattedValue:function(){return r()},getRawValue:function(){return r().replace(/\D/g,"")},getComponentMetadata:function(){return{name:"PhoneInput",type:"phone",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Phone Number"){a(e),wt()},get placeholder(){return n()},set placeholder(e="Enter phone number"){n(e),wt()},get disabled(){return o()},set disabled(e=!1){o(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e="tel"){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()},get oninput(){return g()},set oninput(e){g(e),wt()},get onchange(){return m()},set onchange(e){m(e),wt()},get onfocus(){return b()},set onfocus(e){b(e),wt()},get onblur(){return y()},set onblur(e){y(e),wt()}})}function jc(e,t,r,a){N.info("DateOfBirthInput: handleChange",event),qr(t).dispatch(as,r()),a()&&a()(event)}function qc(e){/[\d-]/.test(e.key)||["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)||e.preventDefault()}ra(["input","change","keydown"]),customElements.define("alviere-phone-input",Un(Oc,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},oninput:{},onchange:{},onfocus:{},onblur:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue","getComponentMetadata"],!0));var Fc=ia('<label class="alviere-date-of-birth-input__label svelte-1ky42oj"> </label>'),Kc=ia('<div class="alviere-date-of-birth-input__required svelte-1ky42oj">Required</div>'),$c=ia('<div class="alviere-date-of-birth-input__error svelte-1ky42oj" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),Hc=ia('<div><div><!> <input type="text" maxlength="10"/></div> <div class="alviere-date-of-birth-input__validation-messages svelte-1ky42oj"><!> <!></div></div>');const Gc={hash:"svelte-1ky42oj",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-date-of-birth-input.svelte-1ky42oj {position:relative;width:100%;}.alviere-date-of-birth-input__label.svelte-1ky42oj {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-date-of-birth-input__required.svelte-1ky42oj {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-date-of-birth-input__error.svelte-1ky42oj {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-date-of-birth-input__wrapper.svelte-1ky42oj {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-text-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-phone-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-date-of-birth-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-search-select__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-currency-input__label:where(.svelte-1ky42oj) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-text-input__input:where(.svelte-1ky42oj)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-phone-input__input:where(.svelte-1ky42oj)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-date-of-birth-input__input:where(.svelte-1ky42oj)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-search-select__input:where(.svelte-1ky42oj)::placeholder,\n.alviere-date-of-birth-input__wrapper--focused.svelte-1ky42oj .alviere-currency-input__input:where(.svelte-1ky42oj)::placeholder {opacity:1;}.alviere-date-of-birth-input__wrapper--dirty.svelte-1ky42oj .alviere-text-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ky42oj .alviere-phone-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ky42oj .alviere-date-of-birth-input__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ky42oj .alviere-search-select__label:where(.svelte-1ky42oj),\n.alviere-date-of-birth-input__wrapper--dirty.svelte-1ky42oj .alviere-currency-input__label:where(.svelte-1ky42oj) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-date-of-birth-input__wrapper--disabled.svelte-1ky42oj {background:#f4f4f5;cursor:not-allowed;}.alviere-date-of-birth-input__wrapper--readonly.svelte-1ky42oj {background:#f4f4f5;cursor:default;}.alviere-date-of-birth-input__wrapper--valid.svelte-1ky42oj {border-color:#436b1d;}.alviere-date-of-birth-input__wrapper--invalid.svelte-1ky42oj {border-color:#b3311f;}.alviere-date-of-birth-input__input.svelte-1ky42oj {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-date-of-birth-input__input.svelte-1ky42oj::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-date-of-birth-input__input.svelte-1ky42oj:disabled {cursor:not-allowed;color:#52525b;}.alviere-date-of-birth-input__input.svelte-1ky42oj:read-only {cursor:default;color:#3f3f46;}.alviere-date-of-birth-input__validation-messages.svelte-1ky42oj {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-date-of-birth-input--sm.svelte-1ky42oj .alviere-date-of-birth-input__wrapper:where(.svelte-1ky42oj) {min-height:2.5rem;}.alviere-date-of-birth-input--sm.svelte-1ky42oj .alviere-date-of-birth-input__input:where(.svelte-1ky42oj) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-date-of-birth-input--sm.svelte-1ky42oj .alviere-date-of-birth-input__textarea:where(.svelte-1ky42oj) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-date-of-birth-input--sm.svelte-1ky42oj .alviere-date-of-birth-input__label:where(.svelte-1ky42oj) {font-size:1rem;}.alviere-date-of-birth-input--md.svelte-1ky42oj .alviere-date-of-birth-input__wrapper:where(.svelte-1ky42oj) {min-height:3.25rem;}.alviere-date-of-birth-input--md.svelte-1ky42oj .alviere-date-of-birth-input__input:where(.svelte-1ky42oj) {font-size:1rem;}.alviere-date-of-birth-input--md.svelte-1ky42oj .alviere-date-of-birth-input__textarea:where(.svelte-1ky42oj) {font-size:1.25rem;}.alviere-date-of-birth-input--lg.svelte-1ky42oj .alviere-date-of-birth-input__wrapper:where(.svelte-1ky42oj) {min-height:3.75rem;}.alviere-date-of-birth-input--lg.svelte-1ky42oj .alviere-date-of-birth-input__input:where(.svelte-1ky42oj) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-date-of-birth-input--lg.svelte-1ky42oj .alviere-date-of-birth-input__textarea:where(.svelte-1ky42oj) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-date-of-birth-input--lg.svelte-1ky42oj .alviere-date-of-birth-input__label:where(.svelte-1ky42oj) {font-size:1.25rem;}.alviere-date-of-birth-input.svelte-1ky42oj:focus-within .alviere-date-of-birth-input__wrapper:where(.svelte-1ky42oj):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-date-of-birth-input__success-message.svelte-1ky42oj {color:#436b1d;font-size:0.875rem;margin-top:0.25rem;font-weight:500;}'};function Wc(e,t){je(t,!0),Oa(e,Gc);let r=zn(t,"value",15,""),a=zn(t,"label",15,"Date of Birth"),n=zn(t,"placeholder",15,"YYYY-MM-DD"),o=zn(t,"disabled",15,!1),i=zn(t,"required",15,!1),l=zn(t,"readonly",15,!1),s=zn(t,"size",15,"md"),c=zn(t,"id",15,""),u=zn(t,"name",15,""),v=zn(t,"autocomplete",15,"bday"),d=zn(t,"validationState",15,"neutral"),p=zn(t,"errorMessage",15,""),f=zn(t,"helpText",15,""),h=zn(t,"validationSchema",31,()=>Dt({})),g=zn(t,"oninput",15),m=zn(t,"onchange",15),b=zn(t,"onfocus",15),y=zn(t,"onblur",15);const _=Jl({get value(){return r()},required:i(),disabled:o(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),validationSchema:h(),componentName:"DateOfBirthInput",componentType:"date",customValidator:e=>{if(e&&10===e.length){const[t,r,a]=e.split("-").map(Number),n=new Date(t,r-1,a),o=new Date,i=o.getFullYear()-n.getFullYear();if(isNaN(n.getTime()))return{isValid:!1,error:"Please enter a valid date"};if(n>o)return{isValid:!1,error:"Date of birth cannot be in the future"};if(i<0)return{isValid:!1,error:"Must be at least 13 years old"}}const t=Ps(e,h(),a());return{isValid:t.isValid,error:t.firstError}}});let w=rt(()=>ts(_.state.inputElement));function C(){return{value:r(),rawValue:r(),isValid:_.state.isValid,validationState:_.state.validationState,errorMessage:_.state.errorMessage,hasInteracted:_.state.hasInteracted,characterCount:r().length,maxLength:10}}Aa(()=>{});const x=rt(()=>["alviere-date-of-birth-input__wrapper",_.state.isFocused?"alviere-date-of-birth-input__wrapper--focused":"",_.state.errorMessage?"alviere-date-of-birth-input__wrapper--invalid":"",!_.state.errorMessage&&r()&&10===r().length?"alviere-date-of-birth-input__wrapper--valid":"",o()?"alviere-date-of-birth-input__wrapper--disabled":"",""!==r()?"alviere-date-of-birth-input__wrapper--dirty":""].filter(Boolean).join(" "));function E(){return _.state.isValid}var S=Hc(),k=Ht(S),T=Ht(k),A=e=>{var t=Fc(),r=Ht(t,!0);Re(t),ar(()=>{sn(t,"for",c()||"date-of-birth-input"),Ca(r,a())}),va(e,t)};Ba(T,e=>{a()&&e(A)});var I=Wt(T,2);an(I),I.__input=function(e){const t=e.target;let a=t.value;a=a.replace(/[^\d-]/g,""),a.length>=4&&!a.includes("-")&&(a=a.substring(0,4)+"-"+a.substring(4)),a.length>=7&&2===a.split("-").length&&(a=a.substring(0,7)+"-"+a.substring(7)),a.length>10&&(a=a.substring(0,10)),r(a),t.value=a,_.handlers.handleInput(e),qr(w).dispatch(rs,C()),g()&&g()(e)},I.__change=[jc,w,C,m],I.__keydown=[qc],kn(I,e=>_.state.inputElement=e,()=>{var e;return null==(e=null==_?void 0:_.state)?void 0:e.inputElement}),Re(k);var B=Wt(k,2),N=Ht(B),R=e=>{va(e,Kc())};Ba(N,e=>{i()&&"neutral"===_.computed.effectiveValidationState&&e(R)});var z=Wt(N,2),L=e=>{var t=$c(),r=Wt(Ht(t));Re(t),ar(()=>{sn(t,"id",`${c()||"date-of-birth-input"}-error`),Ca(r,` ${_.state.errorMessage??""}`)}),va(e,t)};return Ba(z,e=>{"invalid"===_.state.validationState&&e(L)}),Re(B),Re(S),ar(()=>{Ga(S,1,`alviere-date-of-birth-input alviere-date-of-birth-input--${s()??""}`,"svelte-1ky42oj"),Ga(k,1,Fa(qr(x)),"svelte-1ky42oj"),sn(I,"id",c()||"date-of-birth-input"),sn(I,"name",u()),sn(I,"placeholder",_.state.isFocused?n():""),nn(I,r()),I.required=i(),I.disabled=o(),I.readOnly=l(),sn(I,"autocomplete",v()),Ga(I,1,`alviere-date-of-birth-input__input alviere-date-of-birth-input__input--${s()??""}`,"svelte-1ky42oj"),sn(I,"aria-describedby",_.state.errorMessage?`${c()||"date-of-birth-input"}-error`:void 0)}),ta("focus",I,function(e){_.handlers.handleFocus(),qr(w).dispatch(ns,C()),b()&&b()(e)}),ta("blur",I,function(){_.handlers.handleBlur(),qr(w).dispatch(os,C()),y()&&y()(event)}),va(e,S),qe({focus:function(){var e;null===(e=_.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=_.state.inputElement)||void 0===e||e.blur()},isValid:E,getValidationError:function(){return _.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),_.state.inputElement&&(_.state.inputElement.value="")},select:function(){_.state.inputElement&&"select"in _.state.inputElement&&_.state.inputElement.select()},setSelectionRange:function(e,t){_.state.inputElement&&"setSelectionRange"in _.state.inputElement&&_.state.inputElement.setSelectionRange(e,t)},getAge:function(){if(!r()||!E())return null;const e=new Date(r()),t=new Date;let a=t.getFullYear()-e.getFullYear();const n=t.getMonth()-e.getMonth();return(n<0||0===n&&t.getDate()<e.getDate())&&a--,a>=0?a:null},getDate:function(){return r()&&E()?new Date(r()):null},getComponentMetadata:function(){return{name:"DateOfBirthInput",type:"date",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getAge","getDate"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Date of Birth"){a(e),wt()},get placeholder(){return n()},set placeholder(e="YYYY-MM-DD"){n(e),wt()},get disabled(){return o()},set disabled(e=!1){o(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e="bday"){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()},get oninput(){return g()},set oninput(e){g(e),wt()},get onchange(){return m()},set onchange(e){m(e),wt()},get onfocus(){return b()},set onfocus(e){b(e),wt()},get onblur(){return y()},set onblur(e){y(e),wt()}})}function Yc(e,t,r,a){N.info("CurrencyInput: handleChange",e),qr(t).dispatch(as,r()),a()&&a()(e)}ra(["input","change","keydown"]),customElements.define("alviere-date-of-birth-input",Un(Wc,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},oninput:{},onchange:{},onfocus:{},onblur:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getAge","getDate","getComponentMetadata"],!0));var Qc=ia('<label class="alviere-currency-input__label svelte-arhdam"> </label>'),Jc=ia('<div class="alviere-currency-input__required svelte-arhdam">Required</div>'),Xc=ia('<div class="alviere-currency-input__error svelte-arhdam" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),Zc=ia('<div class="alviere-currency-input__help-text"> </div>'),eu=ia('<div><div><!> <input type="text" inputmode="numeric"/></div> <div class="alviere-currency-input__validation-messages svelte-arhdam"><!> <!> <!></div></div>');const tu={hash:"svelte-arhdam",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-currency-input.svelte-arhdam {position:relative;width:100%;}.alviere-currency-input__label.svelte-arhdam {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-currency-input__required.svelte-arhdam {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-currency-input__error.svelte-arhdam {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-currency-input__wrapper.svelte-arhdam {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-currency-input__wrapper--focused.svelte-arhdam {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-text-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-phone-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-date-of-birth-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-search-select__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-currency-input__label:where(.svelte-arhdam) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-text-input__input:where(.svelte-arhdam)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-phone-input__input:where(.svelte-arhdam)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-date-of-birth-input__input:where(.svelte-arhdam)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-search-select__input:where(.svelte-arhdam)::placeholder,\n.alviere-currency-input__wrapper--focused.svelte-arhdam .alviere-currency-input__input:where(.svelte-arhdam)::placeholder {opacity:1;}.alviere-currency-input__wrapper--dirty.svelte-arhdam .alviere-text-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--dirty.svelte-arhdam .alviere-phone-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--dirty.svelte-arhdam .alviere-date-of-birth-input__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--dirty.svelte-arhdam .alviere-search-select__label:where(.svelte-arhdam),\n.alviere-currency-input__wrapper--dirty.svelte-arhdam .alviere-currency-input__label:where(.svelte-arhdam) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-currency-input__wrapper--disabled.svelte-arhdam {background:#f4f4f5;cursor:not-allowed;}.alviere-currency-input__wrapper--readonly.svelte-arhdam {background:#f4f4f5;cursor:default;}.alviere-currency-input__wrapper--valid.svelte-arhdam {border-color:#436b1d;}.alviere-currency-input__wrapper--invalid.svelte-arhdam {border-color:#b3311f;}.alviere-currency-input__input.svelte-arhdam {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-currency-input__input.svelte-arhdam::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-currency-input__input.svelte-arhdam:disabled {cursor:not-allowed;color:#52525b;}.alviere-currency-input__input.svelte-arhdam:read-only {cursor:default;color:#3f3f46;}.alviere-currency-input__validation-messages.svelte-arhdam {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-currency-input--sm.svelte-arhdam .alviere-currency-input__wrapper:where(.svelte-arhdam) {min-height:2.5rem;}.alviere-currency-input--sm.svelte-arhdam .alviere-currency-input__input:where(.svelte-arhdam) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-currency-input--sm.svelte-arhdam .alviere-currency-input__textarea:where(.svelte-arhdam) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-currency-input--sm.svelte-arhdam .alviere-currency-input__label:where(.svelte-arhdam) {font-size:1rem;}.alviere-currency-input--md.svelte-arhdam .alviere-currency-input__wrapper:where(.svelte-arhdam) {min-height:3.25rem;}.alviere-currency-input--md.svelte-arhdam .alviere-currency-input__input:where(.svelte-arhdam) {font-size:1rem;}.alviere-currency-input--md.svelte-arhdam .alviere-currency-input__textarea:where(.svelte-arhdam) {font-size:1.25rem;}.alviere-currency-input--lg.svelte-arhdam .alviere-currency-input__wrapper:where(.svelte-arhdam) {min-height:3.75rem;}.alviere-currency-input--lg.svelte-arhdam .alviere-currency-input__input:where(.svelte-arhdam) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-currency-input--lg.svelte-arhdam .alviere-currency-input__textarea:where(.svelte-arhdam) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-currency-input--lg.svelte-arhdam .alviere-currency-input__label:where(.svelte-arhdam) {font-size:1.25rem;}.alviere-currency-input.svelte-arhdam:focus-within .alviere-currency-input__wrapper:where(.svelte-arhdam):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-currency-input__input.svelte-arhdam {font-variant-numeric:tabular-nums;letter-spacing:0.02em;}'};function ru(e,t){je(t,!0),Oa(e,tu);let r=zn(t,"value",15,""),a=zn(t,"label",15,"Amount"),n=zn(t,"placeholder",15,"0.00"),o=zn(t,"disabled",15,!1),i=zn(t,"required",15,!1),l=zn(t,"readonly",15,!1),s=zn(t,"size",15,"md"),c=zn(t,"id",15,""),u=zn(t,"name",15,""),v=zn(t,"autocomplete",15,""),d=zn(t,"validationState",15,"neutral"),p=zn(t,"errorMessage",15,""),f=zn(t,"helpText",15,""),h=zn(t,"validationSchema",31,()=>Dt({})),g=zn(t,"oninput",15),m=zn(t,"onchange",15),b=zn(t,"onfocus",15),y=zn(t,"onblur",15),_=zn(t,"currency",15,"USD"),w=zn(t,"locale",15,"en-US"),C=At(0);function x(e){try{const t=e/100;return new Intl.NumberFormat(w(),{style:"currency",currency:_(),minimumFractionDigits:2,maximumFractionDigits:2}).format(t)}catch(t){return N.error("CurrencyInput: Error formatting currency",t),`${function(){try{return new Intl.NumberFormat(w(),{style:"currency",currency:_(),minimumFractionDigits:0,maximumFractionDigits:0}).format(0).replace(/\d/g,"").trim()}catch(t){return N.error("CurrencyInput: Error getting currency symbol",t),"$"}}()}${(e/100).toFixed(2)}`}}function E(e){if(!e&&0!==e)return 0;const t=String(e).replace(/\D/g,"");return t?parseInt(t,10):0}if(r()){const e=E(r());Bt(C,e,!0),r(x(e))}const S=Jl({get value(){return r()},required:i(),disabled:o(),readonly:l(),get validationState(){return d()},get errorMessage(){return p()},helpText:f(),label:a(),validationSchema:h(),componentName:"CurrencyInput",componentType:"text",customValidator:e=>{if(e){const t=E(e);if(isNaN(t))return{isValid:!1,error:"Please enter a valid amount"};if(t<0)return{isValid:!1,error:"Amount must be positive"}}const t=Ps(e,h(),a());return{isValid:t.isValid,error:t.firstError}}});let k=rt(()=>ts(S.state.inputElement));function T(){return{value:r(),rawValue:(qr(C)/100).toFixed(2).toString(),isValid:S.state.isValid,validationState:S.state.validationState,errorMessage:S.state.errorMessage,hasInteracted:S.state.hasInteracted,characterCount:r().length}}Zt(()=>{qr(C)>0&&r(x(qr(C)))});const A=rt(()=>["alviere-currency-input__wrapper",S.state.isFocused?"alviere-currency-input__wrapper--focused":"",S.state.errorMessage?"alviere-currency-input__wrapper--invalid":"",!S.state.errorMessage&&r()&&qr(C)>0?"alviere-currency-input__wrapper--valid":"",o()?"alviere-currency-input__wrapper--disabled":"",""!==r()?"alviere-currency-input__wrapper--dirty":""].filter(Boolean).join(" "));function I(e){Bt(C,e,!0),r(x(e))}var B=eu(),R=Ht(B),z=Ht(R),L=e=>{var t=Qc(),r=Ht(t,!0);Re(t),ar(()=>{sn(t,"for",c()||"currency-input"),Ca(r,a())}),va(e,t)};Ba(z,e=>{a()&&e(L)});var D=Wt(z,2);an(D),D.__input=function(e){const t=e.target,a=t.value.replace(/\D/g,""),n=r().replace(/\D/g,"");if(a===n&&0===a.length)Bt(C,0);else if(0===a.length)Bt(C,0);else if(a.length===n.length&&a===n);else{const e=parseInt(a,10)||0;if(n.length>0&&a.length===n.length+1){const e=a[a.length-1];Bt(C,10*qr(C)+parseInt(e,10))}else n.length>0&&a.length===n.length-1?Bt(C,Math.floor(qr(C)/10),!0):Bt(C,e,!0)}const o=x(qr(C));r(o),t.value=o,setTimeout(()=>{const e=o.length;t.setSelectionRange(e,e)},0),S.handlers.handleInput(e),qr(k).dispatch(rs,T()),g()&&g()(e)},D.__change=[Yc,k,T,m],D.__keydown=function(e){const t=e.target;if("Backspace"===e.key){e.preventDefault(),Bt(C,Math.floor(qr(C)/10),!0);const a=x(qr(C));r(a),t.value=a,setTimeout(()=>{const e=a.length;t.setSelectionRange(e,e)},0);const n=new Event("input",{bubbles:!0});return void t.dispatchEvent(n)}if("Delete"===e.key){e.preventDefault(),Bt(C,Math.floor(qr(C)/10),!0);const a=x(qr(C));r(a),t.value=a,setTimeout(()=>{const e=a.length;t.setSelectionRange(e,e)},0);const n=new Event("input",{bubbles:!0});return void t.dispatchEvent(n)}/\d/.test(e.key)||["Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)||e.preventDefault()},kn(D,e=>S.state.inputElement=e,()=>{var e;return null==(e=null==S?void 0:S.state)?void 0:e.inputElement}),Re(R);var U=Wt(R,2),P=Ht(U),V=e=>{va(e,Jc())};Ba(P,e=>{i()&&"neutral"===S.computed.effectiveValidationState&&e(V)});var M=Wt(P,2),O=e=>{var t=Xc(),r=Wt(Ht(t));Re(t),ar(()=>{sn(t,"id",`${c()||"currency-input"}-error`),Ca(r,` ${S.state.errorMessage??""}`)}),va(e,t)};Ba(M,e=>{"invalid"===S.state.validationState&&e(O)});var j=Wt(M,2),q=e=>{var t=Zc(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,f())),va(e,t)};return Ba(j,e=>{f()&&!S.state.errorMessage&&e(q)}),Re(U),Re(B),ar(()=>{Ga(B,1,`alviere-currency-input alviere-currency-input--${s()??""}`,"svelte-arhdam"),Ga(R,1,Fa(qr(A)),"svelte-arhdam"),sn(D,"id",c()||"currency-input"),sn(D,"name",u()),sn(D,"placeholder",S.state.isFocused?n():""),nn(D,r()),D.required=i(),D.disabled=o(),D.readOnly=l(),sn(D,"autocomplete",v()),Ga(D,1,`alviere-currency-input__input alviere-currency-input__input--${s()??""}`,"svelte-arhdam"),sn(D,"aria-invalid","invalid"===S.state.validationState?"true":void 0),sn(D,"aria-describedby",S.state.errorMessage?`${c()||"currency-input"}-error`:void 0)}),ta("focus",D,function(e){S.handlers.handleFocus(),qr(k).dispatch(ns,T()),b()&&b()(e)}),ta("blur",D,function(e){S.handlers.handleBlur(e),qr(k).dispatch(os,T()),y()&&y()(e)}),va(e,B),qe({focus:function(){var e;null===(e=S.state.inputElement)||void 0===e||e.focus()},blur:function(){var e;null===(e=S.state.inputElement)||void 0===e||e.blur()},isValid:function(){return S.state.isValid},getValidationError:function(){return S.state.errorMessage||null},getValidationSchema:function(){return h()},setValidationSchema:function(e){h(e)},clear:function(){r(""),Bt(C,0),S.state.inputElement&&(S.state.inputElement.value="")},select:function(){S.state.inputElement&&"select"in S.state.inputElement&&S.state.inputElement.select()},setSelectionRange:function(e,t){S.state.inputElement&&"setSelectionRange"in S.state.inputElement&&S.state.inputElement.setSelectionRange(e,t)},getFormattedValue:function(){return r()},getRawValue:function(){return qr(C)},getValueInMajorUnits:function(){return qr(C)/100},getValueInMinorUnits:function(){return qr(C)},setValue:I,setValueInMajorUnits:function(e){I(Math.round(100*e))},getComponentMetadata:function(){return{name:"CurrencyInput",type:"currency",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue","getValueInMajorUnits","getValueInMinorUnits","setValue","setValueInMajorUnits"]}}},get value(){return r()},set value(e=""){r(e),wt()},get label(){return a()},set label(e="Amount"){a(e),wt()},get placeholder(){return n()},set placeholder(e="0.00"){n(e),wt()},get disabled(){return o()},set disabled(e=!1){o(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get autocomplete(){return v()},set autocomplete(e=""){v(e),wt()},get validationState(){return d()},set validationState(e="neutral"){d(e),wt()},get errorMessage(){return p()},set errorMessage(e=""){p(e),wt()},get helpText(){return f()},set helpText(e=""){f(e),wt()},get validationSchema(){return h()},set validationSchema(e={}){h(e),wt()},get oninput(){return g()},set oninput(e){g(e),wt()},get onchange(){return m()},set onchange(e){m(e),wt()},get onfocus(){return b()},set onfocus(e){b(e),wt()},get onblur(){return y()},set onblur(e){y(e),wt()},get currency(){return _()},set currency(e="USD"){_(e),wt()},get locale(){return w()},set locale(e="en-US"){w(e),wt()}})}function au(e,t,r,a,n){Bt(t,e.target.value,!0),Bt(r,-1),qr(a).dispatch(Cs,n())}ra(["input","change","keydown"]),customElements.define("alviere-currency-input",Un(ru,{value:{},label:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},autocomplete:{},validationState:{},errorMessage:{},helpText:{},validationSchema:{},oninput:{},onchange:{},onfocus:{},onblur:{},currency:{},locale:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","getFormattedValue","getRawValue","getValueInMajorUnits","getValueInMinorUnits","setValue","setValueInMajorUnits","getComponentMetadata"],!0));var nu=ia('<label class="alviere-search-select__label svelte-1qkkc2b"> </label>'),ou=ia('<div class="alviere-search-select__display-value svelte-1qkkc2b"> </div>'),iu=(e,t)=>{e.stopPropagation(),t()},lu=ia('<button type="button" class="alviere-search-select__clear-button svelte-1qkkc2b" aria-label="Clear selection"><!></button>'),su=ia('<div class="alviere-search-select__loading-message svelte-1qkkc2b"> </div>'),cu=ia('<div class="alviere-search-select__no-options-message svelte-1qkkc2b"> </div>'),uu=(e,t,r)=>t(qr(r)),vu=(e,t,r)=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t(qr(r)))},du=ia('<div role="option" tabindex="0"> </div>'),pu=ia('<div id="search-select-dropdown" class="alviere-search-select__dropdown svelte-1qkkc2b" role="listbox"><div class="alviere-search-select__options-list svelte-1qkkc2b"><!></div></div>'),fu=ia('<div class="alviere-search-select__required svelte-1qkkc2b">Required</div>'),hu=ia('<div class="alviere-search-select__help svelte-1qkkc2b"> </div>'),gu=ia('<div class="alviere-search-select__error svelte-1qkkc2b" role="alert"><svg height="1rem" width="1rem" viewBox="0 0 24 24" class="IconStyle_currentColor__sdo2n67" style="font-size: 1em;"><g fill="none"><path d="M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2 2 6.477 2 12zm5.293-3.293 1.414-1.414 8 8-1.414 1.414z" fill="currentcolor"></path></g></svg> </div>'),mu=ia('<div><div class="alviere-search-select__container svelte-1qkkc2b"><div><!> <input type="text" class="alviere-search-select__input svelte-1qkkc2b" autocomplete="off" role="combobox" aria-haspopup="listbox" aria-controls="search-select-dropdown"/> <!> <div class="alviere-search-select__actions svelte-1qkkc2b"><!> <div><!></div></div></div> <!></div> <div class="alviere-search-select__validation-messages svelte-1qkkc2b"><!> <!> <!></div></div>');const bu={hash:"svelte-1qkkc2b",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-search-select.svelte-1qkkc2b {position:relative;width:100%;}.alviere-search-select__label.svelte-1qkkc2b {position:absolute;max-width:calc(100% - 1.5rem);inset-inline-start:0.75rem;top:calc(50% + 1px);transform:translateY(-50%);transition:all 250ms ease-in-out;transition-delay:0.1s;display:block;font-size:1rem;font-weight:500;color:#3f3f46;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.alviere-search-select__required.svelte-1qkkc2b {font-size:0.75rem;color:#3f3f46;text-align:end;position:absolute;right:1rem;top:calc(50% + 1px);transform:translateY(-50%);}.alviere-search-select__error.svelte-1qkkc2b {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}.alviere-search-select__wrapper.svelte-1qkkc2b {position:relative;display:flex;align-items:center;background:#ffffff;border:1px solid #52525b;border-radius:0.25rem;transition:border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;}.alviere-search-select__wrapper--focused.svelte-1qkkc2b {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}\n.alviere-search-select__wrapper--focused.svelte-1qkkc2b .alviere-search-select__label:where(.svelte-1qkkc2b) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}\n.alviere-search-select__wrapper--focused.svelte-1qkkc2b .alviere-search-select__input:where(.svelte-1qkkc2b)::placeholder {opacity:1;}\n.alviere-search-select__wrapper--dirty.svelte-1qkkc2b .alviere-search-select__label:where(.svelte-1qkkc2b) {transform:translateY(calc(-50% - 0.75rem));font-size:0.75rem;}.alviere-search-select__wrapper--disabled.svelte-1qkkc2b {background:#f4f4f5;cursor:not-allowed;}.alviere-search-select__wrapper--readonly.svelte-1qkkc2b {background:#f4f4f5;cursor:default;}.alviere-search-select__wrapper--valid.svelte-1qkkc2b {border-color:#436b1d;}.alviere-search-select__wrapper--invalid.svelte-1qkkc2b {border-color:#b3311f;}.alviere-search-select__input.svelte-1qkkc2b {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;}.alviere-search-select__input.svelte-1qkkc2b::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-search-select__input.svelte-1qkkc2b:disabled {cursor:not-allowed;color:#52525b;}.alviere-search-select__input.svelte-1qkkc2b:read-only {cursor:default;color:#3f3f46;}.alviere-search-select__validation-messages.svelte-1qkkc2b {min-height:1.40625rem;display:flex;justify-content:space-between;align-items:center;padding-top:0.25rem;}.alviere-search-select--sm.svelte-1qkkc2b .alviere-search-select__wrapper:where(.svelte-1qkkc2b) {min-height:2.5rem;}.alviere-search-select--sm.svelte-1qkkc2b .alviere-search-select__input:where(.svelte-1qkkc2b) {font-size:1.125rem;padding:0.25rem 0.75rem;}.alviere-search-select--sm.svelte-1qkkc2b .alviere-search-select__label:where(.svelte-1qkkc2b) {font-size:1rem;}.alviere-search-select--md.svelte-1qkkc2b .alviere-search-select__wrapper:where(.svelte-1qkkc2b) {min-height:3.25rem;}.alviere-search-select--md.svelte-1qkkc2b .alviere-search-select__input:where(.svelte-1qkkc2b) {font-size:1rem;}.alviere-search-select--lg.svelte-1qkkc2b .alviere-search-select__wrapper:where(.svelte-1qkkc2b) {min-height:3.75rem;}.alviere-search-select--lg.svelte-1qkkc2b .alviere-search-select__input:where(.svelte-1qkkc2b) {font-size:1.5rem;padding:0.875rem 0.75rem;}.alviere-search-select--lg.svelte-1qkkc2b .alviere-search-select__label:where(.svelte-1qkkc2b) {font-size:1.25rem;}.alviere-search-select.svelte-1qkkc2b:focus-within .alviere-search-select__wrapper:where(.svelte-1qkkc2b):not(--disabled):not(--readonly) {border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;}.alviere-search-select__container.svelte-1qkkc2b {position:relative;}.alviere-search-select__wrapper.svelte-1qkkc2b {position:relative;display:flex;align-items:center;}.alviere-search-select__wrapper.svelte-1qkkc2b:hover:not(.alviere-search-select__wrapper--disabled) {border-color:#3f3f46;}.alviere-search-select__wrapper--focused.svelte-1qkkc2b {border-color:#227e9e;box-shadow:0 0 0 2px rgba(34, 126, 158, 0.15);}.alviere-search-select__wrapper--disabled.svelte-1qkkc2b {cursor:not-allowed;opacity:0.7;}.alviere-search-select__wrapper--disabled.alviere-search-select__wrapper--valid.svelte-1qkkc2b {border-color:#52525b;}.alviere-search-select__input.svelte-1qkkc2b {flex:1;width:100%;height:100%;min-height:2.25rem;padding:1rem 0.75rem 0;border:none;background:transparent;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:1.25rem;line-height:1.5rem;color:#18181b;outline:none;flex:1;border:none;outline:none;background:transparent;margin:0;width:100%;height:100%;}.alviere-search-select__input.svelte-1qkkc2b::placeholder {color:#71717a;opacity:0;transition:opacity 150ms ease-in-out;transition-delay:0.15s;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-search-select__input.svelte-1qkkc2b:disabled {cursor:not-allowed;color:#52525b;}.alviere-search-select__input.svelte-1qkkc2b:read-only {cursor:default;color:#3f3f46;}.alviere-search-select__input.svelte-1qkkc2b::placeholder {color:#71717a;opacity:0;transition:opacity 0.2s ease;}.alviere-search-select__input.svelte-1qkkc2b:focus::placeholder {opacity:1;}.alviere-search-select__input.svelte-1qkkc2b:disabled {cursor:not-allowed;color:#52525b;}.alviere-search-select__display-value.svelte-1qkkc2b {position:absolute;left:0.75rem;right:3rem;padding-top:1rem;top:50%;transform:translateY(-50%);color:#18181b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none;z-index:1;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;}.alviere-search-select__actions.svelte-1qkkc2b {position:absolute;right:0.75rem;top:50%;transform:translateY(-50%);display:flex;align-items:center;gap:0.25rem;z-index:2;}.alviere-search-select__clear-button.svelte-1qkkc2b {display:flex;align-items:center;justify-content:center;padding:0.25rem 0.5rem;margin-right:1.5rem;background:#e4e4e7;border-radius:0.125rem;font-size:1rem;font-weight:500;color:#3f3f46;padding-left:0.25rem;padding-right:0.25rem;border-radius:50%;cursor:pointer;transition:all 150ms ease-in-out;margin-right:0.5rem;appearance:none;border:none;}.alviere-search-select__clear-button.svelte-1qkkc2b svg {width:0.75rem;height:0.75rem;}.alviere-search-select__clear-button.svelte-1qkkc2b:hover {background-color:#d4d4d8;color:#27272a;}.alviere-search-select__clear-button.svelte-1qkkc2b:focus {outline:none;box-shadow:0 0 0 2px rgba(34, 126, 158, 0.25);}.alviere-search-select__dropdown-arrow.svelte-1qkkc2b {color:#71717a;font-size:1rem;transition:transform 150ms ease-in-out;display:flex;flex-direction:column;align-items:center;justify-content:center;}.alviere-search-select__dropdown-arrow.open.svelte-1qkkc2b {transform:rotate(180deg);}.alviere-search-select__dropdown.svelte-1qkkc2b {position:absolute;top:100%;left:0;right:0;z-index:1000;background-color:#ffffff;border:1px solid #52525b;border-top:none;border-radius:0 0 0.25rem 0.25rem;box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);overflow:hidden;\n animation: svelte-1qkkc2b-dropdownFadeIn 150ms ease-in-out ease;}.alviere-search-select__options-list.svelte-1qkkc2b {max-height:12.5rem;overflow-y:auto;}.alviere-search-select__option-item.svelte-1qkkc2b {padding:0.5rem 1rem;cursor:pointer;transition:background-color 150ms ease-in-out;border-bottom:1px solid #f4f4f5;}.alviere-search-select__option-item.svelte-1qkkc2b:hover {background-color:#fafafa;}.alviere-search-select__option-item.selected.svelte-1qkkc2b {background-color:rgba(34, 126, 158, 0.1);color:#227e9e;font-weight:500;}.alviere-search-select__option-item.highlighted.svelte-1qkkc2b {background-color:rgba(34, 126, 158, 0.1);}.alviere-search-select__option-item.svelte-1qkkc2b:last-child {border-bottom:none;}.alviere-search-select__loading-message.svelte-1qkkc2b, .alviere-search-select__no-options-message.svelte-1qkkc2b {padding:1.5rem 1rem;text-align:center;color:#71717a;font-style:italic;}.alviere-search-select__help.svelte-1qkkc2b {margin-top:0.25rem;font-size:0.75rem;color:#71717a;line-height:1.25;display:flex;align-items:flex-start;gap:0.25rem;}.alviere-search-select__help.svelte-1qkkc2b svg {width:1rem;height:1rem;}.alviere-search-select__error.svelte-1qkkc2b {display:flex;align-items:center;gap:0.25rem;font-size:0.75rem;color:#b3311f;line-height:1.25;}\n\n@keyframes svelte-1qkkc2b-dropdownFadeIn {\n from {\n opacity: 0;\n transform: translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n@media (max-width: 768px) {.alviere-search-select__dropdown.svelte-1qkkc2b {max-height:15.625rem;}.alviere-search-select__option-item.svelte-1qkkc2b {padding:1rem 0.5rem;}\n}'};function yu(e,t){je(t,!0),Oa(e,bu);let r=zn(t,"value",15,""),a=zn(t,"options",31,()=>Dt([])),n=zn(t,"placeholder",15,"Search..."),o=zn(t,"disabled",15,!1),i=zn(t,"required",15,!1),l=zn(t,"readonly",15,!1),s=zn(t,"size",15,"md"),c=zn(t,"id",15,""),u=zn(t,"name",15,""),v=zn(t,"validationState",15,"neutral"),d=zn(t,"errorMessage",15,""),p=zn(t,"helpText",15,""),f=zn(t,"label",15,""),h=zn(t,"searchPlaceholder",15,""),g=zn(t,"noOptionsMessage",15,"No options found"),m=zn(t,"loadingMessage",15,"Loading..."),b=zn(t,"isLoading",15,!1),y=zn(t,"maxHeight",15,"300px"),_=zn(t,"validationSchema",31,()=>Dt({})),w=zn(t,"onchange",15),C=zn(t,"onfocus",15),x=zn(t,"onblur",15);const E=Ia(),S=cc(pc),k=cc(bc),T=Jl({get value(){return r()},required:i(),disabled:o(),readonly:l(),get validationState(){return v()},get errorMessage(){return d()},helpText:p(),label:f(),validationSchema:_(),componentName:"SearchSelect",componentType:"select",customValidator:e=>{if(i()&&(!e||""===e))return{isValid:!1,error:"Please select an option"};if(e&&a().length>0){if(!a().some(t=>t.value===e))return{isValid:!1,error:"Selected value is not valid"}}const t=Ps(e,_(),f());return{isValid:t.isValid,error:t.firstError}}});let A=At(null),I=At(null),B=At(!1),R=At(""),z=At(-1),L=rt(()=>ts(qr(A)));function D(){const e=a().find(e=>e.value===r());return{value:r()?String(r()):"",rawValue:r()?String(r()):"",isValid:T.state.isValid,validationState:T.state.validationState,errorMessage:T.state.errorMessage,hasInteracted:T.state.hasInteracted,selectedOption:e||null,options:a(),searchQuery:qr(R)}}let U=rt(()=>()=>qr(R)?a().filter(e=>e.label.toLowerCase().includes(qr(R).toLowerCase())):a()),P=rt(()=>()=>{if(!r())return"";const e=a().find(e=>e.value===r());return e?e.label:""});function V(){N.info("SearchSelect: openDropdown",o(),l()),o()||l()||(Bt(B,!0),Bt(z,-1),setTimeout(()=>{null===qr(I)||void 0===qr(I)||qr(I).focus()},0),qr(L).dispatch(Es,D()))}function M(){N.info("SearchSelect: closeDropdown",o(),l()),Bt(B,!1),Bt(R,""),Bt(z,-1),qr(L).dispatch(Ss,D())}function O(e){N.info("SearchSelect: selectOption called with:",{option:e,currentValue:r(),required:i()}),r(e.value),N.info("SearchSelect: After setting value:",{newValue:r(),type:typeof r()}),T.actions.markAsInteracted(),N.info("SearchSelect: After markAsInteracted, hasInteracted:",T.state.hasInteracted),M(),null===qr(I)||void 0===qr(I)||qr(I).blur(),E("change",{value:e.value,label:e.label}),qr(L).dispatch(xs,D()),w()&&w()({detail:{value:e.value,label:e.label}})}function j(){N.info("SearchSelect: clearSelection called, current value:",r()),r(""),Bt(R,""),Bt(z,-1),N.info("SearchSelect: After clearing value:",{value:r(),required:i()}),T.actions.markAsInteracted(),N.info("SearchSelect: After markAsInteracted in clear, hasInteracted:",T.state.hasInteracted),E("change",{value:"",label:""}),qr(L).dispatch(xs,D()),w()&&w()({detail:{value:"",label:""}})}function q(e){var t;if(!qr(B)||!qr(A))return;const r=(null===(t=e.composedPath)||void 0===t?void 0:t.call(e))||[],a=qr(A).getRootNode(),n=null==a?void 0:a.host;r.includes(qr(A))||n&&r.includes(n)||M()}function F(){null===qr(I)||void 0===qr(I)||qr(I).focus()}Zt(()=>{if("undefined"!=typeof window)return document.addEventListener("click",q),()=>{document.removeEventListener("click",q)}}),Zt(()=>{T.state.hasInteracted&&T.actions.forceValidation()}),Zt(()=>{if("undefined"!=typeof window&&window.customElements){const e=null===qr(A)||void 0===qr(A)?void 0:qr(A).getRootNode(),t=null==e?void 0:e.host;if(t){const e=t.getAttributeNames();e.includes("required")&&i(t.hasAttribute("required")),e.includes("disabled")&&o(t.hasAttribute("disabled")),e.includes("readonly")&&l(t.hasAttribute("readonly"))}}});var K=mu(),$=Ht(K),H=Ht($);let G;var W=Ht(H),Y=e=>{var t=nu(),r=Ht(t,!0);Re(t),ar(()=>{sn(t,"for",c()||u()),Ca(r,f())}),va(e,t)};Ba(W,e=>{f()&&e(Y)});var Q=Wt(W,2);an(Q),Q.__input=[au,R,z,L,D],Q.__keydown=function(e){if(qr(B))switch(e.key){case"ArrowDown":e.preventDefault(),Bt(z,Math.min(qr(z)+1,qr(U)().length-1),!0);break;case"ArrowUp":e.preventDefault(),Bt(z,Math.max(qr(z)-1,-1),!0);break;case"Enter":e.preventDefault(),qr(z)>=0&&qr(z)<qr(U)().length&&O(qr(U)()[qr(z)]);break;case"Escape":e.preventDefault(),M()}},kn(Q,e=>Bt(I,e),()=>qr(I));var J=Wt(Q,2),X=e=>{var t=ou(),r=Ht(t,!0);Re(t),ar(e=>Ca(r,e),[()=>qr(P)()]),va(e,t)};Ba(J,e=>{qr(B)||T.state.isFocused||!qr(P)()||e(X)});var Z=Wt(J,2),ee=Ht(Z),te=e=>{var t=lu();t.__click=[iu,j],Pa(Ht(t),()=>k.outerHTML),Re(t),va(e,t)};Ba(ee,e=>{!r()||o()||l()||e(te)});var re=Wt(ee,2);let ae;Pa(Ht(re),()=>S.outerHTML),Re(re),Re(Z),Re(H);var ne=Wt(H,2),oe=e=>{var t=pu(),a=Ht(t),n=Ht(a),o=e=>{var t=su(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,m())),va(e,t)},i=e=>{var t=ua(),a=Gt(t),n=e=>{var t=cu(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,g())),va(e,t)},o=e=>{var t=ua();Ra(Gt(t),17,()=>qr(U)(),Na,(e,t,a)=>{var n=du();let o;n.__click=[uu,O,t],n.__keydown=[vu,O,t];var i=Ht(n,!0);Re(n),ar(e=>{o=Ga(n,1,"alviere-search-select__option-item svelte-1qkkc2b",null,o,e),sn(n,"aria-selected",qr(t).value===r()),sn(n,"aria-label",qr(t).label),Ca(i,qr(t).label)},[()=>({selected:qr(t).value===r(),highlighted:a===qr(z)})]),ta("mouseenter",n,()=>Bt(z,a,!0)),va(e,n)}),va(e,t)};Ba(a,e=>{0===qr(U)().length?e(n):e(o,!1)},!0),va(e,t)};Ba(n,e=>{b()?e(o):e(i,!1)}),Re(a),Re(t),ar(()=>Ya(t,`max-height: ${y()??""}`)),va(e,t)};Ba(ne,e=>{qr(B)&&e(oe)}),Re($);var ie=Wt($,2),le=Ht(ie),se=e=>{va(e,fu())};Ba(le,e=>{i()&&"neutral"===T.state.validationState&&e(se)});var ce=Wt(le,2),ue=e=>{var t=hu(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,p())),va(e,t)};Ba(ce,e=>{p()&&"invalid"!==T.state.validationState&&e(ue)});var ve=Wt(ce,2),de=e=>{var t=gu(),r=Wt(Ht(t));Re(t),ar(()=>{sn(t,"id",`${c()??""}-error`),Ca(r,` ${T.state.errorMessage??""}`)}),va(e,t)};return Ba(ve,e=>{"invalid"===T.state.validationState&&e(de)}),Re(ie),Re(K),kn(K,e=>Bt(A,e),()=>qr(A)),ar((e,t)=>{Ga(K,1,`alviere-search-select alviere-search-select--${s()??""}`,"svelte-1qkkc2b"),G=Ga(H,1,"alviere-search-select__wrapper svelte-1qkkc2b",null,G,e),sn(Q,"placeholder",qr(B)||T.state.isFocused?h()||`Search ${f()||"options"}...`:""),sn(Q,"id",c()),sn(Q,"name",u()),Q.disabled=o(),Q.readOnly=l(),sn(Q,"aria-expanded",qr(B)),ae=Ga(re,1,"alviere-search-select__dropdown-arrow svelte-1qkkc2b",null,ae,t)},[()=>({"alviere-search-select__wrapper--focused":T.state.isFocused,"alviere-search-select__wrapper--valid":"valid"===T.state.validationState,"alviere-search-select__wrapper--invalid":"invalid"===T.state.validationState,"alviere-search-select__wrapper--disabled":o(),"alviere-search-select__wrapper--dirty":!!qr(P)()}),()=>({open:qr(B)})]),ta("focus",Q,function(e){T.handlers.handleFocus(e),V(),qr(P)()&&Bt(R,qr(P)(),!0),C()&&C()(e)}),ta("blur",Q,function(e){T.handlers.handleBlur(e),setTimeout(()=>{(null===qr(A)||void 0===qr(A)?void 0:qr(A).contains(document.activeElement))||(M(),Bt(R,""))},150),x()&&x()(e)}),Cn(Q,()=>qr(R),e=>Bt(R,e)),va(e,K),qe({focus:F,blur:function(){null===qr(I)||void 0===qr(I)||qr(I).blur()},isValid:function(){return T.state.isValid},getValidationError:function(){return T.state.errorMessage||null},getValidationSchema:function(){return _()},setValidationSchema:function(e){_(e)},clear:function(){r(""),Bt(R,""),Bt(z,-1),Bt(B,!1)},select:function(){qr(I)?(qr(I).focus(),qr(I).select()):F()},setSelectionRange:function(e,t){qr(I)&&"setSelectionRange"in qr(I)&&qr(I).setSelectionRange(e,t)},openDropdown:V,closeDropdown:M,getSelectedOption:function(){return qr(U).find(e=>e.value===r())||null},getFilteredOptions:function(){return qr(U)},selectOptionByIndex:function(e){e>=0&&e<qr(U).length&&O(qr(U)[e])},getComponentMetadata:function(){return{name:"SearchSelect",type:"select",standardsVersion:"1.0.0",hasStandardizedAPI:!0,capabilities:{hasTextManipulation:!0,hasSpecializedMethods:!0,methodNames:["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","openDropdown","closeDropdown","getSelectedOption","getFilteredOptions","selectOptionByIndex"]}}},get value(){return r()},set value(e=""){r(e),wt()},get options(){return a()},set options(e=[]){a(e),wt()},get placeholder(){return n()},set placeholder(e="Search..."){n(e),wt()},get disabled(){return o()},set disabled(e=!1){o(e),wt()},get required(){return i()},set required(e=!1){i(e),wt()},get readonly(){return l()},set readonly(e=!1){l(e),wt()},get size(){return s()},set size(e="md"){s(e),wt()},get id(){return c()},set id(e=""){c(e),wt()},get name(){return u()},set name(e=""){u(e),wt()},get validationState(){return v()},set validationState(e="neutral"){v(e),wt()},get errorMessage(){return d()},set errorMessage(e=""){d(e),wt()},get helpText(){return p()},set helpText(e=""){p(e),wt()},get label(){return f()},set label(e=""){f(e),wt()},get searchPlaceholder(){return h()},set searchPlaceholder(e=""){h(e),wt()},get noOptionsMessage(){return g()},set noOptionsMessage(e="No options found"){g(e),wt()},get loadingMessage(){return m()},set loadingMessage(e="Loading..."){m(e),wt()},get isLoading(){return b()},set isLoading(e=!1){b(e),wt()},get maxHeight(){return y()},set maxHeight(e="300px"){y(e),wt()},get validationSchema(){return _()},set validationSchema(e={}){_(e),wt()},get onchange(){return w()},set onchange(e){w(e),wt()},get onfocus(){return C()},set onfocus(e){C(e),wt()},get onblur(){return x()},set onblur(e){x(e),wt()}})}ra(["input","keydown","click"]),customElements.define("alviere-search-select",Un(yu,{value:{},options:{},placeholder:{},disabled:{},required:{},readonly:{},size:{},id:{},name:{},validationState:{},errorMessage:{},helpText:{},label:{},searchPlaceholder:{},noOptionsMessage:{},loadingMessage:{},isLoading:{},maxHeight:{},validationSchema:{},onchange:{},onfocus:{},onblur:{}},[],["focus","blur","isValid","getValidationError","getValidationSchema","setValidationSchema","clear","select","setSelectionRange","openDropdown","closeDropdown","getSelectedOption","getFilteredOptions","selectOptionByIndex","getComponentMetadata"],!0));class _u{constructor(){this.cache=new Map}static getInstance(){return this.managerInstance||(this.managerInstance=new _u),this.managerInstance}getCacheKey(e){return`${e.jwt||""}:${e.publicCertificate||""}:${e.publicCertificateId||""}:${e.business_uuid||""}:${e.debug||!1}`}getOrCreate(e){const t=this.getCacheKey(e),r=this.cache.get(t);if(r)return this.logger=R(r.instance),this.logger.info("🔍 Returning cached AlviereCore instance...",r.instance),r.instance;const a=new Yl(e);return this.logger=R(a),this.logger.info("🔍 Creating new AlviereCore instance...",a),this.cache.set(t,{instance:a,key:{jwt:e.jwt||"",publicCertificate:e.publicCertificate||"",publicCertificateId:e.publicCertificateId||"",business_uuid:e.business_uuid||"",debug:e.debug||!1},createdAt:Date.now()}),a}updateOrCreate(e){const t=this.getCacheKey(e),r=this.cache.get(t);if(r)return r.instance.configure(e),r.instance;const a=e.jwt||"",n=Array.from(this.cache.entries());for(const[o,i]of n)i.key.jwt!==a&&this.cache.delete(o);return this.getOrCreate(e)}clearAll(){this.cache.clear()}clearForJwt(e){const t=[];for(const[r,a]of this.cache.entries())a.key.jwt===e&&t.push(r);t.forEach(e=>this.cache.delete(e))}getStats(){return{totalInstances:this.cache.size,instances:Array.from(this.cache.entries()).map(([e,t])=>({key:e,hasJwt:!!t.key.jwt,debug:t.key.debug,createdAt:new Date(t.createdAt).toISOString()}))}}has(e){const t=this.getCacheKey(e);return this.cache.has(t)}}const wu=_u.getInstance();function Cu(e){return wu.getOrCreate(e)}const xu=Object.freeze(Object.defineProperty({__proto__:null,AlviereCoreManager:_u,getAlviereCore:Cu},Symbol.toStringTag,{value:"Module"}));var Eu=ia('<div class="success-message svelte-hrmrx0">✅ Payment instrument created successfully! <br/> <small class="svelte-hrmrx0"> </small></div>'),Su=ia('<div class="error-message svelte-hrmrx0"> </div>'),ku=ia('<div class="alviere-payment-instrument-form svelte-hrmrx0"><h2 class="svelte-hrmrx0">Add Payment Instrument</h2> <!> <!> <form novalidate=""><fieldset class="svelte-hrmrx0"><legend class="svelte-hrmrx0">Card Information</legend> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-row svelte-hrmrx0"><div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div></div> <div class="form-group svelte-hrmrx0"><!></div></fieldset> <fieldset class="svelte-hrmrx0"><legend class="svelte-hrmrx0">Contact Information</legend> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div></fieldset> <fieldset class="svelte-hrmrx0"><legend class="svelte-hrmrx0">Billing Address</legend> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-row svelte-hrmrx0"><div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><label for="country" class="svelte-hrmrx0">Country *</label> <select id="country" required class="svelte-hrmrx0"><option>United States</option><option>Canada</option><option>Mexico</option></select></div></div></fieldset> <fieldset class="svelte-hrmrx0"><legend class="svelte-hrmrx0">Additional Information</legend> <div class="form-group svelte-hrmrx0"><!></div> <div class="form-group svelte-hrmrx0"><!></div></fieldset> <div class="form-actions svelte-hrmrx0"><button type="submit" class="submit-button svelte-hrmrx0"> </button></div></form></div>');const Tu={hash:"svelte-hrmrx0",code:'@charset "UTF-8";.alviere-payment-instrument-form.svelte-hrmrx0 {max-width:100%;margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;}.alviere-payment-instrument-form.svelte-hrmrx0 h2:where(.svelte-hrmrx0) {color:#27272a;margin-bottom:2rem;text-align:center;}.alviere-payment-instrument-form.svelte-hrmrx0 fieldset:where(.svelte-hrmrx0) {border:1px solid #d4d4d8;border-radius:0.25rem;padding:1.5rem;margin-bottom:2rem;background:#ffffff;}.alviere-payment-instrument-form.svelte-hrmrx0 legend:where(.svelte-hrmrx0) {font-weight:600;color:#3f3f46;padding:0 0.5rem;}.alviere-payment-instrument-form.svelte-hrmrx0 .form-group:where(.svelte-hrmrx0) {margin-bottom:1rem;}.alviere-payment-instrument-form.svelte-hrmrx0 .form-row:where(.svelte-hrmrx0) {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.alviere-payment-instrument-form.svelte-hrmrx0 .form-actions:where(.svelte-hrmrx0) {margin-top:24px;text-align:center;}.alviere-payment-instrument-form.svelte-hrmrx0 .form-actions:where(.svelte-hrmrx0) button:where(.svelte-hrmrx0):disabled {opacity:0.6;cursor:not-allowed;}.alviere-payment-instrument-form.svelte-hrmrx0 .success-message:where(.svelte-hrmrx0) {padding:1rem;border-radius:0.25rem;margin-bottom:2rem;text-align:center;background:#d4edda;border:1px solid #c3e6cb;color:#155724;}.alviere-payment-instrument-form.svelte-hrmrx0 .error-message:where(.svelte-hrmrx0) {padding:1rem;border-radius:0.25rem;margin-bottom:2rem;text-align:center;background:#f8d7da;border:1px solid #f5c6cb;color:#721c24;}.alviere-payment-instrument-form.svelte-hrmrx0 .submit-button:where(.svelte-hrmrx0) {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#27272a;color:#ffffff;}.alviere-payment-instrument-form.svelte-hrmrx0 .submit-button:where(.svelte-hrmrx0):hover:not(:disabled) {background:#3f3f46;}.alviere-payment-instrument-form.svelte-hrmrx0 .submit-button:where(.svelte-hrmrx0):disabled {background:#52525b;cursor:not-allowed;} .alviere-payment-instrument-form.svelte-hrmrx0 select:where(.svelte-hrmrx0) {width:100%;padding:0.75rem;border:1px solid #d4d4d8;border-radius:0.25rem;font-size:1.25rem;line-height:1.5rem;transition:border-color 150ms ease-in-out;} .alviere-payment-instrument-form.svelte-hrmrx0 select:where(.svelte-hrmrx0):focus {outline:none;border-color:#227e9e;box-shadow:0 0 0 1px #227e9e inset;} .alviere-payment-instrument-form.svelte-hrmrx0 select:where(.svelte-hrmrx0):disabled {background:#f4f4f5;cursor:not-allowed;}.alviere-payment-instrument-form.svelte-hrmrx0 label:where(.svelte-hrmrx0) {display:block;margin-bottom:0.5rem;font-weight:500;color:#3f3f46;}.alviere-payment-instrument-form.svelte-hrmrx0 small:where(.svelte-hrmrx0) {display:block;margin-top:4px;color:#52525b;font-size:1rem;}'};function Au(e,t){je(t,!0),Oa(e,Tu);let r,a,n,o,i=zn(t,"jwt",15,""),l=zn(t,"accountUuid",15,""),s=zn(t,"debug",15,!1),c=zn(t,"onsuccess",15),u=zn(t,"onerror",15),v=At(Dt({pan:"",expiry:"",securityCode:"",nameOnCard:"",phoneNumber:"",emailAddress:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US",externalId:"",metadata:""})),d=At(""),p=At(!1),f=At(null),h=At(null);Zt(()=>{o=Cu({jwt:i(),debug:s()})});var g=ku(),m=Wt(Ht(g),2),b=e=>{var t=Eu(),r=Wt(Ht(t),3),a=Ht(r);Re(r),Re(t),ar(()=>{var e;return Ca(a,`ID: ${(null==(e=qr(h).payment_instrument)?void 0:e.payment_instrument_uuid)||"N/A"}`)}),va(e,t)};Ba(m,e=>{qr(h)&&e(b)});var y=Wt(m,2),_=e=>{var t=Su(),r=Ht(t);Re(t),ar(()=>Ca(r,`❌ ${qr(f)??""}`)),va(e,t)};Ba(y,e=>{qr(f)&&e(_)});var w=Wt(y,2),C=Ht(w),x=Wt(Ht(C),2);kn(Ks(Ht(x),{id:"pan",label:"Card Number",placeholder:"Enter your card number",required:!0,get disabled(){return qr(p)},oninput:function(e){var t;qr(v).pan=e.rawValue,Bt(d,(null===(t=e.cardType)||void 0===t?void 0:t.name.toLowerCase())||"",!0)},get value(){return qr(v).pan},set value(e){qr(v).pan=e}}),e=>r=e,()=>r),Re(x);var E=Wt(x,2),S=Ht(E);kn(oc(Ht(S),{id:"expiry",label:"Expiry Date",placeholder:"MM/YY",required:!0,get disabled(){return qr(p)},oninput:function(e){qr(v).expiry=e.value},get value(){return qr(v).expiry},set value(e){qr(v).expiry=e}}),e=>n=e,()=>n),Re(S);var k=Wt(S,2);kn(Xs(Ht(k),{id:"securityCode",label:"Security Code",get cardType(){return qr(d)},required:!0,get disabled(){return qr(p)},oninput:function(e){qr(v).securityCode=e.rawValue},get value(){return qr(v).securityCode},set value(e){qr(v).securityCode=e}}),e=>a=e,()=>a),Re(k),Re(E);var T=Wt(E,2);Rc(Ht(T),{type:"text",id:"nameOnCard",placeholder:"John Doe",label:"Name on Card",required:!0,get disabled(){return qr(p)},autocomplete:"cc-name",validateAlphabetic:!0,validateMinLength:2,get value(){return qr(v).nameOnCard},set value(e){qr(v).nameOnCard=e}}),Re(T),Re(C);var A=Wt(C,2),I=Wt(Ht(A),2);Rc(Ht(I),{type:"text",id:"phoneNumber",placeholder:"+1 (555) 123-4567",label:"Phone Number",get disabled(){return qr(p)},autocomplete:"tel",validatePhone:!0,get value(){return qr(v).phoneNumber},set value(e){qr(v).phoneNumber=e}}),Re(I);var B=Wt(I,2);Rc(Ht(B),{type:"text",id:"emailAddress",placeholder:"john.doe@example.com",label:"Email Address",get disabled(){return qr(p)},autocomplete:"email",validateEmail:!0,get value(){return qr(v).emailAddress},set value(e){qr(v).emailAddress=e}}),Re(B),Re(A);var N=Wt(A,2),R=Wt(Ht(N),2);Rc(Ht(R),{type:"text",id:"addressLine1",placeholder:"123 Main St",label:"Address Line 1",required:!0,get disabled(){return qr(p)},autocomplete:"address-line1",get value(){return qr(v).addressLine1},set value(e){qr(v).addressLine1=e}}),Re(R);var z=Wt(R,2);Rc(Ht(z),{type:"text",id:"addressLine2",placeholder:"Apt 4B",label:"Address Line 2",get disabled(){return qr(p)},autocomplete:"address-line2",get value(){return qr(v).addressLine2},set value(e){qr(v).addressLine2=e}}),Re(z);var L=Wt(z,2),D=Ht(L);Rc(Ht(D),{type:"text",id:"city",placeholder:"New York",label:"City",required:!0,get disabled(){return qr(p)},autocomplete:"address-level2",get value(){return qr(v).city},set value(e){qr(v).city=e}}),Re(D);var U=Wt(D,2);Rc(Ht(U),{type:"text",id:"state",placeholder:"NY",label:"State",required:!0,get disabled(){return qr(p)},autocomplete:"address-level1",get value(){return qr(v).state},set value(e){qr(v).state=e}}),Re(U);var P=Wt(U,2);Rc(Ht(P),{type:"text",id:"postalCode",placeholder:"10001",label:"Postal Code",required:!0,get disabled(){return qr(p)},autocomplete:"postal-code",validatePostalCode:"US",get value(){return qr(v).postalCode},set value(e){qr(v).postalCode=e}}),Re(P);var V=Wt(P,2),M=Wt(Ht(V),2),O=Ht(M);O.value=O.__value="US";var j=Wt(O);j.value=j.__value="CA";var q=Wt(j);q.value=q.__value="MX",Re(M),Re(V),Re(L),Re(N);var F=Wt(N,2),K=Wt(Ht(F),2);Rc(Ht(K),{type:"text",id:"externalId",placeholder:"Optional external reference",label:"External ID",get disabled(){return qr(p)},helpText:"Optional unique identifier for this payment instrument",get value(){return qr(v).externalId},set value(e){qr(v).externalId=e}}),Re(K);var $=Wt(K,2);Rc(Ht($),{type:"textarea",id:"metadata",placeholder:"Optional JSON metadata",label:"Metadata",get disabled(){return qr(p)},rows:3,helpText:"Optional JSON data for additional information",get value(){return qr(v).metadata},set value(e){qr(v).metadata=e}}),Re($),Re(F);var H=Wt(F,2),G=Ht(H),W=Ht(G,!0);return Re(G),Re(H),Re(w),Re(g),ar(()=>{M.disabled=qr(p),G.disabled=qr(p),Ca(W,qr(p)?"Creating...":"Create Payment Instrument")}),ta("submit",w,async function(e){e.preventDefault(),Bt(f,null),Bt(h,null);const t=function(){if(!l())return"Account UUID is required";if(!qr(v).pan)return"Card number is required";if(!(null==r?void 0:r.isValidCard()))return(null==r?void 0:r.getValidationError())||"Please enter a valid card number";if(!qr(v).expiry)return"Expiry date is required";if(!(null==n?void 0:n.isValidExpiry()))return(null==n?void 0:n.getValidationError())||"Please enter a valid expiry date";return qr(v).securityCode?qr(v).nameOnCard?qr(v).addressLine1?qr(v).city?qr(v).state?qr(v).postalCode?qr(v).country?null:"Country is required":"Postal code is required":"State is required":"City is required":"Address line 1 is required":"Name on card is required":"Security code is required"}();if(t)Bt(f,t,!0);else{Bt(p,!0);try{const e=o.createPaymentInstrumentsService(),t=(null==n?void 0:n.getMonth())||"",r=(null==n?void 0:n.getYear())||"",a={account_uuid:l(),external_id:qr(v).externalId||`pi_${Date.now()}`,payment_instrument_type:"CARD",payment_instrument_details:{card:{pan:qr(v).pan,exp_month:t,exp_year:r,security_code:qr(v).securityCode,name_on_card:qr(v).nameOnCard,phone_number:qr(v).phoneNumber||void 0,email_address:qr(v).emailAddress||void 0,billing_address:{line_1:qr(v).addressLine1,line_2:qr(v).addressLine2||void 0,city:qr(v).city,state:qr(v).state,postal_code:qr(v).postalCode,country:qr(v).country}}},metadata:qr(v).metadata||void 0},i=await e.createPaymentInstrument(a);Bt(h,i,!0),null===c()||void 0===c()||c()(i),Bt(v,{pan:"",expiry:"",securityCode:"",nameOnCard:"",phoneNumber:"",emailAddress:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US",externalId:"",metadata:""},!0)}catch(a){const e=a instanceof Error?a:new Error("Unknown error occurred");Bt(f,e.message,!0),null===u()||void 0===u()||u()(e)}finally{Bt(p,!1)}}}),function(e,t,r=t){var a=!0;Jr(e,"change",t=>{var a,n=t?"[selected]":":checked";if(e.multiple)a=[].map.call(e.querySelectorAll(n),Xa);else{var o=e.querySelector(n)??e.querySelector("option:not([disabled])");a=o&&Xa(o)}r(a)}),tr(()=>{var n=t();if(Qa(e,n,a),a&&void 0===n){var o=e.querySelector(":checked");null!==o&&(n=Xa(o),r(n))}e.__value=n,a=!1}),Ja(e)}(M,()=>qr(v).country,e=>qr(v).country=e),va(e,g),qe({get jwt(){return i()},set jwt(e=""){i(e),wt()},get accountUuid(){return l()},set accountUuid(e=""){l(e),wt()},get debug(){return s()},set debug(e=!1){s(e),wt()},get onsuccess(){return c()},set onsuccess(e){c(e),wt()},get onerror(){return u()},set onerror(e){u(e),wt()}})}customElements.define("alviere-add-payment-instrument",Un(Au,{jwt:{},accountUuid:{},debug:{},onsuccess:{},onerror:{}},[],[],!0));const Iu=e=>e;function Bu(e,{delay:t=0,duration:r=400,easing:a=Iu}={}){const n=+getComputedStyle(e).opacity;return{delay:t,duration:r,easing:a,css:e=>"opacity: "+e*n}}const Nu=(()=>{const{subscribe:e,set:t,update:r}=function(e,t=re){let r=null;const a=new Set;function n(t){if(Pe(e,t)&&(e=t,r)){const t=!An.length;for(const r of a)r[1](),An.push(r,e);if(t){for(let e=0;e<An.length;e+=2)An[e][0](An[e+1]);An.length=0}}}function o(t){n(t(e))}return{set:n,update:o,subscribe:function(i,l=re){const s=[i,l];return a.add(s),1===a.size&&(r=t(n,o)||re),i(e),()=>{a.delete(s),0===a.size&&r&&(r(),r=null)}}}}({core:null,isInitialized:!1,config:null});return{subscribe:e,init:async e=>{const t=e.debug||!1;if(e.jwt)try{t&&N.info("🔐 Initializing shared AlviereCore instance in store...");const{getAlviereCore:a}=await Promise.resolve().then(()=>xu),n=a(e);r(t=>({...t,core:n,isInitialized:!0,config:e})),t&&N.info("✅ Shared AlviereCore instance created in store:",{accountUuid:n.getAccountUuid(),businessUuid:n.getBusinessUuid(),isFirstTimeUser:n.isFirstTimeUser()})}catch(a){N.error("❌ Failed to initialize AlviereCore in store:",a)}else t&&N.warn("⚠️ Cannot initialize AlviereCore - missing JWT")},updateJwt:e=>{r(t=>{var r;if(!t.core||!t.config)return(null==(r=t.config)?void 0:r.debug)&&N.warn("⚠️ Cannot update JWT - core not initialized"),t;const a=t.config.debug||!1;return a&&N.info("🔄 Updating JWT in shared AlviereCore instance (store)..."),t.core.configure({...t.config,jwt:e}),a&&N.info("✅ Shared AlviereCore updated with new JWT (store):",{accountUuid:t.core.getAccountUuid(),businessUuid:t.core.getBusinessUuid(),isFirstTimeUser:t.core.isFirstTimeUser()}),{...t,config:{...t.config,jwt:e}}})},reset:()=>{t({core:null,isInitialized:!1,config:null})},getCore:()=>{let t=null;return e(e=>{t=e.core})(),t}}})(),Ru=Nu.init;Nu.updateJwt;const zu=Nu.reset;function Lu(e){const{jwt:t="",businessUuid:r="",publicCertificate:a="",publicCertificateId:n="",debug:o=!1,isInFlow:i=!1,disabled:l=!1,readonly:s=!1,initialData:c={},submitHandler:u,customValidator:v,fieldSchemas:d={},formName:p="UnknownForm",stepType:f="FORM_STEP",stepIndex:h,enableAlviereCore:g=!0,resultTransformer:m,onSuccessCallback:b}=e;let y=At(!1),_=At(!1),w=At(!1),C=At(!1),x=At(0),E=At(0),S=At(0),k=At(null),T=At(null),A=At(null),I=At(Dt({...c})),B=At(Dt({})),R=At(Dt({})),z=At(!1),L=At(!1),D=At(Dt(t));const U=Dt(a),P=Dt(n);let V=At(null);Zt(()=>{if(g&&qr(D)&&""!==qr(D).trim()){const e=Nu.getCore();e?(Bt(V,e,!0),o&&N.info(`[${p}] ✅ Using shared AlviereCore instance from flow store`)):(o&&N.info(`[${p}] 🔍 Creating standalone AlviereCore instance...`),Bt(V,Cu({jwt:qr(D),debug:o,publicCertificate:U,publicCertificateId:P,business_uuid:r}),!0)),r&&qr(V)&&o&&N.info(`[${p}] 🔍 User state check:`,{accountUuid:qr(V).getAccountUuid(),businessUuid:qr(V).getBusinessUuid(),isFirstTimeUser:qr(V).isFirstTimeUser(),isScopedToPayee:qr(V).isScopedToPayee()})}});const M=rt(()=>()=>0===Object.keys(qr(R)).length),O=rt(()=>()=>Object.keys(qr(R)).length>0),j=rt(()=>()=>qr(M)()&&!qr(O)()),q=rt(()=>()=>!qr(y)&&!qr(_)&&!l&&!s&&qr(j)()),F=rt(()=>()=>0===qr(x)?0:qr(E)/qr(x)*100),K=rt(()=>()=>{const e=Object.keys(qr(B)).length;if(0===e)return 100;return Object.values(qr(B)).filter(e=>e.isValid).length/e*100});async function $(){if(qr(q))try{Bt(_,!0),Bt(y,!0),Bt(T,null);if(!J())throw new Error("Form validation failed");if(v){const e=v(qr(I));if(!e.isValid)throw new Error(e.firstError||"Custom validation failed")}qr(X).dispatch(As,{stepType:f,stepIndex:i?h:void 0,formData:{...qr(I)}});const e=await u(qr(I));Bt(k,e,!0),Rt(E),Rt(x),Bt(C,!0),Bt(z,!1),Bt(L,!1);const t=m?m(e):e;qr(X).dispatch(ks,{...t,stepType:f,stepIndex:i?h:void 0,success:!0}),null==b||b(e,qr(X))}catch(e){const t=e instanceof Error?e:new Error(String(e));Bt(T,t,!0),Rt(S),Rt(x),qr(X).dispatch(Ts,{data:t,stepType:f,stepIndex:i?h:void 0,success:!1,error:t}),N.error(`[${p}] Form submission failed:`,t)}finally{Bt(_,!1),Bt(y,!1)}else N.warn(`[${p}] Cannot submit: form validation failed or is disabled`)}function H(){Bt(I,{...c},!0),Bt(R,{},!0),Bt(B,{},!0),Bt(z,!1),Bt(L,!1),Bt(T,null),qr(X).dispatch(Is,{stepType:f,stepIndex:i?h:void 0})}function G(e,t){qr(I)[e]=t,Bt(z,!0),Bt(L,!0),qr(B)[e]?qr(B)[e].value=t:qr(B)[e]={name:e,value:t,isValid:!0,errorMessage:"",hasInteracted:!1,validationSchema:d[e]},Q(e)}function W(e,t){qr(R)[e]=t,qr(B)[e]&&(qr(B)[e].isValid=!1,qr(B)[e].errorMessage=t)}function Y(e){delete qr(R)[e],qr(B)[e]&&(qr(B)[e].isValid=!0,qr(B)[e].errorMessage="")}function Q(e){const t=qr(I)[e],r=d[e];if(!r)return!0;const a=Ps(t,r,e);return a.isValid?(Y(e),!0):(W(e,a.firstError||"Validation failed"),!1)}function J(){let e=!0;for(const t of Object.keys(d)){Q(t)||(e=!1)}return e}const X=rt(()=>ts(qr(A)));return{state:{get isLoading(){return qr(y)},get isSubmitting(){return qr(_)},get isPolling(){return qr(w)},get hasSubmitted(){return qr(C)},get totalSubmissions(){return qr(x)},get successCount(){return qr(E)},get errorCount(){return qr(S)},get lastResponse(){return qr(k)},get lastError(){return qr(T)},get formElement(){return qr(A)},set formElement(e){Bt(A,e,!0)},get formData(){return qr(I)},get fields(){return qr(B)},get validationErrors(){return qr(R)},get isValid(){return qr(j)()},get isDirty(){return qr(z)},get hasUnsavedChanges(){return qr(L)},get alviereCore(){return qr(V)}},computed:{get allFieldsValid(){return qr(M)()},get hasErrors(){return qr(O)()},get canSubmit(){return qr(q)()},get submitProgress(){return qr(F)()},get validationProgress(){return qr(K)()}},actions:{submit:$,reset:H,setFieldValue:G,getFieldValue:function(e){return qr(I)[e]},setFieldError:W,clearFieldError:Y,validateField:Q,validateAllFields:J,clearAllErrors:function(){Bt(R,{},!0);for(const e of Object.values(qr(B)))e.isValid=!0,e.errorMessage=""},setFormData:function(e){Bt(I,{...e},!0),Bt(z,!0),Bt(L,!0);for(const[t,r]of Object.entries(e))qr(B)[t]&&(qr(B)[t].value=r);J()},getFormData:function(){return{...qr(I)}},mergeFormData:function(e){Bt(I,{...qr(I),...e},!0),Bt(z,!0),Bt(L,!0),J()},markAsDirty:function(){Bt(z,!0),Bt(L,!0)},markAsClean:function(){Bt(z,!1),Bt(L,!1)},setLoading:function(e){Bt(y,e,!0)},setPolling:function(e){Bt(w,e,!0)},setJwt:function(e){e&&""!==e.trim()&&e!==qr(D)&&Bt(D,e,!0)}},handlers:{handleSubmit:async function(e){e.preventDefault(),await $()},handleReset:function(e){e.preventDefault(),H()},handleFieldChange:function(e,t){N.info("handleFieldChange",e,t),G(e,t),Y(e),Q(e)},handleFieldBlur:function(e){qr(B)[e]&&(qr(B)[e].hasInteracted=!0),Q(e)}},get eventDispatcher(){return qr(X)}}}Nu.getCore;var Du=ia('<h2 class="svelte-hf49ea">Create Consumer Account</h2>'),Uu=ia('<div><alviere-spinner><span slot="message"><!></span></alviere-spinner></div>',2),Pu=ia('<span class="validation-hint svelte-hf49ea">Please fill in all required fields to continue</span>'),Vu=ia('<span class="validation-error">Please fix the errors above</span>'),Mu=ia('<div class="alviere-create-consumer-account svelte-hf49ea"><!> <!> <form novalidate=""><div class="form-section svelte-hf49ea"><h3 class="svelte-hf49ea">Personal Information</h3> <div class="form-row svelte-hf49ea"><!> <!></div> <div class="form-row svelte-hf49ea"><!></div></div> <div class="form-actions svelte-hf49ea"><div class="form-status svelte-hf49ea"><!> <!></div> <alviere-button><!></alviere-button></div></form></div>',2);const Ou={hash:"svelte-hf49ea",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-create-consumer-account.svelte-hf49ea {max-width:100%;margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;position:relative;}.spinner-container.svelte-hf49ea {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}.spinner-standalone.svelte-hf49ea {position:relative !important;min-height:200px;display:flex;align-items:center;justify-content:center;}h2.svelte-hf49ea {color:#333;margin-bottom:20px;text-align:center;}h3.svelte-hf49ea {color:#555;margin-bottom:15px;border-bottom:2px solid #eee;padding-bottom:5px;}.form-section.svelte-hf49ea {margin-bottom:30px;padding:20px;background:#f9f9f9;border-radius:8px;}.form-row.svelte-hf49ea {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.form-status.svelte-hf49ea {margin-bottom:1rem;text-align:center;font-size:1.125rem;}.validation-hint.svelte-hf49ea {color:#6b7280;font-size:0.875rem;font-style:italic;}.form-actions.svelte-hf49ea {margin-top:24px;text-align:center;}'};function ju(e,t){je(t,!0),Oa(e,Ou);let r=zn(t,"jwt",7,""),a=zn(t,"businessUuid",15,""),n=zn(t,"isInFlow",15,!1),o=zn(t,"debug",15,!0),i=zn(t,"prefillData",31,()=>Dt({})),l=zn(t,"publicCertificate",15,""),s=zn(t,"publicCertificateId",15,""),c=At(!1);const u=Lu({jwt:r(),businessUuid:a(),publicCertificate:l(),publicCertificateId:s(),debug:o(),isInFlow:n(),initialData:{externalId:"",firstName:"",middleName:"",lastName:"",email:"",phone:"",dateOfBirth:"",ssn:"",employmentStatus:"FULL_TIME",profession:"",addressLabel:"Primary Address",addressLine1:"",addressLine2:"",addressCity:"",addressState:"",addressPostalCode:"",addressCountry:"USA"},fieldSchemas:{firstName:{required:"First Name is required",alphabetic:!0},lastName:{required:"Last Name is required",alphabetic:!0},email:{required:"Email Address is required",email:!0},phone:{phone:!0},dateOfBirth:{date:!0},ssn:{pattern:{regex:/^\d{3}-?\d{2}-?\d{4}$/,message:"Please enter a valid SSN"}},addressCity:{alphabetic:!0},addressPostalCode:{postalCode:!0}},formName:"CreateConsumerAccount",stepType:"CREATE_CONSUMER_ACCOUNT",stepIndex:n()?0:void 0,enableAlviereCore:!0,submitHandler:async e=>{var t,r;const n={first_name:e.firstName,last_name:e.lastName,email_address:e.email},o={external_id:e.externalId||`consumer-${Date.now()}`,information:{consumer_information:n},profile:i().profile||void 0,account_type:"CONSUMER",parent_account_uuid:a()};null===(r=null===(t=u.state.alviereCore)||void 0===t?void 0:t.getLogger())||void 0===r||r.info("🔍 Creating account using AlviereCore...");const l=u.state.alviereCore.createAccountsService();try{const e=await l.createAccount(o);if(e.account.account_uuid&&qr(f)){const t=new CustomEvent(Ls,{detail:{account_uuid:e.account.account_uuid,status:"CREATED"},bubbles:!0,composed:!0});qr(f).dispatchEvent(t),N.info("🚀 Dispatched account CREATED event:",t.detail)}if(e.account.account_uuid){u.actions.setPolling(!0);try{const t=await async function(e,t=5,r=6e3){if(!u.state.alviereCore)throw new Error("AlviereCore not initialized");const a=u.state.alviereCore.createAccountsService();for(let o=1;o<=t;o++)try{N.info(`🔍 Polling account status (attempt ${o}/${t})...`);const n=await a.getAccount(e);if("ACTIVE"===n.account.status)return N.info("✅ Account is now ACTIVE"),n;N.info(`⏳ Account status: ${n.account.status}, waiting...`),o<t&&await new Promise(e=>setTimeout(e,r))}catch(n){if(N.error(`❌ Error polling account status (attempt ${o}):`,n),o===t)throw new Error(`Failed to poll account status after ${t} attempts: ${n}`)}throw new ll("115001",`Account did not become active after ${t} polling attempts`)}(e.account.account_uuid);return t}finally{u.actions.setPolling(!1)}}return e}catch(s){if(s instanceof ll&&s.isErrorCode(wl))throw N.info("🔍 Error creating account:","Invalid JWT"),s;throw s}},resultTransformer:e=>({account_uuid:e.account.account_uuid}),onSuccessCallback:(e,t)=>{t.dispatch(Ls,{account_uuid:e.account.account_uuid,status:e.account.status})}});let v=At(!1),d=At(!1),p=At(!1),f=At(null);Aa(async()=>{var e,t;if(Bt(v,!0),null===(e=u.state.alviereCore)||void 0===e?void 0:e.isScopedToPayee()){const e=u.state.alviereCore.getAccountUuid();if(N.info("🔄 Returning user detected - JWT already scoped to consumer account:",e),e&&"862a2524-ce32-4fa7-b138-e7ac7e93c022"!==e)try{const t=await async function(e){if(N.info("🔍 Checking if account exists and is active...",e),N.warn("🔍 Debug:",o()),!u.state.alviereCore)throw new Error("AlviereCore not initialized");const t=u.state.alviereCore.createAccountsService(),r=await t.getAccount(e);if(N.info("🔍 Account result:",r.account),"ACTIVE"===r.account.status)return r;throw N.error(`❌ Account exists but is not active. Status: ${r.account.status}`,r.account),new ll(Al,`Account exists but is not active. Current status: ${r.account.status}`)}(e);if(t)return N.info("✅ Consumer account already exists and is active - skipping creation:",t),Bt(p,!0),void setTimeout(()=>{if(qr(f)){const e=new CustomEvent(Ls,{detail:{account_uuid:t.account.account_uuid,status:t.account.status,skipped:!0},bubbles:!0,composed:!0});qr(f).dispatchEvent(e),N.info("🚀 Dispatched account event (skipped) from host element:",e);const r=new CustomEvent(ks,{detail:{account_uuid:t.account.account_uuid,stepType:"CREATE_CONSUMER_ACCOUNT",stepIndex:n()?0:void 0,success:!0,skipped:!0},bubbles:!0,composed:!0});qr(f).dispatchEvent(r),N.info("🚀 Dispatched form-success event (skipped) from host element:",r)}},100)}catch(r){if(r instanceof ll&&r.isErrorCode(Al)){if(N.error("❌ Critical error: Account exists but is not active"),qr(f)){const e=new CustomEvent(Ts,{detail:{error:r,stepType:"CREATE_CONSUMER_ACCOUNT",stepIndex:n()?0:void 0},bubbles:!0,composed:!0});qr(f).dispatchEvent(e),N.info("🚀 Dispatched form-error event to MultiStepFlow:",e.detail)}return}N.warn("⚠️ Failed to fetch existing account, will show form:",r)}}else(null===(t=u.state.alviereCore)||void 0===t?void 0:t.isFirstTimeUser())&&N.info("👤 First-time user detected - showing account creation form");setTimeout(()=>{Bt(v,!1)},1e3)}),Zt(()=>{if("undefined"!=typeof window&&window.customElements&&qr(f)&&!qr(c)){o()&&N.info("Found web component element for attribute reflection for:",qr(f));const e=null===qr(f)||void 0===qr(f)?void 0:qr(f).getRootNode(),t=null==e?void 0:e.host;if(t){const e=t.getAttributeNames();if(e.includes("prefill-data")){const e=t.getAttribute("prefill-data");e&&(i(JSON.parse(e)),async function(){var e,t,r,a,n,o,l,s,c,v,f,h,g,m,b,y,_,w,C,x,E;const S=e=>null==e?"":String(e);u.state.formData.firstName=S(null===(t=null===(e=i().information)||void 0===e?void 0:e.consumer_information)||void 0===t?void 0:t.first_name),u.state.formData.middleName=S(null===(a=null===(r=i().information)||void 0===r?void 0:r.consumer_information)||void 0===a?void 0:a.middle_name),u.state.formData.lastName=S(null===(o=null===(n=i().information)||void 0===n?void 0:n.consumer_information)||void 0===o?void 0:o.last_name),u.state.formData.email=S(null===(s=null===(l=i().information)||void 0===l?void 0:l.consumer_information)||void 0===s?void 0:s.email_address),u.state.formData.phone=S(null===(v=null===(c=i().information)||void 0===c?void 0:c.consumer_information)||void 0===v?void 0:v.phone_number),u.state.formData.dateOfBirth=S(null===(h=null===(f=i().information)||void 0===f?void 0:f.consumer_information)||void 0===h?void 0:h.date_of_birth),u.state.formData.ssn=S(null===(m=null===(g=i().information)||void 0===g?void 0:g.consumer_information)||void 0===m?void 0:m.ssn),u.state.formData.addressLine1=S(null===(b=i().primary_address)||void 0===b?void 0:b.address_line_1),u.state.formData.addressLine2=S(null===(y=i().primary_address)||void 0===y?void 0:y.address_line_2),u.state.formData.addressCity=S(null===(_=i().primary_address)||void 0===_?void 0:_.city),u.state.formData.addressState=S(null===(w=i().primary_address)||void 0===w?void 0:w.state),u.state.formData.addressPostalCode=S(null===(C=i().primary_address)||void 0===C?void 0:C.postal_code),u.state.formData.addressCountry=S(null===(x=i().primary_address)||void 0===x?void 0:x.country)||"USA";const k=u.actions.validateAllFields();if(null===(E=u.state.alviereCore)||void 0===E?void 0:E.isScopedToPayee())return N.info("🔄 Skipping auto-submit - returning user detected, checking existing account..."),Bt(d,!1),void Bt(p,!0);k?(N.info("✅ Prefilled data is complete and valid, auto-submitting form..."),Bt(d,!0),setTimeout(async()=>{await u.actions.submit()},100)):(N.warn("⚠️ Prefilled data is incomplete or invalid, waiting for user input"),Bt(d,!1))}())}if(e.includes("public-certificate")){const e=t.getAttribute("public-certificate");e&&l(e)}if(e.includes("public-certificate-id")){const e=t.getAttribute("public-certificate-id");e&&s(e)}}}Bt(c,!0)});var h=Mu(),g=Ht(h),m=e=>{va(e,Du())};Ba(g,e=>{n()||qr(d)||qr(v)||qr(p)||e(m)});var b=Wt(g,2),y=e=>{var t=Uu();let r;var a=Ht(t);cn(a,"size","lg"),cn(a,"variant","circular");var n=Ht(a),o=Ht(n),i=e=>{va(e,ca("Account verified, proceeding..."))},l=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Checking account status..."))},n=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Your account is being validated..."))},n=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Waiting for account activation..."))},n=e=>{va(e,ca("Creating consumer account..."))};Ba(r,e=>{u.state.isPolling?e(a):e(n,!1)},!0),va(e,t)};Ba(r,e=>{qr(d)?e(a):e(n,!1)},!0),va(e,t)};Ba(r,e=>{qr(v)?e(a):e(n,!1)},!0),va(e,t)};Ba(o,e=>{qr(p)?e(i):e(l,!1)}),Re(n),Re(a),Re(t),ar(e=>r=Ga(t,1,"spinner-container svelte-hf49ea",null,r,e),[()=>({"spinner-standalone":qr(v)||qr(d)||qr(p)})]),_n(1,t,()=>Bu,()=>({duration:300})),_n(2,t,()=>Bu,()=>({duration:200})),va(e,t)};Ba(b,e=>{(u.state.isLoading||u.state.isPolling||qr(d)||qr(v)||qr(p))&&e(y)});var _=Wt(b,2);let w;var C=Ht(_),x=Wt(Ht(C),2),E=Ht(x);{let e=rt(()=>u.state.validationErrors.firstName?"invalid":"neutral"),t=rt(()=>u.state.validationErrors.firstName||"");Rc(E,{label:"First Name",placeholder:"Enter first name",required:!0,oninput:e=>u.handlers.handleFieldChange("firstName",e.target.value),get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return u.state.formData.firstName},set value(e){u.state.formData.firstName=e}})}var S=Wt(E,2);{let e=rt(()=>u.state.validationErrors.lastName?"invalid":"neutral"),t=rt(()=>u.state.validationErrors.lastName||"");Rc(S,{label:"Last Name",placeholder:"Enter last name",required:!0,oninput:e=>u.handlers.handleFieldChange("lastName",e.target.value),get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return u.state.formData.lastName},set value(e){u.state.formData.lastName=e}})}Re(x);var k=Wt(x,2),T=Ht(k);{let e=rt(()=>u.state.validationErrors.email?"invalid":"neutral"),t=rt(()=>u.state.validationErrors.email||"");Rc(T,{label:"Email Address",placeholder:"Enter email address",type:"email",required:!0,oninput:e=>u.handlers.handleFieldChange("email",e.target.value),get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return u.state.formData.email},set value(e){u.state.formData.email=e}})}Re(k),Re(C);var A=Wt(C,2),I=Ht(A),B=Ht(I),R=e=>{va(e,Pu())};Ba(B,e=>{u.computed.canSubmit||e(R)});var z=Wt(B,2),L=e=>{va(e,Vu())};Ba(z,e=>{u.computed.hasErrors&&u.computed.canSubmit&&e(L)}),Re(I);var D=Wt(I,2);cn(D,"type","submit"),ar(()=>cn(D,"disabled",!u.computed.canSubmit)),cn(D,"variant","primary"),cn(D,"size","md"),ar(()=>cn(D,"handler",u.handlers.handleSubmit));var U=Ht(D),P=e=>{va(e,ca("Creating Consumer Account..."))},V=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Waiting for Account Activation..."))},n=e=>{va(e,ca("Create Consumer Account"))};Ba(r,e=>{u.state.isPolling?e(a):e(n,!1)},!0),va(e,t)};return Ba(U,e=>{u.state.isLoading?e(P):e(V,!1)}),Re(D),Re(A),Re(_),kn(_,e=>u.state.formElement=e,()=>{var e;return null==(e=null==u?void 0:u.state)?void 0:e.formElement}),Re(h),kn(h,e=>Bt(f,e),()=>qr(f)),ar(e=>w=Ya(_,"",w,e),[()=>({display:qr(v)||qr(d)||qr(p)?"none":"block"})]),ta("submit",_,function(...e){var t;null==(t=u.handlers.handleSubmit)||t.apply(this,e)}),va(e,h),qe({get jwt(){return r()},set jwt(e=""){r(e),wt()},get businessUuid(){return a()},set businessUuid(e=""){a(e),wt()},get isInFlow(){return n()},set isInFlow(e=!1){n(e),wt()},get debug(){return o()},set debug(e=!0){o(e),wt()},get prefillData(){return i()},set prefillData(e={}){i(e),wt()},get publicCertificate(){return l()},set publicCertificate(e=""){l(e),wt()},get publicCertificateId(){return s()},set publicCertificateId(e=""){s(e),wt()}})}customElements.define("alviere-create-consumer-account",Un(ju,{jwt:{},businessUuid:{},isInFlow:{},debug:{},prefillData:{},publicCertificate:{},publicCertificateId:{}},[],[],!0));var qu=ia('<h2 class="svelte-5gpp4o">Create Business Account</h2>'),Fu=ia('<div><alviere-spinner><span slot="message"><!></span></alviere-spinner></div>',2),Ku=ia('<span class="validation-hint svelte-5gpp4o">Please fill in all required fields to continue</span>'),$u=ia('<span class="validation-error">Please fix the errors above</span>'),Hu=ia('<div class="alviere-create-business-account svelte-5gpp4o"><!> <!> <form novalidate=""><div class="form-section svelte-5gpp4o"><h3 class="svelte-5gpp4o">Business Information</h3> <div class="form-row svelte-5gpp4o"><!> <!></div> <div class="form-row svelte-5gpp4o"><!> <!></div> <div class="form-row svelte-5gpp4o"><!></div></div> <div class="form-actions svelte-5gpp4o"><div class="form-status svelte-5gpp4o"><!> <!></div> <alviere-button><!></alviere-button></div></form></div>',2);const Gu={hash:"svelte-5gpp4o",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-create-business-account.svelte-5gpp4o {max-width:100%;margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;position:relative;}.spinner-container.svelte-5gpp4o {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}.spinner-standalone.svelte-5gpp4o {position:relative !important;min-height:200px;display:flex;align-items:center;justify-content:center;}h2.svelte-5gpp4o {color:#333;margin-bottom:20px;text-align:center;}h3.svelte-5gpp4o {color:#555;margin-bottom:15px;border-bottom:2px solid #eee;padding-bottom:5px;}.form-section.svelte-5gpp4o {margin-bottom:30px;padding:20px;background:#f9f9f9;border-radius:8px;}.form-row.svelte-5gpp4o {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.form-status.svelte-5gpp4o {margin-bottom:1rem;text-align:center;font-size:1.125rem;}.validation-hint.svelte-5gpp4o {color:#6b7280;font-size:0.875rem;font-style:italic;}.form-actions.svelte-5gpp4o {margin-top:24px;text-align:center;}'};function Wu(e,t){var r,a;je(t,!0),Oa(e,Gu);let n=zn(t,"jwt",7,""),o=zn(t,"businessUuid",15,""),i=zn(t,"isInFlow",15,!1),l=zn(t,"debug",15,!0),s=zn(t,"prefillData",31,()=>Dt({})),c=zn(t,"publicCertificate",15,""),u=zn(t,"publicCertificateId",15,""),v=At(!1);const d={externalId:"",businessType:(null===(a=null===(r=null===s()||void 0===s()?void 0:s().information)||void 0===r?void 0:r.business_information)||void 0===a?void 0:a.business_type)||"SOLE_PROPRIETORSHIP",businessName:"",doingBusinessAs:"",stateOfIncorporation:"",countryOfIncorporation:"",incorporationDate:"",ein:"",addressLabel:"Primary Address",addressLine1:"",addressLine2:"",addressCity:"",addressState:"",addressPostalCode:"",addressCountry:"USA"},p=[{value:"SOLE_PROPRIETORSHIP",label:"Sole Proprietorship"},{value:"LLC",label:"LLC"},{value:"LLP",label:"LLP"},{value:"CORPORATION_C",label:"Corporation C"},{value:"CORPORATION_S",label:"Corporation S"}],f=[{code:"AL",name:"Alabama"},{code:"AK",name:"Alaska"},{code:"AZ",name:"Arizona"},{code:"AR",name:"Arkansas"},{code:"CA",name:"California"},{code:"CO",name:"Colorado"},{code:"CT",name:"Connecticut"},{code:"DE",name:"Delaware"},{code:"FL",name:"Florida"},{code:"GA",name:"Georgia"},{code:"HI",name:"Hawaii"},{code:"ID",name:"Idaho"},{code:"IL",name:"Illinois"},{code:"IN",name:"Indiana"},{code:"IA",name:"Iowa"},{code:"KS",name:"Kansas"},{code:"KY",name:"Kentucky"},{code:"LA",name:"Louisiana"},{code:"ME",name:"Maine"},{code:"MD",name:"Maryland"},{code:"MA",name:"Massachusetts"},{code:"MI",name:"Michigan"},{code:"MN",name:"Minnesota"},{code:"MS",name:"Mississippi"},{code:"MO",name:"Missouri"},{code:"MT",name:"Montana"},{code:"NE",name:"Nebraska"},{code:"NV",name:"Nevada"},{code:"NH",name:"New Hampshire"},{code:"NJ",name:"New Jersey"},{code:"NM",name:"New Mexico"},{code:"NY",name:"New York"},{code:"NC",name:"North Carolina"},{code:"ND",name:"North Dakota"},{code:"OH",name:"Ohio"},{code:"OK",name:"Oklahoma"},{code:"OR",name:"Oregon"},{code:"PA",name:"Pennsylvania"},{code:"RI",name:"Rhode Island"},{code:"SC",name:"South Carolina"},{code:"SD",name:"South Dakota"},{code:"TN",name:"Tennessee"},{code:"TX",name:"Texas"},{code:"UT",name:"Utah"},{code:"VT",name:"Vermont"},{code:"VA",name:"Virginia"},{code:"WA",name:"Washington"},{code:"WV",name:"West Virginia"},{code:"WI",name:"Wisconsin"},{code:"WY",name:"Wyoming"},{code:"DC",name:"District of Columbia"},{code:"AS",name:"American Samoa"},{code:"GU",name:"Guam"},{code:"MP",name:"Northern Mariana Islands"},{code:"PR",name:"Puerto Rico"},{code:"VI",name:"U.S. Virgin Islands"}],h=[{value:"USA",label:"United States"},{value:"CAN",label:"Canada"},{value:"MEX",label:"Mexico"},{value:"GBR",label:"United Kingdom"}],g=Lu({jwt:n(),businessUuid:o(),publicCertificate:c(),publicCertificateId:u(),debug:l(),isInFlow:i(),initialData:d,fieldSchemas:{businessType:{required:"Business Type is required"},businessName:{required:"Business Name is required",alphabetic:!0},countryOfIncorporation:{required:"Country of Incorporation is required"},stateOfIncorporation:{required:"State of Incorporation is required"},ein:{required:"EIN is required",pattern:{regex:/^\d{2}-\d{7}$/,message:"Please enter a valid EIN"}}},formName:"CreateBusinessAccount",stepType:"CREATE_BUSINESS_ACCOUNT",stepIndex:i()?0:void 0,enableAlviereCore:!0,submitHandler:async e=>{var t,r;const a={business_type:e.businessType,business_name:e.businessName,state_of_incorporation:e.stateOfIncorporation,country_of_incorporation:e.countryOfIncorporation,ein:e.ein||void 0},n={external_id:e.externalId||`business-${Date.now()}`,information:{business_information:a},profile:s().profile||void 0,account_type:"BUSINESS",parent_account_uuid:o()};if(!g.state.alviereCore)throw new ll(sl,"AlviereCore not initialized");null===(r=null===(t=g.state.alviereCore)||void 0===t?void 0:t.getLogger())||void 0===r||r.info("🔍 Creating business account using AlviereCore...");const i=g.state.alviereCore.createAccountsService(),l=await i.createAccount(n);if(l.account.account_uuid&&qr(_)){const e=new CustomEvent(Ls,{detail:{account_uuid:l.account.account_uuid,status:"CREATED"},bubbles:!0,composed:!0});qr(_).dispatchEvent(e),N.info("🚀 Dispatched account CREATED event:",e.detail)}if(l.account.account_uuid){g.actions.setPolling(!0);try{const e=await async function(e,t=5,r=6e3){if(!g.state.alviereCore)throw new Error("AlviereCore not initialized");const a=g.state.alviereCore.createAccountsService();for(let o=1;o<=t;o++)try{N.info(`🔍 Polling account status (attempt ${o}/${t})...`);const n=await a.getAccount(e);if("ACTIVE"===n.account.status)return N.info("✅ Account is now ACTIVE"),n;N.info(`⏳ Account status: ${n.account.status}, waiting...`),o<t&&await new Promise(e=>setTimeout(e,r))}catch(n){if(N.error(`❌ Error polling account status (attempt ${o}):`,n),o===t)throw new Error(`Failed to poll account status after ${t} attempts: ${n}`)}throw new ll("115001",`Account did not become active after ${t} polling attempts`)}(l.account.account_uuid);return e}finally{g.actions.setPolling(!1)}}return l},resultTransformer:e=>({account_uuid:e.account.account_uuid}),onSuccessCallback:(e,t)=>{t.dispatch(Ls,{account_uuid:e.account.account_uuid,status:e.account.status})}});let m=At(!1),b=At(!1),y=At(!1),_=At(null);Aa(async()=>{var e,t;if(Bt(m,!0),null===(e=g.state.alviereCore)||void 0===e?void 0:e.isScopedToPayee()){const e=g.state.alviereCore.getAccountUuid();if(N.info("🔄 Returning user detected - JWT already scoped to payor account:",e),e&&"862a2524-ce32-4fa7-b138-e7ac7e93c022"!==e)try{const t=await async function(e){if(N.info("🔍 Checking if account exists and is active...",e),N.warn("🔍 Debug:",l()),!g.state.alviereCore)throw new Error("AlviereCore not initialized");const t=g.state.alviereCore.createAccountsService(),r=await t.getAccount(e);if(N.info("🔍 Account result:",r.account),"ACTIVE"===r.account.status)return r;throw N.error(`❌ Account exists but is not active. Status: ${r.account.status}`,r.account),new ll(Al,`Account exists but is not active. Current status: ${r.account.status}`)}(e);if(t)return N.info("✅ Business account already exists and is active - skipping creation:",t),Bt(y,!0),void setTimeout(()=>{if(qr(_)){const e=new CustomEvent(Ls,{detail:{account_uuid:t.account.account_uuid,status:t.account.status,skipped:!0},bubbles:!0,composed:!0});qr(_).dispatchEvent(e),N.info("🚀 Dispatched account event (skipped) from host element:",e);const r=new CustomEvent(ks,{detail:{account_uuid:t.account.account_uuid,stepType:"CREATE_BUSINESS_ACCOUNT",stepIndex:i()?0:void 0,success:!0,skipped:!0},bubbles:!0,composed:!0});qr(_).dispatchEvent(r),N.info("🚀 Dispatched form-success event (skipped) from host element:",r)}},100)}catch(r){if(r instanceof ll&&r.isErrorCode(Al)){if(N.error("❌ Critical error: Account exists but is not active"),qr(_)){const e=new CustomEvent(Ts,{detail:{error:r,stepType:"CREATE_BUSINESS_ACCOUNT",stepIndex:i()?0:void 0},bubbles:!0,composed:!0});qr(_).dispatchEvent(e),N.info("🚀 Dispatched form-error event to MultiStepFlow:",e.detail)}return}N.warn("⚠️ Failed to fetch existing account, will show form:",r)}}else(null===(t=g.state.alviereCore)||void 0===t?void 0:t.isFirstTimeUser())&&N.info("👤 First-time user detected - showing account creation form");setTimeout(()=>{Bt(m,!1)},1e3)}),Zt(()=>{if("undefined"!=typeof window&&window.customElements&&qr(_)&&!qr(v)){l()&&N.info("Found web component element for attribute reflection for:",qr(_));const e=null===qr(_)||void 0===qr(_)?void 0:qr(_).getRootNode(),t=null==e?void 0:e.host;if(t){const e=t.getAttributeNames();if(e.includes("prefill-data")){const e=t.getAttribute("prefill-data");e&&(s(JSON.parse(e)),async function(){var e,t,r,a,n,o,i,l,c,u,v,d,p,f,h,m,_,w,C,x,E;const S=e=>null==e?"":String(e);g.state.formData.businessType=S(null===(t=null===(e=s().information)||void 0===e?void 0:e.business_information)||void 0===t?void 0:t.business_type),g.state.formData.businessName=S(null===(a=null===(r=s().information)||void 0===r?void 0:r.business_information)||void 0===a?void 0:a.business_name),g.state.formData.doingBusinessAs=S(null===(o=null===(n=s().information)||void 0===n?void 0:n.business_information)||void 0===o?void 0:o.doing_business_as),g.state.formData.stateOfIncorporation=S(null===(l=null===(i=s().information)||void 0===i?void 0:i.business_information)||void 0===l?void 0:l.state_of_incorporation),g.state.formData.countryOfIncorporation=S(null===(u=null===(c=s().information)||void 0===c?void 0:c.business_information)||void 0===u?void 0:u.country_of_incorporation),g.state.formData.incorporationDate=S(null===(d=null===(v=s().information)||void 0===v?void 0:v.business_information)||void 0===d?void 0:d.incorporation_date),g.state.formData.ein=S(null===(f=null===(p=s().information)||void 0===p?void 0:p.business_information)||void 0===f?void 0:f.ein),g.state.formData.addressLine1=S(null===(h=s().primary_address)||void 0===h?void 0:h.address_line_1),g.state.formData.addressLine2=S(null===(m=s().primary_address)||void 0===m?void 0:m.address_line_2),g.state.formData.addressCity=S(null===(_=s().primary_address)||void 0===_?void 0:_.city),g.state.formData.addressState=S(null===(w=s().primary_address)||void 0===w?void 0:w.state),g.state.formData.addressPostalCode=S(null===(C=s().primary_address)||void 0===C?void 0:C.postal_code),g.state.formData.addressCountry=S(null===(x=s().primary_address)||void 0===x?void 0:x.country)||"USA";const k=g.actions.validateAllFields();if(null===(E=g.state.alviereCore)||void 0===E?void 0:E.isScopedToPayee())return N.info("🔄 Skipping auto-submit - returning user detected, checking existing account..."),Bt(b,!1),void Bt(y,!0);k?(N.info("✅ Prefilled data is complete and valid, auto-submitting form..."),Bt(b,!0),setTimeout(async()=>{await g.actions.submit()},100)):(N.warn("⚠️ Prefilled data is incomplete or invalid, waiting for user input"),Bt(b,!1))}())}if(e.includes("public-certificate")){const e=t.getAttribute("public-certificate");e&&c(e)}if(e.includes("public-certificate-id")){const e=t.getAttribute("public-certificate-id");e&&u(e)}}}Bt(v,!0)});var w=Hu(),C=Ht(w),x=e=>{va(e,qu())};Ba(C,e=>{i()||qr(b)||qr(m)||qr(y)||e(x)});var E=Wt(C,2),S=e=>{var t=Fu();let r;var a=Ht(t);cn(a,"size","lg"),cn(a,"variant","circular");var n=Ht(a),o=Ht(n),i=e=>{va(e,ca("Account verified, proceeding..."))},l=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Checking account status..."))},n=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Your account is being validated..."))},n=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Waiting for account activation..."))},n=e=>{va(e,ca("Creating business account..."))};Ba(r,e=>{g.state.isPolling?e(a):e(n,!1)},!0),va(e,t)};Ba(r,e=>{qr(b)?e(a):e(n,!1)},!0),va(e,t)};Ba(r,e=>{qr(m)?e(a):e(n,!1)},!0),va(e,t)};Ba(o,e=>{qr(y)?e(i):e(l,!1)}),Re(n),Re(a),Re(t),ar(e=>r=Ga(t,1,"spinner-container svelte-5gpp4o",null,r,e),[()=>({"spinner-standalone":qr(m)||qr(b)||qr(y)})]),_n(1,t,()=>Bu,()=>({duration:300})),_n(2,t,()=>Bu,()=>({duration:200})),va(e,t)};Ba(E,e=>{(g.state.isLoading||g.state.isPolling||qr(b)||qr(m)||qr(y))&&e(S)});var k=Wt(E,2);let T;var A=Ht(k),I=Wt(Ht(A),2),B=Ht(I);{let e=rt(()=>g.state.validationErrors.businessType?"invalid":"neutral"),t=rt(()=>g.state.validationErrors.businessType||"");yu(B,{label:"Business Type",get options(){return p},placeholder:"Select business type",required:!0,onchange:e=>g.handlers.handleFieldChange("businessType",e.detail.value),get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return g.state.formData.businessType},set value(e){g.state.formData.businessType=e}})}Rc(Wt(B,2),{label:"Business Name",placeholder:"Enter business name",required:!0,oninput:e=>{var t;return g.handlers.handleFieldChange("businessName",(null==(t=e.target)?void 0:t.value)||"")},get value(){return g.state.formData.businessName},set value(e){g.state.formData.businessName=e}}),Re(I);var R=Wt(I,2),z=Ht(R);{let e=rt(()=>g.state.validationErrors.countryOfIncorporation?"invalid":"neutral"),t=rt(()=>g.state.validationErrors.countryOfIncorporation||"");yu(z,{label:"Country of Incorporation",get options(){return h},placeholder:"Select country of incorporation",required:!0,onchange:e=>g.handlers.handleFieldChange("countryOfIncorporation",e.detail.value),get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return g.state.formData.countryOfIncorporation},set value(e){g.state.formData.countryOfIncorporation=e}})}var L=Wt(z,2);{let e=rt(()=>f.map(e=>({value:e.code,label:e.name}))),t=rt(()=>g.state.validationErrors.stateOfIncorporation?"invalid":"neutral"),r=rt(()=>g.state.validationErrors.stateOfIncorporation||"");yu(L,{label:"State of Incorporation",get options(){return qr(e)},placeholder:"Select state of incorporation",required:!0,onchange:e=>g.handlers.handleFieldChange("stateOfIncorporation",e.detail.value),get validationState(){return qr(t)},get errorMessage(){return qr(r)},get value(){return g.state.formData.stateOfIncorporation},set value(e){g.state.formData.stateOfIncorporation=e}})}Re(R);var D=Wt(R,2),U=Ht(D);{let e=rt(()=>g.state.validationErrors.ein?"invalid":"neutral"),t=rt(()=>g.state.validationErrors.ein||"");Rc(U,{label:"EIN",placeholder:"Enter EIN",required:!0,oninput:e=>{var t;return g.handlers.handleFieldChange("ein",(null==(t=e.target)?void 0:t.value)||"")},get validationState(){return qr(e)},get errorMessage(){return qr(t)},get value(){return g.state.formData.ein},set value(e){g.state.formData.ein=e}})}Re(D),Re(A);var P=Wt(A,2),V=Ht(P),M=Ht(V),O=e=>{va(e,Ku())};Ba(M,e=>{g.computed.canSubmit||e(O)});var j=Wt(M,2),q=e=>{va(e,$u())};Ba(j,e=>{g.computed.hasErrors&&e(q)}),Re(V);var F=Wt(V,2);cn(F,"type","submit"),ar(()=>cn(F,"disabled",!g.computed.canSubmit)),cn(F,"variant","primary"),cn(F,"size","md"),ar(()=>cn(F,"handler",g.handlers.handleSubmit));var K=Ht(F),$=e=>{va(e,ca("Creating Business Account..."))},H=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,ca("Waiting for Account Activation..."))},n=e=>{va(e,ca("Create Business Account"))};Ba(r,e=>{g.state.isPolling?e(a):e(n,!1)},!0),va(e,t)};return Ba(K,e=>{g.state.isLoading?e($):e(H,!1)}),Re(F),Re(P),Re(k),kn(k,e=>g.state.formElement=e,()=>{var e;return null==(e=null==g?void 0:g.state)?void 0:e.formElement}),Re(w),kn(w,e=>Bt(_,e),()=>qr(_)),ar(e=>T=Ya(k,"",T,e),[()=>({display:qr(m)||qr(b)||qr(y)?"none":"block"})]),ta("submit",k,function(...e){var t;null==(t=g.handlers.handleSubmit)||t.apply(this,e)}),va(e,w),qe({get jwt(){return n()},set jwt(e=""){n(e),wt()},get businessUuid(){return o()},set businessUuid(e=""){o(e),wt()},get isInFlow(){return i()},set isInFlow(e=!1){i(e),wt()},get debug(){return l()},set debug(e=!0){l(e),wt()},get prefillData(){return s()},set prefillData(e={}){s(e),wt()},get publicCertificate(){return c()},set publicCertificate(e=""){c(e),wt()},get publicCertificateId(){return u()},set publicCertificateId(e=""){u(e),wt()}})}customElements.define("alviere-create-business-account",Un(Wu,{jwt:{},businessUuid:{},isInFlow:{},debug:{},prefillData:{},publicCertificate:{},publicCertificateId:{}},[],[],!0));var Yu=ia("<alviere-create-business-account></alviere-create-business-account>",2),Qu=ia("<alviere-create-consumer-account></alviere-create-consumer-account>",2);function Ju(e,t){var r,a;je(t,!0);let n=zn(t,"config",31,()=>Dt({})),o=zn(t,"jwt",7,""),i=zn(t,"debug",7,!1),l=zn(t,"publicCertificate",7,""),s=zn(t,"publicCertificateId",7,""),c=zn(t,"businessUuid",7,"");N.info("config",n());let u=At(Dt(!!(null===(a=null===(r=n().formData)||void 0===r?void 0:r.information)||void 0===a?void 0:a.business_information))),v=At(Dt(n().formData));N.info("prefillData",qr(v));var d=ua(),p=Gt(d),f=e=>{var t=Yu();ar(()=>cn(t,"prefill-data",JSON.stringify(n().formData))),ar(()=>cn(t,"jwt",o())),ar(()=>cn(t,"businessUuid",c())),ar(()=>cn(t,"debug",i())),ar(()=>cn(t,"publicCertificate",l())),ar(()=>cn(t,"publicCertificateId",s())),va(e,t)},h=e=>{var t=Qu();ar(()=>cn(t,"prefill-data",JSON.stringify(n().formData))),ar(()=>cn(t,"jwt",o())),ar(()=>cn(t,"businessUuid",c())),ar(()=>cn(t,"publicCertificate",l())),ar(()=>cn(t,"publicCertificateId",s())),va(e,t)};return Ba(p,e=>{qr(u)?e(f):e(h,!1)}),va(e,d),qe({get config(){return n()},set config(e={}){n(e),wt()},get jwt(){return o()},set jwt(e=""){o(e),wt()},get debug(){return i()},set debug(e=!1){i(e),wt()},get publicCertificate(){return l()},set publicCertificate(e=""){l(e),wt()},get publicCertificateId(){return s()},set publicCertificateId(e=""){s(e),wt()},get businessUuid(){return c()},set businessUuid(e=""){c(e),wt()}})}customElements.define("alviere-create-account",Un(Ju,{config:{},jwt:{},debug:{},publicCertificate:{},publicCertificateId:{},businessUuid:{}},[],[],!0));const Xu=new Map,Zu={"011000015":{routing_number:"011000015",name:"Federal Reserve Bank",city:"Atlanta"},"021001208":{routing_number:"021001208",name:"Federal Reserve Bank",city:"East Rutherford"},"021000322":{routing_number:"021000322",name:"Bank of America, N.A.",city:"Richmond"},"031000503":{routing_number:"031000503",name:"Wells Fargo Bank",city:"Minneapolis"},"041000014":{routing_number:"041000014",name:"Federal Reserve Bank",city:"Atlanta"},"051000017":{routing_number:"051000017",name:"Bank of A merica, N.A.",city:"Henrico"},"061000104":{routing_number:"061000104",name:"Suntrust",city:"Orlando"},"071000013":{routing_number:"071000013",name:"JPMorgan Chase",city:"Belleville"},"081000032":{routing_number:"081000032",name:"Bank of America, N.A.",city:"Henrico"},"091000019":{routing_number:"091000019",name:"Wells Fargo Bank",city:"Minneapolis"},111000025:{routing_number:"111000025",name:"Bank of America, N.A.",city:"Henrico"},121058313:{routing_number:"121058313",name:"Federal Reserve Bank SF- B, S & R",city:"San Francisco"},"021000021":{routing_number:"021000021",name:"JPMorgan Chase Bank",city:"Tampa"},"026009593":{routing_number:"026009593",name:"Bank of America, N.A.",city:"Richmond"},121000248:{routing_number:"121000248",name:"Wells Fargo Bank",city:"Minneapolis"},"021000089":{routing_number:"021000089",name:"Citibank",city:"New Castle"}},ev={"01":"Boston","02":"New York","03":"Philadelphia","04":"Cleveland","05":"Richmond","06":"Atlanta","07":"Chicago","08":"St. Louis","09":"Minneapolis",10:"Kansas City",11:"Dallas",12:"San Francisco"};async function tv(e,t){const r=e.replace(/[-\s]/g,"");if(!/^\d{9}$/.test(r))return null;if(Xu.has(r))return Xu.get(r);if(t)try{const e=t.createBankInfoService(),a=await e.getBankInfo(r);if(a&&a.bank_info)return a.bank_info}catch(a){return t.getLogger().info(`Bank info API call failed, using local lookup: ${a}`),t.getLogger().warn("⚠️ [DEPRECATED] Using local routing number lookup as fallback. This will be removed in a future version. Ensure API connectivity for accurate bank information."),rv(r)}return null==t||t.getLogger().warn("⚠️ [DEPRECATED] Using local routing number lookup. This will be removed in a future version. Pass AlviereCore instance to lookupRoutingNumber() for API-based lookup."),rv(r)}function rv(e){const t=e.replace(/[-\s]/g,"");if(!/^\d{9}$/.test(t))return null;if(Zu[t])return Zu[t];const r=t.substring(0,2);if(ev[r])return{routing_number:t,name:"Federal Reserve Bank",city:ev[r]};const a=parseInt(t.charAt(0));return 0===a||1===a?{routing_number:t,name:"Federal Reserve Bank",city:ev[r]}:2===a||3===a?{routing_number:t,name:"Commercial Bank",city:"Unknown"}:4===a||5===a?{routing_number:t,name:"Thrift Institution",city:"Unknown"}:6===a||7===a?{routing_number:t,name:"Credit Union",city:"Unknown"}:8===a?{routing_number:t,name:"Special Purpose",city:"Unknown"}:{routing_number:t,name:"Unknown Bank",city:"Unknown"}}function av(e){const t=e.replace(/[-\s]/g,"");return 9===t.length?`${t.slice(0,3)}-${t.slice(3,6)}-${t.slice(6)}`:e}var nv=ia('<div class="spinner-container svelte-hrbllu"><alviere-spinner></alviere-spinner></div>',2),ov=ia('<div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Region:</span> <span class="value svelte-hrbllu"> </span></div>'),iv=ia('<div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Description:</span> <span class="value description svelte-hrbllu"> </span></div>'),lv=ia('<div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Bank:</span> <span class="value svelte-hrbllu"> </span></div> <!> <!>',1),sv=ia('<div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Account Type:</span> <span class="value svelte-hrbllu"> </span></div>'),cv=ia('<alviere-list-item><div slot="leading"><alviere-badge> </alviere-badge></div> <div slot="primary-text"><span> </span></div> <div slot="secondary-text"><span> </span></div> <div slot="tertiary-text"><span> </span></div> <div slot="actions"><alviere-button></alviere-button></div> <div slot="expanded-content"><div class="bank-accounts-section__card-content svelte-hrbllu"><div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Account Number:</span> <span class="value svelte-hrbllu"> </span></div> <div class="bank-accounts-section__card-content__info-row svelte-hrbllu"><span class="label svelte-hrbllu">Routing/SWIFT:</span> <span class="value svelte-hrbllu"> </span></div> <!> <!></div></div></alviere-list-item>',2),uv=ia('<div class="bank-accounts-section svelte-hrbllu"><div class="alviere-add-bank-account__header svelte-hrbllu"><h2 class="svelte-hrbllu"> </h2> <alviere-button>Add New Bank Account</alviere-button></div> <alviere-list></alviere-list> <div class="alviere-add-bank-account__footer svelte-hrbllu"><alviere-button>Continue to Payment</alviere-button></div></div>',2),vv=ia('<alviere-button><span class="alviere-add-bank-account__button__label">Back to Bank Accounts</span></alviere-button>',2),dv=ia('<span class="bank-region svelte-hrbllu"> </span>'),pv=ia('<div class="routing-info svelte-hrbllu"><div class="routing-info-header svelte-hrbllu"><span class="bank-name svelte-hrbllu"> </span> <!></div></div>'),fv=ia("<alviere-spinner></alviere-spinner>",2),hv=ia("<!> <!>",1),gv=ia('<div class="alviere-add-bank-account__form__row alviere-add-bank-account__form__row--banking-info svelte-hrbllu"><alviere-badge>ACH</alviere-badge> <!></div> <div class="alviere-add-bank-account__form__row svelte-hrbllu"><!> <!></div> <div class="alviere-add-bank-account__form__row svelte-hrbllu"><!> <!></div>',3),mv=ia('<span class="validation-hint svelte-hrbllu">Please fill in all required fields to continue</span>'),bv=ia('<span class="validation-error svelte-hrbllu">Please fix the errors above</span>'),yv=ia('<span class="validation-error svelte-hrbllu" role="alert"> </span>'),_v=ia('<form novalidate="" class="alviere-add-bank-account__form svelte-hrbllu"><div class="alviere-add-bank-account__header svelte-hrbllu"><h2 class="svelte-hrbllu">Add Bank Account</h2> <!></div> <div class="alviere-add-bank-account__form__section"><!></div> <div class="form-actions svelte-hrbllu"><div class="form-status svelte-hrbllu"><!> <!> <!></div> <alviere-button> </alviere-button></div></form>',2),wv=ia('<div class="alviere-add-bank-account svelte-hrbllu"><!> <!> <!></div>');const Cv={hash:"svelte-hrbllu",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-add-bank-account.svelte-hrbllu {max-width:100%;margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;position:relative;}.alviere-add-bank-account__header.svelte-hrbllu {display:flex;justify-content:space-between;align-items:center;margin-bottom:2rem;padding-bottom:1rem;border-bottom:1px solid #eee;}.alviere-add-bank-account__header.svelte-hrbllu h2:where(.svelte-hrbllu) {font-size:1.25rem;color:var(--gray-700);margin:0;}\n@media (max-width: 768px) {.alviere-add-bank-account__header.svelte-hrbllu {justify-content:space-between;}\n}\n@media (max-width: 768px) {.alviere-add-bank-account__header.svelte-hrbllu .alviere-add-bank-account__button__label {display:none;}\n}.alviere-add-bank-account__footer.svelte-hrbllu {display:flex;justify-content:center;align-items:center;padding-top:2rem;}.alviere-add-bank-account__form.svelte-hrbllu {max-width:100%;margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;background:#ffffff;}.alviere-add-bank-account__form__row.svelte-hrbllu {display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:1rem;padding-bottom:1rem;}.alviere-add-bank-account__form__row--banking-info.svelte-hrbllu {display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:0.5rem;}.routing-info.svelte-hrbllu {border-radius:6px;padding:0.5rem;}.routing-info-header.svelte-hrbllu {display:flex;align-items:center;gap:0.5rem;}.routing-info.svelte-hrbllu .bank-name:where(.svelte-hrbllu) {font-weight:600;color:var(--gray-600);font-size:0.75rem;}.bank-region.svelte-hrbllu {color:var(--gray-600);font-size:0.75rem;}.bank-accounts-section.svelte-hrbllu {margin:0 auto;background:#fff;}.bank-accounts-section__card-content.svelte-hrbllu {display:flex;flex-direction:column;gap:0.75rem;padding:1rem;padding-top:0.5rem;}.bank-accounts-section__card-content__info-row.svelte-hrbllu {display:flex;justify-content:space-between;align-items:center;padding:0.5rem 0 0;}.bank-accounts-section__card-content__info-row.svelte-hrbllu .label:where(.svelte-hrbllu) {font-weight:500;color:#495057;font-size:0.9rem;}.bank-accounts-section__card-content__info-row.svelte-hrbllu .value:where(.svelte-hrbllu) {font-weight:600;color:#212529;font-size:0.9rem;}.form-actions.svelte-hrbllu {margin-top:24px;text-align:center;}.form-status.svelte-hrbllu {margin-bottom:1rem;text-align:center;font-size:1.125rem;}.validation-hint.svelte-hrbllu {color:#6b7280;font-size:0.875rem;font-style:italic;}.validation-error.svelte-hrbllu {color:#b3311f;font-size:1.125rem;font-weight:500;margin-top:0.25rem;}.spinner-container.svelte-hrbllu {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}'};function xv(e,t){je(t,!0),Oa(e,Cv);let r=zn(t,"jwt",7,""),a=zn(t,"accountUuid",7,""),n=zn(t,"debug",7,!0),o=zn(t,"onsuccess",15),i=zn(t,"publicCertificate",7,""),l=zn(t,"publicCertificateId",7,""),s=zn(t,"requireRoutingAndAccountConfirmation",7,!1);const c=Object.assign({external_id:{required:!0},country:{required:!0},currency:{required:!0},bankAccountType:{required:!0},ach_routing_number:{required:"Routing number is required",pattern:{regex:/^\d{9}$/,message:"Routing number must be exactly 9 digits"}},ach_account_number:{required:"Account number is required",numeric:"Account number must contain only digits",minLength:{value:3,message:"Account number must be at least 3 digits"}}},s()&&{confirm_routing_number:{required:"Please confirm your routing number",pattern:{regex:/^\d{9}$/,message:"Routing number must be exactly 9 digits"},match:{fieldRef:()=>u.state.formData.ach_details.routing_number||"",message:"Routing number confirmation does not match"}},confirm_account_number:{required:"Please confirm your account number",numeric:"Account number must contain only digits",minLength:{value:3,message:"Account number must be at least 3 digits"},match:{fieldRef:()=>u.state.formData.ach_details.account_number||"",message:"Account number confirmation does not match"}}}),u=Lu({jwt:r(),debug:n(),publicCertificate:i(),publicCertificateId:l(),initialData:{external_id:"",country:"USA",currency:"USD",bankAccountType:"ACH",ach_details:{routing_number:"",account_number:""},eft_details:{institution_number:"",transit_number:"",account_number:""},iban_details:{iban:""},swift_details:{swift_code:"",account_number:""},clabe_details:{swift_code:"",account_number:""},metadata:"",confirm_routing_number:"",confirm_account_number:""},fieldSchemas:c,formName:"AddBankAccount",stepType:"ADD_BANK_ACCOUNT",submitHandler:async()=>{throw new Error("This should not be called - using custom handleAddBankAccount instead")}});let v=At(!1),d=At(!1),p=At(Dt({bank_accounts:[]})),f=At(!1),h=At(null),g=At(null),m=At(null),b=At(!1),y=At(null);const _=rt(()=>r()&&a());async function w(){var e;if(!u.state.alviereCore)throw new Error("AlviereCore not initialized");const t=u.state.alviereCore.createPaymentsService(),r=await t.processGetBankAccounts(a());if(r.bank_accounts.length){const t=r.bank_accounts.map(e=>Object.assign(Object.assign({},e),{isExpanded:!1}));qr(p).bank_accounts=t.filter(e=>"ACTIVE"===e.status),Bt(h,(null===(e=qr(p).bank_accounts[0])||void 0===e?void 0:e.payment_method_uuid)||null,!0)}Bt(v,!1)}async function C(e){var t,r;if(e.preventDefault(),u.computed.canSubmit)try{Bt(d,!0),Bt(g,null),u.actions.clearAllErrors();if(!u.actions.validateAllFields())return void N.error("Form validation failed");const e=u.state.formData,o={external_id:e.external_id||`bank-${Date.now()}`,country:e.country,currency:e.currency,bank_account_details:{}};if(e.metadata)try{o.metadata=JSON.parse(e.metadata)}catch(n){return void Bt(g,"Metadata must be valid JSON.")}if("ACH"===e.bankAccountType)o.bank_account_details.ach_details=e.ach_details;const i=u.state.alviereCore.createPaymentsService(),l=await i.processAddBankAccountWithValidation(a(),o);if(N.info("Bank account API response:",l),"FAILED"===(null===(t=l.bank_account)||void 0===t?void 0:t.status)){N.error("❌ Bank account creation failed with status FAILED"),Bt(g,"Bank account validation failed. Please check your routing and account numbers and try again.");const e=`bank-${Date.now()}-${Math.random().toString(36).substring(2,9)}`;return u.state.formData.external_id=e,void N.info("🔄 Regenerated external_id after FAILED status:",e)}if(N.info("✅ Bank account added successfully:",l),(null===(r=l.bank_account)||void 0===r?void 0:r.payment_method_uuid)&&qr(y)){const e=new CustomEvent(Ds,{detail:{payment_method_uuid:l.bank_account.payment_method_uuid,status:l.bank_account.status||"CREATED"},bubbles:!0,composed:!0});qr(y).dispatchEvent(e),N.info("🚀 Dispatched payment-method event after bank account addition:",e.detail)}await w(),u.actions.reset(),Bt(g,null),Bt(f,!1)}catch(n){N.error("❌ Error adding bank account:",n),Bt(g,n instanceof Error?n.message:String(n),!0)}finally{Bt(d,!1)}else N.debug("Cannot submit: form validation failed")}Zt(()=>{if(qr(f)||!qr(v)&&0===qr(p).bank_accounts.length){const e=`bank-${Date.now()}-${Math.random().toString(36).substring(2,9)}`;u.state.formData.external_id=e,N.info("🔄 Generated new external_id for bank account:",e)}}),Zt(()=>{const e=u.state.formData.ach_details.routing_number;e&&9===e.length&&u.state.alviereCore?(Bt(b,!0),tv(e,u.state.alviereCore).then(e=>{Bt(m,e,!0)}).catch(e=>{Bt(m,null)}).finally(()=>{Bt(b,!1)})):Bt(m,null)}),Aa(async()=>{if(Bt(v,!0),!qr(_))throw new Error("Missing required credentials");u.actions.setFieldValue("external_id",`bank_${Date.now()}_${Math.random().toString(36).substring(2,8)}`),await w()});var x=wv(),E=Ht(x),S=e=>{var t=nv(),r=Ht(t);cn(r,"size","lg"),cn(r,"variant","circular"),Re(t),_n(1,t,()=>Bu,()=>({duration:300})),_n(2,t,()=>Bu,()=>({duration:200})),va(e,t)};Ba(E,e=>{(qr(v)||qr(d))&&e(S)});var k=Wt(E,2),T=e=>{var t=uv(),r=Ht(t),n=Ht(r),o=Ht(n);Re(n);var i=Wt(n,2);cn(i,"variant","secondary"),cn(i,"handler",()=>Bt(f,!0)),cn(i,"iconName","Plus"),Re(r);var l=Wt(r,2);Ra(l,21,()=>qr(p).bank_accounts,Na,(e,t,r)=>{var n=cv();const o=rt(()=>function(e){const t=e.bank_account_details;if(null==t?void 0:t.ach_details){const r=tv(t.ach_details.routing_number||"");return{type:"ACH",accountNumber:e.last_4||"N/A",routingNumber:av(t.ach_details.routing_number||""),accountType:e.type||"N/A",bankInfo:r}}return{type:"Unknown",accountNumber:"N/A",routingNumber:"N/A",accountType:"N/A",bankInfo:null}}(qr(t)));ar(()=>cn(n,"selectable",{group:qr(h),name:"bankAccount",value:qr(t).payment_method_uuid})),ar(()=>cn(n,"selected",qr(h)===qr(t).payment_method_uuid)),cn(n,"expandable",!0),ar(()=>cn(n,"last",r===qr(p).bank_accounts.length-1));var i=Ht(n),l=Ht(i);cn(l,"size","sm"),cn(l,"variant","info");var s=Ht(l,!0);Re(l),Re(i);var c=Wt(i,2),v=Ht(c),f=Ht(v);Re(v),Re(c);var g=Wt(c,2),m=Ht(g),b=Ht(m,!0);Re(m),Re(g);var y=Wt(g,2),_=Ht(y),C=Ht(_,!0);Re(_),Re(y);var x=Wt(y,2),E=Ht(x);cn(E,"variant","secondary"),cn(E,"size","sm"),cn(E,"handler",e=>{e.stopPropagation(),async function(e){Bt(d,!0);const t=u.state.alviereCore.createPaymentsService();await t.processDeleteBankAccount(a(),e),await w(),Bt(d,!1)}(qr(t).payment_method_uuid||"")}),cn(E,"iconName","Trash"),Re(x);var S=Wt(x,2),k=Ht(S),T=Ht(k),A=Wt(Ht(T),2),I=Ht(A);Re(A),Re(T);var B=Wt(T,2),N=Wt(Ht(B),2),R=Ht(N,!0);Re(N),Re(B);var z=Wt(B,2),L=e=>{var t=lv(),r=Gt(t),a=Wt(Ht(r),2),n=Ht(a,!0);Re(a),Re(r);var i=Wt(r,2),l=e=>{var t=ov(),r=Wt(Ht(t),2),a=Ht(r,!0);Re(r),Re(t),ar(()=>Ca(a,qr(o).bankInfo.region)),va(e,t)};Ba(i,e=>{qr(o).bankInfo.region&&e(l)});var s=Wt(i,2),c=e=>{var t=iv(),r=Wt(Ht(t),2),a=Ht(r,!0);Re(r),Re(t),ar(()=>Ca(a,qr(o).bankInfo.description)),va(e,t)};Ba(s,e=>{qr(o).bankInfo.description&&e(c)}),ar(()=>Ca(n,qr(o).bankInfo.name)),va(e,t)};Ba(z,e=>{qr(o).bankInfo&&e(L)});var D=Wt(z,2),U=e=>{var t=sv(),r=Wt(Ht(t),2),a=Ht(r,!0);Re(r),Re(t),ar(()=>Ca(a,qr(o).accountType)),va(e,t)};Ba(D,e=>{"N/A"!==qr(o).accountType&&e(U)}),Re(k),Re(S),Re(n),ar(()=>{var e;Ca(s,qr(o).type),Ca(f,`••••${qr(o).accountNumber??""}`),Ca(b,null==(e=qr(o).bankInfo)?void 0:e.name),Ca(C,qr(o).routingNumber),Ca(I,`••••${qr(o).accountNumber??""}`),Ca(R,qr(o).routingNumber)}),ta("select",n,()=>{return e=qr(t).payment_method_uuid||"",void Bt(h,e,!0);var e}),va(e,n)}),Re(l);var s=Wt(l,2),c=Ht(s);cn(c,"variant","primary"),cn(c,"size","md"),cn(c,"handler",()=>{if(qr(y)){const e=new CustomEvent(Ds,{detail:{payment_method_uuid:qr(h),status:"ACTIVE"},bubbles:!0,composed:!0});qr(y).dispatchEvent(e),N.info("🚀 Dispatched payment-method event from host element:",e);const t=new CustomEvent(ks,{detail:{stepType:"ADD_BANK_ACCOUNT",payment_method_uuid:qr(h),success:!0},bubbles:!0,composed:!0});qr(y).dispatchEvent(t),N.info("🚀 Dispatched form-success event from host element:",t)}else N.warn("⚠️ Host element not available for event dispatch")}),Re(s),Re(t),ar(()=>Ca(o,`Your Bank Accounts (${qr(p).bank_accounts.length??""})`)),va(e,t)};Ba(k,e=>{qr(v)||qr(f)||!qr(p).bank_accounts.length||e(T)});var A=Wt(k,2),I=e=>{var t=_v(),r=Ht(t),a=Wt(Ht(r),2),n=e=>{var t=vv();cn(t,"type","button"),cn(t,"variant","secondary"),cn(t,"handler",()=>Bt(f,!1)),cn(t,"iconName","X"),va(e,t)};Ba(a,e=>{qr(p).bank_accounts.length>0&&e(n)}),Re(r);var o=Wt(r,2),i=Ht(o),l=e=>{var t=gv(),r=Gt(t),a=Ht(r);cn(a,"size","sm"),cn(a,"variant","tertiary");var n=Wt(a,2),o=e=>{var t=hv(),r=Gt(t),a=e=>{var t=pv(),r=Ht(t),a=Ht(r),n=Ht(a,!0);Re(a);var o=Wt(a,2),i=e=>{var t=dv(),r=Ht(t);Re(t),ar(()=>Ca(r,`(${qr(m).city??""})`)),va(e,t)};Ba(o,e=>{var t;(null==(t=qr(m))?void 0:t.city)&&e(i)}),Re(r),Re(t),ar(()=>{var e;return Ca(n,null==(e=qr(m))?void 0:e.name)}),va(e,t)};Ba(r,e=>{qr(m)&&e(a)});var n=Wt(r,2),o=e=>{var t=fv();cn(t,"size","sm"),cn(t,"variant","circular"),va(e,t)};Ba(n,e=>{qr(b)&&e(o)}),va(e,t)};Ba(n,e=>{u.state.formData.ach_details.routing_number&&9===u.state.formData.ach_details.routing_number.length&&e(o)}),Re(r);var i=Wt(r,2),l=Ht(i);{let e=rt(()=>u.state.validationErrors.ach_routing_number?"invalid":"neutral"),t=rt(()=>u.state.validationErrors.ach_routing_number||"");Rc(l,{get value(){return u.state.formData.ach_details.routing_number},label:"Routing Number",placeholder:"Enter 9-digit routing number",helpText:"You can find your routing number on your check or bank statement.",required:!0,id:"ach_routing",get validationSchema(){return c.ach_routing_number},get validationState(){return qr(e)},get errorMessage(){return qr(t)},oninput:e=>{const t=e.target.value;u.state.formData.ach_details.routing_number=t,u.handlers.handleFieldChange("ach_routing_number",t)}})}var v=Wt(l,2),d=e=>{{let t=rt(()=>u.state.validationErrors.confirm_routing_number?"invalid":"neutral"),r=rt(()=>u.state.validationErrors.confirm_routing_number||"");Rc(e,{get value(){return u.state.formData.confirm_routing_number},label:"Confirm Routing Number",placeholder:"Re-enter 9-digit routing number",helpText:"Please confirm your routing number to ensure accuracy.",required:!0,id:"confirm_ach_routing",get validationSchema(){return c.confirm_routing_number},get validationState(){return qr(t)},get errorMessage(){return qr(r)},oninput:e=>{const t=e.target.value;u.state.formData.confirm_routing_number=t,u.handlers.handleFieldChange("confirm_routing_number",t)},blockPaste:!0})}};Ba(v,e=>{s()&&e(d)}),Re(i);var p=Wt(i,2),f=Ht(p);{let e=rt(()=>u.state.validationErrors.ach_account_number?"invalid":"neutral"),t=rt(()=>u.state.validationErrors.ach_account_number||"");Rc(f,{get value(){return u.state.formData.ach_details.account_number},label:"Account Number",placeholder:"Enter account number",required:!0,minlength:3,id:"ach_account",get validationSchema(){return c.ach_account_number},get validationState(){return qr(e)},get errorMessage(){return qr(t)},oninput:e=>{const t=e.target.value;u.state.formData.ach_details.account_number=t,u.handlers.handleFieldChange("ach_account_number",t)}})}var h=Wt(f,2),g=e=>{{let t=rt(()=>u.state.validationErrors.confirm_account_number?"invalid":"neutral"),r=rt(()=>u.state.validationErrors.confirm_account_number||"");Rc(e,{get value(){return u.state.formData.confirm_account_number},label:"Confirm Account Number",placeholder:"Re-enter account number",helpText:"Please confirm your account number to ensure accuracy.",required:!0,minlength:3,id:"confirm_ach_account",get validationSchema(){return c.confirm_account_number},get validationState(){return qr(t)},get errorMessage(){return qr(r)},oninput:e=>{const t=e.target.value;u.state.formData.confirm_account_number=t,u.handlers.handleFieldChange("confirm_account_number",t)},blockPaste:!0})}};Ba(h,e=>{s()&&e(g)}),Re(p),va(e,t)};Ba(i,e=>{"ACH"===u.state.formData.bankAccountType&&e(l)}),Re(o);var v=Wt(o,2),h=Ht(v),y=Ht(h),_=e=>{va(e,mv())};Ba(y,e=>{u.computed.canSubmit||e(_)});var w=Wt(y,2),x=e=>{va(e,bv())};Ba(w,e=>{u.computed.hasErrors&&u.computed.canSubmit&&e(x)});var E=Wt(w,2),S=e=>{var t=yv(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,qr(g))),va(e,t)};Ba(E,e=>{qr(g)&&e(S)}),Re(h);var k=Wt(h,2);cn(k,"type","submit"),cn(k,"variant","tertiary"),cn(k,"size","md"),ar(()=>cn(k,"disabled",!u.computed.canSubmit||qr(d))),cn(k,"handler",C);var T=Ht(k,!0);Re(k),Re(v),Re(t),kn(t,e=>u.state.formElement=e,()=>{var e;return null==(e=null==u?void 0:u.state)?void 0:e.formElement}),ar(()=>Ca(T,qr(d)?"Adding...":"Add Bank Account")),ta("submit",t,C),va(e,t)};return Ba(A,e=>{(qr(f)||!qr(v)&&!qr(p).bank_accounts.length)&&e(I)}),Re(x),kn(x,e=>Bt(y,e),()=>qr(y)),va(e,x),qe({get jwt(){return r()},set jwt(e=""){r(e),wt()},get accountUuid(){return a()},set accountUuid(e=""){a(e),wt()},get debug(){return n()},set debug(e=!0){n(e),wt()},get onsuccess(){return o()},set onsuccess(e){o(e),wt()},get publicCertificate(){return i()},set publicCertificate(e=""){i(e),wt()},get publicCertificateId(){return l()},set publicCertificateId(e=""){l(e),wt()},get requireRoutingAndAccountConfirmation(){return s()},set requireRoutingAndAccountConfirmation(e=!1){s(e),wt()}})}function Ev(e,t){Bt(t,e.detail.checked,!0),N.info("Terms agreement changed:",qr(t))}customElements.define("alviere-add-bank-account",Un(xv,{jwt:{},accountUuid:{},debug:{},onsuccess:{},publicCertificate:{},publicCertificateId:{},requireRoutingAndAccountConfirmation:{}},[],[],!0));var Sv=ia('<div class="spinner-container svelte-nz7vbr"><alviere-spinner></alviere-spinner></div>',2),kv=ia('<div class="alviere-checkout-confirm svelte-nz7vbr"><!> <div class="alviere-checkout-confirm__payment-info svelte-nz7vbr"><alviere-currency-input></alviere-currency-input> <div class="alviere-checkout-confirm__terms-and-conditions"><p>By clicking "Pay", you agree to the <a href="https://www.alviere.com/terms-and-conditions" target="_blank">terms and conditions</a> and <a href="https://www.alviere.com/privacy-policy" target="_blank">privacy policy</a>.</p> <alviere-checkbox></alviere-checkbox></div> <alviere-button>Pay</alviere-button></div></div>',2);const Tv={hash:"svelte-nz7vbr",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-checkout-confirm.svelte-nz7vbr {display:flex;flex-direction:column;gap:1rem;position:relative;padding:1rem 0;}.alviere-checkout-confirm__payment-info.svelte-nz7vbr {display:flex;flex-direction:column;gap:2rem;}.alviere-checkout-confirm__payment-info.svelte-nz7vbr alviere-button:where(.svelte-nz7vbr) {align-self:center;}.alviere-checkout-confirm.svelte-nz7vbr .spinner-container:where(.svelte-nz7vbr) {position:absolute;display:flex;justify-content:center;align-items:center;height:100%;width:100%;background-color:rgba(255, 255, 255, 0.2);backdrop-filter:blur(3px);z-index:1000;}'};function Av(e,t){je(t,!0),Oa(e,Tv);let r=zn(t,"jwt",15,""),a=zn(t,"accountUuid",15,""),n=zn(t,"paymentMethodUuid",15,""),o=zn(t,"amount",15,""),i=zn(t,"debug",15,!0),l=zn(t,"publicCertificate",15,""),s=zn(t,"publicCertificateId",15,""),c=At(null),u=At(!1),v=At(Dt(o())),d=At(!1);var p=kv(),f=Ht(p),h=e=>{var t=Sv(),r=Ht(t);cn(r,"size","lg"),cn(r,"variant","circular"),Re(t),_n(1,t,()=>Bu,()=>({duration:300})),_n(2,t,()=>Bu,()=>({duration:200})),va(e,t)};Ba(f,e=>{qr(u)&&e(h)});var g=Wt(f,2),m=Ht(g);ar(()=>cn(m,"value",qr(v)));var b=Wt(m,2),y=Wt(Ht(b),2);ar(()=>cn(y,"checked",qr(d))),cn(y,"label","I agree to the terms and conditions"),y.__change=[Ev,d],Re(b);var _=Wt(b,2);return cn(_,"variant","primary"),cn(_,"size","md"),cn(_,"handler",async function(){if(Bt(u,!0),await new Promise(e=>setTimeout(e,500)),Bt(u,!1),qr(c)){const e=new CustomEvent(ks,{detail:{stepType:"CHECKOUT_CONFIRM",success:!0,amount:qr(v)},bubbles:!0,composed:!0});qr(c).dispatchEvent(e),N.info("🚀 Dispatched form-success event from host element:",e)}else N.warn("⚠️ Host element not available for event dispatch")}),ar(()=>cn(_,"disabled",!qr(d))),Ga(_,1,"svelte-nz7vbr"),Re(g),Re(p),kn(p,e=>Bt(c,e),()=>qr(c)),ta("text-input",m,function(e){Bt(v,e.detail.rawValue,!0),N.info("Amount changed:",qr(v))}),va(e,p),qe({get jwt(){return r()},set jwt(e=""){r(e),wt()},get accountUuid(){return a()},set accountUuid(e=""){a(e),wt()},get paymentMethodUuid(){return n()},set paymentMethodUuid(e=""){n(e),wt()},get amount(){return o()},set amount(e=""){o(e),wt()},get debug(){return i()},set debug(e=!0){i(e),wt()},get publicCertificate(){return l()},set publicCertificate(e=""){l(e),wt()},get publicCertificateId(){return s()},set publicCertificateId(e=""){s(e),wt()}})}ra(["change"]),customElements.define("alviere-checkout-confirm",Un(Av,{jwt:{},accountUuid:{},paymentMethodUuid:{},amount:{},debug:{},publicCertificate:{},publicCertificateId:{}},[],[],!0));var Iv=ia('<h1 class="alviere-multi-step-flow__flow-title svelte-1hoappo"> </h1>'),Bv=ia('<p class="alviere-multi-step-flow__flow-description svelte-1hoappo"> </p>'),Nv=ia('<div class="alviere-multi-step-flow__flow-header svelte-1hoappo"><!> <!></div>'),Rv=ia('<div class="alviere-multi-step-flow__flow-progress"><alviere-timeline></alviere-timeline></div>',2),zv=ia('<span class="alviere-multi-step-flow__step-navigation__status svelte-1hoappo">✓</span>'),Lv=ia('<span class="alviere-multi-step-flow__step-navigation__status svelte-1hoappo">✗</span>'),Dv=ia('<button><span class="alviere-multi-step-flow__step-navigation__number svelte-1hoappo"></span> <span class="alviere-multi-step-flow__step-navigation__label svelte-1hoappo"> </span> <!> <!></button>'),Uv=ia('<div class="alviere-multi-step-flow__step-navigation svelte-1hoappo"></div>'),Pv=ia('<div class="error-message svelte-1hoappo"> </div>'),Vv=ia('<div class="error-message svelte-1hoappo">No step type specified</div>'),Mv=ia('<div class="alviere-multi-step-flow__step-content svelte-1hoappo"><div class="alviere-multi-step-flow__step-content__header svelte-1hoappo"><h3 class="svelte-1hoappo"> </h3></div> <div class="alviere-multi-step-flow__step-content__component"><!></div></div>'),Ov=ia('<div class="alviere-multi-step-flow__flow-complete svelte-1hoappo"><div class="alviere-multi-step-flow__flow-complete__header svelte-1hoappo"><div class="alviere-multi-step-flow__flow-complete__header__icon svelte-1hoappo"><!></div></div> <div class="alviere-multi-step-flow__flow-complete__content svelte-1hoappo"><p>Payment in process.</p></div></div>'),jv=ia('<p class="flow-error-code svelte-1hoappo"> </p>'),qv=ia('<p class="flow-error-description svelte-1hoappo"> </p>'),Fv=ia('<div class="alviere-multi-step-flow__flow-error svelte-1hoappo"><div class="alviere-multi-step-flow__flow-error__header svelte-1hoappo"><div class="alviere-multi-step-flow__flow-error__header__icon svelte-1hoappo"><!></div></div> <div class="alviere-multi-step-flow__flow-error__content svelte-1hoappo"><h3 class="svelte-1hoappo">Unable to Continue</h3> <p class="flow-error-message svelte-1hoappo"> </p> <!> <!></div></div>'),Kv=ia('<div class="alviere-multi-step-flow__flow-navigation svelte-1hoappo"><button class="alviere-multi-step-flow__flow-navigation__button alviere-multi-step-flow__flow-navigation__button--previous svelte-1hoappo">← Previous</button> <button class="nav-button nav-button--next">Next →</button> <button class="nav-button nav-button--reset">Reset Flow</button></div>'),$v=ia('<div class="error-message svelte-1hoappo"> </div>'),Hv=ia('<div class="alviere-multi-step-flow svelte-1hoappo"><!> <!> <!> <!> <!> <!> <!> <!></div>');const Gv={hash:"svelte-1hoappo",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-multi-step-flow.svelte-1hoappo {margin:0 auto;font-family:"Darker Grotesque", sans-serif;line-height:1;--alviere-multi-step-end-size: 8rem;}.alviere-multi-step-flow__flow-complete.svelte-1hoappo {padding:3rem 0;}.alviere-multi-step-flow__flow-complete__header.svelte-1hoappo {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;}.alviere-multi-step-flow__flow-complete__header__icon.svelte-1hoappo {background-color:#436b1d;border-radius:50%;padding:1rem;width:var(--alviere-multi-step-end-size);height:var(--alviere-multi-step-end-size);display:flex;align-items:center;justify-content:center;color:#ffffff;\n animation: svelte-1hoappo-icon-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;}.alviere-multi-step-flow__flow-complete__header__icon.svelte-1hoappo svg {width:calc(var(--alviere-multi-step-end-size) * 0.75);height:calc(var(--alviere-multi-step-end-size) * 0.75);\n animation: svelte-1hoappo-svg-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;transform:scale(0);}.alviere-multi-step-flow__flow-complete__content.svelte-1hoappo {text-align:center;font-size:1.5rem;font-weight:700;}.alviere-multi-step-flow__flow-error.svelte-1hoappo {padding:3rem 0;}.alviere-multi-step-flow__flow-error__header.svelte-1hoappo {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;}.alviere-multi-step-flow__flow-error__header__icon.svelte-1hoappo {background-color:#b3311f;border-radius:50%;padding:1rem;width:var(--alviere-multi-step-end-size);height:var(--alviere-multi-step-end-size);display:flex;align-items:center;justify-content:center;color:#ffffff;\n animation: svelte-1hoappo-icon-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;}.alviere-multi-step-flow__flow-error__header__icon.svelte-1hoappo svg {width:calc(var(--alviere-multi-step-end-size) * 0.75);height:calc(var(--alviere-multi-step-end-size) * 0.75);\n animation: svelte-1hoappo-svg-scale-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;transform:scale(0);}.alviere-multi-step-flow__flow-error__content.svelte-1hoappo {text-align:center;}.alviere-multi-step-flow__flow-error__content.svelte-1hoappo h3:where(.svelte-1hoappo) {font-size:1.5rem;font-weight:700;color:#b3311f;margin-bottom:1rem;}.alviere-multi-step-flow__flow-error__content.svelte-1hoappo .flow-error-message:where(.svelte-1hoappo) {font-size:1.25rem;color:#333;margin-bottom:0.5rem;}.alviere-multi-step-flow__flow-error__content.svelte-1hoappo .flow-error-code:where(.svelte-1hoappo) {font-size:1.125rem;color:#666;font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;margin-top:0.5rem;}.alviere-multi-step-flow__flow-error__content.svelte-1hoappo .flow-error-description:where(.svelte-1hoappo) {font-size:1.125rem;color:#666;margin-top:0.25rem;font-style:italic;}.alviere-multi-step-flow__flow-header.svelte-1hoappo {text-align:center;margin-bottom:2rem;}.alviere-multi-step-flow__flow-title.svelte-1hoappo {font-size:2rem;}.alviere-multi-step-flow__flow-description.svelte-1hoappo {color:#666;font-size:1.1rem;}.alviere-multi-step-flow__step-navigation.svelte-1hoappo {display:flex;gap:0.5rem;margin-bottom:2rem;flex-wrap:wrap;}.alviere-multi-step-flow__step-navigation__button.svelte-1hoappo {display:flex;align-items:center;gap:0.5rem;padding:0.75rem 1rem;border:1px solid #ddd;background:white;border-radius:6px;cursor:pointer;transition:all 0.2s ease;font-size:0.9rem;}.alviere-multi-step-flow__step-navigation__button.svelte-1hoappo:hover:not(:disabled) {background:#f8f9fa;border-color:#007bff;}.alviere-multi-step-flow__step-navigation__button.svelte-1hoappo:disabled {opacity:0.5;cursor:not-allowed;}.alviere-multi-step-flow__step-navigation__button--active.svelte-1hoappo {background:#227e9e;color:white;border-color:#227e9e;}.alviere-multi-step-flow__step-navigation__button--completed.svelte-1hoappo {background:#436b1d;color:white;border-color:#436b1d;}.alviere-multi-step-flow__step-navigation__button--error.svelte-1hoappo {background:#b3311f;color:white;border-color:#b3311f;}.alviere-multi-step-flow__step-navigation__number.svelte-1hoappo {font-weight:bold;min-width:1.5rem;text-align:center;}.alviere-multi-step-flow__step-navigation__label.svelte-1hoappo {flex:1;}.alviere-multi-step-flow__step-navigation__status.svelte-1hoappo {font-size:1.2rem;}.alviere-multi-step-flow__step-content.svelte-1hoappo {margin-bottom:2rem;}.alviere-multi-step-flow__step-content__header.svelte-1hoappo {display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem;}.alviere-multi-step-flow__step-content__header.svelte-1hoappo h3:where(.svelte-1hoappo) {font-size:1.25rem;}.alviere-multi-step-flow__flow-navigation.svelte-1hoappo {display:flex;gap:1rem;justify-content:center;margin-top:2rem;}.alviere-multi-step-flow__flow-navigation__button.svelte-1hoappo {padding:0.75rem 1.5rem;border:none;border-radius:4px;cursor:pointer;font-size:1rem;font-weight:500;transition:background 0.2s ease;}.alviere-multi-step-flow__flow-navigation__button.svelte-1hoappo:disabled {opacity:0.5;cursor:not-allowed;}.alviere-multi-step-flow__flow-navigation__button-previous.svelte-1hoappo {background:#6c757d;color:white;}.alviere-multi-step-flow__flow-navigation__button-previous.svelte-1hoappo:hover:not(:disabled) {background:#545b62;}.alviere-multi-step-flow__flow-navigation__button--next.svelte-1hoappo {background:#007bff;color:white;}.alviere-multi-step-flow__flow-navigation__button--next.svelte-1hoappo:hover:not(:disabled) {background:#0056b3;}.flow-progress.svelte-1hoappo {margin-bottom:2rem;}.progress-bar.svelte-1hoappo {width:100%;height:8px;background:#e9ecef;border-radius:4px;overflow:hidden;margin-bottom:0.5rem;}.progress-fill.svelte-1hoappo {height:100%;background:#007bff;transition:width 0.3s ease;}.progress-text.svelte-1hoappo {text-align:center;font-size:0.9rem;color:#666;}.step-component.svelte-1hoappo {background:white;}.flow-complete.svelte-1hoappo {text-align:center;padding:2rem;background:#d4edda;border:1px solid #c3e6cb;border-radius:8px;margin-top:2rem;}.step-results.svelte-1hoappo {margin-top:1rem;text-align:left;}.result-item.svelte-1hoappo {margin-bottom:1rem;padding:1rem;background:white;border-radius:4px;border:1px solid #c3e6cb;}.error-message.svelte-1hoappo {background:#f8d7da;color:#721c24;border:1px solid #f5c6cb;border-radius:4px;padding:1rem;margin-top:1rem;text-align:center;}\n\n@keyframes svelte-1hoappo-icon-scale-up {\n from {\n transform: scale(0);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n}\n@keyframes svelte-1hoappo-svg-scale-up {\n from {\n transform: scale(0);\n }\n to {\n transform: scale(1);\n }\n}\n@media (max-width: 768px) {.step-navigation.svelte-1hoappo {flex-direction:column;}.step-button.svelte-1hoappo {justify-content:flex-start;}.flow-navigation.svelte-1hoappo {flex-direction:column;}.step-header.svelte-1hoappo {flex-direction:column;gap:1rem;align-items:flex-start;}\n}'};function Wv(e,t){je(t,!0),Oa(e,Gv);const[r,a]=function(){const e={};return[e,function(){Xt(()=>{for(var t in e)e[t].unsubscribe();Y(e,Nn,{enumerable:!1,value:!0})})}]}();var n,o;let i=zn(t,"config",31,()=>Dt({steps:[]})),l=zn(t,"jwt",15,""),s=zn(t,"businessUuid",15,""),c=zn(t,"debug",31,()=>Dt("false")),u=zn(t,"publicCertificate",15,""),v=zn(t,"publicCertificateId",15,""),d=zn(t,"amount",15,""),p=zn(t,"onflowcomplete",15),f=zn(t,"onstepcomplete",15),h=zn(t,"onsteperror",15),g=zn(t,"onreset",15);c("true"===c()),c()&&N.warn("MultiStepFlow initialized, debug:",c());let m=At(null),b=At(!1),y=At(null),_=At(null);const w=cc(dc),C=cc(bc),x=function(e){const{getJwt:t,getCore:r,getDebug:a,onJwtUpdate:n}=e;let o=At(Dt(t())),i=At(null),l=At(Dt(t()));return Zt(()=>{const e=t();e&&Bt(o,e,!0)}),Zt(()=>{var e;if(qr(i)){const t=qr(o);Bt(o,qr(i),!0),Bt(i,null),a()&&(N.info("✅ JWT downgrade successful - updated flow JWT"),N.info("🔐 Old JWT (first 50 chars):",null==t?void 0:t.substring(0,50)),N.info("🔐 New JWT (first 50 chars):",null==(e=qr(o))?void 0:e.substring(0,50)),N.info("🔐 New JWT will be used in all subsequent steps")),null==n||n(qr(o))}}),{getJwtForStep:()=>qr(l),getEffectiveJwt:()=>qr(o),updateJwt:e=>{Bt(o,e,!0)},downgradeJwt:async e=>{const t=r(),n=a();if(t)if(qr(o))try{if(n&&N.info("🔐 Performing JWT downgrade using shared AlviereCore instance..."),!t.isFirstTimeUser())return void(n&&N.info("🔄 User is not first-time - JWT already scoped"));n&&N.info("🔄 First-time user detected - performing JWT downgrade for account:",e);const r=await t.generateScopedToken(e,!1);Bt(i,r,!0),n&&N.info("🔐 Pending JWT set (first 50 chars):",null==r?void 0:r.substring(0,50)),await new Promise(e=>setTimeout(e,0))}catch(y){N.warn("⚠️ Failed to perform JWT downgrade:",y)}else n&&N.warn("⚠️ Cannot perform JWT downgrade - missing JWT");else n&&N.warn("⚠️ Cannot perform JWT downgrade - AlviereCore not initialized")},updateStepSnapshot:()=>{Bt(l,Kr(()=>qr(o)),!0)}}}({getJwt:()=>l(),getCore:()=>Rn(Nu,"$flowCoreStore",r).core,getDebug:()=>c(),onJwtUpdate:e=>{Nu.updateJwt(e),l(e)}}),E=function(e){let t=At(Dt({currentStepIndex:0,completedSteps:[],stepResults:{},isComplete:!1})),r=At(Dt({})),a=At(!1);return Zt(()=>{var n;const o=e();if((null==(n=null==o?void 0:o.steps)?void 0:n.length)>0&&!qr(a)){const e={};o.steps.forEach((t,r)=>{e[r]=0===r?"IN_PROGRESS":"INCOMPLETE"}),Bt(r,e,!0),Bt(a,!0),0===qr(t).currentStepIndex&&0===qr(t).completedSteps.length&&Bt(t,{currentStepIndex:0,completedSteps:[],stepResults:{},isComplete:!1},!0)}}),{get flowState(){return qr(t)},get stepStatuses(){return qr(r)},getCurrentStep:()=>{const r=e();return!(null==r?void 0:r.steps)||0===r.steps.length||qr(t).currentStepIndex>=r.steps.length?null:r.steps[qr(t).currentStepIndex]},getCurrentStepIndex:()=>qr(t).currentStepIndex,isComplete:()=>qr(t).isComplete,nextStep:()=>{var a;const n=e();qr(t).currentStepIndex<((null==(a=null==n?void 0:n.steps)?void 0:a.length)||0)-1&&(qr(t).currentStepIndex++,Bt(r,{...qr(r),[qr(t).currentStepIndex]:"IN_PROGRESS"},!0))},previousStep:()=>{qr(t).currentStepIndex>0&&qr(t).currentStepIndex--},goToStep:a=>{var n;const o=e();a>=0&&a<((null==(n=null==o?void 0:o.steps)?void 0:n.length)||0)&&(qr(t).currentStepIndex=a,"INCOMPLETE"===qr(r)[a]&&Bt(r,{...qr(r),[a]:"IN_PROGRESS"},!0))},canGoNext:()=>{var r;const a=e();return qr(t).currentStepIndex<((null==(r=null==a?void 0:a.steps)?void 0:r.length)||0)-1},canGoPrevious:()=>qr(t).currentStepIndex>0,markStepComplete:(a,n)=>{var o;const i=e();Bt(r,{...qr(r),[a]:"COMPLETE"},!0),qr(t).stepResults[a]=n,qr(t).completedSteps.includes(a)||(qr(t).completedSteps=[...qr(t).completedSteps,a]),a===((null==(o=null==i?void 0:i.steps)?void 0:o.length)||0)-1&&(qr(t).isComplete=!0)},markStepError:e=>{Bt(r,{...qr(r),[e]:"ERROR"},!0)},markStepInProgress:e=>{Bt(r,{...qr(r),[e]:"IN_PROGRESS"},!0)},storeStepResult:(e,r)=>{qr(t).stepResults[e]=r},getStepResult:e=>qr(t).stepResults[e]||null,getAccumulatedResults:()=>{const e={};for(let r=0;r<=qr(t).currentStepIndex;r++)if(qr(t).stepResults[r]){const a=qr(t).stepResults[r];Object.keys(a).forEach(t=>{["stepType","stepIndex","success","data"].includes(t)||(e[t]=a[t])})}return e},reset:()=>{Bt(t,{currentStepIndex:0,completedSteps:[],stepResults:{},isComplete:!1},!0),Bt(a,!1),Bt(r,{},!0)}}}(()=>i()),S=function(e){const{getFlowElement:t,getConfig:r,flowState:a,onflowcomplete:n,onstepcomplete:o,onsteperror:i,onreset:l}=e,s=Ia();function c(e,r){const a=t();return!!a&&ts(a).dispatch(e,r)}function u(){var e;const t=r();return{currentStep:a.currentStepIndex,totalSteps:(null==(e=null==t?void 0:t.steps)?void 0:e.length)||0,stepResults:{...a.stepResults},isComplete:a.isComplete}}function v(e,t,a){var n,o;const i=r();return{stepIndex:e,stepType:(null==(o=null==(n=null==i?void 0:i.steps)?void 0:n[e])?void 0:o.type)||"UNKNOWN",result:t,error:a}}return{dispatchStepComplete:(e,t)=>{var n,i;const l=v(e,t);null==o||o(l),c(Bs,l);const u=r();s("stepSuccess",{stepIndex:e,stepType:(null==(i=null==(n=null==u?void 0:u.steps)?void 0:n[e])?void 0:i.type)||"UNKNOWN",result:t,flowState:{...a}})},dispatchStepError:(e,t)=>{var n,o;const l=v(e,void 0,t);null==i||i(l),c(Ns,l);const u=r();s("stepError",{stepIndex:e,stepType:(null==(o=null==(n=null==u?void 0:u.steps)?void 0:n[e])?void 0:o.type)||"UNKNOWN",error:t,flowState:{...a}})},dispatchFlowComplete:e=>{const t={...u(),result:e};null==n||n(t),c(Rs,t),s("complete",{stepResults:a.stepResults,flowState:{...a},result:e})},dispatchFlowReset:()=>{const e=u();null==l||l(),c(zs,e),s("reset",{flowState:{...a}})}}}({getFlowElement:()=>qr(m),getConfig:()=>i(),flowState:E.flowState,onflowcomplete:p(),onstepcomplete:f(),onsteperror:h(),onreset:g()});let k=rt(()=>E.getCurrentStep());Zt(()=>{E.getCurrentStepIndex(),x.updateStepSnapshot()});let T=rt(()=>(null===qr(k)||void 0===qr(k)?void 0:qr(k).type)?function(e,t){const{jwt:r,businessUuid:a,publicCertificate:n,publicCertificateId:o,debug:i,amount:l,stepConfig:s,previousStepResult:c}=t,u={jwt:r,businessUuid:a,publicCertificate:n,publicCertificateId:o,isInFlow:!0,debug:i,amount:l,config:s};switch(e){case"ADD_BANK_ACCOUNT":case"ADD_PAYMENT_INSTRUMENT":{const e=(null==c?void 0:c.account_uuid)||"";return i&&(N.info("previousStepResult",c),N.info("accountUuidToUse",e)),{...u,accountUuid:e,requireRoutingAndAccountConfirmation:!0}}default:return u}}(qr(k).type,{jwt:x.getJwtForStep(),businessUuid:s(),publicCertificate:u(),publicCertificateId:v(),debug:c(),amount:d(),stepConfig:(null===(o=null===(n=i().steps)||void 0===n?void 0:n[E.getCurrentStepIndex()])||void 0===o?void 0:o.config)||{},previousStepResult:E.getStepResult(E.getCurrentStepIndex()-1)}):{}),A=rt(()=>{return e=i().steps||[],t=E.stepStatuses,r=E.getCurrentStepIndex(),e&&Array.isArray(e)?e.map((e,a)=>{let n="pending";return"COMPLETE"===t[a]?n="completed":"ERROR"===t[a]?n="error":a===r&&(n="active"),{label:e.label,description:e.description||"",status:n}}):[];var e,t,r}),I=rt(()=>E.canGoNext()),B=rt(()=>E.canGoPrevious());async function R(e){const t=E.getCurrentStepIndex(),r=e.detail;c()&&N.info(`✅ Step ${t} completed:`,r),await async function(e,t){var r,a;const n=null===(a=null===(r=null===i()||void 0===i()?void 0:i().steps)||void 0===r?void 0:r[e])||void 0===a?void 0:a.type;if("CREATE_CONSUMER_ACCOUNT"!==n&&"CREATE_BUSINESS_ACCOUNT"!==n&&"CREATE_ACCOUNT"!==n)return;if(!t.account_uuid||t.skipped)return void(c()&&N.info("🔄 Skipping JWT downgrade - account creation was skipped"));await x.downgradeJwt(t.account_uuid)}(t,r),E.markStepComplete(t,r);const a=E.getAccumulatedResults();E.canGoNext()?setTimeout(()=>{E.nextStep()},1e3):(E.flowState.isComplete=!0,S.dispatchFlowComplete(a)),S.dispatchStepComplete(t,a)}function z(e){const t=E.getCurrentStepIndex(),r=e.detail.error;if(c()&&N.error(`❌ Step ${t} failed:`,r),r instanceof ll&&(a=r.errorCode,Rl.includes(a)))return c()&&N.error(`🚨 Critical error - halting flow: ${r.errorCode}`),Bt(_,{message:"An error occurred. Please try again.",errorCode:r.errorCode,description:r.errorDescription},!0),void E.markStepError(t);var a;E.markStepError(t),S.dispatchStepError(t,r)}function L(){E.nextStep()}function D(){E.previousStep()}function U(){E.reset(),Bt(_,null),Bt(y,null),S.dispatchFlowReset()}Zt(()=>{if("undefined"!=typeof window){const e=new URLSearchParams(window.location.search),t=e.get("enhancedJwt")||e.get("jwt");t&&(l(t),x.updateJwt(t),c()&&N.info("🔐 Using enhanced JWT from URL"))}}),Zt(()=>{if("undefined"!=typeof window&&window.customElements&&qr(m)&&!qr(b)){const t=qr(m).getRootNode(),r=null==t?void 0:t.host;if(r){const t=r.getAttributeNames();if(t.includes("config")){const t=r.getAttribute("config");if(t)try{const e=JSON.parse(t);void 0!==e.amount&&d(e.amount),i(Object.assign(Object.assign(Object.assign({},i()),e),{steps:e.steps||i().steps||[]})),c()&&N.info("✅ Config loaded from attribute:",e)}catch(e){c()&&N.error("❌ Failed to parse config:",e)}}["jwt","business-uuid","public-certificate","public-certificate-id","amount"].forEach(e=>{if(t.includes(e)){const t=r.getAttribute(e);if(t)switch(e){case"jwt":l(t),x.updateJwt(t);break;case"business-uuid":s(t);break;case"public-certificate":u(t);break;case"public-certificate-id":v(t);break;case"amount":d(t)}}})}Bt(b,!0)}}),Zt(()=>{(null===qr(k)||void 0===qr(k)?void 0:qr(k).type)&&setTimeout(()=>{!function(e,t,r,a=!1){if(!e)return;const n=`alviere-${e.toLowerCase().replace(/_/g,"-")}`;a&&N.info("Setting up event listeners for:",n);let o=document.querySelectorAll(n);if(0===o.length&&t){const e=t.getRootNode();o=null==e?void 0:e.querySelectorAll(n),a&&0===o.length&&N.info("No step elements found in shadow root")}if(o.length>0){const e=o[o.length-1];e.removeEventListener("success",r.onSuccess),e.removeEventListener("form-success",r.onSuccess),e.removeEventListener("error",r.onError),e.removeEventListener("form-error",r.onError),e.addEventListener("success",r.onSuccess),e.addEventListener("form-success",r.onSuccess),e.addEventListener("error",r.onError),e.addEventListener("form-error",r.onError),a&&N.info("✅ Event listeners set up successfully for:",e)}else a&&N.warn("⚠️ Step element not found for event listener setup:",n)}(qr(k).type,qr(m),{onSuccess:R,onError:z},c())},100)}),Zt(()=>{var e;c()&&N.info("🔍 Config changed:",{hasSteps:!!(null===i()||void 0===i()?void 0:i().steps),stepCount:(null===(e=null===i()||void 0===i()?void 0:i().steps)||void 0===e?void 0:e.length)||0,steps:null===i()||void 0===i()?void 0:i().steps})}),Zt(()=>{c()&&N.info("🔍 Current step:",{currentStep:qr(k),currentStepIndex:E.getCurrentStepIndex(),hasType:!!(null===qr(k)||void 0===qr(k)?void 0:qr(k).type)})}),Aa(()=>{var e;return l()&&s()&&(c()&&N.info("🔐 Initializing shared AlviereCore in store (mount)..."),Ru({jwt:l(),business_uuid:s(),publicCertificate:u(),publicCertificateId:v(),debug:c()})),(null===(e=null===i()||void 0===i()?void 0:i().steps)||void 0===e?void 0:e.length)>0?(c()&&N.info("🚀 MultiStepFlow mounted with",i().steps.length,"steps"),E.markStepInProgress(0)):c()&&N.warn("⚠️ MultiStepFlow mounted with NO steps in config!"),()=>{c()&&N.info("🧹 Cleaning up flow - resetting AlviereCore store"),zu()}});var P=Hv(),V=Ht(P),M=e=>{var t=Nv(),r=Ht(t),a=e=>{var t=Iv(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,i().title)),va(e,t)};Ba(r,e=>{i().title&&e(a)});var n=Wt(r,2),o=e=>{var t=Bv(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,i().description)),va(e,t)};Ba(n,e=>{i().description&&e(o)}),Re(t),va(e,t)};Ba(V,e=>{(i().title||i().description)&&e(M)});var O=Wt(V,2),j=e=>{var t=Rv(),r=Ht(t);ar(()=>cn(r,"steps",qr(A))),cn(r,"size","sm"),cn(r,"showLabels",!0),cn(r,"showDescriptions",!1),Re(t),va(e,t)};Ba(O,e=>{var t,r;!1!==(null==(t=i())?void 0:t.showProgress)&&(null==(r=i())?void 0:r.steps)&&e(j)});var q=Wt(O,2),F=e=>{var t=Uv();Ra(t,21,()=>i().steps,Na,(e,t,r)=>{var a=Dv();let n;a.__click=()=>function(e){E.goToStep(e)}(r);var o=Ht(a);o.textContent=r+1;var l=Wt(o,2),s=Ht(l,!0);Re(l);var c=Wt(l,2),u=e=>{va(e,zv())};Ba(c,e=>{"COMPLETE"===E.stepStatuses[r]&&e(u)});var v=Wt(c,2),d=e=>{va(e,Lv())};Ba(v,e=>{"ERROR"===E.stepStatuses[r]&&e(d)}),Re(a),ar((e,r)=>{n=Ga(a,1,"alviere-multi-step-flow__step-navigation__button svelte-1hoappo",null,n,e),a.disabled=r,Ca(s,qr(t).label)},[()=>({"alviere-multi-step-flow__step-navigation__button--active":r===E.getCurrentStepIndex(),"alviere-multi-step-flow__step-navigation__button--completed":"COMPLETE"===E.stepStatuses[r],"alviere-multi-step-flow__step-navigation__button--error":"ERROR"===E.stepStatuses[r]}),()=>r>E.getCurrentStepIndex()&&!i().allowSkip]),va(e,a)}),Re(t),va(e,t)};Ba(q,e=>{!1===i().showNavigation||qr(_)||e(F)});var K=Wt(q,2),$=e=>{var t=Mv(),r=Ht(t),a=Ht(r),n=Ht(a,!0);Re(a),Re(r);var o=Wt(r,2),i=Ht(o),l=e=>{var t=ua();const r=rt(()=>({CREATE_CONSUMER_ACCOUNT:"alviere-create-consumer-account",CREATE_BUSINESS_ACCOUNT:"alviere-create-business-account",CREATE_ACCOUNT:"alviere-create-account",ADD_BANK_ACCOUNT:"alviere-add-bank-account",ADD_PAYMENT_INSTRUMENT:"alviere-add-payment-instrument",CHECKOUT_CONFIRM:"alviere-checkout-confirm"}[qr(k).type]||null));var a=Gt(t),n=e=>{var t=ua();Ma(Gt(t),()=>qr(r),0,(e,t)=>{un(e,()=>({...qr(T)}),void 0,void 0,"svelte-1hoappo")}),va(e,t)},o=e=>{var t=Pv(),r=Ht(t);Re(t),ar(()=>Ca(r,`Unknown step type: ${qr(k).type??""}`)),va(e,t)};Ba(a,e=>{qr(r)?e(n):e(o,!1)}),va(e,t)},s=e=>{va(e,Vv())};Ba(i,e=>{var t;(null==(t=qr(k))?void 0:t.type)?e(l):e(s,!1)}),Re(o),Re(t),ar(()=>Ca(n,qr(k).label)),_n(1,t,()=>Bu,()=>({duration:300})),_n(2,t,()=>Bu,()=>({duration:200})),va(e,t)};Ba(K,e=>{!qr(k)||E.isComplete()||qr(_)||e($)});var H=Wt(K,2),G=e=>{var t=Ov(),r=Ht(t),a=Ht(r);Pa(Ht(a),()=>w.outerHTML),Re(a),Re(r),ze(2),Re(t),_n(1,t,()=>Bu,()=>({duration:300,delay:300})),_n(2,t,()=>Bu,()=>({duration:200})),va(e,t)};Ba(H,e=>{E.isComplete()&&e(G)});var W=Wt(H,2),Q=e=>{var t=Fv(),r=Ht(t),a=Ht(r);Pa(Ht(a),()=>C.outerHTML),Re(a),Re(r);var n=Wt(r,2),o=Wt(Ht(n),2),i=Ht(o,!0);Re(o);var l=Wt(o,2),s=e=>{var t=jv(),r=Ht(t);Re(t),ar(()=>Ca(r,`Error Code: ${qr(_).errorCode??""}`)),va(e,t)};Ba(l,e=>{c()&&qr(_).errorCode&&e(s)});var u=Wt(l,2),v=e=>{var t=qv(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,qr(_).description)),va(e,t)};Ba(u,e=>{c()&&qr(_).description&&e(v)}),Re(n),Re(t),ar(()=>Ca(i,qr(_).message)),_n(1,t,()=>Bu,()=>({duration:300,delay:100})),_n(2,t,()=>Bu,()=>({duration:200})),va(e,t)};Ba(W,e=>{qr(_)&&e(Q)});var J=Wt(W,2),X=e=>{var t=Kv(),r=Ht(t);r.__click=D;var a=Wt(r,2);a.__click=L,Wt(a,2).__click=U,Re(t),ar(e=>{r.disabled=!qr(B),a.disabled=e},[()=>!qr(I)||"COMPLETE"!==E.stepStatuses[E.getCurrentStepIndex()]]),va(e,t)};Ba(J,e=>{!1===i().showNavigation||qr(_)||E.isComplete()||e(X)});var Z=Wt(J,2),ee=e=>{var t=$v(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,qr(y))),va(e,t)};Ba(Z,e=>{qr(y)&&e(ee)}),Re(P),kn(P,e=>Bt(m,e),()=>qr(m)),va(e,P);var te=qe({get config(){return i()},set config(e={steps:[]}){i(e),wt()},get jwt(){return l()},set jwt(e=""){l(e),wt()},get businessUuid(){return s()},set businessUuid(e=""){s(e),wt()},get debug(){return c()},set debug(e="false"){c(e),wt()},get publicCertificate(){return u()},set publicCertificate(e=""){u(e),wt()},get publicCertificateId(){return v()},set publicCertificateId(e=""){v(e),wt()},get amount(){return d()},set amount(e=""){d(e),wt()},get onflowcomplete(){return p()},set onflowcomplete(e){p(e),wt()},get onstepcomplete(){return f()},set onstepcomplete(e){f(e),wt()},get onsteperror(){return h()},set onsteperror(e){h(e),wt()},get onreset(){return g()},set onreset(e){g(e),wt()}});return a(),te}ra(["click"]),customElements.define("alviere-multi-step-flow",Un(Wv,{config:{},jwt:{},businessUuid:{},debug:{},publicCertificate:{},publicCertificateId:{},amount:{},onflowcomplete:{},onstepcomplete:{},onsteperror:{},onreset:{}},[],[],!0));var Yv=sa('<svg class="alviere-spinner__circle svelte-18d6yb5" viewBox="0 0 50 50" part="circle"><circle class="alviere-spinner__circle-path svelte-18d6yb5" cx="25" cy="25" r="20" fill="none" stroke-width="4" part="circle-path"></circle></svg>'),Qv=ia('<div class="alviere-spinner__dots svelte-18d6yb5" part="dots"><div class="alviere-spinner__dot svelte-18d6yb5" part="dot"></div> <div class="alviere-spinner__dot svelte-18d6yb5" part="dot"></div> <div class="alviere-spinner__dot svelte-18d6yb5" part="dot"></div></div>'),Jv=ia('<div role="status" aria-live="polite" part="root"><!> <div class="alviere-spinner__message svelte-18d6yb5"><!></div></div>');const Xv={hash:"svelte-18d6yb5",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-spinner.svelte-18d6yb5 {display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;--spinner-color: var(--alv-spinner-color, var(--alv-color-text-primary));}.alviere-spinner--sm.svelte-18d6yb5 {--spinner-size: var(--alv-spinner-size-sm, 1rem);--spinner-stroke-width: var(--alv-spinner-stroke-width, 2px);}.alviere-spinner--md.svelte-18d6yb5 {--spinner-size: var(--alv-spinner-size-md, 1.5rem);--spinner-stroke-width: var(--alv-spinner-stroke-width, 2px);}.alviere-spinner--lg.svelte-18d6yb5 {--spinner-size: var(--alv-spinner-size-lg, 4rem);--spinner-stroke-width: 5px;}.alviere-spinner__circle.svelte-18d6yb5 {width:var(--spinner-size);height:var(--spinner-size);\n animation: svelte-18d6yb5-alviere-spinner-rotate 2s linear infinite;}.alviere-spinner__circle-path.svelte-18d6yb5 {stroke:var(--spinner-color);stroke-linecap:square;transform-origin:center;\n animation: svelte-18d6yb5-alviere-spinner-dash 1.5s ease-in-out infinite;}.alviere-spinner--dots.svelte-18d6yb5 .alviere-spinner__dots:where(.svelte-18d6yb5) {display:flex;align-items:center;justify-content:center;gap:calc(var(--spinner-size) * 0.15);}.alviere-spinner--dots.svelte-18d6yb5 .alviere-spinner__dot:where(.svelte-18d6yb5) {width:calc(var(--spinner-size) * 0.25);height:calc(var(--spinner-size) * 0.25);background-color:var(--spinner-color);border-radius:50%;\n animation: svelte-18d6yb5-alviere-spinner-dot-pulse 1.4s ease-in-out infinite both;}.alviere-spinner--dots.svelte-18d6yb5 .alviere-spinner__dot:where(.svelte-18d6yb5):nth-child(1) {animation-delay:-0.32s;}.alviere-spinner--dots.svelte-18d6yb5 .alviere-spinner__dot:where(.svelte-18d6yb5):nth-child(2) {animation-delay:-0.16s;}.alviere-spinner--dots.svelte-18d6yb5 .alviere-spinner__dot:where(.svelte-18d6yb5):nth-child(3) {animation-delay:0s;}.alviere-spinner__message.svelte-18d6yb5 {text-align:center;font-size:var(--alv-font-size-base, 1.25rem);color:var(--alv-color-text-secondary, #555);font-weight:500;margin:0;margin-top:1rem;}.alviere-spinner__message.svelte-18d6yb5:empty {display:none;}\n\n@keyframes svelte-18d6yb5-alviere-spinner-rotate {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n@keyframes svelte-18d6yb5-alviere-spinner-dash {\n 0% {\n stroke-dasharray: 1, 125.6;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 94.2, 125.6;\n stroke-dashoffset: -31.4;\n }\n 100% {\n stroke-dasharray: 1, 125.6;\n stroke-dashoffset: -125.6;\n }\n}\n@keyframes svelte-18d6yb5-alviere-spinner-dot-pulse {\n 0%, 80%, 100% {\n transform: scale(0.8);\n opacity: 0.5;\n }\n 40% {\n transform: scale(1);\n opacity: 1;\n }\n}.alviere-spinner.svelte-18d6yb5:focus-visible {outline:2px solid var(--spinner-color);outline-offset:2px;border-radius:4px;}\n\n@media (prefers-reduced-motion: reduce) {.alviere-spinner__circle.svelte-18d6yb5 {\n animation: svelte-18d6yb5-alviere-spinner-rotate 3s linear infinite;}.alviere-spinner__circle-path.svelte-18d6yb5 {\n animation: none;stroke-dasharray:62.8, 125.6;stroke-dashoffset:0;}\n}'};function Zv(e,t){je(t,!0),Oa(e,Xv);let r=zn(t,"size",15,"md"),a=zn(t,"color",15,""),n=zn(t,"primaryColor",15,""),o=zn(t,"ariaLabel",15,"Loading..."),i=zn(t,"class",15,""),l=zn(t,"variant",15,"circular"),s=rt(()=>`alviere-spinner alviere-spinner--${r()} alviere-spinner--${l()} ${i()}`.trim()),c=rt(()=>a()||n());var u=Jv();let v;var d=Ht(u),p=e=>{va(e,Yv())},f=e=>{var t=ua(),r=Gt(t),a=e=>{va(e,Qv())};Ba(r,e=>{"dots"===l()&&e(a)},!0),va(e,t)};Ba(d,e=>{"circular"===l()?e(p):e(f,!1)});var h=Wt(d,2);return Va(Ht(h),t,"message",{}),Re(h),Re(u),ar(e=>{Ga(u,1,Fa(qr(s)),"svelte-18d6yb5"),sn(u,"aria-label",o()),v=Ya(u,"",v,e)},[()=>({"--spinner-color":qr(c)})]),va(e,u),qe({get size(){return r()},set size(e="md"){r(e),wt()},get color(){return a()},set color(e=""){a(e),wt()},get primaryColor(){return n()},set primaryColor(e=""){n(e),wt()},get ariaLabel(){return o()},set ariaLabel(e="Loading..."){o(e),wt()},get class(){return i()},set class(e=""){i(e),wt()},get variant(){return l()},set variant(e="circular"){l(e),wt()}})}customElements.define("alviere-spinner",Un(Zv,{size:{},color:{},primaryColor:{},ariaLabel:{},class:{},variant:{}},["message"],[],!0));var ed=ia('<div class="alviere-timeline__connector svelte-se2bjk" part="connector"></div>'),td=ia('<span class="alviere-timeline__step-description svelte-se2bjk" part="step-description"> </span>'),rd=ia('<div class="alviere-timeline__step-label svelte-se2bjk" part="step-label"><span class="alviere-timeline__step-text svelte-se2bjk" part="step-text"> </span> <!></div>'),ad=ia('<div class="alviere-timeline__step-wrapper svelte-se2bjk" part="step-wrapper"><!> <div part="step"><div class="alviere-timeline__step-indicator svelte-se2bjk" part="step-indicator"><span class="alviere-timeline__step-icon svelte-se2bjk" part="step-icon"><!></span> <div class="alviere-timeline__step-ripple svelte-se2bjk" part="step-ripple"></div></div> <!></div></div>'),nd=ia('<div role="progressbar" aria-label="Progress timeline" part="root"><div class="alviere-timeline__container svelte-se2bjk" part="container"></div></div>');const od={hash:"svelte-se2bjk",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-timeline.svelte-se2bjk {display:flex;align-items:center;justify-content:center;width:100%;--timeline-color: var(--alv-timeline-color, var(--alv-color-gray-600));--timeline-completed-color: var(--alv-timeline-completed-color, var(--alv-color-success));--timeline-error-color: var(--alv-timeline-error-color, var(--alv-color-error));--timeline-pending-color: var(--alv-timeline-pending-color, var(--alv-color-gray-400));}.alviere-timeline--sm.svelte-se2bjk {--timeline-step-size: var(--alv-timeline-step-size-sm, 1.25rem);--timeline-connector-width: 2px;--timeline-font-size: var(--alv-font-size-sm);--timeline-connector-padding: 0.625rem;}.alviere-timeline--md.svelte-se2bjk {--timeline-step-size: var(--alv-timeline-step-size-md, 2rem);--timeline-connector-width: var(--alv-timeline-connector-width, 3px);--timeline-font-size: var(--alv-timeline-font-size, var(--alv-font-size-base));}.alviere-timeline--lg.svelte-se2bjk {--timeline-step-size: var(--alv-timeline-step-size-lg, 2.5rem);--timeline-connector-width: 4px;--timeline-font-size: var(--alv-font-size-lg);}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__container:where(.svelte-se2bjk) {flex-direction:row;align-items:center;justify-content:space-between;width:100%;}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk) {position:relative;}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk):nth-child(1) .alviere-timeline__step:where(.svelte-se2bjk) {align-items:flex-start;}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk):nth-child(1) .alviere-timeline__connector:where(.svelte-se2bjk) {width:calc(100% - var(--timeline-connector-padding) * 2 + 50% - var(--timeline-connector-padding) - var(--timeline-step-size));left:calc(var(--timeline-step-size) + var(--timeline-connector-padding));}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk):last-child .alviere-timeline__step:where(.svelte-se2bjk) {align-items:flex-end;}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk):last-child .alviere-timeline__connector:where(.svelte-se2bjk) {width:calc(100% - var(--timeline-connector-padding) * 2);}.alviere-timeline--horizontal.svelte-se2bjk .alviere-timeline__connector:where(.svelte-se2bjk) {height:var(--timeline-connector-width);align-self:center;position:relative;top:calc(var(--timeline-step-size) * 0.5 + var(--timeline-connector-width) * 0.5);left:calc(50% + var(--timeline-step-size) * 0.5 + var(--timeline-connector-padding));min-width:2rem;width:calc(100% - var(--timeline-connector-padding) * 2 + 50% - var(--timeline-connector-padding) - var(--timeline-step-size));}.alviere-timeline--vertical.svelte-se2bjk .alviere-timeline__container:where(.svelte-se2bjk) {flex-direction:column;align-items:flex-start;}.alviere-timeline--vertical.svelte-se2bjk .alviere-timeline__step-wrapper:where(.svelte-se2bjk) {flex-direction:column;align-items:flex-start;}.alviere-timeline--vertical.svelte-se2bjk .alviere-timeline__connector:where(.svelte-se2bjk) {width:var(--timeline-connector-width);height:2rem;}.alviere-timeline__container.svelte-se2bjk {display:flex;align-items:center;width:100%;gap:0;}.alviere-timeline__step-wrapper.svelte-se2bjk {position:relative;flex:1;}.alviere-timeline__step.svelte-se2bjk {display:flex;flex-direction:column;align-items:center;gap:0.5rem;position:relative;}.alviere-timeline__step-indicator.svelte-se2bjk {position:relative;width:var(--timeline-step-size);height:var(--timeline-step-size);border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--alv-color-surface, #ffffff);border:1px solid var(--timeline-color);transition:all var(--alv-transition-normal, 0.3s ease-in-out);}.alviere-timeline__step-icon.svelte-se2bjk {font-size:calc(var(--timeline-step-size) * 0.5);font-weight:var(--alv-font-weight-bold, 700);color:var(--alv-color-on-primary, #ffffff);transition:all var(--alv-transition-normal, 0.3s ease-in-out);display:flex;flex-direction:column;align-items:center;justify-content:center;}.alviere-timeline__step-icon.svelte-se2bjk svg {width:calc(var(--timeline-step-size) * 0.75);height:calc(var(--timeline-step-size) * 0.75);}.alviere-timeline__step--pending.svelte-se2bjk .alviere-timeline__step-indicator:where(.svelte-se2bjk) {border-color:var(--timeline-pending-color);background:var(--alv-color-surface, #ffffff);}.alviere-timeline__step--pending.svelte-se2bjk .alviere-timeline__step-icon:where(.svelte-se2bjk) {color:var(--timeline-pending-color);}.alviere-timeline__step--active.svelte-se2bjk .alviere-timeline__step-indicator:where(.svelte-se2bjk) {border-color:var(--timeline-color);background:var(--timeline-color);}.alviere-timeline__step--active.svelte-se2bjk .alviere-timeline__step-icon:where(.svelte-se2bjk) {color:var(--alv-color-on-primary, #ffffff);}.alviere-timeline__step--active.svelte-se2bjk .alviere-timeline__step-text:where(.svelte-se2bjk) {font-weight:var(--alv-font-weight-bold, 700);}.alviere-timeline__step--completed.svelte-se2bjk .alviere-timeline__step-indicator:where(.svelte-se2bjk) {border-color:var(--timeline-completed-color);background:var(--timeline-completed-color);}.alviere-timeline__step--completed.svelte-se2bjk .alviere-timeline__step-icon:where(.svelte-se2bjk) {color:var(--alv-color-on-success, #ffffff);}.alviere-timeline__step--error.svelte-se2bjk .alviere-timeline__step-indicator:where(.svelte-se2bjk) {border-color:var(--timeline-error-color);background:var(--timeline-error-color);}.alviere-timeline__step--error.svelte-se2bjk .alviere-timeline__step-icon:where(.svelte-se2bjk) {color:var(--alv-color-on-error, #ffffff);}.alviere-timeline__step-label.svelte-se2bjk {display:none;flex-direction:column;align-items:center;text-align:center;gap:0.25rem;}.alviere-timeline__step-text.svelte-se2bjk {font-size:var(--timeline-font-size);font-weight:var(--alv-font-weight-medium, 500);color:var(--alv-color-text-primary);white-space:nowrap;}.alviere-timeline__step-description.svelte-se2bjk {font-size:calc(var(--timeline-font-size) * 0.875);color:var(--alv-color-text-secondary);white-space:nowrap;}.alviere-timeline__connector.svelte-se2bjk {background:var(--timeline-pending-color);transition:background-color var(--alv-transition-normal, 0.3s ease-in-out);}.alviere-timeline__step-ripple.svelte-se2bjk {position:absolute;top:50%;left:50%;width:var(--timeline-step-size);height:var(--timeline-step-size);border-radius:50%;background:rgba(var(--alv-color-success-rgb, 67, 107, 29), 0.3);transform:translate(-50%, -50%) scale(0);pointer-events:none;opacity:0;transition:all 0.6s ease-out;}.alviere-timeline__step-ripple--active.svelte-se2bjk {transform:translate(-50%, -50%) scale(2);opacity:1;}\n@media (max-width: 768px) {.alviere-timeline__step-text.svelte-se2bjk {font-size:var(--alv-font-size-sm);}.alviere-timeline__step-description.svelte-se2bjk {font-size:var(--alv-font-size-xs);}\n}.alviere-timeline__step-indicator.svelte-se2bjk:focus-visible {outline:2px solid var(--timeline-color);outline-offset:2px;}\n@media (prefers-reduced-motion: reduce) {.alviere-timeline__step-ripple.svelte-se2bjk {transition:none;}.alviere-timeline__step-indicator.svelte-se2bjk {transition:none;}.alviere-timeline__connector.svelte-se2bjk {transition:none;}\n}'};function id(e,t){je(t,!0),Oa(e,od);let r=zn(t,"steps",31,()=>Dt([])),a=zn(t,"size",15,"md"),n=zn(t,"showLabels",15,!0),o=zn(t,"showDescriptions",15,!1),i=zn(t,"orientation",15,"horizontal"),l=zn(t,"class",15,""),s=At(Dt(new Set)),c=rt(()=>`alviere-timeline alviere-timeline--${a()} alviere-timeline--${i()} ${l()}`.trim());Zt(()=>{r().forEach(e=>{"completed"!==e.status||qr(s).has(e.id)||(qr(s).add(e.id),function(e){const t=document.querySelector(`[data-step-id="${e}"]`);t&&(t.classList.add("alviere-timeline__step-ripple--active"),setTimeout(()=>{t.classList.remove("alviere-timeline__step-ripple--active")},1e3))}(e.id))})});const u=cc(dc),v=cc(bc);var d=nd(),p=Ht(d);return Ra(p,21,r,Na,(e,t,a)=>{var i=ad(),l=Ht(i),s=e=>{va(e,ed())};Ba(l,e=>{a<r().length-1&&e(s)});var c=Wt(l,2),d=Ht(c),p=Ht(d);Pa(Ht(p),()=>{var e;return null==(e=function(e){switch(e){case"completed":return u;case"error":return v;default:return null}}(qr(t).status))?void 0:e.outerHTML}),Re(p);var f=Wt(p,2);Re(d);var h=Wt(d,2),g=e=>{var r=rd(),a=Ht(r),n=Ht(a,!0);Re(a);var i=Wt(a,2),l=e=>{var r=td(),a=Ht(r,!0);Re(r),ar(()=>Ca(a,qr(t).description)),va(e,r)};Ba(i,e=>{o()&&qr(t).description&&e(l)}),Re(r),ar(()=>Ca(n,qr(t).label)),va(e,r)};Ba(h,e=>{n()&&e(g)}),Re(c),Re(i),ar(e=>{Ga(c,1,e,"svelte-se2bjk"),sn(f,"data-step-id",qr(t).id)},[()=>Fa(`alviere-timeline__step alviere-timeline__step--${qr(t).status}`)]),va(e,i)}),Re(p),Re(d),ar(()=>Ga(d,1,Fa(qr(c)),"svelte-se2bjk")),va(e,d),qe({get steps(){return r()},set steps(e=[]){r(e),wt()},get size(){return a()},set size(e="md"){a(e),wt()},get showLabels(){return n()},set showLabels(e=!0){n(e),wt()},get showDescriptions(){return o()},set showDescriptions(e=!1){o(e),wt()},get orientation(){return i()},set orientation(e="horizontal"){i(e),wt()},get class(){return l()},set class(e=""){l(e),wt()}})}customElements.define("alviere-timeline",Un(id,{steps:{},size:{},showLabels:{},showDescriptions:{},orientation:{},class:{}},[],[],!0));var ld=ia('<span class="alviere-button__icon svelte-1tj1ov8" part="icon"><!></span>'),sd=ia('<button part="root"><!> <span class="alviere-button__label svelte-1tj1ov8" part="label"><!></span></button>');const cd={hash:"svelte-1tj1ov8",code:'.alviere-button.svelte-1tj1ov8 {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;}.alviere-button--sm.svelte-1tj1ov8 {padding:0 0.5rem;height:2.4375rem;}.alviere-button--md.svelte-1tj1ov8 {padding:0 1rem;height:3.25rem;}.alviere-button--lg.svelte-1tj1ov8 {padding:0 1.5rem;height:4.0625rem;}.alviere-button--primary.svelte-1tj1ov8 {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#27272a;color:#ffffff;}.alviere-button--primary.svelte-1tj1ov8:hover:not(:disabled) {background:#3f3f46;}.alviere-button--primary.svelte-1tj1ov8:disabled {background:#52525b;cursor:not-allowed;}.alviere-button--secondary.svelte-1tj1ov8 {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#e4e4e7;color:#27272a;}.alviere-button--secondary.svelte-1tj1ov8:hover:not(:disabled) {background:#d4d4d8;}.alviere-button--secondary.svelte-1tj1ov8:disabled {background:#f4f4f5;color:#71717a;cursor:not-allowed;}.alviere-button--tertiary.svelte-1tj1ov8 {border:none;border-radius:0.25rem;font-family:"Darker Grotesque", sans-serif;font-size:1rem;font-weight:600;line-height:1;cursor:pointer;transition:background-color 150ms ease-in-out;background:#ffffff;border:1px solid #3f3f46;color:#27272a;}.alviere-button--tertiary.svelte-1tj1ov8:hover:not(:disabled) {background:#e4e4e7;}.alviere-button--tertiary.svelte-1tj1ov8:disabled {background:#f4f4f5;color:#71717a;cursor:not-allowed;}.alviere-button--icon.svelte-1tj1ov8 {display:flex;align-items:center;gap:0.5rem;}.alviere-button--icon.svelte-1tj1ov8 .alviere-button__icon:where(.svelte-1tj1ov8) {display:flex;align-items:center;}.alviere-button--icon.svelte-1tj1ov8 .alviere-button__label:where(.svelte-1tj1ov8):empty {display:none;}\n@media (max-width: 768px) {.alviere-button--icon.svelte-1tj1ov8 .alviere-button__label:where(.svelte-1tj1ov8) {display:none;}\n}'};function ud(e,t){je(t,!0),Oa(e,cd);let r=zn(t,"size",15,"md"),a=zn(t,"color",15,""),n=zn(t,"primaryColor",15,""),o=zn(t,"backgroundColor",15,""),i=zn(t,"ariaLabel",15,""),l=zn(t,"class",15,""),s=zn(t,"variant",15,"primary"),c=zn(t,"handler",15),u=zn(t,"disabled",15,!1),v=zn(t,"type",15,"button"),d=zn(t,"iconName",15,null),p=rt(()=>`alviere-button alviere-button--${r()} alviere-button--${s()} ${l()} ${d()?"alviere-button--icon":""}`.trim()),f=rt(()=>{const e=[];return a()?e.push(`--alv-color-primary: ${a()}`):n()&&e.push(`--alv-color-primary: ${n()}`),o()&&e.push(`--alv-button-primary-bg: ${o()}`),e.join("; ")});const h={ArrowLeft:uc,ArrowRight:vc,Plus:gc,X:bc,Trash:mc},g=rt(()=>()=>{if(!d())return null;const e=h[d()];return e?cc(e):null}),m=rt(()=>()=>{var e;return(null===(e=qr(g)())||void 0===e?void 0:e.outerHTML)||""});var b=sd();b.__click=function(...e){var t;null==(t=c())||t.apply(this,e)};var y=Ht(b),_=e=>{var t=ld();Pa(Ht(t),()=>qr(m)()),Re(t),va(e,t)};Ba(y,e=>{qr(m)()&&e(_)});var w=Wt(y,2);return Va(Ht(w),t,"default",{}),Re(w),Re(b),ar(()=>{Ga(b,1,Fa(qr(p)),"svelte-1tj1ov8"),b.disabled=u(),sn(b,"aria-label",i()),sn(b,"type",v()),Ya(b,qr(f))}),va(e,b),qe({get size(){return r()},set size(e="md"){r(e),wt()},get color(){return a()},set color(e=""){a(e),wt()},get primaryColor(){return n()},set primaryColor(e=""){n(e),wt()},get backgroundColor(){return o()},set backgroundColor(e=""){o(e),wt()},get ariaLabel(){return i()},set ariaLabel(e=""){i(e),wt()},get class(){return l()},set class(e=""){l(e),wt()},get variant(){return s()},set variant(e="primary"){s(e),wt()},get handler(){return c()},set handler(e){c(e),wt()},get disabled(){return u()},set disabled(e=!1){u(e),wt()},get type(){return v()},set type(e="button"){v(e),wt()},get iconName(){return d()},set iconName(e=null){d(e),wt()}})}ra(["click"]),customElements.define("alviere-button",Un(ud,{size:{},color:{},primaryColor:{},backgroundColor:{},ariaLabel:{},class:{},variant:{},handler:{},disabled:{},type:{},iconName:{}},["default"],[],!0));var vd=ia("<div><!></div>");const dd={hash:"svelte-7elmuq",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-badge.svelte-7elmuq {display:inline-block;padding:0.25rem 0.5rem;border-radius:0.375rem;font-size:0.75rem;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-weight:500;color:#3f3f46;background:#f4f4f5;}.alviere-badge--sm.svelte-7elmuq {padding:0 0.5rem;line-height:1.875rem;border-radius:1.875rem;font-size:0.75rem;}.alviere-badge--md.svelte-7elmuq {padding:0 1rem;line-height:2.5rem;border-radius:2.5rem;font-size:1rem;}.alviere-badge--lg.svelte-7elmuq {padding:0 1rem;line-height:2.8125rem;border-radius:2.8125rem;font-size:1.125rem;}.alviere-badge--primary.svelte-7elmuq {background-color:#227e9e;color:#ffffff;}.alviere-badge--secondary.svelte-7elmuq {background-color:#a1a1aa;color:#ffffff;}.alviere-badge--error.svelte-7elmuq {background-color:#b3311f;color:#ffffff;}.alviere-badge--success.svelte-7elmuq {background-color:#436b1d;color:#ffffff;}.alviere-badge--warning.svelte-7elmuq {background-color:#ffc107;color:#000000;}.alviere-badge--info.svelte-7elmuq {background-color:#175db8;color:#ffffff;}'};function pd(e,t){je(t,!0),Oa(e,dd);let r=zn(t,"variant",15,"primary"),a=zn(t,"size",15,"md");var n=vd();return Va(Ht(n),t,"default",{}),Re(n),ar(()=>Ga(n,1,`alviere-badge alviere-badge--${r()??""} alviere-badge--${a()??""}`,"svelte-7elmuq")),va(e,n),qe({get variant(){return r()},set variant(e="primary"){r(e),wt()},get size(){return a()},set size(e="md"){a(e),wt()}})}customElements.define("alviere-badge",Un(pd,{variant:{},size:{}},["default"],[],!0));var fd=ia('<div class="alviere-list"><!></div>');function hd(e,t){let r;je(t,!0),Aa(()=>{const e=r.querySelector("slot");if(e){e.assignedElements().filter(e=>"alviere-list-item"!==e.tagName.toLowerCase()).length}});var a=fd();Va(Ht(a),t,"default",{}),Re(a),kn(a,e=>r=e,()=>r),va(e,a),qe()}customElements.define("alviere-list",Un(hd,{},["default"],[],!0));var gd=(e,t,r)=>{var a;return(null==(a=t())?void 0:a.value)&&r()},md=(e,t)=>{e.stopPropagation(),Bt(t,!qr(t))},bd=(e,t)=>{e.stopPropagation(),t(e)},yd=ia('<div role="button"><span class="alviere-list-item__expandable__icon svelte-crzbgj"><!></span></div>'),_d=ia("<div><!></div>"),wd=ia('<div><div class="alviere-list-item__header svelte-crzbgj"><div class="alviere-list-item__badge svelte-crzbgj"><!></div> <div class="alviere-list-item__leading svelte-crzbgj"><!></div> <div class="alviere-list-item__content svelte-crzbgj"><div class="alviere-list-item__text svelte-crzbgj"><div class="alviere-list-item__primary-text svelte-crzbgj"><!></div> <div class="alviere-list-item__secondary-text svelte-crzbgj"><!></div> <div class="alviere-list-item__tertiary-text svelte-crzbgj"><!></div></div></div> <div class="alviere-list-item__content__monetary svelte-crzbgj"><div class="alviere-list-item__content__monetary__payment-method"><!></div> <div class="alviere-list-item__content__monetary__amount"><!></div></div> <div class="alviere-list-item__actions svelte-crzbgj"><!></div> <!></div> <!></div>');const Cd={hash:"svelte-crzbgj",code:".alviere-list-item.svelte-crzbgj {display:flex;flex-direction:column;border-top:1px solid transparent;border-bottom:1px solid #d4d4d8;}.alviere-list-item__header.svelte-crzbgj {display:flex;align-items:center;gap:var(--spacing-md, 1rem);padding:var(--spacing-md, 1rem);}.alviere-list-item--last.svelte-crzbgj {border-bottom:1px solid transparent;}.alviere-list-item--selectable.svelte-crzbgj {cursor:pointer;}.alviere-list-item--selectable.svelte-crzbgj:hover {background-color:#fafafa;}.alviere-list-item--selectable:hover.alviere-list-item--selected.svelte-crzbgj .alviere-list-item__header:where(.svelte-crzbgj) {background-color:#d1e8f0;}.alviere-list-item--selectable.alviere-list-item--selected.svelte-crzbgj {border-top:1px solid #227e9e;border-bottom:1px solid #227e9e;}.alviere-list-item--selectable.alviere-list-item--selected.svelte-crzbgj .alviere-list-item__header:where(.svelte-crzbgj) {background-color:#e8f4f8;}.alviere-list-item__leading.svelte-crzbgj {display:flex;align-items:center;flex-shrink:0;}.alviere-list-item__leading.svelte-crzbgj:empty {display:none;}.alviere-list-item__content.svelte-crzbgj {display:flex;align-items:center;gap:var(--spacing-sm, 8px);flex:1;min-width:0;}.alviere-list-item__content__monetary.svelte-crzbgj {display:flex;align-items:center;font-size:1.125rem;gap:var(--spacing-lg, 1.5rem);flex-shrink:0;}.alviere-list-item__badge.svelte-crzbgj {flex-shrink:0;}.alviere-list-item__badge.svelte-crzbgj:empty {display:none;}.alviere-list-item__text.svelte-crzbgj {flex:1;flex-direction:column;min-width:0;}.alviere-list-item__text.svelte-crzbgj:empty {display:none;}.alviere-list-item__primary-text.svelte-crzbgj {font-size:1.25rem;color:#3f3f46;padding-bottom:0.25rem;font-weight:500;}.alviere-list-item__primary-text.svelte-crzbgj:last-child {padding-bottom:0;}.alviere-list-item__secondary-text.svelte-crzbgj {font-size:1.125rem;color:#3f3f46;padding-bottom:0.25rem;}.alviere-list-item__secondary-text.svelte-crzbgj:last-child {padding-bottom:0;}.alviere-list-item__secondary-text.svelte-crzbgj:empty {display:none;}.alviere-list-item__tertiary-text.svelte-crzbgj {font-size:1rem;color:#71717a;}.alviere-list-item__tertiary-text.svelte-crzbgj:last-child {padding-bottom:0;}.alviere-list-item__tertiary-text.svelte-crzbgj:empty {display:none;}.alviere-list-item__actions.svelte-crzbgj {display:flex;align-items:center;gap:var(--spacing-sm, 8px);flex-shrink:0;}.alviere-list-item__actions.svelte-crzbgj:empty {display:none;}.alviere-list-item__expandable.svelte-crzbgj {display:flex;justify-content:center;padding:var(--spacing-xs, 0.25rem);border-radius:0.125rem;}.alviere-list-item__expandable__icon.svelte-crzbgj {display:flex;align-items:center;justify-content:center;width:100%;transition:transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);will-change:transform;}.alviere-list-item__expandable--active.svelte-crzbgj .alviere-list-item__expandable__icon:where(.svelte-crzbgj) {transform:rotate(90deg);}.alviere-list-item__expandable.svelte-crzbgj:hover {background-color:#d4d4d8;}.alviere-list-item__expanded-content.svelte-crzbgj {transition:opacity 0.3s cubic-bezier(0.19, 1, 0.22, 1);will-change:opacity;}.alviere-list-item__expanded-content--active.svelte-crzbgj {border-top:1px solid #227e9e;}"};function xd(e,t){je(t,!0),Oa(e,Cd);let r=zn(t,"selectable",15,null),a=zn(t,"expandable",15,!1),n=zn(t,"selected",15,!1),o=zn(t,"last",15,!1);const i=Ia(),l=cc(fc);let s=At(!1);function c(){N.info("ListItem: dispatching select event",null===r()||void 0===r()?void 0:r().value),i("select",{value:null===r()||void 0===r()?void 0:r().value})}function u(e){"Enter"!==e.key&&" "!==e.key||!(null===r()||void 0===r()?void 0:r().value)||(e.preventDefault(),c())}function v(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Bt(s,!qr(s)))}var d=wd();d.__click=[gd,r,c],d.__keydown=function(...e){var t;null==(t=r()?u:void 0)||t.apply(this,e)};var p=Ht(d),f=Ht(p);Va(Ht(f),t,"badge",{}),Re(f);var h=Wt(f,2);Va(Ht(h),t,"leading",{}),Re(h);var g=Wt(h,2),m=Ht(g),b=Ht(m);Va(Ht(b),t,"primary-text",{}),Re(b);var y=Wt(b,2);Va(Ht(y),t,"secondary-text",{}),Re(y);var _=Wt(y,2);Va(Ht(_),t,"tertiary-text",{}),Re(_),Re(m),Re(g);var w=Wt(g,2),C=Ht(w);Va(Ht(C),t,"monetary-text-method",{}),Re(C);var x=Wt(C,2);Va(Ht(x),t,"monetary-text-amount",{}),Re(x),Re(w);var E=Wt(w,2);Va(Ht(E),t,"actions",{}),Re(E);var S=Wt(E,2),k=e=>{var t=yd();let r;sn(t,"tabindex",0),t.__click=[md,s],t.__keydown=[bd,v];var a=Ht(t);Pa(Ht(a),()=>l.outerHTML),Re(a),Re(t),ar(e=>{r=Ga(t,1,"alviere-list-item__expandable svelte-crzbgj",null,r,e),sn(t,"aria-expanded",qr(s))},[()=>({"alviere-list-item__expandable--active":qr(s)})]),va(e,t)};Ba(S,e=>{a()&&e(k)}),Re(p);var T=Wt(p,2),A=e=>{var r=ua(),a=Gt(r),n=e=>{var r=_d();let a;Va(Ht(r),t,"expanded-content",{}),Re(r),ar(e=>a=Ga(r,1,"alviere-list-item__expanded-content svelte-crzbgj",null,a,e),[()=>({"alviere-list-item__expanded-content--active":qr(s)})]),_n(1,r,()=>Bu,()=>({duration:200})),_n(2,r,()=>Bu,()=>({duration:150})),va(e,r)};Ba(a,e=>{qr(s)&&e(n)}),va(e,r)};return Ba(T,e=>{a()&&e(A)}),Re(d),ar(()=>{Ga(d,1,`alviere-list-item ${(o()&&"alviere-list-item--last")??""} ${(r()&&"alviere-list-item--selectable")??""} ${(n()&&"alviere-list-item--selected")??""}`,"svelte-crzbgj"),sn(d,"role",r()?"button":void 0),sn(d,"tabindex",r()?0:void 0)}),va(e,d),qe({get selectable(){return r()},set selectable(e=null){r(e),wt()},get expandable(){return a()},set expandable(e=!1){a(e),wt()},get selected(){return n()},set selected(e=!1){n(e),wt()},get last(){return o()},set last(e=!1){o(e),wt()}})}ra(["click","keydown"]),customElements.define("alviere-list-item",Un(xd,{selectable:{},expandable:{},selected:{},last:{}},["badge","leading","primary-text","secondary-text","tertiary-text","monetary-text-method","monetary-text-amount","actions","expanded-content"],[],!0));var Ed=ia('<div class="alviere-radio"><div class="alviere-radio__input"><input type="radio"/> <div class="alviere-radio__input-inner"><div class="alviere-radio__input-inner-circle"></div></div></div> <div class="alviere-radio__label"><!></div></div>');const Sd={hash:"svelte-45h",code:""};function kd(e,t){je(t,!0),Oa(e,Sd);let r=zn(t,"name",15,""),a=zn(t,"value",15,""),n=zn(t,"checked",15,!1);var o=Ed(),i=Ht(o),l=Ht(i);an(l),ze(2),Re(i);var s=Wt(i,2);return Va(Ht(s),t,"default",{}),Re(s),Re(o),ar(()=>{on(l,n()),sn(l,"name",r()),nn(l,a())}),va(e,o),qe({get name(){return r()},set name(e=""){r(e),wt()},get value(){return a()},set value(e=""){a(e),wt()},get checked(){return n()},set checked(e=!1){n(e),wt()}})}function Td(e,t,r,a,n,o){const i=e.target;if(t(i.checked),qr(r)){const e=new CustomEvent("change",{detail:{checked:i.checked,value:a(),name:n()},bubbles:!0,composed:!0});qr(r).dispatchEvent(e)}o()&&o()(e)}customElements.define("alviere-radio",Un(kd,{name:{},value:{},checked:{}},["default"],[],!0));var Ad=ia('<div class="alviere-checkbox__label"> </div>'),Id=ia('<div class="alviere-checkbox svelte-vz8w8t"><div><input type="checkbox" class="alviere-checkbox__input-checkbox svelte-vz8w8t"/> <div class="alviere-checkbox__input-inner svelte-vz8w8t"><div class="alviere-checkbox__input-inner-checkmark svelte-vz8w8t"><!></div></div></div> <!></div>');const Bd={hash:"svelte-vz8w8t",code:':root {--alv-color-primary: #227e9e;--alv-color-primary-hover: #1b6680;--alv-color-primary-active: #145164;--alv-color-primary-light: #e8f4f8;--alv-color-primary-light-hover: #d1e8f0;--alv-color-on-primary: #ffffff;--alv-color-success: #436b1d;--alv-color-success-light: #d4edda;--alv-color-success-border: #c3e6cb;--alv-color-success-text: #155724;--alv-color-on-success: #ffffff;--alv-color-success-rgb: 67, 107, 29;--alv-color-error: #b3311f;--alv-color-error-light: #f8d7da;--alv-color-error-border: #f5c6cb;--alv-color-error-text: #721c24;--alv-color-on-error: #ffffff;--alv-color-error-rgb: 179, 49, 31;--alv-color-warning: #ffc107;--alv-color-warning-light: #fff3cd;--alv-color-warning-border: #ffeaa7;--alv-color-warning-text: #856404;--alv-color-on-warning: #000000;--alv-color-info: #175db8;--alv-color-info-light: #d1ecf1;--alv-color-info-border: #bee5eb;--alv-color-info-text: #0c5460;--alv-color-on-info: #ffffff;--alv-color-gray-50: #fafafa;--alv-color-gray-100: #f4f4f5;--alv-color-gray-200: #e4e4e7;--alv-color-gray-300: #d4d4d8;--alv-color-gray-400: #a1a1aa;--alv-color-gray-500: #71717a;--alv-color-gray-600: #52525b;--alv-color-gray-700: #3f3f46;--alv-color-gray-800: #27272a;--alv-color-gray-900: #18181b;--alv-color-surface: #ffffff;--alv-color-surface-secondary: #f9fafb;--alv-color-surface-tertiary: #f4f4f5;--alv-color-surface-elevated: #ffffff;--alv-color-text-primary: #18181b;--alv-color-text-secondary: #52525b;--alv-color-text-tertiary: #71717a;--alv-color-text-disabled: #a1a1aa;--alv-color-text-on-primary: #ffffff;--alv-color-text-on-surface: #18181b;--alv-color-border: #e4e4e7;--alv-color-border-hover: #d4d4d8;--alv-color-border-focus: #227e9e;--alv-color-border-error: #b3311f;--alv-color-border-success: #436b1d;--alv-color-background: #ffffff;--alv-color-background-disabled: #f4f4f5;--alv-color-background-hover: #f9fafb;--alv-color-background-active: #f4f4f5;}:root {--alv-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--alv-font-family-grotesque: "Darker Grotesque", sans-serif;--alv-font-family-mono: "Monaco", "Menlo", "Ubuntu Mono", monospace;--alv-font-size-3xs: 0.625rem;--alv-font-size-2xs: 0.75rem;--alv-font-size-xs: 1rem;--alv-font-size-sm: 1.125rem;--alv-font-size-base: 1.25rem;--alv-font-size-lg: 1.5rem;--alv-font-size-xl: 1.75rem;--alv-font-weight-light: 300;--alv-font-weight-normal: 400;--alv-font-weight-medium: 500;--alv-font-weight-semibold: 600;--alv-font-weight-bold: 700;--alv-line-height-tight: 1.25;--alv-line-height-normal: 1.5;--alv-line-height-relaxed: 1.75;}:root {--alv-spacing-xs: 0.25rem;--alv-spacing-sm: 0.5rem;--alv-spacing-md: 1rem;--alv-spacing-lg: 1.5rem;--alv-spacing-xl: 2rem;--alv-spacing-2xl: 3rem;--alv-spacing-3xl: 4rem;}:root {--alv-border-radius-none: 0;--alv-border-radius-sm: 0.125rem;--alv-border-radius: 0.25rem;--alv-border-radius-md: 0.375rem;--alv-border-radius-lg: 0.5rem;--alv-border-radius-xl: 0.75rem;--alv-border-radius-2xl: 1rem;--alv-border-radius-full: 9999px;}:root {--alv-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);--alv-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);--alv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--alv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);--alv-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);--alv-shadow-none: none;}:root {--alv-transition-fast: 150ms ease-in-out;--alv-transition-normal: 250ms ease-in-out;--alv-transition-slow: 350ms ease-in-out;--alv-transition-none: none;}:root {--alv-input-height-sm: 2.5rem;--alv-input-height: 3.25rem;--alv-input-height-lg: 3.75rem;--alv-input-padding-x: 0.75rem;--alv-input-padding-y: 0.5rem;--alv-input-border-color: var(--alv-color-border);--alv-input-border-hover: var(--alv-color-border-hover);--alv-input-border-focus: var(--alv-color-border-focus);--alv-input-bg: var(--alv-color-background);--alv-input-bg-disabled: var(--alv-color-background-disabled);}:root {--alv-z-dropdown: 1000;--alv-z-sticky: 1020;--alv-z-fixed: 1030;--alv-z-modal-backdrop: 1040;--alv-z-modal: 1050;--alv-z-popover: 1060;--alv-z-tooltip: 1070;}:root {--alv-button-primary-bg: var(--alv-color-primary);--alv-button-primary-bg-hover: var(--alv-color-primary-hover);--alv-button-primary-bg-active: var(--alv-color-primary-active);--alv-button-primary-text: var(--alv-color-on-primary);--alv-button-primary-border: var(--alv-color-primary);--alv-button-secondary-bg: transparent;--alv-button-secondary-bg-hover: var(--alv-color-primary-light);--alv-button-secondary-bg-active: var(--alv-color-primary-light-hover);--alv-button-secondary-text: var(--alv-color-primary);--alv-button-secondary-border: var(--alv-color-primary);--alv-button-tertiary-bg: transparent;--alv-button-tertiary-bg-hover: var(--alv-color-gray-100);--alv-button-tertiary-bg-active: var(--alv-color-gray-200);--alv-button-tertiary-text: var(--alv-color-text-primary);--alv-button-tertiary-border: transparent;--alv-button-link-bg: transparent;--alv-button-link-bg-hover: transparent;--alv-button-link-bg-active: transparent;--alv-button-link-text: var(--alv-color-primary);--alv-button-link-text-hover: var(--alv-color-primary-hover);--alv-button-link-border: transparent;}:root {--alv-spinner-color: var(--alv-color-text-primary);--alv-spinner-size-sm: 1rem;--alv-spinner-size-md: 1.5rem;--alv-spinner-size-lg: 4rem;--alv-spinner-stroke-width: 2px;}:root {--alv-timeline-color: var(--alv-color-gray-600);--alv-timeline-completed-color: var(--alv-color-success);--alv-timeline-error-color: var(--alv-color-error);--alv-timeline-pending-color: var(--alv-color-gray-400);--alv-timeline-step-size-sm: 1.25rem;--alv-timeline-step-size-md: 2rem;--alv-timeline-step-size-lg: 2.5rem;--alv-timeline-connector-width: 3px;--alv-timeline-font-size: var(--alv-font-size-base);}:root {--alv-badge-primary-bg: var(--alv-color-primary);--alv-badge-primary-text: var(--alv-color-on-primary);--alv-badge-secondary-bg: var(--alv-color-gray-200);--alv-badge-secondary-text: var(--alv-color-text-primary);--alv-badge-success-bg: var(--alv-color-success);--alv-badge-success-text: var(--alv-color-on-success);--alv-badge-error-bg: var(--alv-color-error);--alv-badge-error-text: var(--alv-color-on-error);--alv-badge-warning-bg: var(--alv-color-warning);--alv-badge-warning-text: var(--alv-color-on-warning);--alv-badge-info-bg: var(--alv-color-info);--alv-badge-info-text: var(--alv-color-on-info);}:root {--alv-list-bg: var(--alv-color-surface);--alv-list-border: var(--alv-color-border);--alv-list-item-bg: transparent;--alv-list-item-bg-hover: var(--alv-color-background-hover);--alv-list-item-bg-active: var(--alv-color-background-active);--alv-list-item-text: var(--alv-color-text-primary);--alv-list-item-text-secondary: var(--alv-color-text-secondary);}:root {--alv-radio-border: var(--alv-color-border);--alv-radio-border-hover: var(--alv-color-border-hover);--alv-radio-border-focus: var(--alv-color-border-focus);--alv-radio-bg: var(--alv-color-background);--alv-radio-checked-bg: var(--alv-color-primary);--alv-radio-checked-border: var(--alv-color-primary);--alv-radio-text: var(--alv-color-text-primary);--alv-radio-text-disabled: var(--alv-color-text-disabled);}.alviere-checkbox.svelte-vz8w8t {display:flex;align-items:center;gap:0.5rem;position:relative;}.alviere-checkbox__input.svelte-vz8w8t input:where(.svelte-vz8w8t) {opacity:0;position:absolute;top:0;left:0;width:100%;height:100%;cursor:pointer;z-index:2;}.alviere-checkbox__input-inner.svelte-vz8w8t {width:1rem;height:1rem;border-radius:0.25rem;border:1px solid #52525b;position:relative;z-index:1;transition:all 0.2s ease-in-out;}.alviere-checkbox__input-inner-checkmark.svelte-vz8w8t {position:absolute;top:50%;left:50%;transform:translate(-50%, -50%) scale(0.6);width:100%;height:100%;opacity:0;transition:all 0.2s ease-in-out;color:#ffffff;z-index:3;}.alviere-checkbox__input-inner-checkmark.svelte-vz8w8t svg {width:100%;height:100%;position:relative;}.alviere-checkbox__input--checked.svelte-vz8w8t .alviere-checkbox__input-inner:where(.svelte-vz8w8t) {background-color:#000000;}.alviere-checkbox__input--checked.svelte-vz8w8t .alviere-checkbox__input-inner-checkmark:where(.svelte-vz8w8t) {opacity:1;transform:translate(-50%, -50%) scale(1);}'};function Nd(e,t){je(t,!0),Oa(e,Bd);let r=zn(t,"name",15,""),a=zn(t,"value",15,!1),n=zn(t,"checked",15,!1),o=zn(t,"label",15,""),i=zn(t,"disabled",15,!1),l=zn(t,"onchange",15),s=At(null);const c=cc(dc),u=rt(()=>["alviere-checkbox__input",n()?"alviere-checkbox__input--checked":"",i()?"alviere-checkbox__input--disabled":""].filter(Boolean).join(" "));var v=Id(),d=Ht(v),p=Ht(d);an(p),p.__change=[Td,n,s,a,r,l];var f=Wt(p,2),h=Ht(f);Pa(Ht(h),()=>c.outerHTML),Re(h),Re(f),Re(d);var g=Wt(d,2),m=e=>{var t=Ad(),r=Ht(t,!0);Re(t),ar(()=>Ca(r,o())),va(e,t)};return Ba(g,e=>{o()&&e(m)}),Re(v),kn(v,e=>Bt(s,e),()=>qr(s)),ar(()=>{Ga(d,1,Fa(qr(u)),"svelte-vz8w8t"),on(p,n()),sn(p,"name",r()),nn(p,a()),p.disabled=i()}),va(e,v),qe({get name(){return r()},set name(e=""){r(e),wt()},get value(){return a()},set value(e=!1){a(e),wt()},get checked(){return n()},set checked(e=!1){n(e),wt()},get label(){return o()},set label(e=""){o(e),wt()},get disabled(){return i()},set disabled(e=!1){i(e),wt()},get onchange(){return l()},set onchange(e){l(e),wt()}})}ra(["change"]),customElements.define("alviere-checkbox",Un(Nd,{name:{},value:{},checked:{},label:{},disabled:{},onchange:{}},[],[],!0));const Rd=[{name:"alviere-card-pan-input",component:Ks},{name:"alviere-card-cvv-input",component:Xs},{name:"alviere-card-exp-input",component:oc},{name:"alviere-text-input",component:Rc},{name:"alviere-phone-input",component:Oc},{name:"alviere-date-of-birth-input",component:Wc},{name:"alviere-currency-input",component:ru},{name:"alviere-search-select",component:yu},{name:"alviere-add-payment-instrument",component:Au},{name:"alviere-create-consumer-account",component:ju},{name:"alviere-create-business-account",component:Wu},{name:"alviere-create-account",component:Ju},{name:"alviere-add-bank-account",component:xv},{name:"alviere-checkout-confirm",component:Av},{name:"alviere-multi-step-flow",component:Wv},{name:"alviere-spinner",component:Zv},{name:"alviere-timeline",component:id},{name:"alviere-button",component:ud},{name:"alviere-badge",component:pd},{name:"alviere-list",component:hd},{name:"alviere-list-item",component:xd},{name:"alviere-radio",component:kd},{name:"alviere-checkbox",component:Nd}],zd={inputs:{CardPanInput:Ks,CardCVVInput:Xs,CardExpInput:oc,TextInput:Rc,PhoneInput:Oc,DateOfBirthInput:Wc,CurrencyInput:ru,SearchSelect:yu},forms:{AddPaymentInstrument:Au,CreateConsumerAccount:ju,CreateBusinessAccount:Wu,CreateAccount:Ju,AddBankAccount:xv,CheckoutConfirm:Av},flows:{MultiStepFlow:Wv},elements:{Spinner:Zv,Timeline:id,Button:ud,Badge:pd,List:hd,ListItem:xd,Radio:kd,Checkbox:Nd}},Ld={AlviereCardPanInput:Ks,AlviereCardCVVInput:Xs,AlviereCardExpInput:oc,AlviereTextInput:Rc,AlvierePhoneInput:Oc,AlviereDateOfBirthInput:Wc,AlviereCurrencyInput:ru,AlviereSearchSelect:yu,AlviereAddPaymentInstrument:Au,AlviereCreateConsumerAccount:ju,AlviereCreateBusinessAccount:Wu,AlviereCreateAccount:Ju,AlviereAddBankAccount:xv,AlviereCheckoutConfirm:Av,AlviereMultiStepFlow:Wv,AlviereSpinner:Zv,AlviereTimeline:id,AlviereButton:ud,AlviereBadge:pd,AlviereList:hd,AlviereListItem:xd,AlviereRadio:kd,AlviereCheckbox:Nd},Dd={...Ld,...zd.inputs,...zd.forms,...zd.flows,...zd.elements},Ud=zd,Pd=Ld;function Vd(){N.info("🔍 Initializing web components"),"undefined"!=typeof window&&window.customElements&&(O.registerAll(Rd),N.info("✅ Alviere Web Components initialized successfully"))}return Vd(),N.info("🚀 Alviere UI Unified Entry Point v2.0.0 - Ready"),U(),N.info("Alviere UI Web Components v2.0.0 - Unified entry point ready with auto-injected tokens"),e.Alviere=Pd,e.Categories=Ud,e.Components=Dd,e.adoptTokensInShadowRoot=P,e.ensureTokensInjected=U,e.getComponent=function(e){return Dd[e]},e.getComponentNames=function(){return Object.keys(Dd)},e.hasComponent=function(e){return e in Dd},e.initializeWebComponents=Vd,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
2
+ //# sourceMappingURL=web-components.js.map