PageSourceSearch

https://foundervillage.xyz/assets/FiatOnrampScreen-D-ijGLq9-CB9TAvq9.js

js foundervillage.xyz collected 2026-10-05 08:55:36 UTC 185,907 bytes, 488 lines download raw bytes

1import{r as u,P as ll,aj as cl,ak as ul,j as d,l as Wn,_ as dl}from"./index-PlZrRKaG.js";import{g as fl,aD as pl,aE as go,a as Sr,c5 as ml,c as cs,i as Kt,c6 as hl,o as gl,c7 as yi,c8 as yl,c9 as bl,ca as xl,cb as vl,cc as Cl,cd as wl}from"./usePrivy-DXAqHE25-Cpqxmxnm.js";import{bu as Ye,bv as Sl,bw as st,bx as El,by as yo,bz as H,bA as kl,bB as us,bC as Il,bD as Nn}from"./PrivyClientProvider-DHGhbyl4.js";import{w as Rl,c as Pl,p as Al}from"./SelectSourceAsset-CXcAyH34-D-ewUKdG.js";import{g as z}from"./useActiveWallet-D3PAxAaJ-D8zKFXxd.js";import{t as ds}from"./WarningBanner-ZZqCEtZK-DMDMye9j.js";import{n as Wt}from"./ScreenLayout-DTsWfKKs-BE2k2KFi.js";import{a as _l}from"./ModalFooter-DKyozrEX-BChIQc81.js";import{y as Tl}from"./ConnectPhoneForm-BClRnco--R5imV-uF.js";import{p as Ml}from"./CopyableText-CQapvaMr-CjPxg6Fs.js";import{t as Ol}from"./InfoBanner-Cb3p1z12-DrOKxM0u.js";import{t as jl,h as Ll}from"./GooglePay-B53WnudL-C5l3y50W.js";import{C as zn}from"./credit-card-COesgCYF.js";import{c as Ot}from"./createLucideIcon-DhB6nFZb.js";import{C as fs}from"./circle-x--zXlDZB7.js";import{C as ps}from"./check-B4nVb7Nz.js";import{W as Fl}from"./wallet-CtbdoR9W.js";import{S as bi}from"./smartphone-C5TbF0fc.js";import{X as Dl}from"./x-CVavxJzT.js";import{L as Nl}from"./lock-zczQmlto.js";import{i as Er,a as tt,l as kr,x as Vr,y as vt,z as Vl,g as vn,b as Tt,j as $r,k as $l,u as Bl,c as Hl,e as Ul,A as ql,B as Kl,C as hr,D as Wl,E as zl,o as Yl,p as Gl,s as Xl,q as Ql,F as xi,G as dr,t as Zl,n as vi,H as Jl}from"./floating-ui.react-dom-BL0YD4i4.js";import"./founder-haus-testnet-C1PkM2Ql.js";import"./useSendTransaction-DBFheKXt-uZOFC0mU.js";import"./chevron-down-Co-42jBw.js";import"./ExclamationTriangleIcon-BkFnpqOi.js";import"./Screen-DMmH56yL-CF3vA16M.js";import"./index-CWARkn2w-BPL8Uuiu.js";import"./Chip-CZKIKt9K-CdMZhETw.js";import"./LoadingSkeleton-BMsgO5PV-BwnbO_ST.js";import"./copy-CU58T2BI.js";const ec=[["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3",key:"cabbwy"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]],Br=Ot("building",ec);const tc=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],nc=Ot("calendar",tc);const rc=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],oc=Ot("chevron-right",rc);const ic=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],sc=Ot("file-text",ic);const ac=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],ms=Ot("globe",ac);const lc=[["path",{d:"M10 18v-7",key:"wt116b"}],["path",{d:"M11.12 2.198a2 2 0 0 1 1.76.006l7.866 3.847c.476.233.31.949-.22.949H3.474c-.53 0-.695-.716-.22-.949z",key:"1m329m"}],["path",{d:"M14 18v-7",key:"vav6t3"}],["path",{d:"M18 18v-7",key:"aexdmj"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M6 18v-7",key:"1ivflk"}]],rr=Ot("landmark",lc);const cc=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],hs=Ot("map-pin",cc);const uc=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],dc=Ot("plus",uc);const fc=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],pc=Ot("search",fc);const mc=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],hc=Ot("user",mc);function gc(e,t){return function(r,...o){const i=new URL(e);
1return i.searchParams.set("code",r.toString()),o.forEach(s=>i.searchParams.append("args[]",s)),`${t} error #${r}; visit ${i} for the full message.`}}const Vt=gc("https://base-ui.com/production-error","Base UI");function Hr({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=u.useRef(e!==void 0),[i,s]=u.useState(t),a=o&&e!==void 0?e:i,f=u.useCallback(l=>{o||s(l)},[]);return[a,f]}const yc=()=>{},Z=typeof document<"u"?u.useLayoutEffect:yc;function bc(e){const t=u.useRef(!0);t.current&&(t.current=!1,e())}const bo={...ll},Ci={};function ft(e,t){const n=u.useRef(Ci);return n.current===Ci&&(n.current=e(t)),n}const Ur=bo.useInsertionEffect,xc=Ur&&Ur!==bo.useLayoutEffect?Ur:e=>e();function Y(e){const t=ft(vc).current;return t.next=e,xc(t.effect),t.trampoline}function vc(){const e={next:void 0,callback:Cc,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Cc(){}function yn(e,t,n,r){const o=ft(gs).current;return Sc(o,e,t,n,r)&&ys(o,[e,t,n,r]),o.callback}function wc(e){const t=ft(gs).current;return Ec(t,e)&&ys(t,e),t.callback}function gs(){return{callback:null,cleanup:null,refs:[]}}function Sc(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function Ec(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function ys(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const i=t[o];if(i!=null)switch(typeof i){case"function":{const s=i(n);typeof s=="function"&&(r[o]=s);break}case"object":{i.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const i=t[o];if(i!=null)switch(typeof i){case"function":{const s=r[o];typeof s=="function"?s():i(null);break}case"object":{i.current=null;break}}}}}}}function ut(e){const t=ft(kc,e).current;return t.next=e,Z(t.effect),t}function kc(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const bs={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},xs={...bs,position:"fixed",top:0,left:0},vs={...bs,position:"absolute"};var Ic=cl();const Rc=parseInt(u.version,10);function xo(e){return Rc>=e}const Pc=xo(19),Ac=Pc?Tc:Mc;function Cs(e,t,n,r,o){return Ac(e,t,n,r,o)}function _c(e,t,n,r,o){const i=u.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return Ic.useSyncExternalStore(e.subscribe,i,i)}function Tc(e,t,n,r,o){return _c(e,t,n,r,o)}function Mc(e,t,n,r,o){return ul.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,i=>t(i,n,r,o))}class Oc{static create(t){return new this(t)}constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,o){return Cs(this,t,n,r,o)}}function _e(){}const jn=Object.freeze([]),dt=Object.freeze({});class ws extends Oc{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){u.useDebugValue(t);const r=this;Z(()=>{r.state[t]!==n&&r.set(t,n)},[r,t,n])}useSyncedValueWithCleanup(t,n){const r=this;Z(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);Z(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){u.useDebugValue(t);const r=this,o=n!==void 0;Z(()=>{o&&!Object.is(r.state[t],n)&&r.setState({...r.state,[t]:n})},[r,t,n,o])}select(t,n,r,o){const i=this.selectors[t];return i(this.state,n,r,o)}useState(t,n,r,o){return u.useDebugValue(t),Cs(this,this.selectors[t],n,r,o)}useContextCallback(t,n){u.useDebugValue(t);const r=Y(n??_e);this.context[t]=r}useStateSetter(t){const n=u.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];
1let o=r(this.state);return n(o,o,this),this.subscribe(i=>{const s=r(i);if(!Object.is(o,s)){const a=o;o=s,n(s,a,this)}})}}function pn(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Fe(e){return e?.ownerDocument||document}function Ae(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Ss(e){u.useEffect(e,jn)}const or=null;class jc{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let o=0;o<n.length;o+=1)n[o]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||this.callbacks[n]!==null&&(this.callbacks[n]=null,this.callbacksCount-=1)}}let ir=new jc;class _t{static create(){return new _t}static request(t){return ir.request(t)}static cancel(t){return ir.cancel(t)}currentId=or;request(t){this.cancel(),this.currentId=ir.request(()=>{this.currentId=or,t()})}cancel=()=>{this.currentId!==or&&(ir.cancel(this.currentId),this.currentId=or)};disposeEffect=()=>this.cancel}function Vn(){const e=ft(_t.create).current;return Ss(e.disposeEffect),e}const An=0;class rn{static create(){return new rn}currentId=An;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=An,n()},t)}isStarted(){return this.currentId!==An}clear=()=>{this.currentId!==An&&(clearTimeout(this.currentId),this.currentId=An)};disposeEffect=()=>this.clear}function $n(){const e=ft(rn.create).current;return Ss(e.disposeEffect),e}function Lc(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:Fc,platform:Dc,maxTouchPoints:Nc}=Lc(),Ir=Fc.toLowerCase(),Bn=Dc.toLowerCase(),Rr=/^i(os$|p)/.test(Bn)||Bn==="macintel"&&Nc>1,wi="android",gr=Bn===wi||Ir.includes(wi),Vc=!Rr&&Bn.startsWith("mac");Bn.startsWith("win");const $c=Vc||Rr,an=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),Si=!an&&Ir.includes("firefox");!an&&Ir.includes("chrom");const Bc=$c,Hc=/jsdom|happydom/.test(Ir);function it(e){e.preventDefault(),e.stopPropagation()}function Uc(e){return"nativeEvent"in e}function vo(e){return e.pointerType===""&&e.isTrusted?!0:gr&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Co(e){return Hc?!1:!gr&&e.width===0&&e.height===0||gr&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function qr(e,t){return["mouse","pen"].includes(e)}function qc(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function ht(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function ge(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Er(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function gt(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const ro="data-base-ui-focusable",Kc="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",tn="ArrowLeft",nn="ArrowRight",wo="ArrowUp",Pr="ArrowDown",Es="data-starting-style",Wc="data-ending-style",zc={[Es]:""},Yc={[Wc]:""},Gc={transitionStatus(e){return e==="starting"?zc:e==="ending"?Yc:null}},Xc="data-open",Qc="data-closed",Zc="data-anchor-hidden",Jc="data-popup-open",eu="data-pressed",tu={[Jc]:"",[eu]:""},nu={[Xc]:""},ru={[Qc]:""},ou={[Zc]:""},iu={open(e){return e?tu:null}},So={open(e){return e?nu:ru},anchorHidden(e){return e?ou:null}};({...So});function Kr(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function su(e){return e.matches("html,body")}function Eo(e){return tt(e)&&e.matches(Kc)}function oo(e){return e?e.getAttribute("role")==="combobox"&&Eo(e):!1}function io(e){return e?e.hasAttribute(ro)?e:e.querySelector(`[${ro}]`)||e:null}const At="none",ks="trigger-press",au="trigger-hover",ko="outside-press",Ei="item-press",lu="close-press",Fn="input-change",Pt="input-clear",cu="input-press",Ar="focus-out",Io="escape-key",ki="list-navigation",Is="keyboard",Rs="pointer";function ke(e,t,n,r){let o=!1,i=!1;const s=r??dt;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){i=!0},get isCanceled(){return o},get isPropagationAllowed(){return i},trigger:n,...s}}function uu(e,t,n){const r=n??dt;return{reason:e,event:t??new Event("base-ui"),...r}}const yr=u.forwardRef(function(t,n){const[r,o]=u.useState();Z(()=>{Bc&&an&&o("button")},[]);const i={tabIndex:0,role:r};return d.jsx("span",{...t,ref:n,style:xs,"aria-hidden":r?void 0:!0,...i,"data-base-ui-focus-guard":""})});function sr(e,t,n){return Math.floor(e/t)!==n}function Hn(e,t){return t<0||t>=e.length}function Wr(e,t){return lt(e.current,{disabledIndices:t})}function Ii(e,t){return lt(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function lt(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let i=t;do i+=n?-o:o;while(i>=0&&i<=e.length-1&&so(e,i,r));return i}function du(e,{event:t,orientation:n,loopFocus:r,onLoop:o,rtl:i,cols:s,disabledIndices:a,minIndex:f,maxIndex:l,prevIndex:c,stopEvent:m=!1}){let g=c,w;if(t.key===wo?w="up":t.key===Pr&&(w="down"),w){const S=[],v=[];let y=!1,x=0;{let A=null,M=-1;e.forEach((T,V)=>{if(T==null)return;x+=1;const _=T.closest('[role="row"]');_&&(y=!0),(_!==A||M===-1)&&(A=_,M+=1,S[M]=[]),S[M].push(V),v[V]=M})}let p=!1,h=0;if(y)for(const A of S){const M=A.length;M>h&&(h=M),M!==s&&(p=!0)}const C=p&&x<e.length,b=h||s,O=A=>{if(!p||c===-1)return;const M=v[c];if(M==null)return;const T=S[M].indexOf(c),V=A==="up"?-1:1;for(let _=M+V,$=0;$<S.length;$+=1,_+=V){if(_<0||_>=S.length){if(!r||C)return;if(_=_<0?S.length-1:0,o){const ee=Math.min(T,S[_].length-1),J=S[_][ee]??S[_][0],U=o(t,c,J);_=v[U]??_}}const Q=S[_];for(let ee=Math.min(T,Q.length-1);ee>=0;ee-=1){const J=Q[ee];if(!so(e,J,a))return J}}},I=A=>{if(!C||c===-1)return;const M=c%b,T=A==="up"?-b:b,V=l-l%b,_=Vr(l/b)+1;for(let $=c-M+T,Q=0;Q<_;Q+=1,$+=T){if($<0||$>l){if(!r)return;$=$<0?V:0}const ee=Math.min($+b-1,l);for(let J=Math.min($+M,ee);J>=$;J-=1)if(!so(e,J,a))return J}};
1m&&it(t);const k=O(w)??I(w);if(k!==void 0)g=k;else if(c===-1)g=w==="up"?l:f;else if(g=lt(e,{startingIndex:c,amount:b,decrement:w==="up",disabledIndices:a}),r){if(w==="up"&&(c-b<f||g<0)){const A=c%b,M=l%b,T=l-(M-A);M===A?g=l:g=M>A?T:T-b,o&&(g=o(t,c,g))}w==="down"&&c+b>l&&(g=lt(e,{startingIndex:c%b-b,amount:b,disabledIndices:a}),o&&(g=o(t,c,g)))}Hn(e,g)&&(g=c)}if(n==="both"){const S=Vr(c/s);t.key===(i?tn:nn)&&(m&&it(t),c%s!==s-1?(g=lt(e,{startingIndex:c,disabledIndices:a}),r&&sr(g,s,S)&&(g=lt(e,{startingIndex:c-c%s-1,disabledIndices:a}),o&&(g=o(t,c,g)))):r&&(g=lt(e,{startingIndex:c-c%s-1,disabledIndices:a}),o&&(g=o(t,c,g))),sr(g,s,S)&&(g=c)),t.key===(i?nn:tn)&&(m&&it(t),c%s!==0?(g=lt(e,{startingIndex:c,decrement:!0,disabledIndices:a}),r&&sr(g,s,S)&&(g=lt(e,{startingIndex:c+(s-c%s),decrement:!0,disabledIndices:a}),o&&(g=o(t,c,g)))):r&&(g=lt(e,{startingIndex:c+(s-c%s),decrement:!0,disabledIndices:a}),o&&(g=o(t,c,g))),sr(g,s,S)&&(g=c));const v=Vr(l/s)===S;Hn(e,g)&&(r&&v?(g=t.key===(i?nn:tn)?l:lt(e,{startingIndex:c-c%s-1,disabledIndices:a}),o&&(g=o(t,c,g))):g=c)}return g}function so(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const o=e[t];return o?!Ro(o)||o.matches(":disabled")?!0:!n&&(o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true"):!1}function fu(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Ro(e,t=e?kr(e):null){return!e||!e.isConnected||!t||fu(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const pu='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function mu(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return Er(n)?n.host:null}function ao(e){for(const t of Array.from(e.children))if(vt(t)==="summary")return t;return null}function hu(e,t){const n=ao(t);return!!n&&(e===n||ge(n,e))}function Ps(e){const t=e?vt(e):"";return e!=null&&e.matches(pu)&&(t!=="summary"||e.parentElement!=null&&vt(e.parentElement)==="details"&&ao(e.parentElement)===e)&&(t!=="details"||ao(e)==null)&&(t!=="input"||e.type!=="hidden")}function As(e){if(!Ps(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=mu(t)){const n=t!==e,r=vt(t)==="slot";if(t.hasAttribute("inert")||n&&vt(t)==="details"&&!t.open&&!hu(e,t)||t.hasAttribute("hidden")||!r&&!gu(t,n))return!1}return!0}function gu(e,t){const n=kr(e);return t?n.display!=="none":Ro(e,n)}function _s(e){const t=e.tabIndex;if(t<0){const n=vt(e);if(n==="details"||n==="audio"||n==="video"||tt(e)&&e.isContentEditable)return 0}return t}function zr(e){if(vt(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function yu(e,t){const n=zr(e);if(!n)return!0;const r=t.find(o=>{const i=zr(o);return i?.name===n.name&&i.form===n.form&&i.checked});return r?r===n:t.find(o=>{const i=zr(o);return i?.name===n.name&&i.form===n.form})===n}function Ts(e){if(tt(e)&&vt(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return tt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Ms(e,t){Ts(e).forEach(n=>{Ps(n)&&t.push(n),Ms(n,t)})}function Os(e,t,n){Ts(e).forEach(r=>{tt(r)&&r.matches(t)&&n.push(r),Os(r,t,n)})}function Po(e){return As(e)&&_s(e)>=0}function js(e){const t=[];return Ms(e,t),t.filter(As)}function _r(e){const t=js(e);return t.filter(n=>_s(n)>=0&&yu(n,t))}function Ls(e,t){const n=_r(e),r=n.length;if(r===0)return;const o=ht(Fe(e)),i=n.indexOf(o),s=i===-1?t===1?0:r-1:i+t;return n[s]}function Fs(e){return Ls(Fe(e).body,1)||e}function Ds(e){return Ls(Fe(e).body,-1)||e}function Dn(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!ge(n,r)}function bu(e){_r(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Ri(e){const t=[];Os(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Un(e,t,n=!0){return e.filter(o=>o.parentId===t).flatMap(o=>[...!n||o.context?.open?[o]:[],...Un(e,o.id,n)])}function Pi(e,t){let n=[],r=e.find(o=>o.id===t)?.parentId;for(;r;){const o=e.find(i=>i.id===r);r=o?.parentId,o&&(n=n.concat(o))}return n}function br(e){return`data-base-ui-${e}`}let ar=0;function fr(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:o}=t;cancelAnimationFrame(ar);function i(){o&&!o()||e?.focus({preventScroll:n})}if(r)return i(),_e;const s=requestAnimationFrame(i);return ar=s,()=>{ar===s&&(cancelAnimationFrame(s),ar=0)}}const Yr={inert:new WeakMap,"aria-hidden":new WeakMap},Ai="data-base-ui-inert",lo={inert:new WeakSet,"aria-hidden":new WeakSet};let _n=new WeakMap,Gr=0;function xu(e){return lo[e]}function Ns(e){return e?Er(e)?e.host:Ns(e.parentNode):null}const _i=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=Ns(n);return e.contains(r)?r:null}).filter(n=>n!=null),Ti=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},Mi=(e,t,n)=>{const r=[],o=i=>
1{!i||n.has(i)||Array.from(i.children).forEach(s=>{vt(s)!=="script"&&(t.has(s)?o(s):r.push(s))})};return o(e),r};function vu(e,t,n,r,{mark:o=!0}){let i=null;r?i="inert":n&&(i="aria-hidden");let s=null,a=null;const f=_i(t,e),l=o?Mi(t,Ti(f),new Set(f)):[],c=[],m=[];if(i){const g=Yr[i],w=xu(i);a=w,s=g;const S=_i(t,Array.from(t.querySelectorAll("[aria-live]"))),v=f.concat(S);Mi(t,Ti(v),new Set(v)).forEach(x=>{const p=x.getAttribute(i),h=p!==null&&p!=="false",C=(g.get(x)||0)+1;g.set(x,C),c.push(x),C===1&&h&&w.add(x),h||x.setAttribute(i,i==="inert"?"":"true")})}return o&&l.forEach(g=>{const w=(_n.get(g)||0)+1;_n.set(g,w),m.push(g),w===1&&g.setAttribute(Ai,"")}),Gr+=1,()=>{s&&c.forEach(g=>{const S=(s.get(g)||0)-1;s.set(g,S),S||(!a?.has(g)&&i&&g.removeAttribute(i),a?.delete(g))}),o&&m.forEach(g=>{const w=(_n.get(g)||0)-1;_n.set(g,w),w||g.removeAttribute(Ai)}),Gr-=1,Gr||(Yr.inert=new WeakMap,Yr["aria-hidden"]=new WeakMap,lo.inert=new WeakSet,lo["aria-hidden"]=new WeakSet,_n=new WeakMap)}}function Oi(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:o=!0}=t,i=Fe(e[0]).body;return vu(e,i,n,r,{mark:o})}let ji=0;function Cu(e,t="mui"){const[n,r]=u.useState(e),o=e||n;return u.useEffect(()=>{n==null&&(ji+=1,r(`${t}-${ji}`))},[n,t]),o}const Li=bo.useId;function Ao(e,t){if(Li!==void 0){const n=Li();return e??(t?`${t}-${n}`:n)}return Cu(e,t)}function Fi(e){if(!u.isValidElement(e))return null;const t=e,n=t.props;return(xo(19)?n?.ref:t.ref)??null}function co(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function wu(e,t){const n={};for(const r in e){const o=e[r];if(t?.hasOwnProperty(r)){const i=t[r](o);i!=null&&Object.assign(n,i);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function Su(e,t){return typeof e=="function"?e(t):e}function Eu(e,t){return typeof e=="function"?e(t):e}const _o={};function mn(e,t,n,r,o){if(!n&&!r&&!o&&!e)return xr(t);let i=xr(e);return t&&(i=Ln(i,t)),n&&(i=Ln(i,n)),r&&(i=Ln(i,r)),o&&(i=Ln(i,o)),i}function ku(e){if(e.length===0)return _o;if(e.length===1)return xr(e[0]);let t=xr(e[0]);for(let n=1;n<e.length;n+=1)t=Ln(t,e[n]);return t}function xr(e){return To(e)?{...$s(e,_o)}:Iu(e)}function Ln(e,t){return To(t)?$s(t,e):Ru(e,t)}function Iu(e){const t={...e};for(const n in t){const r=t[n];Vs(n,r)&&(t[n]=Bs(r))}return t}function Ru(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=co(e.style,r);break}case"className":{e[n]=Hs(e.className,r);break}default:Vs(n,r)?e[n]=Pu(e[n],r):e[n]=r}}return e}function Vs(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function To(e){return typeof e=="function"}function $s(e,t){return To(e)?e(t):e??_o}function Pu(e,t){return t?e?(...n)=>{const r=n[0];if(Us(r)){const i=r;vr(i);const s=t(...n);return i.baseUIHandlerPrevented||e?.(...n),s}const o=t(...n);return e?.(...n),o}:Bs(t):e}function Bs(e){return e&&((...t)=>{const n=t[0];return Us(n)&&vr(n),e(...t)})}function vr(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Hs(e,t){return t?e?t+" "+e:t:e}function Us(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Cn(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=Mu(r));const o=Au(t,n,r);if(n.enabled===!1)return null;const i=n.state??dt;return Ou(e,r,o,i)}function Au(e,t,n){const{className:r,style:o}=e,{state:i=dt,ref:s,props:a,stateAttributesMapping:f,enabled:l=!0}=t,c=l?Su(r,i):void 0,m=l?Eu(o,i):void 0,g=l?wu(i,f):dt,w=l&&a?_u(a):void 0,S=l?co(g,w)??{}:dt;return typeof document<"u"&&(l?Array.isArray(s)?S.ref=wc([S.ref,Fi(n),...s]):S.ref=yn(S.ref,Fi(n),s):yn(null,null)),l?(c!==void 0&&(S.className=Hs(S.className,c)),m!==void 0&&(S.style=co(S.style,m)),S):dt}function _u(e){return Array.isArray(e)?ku(e):mn(void 0,e)}const Tu=Symbol.for("react.lazy");function Mu(e){if(e?.$$typeof!==Tu)return e;const t=u.Children.toArray(e)[0];return u.isValidElement(t)?t:e}function Ou(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const o=mn(n,t.props);return o.ref=n.ref,u.cloneElement(t,o)}if(e&&typeof e=="string")return ju(e,n);throw new Error(Vt(8))}function ju(e,t){return e==="button"?u.createElement("button",{type:"button",...t,key:t.key}):e==="img"?u.createElement("img",{alt:"",...t,key:t.key}):u.createElement(e,t)}const Lu={style:{transition:"none"}},Fu="data-base-ui-click-trigger",Du={fallbackAxisSide:"none"},Nu={clipPath:"inset(50%)",position:"fixed",top:0,left:0},qs=u.createContext(null),Ks=()=>u.useContext(qs),Vu=br("portal");function $u(e={}){const{ref:t,container:n,componentProps:r=dt,elementProps:o}=e,i=Ao(),a=Ks()?.portalNode,[f,l]=u.useState(null),[c,m]=u.useState(null),g=Y(y=>{y!==null&&m(y)}),w=u.useRef(null);Z(()=>
1{if(n===null){w.current&&(w.current=null,m(null),l(null));return}const y=(n&&(Vl(n)?n:n.current))??a??document.body;if(y==null){w.current&&(w.current=null,m(null),l(null));return}w.current!==y&&(w.current=y,m(null),l(y))},[n,a]);const S=Cn("div",r,{ref:[t,g],props:[{id:i,[Vu]:""},o]}),v=f&&S?Wn.createPortal(S,f):null;return{node:c,nodeId:u.isValidElement(S)?S.props.id:void 0,subtree:v}}const Bu=u.forwardRef(function(t,n){const{render:r,className:o,style:i,children:s,container:a,portalOwnerRole:f,...l}=t,{node:c,nodeId:m,subtree:g}=$u({container:a,ref:n,componentProps:t,elementProps:l}),w=u.useRef(null),S=u.useRef(null),v=u.useRef(null),y=u.useRef(null),[x,p]=u.useState(null),h=u.useRef(!1),C=x?.modal,b=x?.open,O=!!x&&!x.modal&&x.open&&!!c;u.useEffect(()=>{if(!c||C)return;function k(A){c&&A.relatedTarget&&Dn(A)&&(A.type==="focusin"?h.current&&(Ri(c),h.current=!1):(bu(c),h.current=!0))}return pn(Ae(c,"focusin",k,!0),Ae(c,"focusout",k,!0))},[c,C]),Z(()=>{!c||b!==!0||!h.current||(Ri(c),h.current=!1)},[b,c]);const I=u.useMemo(()=>({beforeOutsideRef:w,afterOutsideRef:S,beforeInsideRef:v,afterInsideRef:y,portalNode:c,setFocusManagerState:p}),[c]);return d.jsxs(u.Fragment,{children:[g,d.jsxs(qs.Provider,{value:I,children:[O&&c&&d.jsx(yr,{"data-type":"outside",ref:w,onFocus:k=>{if(Dn(k,c))v.current?.focus();else{const A=x?x.domReference:null;Ds(A)?.focus()}}}),O&&c&&d.jsx("span",{role:f,"aria-owns":m,style:Nu}),c&&Wn.createPortal(s,c),O&&c&&d.jsx(yr,{"data-type":"outside",ref:S,onFocus:k=>{if(Dn(k,c))y.current?.focus();else{const A=x?x.domReference:null;Fs(A)?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,ke(Ar,k.nativeEvent))}}})]})]})});function Hu(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}const Uu=u.createContext(null),qu=u.createContext(null),Ws=()=>u.useContext(Uu)?.id||null,Tr=e=>{const t=u.useContext(qu);return e??t};function Ft(e){return e==null?e:"current"in e?e.current:e}function Ku(e,t){const n=vn(gt(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Di=20;let qt=[];function Mo(){qt=qt.filter(e=>e.deref()?.isConnected)}function Ni(e){Mo(),e&&vt(e)!=="body"&&(qt.push(new WeakRef(e)),qt.length>Di&&(qt=qt.slice(-Di)))}function Vi(){return Mo(),qt[qt.length-1]?.deref()}function Wu(e){return e?Po(e)?e:_r(e)[0]||e:null}function $i(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=js(e).filter(o=>{const i=o.getAttribute("data-tabindex")||"";return Po(o)||o.hasAttribute("data-tabindex")&&!i.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function zu(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:i=!0,restoreFocus:s=!1,modal:a=!0,closeOnFocusOut:f=!0,openInteractionType:l="",nextFocusableElement:c,previousFocusableElement:m,beforeContentFocusGuardRef:g,externalTree:w,getInsideElements:S}=e,v="rootStore"in t?t.rootStore:t,y=v.useState("open"),x=v.useState("domReferenceElement"),p=v.useState("floatingElement"),{events:h,dataRef:C}=v.context,b=Y(()=>C.current.floatingContext?.nodeId),O=o===!1,I=oo(x)&&O,k=ut(o),A=ut(i),M=ut(l),T=ut(y),V=Tr(w),_=Ks(),$=u.useRef(!1),Q=u.useRef(!1),ee=u.useRef(!1),J=u.useRef(null),U=u.useRef(""),ae=u.useRef(""),ve=u.useRef(null),le=u.useRef(null),Be=yn(ve,g,_?.beforeInsideRef),se=yn(le,_?.afterInsideRef),L=$n(),oe=$n(),Ce=Vn(),nt=_!=null,ie=io(p),Re=Y((te=ie)=>te?_r(te):[]),Ie=Y(()=>S?.().filter(te=>te!=null)??[]);u.useEffect(()=>{if(r||!a)return;function te(Ee){Ee.key==="Tab"&&ge(ie,ht(Fe(ie)))&&Re().length===0&&!I&&it(Ee)}const ce=Fe(ie);return Ae(ce,"keydown",te)},[r,ie,a,I,Re]),u.useEffect(()=>{if(r||!y)return;const te=Fe(ie);function ce(){ee.current=!1}function Ee(Te){const B=gt(Te),G=Ie(),K=ge(p,B)||ge(x,B)||ge(_?.portalNode,B)||G.some(fe=>fe===B||ge(fe,B));
1ee.current=!K,ae.current=Te.pointerType||"keyboard",B?.closest(`[${Fu}]`)&&(Q.current=!0,oe.start(0,()=>{Q.current=!1}))}function pe(){ae.current="keyboard"}return pn(Ae(te,"pointerdown",Ee,!0),Ae(te,"pointerup",ce,!0),Ae(te,"pointercancel",ce,!0),Ae(te,"keydown",pe,!0),ce)},[r,p,x,ie,y,_,oe,Ie]),u.useEffect(()=>{if(r||!f)return;const te=Fe(ie);function ce(){Q.current=!0,oe.start(0,()=>{Q.current=!1})}function Ee(G){const K=gt(G);Po(K)&&(J.current=K)}function pe(G){const K=G.relatedTarget,fe=G.currentTarget,ye=gt(G);a&&K==null&&ye!=null&&ge(p,ye)&&Ni(ye),queueMicrotask(()=>{const we=b(),F=v.context.triggerElements,R=Ie(),D=K?.hasAttribute(br("focus-guard"))&&[ve.current,le.current,_?.beforeInsideRef.current,_?.afterInsideRef.current,_?.beforeOutsideRef.current,_?.afterOutsideRef.current,Ft(m),Ft(c)].includes(K),P=!(ge(x,K)||ge(p,K)||ge(K,p)||ge(_?.portalNode,K)||R.some(E=>E===K||ge(E,K))||F.hasMatchingElement(E=>ge(E,K))||D||V&&(Un(V.nodesRef.current,we).find(E=>ge(E.context?.elements.floating,K)||ge(E.context?.elements.domReference,K))||Pi(V.nodesRef.current,we).find(E=>[E.context?.elements.floating,io(E.context?.elements.floating)].includes(K)||E.context?.elements.domReference===K)));if(fe===x&&ie&&$i(ie),s&&fe!==x&&!Ro(ye)&&ht(te)===te.body){if(tt(ie)&&(ie.focus(),s==="popup")){Ce.request(()=>{ie.focus()});return}const E=Re(),q=J.current,ne=(q&&E.includes(q)?q:null)||E[E.length-1]||ie;tt(ne)&&ne.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(I||!a)&&K&&P&&!Q.current&&(I||K!==Vi())&&($.current=!0,v.setOpen(!1,ke(Ar,G)))})}function Te(){ee.current||(C.current.insideReactTree=!0,L.start(0,()=>{C.current.insideReactTree=!1}))}const B=tt(x)?x:null;if(!(!p&&!B))return pn(B&&Ae(B,"focusout",pe),B&&Ae(B,"pointerdown",ce),p&&Ae(p,"focusin",Ee),p&&Ae(p,"focusout",pe),p&&_&&Ae(p,"focusout",Te,!0))},[r,x,p,ie,a,V,_,v,f,s,Re,I,b,C,L,oe,Ce,c,m,Ie]),u.useEffect(()=>{if(r||!p||!y)return;const te=Array.from(_?.portalNode?.querySelectorAll(`[${br("portal")}]`)||[]),Ee=(V?Pi(V.nodesRef.current,b()):[]).find(fe=>oo(fe.context?.elements.domReference||null))?.context?.elements.domReference,Te=[...[p,...te,ve.current,le.current,_?.beforeOutsideRef.current,_?.afterOutsideRef.current,...Ie()],Ee,Ft(m),Ft(c),I?x:null].filter(fe=>fe!=null),B=Oi(Te,{ariaHidden:a||I,mark:!1}),G=[p,...te].filter(fe=>fe!=null),K=Oi(G);return()=>{K(),B()}},[y,r,x,p,a,_,I,V,b,c,m,Ie]),Z(()=>
1{if(!y||r||!tt(ie))return;U.current="",ae.current="";const te=Fe(ie),ce=ht(te);queueMicrotask(()=>{const Ee=k.current,pe=typeof Ee=="function"?Ee(M.current||""):Ee;if(pe===void 0||pe===!1||ge(ie,ce))return;let B=null;const G=()=>(B==null&&(B=Re(ie)),B[0]||ie);let K;pe===!0||pe===null?K=G():K=Ft(pe),K=K||G();const fe=ge(ie,ht(te));fr(K,{preventScroll:K===ie,shouldFocus(){if(!T.current)return!1;if(fe)return!0;const ye=ht(te);return!(ye!==K&&ge(ie,ye))}})})},[r,y,ie,Re,k,M,T]),Z(()=>{if(r||!ie)return;const te=Fe(ie),ce=ht(te),Ee=M.current==null;Ni(ce);function pe(B){if(B.open||(U.current=Ku(B.nativeEvent,ae.current)),B.reason===au&&B.nativeEvent.type==="mouseleave"&&($.current=!0),B.reason===ko)if(B.nested)$.current=!1;else if(vo(B.nativeEvent)||Co(B.nativeEvent))$.current=!1;else{let G=!1;Fe(ie).createElement("div").focus({get preventScroll(){return G=!0,!1}}),G?$.current=!1:$.current=!0}}h.on("openchange",pe);function Te(B){const G=A.current;let K=typeof G=="function"?G(B):G;if(K===void 0||K===!1)return null;K===null&&(K=!0);const fe=x?.isConnected?x:null,ye=ce?.isConnected&&vt(ce)!=="body"?ce:null;let we=Ee?ye||fe:fe||ye;return we||(we=Vi()||null),typeof K=="boolean"?we:Ft(K)||we||null}return()=>{h.off("openchange",pe);const B=ht(te),G=Ie(),K=ge(p,B)||G.some(F=>F===B||ge(F,B))||V&&Un(V.nodesRef.current,b(),!1).some(F=>ge(F.context?.elements.floating,B)),fe=A.current,ye=U.current,we=Te(ye);queueMicrotask(()=>{const F=Wu(we),R=typeof fe!="boolean";if(fe&&!$.current&&tt(F)&&(!(!R&&F!==B&&B!==te.body)||K)){const D={preventScroll:!0};ye==="keyboard"&&(D.focusVisible=!0),F.focus(D)}$.current=!1})}},[r,p,ie,A,M,h,V,x,b,Ie]),Z(()=>
1{if(!an||y||!p)return;const te=ht(Fe(p));!tt(te)||!Eo(te)||ge(p,te)&&te.blur()},[y,p]),Z(()=>{if(!(r||!_))return _.setFocusManagerState({modal:a,closeOnFocusOut:f,open:y,onOpenChange:v.setOpen,domReference:x}),()=>{_.setFocusManagerState(null)}},[r,_,a,y,v,f,x]),Z(()=>{if(!(r||!ie))return $i(ie),()=>{queueMicrotask(Mo)}},[r,ie]);const Me=!r&&(a?!I:!0)&&(nt||a);return d.jsxs(u.Fragment,{children:[Me&&d.jsx(yr,{"data-type":"inside",ref:Be,onFocus:te=>{if(a){const ce=Re();fr(ce[ce.length-1])}else _?.portalNode&&($.current=!1,Dn(te,_.portalNode)?Fs(x)?.focus():Ft(m??_.beforeOutsideRef)?.focus())}}),n,Me&&d.jsx(yr,{"data-type":"inside",ref:se,onFocus:te=>{a?fr(Re()[0]):_?.portalNode&&(f&&($.current=!0),Dn(te,_.portalNode)?Ds(x)?.focus():Ft(c??_.afterOutsideRef)?.focus())}})]})}function Yu(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:i=!1,stickIfOpen:s=!0,touchOpenDelay:a=0,reason:f=ks}=t,l="rootStore"in e?e.rootStore:e,c=l.context.dataRef,m=u.useRef(void 0),g=Vn(),w=$n(),S=u.useMemo(()=>{function v(x,p,h,C){const b=ke(f,p,h);x&&C==="touch"&&a>0?w.start(a,()=>{l.setOpen(!0,b)}):l.setOpen(x,b)}function y(x,p,h){const C=c.current.openEvent,b=l.select("domReferenceElement")!==p;return x&&b||!x||!o?!0:C&&s?!h(C.type):!1}return{onPointerDown(x){m.current=qr(x.pointerType)&&Co(x.nativeEvent)?"virtual":x.pointerType},onMouseDown(x){const p=m.current,h=x.nativeEvent,C=l.select("open");if(x.button!==0||r==="click"||qr(p)&&i)return;const b=y(C,x.currentTarget,k=>k==="click"||k==="mousedown"),O=gt(h);if(Eo(O)){v(b,h,O,p);return}const I=x.currentTarget;g.request(()=>{v(b,h,I,p)})},onClick(x){if(r==="mousedown-only")return;const p=m.current;if(r==="mousedown"&&p){m.current=void 0;return}if(qr(p)&&i)return;const h=l.select("open"),C=y(h,x.currentTarget,b=>b==="click"||b==="mousedown"||b==="keydown"||b==="keyup");v(C,x.nativeEvent,x.currentTarget,p)},onKeyDown(){m.current=void 0}}},[c,r,i,f,l,s,o,g,w,a]);return u.useMemo(()=>n?{reference:S}:dt,[n,S])}function Gu(){return!1}function Xu(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Qu(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:o=!0,outsidePressEvent:i="sloppy",referencePress:s=Gu,bubbles:a,externalTree:f}=t,l="rootStore"in e?e.rootStore:e,c=l.useState("open"),m=l.useState("floatingElement"),{dataRef:g,events:w}=l.context,S=Tr(f),v=Y(typeof o=="function"?o:()=>!1),y=typeof o=="function"?v:o,x=y!==!1,p=Y(()=>i),{escapeKey:h,outsidePress:C}=Xu(a),b=u.useRef(!1),O=u.useRef(!1),I=u.useRef(!1),k=u.useRef(!1),A=u.useRef(!1),M=u.useRef(""),T=u.useRef(null),V=$n(),_=$n(),$=Y(()=>{_.clear(),g.current.insideReactTree=!1}),Q=Y(L=>{const oe=g.current.floatingContext?.nodeId;return(S?Un(S.nodesRef.current,oe):[]).some(nt=>nt.context?.open&&!nt.context.dataRef.current[L])}),ee=Y(L=>Kr(L,l.select("floatingElement"))||Kr(L,l.select("domReferenceElement"))),J=Y(L=>{s()&&l.setOpen(!1,ke(ks,L.nativeEvent))}),U=Y(L=>{if(!c||!n||!r||L.key!=="Escape"||A.current||!h&&Q("__escapeKeyBubbles"))return;const oe=Uc(L)?L.nativeEvent:L,Ce=ke(Io,oe);l.setOpen(!1,Ce),Ce.isCanceled||L.preventDefault(),!h&&!Ce.isPropagationAllowed&&L.stopPropagation()}),ae=Y(()=>{g.current.insideReactTree=!0,_.start(0,$)}),ve=Y(L=>{if(!c||!n||L.button!==0)return;const oe=gt(L.nativeEvent);ge(l.select("floatingElement"),oe)&&(b.current||(b.current=!0,O.current=!1))}),le=Y(L=>{!c||!n||(L.defaultPrevented||L.nativeEvent.defaultPrevented)&&b.current&&(O.current=!0)});u.useEffect(()=>{function L(oe){oe.open||(k.current=!1)}return w.on("openchange",L),()=>{w.off("openchange",L)}},[w]),u.useEffect(()=>{if(!c||!n)return c||(k.current=!1),$;g.current.__escapeKeyBubbles=h,g.current.__outsidePressBubbles=C;const L=new rn,oe=new rn,Ce=Fe(m);function nt(){L.clear(),A.current=!0}function ie(){L.start(an?5:0,()=>{A.current=!1})}function Re(){I.current=!0,oe.start(0,()=>{I.current=!1})}function Ie(){b.current=!1,O.current=!1}function Me(){const P=M.current,E=P==="pen"||!P?"mouse":P,q=p(),ne=typeof q=="function"?q():q;return typeof ne=="string"?ne:ne[E]}function te(P){const E=Me();return E==="intentional"&&P.type!=="click"||E==="sloppy"&&P.type==="click"}function ce(P){const E=g.current.floatingContext?.nodeId,q=S&&Un(S.nodesRef.current,E).some(ne=>Kr(P,ne.context?.elements.floating));return ee(P)||q}function Ee(P){if(te(P)){P.type!=="click"&&!ee(P)&&(oe.clear(),I.current=!1),$();return}if(g.current.insideReactTree){$();return}const E=gt(P),q=`[${br("inert")}]`,ne=Tt(E)?E.getRootNode():null,Pe=Array.from((Er(ne)?ne:Fe(l.select("floatingElement"))).querySelectorAll(q)),Ge=l.context.triggerElements;if(E&&(Ge.hasElement(E)||Ge.hasMatchingElement(me=>ge(me,E))))return;let De=Tt(E)?E:null;for(;De&&!$r(De);){const me=$l(De);if($r(me)||!Tt(me))break;De=me}if(!(Pe.length&&Tt(E)&&!su(E)&&!ge(E,l.select("floatingElement"))&&Pe.every(me=>!ge(De,me)))){if(tt(E)&&!("touches"in P)){const me=$r(E),wt=kr(E),jt=/auto|scroll/,yt=me||jt.test(wt.overflowX),Yt=me||jt.test(wt.overflowY),Gt=yt&&E.clientWidth>0&&E.scrollWidth>E.clientWidth,Xt=Yt&&E.clientHeight>0&&E.scrollHeight>E.clientHeight,Qt=wt.direction==="rtl",Ht=Xt&&(Qt?P.offsetX<=E.offsetWidth-E.clientWidth:P.offsetX>E.clientWidth),ue=Gt&&P.offsetY>E.clientHeight;if(Ht||ue)return}if(!ce(P)){if(Me()==="intentional"){if(P.detail!==0&&!vo(P)&&!k.current)return;if(I.current){oe.clear(),I.current=!1;return}}typeof y=="function"&&!y(P)||Q("__outsidePressBubbles")||(l.setOpen(!1,ke(ko,P)),$())}}}function pe(P){Me()!=="sloppy"||P.pointerType==="touch"||!l.select("open")||!n||ee(P)||Ee(P)}function Te(P){if(Me()!=="sloppy"||!l.select("open")||!n||ee(P))return;const E=P.touches[0];
1E&&(T.current={startTime:Date.now(),startX:E.clientX,startY:E.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},V.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function B(P,E){const q=gt(P);if(!q)return;const ne=Ae(q,P.type,()=>{E(P),ne()})}function G(P){M.current="touch",B(P,Te)}function K(P){V.clear(),P.type==="pointerdown"&&(P.button===0&&(k.current=!0),M.current=P.pointerType),!(P.type==="mousedown"&&T.current&&!T.current.dismissOnMouseDown)&&B(P,E=>{E.type==="pointerdown"?pe(E):Ee(E)})}function fe(P){if(P.type==="pointercancel"&&(k.current=!1),!b.current)return;const E=O.current;if(Ie(),Me()==="intentional"){if(P.type==="pointercancel"){E&&Re();return}if(!ce(P)){if(E){Re();return}typeof y=="function"&&!y(P)||(oe.clear(),I.current=!0,$())}}}function ye(P){if(Me()!=="sloppy"||!T.current||ee(P))return;const E=P.touches[0];if(!E)return;const q=Math.abs(E.clientX-T.current.startX),ne=Math.abs(E.clientY-T.current.startY),Pe=Math.sqrt(q*q+ne*ne);Pe>5&&(T.current.dismissOnTouchEnd=!0),Pe>10&&(Ee(P),V.clear(),T.current=null)}function we(P){B(P,ye)}function F(P){Me()!=="sloppy"||!T.current||ee(P)||(T.current.dismissOnTouchEnd&&Ee(P),V.clear(),T.current=null)}function R(P){B(P,F)}const D=pn(r&&pn(Ae(Ce,"keydown",U),Ae(Ce,"compositionstart",nt),Ae(Ce,"compositionend",ie)),x&&pn(Ae(Ce,"click",K,!0),Ae(Ce,"pointerdown",K,!0),Ae(Ce,"pointerup",fe,!0),Ae(Ce,"pointercancel",fe,!0),Ae(Ce,"mousedown",K,!0),Ae(Ce,"mouseup",fe,!0),Ae(Ce,"touchstart",G,{capture:!0,passive:!0}),Ae(Ce,"touchmove",we,{capture:!0,passive:!0}),Ae(Ce,"touchend",R,{capture:!0,passive:!0})));return()=>{D(),L.clear(),oe.clear(),Ie(),I.current=!1,$()}},[g,m,r,x,y,c,n,h,C,U,$,p,Q,ee,S,l,V]);const Be=u.useMemo(()=>({onKeyDown:U,onPointerDown:J,onClick:J}),[U,J]),se=u.useMemo(()=>({onKeyDown:U,onPointerDown:le,onMouseDown:le,onClickCapture:ae,onMouseDownCapture(L){ae(),ve(L)},onPointerDownCapture(L){ae(),ve(L)},onMouseUpCapture:ae,onTouchEndCapture:ae,onTouchMoveCapture:ae}),[U,ae,ve,le]);return u.useMemo(()=>n?{reference:Be,floating:se,trigger:Be}:{},[n,Be,se])}const Zu={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class Ju extends ws{constructor(t){const{syncOnly:n,nested:r,onOpenChange:o,triggerElements:i,...s}=t;super({...s,positionReference:s.referenceElement,domReferenceElement:s.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:Hu(),nested:r,triggerElements:i},Zu),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&qc(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function ed(e,t=!1,n=!1,r=!1){const[o,i]=u.useState(e&&t?"idle":void 0),[s,a]=u.useState(e&&!r);return e&&!s&&(a(!0),i("starting")),!e&&s&&o!=="ending"&&!n&&i("ending"),!e&&!s&&o==="ending"&&i(void 0),Z(()=>{if(!e&&s&&o!=="ending"&&n){const f=_t.request(()=>{i("ending")});return()=>{_t.cancel(f)}}},[e,s,o,n]),Z(()=>{if(!e||t)return;const f=_t.request(()=>{i(void 0)});return()=>{_t.cancel(f)}},[t,e]),Z(()=>
1{if(!e||!t)return;e&&s&&o!=="idle"&&i("starting");const f=_t.request(()=>{i("idle")});return()=>{_t.cancel(f)}},[t,e,s,o]),{mounted:s,setMounted:a,transitionStatus:o}}let lr=null;function td(e){if(!lr){const t=[];lr=t,queueMicrotask(()=>{lr=null,Wn.flushSync(()=>{for(const n of t)n()})})}lr.push(e)}function nd(e,t=!1,n=!1){const r=Vn();return Y((o,i=null)=>{r.cancel();const s=Ft(e);if(s==null)return;const a=s,f=()=>{if(!n){Wn.flushSync(o);return}td(()=>{i?.aborted||o()})};if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){o();return}function l(){Promise.all(a.getAnimations().map(c=>c.finished)).then(()=>{i?.aborted||f()},()=>{if(i?.aborted)return;if(a.getAnimations().some(m=>m.pending||m.playState!=="finished")){l();return}f()})}if(t){const c=Es;if(!a.hasAttribute(c)){r.request(l);return}const m=new MutationObserver(()=>{a.hasAttribute(c)||(m.disconnect(),l())});m.observe(a,{attributes:!0,attributeFilter:[c]}),i?.addEventListener("abort",()=>m.disconnect(),{once:!0});return}r.request(l)})}function zs(e){const{enabled:t=!0,open:n,ref:r,batch:o=!1,onComplete:i}=e,s=Y(i),a=nd(r,n,o);u.useEffect(()=>{if(!t)return;const f=new AbortController;return a(s,f.signal),()=>{f.abort()}},[t,n,s,a])}const rd={tabIndex:-1,[ro]:""};class od{constructor(){this.idMap=new Map}add(t,n){this.idMap.set(t,n)}delete(t){this.idMap.delete(t)}hasElement(t){for(const n of this.idMap.values())if(n===t)return!0;return!1}hasMatchingElement(t){for(const n of this.idMap.values())if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function id(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Ao(),i=Ws()!=null,s=ft(()=>new Ju({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new od,floatingId:o,syncOnly:!1,nested:i})).current;return Z(()=>{const a={open:t,floatingId:o};r.reference!==void 0&&(a.referenceElement=r.reference,a.domReferenceElement=Tt(r.reference)?r.reference:null),r.floating!==void 0&&(a.floatingElement=r.floating),s.update(a)},[t,o,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=i,s}function sd(e){return ad(e,e.rootContext)}function ad(e,t){const{nodeId:n,externalTree:r}=e,o=t.useState("referenceElement"),i=t.useState("floatingElement"),s=t.useState("domReferenceElement"),a=t.useState("open"),f=t.useState("floatingId"),[l,c]=u.useState(null),[m,g]=u.useState(void 0),[w,S]=u.useState(void 0),v=u.useRef(null),y=Tr(r),x=u.useMemo(()=>({reference:o,floating:i,domReference:s}),[o,i,s]),p=Bl({...e,elements:{...x,...l&&{reference:l}}}),h=Tt(m)?m:null,C=w===void 0?t.state.floatingElement:w;t.useSyncedValue("referenceElement",m??null),t.useSyncedValue("domReferenceElement",m===void 0?s:h),t.useSyncedValue("floatingElement",C);const b=u.useCallback(T=>{const V=Tt(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;c(V),p.refs.setReference(V)},[p.refs]),O=u.useCallback(T=>{(Tt(T)||T===null)&&(v.current=T,g(T)),(Tt(p.refs.reference.current)||p.refs.reference.current===null||T!==null&&!Tt(T))&&p.refs.setReference(T)},[p.refs,g]),I=u.useCallback(T=>{S(T),p.refs.setFloating(T)},[p.refs]),k=u.useMemo(()=>({...p.refs,setReference:O,setFloating:I,setPositionReference:b,domReference:v}),[p.refs,O,I,b]),A=u.useMemo(()=>({...p.elements,domReference:s}),[p.elements,s]),M=u.useMemo(()=>({...p,dataRef:t.context.dataRef,open:a,onOpenChange:t.setOpen,events:t.context.events,floatingId:f,refs:k,elements:A,nodeId:n,rootStore:t}),[p,k,A,n,t,a,f]);return Z(()=>{s&&(v.current=s)},[s]),Z(()=>{t.context.dataRef.current.floatingContext=M;const T=y?.nodesRef.current.find(V=>V.id===n);T&&(T.context=M)}),u.useMemo(()=>({...p,context:M,refs:k,elements:A,rootStore:t}),[p,k,A,M,t])}const ld="Escape";function Bi(e){return an&&e.movementX===0&&e.movementY===0}function Mr(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function cr(e,t){return Mr(t,e===wo||e===Pr,e===tn||e===nn)}function Xr(e,t,n){return Mr(t,e===Pr,n?e===tn:e===nn)||e==="Enter"||e===" "||e===""}function cd(e,t,n){return Mr(t,n?e===tn:e===nn,e===Pr)}function ud(e,t,n,r){const o=n?e===nn:e===tn,i=e===wo;return t==="both"||t==="horizontal"&&r?e===ld:Mr(t,o,i)}function dd(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:i=!0,selectedIndex:s=null,allowEscape:a=!1,loopFocus:f=!1,nested:l=!1,rtl:c=!1,virtual:m=!1,focusItemOnOpen:g="auto",focusItemOnHover:w=!0,openOnArrowKeyDown:S=!0,disabledIndices:v=void 0,orientation:y="vertical",parentOrientation:x,id:p,resetOnPointerLeave:h=!0,externalTree:C,grid:b}=t,O=b!=null,I="rootStore"in e?e.rootStore:e,k=I.useState("open"),A=I.useState("floatingElement"),M=I.use
1State("domReferenceElement"),T=I.context.dataRef,V=io(A),_=oo(M),$=ut(V),Q=Ws(),ee=Tr(C),J=u.useRef(g),U=u.useRef(s??-1),ae=u.useRef(null),ve=u.useRef(!0),le=Y(R=>{o(U.current===-1?null:U.current,R)}),Be=u.useRef(!!A),se=u.useRef(k),L=u.useRef(!1),oe=u.useRef(!1),Ce=u.useRef(null),nt=ut(v),ie=ut(k),Re=ut(s),Ie=ut(h),Me=Vn(),te=Vn(),ce=Y(()=>{function R(q){m?ee?.events.emit("virtualfocus",q):Ce.current=fr(q,{sync:L.current,preventScroll:!0})}const D=n.current[U.current],P=oe.current;D&&R(D),(L.current?q=>q():q=>Me.request(q))(()=>{const q=n.current[U.current]||D;if(!q)return;D||R(q),K&&(P||!ve.current)&&q.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Z(()=>{T.current.orientation=y},[T,y]),Z(()=>{i&&(k&&A?(U.current=s??-1,J.current&&s!=null&&(oe.current=!0,le())):Be.current&&(U.current=-1,le()))},[i,k,A,s,le]),Z(()=>{if(i){if(!k){L.current=!1;return}if(A)if(r==null){if(L.current=!1,Re.current!=null)return;if(Be.current&&(U.current=-1,ce()),(!se.current||!Be.current)&&J.current&&(ae.current!=null||J.current===!0&&ae.current==null)){let R=0;const D=()=>{n.current[0]==null?(R<2&&(R?E=>te.request(E):queueMicrotask)(D),R+=1):(U.current=ae.current==null||Xr(ae.current,y,c)||l?Wr(n):Ii(n),ae.current=null,le())};D()}}else Hn(n.current,r)||(U.current=r,ce(),oe.current=!1)}},[i,k,A,r,Re,l,n,y,c,le,ce,te]),Z(()=>
1{if(!i||A||!ee||m||!Be.current)return;const R=ee.nodesRef.current,D=R.find(q=>q.id===Q)?.context?.elements.floating,P=ht(Fe(M??D??null)),E=R.some(q=>q.context&&ge(q.context.elements.floating,P));D&&!E&&ve.current&&D.focus({preventScroll:!0})},[i,A,M,ee,Q,m]),Z(()=>{se.current=k,Be.current=!!A}),Z(()=>{k||(ae.current=null,J.current=g)},[k,g]);const Ee=r!=null,pe=Y(R=>{if(!ie.current)return;const D=n.current.indexOf(R.currentTarget);D!==-1&&(U.current!==D||r!==D)&&(U.current=D,le(R))}),Te=Y(()=>x??ee?.nodesRef.current.find(R=>R.id===Q)?.context?.dataRef?.current.orientation),B=Y(()=>Wr(n,nt.current)),G=Y(R=>{if(ve.current=!1,L.current=!0,R.which===229||!ie.current&&R.currentTarget===$.current)return;if(l&&ud(R.key,y,c,O)){cr(R.key,Te())||it(R),I.setOpen(!1,ke(ki,R.nativeEvent)),tt(M)&&(m?ee?.events.emit("virtualfocus",M):M.focus());return}const D=U.current,P=Wr(n,v),E=Ii(n,v);if(_||(R.key==="Home"&&(it(R),U.current=P,le(R)),R.key==="End"&&(it(R),U.current=E,le(R))),b!=null){const q=b(R,U.current,n,y,f,c,v,P,E);if(q!=null&&(U.current=q,le(R)),y==="both")return}if(cr(R.key,y)){if(it(R),k&&!m&&ht(R.currentTarget.ownerDocument)===R.currentTarget){U.current=Xr(R.key,y,c)?P:E,le(R);return}Xr(R.key,y,c)?f?D>=E?a&&D!==n.current.length?U.current=-1:(L.current=!1,U.current=P):U.current=lt(n.current,{startingIndex:D,disabledIndices:v}):U.current=Math.min(E,lt(n.current,{startingIndex:D,disabledIndices:v})):f?D<=P?a&&D!==-1?U.current=n.current.length:(L.current=!1,U.current=E):U.current=lt(n.current,{startingIndex:D,decrement:!0,disabledIndices:v}):U.current=Math.max(P,lt(n.current,{startingIndex:D,decrement:!0,disabledIndices:v})),Hn(n.current,U.current)&&(U.current=-1),le(R)}}),K=u.useMemo(()=>({onFocus(D){L.current=!0,pe(D)},onClick:({currentTarget:D})=>D.focus({preventScroll:!0}),onMouseMove(D){Bi(D)||(L.current=!0,oe.current=!1,w&&pe(D))},onPointerLeave(D){if(!ie.current||!ve.current||D.pointerType==="touch")return;L.current=!0;const P=D.relatedTarget;if(!(!w||n.current.includes(P))&&Ie.current&&(Ce.current?.(),Ce.current=null,U.current=-1,le(D),!m)){const E=$.current,q=ht(Fe(E));E&&ge(E,q)&&E.focus({preventScroll:!0})}}}),[pe,ie,$,w,n,le,Ie,m]),fe=u.useMemo(()=>m&&k&&Ee&&{"aria-activedescendant":`${p}-${r}`},[m,k,Ee,p,r]),ye=u.useMemo(()=>({..._?{}:fe,onKeyDown(R){if(R.key==="Tab"&&R.shiftKey&&k&&!m){const D=gt(R.nativeEvent);if(D&&!ge($.current,D))return;it(R),I.setOpen(!1,ke(Ar,R.nativeEvent)),tt(M)&&M.focus();return}G(R)},onPointerMove(R){Bi(R)||(ve.current=!0)}}),[fe,G,$,_,I,k,m,M]),we=u.useMemo(()=>{function R(E){I.setOpen(!0,ke(ki,E.nativeEvent,E.currentTarget))}function D(E){g==="auto"&&vo(E.nativeEvent)&&(J.current=!m)}function P(E){J.current=g,g==="auto"&&Co(E.nativeEvent)&&(J.current=!0)}return{onKeyDown(E){const q=I.select("open");ve.current=!1;const ne=E.key.startsWith("Arrow"),Pe=cd(E.key,Te(),c),Ge=cr(E.key,y),De=(l?Pe:Ge)||E.key==="Enter"||E.key.trim()==="";if(m&&q)return G(E);if(!(!q&&!S&&ne)){if(De){const me=cr(E.key,Te());ae.current=l&&me?null:E.key}if(l){Pe&&(it(E),q?(U.current=B(),le(E)):R(E));return}Ge&&(Re.current!=null&&(U.current=Re.current),it(E),!q&&S?R(E):G(E),q&&le(E))}},onFocus(E){I.select("open")&&!m&&(U.current=-1,le(E))},onPointerDown:P,onPointerEnter:P,onMouseDown:D,onClick:D}},[G,g,B,l,le,I,S,y,Te,c,Re,m]),F=u.useMemo(()=>({...fe,...we}),[fe,we]);return u.useMemo(()=>i?{reference:F,floating:ye,item:K,trigger:we}:{},[i,F,ye,we,K])}function fd(e,t,n,r,o,i,s,a,f,l=2){const c=du(n.current,{event:e,orientation:r,loopFocus:o,rtl:i,cols:l,disabledIndices:s,minIndex:a,maxIndex:f,prevIndex:t>f?a:t,stopEvent:!0});return Hn(n.current,c)?void 0:c}const Ys=u.createContext(void 0),Gs=u.createContext(void 0),Xs=u.createContext(void 0),Qs=u.createContext(!1),Zs=u.createContext("");function $t(){const e=u.useContext(Ys);if(!e)throw new Error(Vt(22));return e}function Oo(){const e=u.useContext(Gs);if(!e)throw new Error(Vt(23));return e}function Or(){const e=u.useContext(Xs);if(!e)throw new Error(Vt(24));return e}function pd(){return u.useContext(Zs)}function md(){return u.useContext(Qs)}function hd(e,t,n=Object.is){const{length:r}=e;if(r!==t.length)return!1;for(let o=0;o<r;o+=1)if(!n(e[o],t[o]))return!1;return!0}const jo=(e,t)=>Object.is(e,t);
1function Nt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function gd(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!hd(e,t,(r,o)=>Nt(r,o,n)):e!==t}function Cr(e,t,n){return e?e.some(r=>r===void 0?!1:Nt(t,r,n)):!1}function Lo(e,t,n){return e?e.findIndex(r=>r===void 0?!1:Nt(r,t,n)):-1}function yd(e,t){if(t!==jo)return r=>Cr(e,r,t);const n=new Set(e);return n.delete(void 0),r=>n.has(r)&&(r!==0||e.some(o=>Object.is(r,o)))}function pr(e,t,n,r){const o=r&&Array.isArray(t)?e.findIndex(yd(t,n)):Lo(e,t,n);return o===-1?null:o}function bd(e,t,n,r,o,i){return Cr(r,t,o)?i!=null&&e>i&&Cr(r,n[i],o)?i:e:e===i?pr(n,r,o,!0):i}function xd(e,t,n){return e.filter(r=>!Nt(t,r,n))}function uo(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function vd(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function Fo(e){return vd(e?.[0])}function Qr(e){return Fo(e)?e.flatMap(t=>t.items):e}function Cd(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Fo(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function hn(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return uo(e)}function Tn(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?uo(e.value):uo(e)}const wd={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{const t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{const{selectedValue:t,selectionMode:n}=e;return t==null?!1:n==="multiple"&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?Cd(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(o=>Nt(t,o,n)):Nt(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight},Sd="data-valid",Ed="data-invalid",kd={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Js={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Id={disabled:!1,...Js},Rd={valid(e){return e===null?null:e?{[Sd]:""}:{[Ed]:""}}},ea={invalid:void 0,name:void 0,validityData:{state:kd,errors:[],error:"",value:"",initialValue:null},setValidityData:_e,disabled:void 0,setTouched:_e,setDirty:_e,setFilled:_e,setFocused:_e,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:Id,registerFieldControl:_e,validation:{getValidationProps:(e,t=dt)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:_e,getInputControl:()=>null,commit:async()=>{},change:_e}},ta=u.createContext(ea);function Do(e=!0){const t=u.useContext(ta);if(t.setValidityData===_e&&!e)throw new Error(Vt(28));return t}function Pd(e,t,n,r,o=!0,i){const{registerFieldControl:s}=Do(),a=ft(()=>Symbol());Z(()=>{const f=a.current;if(!o){s(f,void 0);return}s(f,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,o,r,t,i,s,a,n]),Z(()=>{const f=a.current;return()=>{s(f,void 0)}},[s,a])}const Ad=u.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:_e,validationMode:"onSubmit",submitCountRef:{current:0}});function _d(){return u.useContext(Ad)}function na(e){return Ao(e,"base-ui")}const Td=u.createContext({controlId:void 0,registerControlId:_e,resetControlId:_e,labelId:void 0,setLabelId:_e,messageIds:[],setMessageIds:_e,getDescriptionProps:e=>e});function ra(){return u.useContext(Td)}function Md(e={}){const{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:o,resetControlId:i}=ra(),s=na(),a=ft(()=>Symbol()),f=u.useRef(!1),l=u.useRef(!1),c=Y(()=>{!f.current||o===_e||(f.current=!1,o(a.current,void 0))});return Z(()=>
1{if(!n||o===_e){c();return}let m;if(t!==void 0)l.current=!0,m=t;else if(l.current)m=s;else{i();return}if(m===void 0){c();return}f.current=!0,o(a.current,m)},[t,n,o,i,s,a,c]),Z(()=>c,[c]),(n?r:void 0)??t??s}function Od(e){return e==null?void 0:`${e}-popup`}function jd(e,t){return(n,r)=>n==null?!1:e.contains(n,r,t)}function oa(e){return Array.isArray(e)?e.map(t=>oa(t)).join(","):e==null?"":String(e)}const Hi=new Map;function Ld(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${oa(e.locale)}|${JSON.stringify(t)}`,r=Hi.get(n);if(r)return r;const o=new Intl.Collator(e.locale,t),i={contains(s,a,f){if(!a)return!0;const l=hn(s,f);for(let c=0;c<=l.length-a.length;c+=1)if(o.compare(l.slice(c,c+a.length),a)===0)return!0;return!1},startsWith(s,a,f){if(!a)return!0;const l=hn(s,f);return o.compare(l.slice(0,a.length),a)===0},endsWith(s,a,f){if(!a)return!0;const l=hn(s,f),c=a.length;return l.length>=c&&o.compare(l.slice(l.length-c),a)===0}};return Hi.set(n,i),i}const Fd=Ld;function Dd(e){const t=u.useRef(""),n=u.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:u.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function en(e,t){const n=u.useRef(e),r=Y(t);Z(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Nd(e,t){const n=Y((i,s)=>{(typeof e=="function"?e():e)||t(s||(Rr?"touch":""))}),{onClick:r,onPointerDown:o}=Dd(n);return u.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Vd(e){const[t,n]=u.useState(null),r=Nd(e,n);return en(e,o=>{o&&!e&&n(null)}),u.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function $d(e,t=!1){const{overflowY:n}=kr(e);return n!=="auto"&&n!=="scroll"?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}const ia=Symbol("none"),Zr={value:ia,index:-1},Bd=u.createContext(void 0);function No(){return u.useContext(Bd)?.direction??"ltr"}function Hd(e,t,n){const r=e.get(t);if(r!==void 0||n===jo)return r;for(const[o,i]of e)if(Nt(o,t,n))return i}function Ud(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:o,onSelectedValueChange:i,defaultInputValue:s,inputValue:a,open:f,defaultOpen:l=!1,selectionMode:c,onItemHighlighted:m,name:g,form:w,disabled:S=!1,readOnly:v=!1,required:y=!1,inputRef:x,grid:p=!1,items:h,filteredItems:C,filter:b,filterQuery:O,openOnInputClick:I=!0,autoHighlight:k=!1,keepHighlight:A=!1,highlightItemOnHover:M=!0,loopFocus:T=!0,itemToStringLabel:V,itemToStringValue:_,isItemEqualToValue:$=jo,virtualized:Q=!1,inline:ee=!1,fillInputOnItemPress:J=!0,modal:U=!1,limit:ae=-1,autoComplete:ve="list",formAutoComplete:le,locale:Be,submitOnItemClick:se=!1}=e,{clearErrors:L}=_d(),{setDirty:oe,validityData:Ce,setFilled:nt,name:ie,disabled:Re,setTouched:Ie,setFocused:Me,validationMode:te,validation:ce}=Do(),Ee=No(),pe=Md({id:t}),Te=Fd({locale:Be}),B=Array.isArray(h)?null:h;if(B&&typeof B.label!="function")throw new Error(Vt(100));const G=B?B.data:h,K=B?.value,fe=K?void 0:G,ye=u.useMemo(()=>{if(!C||!K)return;const j=Qr(C),N=j.map(K);let de;return{values:N,findItem(Se,He){if(!de){de=new Map;for(let ze=0;ze<N.length;ze+=1)de.has(N[ze])||de.set(N[ze],j[ze])}return Hd(de,Se,He)}}},[C,K]),we=u.useMemo(()=>B?j=>B.label(j,$,N=>{const de=ye?.findItem(N,$);return de!=null?B.itemLabel(de):hn(N,V)}):V,[B,V,ye,$]),F=u.useMemo(()=>B?Object.assign(j=>B.itemLabel(j),{selected:j=>hn(j,we)}):V,[B,we,V]);function R(j){return hn(j,we)}const[D,P]=u.useState(!1),[E,q]=u.useState(null),ne=u.useRef(E),Pe=u.useRef([]),Ge=u.useRef([]),De=u.useRef(null),me=u.useRef(null),wt=u.useRef(null),jt=u.useRef(null),yt=u.useRef(null),Yt=u.useRef(!0),Gt=u.useRef(!1),Xt=u.useRef(null),Qt=u.useRef(null),Ht=u.useRef(null),ue=u.useRef(Zr),Ue=u.useRef(null),Ne=u.useRef([]),Ze=u.useRef(null),qe=Re||S,Ke=ie??g,Xe=c==="multiple",Je=c==="single",St=a!==void 0||s!==void 0,Oe=G!==void 0,Et=C!==void 0;let We;k==="always"?We="always":We=k?"input-change":!1;const[be,En]=Hr({controlled:o,default:Xe?r??jn:r,name:"Combobox",state:"selectedValue"}),kn=u.useMemo(()=>b===null?()=>!0:b!==void 0?b:jd(Te,F),[b,Te,F]),Yn=ft(()=>St?s??"":Je?R(be):"").current,[et,Fa]=Hr({controlled:a,default:Yn,name:"Combobox",state:"inputValue"}),[je,Da]=Hr({controlled:f,default:l,name:"Combobox",state:"open"}),Yo=Fo(G),pt=!je&&E!==null?E:String(et).trim(),Zt=Je?R(be):"",Go=Je&&!D&&pt!==""&&Zt.length===pt.length&&Te.contains(Zt,pt),ln=Go?"":O??pt,Xo=Oe&&Et&&Go&&(!B||B.hasValue(be,$)),Gn=u.useMemo(()=>G?Qr(G):jn,[G]),In=u.useMemo(()=>
1{if(C&&!Xo)return C;if(!G)return jn;if(Yo){const N=G,de=[];let Se=0;for(const He of N){if(ae>-1&&Se>=ae)break;const ze=ae>-1?ae-Se:1/0,Le=ln===""?He.items.slice(0,ze):[];if(ln!=="")for(const rt of He.items){if(Le.length>=ze)break;kn(rt,ln,F)&&Le.push(rt)}if(Le.length>0){const rt={...He,items:Le};de.push(rt),Se+=Le.length}}return de}if(ln==="")return ae>-1?Gn.slice(0,ae):Gn;const j=[];for(const N of Gn){if(ae>-1&&j.length>=ae)break;kn(N,ln,F)&&j.push(N)}return j},[C,Xo,G,Yo,ln,ae,kn,F,Gn]),at=u.useMemo(()=>{if(ye&&In===C)return ye.values;const j=Qr(In);return K?j.map(N=>K(N)):j},[In,C,ye,K]),W=ft(()=>{let j=null;return ee&&je&&Oe&&c!=="none"&&(j=pr(at,be,$,Xe)),new ws({id:pe,labelId:void 0,selectedValue:be,open:je,items:fe,selectionMode:c,name:Ke,form:w,disabled:qe,readOnly:v,required:y,grid:p,virtualized:Q,openOnInputClick:I,itemToStringLabel:we,isItemEqualToValue:$,modal:U,autoHighlight:We,submitOnItemClick:se,hasInputValue:St,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:ee,activeIndex:null,selectedIndex:j,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:dt,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:c==="none"},{onOpenChangeComplete:_e,setOpen:_e,setInputValue:_e,setSelectedValue:_e,setIndices:_e,handleSelection:_e,forceMount:_e,requestSubmit:_e,listRef:Pe,labelsRef:Ge,popupRef:De,emptyRef:yt,inputRef:me,startDismissRef:wt,endDismissRef:jt,keyboardActiveRef:Yt,chipsContainerRef:Xt,clearRef:Qt,valuesRef:Ne,pointerDownItemRef:Ze,selectionEventRef:Ht},wd)}).current,cn=c==="none"?et:be,Na=u.useMemo(()=>c==="none"?cn:Array.isArray(be)?be.map(j=>Tn(j,_)):Tn(be,_),[cn,_,c,be]),Va=Y(m),$a=Y(n),Qo=W.useState("activeIndex"),Ba=W.useState("selectedIndex"),Xn=W.useState("positionerElement"),Zo=W.useState("listElement"),Rn=W.useState("triggerElement"),Qn=W.useState("inputElement"),Ha=W.useState("inputGroupElement"),ct=W.useState("inline"),bt=W.useState("inputInsidePopup"),Ua=W.useState("inputOwnsFormValue"),Jo=Je&&!bt&&et===Zt,qa=ut(Rn),{mounted:Ka,setMounted:Wa,transitionStatus:ei}=ed(je),{openMethod:za,triggerProps:ti}=Vd(je),Ya=Y(()=>Na);Pd(bt?qa:me,pe,cn,Ya,!qe,g);const ni=Y(()=>{G?Ge.current=at.map(R):W.set("forceMounted",!0)}),un=Y((j,N,de)=>{if(N===-1){if(ue.current===Zr)return;ue.current=Zr}else ue.current={value:j,index:N};Va(j,uu(de,void 0,{index:N}))}),kt=Y(j=>{const N={};j.activeIndex!==void 0&&(N.activeIndex=j.activeIndex),j.selectedIndex!==void 0&&(N.selectedIndex=j.selectedIndex),W.update(N);const de=j.activeIndex;if(de===void 0)return;const Se=j.type||At;de===null?un(void 0,-1,Se):un(Ne.current[de],de,Se)}),It=Y((j,N)=>{if(e.onInputValueChange?.(j,N),!N.isCanceled){if(Gt.current=N.reason===Pt,N.reason===Fn){je&&E!==null&&q(null);const de=N.event,Se=de.inputType;if(de.type==="compositionend"||Se!=null&&Se!==""&&Se!=="insertReplacementText"){const ze=j.trim()!=="";ze&&P(!0),Ue.current={hasQuery:ze};const Le=W.state.listElement;if(!W.state.virtualized&&Le){const rt=De.current;for(const xt of Hl(Le.firstElementChild??Le)){if(!tt(xt)||(rt?!ge(rt,xt):xt.getAttribute("role")==="dialog"))break;if($d(xt)){xt.scrollTop=0;break}}}ze&&We&&W.state.activeIndex==null&&(je||ct)&&W.set("activeIndex",0)}}else N.reason===Pt&&j===""&&W.state.inputInsidePopup&&(Ue.current={hasQuery:!1,selection:!0}
1);Fa(j)}}),ri=Y(j=>{const N=!j&&bt&&!ct&&et!==""&&(String(et).trim()===E||et===Zt);!j&&(N||et===""||Jo)&&P(!1),q(null),N&&It("",ke(Pt))}),Pn=Y((j,N)=>{if(je!==j&&(N.reason===Io&&Oe&&at.length===0&&!yt.current&&N.allowPropagation(),e.onOpenChange?.(j,N),!N.isCanceled&&(j&&E!==null&&ri(N.reason===Fn),!j&&D&&(Je?(ct||q(pt),pt===""&&P(!1)):Xe&&(ct||q(pt),bt&&kt({activeIndex:null}),(!bt||ct)&&It("",ke(Pt,N.event,void 0,{isItemPress:N.reason===Ei})))),Da(j),!j&&bt&&(N.reason===Ar||N.reason===ko)&&(Ie(!0),Me(!1),te==="onBlur")))){const de=c==="none"?et:be;ce.commit(de)}}),Zn=Y((j,N)=>{if(i?.(j,N),N.isCanceled)return;En(j),(c==="none"&&De.current&&J||Je&&!W.state.inputInsidePopup)&&It(R(j),ke(N.reason,N.event))}),Ga=Y((j,N)=>{const de=gt(j),Se=Ht.current??j;Ht.current=null;const He=ke(Ei,Se),ze=de?.closest("a")?.getAttribute("href");if(ze){ze.startsWith("#")&&Pn(!1,He);return}if(Xe){const Le=Array.isArray(be)?be:[],rt=Cr(Le,N,$),xt=rt?xd(Le,N,$):[...Le,N];if(Zn(xt,He),He.isCanceled||!(me.current?me.current.value.trim()!=="":!1))return;if(W.state.inputInsidePopup){It("",ke(Pt,He.event,void 0,{isItemPress:!0}));const Ut=Ue.current;Ut&&!rt&&(Ut.toggledValue=N)}else Pn(!1,He)}else{if(Zn(N,He),He.isCanceled)return;Pn(!1,He)}}),Xa=Y(()=>{const j=ce.inputRef.current?.form??W.state.inputElement?.form;j&&typeof j.requestSubmit=="function"&&j.requestSubmit()}),Dr=Y(()=>{if(Wa(!1),$a?.(!1),P(!1),q(null),kt(c==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Xe&&me.current&&me.current.value!==""&&!Gt.current&&It("",ke(Pt)),Je)if(W.state.inputInsidePopup)me.current&&me.current.value!==""&&It("",ke(Pt));else{const j=R(be);me.current&&me.current.value!==j&&It(j,ke(j===""?Pt:At))}}),Qa=u.useMemo(()=>ct&&Xn?{current:Xn.closest('[role="dialog"]')}:De,[ct,Xn]);zs({enabled:!e.actionsRef,open:je,ref:Qa,onComplete(){je||Dr()}}),u.useImperativeHandle(e.actionsRef,()=>({unmount:Dr}),[Dr]),Z(function(){const N=ne.current!==null&&E===null;if(ne.current=E,je&&(!N||!Oe)||(je||(Ze.current=null),c==="none"))return;const de=Oe?at:Ne.current;kt({selectedIndex:pr(de,be,$,Xe)})},[je,E,be,c,Xe,Oe,at,$,kt]),Z(()=>{G&&(Ne.current=at,Pe.current.length=at.length)},[G,at]),Z(()=>{const j=Ue.current;if(j){const rt=je||ct||W.state.positionerElement?.hidden===!1;if(j.hasQuery)We&&rt&&W.set("activeIndex",0),Ue.current=null;else if(String(et).trim()===""&&(Ue.current=null,rt)){const xt=j.selection;We==="always"&&!xt&&W.state.selectionMode==="none"&&W.set("activeIndex",0),queueMicrotask(()=>{if(!W.state.open&&!W.state.inline||me.current&&me.current.value.trim()!=="")return;const Jt=W.state.selectedValue,Ut=W.state.selectionMode==="multiple";if(Ut&&Array.isArray(Jt)?Jt.length>0:W.state.selectionMode!=="none"&&Jt!=null){const hi=Oe||Et?at:Ne.current,gi=Lo(hi,j.toggledValue,W.state.isItemEqualToValue);W.set("activeIndex",gi!==-1?gi:pr(hi,Jt,W.state.isItemEqualToValue,Ut))}else xt?W.set("activeIndex",null):We==="always"&&W.set("activeIndex",0)})}}if(!je&&!ct)return;const de=Oe||Et?at:Ne.current,Se=W.state.activeIndex;if(Se==null){if(We==="always"&&de.length>0){W.set("activeIndex",0);return}un(void 0,-1,At);return}if(Se>=de.length){un(void 0,-1,At),W.set("activeIndex",null);return}const He=de[Se],ze=ue.current.value,Le=ze!==ia&&Nt(He,ze,W.state.isItemEqualToValue);(ue.current.index!==Se||!Le)&&un(He,Se,At)},[Qo,We,un,Et,Oe,at,ct,je,W,et]),Z(()=>
1{if(c==="none"){nt(String(et)!=="");return}nt(Xe?Array.isArray(be)&&be.length>0:be!=null)},[nt,c,et,be,Xe]),u.useEffect(()=>{Oe&&We&&at.length===0&&kt({activeIndex:null})},[Oe,We,at.length,kt]);function Za(){je&&pt!==""&&pt!==String(Yn)&&!Jo&&P(!0)}function Ja(){je&&E!==null&&ri(!1)}let oi=!1;function ii(){!oi&&et!==Zt&&(oi=!0,It(Zt,ke(At)))}function el(){c!=="none"&&(L(Ke),oe(gd(be,Ce.initialValue,$)),ce.change(be),Je&&!St&&!bt&&ii())}function si(){Je&&!St&&!bt&&!D&&ii()}function tl(){c==="none"&&(L(Ke),oe(et!==Ce.initialValue),ce.change(et))}en(pt,Za),en(je,Ja),en(be,el),en(Zt,si),en(G,si),en(et,tl);const Jn=id({open:ct?!0:je,onOpenChange:Pn,elements:{reference:bt?Rn:Qn,floating:Xn}}),ai=p?"grid":"listbox",er=je||ct,li=er?"true":"false",tr=u.useMemo(()=>{const j=Qn?.tagName==="INPUT",N=Qn==null||j,de=N||er,Se=N?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return de&&(Se.role="combobox",Se["aria-expanded"]=li,Se["aria-haspopup"]=ai,Se["aria-controls"]=er?Zo?.id:void 0,Se["aria-autocomplete"]=v?"none":ve),{reference:Se,floating:{role:"presentation"}}},[Qn,er,li,ai,Zo?.id,ve,v]),ci=Yu(Jn,{enabled:!qe&&I,event:"mousedown-only",toggle:!1,touchOpenDelay:bt?0:100,reason:cu}),nr=Qu(Jn,{enabled:!qe&&!ct,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:ct?!0:void 0,outsidePress(j){const N=gt(j);return!ge(Rn,N)&&!ge(Qt.current,N)&&!ge(Xt.current,N)&&!ge(Ha,N)}}),dn=dd(Jn,{enabled:!qe,id:pe,listRef:Pe,activeIndex:Qo,selectedIndex:Ba,virtual:!0,loopFocus:T,allowEscape:T&&!We,focusItemOnOpen:D||c==="none"&&!We?!1:"auto",focusItemOnHover:M,resetOnPointerLeave:!A,orientation:p?"horizontal":void 0,rtl:Ee==="rtl",disabledIndices:jn,grid:p?fd:void 0,onNavigate(j,N){!N&&!je||ei==="ending"||kt(N?{activeIndex:j,type:Yt.current?Is:Rs}:{activeIndex:j})}}),ui=u.useMemo(()=>mn(dn.reference,{onKeyDown(j){p&&W.state.activeIndex==null&&(j.key==="ArrowLeft"||j.key==="ArrowRight")&&j.preventBaseUIHandler()}},nr.reference,ci.reference,tr.reference),[dn.reference,nr.reference,ci.reference,tr.reference,p,W]),di=u.useMemo(()=>mn(rd,nr.floating),[nr.floating]),fi=u.useMemo(()=>mn(dn.floating,tr.floating),[dn.floating,tr.floating]),pi=u.useMemo(()=>{const j=dn.item;return j?{...j,onFocus:void 0}:dt},[dn.item]);W.useContextCallback("setOpen",Pn),W.useContextCallback("setInputValue",It),W.useContextCallback("setSelectedValue",Zn),W.useContextCallback("setIndices",kt),W.useContextCallback("handleSelection",Ga),W.useContextCallback("forceMount",ni),W.useContextCallback("requestSubmit",Xa),W.useContextCallback("onOpenChangeComplete",n),bc(()=>{W.update({inline:ee,popupProps:di,listProps:fi,inputProps:ui,triggerProps:ti,itemProps:pi})});const mi={id:pe,selectedValue:be,open:je,mounted:Ka,transitionStatus:ei,items:fe,inline:ee,popupProps:di,listProps:fi,inputProps:ui,triggerProps:ti,itemProps:pi,openMethod:za,selectionMode:c,name:Ke,form:w,disabled:qe,readOnly:v,required:y,grid:p,virtualized:Q,openOnInputClick:I,itemToStringLabel:we,modal:U,autoHighlight:We,isItemEqualToValue:$,submitOnItemClick:se,hasInputValue:St};Z(()=>{W.update({...mi,inputOwnsFormValue:c==="none"&&(ee||!W.state.inputInsidePopup)})},[W,...Object.values(mi)]);const nl=yn(x,ce.inputRef),rl=u.useMemo(()=>({query:pt,hasItems:Oe,filteredItems:In,flatFilteredValues:at}),[pt,Oe,In,at]),ol=u.useMemo(()=>Array.isArray(cn)?"":Tn(cn,_),[cn,_]),il=Xe&&Array.isArray(be)&&be.length>0,Nr=Xe||c==="none"&&Ua?void 0:Ke,sl=u.useMemo(()=>!Xe||!Array.isArray(be)||!Ke?null:be.map(j=>{const N=Tn(j,_);return d.jsx("input",{type:"hidden",form:w,name:Ke,value:N,disabled:qe},N)}),[Xe,be,w,Ke,_,qe]),al=d.jsxs(u.Fragment,{children:[e.children,d.jsx("input",{...ce.getValidationProps(qe,{onFocus(){if(bt){Rn?.focus();return}(me.current||Rn)?.focus()},onChange(j){if(j.nativeEvent.defaultPrevented||qe||v)return;const N=j.currentTarget.value,de=N.toLowerCase(),Se=ke(At,j.nativeEvent),He=()=>Ne.current.findIndex(Le=>Tn(Le,_).toLowerCase()===de||R(Le).toLowerCase()===de);function ze(){if(Xe)return;if(c==="none"){It(N,Se);return}let Le=He();Le===-1&&(Le=Ne.current.findIndex((xt,Jt)=>{const Ut=Ge.current[Jt];return Ut!=null&&Ut.toLowerCase()===de}));const rt=Le===-1?void 0:Ne.current[Le];rt!=null&&Zn?.(rt,Se)}Je&&(ni(),G&&He()===-1&&W.set("forceMounted",!0)),queueMicrotask(ze)}}),id:pe&&Nr==null?`${pe}-hidden-input`:void 0,form:w,name:Nr,autoComplete:le,disabled:qe,required:y&&!il,readOnly:v,value:ol,ref:nl,style:Nr?vs:xs,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),sl]});return d.jsx(Ys.Provider,{value:W,children:d.jsx(Gs.Provider,{value:Jn,children:d.jsx(Qs.Provider,{value:Oe,children:d.jsx(Xs.Provider,{value:rl,children:d.jsx(Zs.Provider,{value:et,children:al})})})})})}function qd(e){const{multiple:t=!1,defaultValue:n,value:r,onValueChange:o,autoComplete:i,...s}=e;return d.jsx(Ud,{...s,selectionMode:t?"multiple":"single",selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:o,formAutoComplete:i})}const Kd="data-popup-side",Wd="data-list-empty",zd={...iu,...Rd,popupSide:e=>e?{[Kd]:e}:null,listEmpty:e=>e?{[Wd]:""}:null},Yd=u.createContext(void 0);function Gd(){return u.useContext(Yd)}const sa=u.createContext(void 0);function Vo(e){const t=u.useContext(sa);if(t===void 0&&!e)throw new Error(Vt(21));return t}const Xd=u.createContext(void 0);function Qd(e=!1){const t=u.useContext(Xd);if(t===void 0&&!e)throw new Error(Vt(16));return t}function Zd(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:i}=e,s=r&&t!==!1,a=r&&t===!1;return{props:u.useMemo(()=>{const l={onKeyDown(c){n&&t&&c.key!=="Tab"&&c.preventDefault()}};return r||(l.tabIndex=o,!i&&n&&(l.tabIndex=t?o:-1)),(i&&(t||s)||!i&&n)&&(l["aria-disabled"]=n),i&&(!t||a)&&(l.disabled=n),l},[r,n,t,s,a,i,o])}}function Jr(e,t,{detail:n=0}={}){e.dispatchEvent(new(vn(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function aa(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0,composite:i}=e,s=u.useRef(null),a=Qd(!0),f=i??a!==void 0,{props:l}=Zd({focusableWhenDisabled:n,disabled:t,composite:f,tabIndex:r,isNativeButton:o}),c=u.useCallback(()=>{const w=s.current;eo(w)&&f&&t&&l.disabled===void 0&&w.disabled&&(w.disabled=!1)},[t,l.disabled,f]);Z(c,[c]);const m=u.useCallback((w={})=>{const{onClick:S,onMouseDown:v,onKeyUp:y,onKeyDown:x,onPointerDown:p,...h}=w;return mn({onClick(C){if(t){C.preventDefault();return}S?.(C)},onMouseDown(C){t||v?.(C)},onKeyDown(C){if(t||(vr(C),x?.(C),C.baseUIHandlerPrevented))return;const b=C.target===C.currentTarget,O=C.currentTarget,I=eo(O),k=!o&&Jd(O),A=b&&(o?I:!k),M=C.key==="Enter",T=C.key===" ",V=O.getAttribute("role"),_=V?.startsWith("menuitem")||V==="option"||V==="gridcell";if(b&&f&&T){if(C.defaultPrevented&&_)return;C.preventDefault(),(!o||I)&&(C.preventBaseUIHandler(),Jr(O,C));return}if(!A||o||!T&&!M){b&&k&&T&&C.preventDefault();return}C.defaultPrevented||(C.preventDefault(),M&&(C.preventBaseUIHandler(),Jr(O,C)))},onKeyUp(C){if(!t){if(vr(C),y?.(C),C.target===C.currentTarget&&o&&f&&eo(C.currentTarget)&&C.key===" "){C.preventDefault();return}
1C.baseUIHandlerPrevented||C.target===C.currentTarget&&!o&&!f&&!C.defaultPrevented&&C.key===" "&&(C.preventBaseUIHandler(),Jr(C.currentTarget,C))}},onPointerDown(C){if(t){C.preventDefault();return}p?.(C)}},o?{type:"button"}:{role:"button"},l,h)},[t,l,f,o]),g=Y(w=>{s.current=w,c()});return{getButtonProps:m,buttonRef:g}}function eo(e){return tt(e)&&e.tagName==="BUTTON"}function Jd(e){return tt(e)&&e.tagName==="A"&&!!e.href}const la=u.forwardRef(function(t,n){const r=$t(),{buttonRef:o,getButtonProps:i}=aa({native:!1}),s=yn(n,o);function a(l){r.context.setOpen(!1,ke(lu,l.nativeEvent,l.currentTarget))}const f=i({onClick:a});return d.jsx("span",{ref:s,...f,"aria-label":"Dismiss",tabIndex:void 0,style:vs})});function ef(e){const t=e.useState("mounted"),n=e.useState("popupSide"),r=e.useState("positionerElement");return t&&r?n:null}function $o(){return Or().filteredItems.length===0}function tf(e){return e==="rtl"?["ArrowRight","ArrowLeft"]:["ArrowLeft","ArrowRight"]}function nf(e,t){const n=e>=t-1?t-2:e;return n>=0?n:void 0}function ca(e,t,n){const r=e.context.listRef.current[t];r&&(e.context.selectionEventRef.current=n,r.click(),e.context.selectionEventRef.current=null)}const rf=u.forwardRef(function(t,n){const{render:r,className:o,disabled:i=!1,id:s,style:a,...f}=t,{state:l,disabled:c,setTouched:m,setFocused:g,validationMode:w,validation:S}=Do(),{labelId:v}=ra(),y=Gd(),p=!!Vo(!0),h=$t(),C=pd(),b=No(),O=h.useState("required"),I=h.useState("disabled"),k=h.useState("readOnly"),A=h.useState("name"),M=h.useState("form"),T=h.useState("selectionMode"),V=h.useState("autoHighlight"),_=h.useState("inputProps"),$=h.useState("triggerProps"),Q=h.useState("open"),ee=h.useState("mounted"),J=h.useState("selectedValue"),U=h.useState("id"),ae=h.useState("inline"),ve=h.useState("modal"),le=!!V,Be=ef(h),se=c||I||i,L=$o(),oe=p||ae,Ce=!oe||ve,nt=na(s??(oe?void 0:U)),ie=p?Js:l,[Re,Ie]=u.useState(null),Me=u.useRef(!1),te=u.useRef(null),ce=u.useRef(!1),Ee=T==="none"&&!p,pe=Y(F=>{const R=p||h.state.inline;R&&!h.state.hasInputValue&&h.context.setInputValue("",ke(At)),h.update({inputElement:F,inputInsidePopup:R,inputOwnsFormValue:Ee})}),Te=p?f:S.getValidationProps(se,f);function B(){h.context.setIndices({activeIndex:null,selectedIndex:null,type:h.context.keyboardActiveRef.current?Is:Rs})}function G(){h.context.keyboardActiveRef.current=!1}const K={...ie,open:Q,disabled:se,readOnly:k,popupSide:Be,listEmpty:L};function fe(F){if(!y)return;let R;const{highlightedChipIndex:D}=y,P=y.chipsRef.current.length,[E,q]=tf(b);return D!==void 0?(F.key===E?(F.preventDefault(),D>0?R=D-1:R=void 0):F.key===q?(F.preventDefault(),D<P-1?R=D+1:R=void 0):(F.key==="Backspace"||F.key==="Delete")&&(F.preventDefault(),R=nf(D,J.length),B()),R):(F.key===E&&(F.currentTarget.selectionStart??0)===0&&J.length>0&&(F.preventDefault(),R=P>0?P-1:void 0),R)}const ye=Cn("input",t,{state:K,ref:[n,h.context.inputRef,pe],props:[_,$,{value:Re??C,"aria-readonly":k||void 0,"aria-required":O||void 0,"aria-labelledby":v,disabled:se,readOnly:k,required:T==="none"?O:void 0,form:M,...Ee&&A&&{name:A},id:nt,onFocus(){if(g(!0),!ae||!ce.current)return;ce.current=!1;const F=te.current;F==null||!Object.hasOwn(h.context.valuesRef.current,F)||h.context.setIndices({activeIndex:F})},onBlur(){m(!0),g(!1);const F=h.state.activeIndex;if(ae&&F!==null&&V!=="always"&&(te.current=F,ce.current=!0,h.context.setIndices({activeIndex:null})),w==="onBlur"){const R=T==="none"?C:J;S.commit(R)}},onCompositionStart(F){gr||(Me.current=!0,Ie(F.currentTarget.value))},onCompositionEnd(F){Me.current=!1;const R=F.currentTarget.value;Ie(null),h.context.setInputValue(R,ke(Fn,F.nativeEvent))},onChange(F){const R=F.nativeEvent,D=R.inputType,P=!D||D==="insertReplacementText",E=Me.current||!P;function q(De){k||se||!De||!E||(h.context.setOpen(!0,ke(Fn,R)),le||B())}if(Me.current){const De=F.currentTarget.value;Ie(De),De===""&&!h.state.openOnInputClick&&!h.state.inputInsidePopup&&h.context.setOpen(!1,ke(Pt,R));const me=De.trim(),wt=le&&me!=="";q(me),Q&&h.state.activeIndex!==null&&!wt&&B();return}const ne=ke(Fn,R);if(h.context.setInputValue(F.currentTarget.value,ne),ne.isCanceled)return;const Pe=F.currentTarget.value==="",Ge=ke(Pt,R);Pe&&!h.state.inputInsidePopup&&(T==="single"&&h.context.setSelectedValue(null,Ge),h.state.openOn
1InputClick||h.context.setOpen(!1,Ge)),q(F.currentTarget.value.trim()),Q&&h.state.activeIndex!==null&&!le&&B()},onKeyDown(F){if(F.ctrlKey||F.shiftKey||F.altKey||F.metaKey)return;if(h.context.keyboardActiveRef.current=!0,se||k){k&&F.key==="Enter"&&Q&&h.state.activeIndex!==null&&it(F);return}const R=F.currentTarget,D=R.scrollWidth-R.clientWidth,P=b==="rtl";if(F.key==="Home"){it(F);const ne=Si&&P?R.value.length:0;R.setSelectionRange(ne,ne),R.scrollLeft=0;return}if(F.key==="End"){it(F);const ne=Si&&P?0:R.value.length;R.setSelectionRange(ne,ne),R.scrollLeft=P?-D:D;return}if(!ee&&F.key==="Escape"){const ne=T==="multiple"&&Array.isArray(J)?J.length===0:J===null,Pe=ke(Io,F.nativeEvent),Ge=T==="multiple"?[]:null;h.context.setInputValue("",Pe),h.context.setSelectedValue(Ge,Pe),!ne&&!h.state.inline&&!Pe.isPropagationAllowed&&F.stopPropagation();return}if(y&&F.key==="Backspace"&&R.value===""&&y.highlightedChipIndex===void 0&&Array.isArray(J)&&J.length>0){const ne=y.chipsRef.current.length,Pe=ne>0?ne-1:J.length-1,Ge=J.filter((De,me)=>me!==Pe);B(),h.context.setSelectedValue(Ge,ke(At,F.nativeEvent));return}const E=y?.highlightedChipIndex!==void 0,q=fe(F);if(y?.setHighlightedChipIndex(q),q!==void 0?y?.chipsRef.current[q]?.focus():E&&h.context.inputRef.current?.focus(),F.which!==229&&F.key==="Enter"&&Q){const ne=h.state.activeIndex,Pe=F.nativeEvent;if(ne===null){if(ae)return;h.context.setOpen(!1,ke(At,Pe));return}it(F),ca(h,ne,Pe)}},onPointerMove:G,onPointerDown:G},Te],stateAttributesMapping:zd}),we=p?d.jsx(ta.Provider,{value:ea,children:ye}):ye;return d.jsxs(u.Fragment,{children:[Q&&Ce&&d.jsx(la,{ref:h.context.startDismissRef}),we]})}),of=u.createContext(null);function sf(){return u.useContext(of)}function af(e){const{children:t}=e,{filteredItems:n}=Or(),r=sf(),o=r?r.items:n;return d.jsx(u.Fragment,{children:o.map(t)})}const ua=u.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function lf(){return u.useContext(ua)}function cf(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,i=Y(o),[,s]=u.useState(!1),a=ft(df).current,f=ft(uf).current,l=u.useRef(0),c=u.useRef(!0),m=u.useRef(null),g=u.useRef(null),w=Y(()=>{c.current||(c.current=!0,s(b=>!b))}),S=Y((b,O)=>{f.set(b,O),w()}),v=Y(b=>{f.delete(b),w()}),y=Y(b=>{const O=new Map;return n.current.length=0,r&&(r.current.length=0),b.forEach(I=>{O.set(I.element,{...I.registration.metadata??{},index:I.index}),n.current[I.index]=I.element,r&&(r.current[I.index]=I.registration.label!==void 0?I.registration.label:I.registration.textRef?.current?.textContent??I.element.textContent)}),l.current=n.current.length,O});function x(b){if(g.current?.disconnect(),g.current=null,typeof MutationObserver!="function"||b.length<2)return;const O=new MutationObserver(k=>{if(!mf(k))return;let A=null;for(const M of b)if(M.isConnected){if(A&&da(A,M)>0){O.disconnect(),w();return}A=M}});g.current=O;const I=new Set;for(let k=1;k<b.length;k+=1){const A=pf(b[k-1],b[k]);A&&I.add(A)}I.forEach(k=>O.observe(k,{childList:!0}))}const p=Y(()=>{const[b,O]=ff(f),I=y(b),k=m.current,A=!k||k.length!==b.length||b.some((M,T)=>{const V=k[T];return M.index!==V.index||M.element!==V.element||M.registration.index!==V.registration.index||M.registration.metadata!==V.registration.metadata});x(O),m.current=b,c.current=!1,A&&(a.forEach(M=>M(I)),i(I))});Z(()=>(!c.current&&m.current&&y(m.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,y]),Z(()=>{c.current&&p()}),Z(()=>()=>{g.current?.disconnect(),c.current=!0},[]);const h=Y(b=>(a.add(b),()=>{a.delete(b)})),C=u.useMemo(()=>({register:S,unregister:v,subscribeMapChange:h,nextIndexRef:l}),[S,v,h,l]);return d.jsx(ua.Provider,{value:C,children:t})}function uf(){return new Map}function df(){return new Set}function ff(e){const t=new Set,n=[],r=[];e.forEach((i,s)=>{if(!s.isConnected)return;const a=i.index,f={index:a??-1,element:s,registration:i};a===null?r.push(f):a>=0&&(t.add(a),n.push(f))});let o=0;return r.sort((i,s)=>da(i.element,s.element)),r.forEach(i=>{for(;t.has(o);)o+=1;i.index=o,n.push(i),o+=1}),t.size>0&&n.sort((i,s)=>i.index-s.index),[n,r.map(i=>i.element)]}function pf(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function mf(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function da(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const hf=u.forwardRef(function(t,n){var r;const{render:o,className:i,style:s,children:a,...f}=t,l=$t(),c=Oo(),m=!!Vo(!0),{filteredItems:g,hasItems:w}=Or(),S=l.useState("selectionMode"),v=l.useState("grid"),y=l.useState("readOnly"),x=l.useState("listProps"),p=l.useState("virtualized"),h=l.useState("forceMounted"),C=S==="multiple",b=g.length===0,O=Y(_=>
1{l.set("positionerElement",_)}),I=Y(_=>{l.set("listElement",_)}),k=u.useMemo(()=>typeof a=="function"?r||(r=d.jsx(af,{children:a})):a,[a]),A={empty:b},M=c.useState("floatingId"),T=Cn("div",t,{state:A,ref:[n,I,m?null:O],props:[x,{children:k,tabIndex:-1,id:M,role:v?"grid":"listbox","aria-multiselectable":C?"true":void 0,"aria-readonly":!v&&y?!0:void 0,onKeyDown(_){if(!(l.state.disabled||l.state.readOnly)&&_.key==="Enter"){const $=l.state.activeIndex;if($==null)return;it(_),ca(l,$,_.nativeEvent)}},onKeyDownCapture(){l.context.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.context.keyboardActiveRef.current=!1}},f]});if(p)return T;const V=w&&!h?void 0:l.context.labelsRef;return d.jsx(cf,{elementsRef:l.context.listRef,labelsRef:V,children:T})}),fa=u.createContext(void 0);function gf(){const e=u.useContext(fa);if(e===void 0)throw new Error(Vt(20));return e}const yf=u.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,i=$t(),s=i.useState("mounted"),a=i.useState("forceMounted");return s||r||a?d.jsx(fa.Provider,{value:r,children:d.jsx(Bu,{ref:n,...o})}):null});function bf(e){return xo(19)?e:e?"true":void 0}const xf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:f}=t,{element:l,padding:c=0,offsetParent:m="real"}=Ul(e,t)||{};if(l==null)return{};const g=ql(c),w={x:n,y:r},S=Kl(o),v=Wl(S),y=await s.getDimensions(l),x=S==="y",p=x?"top":"left",h=x?"bottom":"right",C=x?"clientHeight":"clientWidth",b=i.reference[v]+i.reference[S]-w[S]-i.floating[v],O=w[S]-i.reference[S],I=m==="real"?await s.getOffsetParent?.(l):a.floating;let k=a.floating[C]||i.floating[v];(!k||!await s.isElement?.(I))&&(k=a.floating[C]||i.floating[v]);const A=b/2-O/2,M=k/2-y[v]/2-1,T=Math.min(g[p],M),V=Math.min(g[h],M),_=T,$=k-y[v]-V,Q=k/2-y[v]/2+A,ee=zl(_,Q,$),J=!f.arrow&&hr(o)!=null&&Q!==ee&&i.reference[v]/2-(Q<_?T:V)-y[v]/2<0,U=J?Q<_?Q-_:Q-$:0;return{[S]:w[S]+U,data:{[S]:ee,centerOffset:Q-ee-U,...J&&{alignmentOffset:U}},reset:J}}}),vf=(e,t)=>{const{name:n,fn:r}=xf(e);return{name:n,fn:r,options:[e,t]}},Cf={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,i=t===0&&n===0&&r===0&&o===0,s=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:s.top-n>=0||s.right-t>=0||s.bottom-n>=0||s.left-t>=0||i}}}},wf={sideX:"left",sideY:"top"},Sf="--available-width",Ef="--available-height",kf="--anchor-width",If="--anchor-height",Rf="--transform-origin",Ui=Sf,qi=Ef;function pa(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Ki(e,t,n){const{rects:r,placement:o}=e;return{side:pa(t,dr(o),n),align:hr(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Pf(e){return Af(e,sd)}function Af(e,t){const{anchor:n,positionMethod:r="absolute",side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,collisionBoundary:f,collisionPadding:l=5,sticky:c=!1,arrowPadding:m=5,disableAnchorTracking:g=!1,inline:w,keepMounted:S=!1,floatingRootContext:v,mounted:y,collisionAvoidance:x,shift:p,nodeId:h,adaptiveOrigin:C,lazyFlip:b=!1,externalTree:O}=e,[I,k]=u.useState(null);!y&&I!==null&&k(null);const A=x.side||"flip",M=x.align||"flip",T=x.fallbackAxisSide||"end",V=p?.crossAxis??!1,_=p?.rootBoundary,$=typeof n=="function"?n:void 0,Q=Y($),ee=$?Q:n,J=ut(n),U=ut(y),ve=No()==="rtl",le=I||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":ve?"left":"right","inline-start":ve?"right":"left"}[o],Be=s==="center"?le:`${le}-${s}`;let se=l;typeof se=="number"?se={top:se,right:se,bottom:se,left:se}:se&&(se={top:se.top||0,right:se.right||0,bottom:se.bottom||0,left:se.left||0});const L=1,oe=o==="bottom"?L:0,Ce=o==="top"?L:0,nt=o==="right"?L:0,ie=o==="left"?L:0,Re={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:se},Ie=u.useRef(null),Me=ut(i),te=ut(a),ce=typeof i!="function"?i:0,Ee=typeof a!="function"?a:0,pe=[];w&&pe.push(w),pe.push(Yl(ue=>{const Ue=Ki(ue,o,ve),Ne=typeof Me.current=="function"?Me.current(Ue):Me.current,Ze=typeof te.current=="function"?te.current(Ue):te.current;return{mainAxis:Ne,crossAxis:Ze,alignmentAxis:Ze}},[ce,Ee,ve,o]));const Te=M==="none"&&A!=="shift",B=!Te&&(c||V||A==="shift"),G=A==="none"?null:Gl({...Re,padding:{top:se.top+L+oe,right:se.right+L+ie,bottom:se.bottom+L+Ce,left:se.left+L+nt},mainAxis:!V&&A==="flip",crossAxis:M==="flip"?"alignment":!1,fallbackAxisSideDirection:T}),K=Te?null:Xl({...Re,rootBoundary:_,mainAxis:M!=="none",crossAxis:B,limiter:c||V?void 0:Ql(ue=>{if(!Ie.current)return{};const{width:Ue,height:Ne}=Ie.current.getBoundingClientRect(),Ze=xi(dr(ue.placement)),qe=Ze==="y"?Ue:Ne,Ke=Ze==="y"?se.left+se.right:se.top+se.bottom;
1return{offset:qe/2+Ke/2}})},[Re,c,V,_,se,M]);A==="shift"||M==="shift"||s==="center"?pe.push(K,G):pe.push(G,K),pe.push(Zl({...Re,apply({elements:{floating:ue},availableWidth:Ue,availableHeight:Ne,rects:Ze}){if(!U.current)return;const qe=ue.style;qe.setProperty(Ui,`${Ue}px`),qe.setProperty(qi,`${Ne}px`);const Ke=vn(ue).devicePixelRatio||1,{x:Xe,y:Je,width:St,height:Oe}=Ze.reference,Et=(Math.round((Xe+St)*Ke)-Math.round(Xe*Ke))/Ke,We=(Math.round((Je+Oe)*Ke)-Math.round(Je*Ke))/Ke;qe.setProperty(kf,`${Et}px`),qe.setProperty(If,`${We}px`)}}),vf(ue=>({element:Ie.current||Fe(ue.elements.floating).createElement("div"),padding:Ie.current?m:0,offsetParent:"floating"}),[m]),{name:"transformOrigin",fn(ue){const{elements:{floating:Ue},middlewareData:Ne,placement:Ze,platform:qe,rects:Ke,y:Xe}=ue,Je=dr(Ze),St=hr(Ze),Oe=xi(Je)==="y",Et=Ie.current,We=typeof i=="function"?i(Ki(ue,o,ve)):i;let be;if(!Et&&St&&Math.abs(Oe?Ne.shift?.x||0:Ne.shift?.y||0)<=1)be=St==="start"===(Oe&&qe.isRTL?.(Ue)===!0)?"100%":"0%";else{const kn=Oe?Ne.arrow?.x||0:Ne.arrow?.y||0,Yn=Oe?Et?.clientWidth||0:Et?.clientHeight||0;be=`${kn+Yn/2}px`}let En=Je==="top"||Je==="left"?`calc(100% + ${We}px)`:`${-We}px`;return B&&Oe&&Math.abs(Ne.shift?.y||0)>We&&(En=`${Ke.reference.y+Ke.reference.height/2-Xe}px`),Ue.style.setProperty(Rf,Oe?`${be} ${En}`:`${En} ${be}`),{}}},Cf,C),Z(()=>{!y&&v&&v.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,v]);const fe=u.useMemo(()=>({ancestorScroll:!g,elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:ye,elements:we,x:F,y:R,middlewareData:D,update:P,placement:E,context:q,isPositioned:ne,floatingStyles:Pe}=t({rootContext:v,open:S?y:void 0,placement:Be,middleware:pe,strategy:r,whileElementsMounted:S?void 0:(...ue)=>vi(...ue,fe),nodeId:h,externalTree:O}),{sideX:Ge,sideY:De}=D.adaptiveOrigin||wf,me=ne?r:"fixed",wt=u.useMemo(()=>{let ue;return ne?C?ue={position:me,[Ge]:F,[De]:R}:ue={...Pe,position:me}:ue={position:me,top:0,left:0},ue[Ui]="100vw",ue[qi]="100vh",ne||(ue.opacity=0),ue},[C,me,Ge,F,De,R,Pe,ne]),jt=u.useRef(null);Z(()=>{if(!y)return;const ue=J.current,Ue=typeof ue=="function"?ue():ue,Ze=(Wi(Ue)?Ue.current:Ue)||null||null;Ze!==jt.current&&(ye.setPositionReference(Ze),jt.current=Ze)},[y,ye,ee,J]),u.useEffect(()=>{if(!y)return;const ue=J.current;typeof ue!="function"&&Wi(ue)&&ue.current!==jt.current&&(ye.setPositionReference(ue.current),jt.current=ue.current)},[y,ye,ee,J]),u.useEffect(()=>{if(S&&y&&we.reference&&we.floating)return vi(we.reference,we.floating,P,fe)},[S,y,we,P,fe]);const yt=dr(E),Yt=pa(o,yt,ve),Gt=hr(E)||"center",Xt=!!D.hide?.referenceHidden;Z(()=>{b&&y&&ne&&yt!==le&&k(yt)},[b,y,ne,yt,le]);const Qt=u.useMemo(()=>({position:"absolute",top:D.arrow?.y,left:D.arrow?.x}),[D.arrow]),Ht=D.arrow?.centerOffset!==0;return u.useMemo(()=>({positionerStyles:wt,arrowStyles:Qt,arrowRef:Ie,arrowUncentered:Ht,side:Yt,align:Gt,physicalSide:yt,anchorHidden:Xt,refs:ye,context:q,isPositioned:ne,update:P}),[wt,Qt,Ie,Ht,Yt,Gt,yt,Xt,ye,q,ne,P])}function Wi(e){return e!=null&&"current"in e}const _f=u.forwardRef(function(t,n){const{cutout:r,...o}=t;let i;if(r){const s=r.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${s.left}px ${s.top}px,${s.left}px ${s.bottom}px,${s.right}px ${s.bottom}px,${s.right}px ${s.top}px,${s.left}px ${s.top}px)`}return d.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:i}})});function ma(e){return e==="starting"?Lu:dt}function Tf(e,t,{styles:n,transitionStatus:r,props:o,refs:i,hidden:s,inert:a=!1}){const f={...n};return a&&(f.pointerEvents="none"),Cn("div",e,{state:t,ref:i,props:[{role:"presentation",hidden:s,style:f},ma(r),o],stateAttributesMapping:So})}let zi={},Yi={},Gi="";function jr(e,t){return Jl(e)?e:t}function Xi(e,t,n){return/hidden|clip/.test(e.getComputedStyle(jr(t,n)).overflowY)}function Mf(e){if(typeof document>"u")return!1;const t=Fe(e);return vn(t).innerWidth-t.documentElement.clientWidth>0}function Of(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=Fe(e),r=n.documentElement,o=n.body,i=jr(r,o),s=i.style.overflowY,a=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",i.style.overflowY="scroll";const f=i.offsetWidth;i.style.overflowY="hidden";const l=i.offsetWidth;return i.style.overflowY=s,r.style.scrollbarGutter=a,f===l}function jf(e){const t=Fe(e),n=t.documentElement,r=t.body,o=jr(n,r),i={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,i)}}function Lf(e){const t=Fe(e),n=t.documentElement,r=t.body,o=vn(n);let i=0,s=0,a=!1;const f=_t.create();
1if(an&&(o.visualViewport?.scale??1)!==1)return()=>{};function l(){const w=o.getComputedStyle(n),S=o.getComputedStyle(r),x=(w.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";i=n.scrollTop,s=n.scrollLeft,zi={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Gi=n.style.scrollBehavior,Yi={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const p=n.scrollHeight>n.clientHeight,h=n.scrollWidth>n.clientWidth,C=w.overflowY==="scroll"||S.overflowY==="scroll",b=w.overflowX==="scroll"||S.overflowX==="scroll",O=Math.max(0,o.innerWidth-r.clientWidth),I=Math.max(0,o.innerHeight-r.clientHeight),k=parseFloat(S.marginTop)+parseFloat(S.marginBottom),A=parseFloat(S.marginLeft)+parseFloat(S.marginRight),M=jr(n,r);if(a=Of(e),a){n.style.scrollbarGutter=x,M.style.overflowY="hidden",M.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:x,overflowY:"hidden",overflowX:"hidden"}),(p||C)&&(n.style.overflowY="scroll"),(h||b)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:k||I?`calc(100dvh - ${k+I}px)`:"100dvh",width:A||O?`calc(100vw - ${A+O}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),r.scrollTop=i,r.scrollLeft=s,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function c(){Object.assign(n.style,zi),Object.assign(r.style,Yi),a||(n.scrollTop=i,n.scrollLeft=s,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Gi)}function m(){c(),f.request(l)}l();const g=Ae(o,"resize",m);return()=>{f.cancel(),c(),typeof o.removeEventListener=="function"&&g()}}class Ff{lockCount=0;restore=null;timeoutLock=rn.create();timeoutUnlock=rn.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const n=Fe(t),r=n.documentElement,o=n.body,i=vn(r);if(Xi(i,r,o)){const a=new i.MutationObserver(()=>{Xi(i,r,o)||(a.disconnect(),this.restore=null,this.lock(t))}),f={attributes:!0};a.observe(r,f),a.observe(o,f),this.restore=()=>a.disconnect();return}const s=Rr||!Mf(t);this.restore=s?jf(t):Lf(t)}}const Df=new Ff;function Nf(e=!0,t=null){Z(()=>{if(e)return Df.acquire(t)},[e,t])}const Vf=20;function $f(e,t,n,r){const[o,i]=u.useState(!1);Z(()=>{if(!e||!t||n==null){i(!1);return}const s=Fe(n).documentElement.clientWidth,a=n.offsetWidth;i(s>0&&a>0&&a>=s-Vf)},[e,t,n]),Nf(e&&(!t||o),r)}const Bf=u.forwardRef(function(t,n){const{render:r,className:o,anchor:i,positionMethod:s,side:a,align:f,sideOffset:l,alignOffset:c,collisionBoundary:m="clipping-ancestors",collisionPadding:g,arrowPadding:w,sticky:S,disableAnchorTracking:v=!1,collisionAvoidance:y=Du,style:x,...p}=t,h=$t(),C=Oo(),b=gf(),O=h.useState("modal"),I=h.useState("open"),k=h.useState("mounted"),A=h.useState("openMethod"),M=h.useState("positionerElement"),T=h.useState("triggerElement"),V=h.useState("inputElement"),_=h.useState("inputGroupElement"),$=h.useState("inputInsidePopup"),Q=h.useState("transitionStatus"),ee=$o(),U=Pf({anchor:i??($?T:_??V),floatingRootContext:C,positionMethod:s,mounted:k,side:a,sideOffset:l,align:f,alignOffset:c,arrowPadding:w,collisionBoundary:m,collisionPadding:g,sticky:S,disableAnchorTracking:v,keepMounted:b,collisionAvoidance:y,lazyFlip:!0});$f(I&&O,A==="touch",M,T);const ae={open:I,side:U.side,align:U.align,anchorHidden:U.anchorHidden,empty:ee};Z(()=>{h.set("popupSide",U.side)},[h,U.side]);const ve=Y(Be=>{h.set("positionerElement",Be)}),le=Tf(t,ae,{styles:U.positionerStyles,transitionStatus:Q,props:p,refs:[n,ve],hidden:!k,inert:!I});return d.jsxs(sa.Provider,{value:U,children:[k&&O&&d.jsx(_f,{inert:bf(!I),cutout:_??V??T}),le]})}),Hf={...So,...Gc},Uf=u.forwardRef(function(t,n){const{render:r,className:o,style:i,initialFocus:s,finalFocus:a,...f}=t,l=$t(),c=Vo(),m=Oo(),g=l.useState("mounted"),w=l.useState("open"),S=l.useState("openMethod"),v=l.useState("popupProps"),y=l.useState("transitionStatus"),x=l.useState("inputInsidePopup"),p=l.useState("inputElement"),h=l.useState("modal"),C=l.useState("id"),b=$o(),O=f.id??(x?Od(C):void 0);Z(()=>(l.set("popupId",l.context.popupRef.current?.id||O),()=>{l.set("popupId",void 0)}),[l,O]),zs({open:w,ref:l.context.popupRef,onComplete(){w&&l.context.onOpenChangeComplete(!0)}});const I={open:w,side:c.side,align:c.align,anchorHidden:c.anchorHidden,transitionStatus:y,empty:b},k=Cn("div",t,{state:I,ref:[n,l.context.popupRef],props:[v,{id:O,role:x?"dialog":"presentation",onFocus(_){const $=gt(_.nativeEvent);S!=="touch"&&(ge(l.state.listElement,$)||$===_.currentTarget)&&l.context.
1inputRef.current?.focus()}},ma(y),f],stateAttributesMapping:Hf}),M=s===void 0?x?_=>_==="touch"?l.context.popupRef.current:p:!1:s;let T;a!=null?T=a:T=x?void 0:!1;const V=!x||h;return d.jsx(zu,{context:m,disabled:!g,modal:V,openInteractionType:S,initialFocus:M,returnFocus:T,getInsideElements:()=>[l.context.startDismissRef.current,l.context.endDismissRef.current],children:d.jsxs(u.Fragment,{children:[k,V&&d.jsx(la,{ref:l.context.endDismissRef})]})})});function qf(e={}){const{guess:t,label:n,metadata:r,textRef:o,index:i}=e,{register:s,unregister:a,subscribeMapChange:f,nextIndexRef:l}=lf(),c=u.useRef(-1),[m,g]=u.useState(i==null&&t?()=>{if(c.current===-1){const y=l.current;l.current+=1,c.current=y}return c.current}:-1),w=i??m,S=u.useRef(null),v=u.useCallback(y=>{const x=S.current;x&&a(x),S.current=y,y&&s(y,{metadata:r??null,index:i??null,label:n,textRef:o})},[i,s,a,r,n,o]);return Z(()=>{if(i==null)return f(y=>{const x=S.current?y.get(S.current)?.index:null;x!=null&&g(x)})},[i,f]),{ref:v,index:w}}const Kf=u.createContext(void 0),Wf=u.createContext(!1);function zf(){return u.useContext(Wf)}function ha(e){const{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:o}=e,{render:i,className:s,style:a,value:f=null,index:l,disabled:c=!1,nativeButton:m=!1,...g}=t,w=u.useRef(null),S=qf({guess:!0,index:l,textRef:w}),v=$t(),y=zf(),x=md(),p=v.useState("selectionMode"),h=v.useState("disabled"),C=v.useState("readOnly"),b=v.useState("isItemEqualToValue"),O=h||c,I=p!=="none",k=l??o??S.index,A=k!==-1,M=v.useState("id"),T=v.useState("isActive",k),V=v.useState("isSelected",f),_=v.useState("itemProps"),$=u.useRef(null),Q=M!=null&&A?`${M}-${k}`:void 0,ee=V&&I;Z(()=>{if(!(A&&(r||l!=null)))return;const oe=v.context.listRef.current;return oe[k]=$.current,()=>{delete oe[k]}},[A,r,k,l,v]),Z(()=>
1{if(!A||x)return;const L=v.context.valuesRef.current;return L[k]=f,()=>{delete L[k]}},[A,x,k,f,v]),Z(()=>{if(!A||x)return;const L=v.state.selectedValue;let oe=v.state.selectedIndex;v.state.selectionMode==="multiple"&&Array.isArray(L)?oe=bd(k,f,v.context.valuesRef.current,L,b,oe):Nt(f,L,b)&&(oe=k),v.set("selectedIndex",oe)},[A,x,v,k,f,b]);const{getButtonProps:J,buttonRef:U}=aa({disabled:O,focusableWhenDisabled:!0,native:m,composite:!0}),ae={disabled:O,selected:ee,highlighted:T};function ve(L){function oe(){v.context.handleSelection(L,f)}v.state.submitOnItemClick?(Wn.flushSync(oe),v.context.requestSubmit()):oe()}const le={id:Q,role:y?"gridcell":"option","aria-selected":I?ee:void 0,tabIndex:void 0,onPointerDownCapture(L){L.isPrimary&&(v.context.pointerDownItemRef.current=L.currentTarget),L.preventDefault()},onMouseDown(L){L.preventDefault()},onClick(L){O||C||ve(L.nativeEvent)},onMouseUp(L){const oe=v.context.pointerDownItemRef.current===L.currentTarget;v.context.pointerDownItemRef.current=null,!(O||C||L.button!==0||oe||!T)&&ve(L.nativeEvent)}},Be=Cn("div",t,{ref:[U,n,S.ref,$],state:ae,props:[_,le,g,J]}),se=u.useMemo(()=>({selected:ee,textRef:w}),[ee,w]);return d.jsx(Kf.Provider,{value:se,children:Be})}function Yf(e){const{componentProps:t,forwardedRef:n}=e,o=$t().useState("isItemEqualToValue"),{flatFilteredValues:i}=Or(),s=t.value??null,a=Lo(i,s,o);return d.jsx(ha,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:a})}const Gf=u.memo(u.forwardRef(function(t,n){const o=$t().useState("virtualized");return o&&t.index==null?d.jsx(Yf,{componentProps:t,forwardedRef:n}):d.jsx(ha,{componentProps:t,forwardedRef:n,virtualized:o,indexFromFilter:void 0})})),Xf=e=>{H({amount:e,localQuotes:[],localSelectedQuote:null,quotesWarning:null,quotesErrors:null,isLoading:!0});let{opts:t}=st();us(e,t)},Qi=async()=>{let{error:e,state:t,isLoading:n,onFailure:r,onSuccess:o}=st();El(),yo();let i=(({state:s,error:a,isLoading:f})=>a?{type:"failure",error:a}:s.status==="provider-success"?{type:"success",value:{status:"confirmed"}}:s.status==="provider-confirming"||((l,c)=>l.status==="stripe-flow"&&l.step==="confirm-checkout"&&c)(s,f)?{type:"success",value:{status:"submitted"}}:{type:"failure",error:Error("User exited flow")})({state:t,error:e,isLoading:n});i.type==="success"?await o(i.value):r(i.error)},zt=async(e,{environment:t})=>(await e.fetchPrivyRoute(ml,{query:{environment:t}})).data,Lr=(e,t,n="us",r)=>{if(n==="eu")return ga(t,r);let o=l=>t.includes(l),i=o("first_name")&&o("last_name"),s=o("address_line_1")&&o("address_city")&&o("address_state")&&o("address_postal_code"),a=o("dob"),f=o("id_number");return e==="l0"?i?s?null:"collect-address":"collect-name":i?a?f?s?null:"collect-address":"collect-ssn":"collect-dob":"collect-name"},ga=(e,t)=>{let n=r=>e.includes(r);if(t!=="pending"&&t!=="verified"&&t!=="rejected"){if(!n("first_name")||!n("last_name"))return"collect-name";if(!n("dob"))return"collect-dob";if(!n("nationalities"))return"collect-nationality";if(!n("birth_city")||!n("birth_country"))return"collect-birth-location";if(!n("address_line_1"))return"collect-address"}return n("identifiers")?n("attestation")?t!=="verified"?"verify-documents":null:"eu-attestation":"collect-identifiers"},wn=e=>{let t=["collect-name","collect-dob","collect-nationality","collect-birth-location","collect-address","collect-identifiers","eu-attestation","verify-documents","select-payment"],n=t.indexOf(e);return n===-1?"select-payment":t[n+1]??"select-payment"},ya=e=>e?.find((t=>t.tier==="l2"))?.verification_status,ba=e=>e?.find((t=>t.tier==="l2"&&t.verification_status==="rejected"))?.verification_errors?.includes("user_has_reached_max_verification_attempts")??!1;let he=e=>e.replace(/[\s/-]/g,"").toUpperCase(),gn=e=>he(e).split("").map(Number),xe=(e,t,n)=>Number(e.slice(t,n)),Ve=(e,t,n)=>e>=t&&e<=n,Rt=e=>Ve(e,1,12),mt=e=>Ve(e,1,31),xa=e=>Math.floor(e/10)+e%10,Lt=(e,t,n)=>{let r=gn(e);return n(t.reduce(((o,i,s)=>o+r[s]*i),0))===r[t.length]},Zi=e=>{let t=gn(e),n=[1,2,3,4,5,6,7,8,9,1].reduce(((o,i,s)=>o+t[s]*i),0),r=n%11;return r===10&&(r=(n=[3,4,5,6,7,8,9,1,2,3].reduce(((o,i,s)=>
1o+t[s]*i),0))%11)==10&&(r=0),r===t[10]},Ji=(e,t)=>{let n=gn(e);return(10-t.reduce(((r,o,i)=>r+xa(n[i]*o)),0)%10)%10===n[t.length]},Qf={at_stn:e=>{let t=he(e);return/^\d{9}$/.test(t)&&Ji(t,[1,2,1,2,1,2,1,2])},be_nrn:e=>{let t=he(e);if(!/^\d{11}$/.test(t)||!Rt(xe(t,2,4))||!mt(xe(t,4,6)))return!1;let n=Number(t.slice(0,9)),r=xe(t,9,11);return 97-n%97===r||97-+`2${t.slice(0,9)}`%97===r},bg_ucn:e=>{let t=he(e),n=xe(t,2,4);return/^\d{10}$/.test(t)&&(Ve(n,1,12)||Ve(n,21,32)||Ve(n,41,52))&&mt(xe(t,4,6))&&Lt(t,[2,4,8,5,10,9,7,3,6],(r=>r%11==10?0:r%11))},hr_oib:e=>/^\d{11}$/.test(he(e))&&(t=>{let n=gn(t),r=10;for(let i=0;i<10;i++){let s=(n[i]+r)%10;s===0&&(s=10),r=2*s%11}let o=11-r;return o===10&&(o=0),o===n[10]})(he(e)),cy_tic:e=>{let t=he(e);if(!/^[069]\d{7}[A-Z]$/.test(t))return!1;let n={0:1,1:0,2:5,3:7,4:9,5:13,6:15,7:17,8:19,9:21};return String.fromCharCode(65+([0,2,4,6].reduce(((r,o)=>r+n[t[o]]),0)+[1,3,5,7].reduce(((r,o)=>r+Number(t[o])),0))%26)===t[8]},cz_rc:e=>{let t=he(e),n=xe(t,2,4);return/^\d{9,10}$/.test(t)&&(Ve(n,1,12)||Ve(n,51,62)||t.length===10&&(Ve(n,21,32)||Ve(n,71,82)))&&mt(xe(t,4,6))},dk_cpr:e=>{let t=he(e);return/^\d{10}$/.test(t)&&mt(xe(t,0,2))&&Rt(xe(t,2,4))&&Lt(t,[4,3,2,7,6,5,4,3,2],(n=>{let r=n%11;return r===1?-1:r===0?0:11-r}))},ee_ik:e=>{let t=he(e);return/^\d{11}$/.test(t)&&Ve(xe(t,0,1),1,6)&&Rt(xe(t,3,5))&&mt(xe(t,5,7))&&Ve(xe(t,7,10),1,710)&&Zi(t)},es_nif:e=>{let t=he(e);return!!/^([KLMXYZ]?\d{7}[A-Z]|\d{8}[A-Z])$/.test(t)&&"TRWAGMYFPDXBNJZSQVHLCKE"[Number(/^\d/.test(t)?t.slice(0,8):`${{X:"0",Y:"1",Z:"2",K:"0",L:"0",M:"0"}[t[0]]}${t.slice(1,8)}`)%23]===t[8]},fi_hetu:e=>{let t=e.replace(/\s/g,"").toUpperCase();return!!/^(0[1-9]|[12]\d|3[01])(0[1-9]|1[0-2])\d{2}[+\-A-FU-Y]\d{3}[A-Z0-9]$/.test(t)&&"0123456789ABCDEFHJKLMNPRSTUVWXY"[+`${t.slice(0,6)}${t.slice(7,10)}`%31]===t[10]},fr_nir:e=>{let t=he(e);return/^[0-3]\d{12}$/.test(t)&&String(Number(t.slice(0,10))%511).padStart(3,"0")===t.slice(10)},fr_spi:e=>{let t=he(e);return/^[0-3]\d{12}$/.test(t)&&String(Number(t.slice(0,10))%511).padStart(3,"0")===t.slice(10)},de_stn:e=>{let t=he(e);if(/^\d{13}$/.test(t))return t[4]==="0";if(!/^\d{11}$/.test(t)||t[0]==="0"||/(\d)\1\1/.test(t)||![...new Set(t.slice(0,10))].map((o=>t.slice(0,10).split(o).length-1)).some((o=>o===2||o===3)))return!1;let n=gn(t),r=10;for(let o=0;o<10;o++){let i=(n[o]+r)%10;i===0&&(i=10),r=2*i%11}return(11-r==10?0:11-r)===n[10]},gr_afm:e=>/^\d{9}$/.test(he(e)),hu_ad:e=>/^8\d{9}$/.test(he(e))&&Lt(he(e),[1,2,3,4,5,6,7,8,9],(t=>t%11)),ie_ppsn:e=>{let t=he(e);if(!/^\d{7}[A-W][A-IW]?$/.test(t))return!1;let n=(9*(t.length===9?t[8]==="W"?0:t.charCodeAt(8)-64:0)+[8,7,6,5,4,3,2].reduce(((r,o,i)=>r+Number(t[i])*o),0))%23;return(n===0?"W":String.fromCharCode(64+n))===t[7]},is_kt:e=>{let t=he(e);return/^\d{10}$/.test(t)&&mt(xe(t,0,2))&&Rt(xe(t,2,4))&&(t[9]==="9"||t[9]==="0")},it_cf:e=>{let t=he(e);if(!/^[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]$/.test(t)||!"ABCDEHLMPRST".includes(t[8])||![...Array(31).keys()].some((o=>xe(t,9,11)===o+1||xe(t,9,11)===o+41)))return!1;let n={0:1,1:0,2:5,3:7,4:9,5:13,6:15,7:17,8:19,9:21,A:1,B:0,C:5,D:7,E:9,F:13,G:15,H:17,I:19,J:21,K:2,L:4,M:18,N:20,O:11,P:3,Q:6,R:8,S:12,T:14,U:16,V:10,W:22,X:25,Y:24,Z:23},r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").reduce(((o,i,s)=>({...o,[i]:s<10?s:s-10})),{});return String.fromCharCode(65+t.slice(0,15).split("").reduce(((o,i,s)=>o+((s+1)%2?n[i]:r[i])),0)%26)===t[15]},lv_pk:e=>{let t=he(e);return/^(0[1-9]|[12]\d|3[01])(0[0-9]|1[0-2])\d{7}$|^32\d{9}$/.test(t)&&(t.startsWith("32")||["0","1","2"].includes(t[6]))},lt_ak:e=>{let t=he(e);return/^\d{11}$/.test(t)&&Ve(xe(t,0,1),1,6)&&Rt(xe(t,3,5))&&mt(xe(t,5,7))&&Zi(t)},lu_nif:e=>{let t=he(e);return!!(/^\d{13}$/.test(t)&&Ve(xe(t,0,4),1800,2100)&&Rt(xe(t,4,6))&&mt(xe(t,6,8)))&&[2,1,2,1,2,1,2,1,2,1,2,1].reduce(((n,r,o)=>n+xa(Number(t[o])*r)),0)%10==0&&(n=>{let r=[[0,1,2,3,4,5,6,7,8,9],[1,2,3,4,0,6,7,8,9,5],[2,3,4,0,1,7,8,9,5,6],[3,4,0,1,2,8,9,5,6,7],[4,0,1,2,3,9,5,6,7,8],[5,9,8,7,6,0,4,3,2,1],[6,5,9,8,7,1,0,4,3,2],[7,6,5,9,8,2,1,0,4,3],[8,7,6,5,9,3,2,1,0,4],[9,8,7,6,5,4,3,2,1,0]],o=[[0,1,2,3,4,5,6,7,8,9],[1,5,7,6,2,8,3,0,9,4],[5,8,0,3,7,9,6,1,4,2],[8,9,1,6,0,4,3,5,2,7],[9,4,5,3,1,2,6,8,7,0],[4,2,8,6,5,7,3,9,0,1],[2,7,9,3,8,0,6,4,1,5],[7,0,4,6,9,1,3,2,5,8]],i=0,s=gn(n).reverse();for(let a=0;a<s.length;a++)i=r[i][o[a%8][s[a]]];return i===0})(`${t.slice(0,11)}${t[12]}`)},mt_nic:e=>{let t=he(e);return/^\d{7}[MGAPLHBZ]$/.test(t)||/^\d{9}$/.test(t)&&["11","22","33","44","55","66","77","88"].includes(t.slice(0,2))},mt_pp:e=>/^\d{7}$/.test(he(e)),nl_bsn:e=>/^\d{9}$/.test(he(e))&&Lt(he(e),[9,8,7,6,5,4,3,2],(t=>t%11==10?-1:t%11)),pl_nip:e=>/^\d{10}$/.test(he(e))&&Lt(he(e),[6,5,7,2,3,4,5,6,7],(t=>t%11==10?-1:t%11)),pl_pesel:e=>{let t=he(e),n=xe(t,2,4);return/^\d{11}$/.test(t)&&(Rt(n)||Ve(n,21,32)||Ve(n,41,52)||Ve(n,61,72)||Ve(n,81,92))&&mt(xe(t,4,6))&&Lt(t,[1,3,7,9,1,3,7,9,1,3],(r=>(10-r%10)%10))},pt_nif:e=>/^\d{9}$/.test(he(e))&&Lt(he(e),[9,8,7,6,5,4,3,2],(t=>{let n=11-t%11;return n>=10?0:n})),ro_cnp:e=>{let t=he(e),n=xe(t,7,9),r=t[0]==="9"&&t.slice(1,4)==="000";return/^\d{13}
1$/.test(t)&&Ve(xe(t,0,1),1,9)&&(r||Rt(xe(t,3,5))&&mt(xe(t,5,7)))&&(Ve(n,1,47)||n===51||n===52)&&Lt(t,[2,7,9,1,4,6,3,5,8,2,7,9],(o=>o%11==10?1:o%11))},sk_rc:e=>{let t=he(e),n=xe(t,2,4);return/^\d{9,10}$/.test(t)&&(Rt(n)||Ve(n,51,62))&&mt(xe(t,4,6))},si_pin:e=>{let t=he(e);return/^\d{8}$/.test(t)&&Ve(xe(t,0,7),1e6,9999999)&&Lt(t,[8,7,6,5,4,3,2],(n=>{let r=11-n%11;return r===10?0:r===11?-1:r}))},se_pin:e=>{let t=he(e);if(!/^\d{10}$|^\d{12}$/.test(t))return!1;if(t.length===12){if(!["18","19","20"].includes(t.slice(0,2)))return!1;t=t.slice(2)}let n=xe(t,4,6);return Rt(xe(t,2,4))&&(mt(n)||Ve(n,61,91))&&Ji(t,[2,1,2,1,2,1,2,1,2])}};const to={ee_ik:"39901011231",es_nif:"00000000T",is_kt:"0101000000",it_cf:"AAAAAA00A01A000H",mt_nic:"0000000M",mt_pp:"0000000",pl_pesel:"44051401458",pl_nip:"8567346215"},fn={at_stn:"Steuernummer (Austria)",be_nrn:"National Registration Number (Belgium)",bg_ucn:"Unified Civil Number (Bulgaria)",hr_oib:"OIB (Croatia)",cy_tic:"Tax Identification Code (Cyprus)",cz_rc:"Rodné číslo (Czech Republic)",dk_cpr:"CPR (Denmark)",ee_ik:"Isikukood (Estonia)",es_nif:"NIF (Spain)",fi_hetu:"HETU (Finland)",fr_spi:"Numéro fiscal (France)",fr_nir:"NIR (France)",de_stn:"Steuer-ID (Germany)",gr_afm:"AFM (Greece)",hu_ad:"Adóazonosító (Hungary)",ie_ppsn:"PPSN (Ireland)",is_kt:"Kennitala (Iceland)",it_cf:"Codice fiscale (Italy)",lv_pk:"Personas kods (Latvia)",lt_ak:"Asmens kodas (Lithuania)",lu_nif:"NIF (Luxembourg)",mt_nic:"National Identity Card (Malta)",mt_pp:"Passport (Malta)",nl_bsn:"BSN (Netherlands)",pl_pesel:"PESEL (Poland)",pl_nip:"NIP (Poland)",pt_nif:"NIF (Portugal)",ro_cnp:"CNP (Romania)",sk_rc:"Rodné číslo (Slovakia)",si_pin:"EMŠO (Slovenia)",se_pin:"Personnummer (Sweden)"},re=()=>{let e=st().stripeSession;if(!e)throw Error("No active Stripe onramp session");return e},X=()=>{let{stripeSession:e,controller:t}=st();return e!==null&&!(t.current?.signal.aborted??1)},Sn=()=>{let{controller:e}=st();if(!e.current)throw Error("No active abort controller");return e.current.signal},va=async()=>{let e=re().onramp;if(!e.getMissingIdentifiers)throw Error("Stripe onramp getMissingIdentifiers is unavailable");let t=await e.getMissingIdentifiers();if(!X())return!1;let n=re();return H({stripeSession:{...n,context:{...n.context,kycMissingIdentifiers:t.identifiers,kycMissingAlternatives:t.alternatives}}}),(({identifiers:r})=>r.length>0)(t)},Ca=({stripeKycRegion:e,sourceCurrency:t})=>{if(e==="eu"||e==="us")return e;let n=t.toUpperCase();if(n==="EUR")return"eu";if(n==="USD")return"us";throw Error(`Unsupported source currency for Stripe onramp: ${n}`)},wr=e=>({providedFields:e.status==="active"?e.provided_fields:[],kycTiers:e.status==="active"?e.kyc_tiers:void 0}),qn=({customer:e,region:t})=>e.status==="active"&&(t==="eu"?((n,r)=>r==="verified"&&n.includes("identifiers")&&n.includes("attestation"))(e.provided_fields,ya(e.kyc_tiers)):e.verifications.some((n=>n.status==="verified"))),bn=async({customer:e,region:t,tier:n="l0"})=>{let{providedFields:r,kycTiers:o}=wr(e);if(t!=="eu")return Lr(n,r,t);if(ba(o))throw Error("Document verification was rejected. Contact Stripe support for help.");let i=(({kycTiers:s,providedFields:a})=>{let f=ya(s);return ga(a,f)})({kycTiers:o,providedFields:r});return i!=="collect-identifiers"||await va()||(i=wn("collect-identifiers")),i},wa=e=>e?"privyErrorCode"in e&&typeof e.privyErrorCode=="string"?e.privyErrorCode:"code"in e&&typeof e.code=="string"?e.code:null:null,on=({eventType:e,error:t,errorCode:n,attempt:r,context:o,stripeSessionId:i})=>{let s=Ye.getState();if(!s)return;let a=s.stripeSession,f=o??a?.context.config;f&&s.privy.track({name:"stripe_onramp_client_operation",properties:{event_type:e,error_code:n??wa(t instanceof Error?t:null),privy_session_id:f.sessionId,stripe_session_id:i??a?.context.stripeSessionId,source_currency:s.opts.source.selectedAsset.toLowerCase(),destination_currency:s.opts.destination.asset.toLowerCase(),destination_network:f.network,environment:f.environment,...r===void 0?{}:{attempt:r}}})},Sa=e=>(e instanceof Error?e.message:String(e)).toLowerCase().includes("user is not authenticated"),$e=(e,t="flow_failed")=>{let n=e instanceof Error?e:Error(String(e));if(console.error("[FiatOnramp:Stripe]",n),Sa(n))return on({eventType:"link_auth_error",error:n}),void H({state:{status:"stripe-flow",step:"choose-email"},error:null,stripeElement:null,isLoading:!1});on({eventType:t,error:n}),H({state:{status:"provider-error"},error:n,isLoading:!1})};let Zf={path:"/api/v1/onramp/stripe/transaction_limits",method:"GET"};const Kn=async()=>{let e=re(),{opts:t,amount:n}=st(),r=Jf(n);try{let o=await(async(s,a)=>
1await s.fetchPrivyRoute(Zf,{query:{environment:a.environment,destination_chain:a.destinationChain,wallet_address:a.walletAddress}}))(e.privy,{environment:e.context.config.environment,destinationChain:t.destination.chain,walletAddress:t.destination.address}),i=ep({limits:o,sourceCurrency:t.source.selectedAsset});return i===null||r<=i}catch{return!0}};let Jf=e=>{let t=e.trim();if(!/^\d+(?:\.\d*)?$/.test(t))throw Error("Enter a valid amount and try again.");let n=Number.parseFloat(t);if(!Number.isFinite(n))throw Error("Enter a valid amount and try again.");return n},ep=({limits:e,sourceCurrency:t})=>{let n=Object.values(e.limits[`${t.toLowerCase()}.fiat`]??{}).flat();return n.length?Math.max(...n.map((r=>r.limit))):null};const xn=async({customer:e,loader:t,tier:n})=>{if(!X())return;let{providedFields:r}=wr(e),o=re(),i=o.context.kycRegion??"us",s=n??(({customer:l,region:c})=>{if(l.status!=="active")return null;if(c==="eu")return qn({customer:l,region:c})?null:"l2";let m=g=>l.kyc_tiers?.some((w=>w.tier===g&&w.verification_status==="verified"));return m("l2")?null:m("l1")?"l2":m("l0")?"l1":"l0"})({customer:e,region:i});if(!s)throw new cs("Checkout failed: transaction_limit_reached",void 0,Kt.ONRAMP_TRANSACTION_LIMIT_REACHED);if(i==="eu"){let l=await bn({customer:e,region:i});if(!X())return;if(!l)throw Error("Stripe could not continue identity verification. Try again.");return void H({stripeSession:{...o=re(),context:{...o.context,...t?{documentVerificationAction:{type:"retry-payment",loader:t}}:{},kycTier:s,kycProvidedFields:r}},state:{status:"stripe-flow",step:l},isLoading:!1})}let a=await bn({customer:e,region:i,tier:s});if(!X())return;let f={...(o=re()).context,...s==="l2"&&t?{documentVerificationAction:{type:"retry-payment",loader:t}}:{},kycTier:s,kycProvidedFields:r};if(a)H({stripeSession:{...o,context:f},state:{status:"stripe-flow",step:a},isLoading:!1});else{if(s!=="l2")throw Error("Stripe could not continue identity verification. Try again.");H({stripeSession:{...o,context:f},state:{status:"stripe-flow",step:"verify-documents"},isLoading:!1})}},Ea=async(e,{environment:t})=>(await e.fetchPrivyRoute(yl,{query:{environment:t}})).data,tp=["aptos","avalanche","arbitrum","base","bitcoin","ethereum","optimism","polygon","solana","stellar","sui","tempo","worldchain","xrpl"],ka=2e3,Ia=e=>{if((t=>tp.some((n=>n===t)))(e))return e;throw Error(`Unsupported Stripe onramp network: ${e}`)},Ra=async(e,t)=>await e.fetchPrivyRoute(vl,{body:{session_id:t.sessionId,environment:t.environment,session:t.session}}),np=e=>{let t=rp(e?.source_currency?.toLowerCase());return{currencySymbol:t,paymentMethodLabel:null,fee:e?.fee&&t?`${t}${e.fee}`:null,destinationAmount:op(e?.destination_amount),destinationToken:e?.destination_currency?.toUpperCase()??null,destinationNetwork:ip(e?.destination_network),sourceAmount:e?.source_total_amount??null,quoteExpiresAt:e?.quote_expiration??null}};let rp=e=>e==="usd"?"$":e==="eur"?"€":e==="gbp"?"£":null,op=e=>e?e.replace(/\.0+$/,"").replace(/(\.\d*?)0+$/,"$1"):null,ip=e=>e?e.split(/[-_]/).map((t=>`${t.slice(0,1).toUpperCase()}${t.slice(1)}`)).join(" "):null;const sp=e=>{let t=Pa(e);if(t===Kt.ONRAMP_MINIMUM_IDENTITY_VERIFICATION_REQUIRED)return"l0";if(t===Kt.ONRAMP_IDENTITY_VERIFICATION_REQUIRED)return"l1";if(t===Kt.ONRAMP_DOCUMENT_VERIFICATION_REQUIRED)return"l2";if(t==="crypto_onramp_missing_minimum_identity_verification")return"l0";if(t==="crypto_onramp_missing_identity_verification")return"l1";if(t==="crypto_onramp_missing_document_verification")return"l2";let n=lp(e);return n.includes("crypto_onramp_missing_minimum_identity_verification")?"l0":n.includes("crypto_onramp_missing_identity_verification")?"l1":n.includes("crypto_onramp_missing_document_verification")?"l2":n.toLowerCase().includes("minimum identity verification")?"l0":n.toLowerCase().includes("identity verification")?"l1":n.toLowerCase().includes("document verification")?"l2":null},ap=e=>{let t=Pa(e);return t===Kt.ONRAMP_TRANSACTION_LIMIT_REACHED||t==="transaction_limit_reached"||t==="crypto_onramp_transaction_limit_reached"};let Pa=e=>{if(!e||typeof e!="object")return null;if("code"in e&&typeof e.code=="string")return e.code;if("error"in e){let t=e.error;if(t&&typeof t=="object"&&"code"in t&&typeof t.code=="string")return t.code}return null},lp=e=>{if(!e)return"";let t=[];if(e instanceof Error?t.push(e.name,e.message):t.push(String(e)),typeof e=="object"&&("code"in e&&t.push(String(e.code)),"type"in e&&t.push(String(e.type)),"error"in e)){let n=e.error;
1typeof n=="object"&&n&&"message"in n&&t.push(String(n.message)),typeof n=="object"&&n&&"code"in n&&t.push(String(n.code))}return t.join(" ")};const Aa=(e,t)=>{let n=e.find((o=>o.id===t));if(!n?.card)return null;let r=n.card.brand?`${n.card.brand.charAt(0).toUpperCase()}${n.card.brand.slice(1)}`:"Card";return n.card.last4?`${r} •••• ${n.card.last4}`:r},Bo=async({paymentToken:e,loader:t})=>{let n=re();try{let r,o,{opts:i,amount:s}=st(),{config:a,cryptoCustomerId:f}=n.context;if(!f)throw Error("Missing cryptoCustomerId");t==="inline"?H({stripeSession:{...n,context:{...n.context,paymentToken:e}},isLoading:!0}):t==="screen"&&H({stripeSession:{...n,context:{...n.context,paymentToken:e}},state:{status:"stripe-flow",step:"checkout"},isLoading:!1});let l={crypto_customer_id:f,payment_token:e,source_amount:s||"0",source_currency:i.source.selectedAsset.toUpperCase(),destination_currency:i.destination.asset,destination_network:a.network,wallet_address:i.destination.address};try{let w=await Ra(n.privy,{sessionId:a.sessionId,environment:a.environment,session:l});r=w.id,o=w.transaction_details}catch(w){let S=sp(w);if(!S&&!ap(w))throw w;if(!X())return;let v=await zt(n.privy,{environment:a.environment});return await xn({customer:v,loader:t,tier:S})}if(!X())return;let c=re().context.paymentMethodLabel??null;if(!c)try{let w=await Ea(n.privy,{environment:a.environment});c=Aa(w,e)}catch{}let m={...np(o),paymentMethodLabel:c},g=re();H({stripeSession:{...g,context:{...g.context,stripeSessionId:r,checkoutDetails:m}},stripeConfirmCheckoutDetails:m,state:{status:"stripe-flow",step:"confirm-checkout"},isLoading:!1})}catch(r){$e(r)}},sn=async e=>{let t=re();try{let{opts:n}=st(),r=t.context.config.network,o=await(async(a,{environment:f})=>(await a.fetchPrivyRoute(hl,{query:{environment:f}})).data)(t.privy,{environment:t.context.config.environment});if(!X())return;if(!o.some((a=>a.wallet_address===n.destination.address&&a.network===r))){try{await t.onramp.registerWalletAddress(n.destination.address,Ia(r))}catch(a){if(console.warn("[FiatOnramp:Stripe] registerWalletAddress failed:",a),Sa(a))return void $e(a);on({eventType:"wallet_registration_error",error:a})}if(!X())return}if(!e?.skipTokenCheck){let a=[];try{a=await Ea(t.privy,{environment:t.context.config.environment})}catch{}if(!X())return;if(a.length>0){let f=new Set,l=a.filter((m=>{let g=`${m.type}:${m.card?.brand??""}:${m.card?.last4??""}`;return!f.has(g)&&(f.add(g),!0)})),c=re();return void H({stripeSession:{...c,context:{...c.context,savedPaymentTokens:l}},state:{status:"stripe-flow",step:"select-payment"},isLoading:!1})}}H({stripeElement:null,state:{status:"stripe-flow",step:"payment"},isLoading:!1});let i=t.context.kycRegion??"us",s=await Nn(t.onramp.collectPaymentMethod({payment_method_types:i==="eu"?["card"]:["card","us_bank_account"],wallets:{applePay:"auto",googlePay:"auto"}},(a=>{if(X()){if(!a.cryptoPaymentToken)return void $e(Error("Payment method selection was cancelled"),"flow_cancelled");Bo({paymentToken:a.cryptoPaymentToken,loader:"screen"})}})).catch((a=>($e(a),null))),3e4,Sn());X()&&s&&H({stripeElement:s})}catch(n){$e(n)}},cp=async()=>{let e,t=Il();if(!t)return;let n=t.provider;if(n==="stripe"||n==="stripe-sandbox"){H({isLoading:!0});let{opts:m,amount:g,getProviderUrl:w,email:S,phone:v,privy:y}=st();try{let x=await w({source:{asset:m.source.selectedAsset.toUpperCase(),amount:g||"0"},destination:{asset:m.destination.asset,chain:m.destination.chain,address:m.destination.address},provider:t.provider,sub_provider:t.sub_provider??void 0,payment_method:t.payment_method}),p=up(x),h=n==="stripe"?"production":"sandbox",C={publishableKey:p.publishable_key,network:p.network,sessionId:p.session_id,userEmail:S??"",userPhone:v,environment:h};try{await(async(I,k)=>{let A;yo();try{({loadCryptoOnrampAndInitialize:A}=await dl(()=>import("./stripe.esm-g-zUbXrr.js"),[]))}catch{throw Error("@stripe/crypto is required for Stripe onramp but could not be loaded. Ensure the package is installed.")}let{controller:M}=st();M.current=new AbortController;let T=await Nn(Promise.resolve(A(k.publishableKey,{theme:"stripe"})),15e3,M.current.signal);if(!T)throw Error("Stripe crypto SDK unavailable");let V=crypto.randomUUID();H({stripeSession:{id:V,onramp:T,privy:I,context:{sessionId:V,config:k}}})})(y,C)}catch(I){throw on({eventType:"sdk_init_error",error:I,context:C}),I}let b=re();if(!b)return;let O=await zt(b.privy,{environment:h});if(!X())return;if(O.status==="active"){let I=re(),k=Ca({stripeKycRegion:O.kyc_region,sourceCurrency:m.source.selectedAsset});H({stripeSession:{...I,context:{...I.context,cryptoCustomerId:O.crypto_customer_id,kycRegion:k,kycProvidedFields:O.provided_fields}},isLoading:!0}),await(async({authIntentId:A,onReady:M})=>{let T=re(),V=!1,_=async()=>
1{if(!V){V=!0;try{await M()}catch(Q){if(!X())return;$e(Q)}}};if(!A)return void await _();let $=null;try{$=await Nn(T.onramp.authenticate(A,(Q=>{X()&&(Q.result==="success"?_():$e(Error(`Link authentication ${Q.result}`)))})),3e4,Sn())}catch(Q){return X()?(on({eventType:"link_auth_error",error:Q}),void H({state:{status:"stripe-flow",step:"choose-email"},isLoading:!1})):void 0}X()&&($?H({state:{status:"stripe-flow",step:"authenticating"},stripeElement:$,isLoading:!1}):await _())})({authIntentId:O.link_auth_intent_id,onReady:async()=>{if(X())if(k==="eu")if(qn({customer:O,region:k})){let A=await Kn();if(X()){if(!A)return await xn({customer:O});await sn()}}else{let A=await bn({customer:O,region:k})??"collect-name";if(!X())return;H({state:{status:"stripe-flow",step:A},isLoading:!1})}else if(qn({customer:O,region:k})){let A=await Kn();if(!X())return;if(!A)return await xn({customer:O});await sn()}else H({state:{status:"stripe-flow",step:"collect-name"},isLoading:!1})}})}else H({state:{status:"stripe-flow",step:"choose-email"},isLoading:!1})}catch(x){console.error("[FiatOnramp:Stripe] Init failed:",x),H({state:{status:"provider-error"},isLoading:!1,error:Error("Something went wrong setting up checkout. Please try again.")})}return}let r=pl();if(!r)return void H({state:{status:"provider-error"},error:Error("Unable to open payment window")});H({isLoading:!0});let{opts:o,amount:i,getProviderUrl:s,getStatus:a,controller:f}=st(),l=()=>{try{r.closed||r.close()}catch{}};f.current=new AbortController;try{let m=await s({source:{asset:o.source.selectedAsset.toUpperCase(),amount:i||"0"},destination:{asset:o.destination.asset,chain:o.destination.chain,address:o.destination.address},provider:t.provider,sub_provider:t.sub_provider??void 0,payment_method:t.payment_method,redirect_url:window.location.origin});if(m.type!=="url")throw Error("Expected URL response for popup-based provider");r.location.href=m.url,e=m.session_id}catch{return l(),void H({state:{status:"provider-error"},isLoading:!1,error:Error("Unable to start payment session")})}H({isLoading:!1}),H({state:{status:"provider-confirming"}});let c=await go({operation:()=>a({session_id:e,provider:t.provider}),until:m=>m.status==="completed"||m.status==="failed"||m.status==="cancelled",delay:0,interval:2e3,attempts:210,signal:f.current.signal});if(c.status!=="aborted"){if(c.status==="max_attempts")return l(),c.error?(console.error(c.error),void H({state:{status:"select-amount"},isLoading:!1,error:Error("Unable to check payment status. Please try again.")})):void H({state:{status:"provider-error"},error:Error("Could not confirm payment status yet.")});c.result?.status==="completed"?(l(),H({state:{status:"provider-success"}})):(l(),H({state:{status:"provider-error"},error:Error(`Transaction ${c.result?.status??"failed"}`)}))}};let up=e=>{if(e&&typeof e=="object"&&"publishable_key"in e&&"network"in e&&"session_id"in e)return e;throw Error("Unexpected response shape from provider_session_url for Stripe")};const dp=()=>{let e=kl();e&&e.length>0&&H({state:{status:"select-payment-method",quotes:e}})},fp=()=>{H({state:{status:"select-source-asset"},localQuotes:[],localSelectedQuote:null,quotesWarning:null,quotesErrors:null})},pp=()=>{H({error:null,state:{status:"select-amount"}})},mp=e=>{H({localSelectedQuote:e,state:{status:"select-amount"}})},hp=e=>{let{opts:t,amount:n}=st(),r={...t,source:{...t.source,selectedAsset:e}};H({opts:r,state:{status:"select-amount"},localQuotes:[],localSelectedQuote:null,quotesWarning:null,quotesErrors:null,isLoading:!0}),us(n,r)},Ho=({element:e,minHeight:t,bleed:n=!1})=>{let r=u.useRef(null);return u.useEffect((()=>(r.current&&e&&r.current.replaceChildren(e),()=>{r.current&&r.current.replaceChildren()})),[e]),d.jsx("div",{ref:r,style:{minHeight:t,margin:n?"0 -1rem":void 0}})},Uo=(e,t)=>e!=="collect-address"||t.kycRegion!=="eu"||t.kycAddress?.country?e:"collect-country",Ct=e=>{X()&&H({state:{status:"stripe-flow",step:Uo(e,re().context)}})},gp=({city:e,country:t})=>{let n=re(),r=n.context,o=[...r.kycProvidedFields??[],"birth_city","birth_country"];H({stripeSession:{...n,context:{...r,kycBirthCity:e,kycBirthCountry:t,kycProvidedFields:o}}}),Ct(wn("collect-birth-location"))},yp=async(e,t)=>
1(await e.fetchPrivyRoute(xl,{params:{session_id:t}})).client_secret,fo=async(e,t)=>{let n=await e.fetchPrivyRoute(bl,{params:{session_id:t}});return{quoteExpiresAt:n.quote_expiration,sourceTotalAmount:n.source_total_amount,fee:n.fee,destinationAmount:n.destination_amount}},bp=e=>!e||typeof e!="object"?null:e.transaction_details?.last_error??null;let xp=new Set(["transaction_limit_reached","location_not_supported","transaction_failed"]),vp=e=>e==="transaction_limit_reached"?new cs("Checkout failed: transaction_limit_reached",void 0,Kt.ONRAMP_TRANSACTION_LIMIT_REACHED):Error(`Checkout failed: ${e??"unknown error"}`),Cp=e=>!!(e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&e.message.toLowerCase().includes("quote expired"));const es=async()=>{let e=re();try{let{stripeSessionId:t}=e.context;if(!t)throw Error("Missing stripeSessionId");H({isLoading:!0});for(let n=0;n<3;n++){let r;if(!X())return;try{r=await e.onramp.performCheckout(t,(async i=>await yp(e.privy,i)))}catch(i){if(!Cp(i))throw i;on({eventType:"checkout_error",error:i,errorCode:"quote_expired",attempt:n+1,stripeSessionId:t}),await fo(e.privy,t);continue}if(r.successful)return X()?void H({state:{status:"provider-success"},isLoading:!1}):void 0;let o=bp(r);if(on({eventType:"checkout_error",errorCode:o,attempt:n+1,stripeSessionId:t}),!o||xp.has(o))throw vp(o);if(!X())return;if(o==="charged_with_expired_quote")await fo(e.privy,t);else if(o==="quote_rate_drifted"){let{opts:i,amount:s}=st(),{config:a,cryptoCustomerId:f,paymentToken:l}=e.context;if(!f||!l)throw Error("Cannot recreate session: missing customer or payment token");t=(await Ra(e.privy,{sessionId:a.sessionId,environment:a.environment,session:{crypto_customer_id:f,payment_token:l,source_amount:s||"0",source_currency:i.source.selectedAsset.toUpperCase(),destination_currency:i.destination.asset,destination_network:a.network,wallet_address:i.destination.address}})).id;let c=re();H({stripeSession:{...c,context:{...c.context,stripeSessionId:t}}})}else{if(o==="missing_kyc"){let i=await zt(e.privy,{environment:e.context.config.environment});if(!X())return;let{providedFields:s}=wr(i),a=re(),f=a.context.kycRegion??"us",l=await bn({customer:i,region:f,tier:"l0"});if(!X())return;if(a=re(),!l)throw Error("Checkout failed: missing_kyc but all fields already provided");return void H({stripeSession:{...a,context:{...a.context,documentVerificationAction:{type:"retry-checkout"},kycTier:"l0",kycProvidedFields:s}},state:{status:"stripe-flow",step:l}})}if(o==="missing_document_verification"){let i=await zt(e.privy,{environment:e.context.config.environment});if(!X())return;let{providedFields:s}=wr(i),a=re(),f=a.context.kycRegion??"us",l=await bn({customer:i,region:f,tier:"l2"});if(!X())return;let c={...(a=re()).context,documentVerificationAction:{type:"retry-checkout"},kycTier:"l2",kycProvidedFields:s};return l?void H({stripeSession:{...a,context:c},state:{status:"stripe-flow",step:l},isLoading:!1}):void H({stripeSession:{...a,context:c},state:{status:"stripe-flow",step:"verify-documents"},isLoading:!1})}if(o!=="missing_consumer_wallet")throw Error(`Checkout failed: ${o}`);{let{opts:i}=st();await e.onramp.registerWalletAddress(i.destination.address,Ia(e.context.config.network))}}}throw Error("Checkout failed after maximum retry attempts")}catch(t){$e(t)}},Dt=[{code:"AT",name:"Austria"},{code:"BE",name:"Belgium"},{code:"BG",name:"Bulgaria"},{code:"HR",name:"Croatia"},{code:"CY",name:"Cyprus"},{code:"CZ",name:"Czech Republic"},{code:"DK",name:"Denmark"},{code:"EE",name:"Estonia"},{code:"FI",name:"Finland"},{code:"FR",name:"France"},{code:"DE",name:"Germany"},{code:"GR",name:"Greece"},{code:"HU",name:"Hungary"},{code:"IS",name:"Iceland"},{code:"IE",name:"Ireland"},{code:"IT",name:"Italy"},{code:"LV",name:"Latvia"},{code:"LT",name:"Lithuania"},{code:"LU",name:"Luxembourg"},{code:"MT",name:"Malta"},{code:"NL",name:"Netherlands"},{code:"PL",name:"Poland"},{code:"PT",name:"Portugal"},{code:"RO",name:"Romania"},{code:"SK",name:"Slovakia"},{code:"SI",name:"Slovenia"},{code:"ES",name:"Spain"},{code:"SE",name:"Sweden"}],_a=new Set(Dt.map((e=>e.code))),wp=e=>{if(!_a.has(e))return void $e(Error("Stripe EU onramp is not available in this country"));let t=re(),n=t.context,r=n.cryptoCustomerId?"collect-address":"create-link-account";H({stripeSession:{...t,context:{...n,kycRegion:"eu",kycAddress:{...n.kycAddress??{addressLine1:"",city:"",state:"",postalCode:""},country:e}}},state:{status:"stripe-flow",step:r}})},Ta=async(e,{email:t,environment:n})=>
1(await e.fetchPrivyRoute(Cl,{body:{email:t,environment:n}})).data,ts=e=>{let t=re();H({stripeSession:{...t,context:{...t.context,...e}}})},Ma=async(e,t)=>{let n=re();try{if(await(async(s,{authIntentId:a,cryptoCustomerId:f,environment:l})=>{await s.fetchPrivyRoute(wl,{body:{auth_intent_id:a,crypto_customer_id:f,environment:l}})})(n.privy,{authIntentId:t,cryptoCustomerId:e,environment:n.context.config.environment}),!X())return;ts({cryptoCustomerId:e});let r=await zt(n.privy,{environment:n.context.config.environment});if(!X())return;if(r.status!=="active")throw Error("Session unexpectedly inactive after authentication");let{opts:o}=st(),i=Ca({stripeKycRegion:r.kyc_region,sourceCurrency:o.source.selectedAsset});if(ts({kycRegion:i,kycProvidedFields:r.provided_fields}),i==="eu")if(qn({customer:r,region:i})){let s=await Kn();if(!X())return;if(!s)return await xn({customer:r});await sn()}else{let s=await bn({customer:r,region:i})??"collect-name";if(!X())return;Ct(s)}else if(qn({customer:r,region:i})){let s=await Kn();if(!X())return;if(!s)return await xn({customer:r});await sn()}else Ct("collect-name")}catch(r){$e(r)}},Sp=async e=>{let t=re();try{H({isLoading:!0});let n=await Ta(t.privy,{email:e,environment:t.context.config.environment});if(!X())return;if(H({isLoading:!1}),n.status==="no_account"){let{opts:r}=st(),o=r.source.selectedAsset.toUpperCase()==="EUR";H({stripeSession:{...t,context:{...t.context,pendingEmail:e}},state:{status:"stripe-flow",step:o?"collect-country":"create-link-account"},email:e})}else{H({stripeSession:{...t,context:{...t.context,authIntentId:n.id,pendingEmail:e}},state:{status:"stripe-flow",step:"authenticating"},email:e});let r=await Nn(t.onramp.authenticate(n.id,(o=>{X()&&(o.result==="success"&&o.crypto_customer_id?Ma(o.crypto_customer_id,n.id):$e(Error(`Link authentication ${o.result}`)))})),3e4,Sn());X()&&r&&H({stripeElement:r})}}catch(n){$e(n)}},Ep=async e=>{let t=re(),n=t.context,r=t.onramp,o=await r.updateKycInfo(e).catch((s=>($e(s),null)));if(!o)return;let i=[...n.kycProvidedFields??[]];o.completed&&i.push("identifiers"),H({stripeSession:{...t,context:{...n,kycProvidedFields:i,kycMissingIdentifiers:o.identifiers??[],kycMissingAlternatives:o.alternatives??[],kycInvalidIdentifiers:o.invalid_identifiers??[]}}}),o.completed&&Ct(wn("collect-identifiers"))},Fr=async()=>{let e=re();try{let{kycSsn:t,kycTier:n,kycRegion:r,config:o}=e.context,i={...kp(e.context),...Ip(e.context),...Rp(e.context),...Pp(e.context),...Ap(e.context)};if(Ct("kyc"),await e.onramp.submitKycInfo(i),t){let l=re();H({stripeSession:{...l,context:{...l.context,kycSsn:void 0}}})}if(!X())return;let s=r==="eu"?"l2":n==="l2"?"l1":n??"l0",a=await go({operation:()=>zt(e.privy,{environment:o.environment}),until:l=>{if(l.status!=="active")return!1;if(r==="eu"){let c=l.kyc_tiers?.find((m=>m.tier==="l2"));return c?.verification_status==="pending"||c?.verification_status==="verified"}if(l.kyc_tiers?.length){let c=l.kyc_tiers.find((m=>m.tier===s));if(c)return c.verification_status==="verified"}return l.verifications.some((c=>c.status==="verified"))},delay:0,interval:ka,attempts:Math.ceil(30),signal:Sn()});if(!X()||a.status==="aborted")return;if(a.status==="max_attempts")throw Error("KYC verification timed out");let f=await Kn();if(!X())return;if(!f)return await xn({customer:a.result});if(n==="l2"){let l=re(),c=l.context.documentVerificationAction??{type:"retry-payment",loader:"screen"};return void H({stripeSession:{...l,context:{...l.context,documentVerificationAction:c}},state:{status:"stripe-flow",step:"verify-documents"},isLoading:!1})}await sn()}catch(t){$e(t)}};let kp=({kycName:e})=>e?{given_name:e.firstName,surname:e.lastName}:{},Ip=({kycDob:e})=>e?{date_of_birth:{day:e.day,month:e.month,year:e.year}}:{},Rp=({kycRegion:e,kycSsn:t})=>e!=="eu"&&t?{id_number:{type:"us_ssn",value:t}}:{},Pp=({kycAddress:e})=>e?{address:{line1:e.addressLine1,city:e.city,...e.state?{state:e.state}:{},postal_code:e.postalCode,country:e.country}}:{},Ap=({kycRegion:e,kycNationalities:t,kycBirthCity:n,kycBirthCountry:r})=>e==="eu"?{...t?.length?{nationalities:t}:{},...n?{birth_city:n}:{},...r?{birth_country:r}:{}}:{};const _p=async e=>{let t=re(),n=t.context,r=n.kycAddress?.country;if(!(n.kycRegion!=="eu"||r&&_a.has(r)))return void $e(Error("Stripe EU onramp is not available in this country"));let o=n.kycRegion==="eu"&&r?{...e,country:r}:e;H({stripeSession:{...t,context:{...n,kycAddress:o,kycProvidedFields:[...n.kycProvidedFields??[],"address_line_1","address_city",...o.state?["address_state"]:[],"address_postal_code"]}
1}}),n.kycRegion!=="eu"?await Fr():await(async()=>{let i=re();try{let{kycName:s,kycDob:a,kycAddress:f,kycNationalities:l,kycBirthCity:c,kycBirthCountry:m}=i.context,g={...s?{given_name:s.firstName,surname:s.lastName}:{},...a?{date_of_birth:{day:a.day,month:a.month,year:a.year}}:{},...f?{address:{line1:f.addressLine1,city:f.city,...f.state?{state:f.state}:{},postal_code:f.postalCode,country:f.country}}:{},...l?.length?{nationalities:l}:{},...c?{birth_city:c}:{},...m?{birth_country:m}:{}};if(Ct("kyc"),await i.onramp.submitKycInfo(g),!X())return;let w=await va();if(!X())return;Ct(w?"collect-identifiers":wn("collect-identifiers"))}catch(s){$e(s)}})()},Tp=({day:e,month:t,year:n})=>{let r=re(),o=r.context,i=o.kycTier??"l1",s=o.kycRegion??"us",a=[...o.kycProvidedFields??[],"dob"],f=Lr(i,a,s),l={...o,kycDob:{day:e,month:t,year:n},kycProvidedFields:a},c=f?{status:"stripe-flow",step:Uo(f,l)}:void 0;H({stripeSession:{...r,context:l},...c?{state:c}:{}}),f||Fr()},Mp=({firstName:e,lastName:t})=>{let n=re(),r=n.context,o=r.kycTier??"l0",i=r.kycRegion??"us",s=[...r.kycProvidedFields??[],"first_name","last_name"],a=Lr(o,s,i),f={...r,kycName:{firstName:e,lastName:t},kycProvidedFields:s},l=a?{status:"stripe-flow",step:Uo(a,f)}:void 0;H({stripeSession:{...n,context:f},...l?{state:l}:{}}),a||Fr()},Op=e=>{let t=re(),n=t.context,r=n.kycTier??"l1",o=[...n.kycProvidedFields??[],"id_number"],i=Lr(r,o);H({stripeSession:{...t,context:{...n,kycSsn:e,kycProvidedFields:o}},...i?{state:{status:"stripe-flow",step:i}}:{}}),i||Fr()},Oa=e=>e.kycAddress?.country?e.kycAddress.country:"US",po=async e=>{let t=re();try{let n=t.context.pendingEmail;if(!n)throw Error("No email in session context");if(e==="create"){let i=t.context.config.userPhone;if(!i)return void Ct("collect-contact");let s=Oa(t.context),a=await t.onramp.registerLinkUser(n,i,s);if(!X())return;if(!a.created)throw Error("Failed to register Stripe Link account")}let r=await Ta(t.privy,{email:n,environment:t.context.config.environment});if(!X())return;if(r.status!=="created")throw Error("Failed to create Link auth intent after registration");H({stripeSession:{...t,context:{...t.context,authIntentId:r.id}},state:{status:"stripe-flow",step:"authenticating"}});let o=await Nn(t.onramp.authenticate(r.id,(i=>{X()&&(i.result==="success"&&i.crypto_customer_id?Ma(i.crypto_customer_id,r.id):$e(Error(`Link authentication ${i.result}`)))})),3e4,Sn());X()&&o&&H({stripeElement:o})}catch(n){$e(n)}},jp=e=>{let t=re(),n=t.context,r=[...n.kycProvidedFields??[],"nationalities"];H({stripeSession:{...t,context:{...n,kycNationalities:e,kycProvidedFields:r}}}),Ct(wn("collect-nationality"))},Lp=e=>{let t=re(),n=Aa([e],e.id);H({stripeSession:{...t,context:{...t.context,paymentToken:e.id,paymentMethodLabel:n}}}),Bo({paymentToken:e.id,loader:"inline"})},Fp=async e=>{let t=re();try{let n=t.context.pendingEmail;if(!n)throw Error("No email in session context");let r=Oa(t.context),o=await t.onramp.registerLinkUser(n,e,r);if(!X())return;if(!o.created)throw Error("Failed to register Stripe Link account");await po("connect")}catch(n){$e(n)}},Dp=async()=>{try{if(!X())return;let e=re(),t=e.context.stripeSessionId;if(!t)return;let n=await fo(e.privy,t);if(!X())return;let r=e.context.checkoutDetails;if(r){let o=r.currencySymbol,i={...r,quoteExpiresAt:n.quoteExpiresAt,sourceAmount:n.sourceTotalAmount??r.sourceAmount,destinationAmount:n.destinationAmount??r.destinationAmount,fee:n.fee&&o?`${o}${n.fee}`:r.fee};H({stripeConfirmCheckoutDetails:i})}}catch(e){$e(e)}},qo=({height:e=24,...t})=>d.jsxs("svg",{height:e,viewBox:"120 0 72 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[d.jsx("path",{d:"M132.258 24C138.856 24 144.205 18.6274 144.205 12C144.205 5.37257 138.856 0 132.258 0C125.66 0 120.312 5.37257 120.312 12C120.312 18.6274 125.66 24 132.258 24Z",fill:"#00D66F"}),d.jsx("path",{d:"M156.317 3.81824C156.317 2.69024 157.263 1.77344 158.377 1.77344C159.49 1.77344 160.436 2.69504 160.436 3.81824C160.436 4.94144 159.524 5.88704 158.377 5.88704C157.23 5.88704 156.317 4.97024 156.317 3.81824Z",fill:"#011E0F"}),d.jsx("path",{d:"M150.205 2.06143H153.789V22.2214H150.205V2.06143Z",fill:"#011E0F"}
1),d.jsx("path",{d:"M160.188 7.82143H156.575V22.2214H160.188V7.82143Z",fill:"#011E0F"}),d.jsx("path",{d:"M186.16 14.5319C188.879 12.8519 190.728 10.3511 191.459 7.81665H187.847C186.905 10.2359 184.745 12.0551 182.37 12.8279V2.05665H178.758V22.2167H182.37V16.2214C185.128 16.9126 187.307 19.3079 188.052 22.2167H191.689C191.134 19.1639 189.056 16.3079 186.16 14.5319Z",fill:"#011E0F"}),d.jsx("path",{d:"M166.591 9.43425C167.537 8.17185 169.382 7.43744 170.878 7.43744C173.668 7.43744 175.976 9.48705 175.981 12.5831V22.2167H172.369V13.3846C172.369 12.1126 171.805 10.6438 169.974 10.6438C167.824 10.6438 166.586 12.5591 166.586 14.8007V22.2262H162.974V7.83104H166.591V9.43425Z",fill:"#011E0F"}),d.jsx("path",{d:"M131.61 4.7998H127.958C128.668 7.80941 130.743 10.3822 133.339 11.9998C130.738 13.6174 128.668 16.1902 127.958 19.1998H131.61C132.515 16.4158 135.021 13.9966 138.1 13.5022V10.4926C135.016 10.003 132.51 7.58381 131.61 4.7998Z",fill:"#011E0F"})]});function Ko({children:e}){return d.jsx(Np,{theme:Sr()?.appearance.palette.colorScheme??"light",children:e??"You're in a sandbox environment"})}let Np=z(ds)`
2  margin: 1rem 0;
3`;const Qe=({isSandbox:e,children:t,...n})=>{let r=Ye((o=>o?.opts?.environment==="sandbox"));return e??r?d.jsxs(Wt,{...n,children:[d.jsx(Ko,{}),t]}):d.jsx(Wt,{...n,children:t})},Bt=z.div`
4  display: flex;
5  flex-direction: column;
6  gap: 0.5rem;
7  width: 100%;
8`,ot=z.input`
9  && {
10    width: 100%;
11    padding: 0.625rem 0.75rem;
12    font-family: inherit;
13    font-size: 1rem;
14    line-height: 1.5rem;
15    color: ${e=>e.$hasError?"var(--privy-color-error-dark)":"var(--privy-color-foreground)"};
16    background: var(--privy-color-background);
17    border: 1px solid
18      ${e=>e.$hasError?"var(--privy-color-border-error)":"var(--privy-color-foreground-4)"};
19    border-radius: var(--privy-border-radius-sm, 0.5rem);
20    outline: none;
21    box-sizing: border-box;
22    transition: border-color 0.15s ease;
23
24    &:focus {
25      border-color: ${e=>e.$hasError?"var(--privy-color-border-error)":"var(--privy-color-accent)"};
26      box-shadow: ${e=>e.$hasError?"none":"0 0 0 1px var(--privy-color-accent-light)"};
27    }
28
29    &::placeholder {
30      color: ${e=>e.$hasError?"var(--privy-color-error-dark)":"var(--privy-color-foreground-3)"};
31    }
32
33    @media (min-width: 441px) {
34      font-size: 0.875rem;
35    }
36  }
37`,Mt=z.p`
38  && {
39    color: var(--privy-color-error-dark);
40    font-size: 0.8125rem;
41  }
42`,Wo=z.select`
43  && {
44    width: 100%;
45    padding: 0.75rem 1rem;
46    font-size: 1rem;
47    line-height: 1.5rem;
48    color: var(--privy-color-foreground);
49    background: var(--privy-color-background);
50    border: 1px solid
51      ${e=>e.$hasError?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
52    border-radius: var(--privy-border-radius-md, 0.5rem);
53    outline: none;
54    box-sizing: border-box;
55    transition: border-color 0.15s ease;
56    appearance: none;
57    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
58    background-repeat: no-repeat;
59    background-position: right 0.75rem center;
60    padding-right: 2rem;
61
62    &:focus {
63      border-color: var(--privy-color-accent);
64      box-shadow: 0 0 0 1px var(--privy-color-accent-light);
65    }
66
67    @media (min-width: 441px) {
68      font-size: 0.875rem;
69    }
70  }
71`,mr=z.div`
72  display: flex;
73  gap: 0.5rem;
74`,Vp=z(qd)`
75  width: 100%;
76`,$p=z.div`
77  position: relative;
78  width: 100%;
79`,mo=z(rf)`
80  && {
81    width: 100%;
82    padding: 0.75rem 2.5rem 0.75rem 1rem;
83    font-family: inherit;
84    font-size: 1rem;
85    line-height: 1.5rem;
86    color: var(--privy-color-foreground);
87    background: var(--privy-color-background);
88    border: 1px solid
89      ${e=>e.$hasError?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
90    border-radius: 0.5rem;
91    outline: none;
92    box-sizing: border-box;
93    transition:
94      border-color 0.15s ease,
95      box-shadow 0.15s ease,
96      background-color 0.15s ease;
97
98    &:hover:not(:disabled) {
99      border-color: var(--privy-color-foreground-3);
100    }
101
102    &:focus {
103      border-color: var(--privy-color-accent);
104      box-shadow: 0 0 0 2px var(--privy-color-accent-light);
105    }
106
107    &::placeholder {
108      color: var(--privy-color-foreground-3);
109    }
110
111    &:disabled {
112      color: var(--privy-color-foreground-3);
113      background: var(--privy-color-background-2);
114      cursor: not-allowed;
115    }
116
117    @media (min-width: 441px) {
118      font-size: 0.875rem;
119    }
120  }
121`,Bp=z.span`
122  position: absolute;
123  top: 50%;
124  right: 0.75rem;
125  display: flex;
126  align-items: center;
127  justify-content: center;
128  width: 1.25rem;
129  height: 1.25rem;
130  color: var(--privy-color-foreground-2);
131  pointer-events: none;
132  transform: translateY(-50%);
133
134  ${mo}:focus + & {
135    color: var(--privy-color-accent);
136  }
137
138  ${mo}:disabled + & {
139    color: var(--privy-color-foreground-3);
140  }
141`,Hp=yf,Up=z(Bf)`
142  z-index: 2147483647;
143`,qp=z(Uf)`
144  width: var(--anchor-width);
145  max-height: min(16rem, var(--available-height));
146  overflow: auto;
147  padding: 0.25rem 0;
148  font-family: inherit;
149  background: var(--privy-color-background);
150  border: 1px solid var(--privy-color-foreground-4);
151  border-radius: 0.5rem;
152  box-shadow: 0 0.25rem 0.75rem rgb(0 0 0 / 8%);
153  box-sizing: border-box;
154`,Kp=z(hf)`
155  display: flex;
156  flex-direction: column;
157  gap: 0;
158`,Wp=z.span`
159  display: flex;
160  flex: 0 0 auto;
161  align-items: center;
162  justify-content: center;
163  min-width: 1.25rem;
164  color: var(--privy-color-foreground-2);
165  font-size: 0.75rem;
166  line-height: 1rem;
167`,zp=z(Gf)`
168  display: flex;
169  justify-content: space-between;
170  align-items: center;
171  gap: 0.75rem;
172  min-height: 2.125rem;
173  padding: 0 0.75rem;
174  font-family: inherit;
175  color: var(--privy-color-foreground);
176  background: transparent;
177  border: 0;
178  border-radius: 0;
179  font-size: 0.875rem;
180  font-weight: 400;
181  line-height: 1.25rem;
182  text-align: left;
183  cursor: pointer;
184  outline: none;
185  transition:
186    background-color 0.15s ease,
187    color 0.15s ease;
188
189  span {
190    font-family: inherit;
191  }
192
193  &:hover,
194  &[data-highlighted] {
195    background: var(--privy-color-background-2);
196  }
197
198  &[data-focus-visible] {
199    background: var(--privy-color-background-2);
200    box-shadow: inset 0 0 0 1px var(--privy-color-accent-light);
201  }
202
203  &[data-selected] {
204    background: transparent;
205    color: var(--privy-color-foreground);
206  }
207
208  &[data-disabled] {
209    color: var(--privy-color-foreground-3);
210    cursor: not-allowed;
211  }
212`,Yp=z.ul`
213  display: flex;
214  flex-wrap: wrap;
215  gap: 0.375rem;
216  padding: 0;
217  margin: 0.25rem 0 0;
218  list-style: none;
219`,Gp=z.li`
220  display: block;
221`,Xp=z(_l)`
222  && {
223    gap: 0.375rem;
224    width: auto;
225    height: 2rem;
226    padding: 0 0.625rem;
227    color: var(--privy-color-foreground);
228    font-size: 0.75rem;
229    line-height: 1rem;
230  }
231`;z.div`
232  display: flex;
233  flex-direction: column;
234  gap: 0.75rem;
235  width: 100%;
236  padding: 1rem;
237  background: var(--privy-color-background-2);
238  border-radius: var(--privy-border-radius-md, 0.5rem);
239`,z.div`
240  display: flex;
241  justify-content: space-between;
242  align-items: center;
243`,z.span`
244  font-size: 0.875rem;
245  color: var(--privy-color-foreground-3);
246`,z.span`
247  font-size: 0.875rem;
248  font-weight: 500;
249  color: var(--privy-color-foreground);
250`;const Qp=z.div`
251  display: flex;
252  flex-direction: column;
253  gap: 1rem;
254  width: 100%;
255  padding: 1rem 1rem 0.75rem;
256  border: 1px solid var(--privy-color-foreground-4);
257  border-radius: 0.75rem;
258`,Zp=z.div`
259  display: flex;
260  align-items: center;
261  gap: 0.75rem;
262`,Jp=z.span`
263  position: relative;
264  width: 2rem;
265  height: 2rem;
266  flex-shrink: 0;
267`,em=z.img`
268  width: 2rem;
269  height: 2rem;
270  border-radius: 100px;
271`,tm=z.img`
272  position: absolute;
273  top: -2px;
274  right: -2px;
275  width: 0.875rem;
276  height: 0.875rem;
277  border-radius: 100px;
278  border: 1.5px solid var(--privy-color-background);
279  background-color: var(--privy-color-background);
280`,ns=z.div`
281  display: flex;
282  flex-direction: column;
283  text-align: left;
284`,rs=z.span`
285  font-size: 0.75rem;
286  font-weight: 400;
287  line-height: 1.125rem;
288  color: var(--privy-color-foreground-3);
289`,os=z.span`
290  font-size: 0.875rem;
291  font-weight: 500;
292  line-height: 1.375rem;
293  color: var(--privy-color-foreground);
294`,nm=z.div`
295  display: flex;
296  flex-direction: column;
297`,Mn=z.div`
298  display: flex;
299  align-items: center;
300  justify-content: space-between;
301  padding: 0.625rem 0;
302  border-bottom: 1px solid var(--privy-color-foreground-4);
303  font-size: 0.75rem;
304  line-height: 1.125rem;
305
306  &:last-child {
307    border-bottom: none;
308  }
309`,On=z.span`
310  color: var(--privy-color-foreground);
311  font-weight: 400;
312`,ur=z.span`
313  color: var(--privy-color-foreground);
314  font-weight: 500;
315  text-align: right;
316  white-space: nowrap;
317`,rm=z.div`
318  display: inline-flex;
319  align-items: center;
320  align-self: center;
321  padding: 0.75rem 1rem;
322  border: 1px solid var(--privy-color-foreground-4);
323  border-radius: 999px;
324  color: var(--privy-color-foreground);
325  background: var(--privy-color-background);
326  font-size: 0.875rem;
327  font-weight: 500;
328  line-height: 1.25rem;
329`,om=({onClose:e,onEmailChosen:t,onEmailBack:n,userEmail:r})=>{let[o,i]=u.useState(r??""),[s,a]=u.useState(null),[f,l]=u.useState(!1),c=async()=>{let m=o.trim();if(m)if(/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m)){l(!0);try{await t?.(m)}catch{l(!1)}}else a("Enter a valid email address");else a("Email is required")};return d.jsx(Qe,{showClose:!0,onClose:e,showBack:!!n,onBack:n??void 0,icon:d.jsx(qo,{height:24}),iconVariant:"logo",title:"Add email",subtitle:"Enter your email address to continue with Link.",primaryCta:{label:"Submit",onClick:c,loading:f},watermark:!0,children:d.jsxs(Bt,{children:[d.jsx(ot,{type:"email",placeholder:"[email protected]",value:o,onChange:m=>{i(m.target.value),a(null)},onKeyDown:m=>m.key==="Enter"&&c(),$hasError:!!s,autoFocus:!0}),s&&d.jsx(Mt,{children:s})]})})};let ja={addressPlaceholder:"Street and house number",addressAriaLabel:"Street and house number",cityPlaceholder:"City",cityAriaLabel:"City",postalPlaceholder:"Postal code",postalAriaLabel:"Postal code",postalInputMode:"text",postalMaxWidth:"7rem",postalFirst:!0,missingAddressError:"Street and house number, 
329city, and postal code are required"},La={addressPlaceholder:"Street address",addressAriaLabel:"Street address",cityPlaceholder:"City",cityAriaLabel:"City",postalPlaceholder:"ZIP",postalAriaLabel:"ZIP code",postalInputMode:"numeric",postalMaxWidth:"6.25rem",postalFirst:!1,missingAddressError:"Street address, city, and ZIP are required",adminPlaceholder:"State",adminAriaLabel:"State",adminRequiredError:"State is required",adminMaxWidth:"5.5rem",adminOptions:["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY","DC"]},im={US:La,IE:{...ja,addressPlaceholder:"Street address",addressAriaLabel:"Street address",cityPlaceholder:"Town or city",cityAriaLabel:"Town or city",postalPlaceholder:"Eircode",postalAriaLabel:"Eircode",missingAddressError:"Street address, town or city, and Eircode are required",adminPlaceholder:"County",adminAriaLabel:"County",adminRequiredError:"County is required"}},sm=e=>e==="US"?"United States":Dt.find((t=>t.code===e))?.name??e;const am=({onClose:e,onAddressSubmitted:t,onBack:n})=>{let r=Ye((i=>i?.stripeSession?.context.kycRegion??"us")),o=Ye((i=>i?.stripeSession?.context.kycAddress?.country??""));return d.jsx(lm,{onClose:e,onAddressSubmitted:t,onBack:n,region:r,country:r==="eu"?o:"US"})},lm=({onClose:e,onAddressSubmitted:t,onBack:n,region:r,country:o})=>{let i=r==="eu",[s,a]=u.useState(""),[f,l]=u.useState(""),[c,m]=u.useState(""),[g,w]=u.useState(""),[S,v]=u.useState(null),[y,x]=u.useState(!1),p=((b,O)=>b!=="eu"?La:(O?im[O]:null)??ja)(r,o),h=!!p.adminPlaceholder,C=()=>{s.trim()&&f.trim()&&g.trim()?o?!h||c.trim()?(x(!0),t?.({addressLine1:s.trim(),city:f.trim(),state:c.trim(),postalCode:g.trim(),country:o})):v(p.adminRequiredError??"State is required"):v("Country is required"):v(p.missingAddressError)};return d.jsx(Qe,{showClose:!0,onClose:e,showBack:!!n,onBack:n??void 0,icon:hs,title:"Add address",subtitle:"Enter your residential address as it appears on your government-issued ID.",primaryCta:{label:"Continue",onClick:C,loading:y},watermark:!0,children:d.jsxs(Bt,{children:[d.jsx(ot,{placeholder:p.addressPlaceholder,value:s,onChange:b=>{a(b.target.value),v(null)},onKeyDown:b=>b.key==="Enter"&&C(),$hasError:!!S&&!s.trim(),autoFocus:!0,"aria-label":p.addressAriaLabel,autoComplete:"address-line1"}),i?d.jsxs(d.Fragment,{children:[d.jsxs(mr,{children:[p.postalFirst&&d.jsx(ot,{placeholder:p.postalPlaceholder,value:g,onChange:b=>{w(b.target.value),v(null)},onKeyDown:b=>b.key==="Enter"&&C(),$hasError:!!S&&!g.trim(),style:{maxWidth:p.postalMaxWidth},"aria-label":p.postalAriaLabel,autoComplete:"postal-code",inputMode:p.postalInputMode}),d.jsx(ot,{placeholder:p.cityPlaceholder,value:f,onChange:b=>{l(b.target.value),v(null)},$hasError:!!S&&!f.trim(),"aria-label":p.cityAriaLabel,autoComplete:"address-level2"}),!p.postalFirst&&d.jsx(ot,{placeholder:p.postalPlaceholder,value:g,onChange:b=>{w(b.target.value),v(null)},onKeyDown:b=>b.key==="Enter"&&C(),$hasError:!!S&&!g.trim(),style:{maxWidth:p.postalMaxWidth},"aria-label":p.postalAriaLabel,autoComplete:"postal-code",inputMode:p.postalInputMode})]}),d.jsxs(mr,{children:[p.adminPlaceholder&&d.jsx(ot,{placeholder:p.adminPlaceholder,value:c,onChange:b=>{m(b.target.value),v(null)},$hasError:!!S&&!c.trim(),"aria-label":p.adminAriaLabel??p.adminPlaceholder,autoComplete:"address-level1"}),d.jsx(ot,{value:sm(o),readOnly:!0,$hasError:!1,style:{opacity:.7},"aria-label":"Country",autoComplete:"country-name",tabIndex:-1})]})]}):d.jsxs(mr,{children:[d.jsx(ot,{placeholder:p.cityPlaceholder,value:f,onChange:b=>{l(b.target.value),v(null)},$hasError:!!S&&!f.trim(),"aria-label":p.cityAriaLabel,autoComplete:"address-level2"}),d.jsxs(Wo,{value:c,onChange:b=>{m(b.target.value),v(null)},$hasError:!!S&&!c,style:{maxWidth:p.adminMaxWidth},"aria-label":p.adminAriaLabel,autoComplete:"address-level1",children:[d.jsx("option",{value:"",disabled:!0,children:p.adminPlaceholder}),p.adminOptions?.map((b=>d.jsx("option",{value:b,children:b},b)))]}),d.jsx(ot,{placeholder:p.postalPlaceholder,value:g,onChange:b=>{w(b.target.value),v(null)},onKeyDown:b=>b.key==="Enter"&&C(),$hasError:!!S&&!g.trim(),style:{maxWidth:p.postalMaxWidth},"aria-label":p.postalAriaLabel,autoComplete:"postal-code",inputMode:p.postalInputMode})]}),S&&d.jsx(Mt,{children:S})]})})},cm=({onClose:e,onSubmit:t})=>{let[n,r]=u.useState(""),[o,i]=u.useState(""),[s,a]=u.useState(null),f=()=>{n.trim()?o?t({city:n.trim(),country:o}):a("Birth country is required"):a("Birth city is required")};return d.jsx(Qe,{showClose:!0,onClose:e,icon:hs,title:"Place of birth",subtitle:"Enter your city and country of birth.",primaryCta:{label:"Continue",onClick:f},watermark:!0,children:d.jsxs(Bt,{children:[d.jsx(ot,{placeholder:"City of birth",value:n,onChange:l=>{r(l.target.value),a(null)},onKeyDown:l=>l.key==="Enter"&&f(),$hasError:!!s&&!n.trim(),autoFocus:!0,"aria-label":"City of birth",autoComplete:"off"}),d.jsxs(Wo,{value:o,onChange:l=>{i(l.target.value),a(null)},$hasError:!!s&&!o,"aria-label":"Country of birth",autoComplete:"country",children:[d.jsx("option",{value:"",disabled:!0,children:"Select birth country"}),Dt.map((l=>d.jsx("option",{value:l.code,children:l.name},l.code)))]}),s&&d.jsx(Mt,{children:s})]})})},um=({onClose:e,onSubmit:t})=>{let[n,r]=u.useState(""),[o,i]=u.useState(null);return d.jsx(Qe,{showClose:!0,onClose:e,icon:ms,title:"Country of residence",subtitle:"Select your country of residence. This determines your verification requirements.",primaryCta:{label:"Continue",onClick:()=>{n?t(n):i("Please select your country of residence")}},watermark:!0,children:d.jsxs(Bt,{children:[d.jsxs(Wo,{value:n,onChange:s=>{r(s.target.value),i(null)},$hasError:!!o,"aria-label":"Country of residence",autoComplete:"country",children:[d.jsx("option",{value:"",disabled:!0,children:"Select country"}),Dt.map((s=>d.jsx("option",{value:s.code,children:s.name},s.code)))]}),o&&d.jsx(Mt,{children:o})]})})},dm=({onClose:e,onDobSubmitted:t,region:n="us"})=>{let[r,o]=u.useState(""),[i,s]=u.useState(null),a=n==="eu",f=()=>{let l=r.replace(/\D/g,""),c=Number.parseInt(l.slice(0,2),10),m=Number.parseInt(l.slice(2,4),10),g=Number.parseInt(l.slice(4,8),10),w=a?c:m,S=a?m:c,v=new Date(g,S-1,w),y=new Date,x=new Date(y.getFullYear()-18,y.getMonth(),y.getDate());l.length!==8||v.getFullYear()!==g||v.getMonth()!==S-1||v.getDate()!==w||g<1900||v>x?s("Enter a valid date of birth"):t?.({day:w,month:S,year:g})};return d.jsx(Qe,{showClose:!0,onClose:e,icon:nc,title:"Add date of birth",subtitle:"You must be at least 18 years old.",primaryCta:{label:"Continue",onClick:f},watermark:!0,children:d.jsxs(Bt,{children:[d.jsx(ot,{placeholder:a?"DD/MM/YYYY":"MM/DD/YYYY",value:r,onChange:l=>{o((c=>{let m=c.replace(/\D/g,"").slice(0,8);
329return[m.slice(0,2),m.slice(2,4),m.slice(4,8)].filter(Boolean).join("/")})(l.target.value)),s(null)},onKeyDown:l=>l.key==="Enter"&&f(),$hasError:!!i,inputMode:"numeric",maxLength:10,autoFocus:!0}),i&&d.jsx(Mt,{children:i})]})})},fm=({onClose:e,onSubmit:t,isSandbox:n})=>{let r=Ye((s=>s?.stripeSession?.context.kycMissingIdentifiers)),o=Ye((s=>s?.stripeSession?.context.kycMissingAlternatives)),i=Ye((s=>s?.stripeSession?.context.kycInvalidIdentifiers));return d.jsx(pm,{onClose:e,onSubmit:t,isSandbox:n,missingMica:r,alternatives:o,invalidIdentifiers:i})},pm=({onClose:e,onSubmit:t,isSandbox:n,missingMica:r,alternatives:o,invalidIdentifiers:i})=>{let[s,a]=u.useState({}),[f,l]=u.useState({}),[c,m]=u.useState(null),[g,w]=u.useState(null),[S,v]=u.useState(null),y=p=>(n?to[p]:void 0)??s[p]??"",x=p=>{let h=y(p);return n||S===p?h:h.replace(/[^\s/-]/g,"•")};return d.jsx(Qe,{showClose:!0,onClose:e,icon:sc,title:"Identity verification",subtitle:"Provide your national identity numbers.",primaryCta:{label:"Continue",onClick:()=>{let p=[];for(let C of r??[]){let b=(o??[]).find((I=>I.original_missing_identifiers.includes(C.type)))&&f[C.type]||C.type,O=y(b).trim();if(!O)return w(b),void m(`Please provide your ${fn[b]??b}`);p.push({type:b,value:O})}let h=p.find((C=>!(({type:b,value:O})=>{let I=Qf[b];return!I||I(O)})(C)));if(h)return w(h.type),void m(`Enter a valid ${fn[h.type]??h.type}`);t(p)}},watermark:!0,isSandbox:n,children:d.jsxs(Bt,{children:[(r??[]).map((p=>{let h=(o??[]).find((C=>C.original_missing_identifiers.includes(p.type)));if(h){let C=f[p.type]||p.type;return d.jsxs(mr,{children:[d.jsx("select",{value:C,onChange:b=>{l((O=>({...O,[p.type]:b.target.value}))),v(null),m(null),w(null)},style:{flex:"0 0 auto",padding:"6px"},children:[p.type,...h.alternative_missing_identifiers].map((b=>d.jsx("option",{value:b,children:fn[b]??b},b)))}),d.jsx(ot,{placeholder:fn[C]??C,value:x(C),onChange:b=>{a((O=>({...O,[C]:b.target.value}))),m(null),w(null)},onFocus:()=>v(C),onBlur:()=>v(null),readOnly:n&&!!to[C],$hasError:g===C||(i?.includes(C)??!1)})]},p.type)}return d.jsx(ot,{placeholder:fn[p.type]??p.type,value:x(p.type),onChange:C=>{a((b=>({...b,[p.type]:C.target.value}))),m(null),w(null)},onFocus:()=>v(p.type),onBlur:()=>v(null),readOnly:n&&!!to[p.type],$hasError:g===p.type||(i?.includes(p.type)??!1)},p.type)})),c&&d.jsx(Mt,{children:c}),i&&i.length>0&&d.jsxs(Mt,{children:["Invalid format for:"," ",i.map((p=>fn[p]??p)).join(", ")]})]})})},mm=({onClose:e,onNameSubmitted:t,isSandbox:n})=>{let[r,o]=u.useState(""),[i,s]=u.useState(n?"Verified":""),[a,f]=u.useState(null),l=()=>{r.trim()&&i.trim()?t?.({firstName:r.trim(),lastName:i.trim()}):f("First and last name are required")};return d.jsx(Qe,{showClose:!0,onClose:e,icon:hc,title:"Add name",subtitle:"Please enter your full legal name as it appears on your government-issued ID.",primaryCta:{label:"Continue",onClick:l},watermark:!0,isSandbox:n,children:d.jsxs(Bt,{children:[d.jsx(ot,{placeholder:"First name",value:r,onChange:c=>{o(c.target.value),f(null)},onKeyDown:c=>c.key==="Enter"&&l(),$hasError:!!a&&!r.trim(),autoFocus:!0}),d.jsx(ot,{placeholder:"Last name",value:i,onChange:c=>{s(c.target.value),f(null)},onKeyDown:c=>c.key==="Enter"&&l(),$hasError:!!a&&!i.trim(),readOnly:n}),a&&d.jsx(Mt,{children:a})]})})},hm=({onClose:e,onSubmit:t})=>{let[n,r]=u.useState([]),[o,i]=u.useState(""),[s,a]=u.useState(null),f=u.useRef(!1),l=Dt.filter((y=>!n.includes(y.code))),c=n.map((y=>Dt.find((x=>x.code===y)))).filter((y=>!!y)),m=y=>{let x=y.trim().toLowerCase();return Dt.find((p=>p.code.toLowerCase()===x||p.name.toLowerCase()===x))},g=y=>{let x=y.trim().toLowerCase();return x?Dt.filter((p=>p.code.toLowerCase().includes(x)||p.name.toLowerCase().includes(x))):Dt},w=g(o),S=w.map((y=>y.name)),v=y=>{let x=g(y),p=m(y)??(x.length===1?x[0]:void 0);p&&(r((h=>h.includes(p.code)?h:[...h,p.code])),i(""),a(null))};return d.jsx(Qe,{showClose:!0,onClose:e,icon:ms,title:"Nationality",subtitle:"Select your nationality or nationalities.",primaryCta:{label:"Continue",onClick:()=>{let y=m(o),x=y&&!n.includes(y.code)?[...n,y.code]:n;x.length?t(x):a("Please select at least one nationality")}},watermark:!0,children:d.jsxs(Bt,{children:[d.jsxs(Vp,{items:S,value:null,inputValue:o,onInputValueChange:y=>{f.current&&(f.current=!1,m(y))||i(y)},onValueChange:y=>(x=>{x&&(f.current=!0,v(x))})(typeof y=="string"?y:null),children:[d.jsxs($p,{children:[d.jsx(mo,{$hasError:!!s,"aria-label":"Nationality",autoComplete:"country",disabled:!l.length,placeholder:n.length?"Add another nationality":"Search nationality",onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),v(y.currentTarget.value))}}),d.jsx(Bp,{"aria-hidden":"true",children:d.jsx(pc,{size:18})})]}),d.jsx(Hp,{children:d.jsx(Up,{side:"bottom",sideOffset:4,collisionAvoidance:{side:"none",align:"shift",fallbackAxisSide:"none"},children:d.jsx(qp,{children:d.jsx(Kp,{children:y=>{let x=w.find((p=>p.name===y));return x?d.jsxs(zp,{value:x.name,children:[d.jsx("span",{children:x.name}),d.jsx(Wp,{children:n.includes(x.code)?d.jsx(ps,{size:16}):x.code})]},x.code):null}})})})})]}),!!c.length&&d.jsx(Yp,{"aria-label":"Selected nationalities",children:c.map((y=>d.jsx(Gp,{children:d.jsxs(Xp,{type:"button",onClick:()=>(x=>{r((p=>p.filter((h=>h!==x)))),a(null)})(y.code),"aria-label":`Remove ${y.name}`,size:"sm",children:[d.jsx("span",{children:y.name}),d.jsx(Dl,{size:14})]})},y.code)))}),s&&d.jsx(Mt,{children:s})]})})},gm=({onClose:e,onPhoneSubmitted:t,onPhoneBack:n,defaultCountry:r})=>{let o=u.useRef(null),[i,s]=u.useState(!1),[a,f]=u.useState(!1);return d.jsx(Qe,{showClose:!0,onClose:e,showBack:!!n,onBack:n??void 0,icon:d.jsx(qo,{height:24}),iconVariant:"logo",title:"Add phone number",subtitle:"Enter your phone number to continue with Link.",primaryCta:{label:"Submit",onClick:()=>
329{o.current?.isValid&&(f(!0),t?.(yi(o.current.qualifiedPhoneNumber)))},disabled:!i,loading:a},watermark:!0,children:d.jsx(Tl,{stacked:!0,noIncludeSubmitButton:!0,hideRecent:!0,defaultCountry:r,onChange:l=>{o.current=l,s(l.isValid)},onSubmit:async l=>{f(!0),t?.(yi(l.qualifiedPhoneNumber))}})})},ym=({onClose:e,onSsnSubmitted:t,appName:n,isSandbox:r})=>{let[o,i]=u.useState(r?"000-00-0000":""),[s,a]=u.useState(null),[f,l]=u.useState(!0),c=()=>{let m=o.replace(/\D/g,"");m.length===9?t?.(m):a("Enter your full 9-digit SSN")};return d.jsx(Qe,{showClose:!0,onClose:e,icon:Nl,title:"Add social security number",subtitle:`Required to verify your identity. ${n} will not store your SSN.`,primaryCta:{label:"Continue",onClick:c},watermark:!0,isSandbox:r,children:d.jsxs(Bt,{children:[d.jsx(ot,{placeholder:"XXX-XX-XXXX",value:r||f?o:o.replace(/\d/g,"•"),onChange:m=>{i((g=>{let w=g.replace(/\D/g,"").slice(0,9);return[w.slice(0,3),w.slice(3,5),w.slice(5,9)].filter(Boolean).join("-")})(m.target.value)),a(null)},onFocus:()=>l(!0),onBlur:()=>l(!1),onKeyDown:m=>m.key==="Enter"&&c(),$hasError:!!s,type:"text",inputMode:"numeric",autoComplete:"off",maxLength:11,readOnly:r,autoFocus:!0}),s&&d.jsx(Mt,{children:s})]})})},bm=({onClose:e,amount:t,appName:n,currencySymbol:r,paymentMethodLabel:o,fee:i,destinationAmount:s,destinationToken:a,destinationNetwork:f,tokenIconUrl:l,networkIconUrl:c,opts:m,onConfirmCheckout:g,quoteExpiresAt:w,onRefreshQuote:S,initialLoading:v=!1})=>{let[y,x]=u.useState(v),[p,h]=u.useState(!1),C=u.useRef(null);u.useEffect((()=>{if(!w||!S)return;let I=Math.max(w-Date.now()-1e4,0);return C.current=setTimeout((()=>{h(!0),S().finally((()=>h(!1)))}),I),()=>{C.current&&clearTimeout(C.current)}}),[w,S]);let b=m?.destination.address??"",O=gl(b,4,4);
329return d.jsx(Qe,{showClose:!0,onClose:e,title:"Approve transaction",subtitle:`${n} wants your permission for this transaction.`,primaryCta:{label:"Approve",onClick:()=>{C.current&&clearTimeout(C.current),x(!0),g?.()},loading:y,disabled:p},watermark:!0,isSandbox:m?.environment==="sandbox",children:d.jsxs(Qp,{children:[l||c?d.jsxs(Zp,{children:[d.jsxs(Jp,{children:[l&&d.jsx(em,{src:l,alt:a}),c&&d.jsx(tm,{src:c,alt:f})]}),d.jsxs(ns,{children:[d.jsx(rs,{children:"You receive"}),d.jsxs(os,{children:[s," ",a," on ",f]})]})]}):d.jsxs(ns,{children:[d.jsx(rs,{children:"You receive"}),d.jsxs(os,{children:[s," ",a," on ",f]})]}),d.jsxs(nm,{children:[d.jsxs(Mn,{children:[d.jsx(On,{children:"Total amount"}),d.jsxs(ur,{children:[r,t]})]}),o&&d.jsxs(Mn,{children:[d.jsx(On,{children:"From"}),d.jsx(ur,{children:o})]}),d.jsxs(Mn,{children:[d.jsx(On,{children:"To"}),d.jsx(Ml,{iconOnly:!0,value:b,iconSize:16,children:O})]}),d.jsxs(Mn,{children:[d.jsx(On,{children:"Estimated fee"}),d.jsx(ur,{children:i})]}),d.jsxs(Mn,{children:[d.jsx(On,{children:"Processing time"}),d.jsx(ur,{children:"Instant"})]})]})]})})},xm=({onClose:e})=>{let t=u.useRef(!1),[n,r]=u.useState(null),o=Ye((i=>i?.opts?.environment==="sandbox"));return u.useEffect((()=>{t.current||(t.current=!0,(async()=>{let i=re().onramp;try{if(!i.promptUserAttestation)throw Error("Stripe onramp promptUserAttestation is unavailable");return await i.promptUserAttestation("eu_carf",(({result:s})=>{if(X()&&s==="confirmed"){let a=re(),f=[...a.context.kycProvidedFields??[],"attestation"];H({stripeSession:{...a,context:{...a.context,kycProvidedFields:f}}}),Ct(wn("eu-attestation"))}}))}catch(s){return $e(s),null}})().then((i=>{i&&r(i)})))}),[]),n?d.jsxs(d.Fragment,{children:[o?d.jsx(Ko,{}):null,d.jsx(Ho,{element:n,minHeight:480})]}):d.jsx(Qe,{showClose:!0,onClose:e,iconVariant:"loading",title:"Loading attestation...",watermark:!0})},zo=({size:e=64,...t})=>d.jsxs("svg",{width:e,height:e,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[d.jsx("path",{d:"M32 64C49.6731 64 64 49.6731 64 32C64 14.3269 49.6731 0 32 0C14.3269 0 0 14.3269 0 32C0 49.6731 14.3269 64 32 64Z",fill:"#00D66F"}),d.jsx("path",{d:"M30.5274 12.8003H20.6587C22.5787 20.8259 28.1851 27.6867 35.1995 32.0003C28.1723 36.3139 22.5787 43.1747 20.6587 51.2003H30.5274C32.9722 43.7763 39.7435 37.3251 48.0634 36.0067V27.9811C39.7307 26.6755 32.9594 20.2243 30.5274 12.8003Z",fill:"#011E0F"})]}),is=({mode:e,onClose:t,onLinkAccountConfirmed:n,onLinkAccountBack:r,userEmail:o})=>{let i=Sr(),s=i?.name??"This app",a=e==="connect"?{title:"Connect to Link",subtitle:`${s} uses Link for quicker and easier checkout.`,description:`${s} will be able to view your Link account details, identity information, and saved payments.`,cta:"Continue"}:{title:"Create a Link account",subtitle:"With Link, you can securely save your information for faster checkout.",description:null,cta:"Continue"};return d.jsx(Qe,{showClose:!0,onClose:t,showBack:!!r,onBack:r??void 0,icon:d.jsx(zo,{size:64}),iconVariant:"logo",title:a.title,subtitle:a.subtitle,primaryCta:{label:a.cta,onClick:()=>n?.()},helpText:a.description??void 0,watermark:!0,children:e==="create"&&o&&d.jsx(rm,{children:o})})},vm=({onClose:e,tokens:t,onSelectToken:n,onAddNew:r,isLoading:o})=>{let[i,s]=u.useState(t[0]?.id??null);return d.jsx(Qe,{showClose:!0,onClose:e,icon:d.jsx(qo,{height:24}),iconVariant:"logo",title:"Select payment method",subtitle:"Choose from your saved cards. Debit cards typically have higher success rates than credit cards.",primaryCta:{label:"Continue",onClick:()=>{let a=t.find((f=>f.id===i));a&&n(a)},loading:o,disabled:!i},watermark:!0,children:d.jsx(wm,{children:d.jsxs(Sm,{children:[t.map((a=>d.jsxs(Em,{$selected:i===a.id,onClick:()=>s(a.id),disabled:o,children:[d.jsx(km,{children:d.jsx(zn,{size:16})}),d.jsxs(Im,{children:[d.jsx(Rm,{children:Cm(a.card?.brand,a.card?.funding)}),d.jsxs(Pm,{children:[d.jsx(Am,{children:"••••"})," ",a.card?.last4??""]})]})]},a.id))),d.jsxs(_m,{onClick:r,disabled:o,children:[d.jsx(dc,{size:14}),d.jsx("span",{children:"Add new card"})]})]})})})};let Cm=(e,t)=>{if(!e)return"Card";let n=e.charAt(0).toUpperCase()+e.slice(1);return t?`${n} ${t.charAt(0).toUpperCase()}${t.slice(1)}`:n},wm=z.div`
330  display: flex;
331  flex-direction: column;
332  gap: 1.5rem;
333  width: 100%;
334`,Sm=z.div`
335  display: flex;
336  flex-direction: column;
337  gap: 0.5rem;
338  width: 100%;
339`,Em=z.button`
340  && {
341    display: flex;
342    align-items: center;
343    gap: 0.75rem;
344    width: 100%;
345    padding: 0.75rem;
346    background: ${e=>e.$selected?"var(--privy-color-background-2)":"transparent"};
347    border: ${e=>e.$selected?"1.5px solid var(--privy-color-accent)":"1px solid var(--privy-color-foreground-4)"};
348    border-radius: var(--privy-border-radius-md, 0.5rem);
349    cursor: pointer;
350    transition: border-color 0.15s ease;
351    box-shadow: ${e=>e.$selected?"0px 2px 6px rgba(50, 50, 93, 0.06), 0px 1px 1.5px rgba(0, 0, 0, 0.06)":"none"};
352    outline: none;
353  }
354
355  &:disabled {
356    opacity: 0.6;
357    cursor: not-allowed;
358  }
359`,km=z.div`
360  display: flex;
361  align-items: center;
362  justify-content: center;
363  width: 1.5rem;
364  height: 1rem;
365  flex-shrink: 0;
366  color: var(--privy-color-foreground-3);
367`,Im=z.div`
368  display: flex;
369  flex-direction: column;
370  align-items: flex-start;
371  flex: 1;
372  min-width: 0;
373`,Rm=z.span`
374  font-size: 0.875rem;
375  font-weight: 400;
376  line-height: 1.125rem;
377  color: var(--privy-color-foreground);
378  letter-spacing: -0.15px;
379`,Pm=z.span`
380  font-size: 0.75rem;
381  font-weight: 400;
382  line-height: 1rem;
383  color: var(--privy-color-foreground-3);
384`,Am=z.span`
385  font-weight: 500;
386`,_m=z.button`
387  && {
388    display: flex;
389    align-items: center;
390    justify-content: center;
391    gap: 0.5rem;
392    width: 100%;
393    padding: 1rem;
394    background: none;
395    border: none;
396    font-size: 0.875rem;
397    font-weight: 500;
398    line-height: 1.25rem;
399    color: var(--privy-color-accent);
400    cursor: pointer;
401  }
402
403  &:focus,
404  &:focus-visible {
405    outline: none;
406  }
407
408  &:hover:not(:disabled) {
409    opacity: 0.8;
410  }
411
412  &:disabled {
413    opacity: 0.5;
414    cursor: not-allowed;
415  }
416`;const Tm=({element:e,isSandbox:t})=>d.jsxs(d.Fragment,{children:[t&&d.jsx(Ko,{children:"You're in a sandbox environment. Use 000-000 as the Link verification code."}),d.jsx(Ho,{element:e,minHeight:300,bleed:!0})]}),Mm=({onClose:e,onVerified:t})=>{let n=u.useRef(!1),[r,o]=u.useState(!1),i=u.useCallback((async()=>{o(!1);let s=await(async(a={})=>{let f=re();try{let l=await f.onramp.verifyDocuments();if(!X())return"inactive";if(l?.result==="abandoned")return"abandoned";Ct("kyc");let c=await go({operation:()=>zt(f.privy,{environment:f.context.config.environment}),until:m=>m.status!=="active"?!1:m.kyc_tiers?.find((w=>w.tier==="l2"))?.verification_status==="verified",delay:0,interval:ka,attempts:Math.ceil(30),signal:Sn()});if(!X()||c.status==="aborted")return"inactive";if(c.status==="max_attempts"){let m=await zt(f.privy,{environment:f.context.config.environment});if(m.status==="active"&&m.kyc_tiers?.find((w=>w.tier==="l2"))?.verification_status==="rejected")throw ba(m.kyc_tiers)?Error("Document verification was rejected. Contact Stripe support for help."):Error("Document verification was rejected. Try again.")}return(a.proceedToPayment??!0)&&await sn(),"done"}catch(l){return $e(l),"error"}})({proceedToPayment:!t});s==="abandoned"&&o(!0),s==="done"&&t?.()}),[t]);return u.useEffect((()=>{n.current||(n.current=!0,i())}),[i]),d.jsx(Qe,r?{showClose:!0,onClose:e,icon:fs,iconVariant:"error",title:"Verification canceled",subtitle:"Try again to finish identity verification.",primaryCta:{label:"Try again",onClick:i},watermark:!0}:{showClose:!0,onClose:e,iconVariant:"loading",title:"Verifying identity",subtitle:"Please complete document and selfie verification...",watermark:!0})};let Om=[];const jm=({step:e,element:t,onClose:n,isLoading:r})=>{let o=Sr(),i=o?.name??"This app",s=Ye((h=>h?.email??null)),a=Ye((h=>h?.amount??"")),f=Ye((h=>h?.opts??null)),l=Ye((h=>h?.stripeConfirmCheckoutDetails??null)),c=Ye((h=>h?.destinationCurrencyIconUrl??null)),m=Ye((h=>h?.destinationNetworkIconUrl??null)),g=Ye((h=>h?.destinationCurrencySymbol??null)),w=Ye((h=>h?.stripeSession?.context.kycAddress?.country)),S=Ye((h=>h?.stripeSession?.context.savedPaymentTokens))??Om,v=Ye((h=>h?.stripeSession?.context.documentVerificationAction)),y=Ye((h=>h?.stripeSession?.context.kycRegion??"us")),x=()=>{yo(),H({state:{status:"select-amount"},isLoading:!1})},p=v?()=>{let h=re();if((()=>{let b=re(),{documentVerificationAction:O,...I}=b.context;H({stripeSession:{...b,context:I}})})(),v.type==="retry-checkout")return void es();let C=h.context.paymentToken;C&&Bo({paymentToken:C,loader:v.loader})}:void 0;switch(e){case"choose-email":return d.jsx(om,{onClose:n,onEmailChosen:Sp,onEmailBack:x,userEmail:s});case"connect-link":return d.jsx(is,{mode:"connect",onClose:n,onLinkAccountConfirmed:()=>{po("connect")},onLinkAccountBack:x,userEmail:s});case"create-link-account":return d.jsx(is,{mode:"create",onClose:n,onLinkAccountConfirmed:()=>{po("create")},onLinkAccountBack:x,userEmail:s});case"collect-country":return d.jsx(um,{onClose:n,onSubmit:wp});case"collect-contact":return d.jsx(gm,{onClose:n,onPhoneSubmitted:Fp,onPhoneBack:x,defaultCountry:w});case"collect-name":return d.jsx(mm,{onClose:n,onNameSubmitted:Mp,isSandbox:f?.environment==="sandbox"});case"collect-dob":return d.jsx(dm,{onClose:n,onDobSubmitted:Tp,region:y}
416);case"collect-ssn":return d.jsx(ym,{onClose:n,onSsnSubmitted:Op,appName:i,isSandbox:f?.environment==="sandbox"});case"collect-address":return d.jsx(am,{onClose:n,onAddressSubmitted:_p,onBack:x});case"collect-nationality":return d.jsx(hm,{onClose:n,onSubmit:jp});case"collect-birth-location":return d.jsx(cm,{onClose:n,onSubmit:gp});case"collect-identifiers":return d.jsx(fm,{onClose:n,onSubmit:Ep,isSandbox:f?.environment==="sandbox"});case"eu-attestation":return d.jsx(xm,{onClose:n});case"verify-documents":return d.jsx(Mm,{onClose:n,onVerified:p});case"authenticating":return d.jsx(Tm,{element:t,isSandbox:f?.environment==="sandbox"});case"kyc":return d.jsx(Qe,{showClose:!0,onClose:n,iconVariant:"loading",title:"Verifying identity",subtitle:"This may take a moment...",watermark:!0,isSandbox:f?.environment==="sandbox"});case"select-payment":return d.jsx(vm,{onClose:n,tokens:S,onSelectToken:Lp,onAddNew:()=>{sn({skipTokenCheck:!0})},isLoading:r});case"payment":return d.jsx(Qe,{showClose:!0,onClose:n,showBack:!0,onBack:x,headerTitle:"Add payment method",subtitle:"Use a Visa or Mastercard. American Express and Discover are not supported.",watermark:!0,isSandbox:f?.environment==="sandbox",children:d.jsx(Ho,{element:t,minHeight:300})});case"confirm-checkout":return d.jsx(bm,{onClose:n,amount:l?.sourceAmount??a,appName:i,currencySymbol:l?.currencySymbol??"$",paymentMethodLabel:l?.paymentMethodLabel??null,fee:l?.fee??"Included",destinationAmount:l?.destinationAmount??a,destinationToken:l?.destinationToken??g??f?.destination.asset?.toUpperCase()??"",destinationNetwork:l?.destinationNetwork??"",tokenIconUrl:c,networkIconUrl:m,opts:f,onConfirmCheckout:es,quoteExpiresAt:l?.quoteExpiresAt??null,onRefreshQuote:Dp});case"checkout":return d.jsx(Qe,{showClose:!0,onClose:n,iconVariant:"loading",watermark:!0,isSandbox:f?.environment==="sandbox"});default:return null}},Lm=({onClose:e})=>d.jsx(Wt,{showClose:!0,onClose:e,iconVariant:"loading",title:"Processing transaction",subtitle:"Your purchase is in progress. You can leave this screen — we’ll notify you when it’s complete.",primaryCta:{label:"Done",onClick:e},watermark:!0});let ho={title:"Something went wrong",subtitle:"We couldn't complete your transaction. Please try again.",primaryCtaLabel:"Try again"},ss={[Kt.ONRAMP_UNSUPPORTED_INFORMATION]:{...ho,subtitle:"This payment method is not available in your region. Try another payment method."},[Kt.ONRAMP_TRANSACTION_LIMIT_REACHED]:{title:"Purchase limit reached",subtitle:"This purchase is above the current limit. Try a smaller amount.",primaryCtaLabel:"Edit amount"}};const Fm=e=>{let t=wa(e);return t&&ss[t]?ss[t]:e?.message?{...ho,subtitle:e.message}:ho},Dm=({onClose:e,onRetry:t,error:n})=>{let r=Fm(n);return d.jsx(Wt,{showClose:!0,onClose:e,icon:fs,iconVariant:"error",title:r.title,subtitle:r.subtitle,primaryCta:{label:r.primaryCtaLabel,onClick:t},secondaryCta:{label:"Close",onClick:e},watermark:!0})},Nm=({onClose:e})=>d.jsx(Wt,{showClose:!0,onClose:e,icon:ps,iconVariant:"success",title:"Transaction confirmed",subtitle:"Your purchase is processing. Funds should arrive in your wallet within a few minutes.",primaryCta:{label:"Done",onClick:e},watermark:!0});let Vm={CREDIT_DEBIT_CARD:"card",APPLE_PAY:"Apple Pay",GOOGLE_PAY:"Google Pay",BANK:"bank deposit",BANK_TRANSFER:"bank deposit",SEPA:"bank deposit",PIX:"PIX",STRIPE_LINK:"Link"},$m=e=>Vm[e]??e.replace(/_/g," ").toLowerCase().replace(/^\w/,(t=>t.toUpperCase())),Bm={CREDIT_DEBIT_CARD:d.jsx(zn,{size:14}),APPLE_PAY:d.jsx(bi,{size:14}),GOOGLE_PAY:d.jsx(bi,{size:14}),BANK:d.jsx(Br,{size:14}),BANK_TRANSFER:d.jsx(Br,{size:14}),SEPA:d.jsx(Br,{size:14}),PIX:d.jsx(Fl,{size:14}),STRIPE_LINK:d.jsx(zo,{size:14})};const Hm=({opts:e,onClose:t,onBack:n,onEditSourceAsset:r,onEditPaymentMethod:o,onContinue:i,onAmountChange:s,amount:a,selectedQuote:f,quotesWarning:l,quotesErrors:c,quotesCount:m,isLoading:g,destinationCurrencySymbol:w})=>{let S=Sr().appearance.palette.colorScheme,v=(({destinationCurrencySymbol:x})=>x??"crypto")({destinationCurrencySymbol:w});return d.jsxs(Wt,{showClose:!0,onClose:t,showBack:!!n,onBack:n,headerTitle:`Buy ${v}`,primaryCta:{label:"Continue",onClick:i,loading:g,disabled:!f},helpText:l?d.jsx(ds,{theme:S,children:d.jsx(as,{children:d.jsxs(d.Fragment,l==="amount_too_low"?{children:[d.jsx(ls,{children:"Amount too low"}),d.jsx(no,{children:"Please choose a higher amount to continue."})]}:{children:[d.jsx(ls,{children:"Unable to get quotes"}),d.jsx(no,{children:c?.[0]?.error??"Something went wrong. Please try again."})]})})}):f&&m>1?d.jsxs(qm,{onClick:o,children:[(y=f.payment_method_category??f.payment_method,Bm[y]??d.jsx(zn,{size:14})),d.jsxs("span",{children:["Pay with"," ",$m(f.payment_method_category??f.payment_method)]}),d.jsx(oc,{size:14})]}):null,watermark:!0,children:[f?.warning&&d.jsx(Um,{theme:S,children:d.jsx(as,{children:d.jsx(no,{children:f.warning})})}),d.jsx(Pl,{currency:e.source.selectedAsset,value:a,onChange:s,inputMode:"decimal",autoFocus:!0}),d.jsx(Al,{selectedAsset:e.source.selectedAsset,onEditSourceAsset:r})]});var y};let Um=z(Ol)`
417  margin-bottom: 0.75rem;
418`,as=z.div`
419  display: flex;
420  flex-direction: column;
421  gap: 0.125rem;
422  flex: 1;
423  min-width: 0;
424  font-size: 0.75rem;
425  line-height: 1.125rem;
426  color: var(--privy-color-foreground);
427  font-feature-settings:
428    'calt' 0,
429    'kern' 0;
430  text-align: left;
431`,ls=z.span`
432  font-weight: 600;
433`,no=z.span`
434  font-weight: 400;
435`,qm=z.button`
436  display: inline-flex;
437  align-items: center;
438  gap: 0.25rem;
439  background: none;
440  border: none;
441  cursor: pointer;
442
443  && {
444    padding: 0;
445    color: var(--privy-color-accent);
446    font-size: 0.875rem;
447    font-style: normal;
448    font-weight: 500;
449    line-height: 1.375rem;
450  }
451`,Km={CREDIT_DEBIT_CARD:"Credit / debit card",APPLE_PAY:"Apple Pay",GOOGLE_PAY:"Google Pay",BANK:"Bank transfer",BANK_TRANSFER:"Bank transfer",SEPA:"SEPA",PIX:"PIX",STRIPE_LINK:"Link"},Wm=e=>Km[e]??e.replace(/_/g," ").toLowerCase().replace(/^\w/,(t=>t.toUpperCase())),zm={CREDIT_DEBIT_CARD:d.jsx(zn,{size:20}),APPLE_PAY:d.jsx(Ll,{width:20,height:20}),GOOGLE_PAY:d.jsx(jl,{width:20,height:20}),BANK:d.jsx(rr,{size:20}),BANK_TRANSFER:d.jsx(rr,{size:20}),SEPA:d.jsx(rr,{size:20}),PIX:d.jsx(rr,{size:20}),STRIPE_LINK:d.jsx(zo,{size:20})},Ym=e=>zm[e]??d.jsx(zn,{size:20});const Gm=({onClose:e,onSelectPaymentMethod:t,quotes:n,isLoading:r})=>d.jsx(Wt,{showClose:!0,onClose:e,title:"Select payment method",subtitle:"Cho
451ose how you'd like to pay",watermark:!0,children:d.jsx(Xm,{children:n.map(((o,i)=>{let s=o.payment_method_category??o.payment_method;return d.jsx(Qm,{onClick:()=>t(o),disabled:r,children:d.jsxs(Zm,{children:[d.jsx(Jm,{children:Ym(s)}),d.jsx(eh,{children:d.jsx(th,{children:Wm(s)})})]})},`${o.provider}-${o.payment_method}-${i}`)}))})});let Xm=z.div`
452  display: flex;
453  flex-direction: column;
454  gap: 0.75rem;
455  width: 100%;
456`,Qm=z.button`
457  border-color: var(--privy-color-border-default);
458  border-width: 1px;
459  border-radius: var(--privy-border-radius-md);
460  border-style: solid;
461  display: flex;
462
463  && {
464    padding: 1rem;
465  }
466`,Zm=z.div`
467  display: flex;
468  align-items: center;
469  gap: 1rem;
470  width: 100%;
471`,Jm=z.div`
472  color: var(--privy-color-foreground-3);
473  display: flex;
474  align-items: center;
475  justify-content: center;
476  flex-shrink: 0;
477`,eh=z.div`
478  display: flex;
479  flex-direction: column;
480  align-items: flex-start;
481  gap: 0.125rem;
482  flex: 1;
483`,th=z.span`
484  color: var(--privy-color-foreground);
485  font-size: 0.875rem;
486  font-weight: 400;
487  line-height: 1.25rem;
488`;const nh=({onClose:e,onBack:t,onContinue:n,onAmountChange:r,onSelectSource:o,onEditSourceAsset:i,onEditPaymentMethod:s,onSelectPaymentMethod:a,onRetry:f,opts:l,state:c,amount:m,error:g,selectedQuote:w,quotesWarning:S,quotesErrors:v,destinationCurrencySymbol:y,quotesCount:x,isLoading:p,isInitialQuoteLoading:h,stripeElement:C})=>c.status==="select-amount"?h?d.jsx(Wt,{showClose:!0,onClose:e,iconVariant:"loading"}):d.jsx(Hm,{onClose:e,onBack:t,onContinue:n,onAmountChange:r,onEditSourceAsset:i,onEditPaymentMethod:s,opts:l,amount:m,selectedQuote:w,quotesWarning:S,quotesErrors:v,quotesCount:x,destinationCurrencySymbol:y,isLoading:p}):c.status==="select-source-asset"?d.jsx(Rl,{onSelectSource:o,opts:l,isLoading:p}):c.status==="select-payment-method"?d.jsx(Gm,{onClose:e,onSelectPaymentMethod:a,quotes:c.quotes,isLoading:p}):c.status==="stripe-flow"?d.jsx(jm,{step:c.step,element:C,onClose:e,isLoading:p}):c.status==="provider-confirming"?d.jsx(Lm,{onClose:e}):c.status==="provider-error"?d.jsx(Dm,{onClose:e,onRetry:f,error:g}):c.status==="provider-success"?d.jsx(Nm,{onClose:e}):null,jh={component:()=>{let{onUserCloseViaDialogOrKeybindRef:e}=fl(),t=Ye();if(!t)return null;let{opts:n,state:r,error:o,isLoading:i,amount:s,quotesWarning:a,quotesErrors:f,localQuotes:l,localSelectedQuote:c,initialQuotes:m,initialSelectedQuote:g,destinationCurrencySymbol:w,stripeElement:S,onBack:v}=t;return e.current=Qi,d.jsx(nh,{onClose:Qi,onBack:v,opts:n,state:r,error:o,isLoading:i,isInitialQuoteLoading:m==null,amount:s,selectedQuote:Sl({localQuotes:l,localSelectedQuote:c,initialSelectedQuote:g}),quotesWarning:a,quotesErrors:f,quotesCount:(l??m)?.length??0,destinationCurrencySymbol:w,onAmountChange:Xf,onContinue:cp,onSelectSource:hp,onEditSourceAsset:fp,onEditPaymentMethod:dp,onSelectPaymentMethod:mp,onRetry:pp,stripeElement:S})}};export{jh as FiatOnrampScreen,jh as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.