@gup-fe/js-sdk 2.4.0 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -258,7 +258,7 @@ Avoid returning a new reference inside your input selector, e.g.
258
258
  `));return C.cloneElement(m,d)}if(t&&typeof t=="string")return WU(t,i);throw new Error(process.env.NODE_ENV!=="production"?"Base UI: Render element or function are not defined.":vo(8))}function KU(t){const a=t.name;a.length!==0&&FU.test(a)&&QU.test(a)&&VU(`The \`render\` prop received a function named \`${a}\` that starts with an uppercase letter.`,"This usually means a React component was passed directly as `render={Component}`.","Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.","If this is an intentional render callback, rename it to start with a lowercase letter.","Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.","https://base-ui.com/r/invalid-render-prop")}function WU(t,a){return t==="button"?C.createElement("button",{type:"button",...a,key:a.key}):t==="img"?C.createElement("img",{alt:"",...a,key:a.key}):C.createElement(t,a)}let e9=(function(t){return t.frontmostHeight="--toast-frontmost-height",t})({});const T_=C.forwardRef(function(a,i){const{render:s,className:d,style:m,children:g,...y}=a,S=wC(),b=ml(),T=C.useRef(!1),R=C.useRef(!1),x=C.useRef(!1),_=S.useState("isEmpty"),A=S.useState("toasts"),z=S.useState("focused"),N=S.useState("expanded"),M=S.useState("prevFocusElement"),$=A[0]?.height??0,Y=C.useMemo(()=>A.some(k=>k.transitionStatus==="ending"),[A]);C.useEffect(()=>{const k=S.state.viewport;if(!k)return;function F(de){_||de.key==="F6"&&fo(de)!==k&&(de.preventDefault(),S.setPrevFocusElement(Ua(It(k))),k?.focus({preventScroll:!0}),S.pauseTimers(),S.setFocused(!0))}const W=Zn(k);return rn(W,"keydown",F)},[S,_]),C.useEffect(()=>{const k=S.state.viewport;if(!k||_)return;const F=Zn(k);function W(U){fo(U)===F&&(S.setIsWindowFocused(!1),S.pauseTimers())}function de(U){if(U.relatedTarget)return;const P=fo(U),te=Ua(It(k));(P===F||!Tt(k,P)||!$T(te))&&S.resumeTimers(),b.start(0,()=>S.setIsWindowFocused(!0))}return _u(rn(F,"blur",W,!0),rn(F,"focus",de,!0))},[S,b,_]),C.useEffect(()=>{const k=S.state.viewport;if(!k||_)return;const F=It(k);return rn(F,"pointerdown",S.handleDocumentPointerDown,!0)},[_,S]);function Z(k){const F=S.state.viewport;F&&(T.current=!0,k.relatedTarget===F?A[0]?.ref?.current?.focus():S.restoreFocusToPrevElement())}function V(k){k.key==="Tab"&&k.shiftKey&&fo(k.nativeEvent)===S.state.viewport&&(k.preventDefault(),S.restoreFocusToPrevElement(),S.resumeTimers())}function I(){const k=S.state.toasts.some(F=>F.transitionStatus==="ending");!S.state.isWindowFocused||k||x.current||!R.current||(S.resumeTimers(),S.setHovering(!1),R.current=!1)}C.useEffect(I,[Y,S]);function q(){S.pauseTimers(),S.setHovering(!0),R.current=!1}function J(){Y||x.current?R.current=!0:(S.resumeTimers(),S.setHovering(!1))}function he(k){k.pointerType==="touch"&&(x.current=!0)}function Q(k){k.pointerType==="touch"&&(x.current=!1,I())}function fe(){if(T.current){T.current=!1;return}z||$T(Ua(It(S.state.viewport)))&&(S.setFocused(!0),S.pauseTimers())}function re(k){!z||Tt(S.state.viewport,k.relatedTarget)||(S.setFocused(!1),S.resumeTimers())}const ce={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:q,onMouseMove:q,onMouseLeave:J,onFocus:fe,onBlur:re,onKeyDown:V,onClick:fe,onPointerDown:he,onPointerUp:Q,onPointerCancel:Q},ee={expanded:N},K=Dn("div",a,{ref:[i,S.setViewport],state:ee,props:[ce,{style:{[e9.frontmostHeight]:$?`${$}px`:void 0}},y,{children:X.jsxs(C.Fragment,{children:[!_&&M&&X.jsx(Nu,{onFocus:Z}),g,!_&&M&&X.jsx(Nu,{onFocus:Z})]})}]}),L=C.useMemo(()=>A.filter(k=>k.priority==="high"),[A]);return X.jsxs(C.Fragment,{children:[!_&&M&&X.jsx(Nu,{onFocus:Z}),K,!z&&L.length>0&&X.jsx("div",{style:AS,children:L.map(k=>X.jsxs("div",{role:"alert","aria-atomic":!0,children:[X.jsx("div",{children:k.title}),X.jsx("div",{children:k.description})]},k.id))})]})});process.env.NODE_ENV!=="production"&&(T_.displayName="ToastViewport");function zS(t){return NT(19)?t:t?"true":void 0}const i2=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(i2.displayName="ToastRootContext");function t9(){const t=C.useContext(i2);if(!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.":vo(66));return t}let zd=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const n9={[zd.startingStyle]:""},o9={[zd.endingStyle]:""},Wl={transitionStatus(t){return t==="starting"?n9:t==="ending"?o9:null}};function _s(t){return t==null?t:"current"in t?t.current:t}function R_(t,a=!1,i=!0){const s=Ly();return nt((d,m=null)=>{s.cancel();const g=_s(t);if(g==null)return;const y=g,S=()=>{Jl.flushSync(d)};if(typeof y.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){d();return}function b(){Promise.all(y.getAnimations().map(T=>T.finished)).then(()=>{m?.aborted||S()}).catch(()=>{if(i){m?.aborted||S();return}const T=y.getAnimations();!m?.aborted&&T.length>0&&T.some(R=>R.pending||R.playState!=="finished")&&b()})}if(a){const T=zd.startingStyle;if(!y.hasAttribute(T)){s.request(b);return}const R=new MutationObserver(()=>{y.hasAttribute(T)||(R.disconnect(),b())});R.observe(y,{attributes:!0,attributeFilter:[T]}),m?.addEventListener("abort",()=>R.disconnect(),{once:!0});return}s.request(b)})}function ju(t){const{enabled:a=!0,open:i,ref:s,onComplete:d}=t,m=nt(d),g=R_(s,i,!1);C.useEffect(()=>{if(!a)return;const y=new AbortController;return g(m,y.signal),()=>{y.abort()}},[a,i,m,g])}let Nd=(function(t){return t.index="--toast-index",t.offsetY="--toast-offset-y",t.height="--toast-height",t.swipeMovementX="--toast-swipe-movement-x",t.swipeMovementY="--toast-swipe-movement-y",t})({});const a9=500,r9={style:{transition:"none"}},u2="data-base-ui-click-trigger",l9="data-base-ui-swipe-ignore",i9="data-swipe-ignore",x_=`[${l9}]`,u9=`[${i9}]`,s9={fallbackAxisSide:"none"},c9={fallbackAxisSide:"end"},f9={clipPath:"inset(50%)",position:"fixed",top:0,left:0},d9={...Wl,swipeDirection(t){return t?{"data-swipe-direction":t}:null}},Zy=40,p9=10,$c=.5,h9=1,m9=`${x_},${u9}`;function O_(t,a,i){switch(t){case"up":return-i;case"down":return i;case"left":return-a;case"right":return a;default:return 0}}function g9(t){const i=Zn(t).getComputedStyle(t).transform;let s=0,d=0,m=1;if(i&&i!=="none"){const g=i.match(/matrix(?:3d)?\(([^)]+)\)/);if(g){const y=g[1].split(", ").map(parseFloat);y.length===6?(s=y[4],d=y[5],m=Math.sqrt(y[0]*y[0]+y[1]*y[1])):y.length===16&&(s=y[12],d=y[13],m=y[0])}}return{x:s,y:d,scale:m}}const C_=C.forwardRef(function(a,i){const{toast:s,render:d,className:m,swipeDirection:g=["down","right"],style:y,...S}=a,b=s.positionerProps?.anchor!==void 0;let T=[];b||(T=Array.isArray(g)?g:[g]);const R=T.length>0,x=wC(),[_,A]=C.useState(void 0),[z,N]=C.useState(!1),[M,$]=C.useState(!1),[Y,Z]=C.useState(!1),[V,I]=C.useState({x:0,y:0}),[q,J]=C.useState({x:0,y:0,scale:1}),[he,Q]=C.useState(),[fe,re]=C.useState(),[ce,ee]=C.useState(null),K=C.useRef(null),L=C.useRef({x:0,y:0}),k=C.useRef({x:0,y:0,scale:1}),F=C.useRef(void 0),W=C.useRef(0),de=C.useRef(!1),U=C.useRef({x:0,y:0}),P=C.useRef(!1),te=x.useState("toastIndex",s.id),ae=x.useState("toastVisibleIndex",s.id),Se=x.useState("toastOffsetY",s.id),Re=x.useState("focused"),Te=x.useState("expanded");ju({open:s.transitionStatus!=="ending",ref:K,onComplete(){s.transitionStatus==="ending"&&x.removeToast(s.id)}});const Me=nt((ne=!1)=>{const Ee=K.current;if(!Ee)return;const be=Ee.style.height;Ee.style.height="auto";const me=Ee.offsetHeight;Ee.style.height=be;function $e(){x.updateToastInternal(s.id,{ref:K,height:me,...s.transitionStatus==="starting"?{transitionStatus:void 0}:{}})}ne?Jl.flushSync($e):$e()});ht(Me,[Me]);function Be(ne,Ee){let be=ne,me=Ee;return!T.includes("left")&&!T.includes("right")?be=ne>0?ne**$c:-(Math.abs(ne)**$c):(!T.includes("right")&&ne>0&&(be=ne**$c),!T.includes("left")&&ne<0&&(be=-(Math.abs(ne)**$c))),!T.includes("up")&&!T.includes("down")?me=Ee>0?Ee**$c:-(Math.abs(Ee)**$c):(!T.includes("down")&&Ee>0&&(me=Ee**$c),!T.includes("up")&&Ee<0&&(me=-(Math.abs(Ee)**$c))),{x:be,y:me}}function Qe(ne){if(ne.button!==0)return;ne.pointerType==="touch"&&x.pauseTimers();const Ee=fo(ne.nativeEvent);if(!(Ee&&Ee.closest(`button,a,input,textarea,[role="button"],${m9}`))){if(de.current=!1,F.current=void 0,W.current=0,L.current={x:ne.clientX,y:ne.clientY},U.current=L.current,K.current){const me=g9(K.current);k.current=me,J(me),I({x:me.x,y:me.y})}x.setHovering(!0),N(!0),$(!1),ee(null),P.current=!0,K.current?.setPointerCapture(ne.pointerId)}}function Ae(ne){if(!z)return;ne.preventDefault(),P.current&&(L.current={x:ne.clientX,y:ne.clientY},P.current=!1);const{clientY:Ee,clientX:be,movementX:me,movementY:$e}=ne;($e<0&&Ee>U.current.y||$e>0&&Ee<U.current.y)&&(U.current={x:U.current.x,y:Ee}),(me<0&&be>U.current.x||me>0&&be<U.current.x)&&(U.current={x:be,y:U.current.y});const Pe=be-L.current.x,Xe=Ee-L.current.y,at=Ee-U.current.y,zt=be-U.current.x;if(!M&&Math.sqrt(Pe*Pe+Xe*Xe)>=h9&&($(!0),ce===null)){const Nt=T.includes("left")||T.includes("right"),Yt=T.includes("up")||T.includes("down");if(Nt&&Yt){const gn=Math.abs(Pe),H=Math.abs(Xe);ee(gn>H?"horizontal":"vertical")}}let yt;if(!F.current)ce==="vertical"?Xe>0?yt="down":Xe<0&&(yt="up"):ce==="horizontal"?Pe>0?yt="right":Pe<0&&(yt="left"):Math.abs(Pe)>=Math.abs(Xe)?yt=Pe>0?"right":"left":yt=Xe>0?"down":"up",yt&&T.includes(yt)&&(F.current=yt,W.current=O_(yt,Pe,Xe),A(yt));else{const Ot=F.current,Nt=O_(Ot,zt,at);Nt>Zy?(de.current=!1,A(Ot)):!(T.includes("left")&&T.includes("right"))&&!(T.includes("up")&&T.includes("down"))&&W.current-Nt>=p9&&(de.current=!0)}const St=Be(Pe,Xe);let Rt=k.current.x,_t=k.current.y;ce==="horizontal"?(T.includes("left")||T.includes("right"))&&(Rt+=St.x):(ce==="vertical"||(T.includes("left")||T.includes("right"))&&(Rt+=St.x),(T.includes("up")||T.includes("down"))&&(_t+=St.y)),I({x:Rt,y:_t})}function Le(ne){if(!z)return;if(N(!1),$(!1),ee(null),K.current?.releasePointerCapture(ne.pointerId),de.current){I({x:q.x,y:q.y}),A(void 0);return}let Ee=!1;const be=V.x-q.x,me=V.y-q.y;let $e;for(const Pe of T){switch(Pe){case"right":be>Zy&&(Ee=!0,$e="right");break;case"left":be<-Zy&&(Ee=!0,$e="left");break;case"down":me>Zy&&(Ee=!0,$e="down");break;case"up":me<-Zy&&(Ee=!0,$e="up");break}if(Ee)break}Ee?(A($e),Z(!0),x.closeToast(s.id)):(I({x:q.x,y:q.y}),A(void 0))}function rt(){z&&(N(!1),$(!1),ee(null),I({x:q.x,y:q.y}),A(void 0))}function ot(ne){if(ne.key==="Escape"){if(!K.current||!Tt(K.current,Ua(It(K.current))))return;x.closeToast(s.id)}}C.useEffect(()=>{if(!R)return;const ne=K.current;if(!ne)return;function Ee(be){Tt(ne,fo(be))&&be.preventDefault()}return rn(ne,"touchmove",Ee,{passive:!1})},[R]);function We(){if(!z&&V.x===q.x&&V.y===q.y&&!Y)return{[Nd.swipeMovementX]:"0px",[Nd.swipeMovementY]:"0px"};const ne=V.x-q.x,Ee=V.y-q.y;return{transition:z?"none":void 0,transform:z?`translateX(${V.x}px) translateY(${V.y}px) scale(${q.scale})`:void 0,[Nd.swipeMovementX]:`${ne}px`,[Nd.swipeMovementY]:`${Ee}px`}}const Ze=s.priority==="high",Je={role:Ze?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":he,"aria-describedby":fe,"aria-hidden":Ze&&!Re?!0:void 0,onPointerDown:R?Qe:void 0,onPointerMove:R?Ae:void 0,onPointerUp:R?Le:void 0,onPointerCancel:R?rt:void 0,onKeyDown:ot,inert:zS(s.limited),style:{...We(),[Nd.index]:s.transitionStatus==="ending"?te:ae,[Nd.offsetY]:`${Se}px`,[Nd.height]:s.height?`${s.height}px`:void 0}},ct=C.useMemo(()=>({rootRef:K,toast:s,titleId:he,setTitleId:Q,descriptionId:fe,setDescriptionId:re,swiping:z,swipeDirection:_,recalculateHeight:Me,index:te,visibleIndex:ae,expanded:Te}),[s,he,fe,z,_,Me,te,ae,Te]),tt={transitionStatus:s.transitionStatus,expanded:Te,limited:s.limited||!1,type:s.type,swiping:ct.swiping,swipeDirection:ct.swipeDirection},Ye=Dn("div",a,{ref:[i,ct.rootRef],state:tt,stateAttributesMapping:d9,props:[Je,S]});return X.jsx(i2.Provider,{value:ct,children:Ye})});process.env.NODE_ENV!=="production"&&(C_.displayName="ToastRoot");const Zh={...LO};let __=0;function y9(t,a="mui"){const[i,s]=C.useState(t),d=t||i;return C.useEffect(()=>{i==null&&(__+=1,s(`${a}-${__}`))},[i,a]),d}const A_=Zh.useId;function Xc(t,a){if(A_!==void 0){const i=A_();return t??(a?`${a}-${i}`:i)}return y9(t,a)}const D_=C.forwardRef(function(a,i){const{render:s,className:d,style:m,id:g,children:y,...S}=a,{toast:b,setDescriptionId:T}=t9(),R=y??b.description,x=!!R,_=Xc(g);ht(()=>{if(x)return T(_),()=>{T(void 0)}},[x,_,T]);const A={type:b.type},z=Dn("p",a,{ref:i,state:A,props:{...S,id:_,children:R}});return x?z:null});process.env.NODE_ENV!=="production"&&(D_.displayName="ToastDescription");let s2;process.env.NODE_ENV!=="production"&&(s2=new Set);function Ud(...t){if(process.env.NODE_ENV!=="production"){const a=t.join(" ");s2.has(a)||(s2.add(a),console.error(`Base UI: ${a}`))}}const M_=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(M_.displayName="CompositeRootContext");function v9(t=!1){const a=C.useContext(M_);if(a===void 0&&!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":vo(16));return a}function b9(t){const{focusableWhenDisabled:a,disabled:i,composite:s=!1,tabIndex:d=0,isNativeButton:m}=t,g=s&&a!==!1,y=s&&a===!1;return{props:C.useMemo(()=>{const b={onKeyDown(T){i&&a&&T.key!=="Tab"&&T.preventDefault()}};return s||(b.tabIndex=d,!m&&i&&(b.tabIndex=a?d:-1)),(m&&(a||g)||!m&&i)&&(b["aria-disabled"]=i),m&&(!a||y)&&(b.disabled=i),b},[s,i,a,g,y,m,d])}}function Ih(t={}){const{disabled:a=!1,focusableWhenDisabled:i,tabIndex:s=0,native:d=!0,composite:m}=t,g=C.useRef(null),y=v9(!0),S=m??y!==void 0,{props:b}=b9({focusableWhenDisabled:i,disabled:a,composite:S,tabIndex:s,isNativeButton:d});process.env.NODE_ENV!=="production"&&C.useEffect(()=>{if(!g.current)return;const _=NS(g.current);if(d){if(!_){const A=Zh.captureOwnerStack?.()||"";Ud(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${A}`)}}else if(_){const A=Zh.captureOwnerStack?.()||"";Ud(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${A}`)}},[d]);const T=C.useCallback(()=>{const _=g.current;NS(_)&&S&&a&&b.disabled===void 0&&_.disabled&&(_.disabled=!1)},[a,b.disabled,S]);ht(T,[T]);const R=C.useCallback((_={})=>{const{onClick:A,onMouseDown:z,onKeyUp:N,onKeyDown:M,onPointerDown:$,...Y}=_;return Uu({type:d?"button":void 0,onClick(V){if(a){V.preventDefault();return}A?.(V)},onMouseDown(V){a||z?.(V)},onKeyDown(V){if(a||(MS(V),M?.(V),V.baseUIHandlerPrevented))return;const I=V.target===V.currentTarget,q=V.currentTarget,J=NS(q),he=!d&&S9(q),Q=I&&(d?J:!he),fe=V.key==="Enter",re=V.key===" ",ce=q.getAttribute("role"),ee=ce?.startsWith("menuitem")||ce==="option"||ce==="gridcell";if(I&&S&&re){if(V.defaultPrevented&&ee)return;V.preventDefault(),he||d&&J?(q.click(),V.preventBaseUIHandler()):Q&&(A?.(V),V.preventBaseUIHandler());return}Q&&(!d&&(re||fe)&&V.preventDefault(),!d&&fe&&A?.(V))},onKeyUp(V){if(!a){if(MS(V),N?.(V),V.target===V.currentTarget&&d&&S&&NS(V.currentTarget)&&V.key===" "){V.preventDefault();return}V.baseUIHandlerPrevented||V.target===V.currentTarget&&!d&&!S&&V.key===" "&&A?.(V)}},onPointerDown(V){if(a){V.preventDefault();return}$?.(V)}},d?void 0:{role:"button"},b,Y)},[a,b,S,d]),x=nt(_=>{g.current=_,T()});return{getButtonProps:R,buttonRef:x}}function NS(t){return Wn(t)&&t.tagName==="BUTTON"}function S9(t){return!!(t?.tagName==="A"&&t?.href)}function E9(t,a){return a!=null&&!By(a)?0:typeof t=="function"?t():t}function c2(t,a,i){const s=E9(t,i);return typeof s=="number"?s:s?.[a]}function z_(t){return typeof t=="function"?t():t}function N_(t,a){return a||t==="click"||t==="mousedown"}const jd="none",$h="trigger-press",Sr="trigger-hover",f2="outside-press",d2="item-press",w9="close-press",Ld="focus-out",U_="escape-key",T9="close-watcher",p2="list-navigation",R9="cancel-open",j_="imperative-action",US="swipe",x9="window-resize";function tn(t,a,i,s){let d=!1,m=!1;const g=No;return{reason:t,event:a??new Event("base-ui"),cancel(){d=!0},allowPropagation(){m=!0},get isCanceled(){return d},get isPropagationAllowed(){return m},trigger:i,...g}}function O9(t,a,i){const s=No;return{reason:t,event:a??new Event("base-ui"),...s}}function Fo(t){const a=pa(C9,t).current;return a.next=t,ht(a.effect),a}function C9(t){const a={current:t,next:t,effect:()=>{a.current=a.next}};return a}function jS(t){return`data-base-ui-${t}`}let LS=0;function HS(t,a={}){const{preventScroll:i=!1,cancelPrevious:s=!0,sync:d=!1}=a;s&&cancelAnimationFrame(LS);const m=()=>t?.focus({preventScroll:i});if(d)return m(),Ta;const g=requestAnimationFrame(m);return LS=g,()=>{LS===g&&(cancelAnimationFrame(g),LS=0)}}const h2={inert:new WeakMap,"aria-hidden":new WeakMap},L_="data-base-ui-inert",m2={inert:new WeakSet,"aria-hidden":new WeakSet};let Iy=new WeakMap,g2=0;function _9(t){return m2[t]}function H_(t){return t?kh(t)?t.host:H_(t.parentNode):null}const y2=(t,a)=>a.map(i=>{if(t.contains(i))return i;const s=H_(i);return t.contains(s)?s:null}).filter(i=>i!=null),V_=t=>{const a=new Set;return t.forEach(i=>{let s=i;for(;s&&!a.has(s);)a.add(s),s=s.parentNode}),a},k_=(t,a,i)=>{const s=[],d=m=>{!m||i.has(m)||Array.from(m.children).forEach(g=>{ar(g)!=="script"&&(a.has(g)?d(g):s.push(g))})};return d(t),s};function A9(t,a,i,s,{mark:d=!0,markerIgnoreElements:m=[]}){const g=s?"inert":i?"aria-hidden":null;let y=null,S=null;const b=y2(a,t),T=d?y2(a,m):[],R=new Set(T),x=d?k_(a,V_(b),new Set(b)).filter(z=>!R.has(z)):[],_=[],A=[];if(g){const z=h2[g],N=_9(g);S=N,y=z;const M=y2(a,Array.from(a.querySelectorAll("[aria-live]"))),$=b.concat(M);k_(a,V_($),new Set($)).forEach(Z=>{const V=Z.getAttribute(g),I=V!==null&&V!=="false",q=(z.get(Z)||0)+1;z.set(Z,q),_.push(Z),q===1&&I&&N.add(Z),I||Z.setAttribute(g,g==="inert"?"":"true")})}return d&&x.forEach(z=>{const N=(Iy.get(z)||0)+1;Iy.set(z,N),A.push(z),N===1&&z.setAttribute(L_,"")}),g2+=1,()=>{y&&_.forEach(z=>{const M=(y.get(z)||0)-1;y.set(z,M),M||(!S?.has(z)&&g&&z.removeAttribute(g),S?.delete(z))}),d&&A.forEach(z=>{const N=(Iy.get(z)||0)-1;Iy.set(z,N),N||z.removeAttribute(L_)}),g2-=1,g2||(h2.inert=new WeakMap,h2["aria-hidden"]=new WeakMap,m2.inert=new WeakSet,m2["aria-hidden"]=new WeakSet,Iy=new WeakMap)}}function B_(t,a={}){const{ariaHidden:i=!1,inert:s=!1,mark:d=!0,markerIgnoreElements:m=[]}=a,g=It(t[0]).body;return A9(t,g,i,s,{mark:d,markerIgnoreElements:m})}const v2=C.createContext(null);process.env.NODE_ENV!=="production"&&(v2.displayName="PortalContext");const Y_=()=>C.useContext(v2),D9=jS("portal");function G_(t={}){const{ref:a,container:i,componentProps:s=No,elementProps:d}=t,m=Xc(),y=Y_()?.portalNode,[S,b]=C.useState(null),[T,R]=C.useState(null),x=nt(N=>{N!==null&&R(N)}),_=C.useRef(null);ht(()=>{if(i===null){_.current&&(_.current=null,R(null),b(null));return}if(m==null)return;const N=(i&&(jT(i)?i:i.current))??y??document.body;if(N==null){_.current&&(_.current=null,R(null),b(null));return}_.current!==N&&(_.current=N,R(null),b(N))},[i,y,m]);const A=Dn("div",s,{ref:[a,x],props:[{id:m,[D9]:""},d]});return{portalNode:T,portalSubtree:S&&A?Jl.createPortal(A,S):null}}const VS=C.forwardRef(function(a,i){const{children:s,container:d,className:m,render:g,renderGuards:y,style:S,...b}=a,{portalNode:T,portalSubtree:R}=G_({container:d,ref:i,componentProps:a,elementProps:b}),x=C.useRef(null),_=C.useRef(null),A=C.useRef(null),z=C.useRef(null),[N,M]=C.useState(null),$=C.useRef(!1),Y=N?.modal,Z=N?.open,V=typeof y=="boolean"?y:!!N&&!N.modal&&N.open&&!!T;C.useEffect(()=>{if(!T||Y)return;function q(J){T&&J.relatedTarget&&qh(J)&&(J.type==="focusin"?$.current&&(f_(T),$.current=!1):(NU(T),$.current=!0))}return _u(rn(T,"focusin",q,!0),rn(T,"focusout",q,!0))},[T,Y]),C.useEffect(()=>{!T||Z!==!1||(f_(T),$.current=!1)},[Z,T]);const I=C.useMemo(()=>({beforeOutsideRef:x,afterOutsideRef:_,beforeInsideRef:A,afterInsideRef:z,portalNode:T,setFocusManagerState:M}),[T]);return X.jsxs(C.Fragment,{children:[R,X.jsxs(v2.Provider,{value:I,children:[V&&T&&X.jsx(Nu,{"data-type":"outside",ref:x,onFocus:q=>{if(qh(q,T))A.current?.focus();else{const J=N?N.domReference:null;s_(J)?.focus()}}}),V&&T&&X.jsx("span",{"aria-owns":T.id,style:f9}),T&&Jl.createPortal(s,T),V&&T&&X.jsx(Nu,{"data-type":"outside",ref:_,onFocus:q=>{if(qh(q,T))z.current?.focus();else{const J=N?N.domReference:null;n2(J)?.focus(),N?.closeOnFocusOut&&N?.onOpenChange(!1,tn(Ld,q.nativeEvent))}}})]})]})});process.env.NODE_ENV!=="production"&&(VS.displayName="FloatingPortal");function q_(){const t=new Map;return{emit(a,i){t.get(a)?.forEach(s=>s(i))},on(a,i){t.has(a)||t.set(a,new Set),t.get(a).add(i)},off(a,i){t.get(a)?.delete(i)}}}class M9{nodesRef={current:[]};events=q_();addNode(a){this.nodesRef.current.push(a)}removeNode(a){const i=this.nodesRef.current.findIndex(s=>s===a);i!==-1&&this.nodesRef.current.splice(i,1)}}const b2=C.createContext(null);process.env.NODE_ENV!=="production"&&(b2.displayName="FloatingNodeContext");const S2=C.createContext(null);process.env.NODE_ENV!=="production"&&(S2.displayName="FloatingTreeContext");const Pc=()=>C.useContext(b2)?.id||null,Hd=t=>{const a=C.useContext(S2);return t??a};function z9(t){const a=Xc(),i=Hd(t),s=Pc();return ht(()=>{if(!a)return;const d={id:a,parentId:s};return i?.addNode(d),()=>{i?.removeNode(d)}},[i,a,s]),a}function N9(t){const{children:a,id:i}=t,s=Pc();return X.jsx(b2.Provider,{value:C.useMemo(()=>({id:i,parentId:s}),[i,s]),children:a})}function U9(t){const{children:a,externalTree:i}=t,s=pa(()=>i??new M9).current;return X.jsx(S2.Provider,{value:s,children:a})}function j9(t,a){const i=Zn(fo(t));return t instanceof i.KeyboardEvent?"keyboard":t instanceof i.FocusEvent?a||"keyboard":"pointerType"in t?t.pointerType||"keyboard":"touches"in t?"touch":t instanceof i.MouseEvent?a||(t.detail===0?"keyboard":"mouse"):""}const Z_=20;let Fc=[];function E2(){Fc=Fc.filter(t=>t.deref()?.isConnected)}function L9(t){E2(),t&&ar(t)!=="body"&&(Fc.push(new WeakRef(t)),Fc.length>Z_&&(Fc=Fc.slice(-Z_)))}function w2(){return E2(),Fc[Fc.length-1]?.deref()}function H9(t){return t?t2(t)?t:Gy(t)[0]||t:null}function I_(t,a){if(t.hasAttribute("tabindex")&&!t.hasAttribute("data-tabindex")||!a.current.includes("floating")&&!t.getAttribute("role")?.includes("dialog"))return;const s=i_(t).filter(m=>{const g=m.getAttribute("data-tabindex")||"";return t2(m)||m.hasAttribute("data-tabindex")&&!g.startsWith("-")}),d=t.getAttribute("tabindex");a.current.includes("floating")||s.length===0?d!=="0"&&t.setAttribute("tabindex","0"):(d!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}function kS(t){const{context:a,children:i,disabled:s=!1,initialFocus:d=!0,returnFocus:m=!0,restoreFocus:g=!1,modal:y=!0,closeOnFocusOut:S=!0,openInteractionType:b="",nextFocusableElement:T,previousFocusableElement:R,beforeContentFocusGuardRef:x,externalTree:_,getInsideElements:A}=t,z="rootStore"in a?a.rootStore:a,N=z.useState("open"),M=z.useState("domReferenceElement"),$=z.useState("floatingElement"),{events:Y,dataRef:Z}=z.context,V=nt(()=>Z.current.floatingContext?.nodeId),I=d===!1,q=IT(M)&&I,J=C.useRef(["content"]),he=Fo(d),Q=Fo(m),fe=Fo(b),re=Hd(_),ce=Y_(),ee=C.useRef(!1),K=C.useRef(!1),L=C.useRef(!1),k=C.useRef(null),F=C.useRef(""),W=C.useRef(""),de=C.useRef(null),U=C.useRef(null),P=Md(de,x,ce?.beforeInsideRef),te=Md(U,ce?.afterInsideRef),ae=ml(),Se=ml(),Re=Ly(),Te=ce!=null,Me=ky($),Be=nt((Le=Me)=>Le?Gy(Le):[]),Qe=nt(()=>A?.().filter(Le=>Le!=null)??[]);C.useEffect(()=>{if(s||!y)return;function Le(ot){ot.key==="Tab"&&Tt(Me,Ua(It(Me)))&&Be().length===0&&!q&&gl(ot)}const rt=It(Me);return rn(rt,"keydown",Le)},[s,M,Me,y,J,q,Be]),C.useEffect(()=>{if(s||!N)return;const Le=It(Me);function rt(){L.current=!1}function ot(Ze){const Je=fo(Ze),ct=Qe(),tt=Tt($,Je)||Tt(M,Je)||Tt(ce?.portalNode,Je)||ct.some(Ye=>Ye===Je||Tt(Ye,Je));L.current=!tt,W.current=Ze.pointerType||"keyboard",Je?.closest(`[${u2}]`)&&(K.current=!0)}function We(){W.current="keyboard"}return _u(rn(Le,"pointerdown",ot,!0),rn(Le,"pointerup",rt,!0),rn(Le,"pointercancel",rt,!0),rn(Le,"keydown",We,!0))},[s,$,M,Me,N,ce,Qe]),C.useEffect(()=>{if(s||!S)return;const Le=It(Me);function rt(){K.current=!0,Se.start(0,()=>{K.current=!1})}function ot(ct){const tt=fo(ct);t2(tt)&&(k.current=tt)}function We(ct){const tt=ct.relatedTarget,Ye=ct.currentTarget,ne=fo(ct);queueMicrotask(()=>{const Ee=V(),be=z.context.triggerElements,me=Qe(),$e=tt?.hasAttribute(jS("focus-guard"))&&[de.current,U.current,ce?.beforeInsideRef.current,ce?.afterInsideRef.current,ce?.beforeOutsideRef.current,ce?.afterOutsideRef.current,_s(R),_s(T)].includes(tt),Pe=!(Tt(M,tt)||Tt($,tt)||Tt(tt,$)||Tt(ce?.portalNode,tt)||me.some(Xe=>Xe===tt||Tt(Xe,tt))||tt!=null&&be.hasElement(tt)||be.hasMatchingElement(Xe=>Tt(Xe,tt))||$e||re&&(Du(re.nodesRef.current,Ee).find(Xe=>Tt(Xe.context?.elements.floating,tt)||Tt(Xe.context?.elements.domReference,tt))||XC(re.nodesRef.current,Ee).find(Xe=>[Xe.context?.elements.floating,ky(Xe.context?.elements.floating)].includes(tt)||Xe.context?.elements.domReference===tt)));if(Ye===M&&Me&&I_(Me,J),g&&Ye!==M&&!CS(ne)&&Ua(Le)===Le.body){if(Wn(Me)&&(Me.focus(),g==="popup")){Re.request(()=>{Me.focus()});return}const Xe=Be(),at=k.current,zt=(at&&Xe.includes(at)?at:null)||Xe[Xe.length-1]||Me;Wn(zt)&&zt.focus()}if(Z.current.insideReactTree){Z.current.insideReactTree=!1;return}(q||!y)&&tt&&Pe&&!K.current&&(q||tt!==w2())&&(ee.current=!0,z.setOpen(!1,tn(Ld,ct)))})}function Ze(){L.current||(Z.current.insideReactTree=!0,ae.start(0,()=>{Z.current.insideReactTree=!1}))}const Je=Wn(M)?M:null;if(!(!$&&!Je))return _u(Je&&rn(Je,"focusout",We),Je&&rn(Je,"pointerdown",rt),$&&rn($,"focusin",ot),$&&rn($,"focusout",We),$&&ce&&rn($,"focusout",Ze,!0))},[s,M,$,Me,y,re,ce,z,S,g,Be,q,V,J,Z,ae,Se,Re,T,R,Qe]),C.useEffect(()=>{if(s||!$||!N)return;const Le=Array.from(ce?.portalNode?.querySelectorAll(`[${jS("portal")}]`)||[]),ot=(re?XC(re.nodesRef.current,V()):[]).find(Ye=>IT(Ye.context?.elements.domReference||null))?.context?.elements.domReference,Ze=[...[$,...Le,de.current,U.current,ce?.beforeOutsideRef.current,ce?.afterOutsideRef.current,...Qe()],ot,_s(R),_s(T),q?M:null].filter(Ye=>Ye!=null),Je=B_(Ze,{ariaHidden:y||q,mark:!1}),ct=[$,...Le].filter(Ye=>Ye!=null),tt=B_(ct);return()=>{tt(),Je()}},[N,s,M,$,y,J,ce,q,re,V,T,R,Qe]),ht(()=>{if(!N||s||!Wn(Me))return;const Le=It(Me),rt=Ua(Le);queueMicrotask(()=>{const ot=he.current,We=typeof ot=="function"?ot(fe.current||""):ot;if(We===void 0||We===!1||Tt(Me,rt))return;let Je=null;const ct=()=>(Je==null&&(Je=Be(Me)),Je[0]||Me);let tt;We===!0||We===null?tt=ct():tt=_s(We),tt=tt||ct(),HS(tt,{preventScroll:tt===Me})})},[s,N,Me,I,Be,he,fe]),ht(()=>{if(s||!Me)return;const Le=It(Me),rt=Ua(Le);L9(rt);function ot(Ze){if(Ze.open||(F.current=j9(Ze.nativeEvent,W.current)),Ze.reason===Sr&&Ze.nativeEvent.type==="mouseleave"&&(ee.current=!0),Ze.reason===f2)if(Ze.nested)ee.current=!1;else if(PC(Ze.nativeEvent)||FC(Ze.nativeEvent))ee.current=!1;else{let Je=!1;It(Me).createElement("div").focus({get preventScroll(){return Je=!0,!1}}),Je?ee.current=!1:ee.current=!0}}Y.on("openchange",ot);function We(){const Ze=Q.current;let Je=typeof Ze=="function"?Ze(F.current):Ze;if(Je===void 0||Je===!1)return null;if(Je===null&&(Je=!0),typeof Je=="boolean"){const tt=M||w2();return tt&&tt.isConnected?tt:null}const ct=M||w2();return _s(Je)||ct||null}return()=>{Y.off("openchange",ot);const Ze=Ua(Le),Je=Qe(),ct=Tt($,Ze)||Je.some(ne=>ne===Ze||Tt(ne,Ze))||re&&Du(re.nodesRef.current,V(),!1).some(ne=>Tt(ne.context?.elements.floating,Ze)),tt=Q.current,Ye=We();queueMicrotask(()=>{const ne=H9(Ye),Ee=typeof tt!="boolean";tt&&!ee.current&&Wn(ne)&&(!(!Ee&&ne!==Ze&&Ze!==Le.body)||ct)&&ne.focus({preventScroll:!0}),ee.current=!1})}},[s,$,Me,Q,Z,Y,re,M,V,Qe]),ht(()=>{if(!YT||N||!$)return;const Le=Ua(It($));!Wn(Le)||!ZT(Le)||Tt($,Le)&&Le.blur()},[N,$]),ht(()=>{if(!(s||!ce))return ce.setFocusManagerState({modal:y,closeOnFocusOut:S,open:N,onOpenChange:z.setOpen,domReference:M}),()=>{ce.setFocusManagerState(null)}},[s,ce,y,N,z,S,M]),ht(()=>{if(!(s||!Me))return I_(Me,J),()=>{queueMicrotask(E2)}},[s,Me,J]);const Ae=!s&&(y?!q:!0)&&(Te||y);return X.jsxs(C.Fragment,{children:[Ae&&X.jsx(Nu,{"data-type":"inside",ref:P,onFocus:Le=>{if(y){const rt=Be();HS(rt[rt.length-1])}else ce?.portalNode&&(ee.current=!1,qh(Le,ce.portalNode)?n2(M)?.focus():_s(R??ce.beforeOutsideRef)?.focus())}}),i,Ae&&X.jsx(Nu,{"data-type":"inside",ref:te,onFocus:Le=>{y?HS(Be()[0]):ce?.portalNode&&(S&&(ee.current=!0),qh(Le,ce.portalNode)?s_(M)?.focus():_s(T??ce.afterOutsideRef)?.focus())}})]})}function T2(t,a={}){const i="rootStore"in t?t.rootStore:t,s=i.context.dataRef,{enabled:d=!0,event:m="click",toggle:g=!0,ignoreMouse:y=!1,stickIfOpen:S=!0,touchOpenDelay:b=0,reason:T=$h}=a,R=C.useRef(void 0),x=Ly(),_=ml(),A=C.useMemo(()=>({onPointerDown(z){R.current=z.pointerType},onMouseDown(z){const N=R.current,M=z.nativeEvent,$=i.select("open");if(z.button!==0||m==="click"||By(N,!0)&&y)return;const Y=s.current.openEvent,Z=Y?.type,V=i.select("domReferenceElement")!==z.currentTarget,I=$&&V||!($&&g&&(!(Y&&S)||Z==="click"||Z==="mousedown")),q=fo(M);if(ZT(q)){const he=tn(T,M,q);I&&N==="touch"&&b>0?_.start(b,()=>{i.setOpen(!0,he)}):i.setOpen(I,he);return}const J=z.currentTarget;x.request(()=>{const he=tn(T,M,J);I&&N==="touch"&&b>0?_.start(b,()=>{i.setOpen(!0,he)}):i.setOpen(I,he)})},onClick(z){if(m==="mousedown-only")return;const N=R.current;if(m==="mousedown"&&N){R.current=void 0;return}if(By(N,!0)&&y)return;const M=i.select("open"),$=s.current.openEvent,Y=i.select("domReferenceElement")!==z.currentTarget,Z=M&&Y||!(M&&g&&(!($&&S)||QC($))),V=tn(T,z.nativeEvent,z.currentTarget);Z&&N==="touch"&&b>0?_.start(b,()=>{i.setOpen(!0,V)}):i.setOpen(Z,V)},onKeyDown(){R.current=void 0}}),[s,m,y,i,S,g,x,_,b,T]);return C.useMemo(()=>d?{reference:A}:No,[d,A])}const V9={intentional:"onClick",sloppy:"onPointerDown"};function k9(){return!1}function B9(t){return{escapeKey:typeof t=="boolean"?t:t?.escapeKey??!1,outsidePress:typeof t=="boolean"?t:t?.outsidePress??!0}}function R2(t,a={}){const i="rootStore"in t?t.rootStore:t,s=i.useState("open"),d=i.useState("floatingElement"),{dataRef:m}=i.context,{enabled:g=!0,escapeKey:y=!0,outsidePress:S=!0,outsidePressEvent:b="sloppy",referencePress:T=k9,referencePressEvent:R="sloppy",bubbles:x,externalTree:_}=a,A=Hd(_),z=nt(typeof S=="function"?S:()=>!1),N=typeof S=="function"?z:S,M=N!==!1,$=nt(()=>b),Y=C.useRef(!1),Z=C.useRef(!1),V=C.useRef(!1),{escapeKey:I,outsidePress:q}=B9(x),J=C.useRef(null),he=ml(),Q=ml(),fe=nt(()=>{Q.clear(),m.current.insideReactTree=!1}),re=C.useRef(!1),ce=C.useRef(""),ee=nt(T),K=nt(U=>{if(!s||!g||!y||U.key!=="Escape"||re.current)return;const P=m.current.floatingContext?.nodeId,te=A?Du(A.nodesRef.current,P):[];if(!I&&te.length>0){let Re=!0;if(te.forEach(Te=>{Te.context?.open&&!Te.context.dataRef.current.__escapeKeyBubbles&&(Re=!1)}),!Re)return}const ae=fU(U)?U.nativeEvent:U,Se=tn(U_,ae);i.setOpen(!1,Se),!I&&!Se.isPropagationAllowed&&U.stopPropagation()}),L=nt(()=>{m.current.insideReactTree=!0,Q.start(0,fe)});C.useEffect(()=>{if(!s||!g)return;m.current.__escapeKeyBubbles=I,m.current.__outsidePressBubbles=q;const U=new hl,P=new hl;function te(){U.clear(),re.current=!0}function ae(){U.start(vS()?5:0,()=>{re.current=!1})}function Se(){V.current=!0,P.start(0,()=>{V.current=!1})}function Re(){Y.current=!1,Z.current=!1}function Te(){const be=ce.current,me=be==="pen"||!be?"mouse":be,$e=$(),Pe=typeof $e=="function"?$e():$e;return typeof Pe=="string"?Pe:Pe[me]}function Me(be){const me=Te();return me==="intentional"&&be.type!=="click"||me==="sloppy"&&be.type==="click"}function Be(be){const me=m.current.floatingContext?.nodeId,$e=A&&Du(A.nodesRef.current,me).some(Pe=>Xi(be,Pe.context?.elements.floating));return Xi(be,i.select("floatingElement"))||Xi(be,i.select("domReferenceElement"))||$e}function Qe(be){if(Me(be)){fe();return}if(m.current.insideReactTree){fe();return}const me=fo(be),$e=`[${jS("inert")}]`,Pe=dn(me)?me.getRootNode():null,Xe=Array.from((kh(Pe)?Pe:It(i.select("floatingElement"))).querySelectorAll($e)),at=i.context.triggerElements;if(me&&(at.hasElement(me)||at.hasMatchingElement(Rt=>Tt(Rt,me))))return;let zt=dn(me)?me:null;for(;zt&&!xs(zt);){const Rt=Os(zt);if(xs(Rt)||!dn(Rt))break;zt=Rt}if(Xe.length&&dn(me)&&!sU(me)&&!Tt(me,i.select("floatingElement"))&&Xe.every(Rt=>!Tt(zt,Rt)))return;if(Wn(me)&&!("touches"in be)){const Rt=xs(me),_t=vr(me),Ot=/auto|scroll/,Nt=Rt||Ot.test(_t.overflowX),Yt=Rt||Ot.test(_t.overflowY),gn=Nt&&me.clientWidth>0&&me.scrollWidth>me.clientWidth,H=Yt&&me.clientHeight>0&&me.scrollHeight>me.clientHeight,le=_t.direction==="rtl",ze=H&&(le?be.offsetX<=me.offsetWidth-me.clientWidth:be.offsetX>me.clientWidth),He=gn&&be.offsetY>me.clientHeight;if(ze||He)return}if(Be(be))return;if(Te()==="intentional"&&V.current){P.clear(),V.current=!1;return}if(typeof N=="function"&&!N(be))return;const yt=m.current.floatingContext?.nodeId,St=A?Du(A.nodesRef.current,yt):[];if(St.length>0){let Rt=!0;if(St.forEach(_t=>{_t.context?.open&&!_t.context.dataRef.current.__outsidePressBubbles&&(Rt=!1)}),!Rt)return}i.setOpen(!1,tn(f2,be)),fe()}function Ae(be){Te()!=="sloppy"||be.pointerType==="touch"||!i.select("open")||!g||Xi(be,i.select("floatingElement"))||Xi(be,i.select("domReferenceElement"))||Qe(be)}function Le(be){if(Te()!=="sloppy"||!i.select("open")||!g||Xi(be,i.select("floatingElement"))||Xi(be,i.select("domReferenceElement")))return;const me=be.touches[0];me&&(J.current={startTime:Date.now(),startX:me.clientX,startY:me.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},he.start(1e3,()=>{J.current&&(J.current.dismissOnTouchEnd=!1,J.current.dismissOnMouseDown=!1)}))}function rt(be,me){const $e=fo(be);if(!$e)return;const Pe=rn($e,be.type,()=>{me(be),Pe()})}function ot(be){ce.current="touch",rt(be,Le)}function We(be){he.clear(),be.type==="pointerdown"&&(ce.current=be.pointerType),!(be.type==="mousedown"&&J.current&&!J.current.dismissOnMouseDown)&&rt(be,me=>{me.type==="pointerdown"?Ae(me):Qe(me)})}function Ze(be){if(!Y.current)return;const me=Z.current;if(Re(),Te()==="intentional"){if(be.type==="pointercancel"){me&&Se();return}if(!Be(be)){if(me){Se();return}typeof N=="function"&&!N(be)||(P.clear(),V.current=!0,fe())}}}function Je(be){if(Te()!=="sloppy"||!J.current||Xi(be,i.select("floatingElement"))||Xi(be,i.select("domReferenceElement")))return;const me=be.touches[0];if(!me)return;const $e=Math.abs(me.clientX-J.current.startX),Pe=Math.abs(me.clientY-J.current.startY),Xe=Math.sqrt($e*$e+Pe*Pe);Xe>5&&(J.current.dismissOnTouchEnd=!0),Xe>10&&(Qe(be),he.clear(),J.current=null)}function ct(be){rt(be,Je)}function tt(be){Te()!=="sloppy"||!J.current||Xi(be,i.select("floatingElement"))||Xi(be,i.select("domReferenceElement"))||(J.current.dismissOnTouchEnd&&Qe(be),he.clear(),J.current=null)}function Ye(be){rt(be,tt)}const ne=It(d),Ee=_u(y&&_u(rn(ne,"keydown",K),rn(ne,"compositionstart",te),rn(ne,"compositionend",ae)),M&&_u(rn(ne,"click",We,!0),rn(ne,"pointerdown",We,!0),rn(ne,"pointerup",Ze,!0),rn(ne,"pointercancel",Ze,!0),rn(ne,"mousedown",We,!0),rn(ne,"mouseup",Ze,!0),rn(ne,"touchstart",ot,!0),rn(ne,"touchmove",ct,!0),rn(ne,"touchend",Ye,!0)));return()=>{Ee(),U.clear(),P.clear(),Re(),V.current=!1}},[m,d,y,M,N,s,g,I,q,K,fe,$,A,i,he]),C.useEffect(fe,[N,fe]);const k=C.useMemo(()=>({onKeyDown:K,[V9[R]]:U=>{ee()&&i.setOpen(!1,tn($h,U.nativeEvent))},...R!=="intentional"&&{onClick(U){ee()&&i.setOpen(!1,tn($h,U.nativeEvent))}}}),[K,i,R,ee]),F=nt(U=>{if(!s||!g||U.button!==0)return;const P=fo(U.nativeEvent);Tt(i.select("floatingElement"),P)&&(Y.current||(Y.current=!0,Z.current=!1))}),W=nt(U=>{!s||!g||(U.defaultPrevented||U.nativeEvent.defaultPrevented)&&Y.current&&(Z.current=!0)}),de=C.useMemo(()=>({onKeyDown:K,onPointerDown:W,onMouseDown:W,onClickCapture:L,onMouseDownCapture(U){L(),F(U)},onPointerDownCapture(U){L(),F(U)},onMouseUpCapture:L,onTouchEndCapture:L,onTouchMoveCapture:L}),[K,L,F,W]);return C.useMemo(()=>g?{reference:k,floating:de,trigger:k}:{},[g,k,de])}function $_(t,a,i){let{reference:s,floating:d}=t;const m=Kl(a),g=QT(a),y=FT(g),S=Pr(a),b=m==="y",T=s.x+s.width/2-d.width/2,R=s.y+s.height/2-d.height/2,x=s[y]/2-d[y]/2;let _;switch(S){case"top":_={x:T,y:s.y-d.height};break;case"bottom":_={x:T,y:s.y+s.height};break;case"right":_={x:s.x+s.width,y:R};break;case"left":_={x:s.x-d.width,y:R};break;default:_={x:s.x,y:s.y}}switch(Ic(a)){case"start":_[g]-=x*(i&&b?-1:1);break;case"end":_[g]+=x*(i&&b?-1:1);break}return _}async function Y9(t,a){var i;a===void 0&&(a={});const{x:s,y:d,platform:m,rects:g,elements:y,strategy:S}=t,{boundary:b="clippingAncestors",rootBoundary:T="viewport",elementContext:R="floating",altBoundary:x=!1,padding:_=0}=Cs(a,t),A=WC(_),N=y[x?R==="floating"?"reference":"floating":R],M=Yy(await m.getClippingRect({element:(i=await(m.isElement==null?void 0:m.isElement(N)))==null||i?N:N.contextElement||await(m.getDocumentElement==null?void 0:m.getDocumentElement(y.floating)),boundary:b,rootBoundary:T,strategy:S})),$=R==="floating"?{x:s,y:d,width:g.floating.width,height:g.floating.height}:g.reference,Y=await(m.getOffsetParent==null?void 0:m.getOffsetParent(y.floating)),Z=await(m.isElement==null?void 0:m.isElement(Y))?await(m.getScale==null?void 0:m.getScale(Y))||{x:1,y:1}:{x:1,y:1},V=Yy(m.convertOffsetParentRelativeRectToViewportRelativeRect?await m.convertOffsetParentRelativeRectToViewportRelativeRect({elements:y,rect:$,offsetParent:Y,strategy:S}):$);return{top:(M.top-V.top+A.top)/Z.y,bottom:(V.bottom-M.bottom+A.bottom)/Z.y,left:(M.left-V.left+A.left)/Z.x,right:(V.right-M.right+A.right)/Z.x}}const G9=50,q9=async(t,a,i)=>{const{placement:s="bottom",strategy:d="absolute",middleware:m=[],platform:g}=i,y=g.detectOverflow?g:{...g,detectOverflow:Y9},S=await(g.isRTL==null?void 0:g.isRTL(a));let b=await g.getElementRects({reference:t,floating:a,strategy:d}),{x:T,y:R}=$_(b,s,S),x=s,_=0;const A={};for(let z=0;z<m.length;z++){const N=m[z];if(!N)continue;const{name:M,fn:$}=N,{x:Y,y:Z,data:V,reset:I}=await $({x:T,y:R,initialPlacement:s,placement:x,strategy:d,middlewareData:A,rects:b,platform:y,elements:{reference:t,floating:a}});T=Y??T,R=Z??R,A[M]={...A[M],...V},I&&_<G9&&(_++,typeof I=="object"&&(I.placement&&(x=I.placement),I.rects&&(b=I.rects===!0?await g.getElementRects({reference:t,floating:a,strategy:d}):I.rects),{x:T,y:R}=$_(b,x,S)),z=-1)}return{x:T,y:R,placement:x,strategy:d,middlewareData:A}},Z9=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(a){var i,s;const{placement:d,middlewareData:m,rects:g,initialPlacement:y,platform:S,elements:b}=a,{mainAxis:T=!0,crossAxis:R=!0,fallbackPlacements:x,fallbackStrategy:_="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:z=!0,...N}=Cs(t,a);if((i=m.arrow)!=null&&i.alignmentOffset)return{};const M=Pr(d),$=Kl(y),Y=Pr(y)===y,Z=await(S.isRTL==null?void 0:S.isRTL(b.floating)),V=x||(Y||!z?[RS(y)]:mU(y)),I=A!=="none";!x&&I&&V.push(...bU(y,z,A,Z));const q=[y,...V],J=await S.detectOverflow(a,N),he=[];let Q=((s=m.flip)==null?void 0:s.overflows)||[];if(T&&he.push(J[M]),R){const ee=hU(d,g,Z);he.push(J[ee[0]],J[ee[1]])}if(Q=[...Q,{placement:d,overflows:he}],!he.every(ee=>ee<=0)){var fe,re;const ee=(((fe=m.flip)==null?void 0:fe.index)||0)+1,K=q[ee];if(K&&(!(R==="alignment"?$!==Kl(K):!1)||Q.every(F=>Kl(F.placement)===$?F.overflows[0]>0:!0)))return{data:{index:ee,overflows:Q},reset:{placement:K}};let L=(re=Q.filter(k=>k.overflows[0]<=0).sort((k,F)=>k.overflows[1]-F.overflows[1])[0])==null?void 0:re.placement;if(!L)switch(_){case"bestFit":{var ce;const k=(ce=Q.filter(F=>{if(I){const W=Kl(F.placement);return W===$||W==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(W=>W>0).reduce((W,de)=>W+de,0)]).sort((F,W)=>F[1]-W[1])[0])==null?void 0:ce[0];k&&(L=k);break}case"initialPlacement":L=y;break}if(d!==L)return{reset:{placement:L}}}return{}}}};function X_(t,a){return{top:t.top-a.height,right:t.right-a.width,bottom:t.bottom-a.height,left:t.left-a.width}}function P_(t){return dU.some(a=>t[a]>=0)}const I9=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(a){const{rects:i,platform:s}=a,{strategy:d="referenceHidden",...m}=Cs(t,a);switch(d){case"referenceHidden":{const g=await s.detectOverflow(a,{...m,elementContext:"reference"}),y=X_(g,i.reference);return{data:{referenceHiddenOffsets:y,referenceHidden:P_(y)}}}case"escaped":{const g=await s.detectOverflow(a,{...m,altBoundary:!0}),y=X_(g,i.floating);return{data:{escapedOffsets:y,escaped:P_(y)}}}default:return{}}}}},F_=new Set(["left","top"]);async function $9(t,a){const{placement:i,platform:s,elements:d}=t,m=await(s.isRTL==null?void 0:s.isRTL(d.floating)),g=Pr(i),y=Ic(i),S=Kl(i)==="y",b=F_.has(g)?-1:1,T=m&&S?-1:1,R=Cs(a,t);let{mainAxis:x,crossAxis:_,alignmentAxis:A}=typeof R=="number"?{mainAxis:R,crossAxis:0,alignmentAxis:null}:{mainAxis:R.mainAxis||0,crossAxis:R.crossAxis||0,alignmentAxis:R.alignmentAxis};return y&&typeof A=="number"&&(_=y==="end"?A*-1:A),S?{x:_*T,y:x*b}:{x:x*b,y:_*T}}const X9=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(a){var i,s;const{x:d,y:m,placement:g,middlewareData:y}=a,S=await $9(a,t);return g===((i=y.offset)==null?void 0:i.placement)&&(s=y.arrow)!=null&&s.alignmentOffset?{}:{x:d+S.x,y:m+S.y,data:{...S,placement:g}}}}},P9=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(a){const{x:i,y:s,placement:d,platform:m}=a,{mainAxis:g=!0,crossAxis:y=!1,limiter:S={fn:M=>{let{x:$,y:Y}=M;return{x:$,y:Y}}},...b}=Cs(t,a),T={x:i,y:s},R=await m.detectOverflow(a,b),x=Kl(Pr(d)),_=PT(x);let A=T[_],z=T[x];if(g){const M=_==="y"?"top":"left",$=_==="y"?"bottom":"right",Y=A+R[M],Z=A-R[$];A=XT(Y,A,Z)}if(y){const M=x==="y"?"top":"left",$=x==="y"?"bottom":"right",Y=z+R[M],Z=z-R[$];z=XT(Y,z,Z)}const N=S.fn({...a,[_]:A,[x]:z});return{...N,data:{x:N.x-i,y:N.y-s,enabled:{[_]:g,[x]:y}}}}}},F9=function(t){return t===void 0&&(t={}),{options:t,fn(a){const{x:i,y:s,placement:d,rects:m,middlewareData:g}=a,{offset:y=0,mainAxis:S=!0,crossAxis:b=!0}=Cs(t,a),T={x:i,y:s},R=Kl(d),x=PT(R);let _=T[x],A=T[R];const z=Cs(y,a),N=typeof z=="number"?{mainAxis:z,crossAxis:0}:{mainAxis:0,crossAxis:0,...z};if(S){const Y=x==="y"?"height":"width",Z=m.reference[x]-m.floating[Y]+N.mainAxis,V=m.reference[x]+m.reference[Y]-N.mainAxis;_<Z?_=Z:_>V&&(_=V)}if(b){var M,$;const Y=x==="y"?"width":"height",Z=F_.has(Pr(d)),V=m.reference[R]-m.floating[Y]+(Z&&((M=g.offset)==null?void 0:M[R])||0)+(Z?0:N.crossAxis),I=m.reference[R]+m.reference[Y]+(Z?0:(($=g.offset)==null?void 0:$[R])||0)-(Z?N.crossAxis:0);A<V?A=V:A>I&&(A=I)}return{[x]:_,[R]:A}}}},Q9=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(a){var i,s;const{placement:d,rects:m,platform:g,elements:y}=a,{apply:S=()=>{},...b}=Cs(t,a),T=await g.detectOverflow(a,b),R=Pr(d),x=Ic(d),_=Kl(d)==="y",{width:A,height:z}=m.floating;let N,M;R==="top"||R==="bottom"?(N=R,M=x===(await(g.isRTL==null?void 0:g.isRTL(y.floating))?"start":"end")?"left":"right"):(M=R,N=x==="end"?"top":"bottom");const $=z-T.top-T.bottom,Y=A-T.left-T.right,Z=Yh(z-T[N],$),V=Yh(A-T[M],Y),I=!a.middlewareData.shift;let q=Z,J=V;if((i=a.middlewareData.shift)!=null&&i.enabled.x&&(J=Y),(s=a.middlewareData.shift)!=null&&s.enabled.y&&(q=$),I&&!x){const Q=yl(T.left,0),fe=yl(T.right,0),re=yl(T.top,0),ce=yl(T.bottom,0);_?J=A-2*(Q!==0||fe!==0?Q+fe:yl(T.left,T.right)):q=z-2*(re!==0||ce!==0?re+ce:yl(T.top,T.bottom))}await S({...a,availableWidth:J,availableHeight:q});const he=await g.getDimensions(y.floating);return A!==he.width||z!==he.height?{reset:{rects:!0}}:{}}}};function Q_(t){const a=vr(t);let i=parseFloat(a.width)||0,s=parseFloat(a.height)||0;const d=Wn(t),m=d?t.offsetWidth:i,g=d?t.offsetHeight:s,y=TS(i)!==m||TS(s)!==g;return y&&(i=m,s=g),{width:i,height:s,$:y}}function x2(t){return dn(t)?t:t.contextElement}function Xh(t){const a=x2(t);if(!Wn(a))return Mu(1);const i=a.getBoundingClientRect(),{width:s,height:d,$:m}=Q_(a);let g=(m?TS(i.width):i.width)/s,y=(m?TS(i.height):i.height)/d;return(!g||!Number.isFinite(g))&&(g=1),(!y||!Number.isFinite(y))&&(y=1),{x:g,y}}const J9=Mu(0);function J_(t){const a=Zn(t);return!vS()||!a.visualViewport?J9:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function K9(t,a,i){return a===void 0&&(a=!1),!i||a&&i!==Zn(t)?!1:a}function Vd(t,a,i,s){a===void 0&&(a=!1),i===void 0&&(i=!1);const d=t.getBoundingClientRect(),m=x2(t);let g=Mu(1);a&&(s?dn(s)&&(g=Xh(s)):g=Xh(t));const y=K9(m,i,s)?J_(m):Mu(0);let S=(d.left+y.x)/g.x,b=(d.top+y.y)/g.y,T=d.width/g.x,R=d.height/g.y;if(m){const x=Zn(m),_=s&&dn(s)?Zn(s):s;let A=x,z=VT(A);for(;z&&s&&_!==A;){const N=Xh(z),M=z.getBoundingClientRect(),$=vr(z),Y=M.left+(z.clientLeft+parseFloat($.paddingLeft))*N.x,Z=M.top+(z.clientTop+parseFloat($.paddingTop))*N.y;S*=N.x,b*=N.y,T*=N.x,R*=N.y,S+=Y,b+=Z,A=Zn(z),z=VT(A)}}return Yy({width:T,height:R,x:S,y:b})}function BS(t,a){const i=bS(t).scrollLeft;return a?a.left+i:Vd(Cu(t)).left+i}function K_(t,a){const i=t.getBoundingClientRect(),s=i.left+a.scrollLeft-BS(t,i),d=i.top+a.scrollTop;return{x:s,y:d}}function W9(t){let{elements:a,rect:i,offsetParent:s,strategy:d}=t;const m=d==="fixed",g=Cu(s),y=a?yS(a.floating):!1;if(s===g||y&&m)return i;let S={scrollLeft:0,scrollTop:0},b=Mu(1);const T=Mu(0),R=Wn(s);if((R||!R&&!m)&&((ar(s)!=="body"||Gc(g))&&(S=bS(s)),R)){const _=Vd(s);b=Xh(s),T.x=_.x+s.clientLeft,T.y=_.y+s.clientTop}const x=g&&!R&&!m?K_(g,S):Mu(0);return{width:i.width*b.x,height:i.height*b.y,x:i.x*b.x-S.scrollLeft*b.x+T.x+x.x,y:i.y*b.y-S.scrollTop*b.y+T.y+x.y}}function ej(t){return Array.from(t.getClientRects())}function tj(t){const a=Cu(t),i=bS(t),s=t.ownerDocument.body,d=yl(a.scrollWidth,a.clientWidth,s.scrollWidth,s.clientWidth),m=yl(a.scrollHeight,a.clientHeight,s.scrollHeight,s.clientHeight);let g=-i.scrollLeft+BS(t);const y=-i.scrollTop;return vr(s).direction==="rtl"&&(g+=yl(a.clientWidth,s.clientWidth)-d),{width:d,height:m,x:g,y}}const W_=25;function nj(t,a){const i=Zn(t),s=Cu(t),d=i.visualViewport;let m=s.clientWidth,g=s.clientHeight,y=0,S=0;if(d){m=d.width,g=d.height;const T=vS();(!T||T&&a==="fixed")&&(y=d.offsetLeft,S=d.offsetTop)}const b=BS(s);if(b<=0){const T=s.ownerDocument,R=T.body,x=getComputedStyle(R),_=T.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,A=Math.abs(s.clientWidth-R.clientWidth-_);A<=W_&&(m-=A)}else b<=W_&&(m+=b);return{width:m,height:g,x:y,y:S}}function oj(t,a){const i=Vd(t,!0,a==="fixed"),s=i.top+t.clientTop,d=i.left+t.clientLeft,m=Wn(t)?Xh(t):Mu(1),g=t.clientWidth*m.x,y=t.clientHeight*m.y,S=d*m.x,b=s*m.y;return{width:g,height:y,x:S,y:b}}function eA(t,a,i){let s;if(a==="viewport")s=nj(t,i);else if(a==="document")s=tj(Cu(t));else if(dn(a))s=oj(a,i);else{const d=J_(t);s={x:a.x-d.x,y:a.y-d.y,width:a.width,height:a.height}}return Yy(s)}function tA(t,a){const i=Os(t);return i===a||!dn(i)||xs(i)?!1:vr(i).position==="fixed"||tA(i,a)}function aj(t,a){const i=a.get(t);if(i)return i;let s=jy(t,[],!1).filter(y=>dn(y)&&ar(y)!=="body"),d=null;const m=vr(t).position==="fixed";let g=m?Os(t):t;for(;dn(g)&&!xs(g);){const y=vr(g),S=HT(g);!S&&y.position==="fixed"&&(d=null),(m?!S&&!d:!S&&y.position==="static"&&!!d&&(d.position==="absolute"||d.position==="fixed")||Gc(g)&&!S&&tA(t,g))?s=s.filter(T=>T!==g):d=y,g=Os(g)}return a.set(t,s),s}function rj(t){let{element:a,boundary:i,rootBoundary:s,strategy:d}=t;const g=[...i==="clippingAncestors"?yS(a)?[]:aj(a,this._c):[].concat(i),s],y=eA(a,g[0],d);let S=y.top,b=y.right,T=y.bottom,R=y.left;for(let x=1;x<g.length;x++){const _=eA(a,g[x],d);S=yl(_.top,S),b=Yh(_.right,b),T=Yh(_.bottom,T),R=yl(_.left,R)}return{width:b-R,height:T-S,x:R,y:S}}function lj(t){const{width:a,height:i}=Q_(t);return{width:a,height:i}}function ij(t,a,i){const s=Wn(a),d=Cu(a),m=i==="fixed",g=Vd(t,!0,m,a);let y={scrollLeft:0,scrollTop:0};const S=Mu(0);function b(){S.x=BS(d)}if(s||!s&&!m)if((ar(a)!=="body"||Gc(d))&&(y=bS(a)),s){const _=Vd(a,!0,m,a);S.x=_.x+a.clientLeft,S.y=_.y+a.clientTop}else d&&b();m&&!s&&d&&b();const T=d&&!s&&!m?K_(d,y):Mu(0),R=g.left+y.scrollLeft-S.x-T.x,x=g.top+y.scrollTop-S.y-T.y;return{x:R,y:x,width:g.width,height:g.height}}function O2(t){return vr(t).position==="static"}function nA(t,a){if(!Wn(t)||vr(t).position==="fixed")return null;if(a)return a(t);let i=t.offsetParent;return Cu(t)===i&&(i=i.ownerDocument.body),i}function oA(t,a){const i=Zn(t);if(yS(t))return i;if(!Wn(t)){let d=Os(t);for(;d&&!xs(d);){if(dn(d)&&!O2(d))return d;d=Os(d)}return i}let s=nA(t,a);for(;s&&W8(s)&&O2(s);)s=nA(s,a);return s&&xs(s)&&O2(s)&&!HT(s)?i:s||nU(t)||i}const uj=async function(t){const a=this.getOffsetParent||oA,i=this.getDimensions,s=await i(t.floating);return{reference:ij(t.reference,await a(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function sj(t){return vr(t).direction==="rtl"}const aA={convertOffsetParentRelativeRectToViewportRelativeRect:W9,getDocumentElement:Cu,getClippingRect:rj,getOffsetParent:oA,getElementRects:uj,getClientRects:ej,getDimensions:lj,getScale:Xh,isElement:dn,isRTL:sj};function rA(t,a){return t.x===a.x&&t.y===a.y&&t.width===a.width&&t.height===a.height}function cj(t,a){let i=null,s;const d=Cu(t);function m(){var y;clearTimeout(s),(y=i)==null||y.disconnect(),i=null}function g(y,S){y===void 0&&(y=!1),S===void 0&&(S=1),m();const b=t.getBoundingClientRect(),{left:T,top:R,width:x,height:_}=b;if(y||a(),!x||!_)return;const A=Dd(R),z=Dd(d.clientWidth-(T+x)),N=Dd(d.clientHeight-(R+_)),M=Dd(T),Y={rootMargin:-A+"px "+-z+"px "+-N+"px "+-M+"px",threshold:yl(0,Yh(1,S))||1};let Z=!0;function V(I){const q=I[0].intersectionRatio;if(q!==S){if(!Z)return g();q?g(!1,q):s=setTimeout(()=>{g(!1,1e-7)},1e3)}q===1&&!rA(b,t.getBoundingClientRect())&&g(),Z=!1}try{i=new IntersectionObserver(V,{...Y,root:d.ownerDocument})}catch{i=new IntersectionObserver(V,Y)}i.observe(t)}return g(!0),m}function lA(t,a,i,s){s===void 0&&(s={});const{ancestorScroll:d=!0,ancestorResize:m=!0,elementResize:g=typeof ResizeObserver=="function",layoutShift:y=typeof IntersectionObserver=="function",animationFrame:S=!1}=s,b=x2(t),T=d||m?[...b?jy(b):[],...a?jy(a):[]]:[];T.forEach(M=>{d&&M.addEventListener("scroll",i,{passive:!0}),m&&M.addEventListener("resize",i)});const R=b&&y?cj(b,i):null;let x=-1,_=null;g&&(_=new ResizeObserver(M=>{let[$]=M;$&&$.target===b&&_&&a&&(_.unobserve(a),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var Y;(Y=_)==null||Y.observe(a)})),i()}),b&&!S&&_.observe(b),a&&_.observe(a));let A,z=S?Vd(t):null;S&&N();function N(){const M=Vd(t);z&&!rA(z,M)&&i(),z=M,A=requestAnimationFrame(N)}return i(),()=>{var M;T.forEach($=>{d&&$.removeEventListener("scroll",i),m&&$.removeEventListener("resize",i)}),R?.(),(M=_)==null||M.disconnect(),_=null,S&&cancelAnimationFrame(A)}}const fj=X9,dj=P9,pj=Z9,hj=Q9,mj=I9,gj=F9,yj=(t,a,i)=>{const s=new Map,d={platform:aA,...i},m={...d.platform,_c:s};return q9(t,a,{...d,platform:m})};var vj=typeof document<"u",bj=function(){},YS=vj?C.useLayoutEffect:bj;function GS(t,a){if(t===a)return!0;if(typeof t!=typeof a)return!1;if(typeof t=="function"&&t.toString()===a.toString())return!0;let i,s,d;if(t&&a&&typeof t=="object"){if(Array.isArray(t)){if(i=t.length,i!==a.length)return!1;for(s=i;s--!==0;)if(!GS(t[s],a[s]))return!1;return!0}if(d=Object.keys(t),i=d.length,i!==Object.keys(a).length)return!1;for(s=i;s--!==0;)if(!{}.hasOwnProperty.call(a,d[s]))return!1;for(s=i;s--!==0;){const m=d[s];if(!(m==="_owner"&&t.$$typeof)&&!GS(t[m],a[m]))return!1}return!0}return t!==t&&a!==a}function iA(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function uA(t,a){const i=iA(t);return Math.round(a*i)/i}function C2(t){const a=C.useRef(t);return YS(()=>{a.current=t}),a}function Sj(t){t===void 0&&(t={});const{placement:a="bottom",strategy:i="absolute",middleware:s=[],platform:d,elements:{reference:m,floating:g}={},transform:y=!0,whileElementsMounted:S,open:b}=t,[T,R]=C.useState({x:0,y:0,strategy:i,placement:a,middlewareData:{},isPositioned:!1}),[x,_]=C.useState(s);GS(x,s)||_(s);const[A,z]=C.useState(null),[N,M]=C.useState(null),$=C.useCallback(F=>{F!==I.current&&(I.current=F,z(F))},[]),Y=C.useCallback(F=>{F!==q.current&&(q.current=F,M(F))},[]),Z=m||A,V=g||N,I=C.useRef(null),q=C.useRef(null),J=C.useRef(T),he=S!=null,Q=C2(S),fe=C2(d),re=C2(b),ce=C.useCallback(()=>{if(!I.current||!q.current)return;const F={placement:a,strategy:i,middleware:x};fe.current&&(F.platform=fe.current),yj(I.current,q.current,F).then(W=>{const de={...W,isPositioned:re.current!==!1};ee.current&&!GS(J.current,de)&&(J.current=de,Jl.flushSync(()=>{R(de)}))})},[x,a,i,fe,re]);YS(()=>{b===!1&&J.current.isPositioned&&(J.current.isPositioned=!1,R(F=>({...F,isPositioned:!1})))},[b]);const ee=C.useRef(!1);YS(()=>(ee.current=!0,()=>{ee.current=!1}),[]),YS(()=>{if(Z&&(I.current=Z),V&&(q.current=V),Z&&V){if(Q.current)return Q.current(Z,V,ce);ce()}},[Z,V,ce,Q,he]);const K=C.useMemo(()=>({reference:I,floating:q,setReference:$,setFloating:Y}),[$,Y]),L=C.useMemo(()=>({reference:Z,floating:V}),[Z,V]),k=C.useMemo(()=>{const F={position:i,left:0,top:0};if(!L.floating)return F;const W=uA(L.floating,T.x),de=uA(L.floating,T.y);return y?{...F,transform:"translate("+W+"px, "+de+"px)",...iA(L.floating)>=1.5&&{willChange:"transform"}}:{position:i,left:W,top:de}},[i,y,L.floating,T.x,T.y]);return C.useMemo(()=>({...T,update:ce,refs:K,elements:L,floatingStyles:k}),[T,ce,K,L,k])}const Ej=(t,a)=>{const i=fj(t);return{name:i.name,fn:i.fn,options:[t,a]}},wj=(t,a)=>{const i=dj(t);return{name:i.name,fn:i.fn,options:[t,a]}},Tj=(t,a)=>({fn:gj(t).fn,options:[t,a]}),Rj=(t,a)=>{const i=pj(t);return{name:i.name,fn:i.fn,options:[t,a]}},xj=(t,a)=>{const i=hj(t);return{name:i.name,fn:i.fn,options:[t,a]}},Oj=(t,a)=>{const i=mj(t);return{name:i.name,fn:i.fn,options:[t,a]}},Cj={open:ut(t=>t.open),transitionStatus:ut(t=>t.transitionStatus),domReferenceElement:ut(t=>t.domReferenceElement),referenceElement:ut(t=>t.positionReference??t.referenceElement),floatingElement:ut(t=>t.floatingElement),floatingId:ut(t=>t.floatingId)};class _2 extends mS{constructor(a){const{syncOnly:i,nested:s,onOpenChange:d,triggerElements:m,...g}=a;super({...g,positionReference:g.referenceElement,domReferenceElement:g.referenceElement},{onOpenChange:d,dataRef:{current:{}},events:q_(),nested:s,triggerElements:m},Cj),this.syncOnly=i}syncOpenEvent=(a,i)=>{(!a||!this.state.open||i!=null&&QC(i))&&(this.context.dataRef.current.openEvent=a?i:void 0)};dispatchOpenChange=(a,i)=>{this.syncOpenEvent(a,i.event);const s={open:a,reason:i.reason,nativeEvent:i.event,nested:this.context.nested,triggerElement:i.trigger};this.context.events.emit("openchange",s)};setOpen=(a,i)=>{if(this.syncOnly){this.context.onOpenChange?.(a,i);return}this.dispatchOpenChange(a,i),this.context.onOpenChange?.(a,i)}}function $y(t,a=!1,i=!1){const[s,d]=C.useState(t&&a?"idle":void 0),[m,g]=C.useState(t);return t&&!m&&(g(!0),d("starting")),!t&&m&&s!=="ending"&&!i&&d("ending"),!t&&!m&&s==="ending"&&d(void 0),ht(()=>{if(!t&&m&&s!=="ending"&&i){const y=Au.request(()=>{d("ending")});return()=>{Au.cancel(y)}}},[t,m,s,i]),ht(()=>{if(!t||a)return;const y=Au.request(()=>{d(void 0)});return()=>{Au.cancel(y)}},[a,t]),ht(()=>{if(!t||!a)return;t&&m&&s!=="idle"&&d("starting");const y=Au.request(()=>{d("idle")});return()=>{Au.cancel(y)}},[a,t,m,s]),{mounted:m,setMounted:g,transitionStatus:s}}function _j(t,a){const i=C.useRef(null),s=C.useRef(null);return C.useCallback(d=>{if(t!==void 0){if(i.current!==null){const m=i.current,g=s.current,y=a.context.triggerElements.getById(m);g&&y===g&&a.context.triggerElements.delete(m),i.current=null,s.current=null}d!==null&&(i.current=t,s.current=d,a.context.triggerElements.add(t,d))}},[a,t])}function sA(t,a,i,s){const d=i.useState("isMountedByTrigger",t),m=_j(t,i),g=nt(y=>{if(m(y),!y||!i.select("open"))return;const S=i.select("activeTriggerId");if(S===t){i.update({activeTriggerElement:y,...s});return}S==null&&i.update({activeTriggerId:t,activeTriggerElement:y,...s})});return ht(()=>{d&&i.update({activeTriggerElement:a.current,...s})},[d,i,a,...Object.values(s)]),{registerTrigger:g,isMountedByThisTrigger:d}}function cA(t){const a=t.useState("open");ht(()=>{if(a&&!t.select("activeTriggerId")&&t.context.triggerElements.size===1){const i=t.context.triggerElements.entries().next();if(!i.done){const[s,d]=i.value;t.update({activeTriggerId:s,activeTriggerElement:d})}}},[a,t])}function fA(t,a,i){const{mounted:s,setMounted:d,transitionStatus:m}=$y(t);a.useSyncedValues({mounted:s,transitionStatus:m});const g=nt(()=>{d(!1),a.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),i?.(),a.context.onOpenChangeComplete?.(!1)}),y=a.useState("preventUnmountingOnClose");return ju({enabled:!y,open:t,ref:a.context.popupRef,onComplete(){t||g()}}),{forceUnmount:g,transitionStatus:m}}class qS{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(a,i){const s=this.idMap.get(a);if(s!==i&&(s!==void 0&&this.elementsSet.delete(s),this.elementsSet.add(i),this.idMap.set(a,i),process.env.NODE_ENV!=="production"&&this.elementsSet.size!==this.idMap.size))throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.")}delete(a){const i=this.idMap.get(a);i&&(this.elementsSet.delete(i),this.idMap.delete(a))}hasElement(a){return this.elementsSet.has(a)}hasMatchingElement(a){for(const i of this.elementsSet)if(a(i))return!0;return!1}getById(a){return this.idMap.get(a)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function Aj(){return new _2({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new qS,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0})}function dA(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Aj(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:No,inactiveTriggerProps:No,popupProps:No}}const ZS=ut(t=>t.triggerIdProp??t.activeTriggerId),pA={open:ut(t=>t.openProp??t.open),mounted:ut(t=>t.mounted),transitionStatus:ut(t=>t.transitionStatus),floatingRootContext:ut(t=>t.floatingRootContext),preventUnmountingOnClose:ut(t=>t.preventUnmountingOnClose),payload:ut(t=>t.payload),activeTriggerId:ZS,activeTriggerElement:ut(t=>t.mounted?t.activeTriggerElement:null),isTriggerActive:ut((t,a)=>a!==void 0&&ZS(t)===a),isOpenedByTrigger:ut((t,a)=>a!==void 0&&ZS(t)===a&&t.open),isMountedByTrigger:ut((t,a)=>a!==void 0&&ZS(t)===a&&t.mounted),triggerProps:ut((t,a)=>a?t.activeTriggerProps:t.inactiveTriggerProps),popupProps:ut(t=>t.popupProps),popupElement:ut(t=>t.popupElement),positionerElement:ut(t=>t.positionerElement)};function hA(t){const{open:a=!1,onOpenChange:i,elements:s={}}=t,d=Xc(),m=Pc()!=null;if(process.env.NODE_ENV!=="production"){const y=s.reference;y&&!dn(y)&&console.error("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `context.setPositionReference()`","instead.")}const g=pa(()=>new _2({open:a,transitionStatus:void 0,onOpenChange:i,referenceElement:s.reference??null,floatingElement:s.floating??null,triggerElements:new qS,floatingId:d,syncOnly:!1,nested:m})).current;return ht(()=>{const y={open:a,floatingId:d};s.reference!==void 0&&(y.referenceElement=s.reference,y.domReferenceElement=dn(s.reference)?s.reference:null),s.floating!==void 0&&(y.floatingElement=s.floating),g.update(y)},[a,d,s.reference,s.floating,g]),g.context.onOpenChange=i,g.context.nested=m,g}function Dj(t={}){const{nodeId:a,externalTree:i}=t,s=hA(t),d=t.rootContext||s,m={reference:d.useState("referenceElement"),floating:d.useState("floatingElement"),domReference:d.useState("domReferenceElement")},[g,y]=C.useState(null),S=C.useRef(null),b=Hd(i);ht(()=>{m.domReference&&(S.current=m.domReference)},[m.domReference]);const T=Sj({...t,elements:{...m,...g&&{reference:g}}}),R=C.useCallback(J=>{const he=dn(J)?{getBoundingClientRect:()=>J.getBoundingClientRect(),getClientRects:()=>J.getClientRects(),contextElement:J}:J;y(he),T.refs.setReference(he)},[T.refs]),[x,_]=C.useState(void 0),[A,z]=C.useState(null);d.useSyncedValue("referenceElement",x??null);const N=dn(x)?x:null;d.useSyncedValue("domReferenceElement",x===void 0?m.domReference:N),d.useSyncedValue("floatingElement",A);const M=C.useCallback(J=>{(dn(J)||J===null)&&(S.current=J,_(J)),(dn(T.refs.reference.current)||T.refs.reference.current===null||J!==null&&!dn(J))&&T.refs.setReference(J)},[T.refs,_]),$=C.useCallback(J=>{z(J),T.refs.setFloating(J)},[T.refs]),Y=C.useMemo(()=>({...T.refs,setReference:M,setFloating:$,setPositionReference:R,domReference:S}),[T.refs,M,$,R]),Z=C.useMemo(()=>({...T.elements,domReference:m.domReference}),[T.elements,m.domReference]),V=d.useState("open"),I=d.useState("floatingId"),q=C.useMemo(()=>({...T,dataRef:d.context.dataRef,open:V,onOpenChange:d.setOpen,events:d.context.events,floatingId:I,refs:Y,elements:Z,nodeId:a,rootStore:d}),[T,Y,Z,a,d,V,I]);return ht(()=>{d.context.dataRef.current.floatingContext=q;const J=b?.nodesRef.current.find(he=>he.id===a);J&&(J.context=q)}),C.useMemo(()=>({...T,context:q,refs:Y,elements:Z,rootStore:d}),[T,Y,Z,q,d])}function mA(t){const{popupStore:a,treatPopupAsFloatingElement:i=!1,onOpenChange:s}=t,d=Xc(),m=Pc()!=null,g=a.useState("open"),y=a.useState("activeTriggerElement"),S=a.useState(i?"popupElement":"positionerElement"),b=a.context.triggerElements,T=pa(()=>new _2({open:g,transitionStatus:void 0,referenceElement:y,floatingElement:S,triggerElements:b,onOpenChange:s,floatingId:d,syncOnly:!0,nested:m})).current;return ht(()=>{const R={open:g,floatingId:d,referenceElement:y,floatingElement:S};dn(y)&&(R.domReferenceElement=y),T.state.positionReference===T.state.referenceElement&&(R.positionReference=y),T.update(R)},[g,d,y,S,T]),T.context.onOpenChange=s,T.context.nested=m,T}class A2{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new hl,this.restTimeout=new hl,this.handleCloseOptions=void 0}static create(){return new A2}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const IS=new WeakMap;function $S(t){if(!t.performedPointerEventsMutation)return;const a=t.pointerEventsScopeElement;a&&IS.get(a)===t&&(t.pointerEventsScopeElement?.style.removeProperty("pointer-events"),t.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),t.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),IS.delete(a)),t.performedPointerEventsMutation=!1,t.pointerEventsScopeElement=null,t.pointerEventsReferenceElement=null,t.pointerEventsFloatingElement=null}function gA(t,a){const{scopeElement:i,referenceElement:s,floatingElement:d}=a,m=IS.get(i);m&&m!==t&&$S(m),$S(t),t.performedPointerEventsMutation=!0,t.pointerEventsScopeElement=i,t.pointerEventsReferenceElement=s,t.pointerEventsFloatingElement=d,IS.set(i,t),i.style.pointerEvents="none",s.style.pointerEvents="auto",d.style.pointerEvents="auto"}function yA(t){const a=pa(A2.create).current,i=t.context.dataRef.current;return i.hoverInteractionState||(i.hoverInteractionState=a),Uy(i.hoverInteractionState.disposeEffect),i.hoverInteractionState}function Mj(t,a={}){const i="rootStore"in t?t.rootStore:t,s=i.useState("open"),d=i.useState("floatingElement"),m=i.useState("domReferenceElement"),{dataRef:g}=i.context,{enabled:y=!0,closeDelay:S=0,nodeId:b}=a,T=yA(i),R=Hd(),x=Pc(),_=nt(()=>N_(g.current.openEvent?.type,T.interactedInside)),A=nt(()=>{const Z=g.current.openEvent?.type;return Z?.includes("mouse")&&Z!=="mousedown"}),z=nt(Z=>$C(Z,i.context.triggerElements)),N=C.useCallback(Z=>{const V=c2(S,"close",T.pointerType),I=()=>{i.setOpen(!1,tn(Sr,Z)),R?.events.emit("floating.closed",Z)};V?T.openChangeTimeout.start(V,I):(T.openChangeTimeout.clear(),I())},[S,i,T,R]),M=nt(()=>{$S(T)}),$=nt(Z=>{const V=fo(Z);if(!cU(V)){T.interactedInside=!1;return}T.interactedInside=V?.closest("[aria-haspopup]")!=null});ht(()=>{s||(T.pointerType=void 0,T.restTimeoutPending=!1,T.interactedInside=!1,M())},[s,T,M]),C.useEffect(()=>M,[M]),ht(()=>{if(y&&s&&T.handleCloseOptions?.blockPointerEvents&&A()&&dn(m)&&d){const Z=m,V=d,I=It(d),q=R?.nodesRef.current.find(he=>he.id===x)?.context?.elements.floating;q&&(q.style.pointerEvents="");const J=T.handleCloseOptions?.getScope?.()??T.pointerEventsScopeElement??q??Z.closest("[data-rootownerid]")??I.body;return gA(T,{scopeElement:J,referenceElement:Z,floatingElement:V}),()=>{M()}}},[y,s,m,d,T,A,R,x,M]);const Y=ml();C.useEffect(()=>{if(!y)return;function Z(){T.openChangeTimeout.clear(),Y.clear(),R?.events.off("floating.closed",I),M()}function V(J){if(R&&x&&Du(R.nodesRef.current,x).length>0){R.events.on("floating.closed",I);return}if(z(J.relatedTarget))return;const he=g.current.floatingContext?.nodeId??b,Q=J.relatedTarget;if(!(R&&he&&dn(Q)&&Du(R.nodesRef.current,he,!1).some(re=>Tt(re.context?.elements.floating,Q)))){if(T.handler){T.handler(J);return}M(),_()||N(J)}}function I(J){!R||!x||Du(R.nodesRef.current,x).length>0||Y.start(0,()=>{R.events.off("floating.closed",I),i.setOpen(!1,tn(Sr,J)),R.events.emit("floating.closed",J)})}const q=d;return _u(q&&rn(q,"mouseenter",Z),q&&rn(q,"mouseleave",V),q&&rn(q,"pointerdown",$,!0),()=>{R?.events.off("floating.closed",I)})},[y,d,i,g,b,_,z,N,M,$,T,R,x,Y])}const zj={current:null};function Nj(t,a={}){const i="rootStore"in t?t.rootStore:t,{dataRef:s,events:d}=i.context,{enabled:m=!0,delay:g=0,handleClose:y=null,mouseOnly:S=!1,restMs:b=0,move:T=!0,triggerElementRef:R=zj,externalTree:x,isActiveTrigger:_=!0,getHandleCloseContext:A,isClosing:z}=a,N=Hd(x),M=yA(i),$=C.useRef(!1),Y=Fo(y),Z=Fo(g),V=Fo(b),I=Fo(m),q=Fo(z);_&&(M.handleCloseOptions=Y.current?.__options);const J=nt(()=>N_(s.current.openEvent?.type,M.interactedInside)),he=nt(ee=>$C(ee,i.context.triggerElements)),Q=nt((ee,K,L)=>{const k=i.context.triggerElements;if(k.hasElement(K))return!ee||!Tt(ee,K);if(!dn(L))return!1;const F=L;return k.hasMatchingElement(W=>Tt(W,F))&&(!ee||!Tt(ee,F))}),fe=nt((ee,K=!0)=>{const L=c2(Z.current,"close",M.pointerType);L?M.openChangeTimeout.start(L,()=>{i.setOpen(!1,tn(Sr,ee)),N?.events.emit("floating.closed",ee)}):K&&(M.openChangeTimeout.clear(),i.setOpen(!1,tn(Sr,ee)),N?.events.emit("floating.closed",ee))}),re=nt(()=>{if(!M.handler)return;It(i.select("domReferenceElement")).removeEventListener("mousemove",M.handler),M.handler=void 0}),ce=nt(()=>{$S(M)});return C.useEffect(()=>re,[re]),C.useEffect(()=>{if(!m)return;function ee(K){K.open?$.current=!1:($.current=K.reason===Sr,re(),M.openChangeTimeout.clear(),M.restTimeout.clear(),M.blockMouseMove=!0,M.restTimeoutPending=!1)}return d.on("openchange",ee),()=>{d.off("openchange",ee)}},[m,d,M,re]),C.useEffect(()=>{if(!m)return;const ee=R.current??(_?i.select("domReferenceElement"):null);if(!dn(ee))return;function K(k){if(M.openChangeTimeout.clear(),M.blockMouseMove=!1,S&&!By(M.pointerType))return;const F=z_(V.current),W=c2(Z.current,"open",M.pointerType),de=fo(k),U=k.currentTarget??null,P=i.select("domReferenceElement");let te=U;if(dn(de)&&!i.context.triggerElements.hasElement(de)){for(const Le of i.context.triggerElements.elements())if(Tt(Le,de)){te=Le;break}}dn(U)&&dn(P)&&!i.context.triggerElements.hasElement(U)&&Tt(U,P)&&(te=P);const ae=te==null?!1:Q(P,te,de),Se=i.select("open"),Re=q.current?.()??i.select("transitionStatus")==="ending",Te=!Se&&Re&&$.current,Me=!ae&&dn(te)&&dn(P)&&Tt(P,te)&&Te,Be=F>0&&!W,Qe=ae&&(Se||Te)||Me,Ae=!Se||ae;if(Qe){i.setOpen(!0,tn(Sr,k,te));return}Be||(W?M.openChangeTimeout.start(W,()=>{Ae&&i.setOpen(!0,tn(Sr,k,te))}):Ae&&i.setOpen(!0,tn(Sr,k,te)))}function L(k){if(J()){ce();return}re();const F=i.select("domReferenceElement"),W=It(F);M.restTimeout.clear(),M.restTimeoutPending=!1;const de=s.current.floatingContext??A?.();if(he(k.relatedTarget))return;if(Y.current&&de){i.select("open")||M.openChangeTimeout.clear();const te=R.current;M.handler=Y.current({...de,tree:N,x:k.clientX,y:k.clientY,onClose(){ce(),re(),I.current&&!J()&&te===i.select("domReferenceElement")&&fe(k,!0)}}),W.addEventListener("mousemove",M.handler),M.handler(k);return}(M.pointerType!=="touch"||!Tt(i.select("floatingElement"),k.relatedTarget))&&fe(k)}return T?_u(rn(ee,"mousemove",K,{once:!0}),rn(ee,"mouseenter",K),rn(ee,"mouseleave",L)):_u(rn(ee,"mouseenter",K),rn(ee,"mouseleave",L))},[re,ce,s,Z,fe,i,m,Y,M,_,Q,J,he,S,T,V,R,N,I,A,q]),C.useMemo(()=>{if(!m)return;function ee(K){M.pointerType=K.pointerType}return{onPointerDown:ee,onPointerEnter:ee,onMouseMove(K){const{nativeEvent:L}=K,k=K.currentTarget,F=i.select("domReferenceElement"),W=i.select("open"),de=Q(F,k,K.target);if(S&&!By(M.pointerType))return;if(W&&de&&M.handleCloseOptions?.blockPointerEvents){const te=i.select("floatingElement");if(te){const ae=M.handleCloseOptions?.getScope?.()??k.ownerDocument.body;gA(M,{scopeElement:ae,referenceElement:k,floatingElement:te})}}const U=z_(V.current);if(W&&!de||U===0||!de&&M.restTimeoutPending&&K.movementX**2+K.movementY**2<2)return;M.restTimeout.clear();function P(){if(M.restTimeoutPending=!1,J())return;const te=i.select("open");!M.blockMouseMove&&(!te||de)&&i.setOpen(!0,tn(Sr,L,k))}M.pointerType==="touch"?Jl.flushSync(()=>{P()}):de&&W?P():(M.restTimeoutPending=!0,M.restTimeout.start(U,P))}}},[m,M,J,Q,S,i,V])}function Xy(t=[]){const a=t.map(b=>b?.reference),i=t.map(b=>b?.floating),s=t.map(b=>b?.item),d=t.map(b=>b?.trigger),m=C.useCallback(b=>XS(b,t,"reference"),a),g=C.useCallback(b=>XS(b,t,"floating"),i),y=C.useCallback(b=>XS(b,t,"item"),s),S=C.useCallback(b=>XS(b,t,"trigger"),d);return C.useMemo(()=>({getReferenceProps:m,getFloatingProps:g,getItemProps:y,getTriggerProps:S}),[m,g,y,S])}function XS(t,a,i){const s=new Map,d=i==="item",m={};i==="floating"&&(m.tabIndex=-1,m[GT]="");for(const g in t)d&&t&&(g===qC||g===ZC)||(m[g]=t[g]);for(let g=0;g<a.length;g+=1){let y;const S=a[g]?.[i];typeof S=="function"?y=t?S(t):null:y=S,y&&vA(m,y,d,s)}return vA(m,t,d,s),m}function vA(t,a,i,s){for(const d in a){const m=a[d];i&&(d===qC||d===ZC)||(d.startsWith("on")?(s.has(d)||s.set(d,[]),typeof m=="function"&&(s.get(d)?.push(m),t[d]=(...g)=>s.get(d)?.map(y=>y(...g)).find(y=>y!==void 0))):t[d]=m)}}const Uj="Escape";function PS(t,a,i){switch(t){case"vertical":return a;case"horizontal":return i;default:return a||i}}function FS(t,a){return PS(a,t===qT||t===Vy,t===qc||t===Zc)}function D2(t,a,i){return PS(a,t===Vy,i?t===qc:t===Zc)||t==="Enter"||t===" "||t===""}function jj(t,a,i){return PS(a,i?t===qc:t===Zc,t===Vy)}function Lj(t,a,i,s){const d=i?t===Zc:t===qc,m=t===qT;return a==="both"||a==="horizontal"&&s&&s>1?t===Uj:PS(a,d,m)}function Hj(t,a){const i="rootStore"in t?t.rootStore:t,s=i.useState("open"),d=i.useState("floatingElement"),m=i.useState("domReferenceElement"),g=i.context.dataRef,{listRef:y,activeIndex:S,onNavigate:b=()=>{},enabled:T=!0,selectedIndex:R=null,allowEscape:x=!1,loopFocus:_=!1,nested:A=!1,rtl:z=!1,virtual:N=!1,focusItemOnOpen:M="auto",focusItemOnHover:$=!0,openOnArrowKeyDown:Y=!0,disabledIndices:Z=void 0,orientation:V="vertical",parentOrientation:I,cols:q=1,id:J,resetOnPointerLeave:he=!0,externalTree:Q}=a;process.env.NODE_ENV!=="production"&&(x&&(_||console.warn("`useListNavigation` looping must be enabled to allow escaping."),N||console.warn("`useListNavigation` must be virtual to allow escaping.")),V==="vertical"&&q>1&&console.warn("In grid list navigation mode (`cols` > 1), the `orientation` should",'be either "horizontal" or "both".'));const fe=ky(d),re=Fo(fe),ce=Pc(),ee=Hd(Q);ht(()=>{g.current.orientation=V},[g,V]);const K=IT(m),L=C.useRef(M),k=C.useRef(R??-1),F=C.useRef(null),W=C.useRef(!0),de=nt(ne=>{b(k.current===-1?null:k.current,ne)}),U=C.useRef(de),P=C.useRef(!!d),te=C.useRef(s),ae=C.useRef(!1),Se=C.useRef(!1),Re=C.useRef(null),Te=Fo(Z),Me=Fo(s),Be=Fo(R),Qe=Fo(he),Ae=nt(()=>{function ne($e){N?ee?.events.emit("virtualfocus",$e):Re.current=HS($e,{sync:ae.current,preventScroll:!0})}const Ee=y.current[k.current],be=Se.current;Ee&&ne(Ee),(ae.current?$e=>$e():requestAnimationFrame)(()=>{const $e=y.current[k.current]||Ee;if(!$e)return;Ee||ne($e),ot&&(be||!W.current)&&$e.scrollIntoView?.({block:"nearest",inline:"nearest"})})});ht(()=>{T&&(s&&d?(k.current=R??-1,L.current&&R!=null&&(Se.current=!0,de())):P.current&&(k.current=-1,U.current()))},[T,s,d,R,de]),ht(()=>{if(T){if(!s){ae.current=!1;return}if(d)if(S==null){if(ae.current=!1,Be.current!=null)return;if(P.current&&(k.current=-1,Ae()),(!te.current||!P.current)&&L.current&&(F.current!=null||L.current===!0&&F.current==null)){let ne=0;const Ee=()=>{y.current[0]==null?(ne<2&&(ne?requestAnimationFrame:queueMicrotask)(Ee),ne+=1):(k.current=F.current==null||D2(F.current,V,z)||A?KT(y):e_(y),F.current=null,de())};Ee()}}else OS(y.current,S)||(k.current=S,Ae(),Se.current=!1)}},[T,s,d,S,Be,A,y,V,z,de,Ae,Te]),ht(()=>{if(!T||d||!ee||N||!P.current)return;const ne=ee.nodesRef.current,Ee=ne.find($e=>$e.id===ce)?.context?.elements.floating,be=Ua(It(d)),me=ne.some($e=>$e.context&&Tt($e.context.elements.floating,be));Ee&&!me&&W.current&&Ee.focus({preventScroll:!0})},[T,d,ee,ce,N]),ht(()=>{U.current=de,te.current=s,P.current=!!d}),ht(()=>{s||(F.current=null,L.current=M)},[s,M]);const Le=S!=null,rt=nt(ne=>{if(!Me.current)return;const Ee=y.current.indexOf(ne.currentTarget);Ee!==-1&&(k.current!==Ee||S!==Ee)&&(k.current=Ee,de(ne))}),ot=C.useMemo(()=>({onFocus(Ee){ae.current=!0,rt(Ee)},onClick:({currentTarget:Ee})=>Ee.focus({preventScroll:!0}),onMouseMove(Ee){ae.current=!0,Se.current=!1,$&&rt(Ee)},onPointerLeave(Ee){if(!Me.current||!W.current||Ee.pointerType==="touch")return;ae.current=!0;const be=Ee.relatedTarget;if(!(!$||y.current.includes(be))&&Qe.current&&(Re.current?.(),Re.current=null,k.current=-1,de(Ee),!N)){const me=re.current,$e=Ua(It(me));me&&Tt(me,$e)&&me.focus({preventScroll:!0})}}}),[rt,Me,re,$,y,de,Qe,N]),We=C.useCallback(()=>I??ee?.nodesRef.current.find(ne=>ne.id===ce)?.context?.dataRef?.current.orientation,[ce,ee,I]),Ze=nt(ne=>{if(W.current=!1,ae.current=!0,ne.which===229||!Me.current&&ne.currentTarget===re.current)return;if(A&&Lj(ne.key,V,z,q)){FS(ne.key,We())||gl(ne),i.setOpen(!1,tn(p2,ne.nativeEvent)),Wn(m)&&(N?ee?.events.emit("virtualfocus",m):m.focus());return}const Ee=k.current,be=KT(y,Z),me=e_(y,Z);if(K||(ne.key==="Home"&&(gl(ne),k.current=be,de(ne)),ne.key==="End"&&(gl(ne),k.current=me,de(ne))),q>1){const $e=Array.from({length:y.current.length},()=>({width:1,height:1})),Pe=wU($e,q),Xe=Pe.findIndex(yt=>yt!=null&&!Gh(y.current,yt,Z)),at=Pe.reduce((yt,St,Rt)=>St!=null&&!Gh(y.current,St,Z)?Rt:yt,-1),zt=Pe[EU(Pe.map(yt=>yt!=null?y.current[yt]:null),{event:ne,orientation:V,loopFocus:_,rtl:z,cols:q,disabledIndices:RU([...(typeof Z!="function"?Z:null)||y.current.map((yt,St)=>Gh(y.current,St,Z)?St:void 0),void 0],Pe),minIndex:Xe,maxIndex:at,prevIndex:TU(k.current>me?be:k.current,$e,Pe,q,ne.key===Vy?"bl":ne.key===(z?qc:Zc)?"tr":"tl"),stopEvent:!0})];if(zt!=null&&(k.current=zt,de(ne)),V==="both")return}if(FS(ne.key,V)){if(gl(ne),s&&!N&&Ua(ne.currentTarget.ownerDocument)===ne.currentTarget){k.current=D2(ne.key,V,z)?be:me,de(ne);return}D2(ne.key,V,z)?_?Ee>=me?x&&Ee!==y.current.length?k.current=-1:(ae.current=!1,k.current=be):k.current=br(y.current,{startingIndex:Ee,disabledIndices:Z}):k.current=Math.min(me,br(y.current,{startingIndex:Ee,disabledIndices:Z})):_?Ee<=be?x&&Ee!==-1?k.current=y.current.length:(ae.current=!1,k.current=me):k.current=br(y.current,{startingIndex:Ee,decrement:!0,disabledIndices:Z}):k.current=Math.max(be,br(y.current,{startingIndex:Ee,decrement:!0,disabledIndices:Z})),OS(y.current,k.current)&&(k.current=-1),de(ne)}}),Je=C.useMemo(()=>N&&s&&Le&&{"aria-activedescendant":`${J}-${S}`},[N,s,Le,J,S]),ct=C.useMemo(()=>({"aria-orientation":V==="both"?void 0:V,...K?{}:Je,onKeyDown(ne){if(ne.key==="Tab"&&ne.shiftKey&&s&&!N){const Ee=fo(ne.nativeEvent);if(Ee&&!Tt(re.current,Ee))return;gl(ne),i.setOpen(!1,tn(Ld,ne.nativeEvent)),Wn(m)&&m.focus();return}Ze(ne)},onPointerMove(){W.current=!0}}),[Je,Ze,re,V,K,i,s,N,m]),tt=C.useMemo(()=>{function ne(be){M==="auto"&&PC(be.nativeEvent)&&(L.current=!N)}function Ee(be){L.current=M,M==="auto"&&FC(be.nativeEvent)&&(L.current=!0)}return{onKeyDown(be){const me=i.select("open");W.current=!1;const $e=be.key.startsWith("Arrow"),Pe=jj(be.key,We(),z),Xe=FS(be.key,V),at=(A?Pe:Xe)||be.key==="Enter"||be.key.trim()==="";if(N&&me)return Ze(be);if(!(!me&&!Y&&$e)){if(at){const zt=FS(be.key,We());F.current=A&&zt?null:be.key}if(A){Pe&&(gl(be),me?(k.current=KT(y,Te.current),de(be)):i.setOpen(!0,tn(p2,be.nativeEvent,be.currentTarget)));return}Xe&&(Be.current!=null&&(k.current=Be.current),gl(be),!me&&Y?i.setOpen(!0,tn(p2,be.nativeEvent,be.currentTarget)):Ze(be),me&&de(be))}},onFocus(be){i.select("open")&&!N&&(k.current=-1,de(be))},onPointerDown:Ee,onPointerEnter:Ee,onMouseDown:ne,onClick:ne}},[Ze,Te,M,y,A,de,i,Y,V,We,z,Be,N]),Ye=C.useMemo(()=>({...Je,...tt}),[Je,tt]);return C.useMemo(()=>T?{reference:Ye,floating:ct,item:ot,trigger:tt}:{},[T,Ye,ct,tt,ot])}const Vj=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function bA(t,a={}){const i="rootStore"in t?t.rootStore:t,s=i.useState("open"),d=i.useState("floatingId"),m=i.useState("domReferenceElement"),g=i.useState("floatingElement"),{role:y="dialog"}=a,S=Xc(),b=m?.id||S,T=C.useMemo(()=>ky(g)?.id||d,[g,d]),R=Vj.get(y)??y,_=Pc()!=null,A=C.useMemo(()=>R==="tooltip"||y==="label"?No:{"aria-haspopup":R==="alertdialog"?"dialog":R,"aria-expanded":"false",...R==="listbox"&&{role:"combobox"},...R==="menu"&&_&&{role:"menuitem"},...y==="select"&&{"aria-autocomplete":"none"},...y==="combobox"&&{"aria-autocomplete":"list"}},[R,_,y]),z=C.useMemo(()=>R==="tooltip"||y==="label"?{[`aria-${y==="label"?"labelledby":"describedby"}`]:s?T:void 0}:{...A,"aria-expanded":s?"true":"false","aria-controls":s?T:void 0,...R==="menu"&&{id:b}},[R,T,s,b,y,A]),N=C.useMemo(()=>{const $={id:T,...R&&{role:R}};return R==="tooltip"||y==="label"?$:{...$,...R==="menu"&&{"aria-labelledby":b}}},[R,T,b,y]),M=C.useCallback(({active:$,selected:Y})=>{const Z={role:"option",...$&&{id:`${T}-fui-option`}};switch(y){case"select":case"combobox":return{...Z,"aria-selected":Y}}return{}},[T,y]);return C.useMemo(()=>({reference:z,floating:N,item:M,trigger:A}),[z,N,A,M])}function kj(t,a){const i="rootStore"in t?t.rootStore:t,s=i.context.dataRef,d=i.useState("open"),{listRef:m,elementsRef:g,activeIndex:y,onMatch:S,onTypingChange:b,enabled:T=!0,resetMs:R=750,selectedIndex:x=null}=a,_=ml(),A=C.useRef(""),z=C.useRef(x??y??-1),N=C.useRef(null);ht(()=>{!d&&x!==null||(_.clear(),N.current=null,A.current!==""&&(A.current=""))},[d,x,_]),ht(()=>{d&&A.current===""&&(z.current=x??y??-1)},[d,x,y]);const M=nt(I=>{I?s.current.typing||(s.current.typing=I,b?.(I)):s.current.typing&&(s.current.typing=I,b?.(I))}),$=nt(I=>{function q(K){const L=g?.current[K];return!L||CS(L)}function J(K,L,k=0){if(K.length===0)return-1;const F=(k%K.length+K.length)%K.length,W=L.toLocaleLowerCase();for(let de=0;de<K.length;de+=1){const U=(F+de)%K.length;if(!(!K[U]?.toLocaleLowerCase().startsWith(W)||!q(U)))return U}return-1}const he=m.current;if(A.current.length>0&&I.key===" "&&(gl(I),M(!0)),A.current.length>0&&A.current[0]!==" "&&J(he,A.current)===-1&&I.key!==" "&&M(!1),he==null||I.key.length!==1||I.ctrlKey||I.metaKey||I.altKey)return;d&&I.key!==" "&&(gl(I),M(!0));const Q=A.current==="";Q&&(z.current=x??y??-1),he.every(K=>K?K[0]?.toLocaleLowerCase()!==K[1]?.toLocaleLowerCase():!0)&&A.current===I.key&&(A.current="",z.current=N.current),A.current+=I.key,_.start(R,()=>{A.current="",z.current=N.current,M(!1)});const ce=((Q?x??y??-1:z.current)??0)+1,ee=J(he,A.current,ce);ee!==-1?(S?.(ee),N.current=ee):I.key!==" "&&(A.current="",M(!1))}),Y=nt(I=>{const q=I.relatedTarget,J=i.select("domReferenceElement"),he=i.select("floatingElement"),Q=Tt(J,q),fe=Tt(he,q);Q||fe||(_.clear(),A.current="",z.current=N.current,M(!1))}),Z=C.useMemo(()=>({onKeyDown:$,onBlur:Y}),[$,Y]),V=C.useMemo(()=>({onKeyDown:$,onBlur:Y}),[$,Y]);return C.useMemo(()=>T?{reference:Z,floating:V}:{},[T,Z,V])}const SA=.1,Bj=SA*SA,$n=.5;function QS(t,a,i,s,d,m){return s>=a!=m>=a&&t<=(d-i)*(a-s)/(m-s)+i}function JS(t,a,i,s,d,m,g,y,S,b){let T=!1;return QS(t,a,i,s,d,m)&&(T=!T),QS(t,a,d,m,g,y)&&(T=!T),QS(t,a,g,y,S,b)&&(T=!T),QS(t,a,S,b,i,s)&&(T=!T),T}function Yj(t,a,i){return t>=i.x&&t<=i.x+i.width&&a>=i.y&&a<=i.y+i.height}function KS(t,a,i,s,d,m){const g=Math.min(i,d),y=Math.max(i,d),S=Math.min(s,m),b=Math.max(s,m);return t>=g&&t<=y&&a>=S&&a<=b}function Gj(t={}){const{blockPointerEvents:a=!1}=t,i=new hl,s=({x:d,y:m,placement:g,elements:y,onClose:S,nodeId:b,tree:T})=>{const R=g?.split("-")[0];let x=!1,_=null,A=null,z=typeof performance<"u"?performance.now():0;function N($,Y){const Z=performance.now(),V=Z-z;if(_===null||A===null||V===0)return _=$,A=Y,z=Z,!1;const I=$-_,q=Y-A,J=I*I+q*q,he=V*V*Bj;return _=$,A=Y,z=Z,J<he}function M(){i.clear(),S()}return function(Y){i.clear();const Z=y.domReference,V=y.floating;if(!Z||!V||R==null||d==null||m==null)return;const{clientX:I,clientY:q}=Y,J=fo(Y),he=Y.type==="mouseleave",Q=Tt(V,J),fe=Tt(Z,J);if(Q&&(x=!0,!he))return;if(fe&&(x=!1,!he)){x=!0;return}if(he&&dn(Y.relatedTarget)&&Tt(V,Y.relatedTarget))return;function re(){return!!(T&&Du(T.nodesRef.current,b).length>0)}function ce(){re()||M()}if(re())return;const ee=Z.getBoundingClientRect(),K=V.getBoundingClientRect(),L=d>K.right-K.width/2,k=m>K.bottom-K.height/2,F=K.width>ee.width,W=K.height>ee.height,de=(F?ee:K).left,U=(F?ee:K).right,P=(W?ee:K).top,te=(W?ee:K).bottom;if(R==="top"&&m>=ee.bottom-1||R==="bottom"&&m<=ee.top+1||R==="left"&&d>=ee.right-1||R==="right"&&d<=ee.left+1){ce();return}let ae=!1;switch(R){case"top":ae=KS(I,q,de,ee.top+1,U,K.bottom-1);break;case"bottom":ae=KS(I,q,de,K.top+1,U,ee.bottom-1);break;case"left":ae=KS(I,q,K.right-1,te,ee.left+1,P);break;case"right":ae=KS(I,q,ee.right-1,te,K.left+1,P);break}if(ae)return;if(x&&!Yj(I,q,ee)){ce();return}if(!he&&N(I,q)){ce();return}let Se=!1;switch(R){case"top":{const Re=F?$n/2:$n*4,Te=F||L?d+Re:d-Re,Me=F?d-Re:L?d+Re:d-Re,Be=m+$n+1,Qe=L||F?K.bottom-$n:K.top,Ae=L?F?K.bottom-$n:K.top:K.bottom-$n;Se=JS(I,q,Te,Be,Me,Be,K.left,Qe,K.right,Ae);break}case"bottom":{const Re=F?$n/2:$n*4,Te=F||L?d+Re:d-Re,Me=F?d-Re:L?d+Re:d-Re,Be=m-$n,Qe=L||F?K.top+$n:K.bottom,Ae=L?F?K.top+$n:K.bottom:K.top+$n;Se=JS(I,q,Te,Be,Me,Be,K.left,Qe,K.right,Ae);break}case"left":{const Re=W?$n/2:$n*4,Te=W||k?m+Re:m-Re,Me=W?m-Re:k?m+Re:m-Re,Be=d+$n+1,Qe=k||W?K.right-$n:K.left,Ae=k?W?K.right-$n:K.left:K.right-$n;Se=JS(I,q,Qe,K.top,Ae,K.bottom,Be,Te,Be,Me);break}case"right":{const Re=W?$n/2:$n*4,Te=W||k?m+Re:m-Re,Me=W?m-Re:k?m+Re:m-Re,Be=d-$n,Qe=k||W?K.left+$n:K.right,Ae=k?W?K.left+$n:K.right:K.left+$n;Se=JS(I,q,Be,Te,Be,Me,Qe,K.top,Ae,K.bottom);break}}Se?x||i.start(40,ce):ce()}};return s.__options={...t,blockPointerEvents:a},s}const EA=C.forwardRef(function(a,i){const{children:s,container:d,className:m,render:g,style:y,...S}=a,{portalNode:b,portalSubtree:T}=G_({container:d,ref:i,componentProps:a,elementProps:S});return!T&&!b?null:X.jsxs(C.Fragment,{children:[T,b&&Jl.createPortal(s,b)]})});process.env.NODE_ENV!=="production"&&(EA.displayName="FloatingPortalLite");const qj=EA,wA=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(wA.displayName="DirectionContext");function TA(){return C.useContext(wA)?.direction??"ltr"}const Zj=t=>({name:"arrow",options:t,async fn(a){const{x:i,y:s,placement:d,rects:m,platform:g,elements:y,middlewareData:S}=a,{element:b,padding:T=0,offsetParent:R="real"}=Cs(t,a)||{};if(b==null)return{};const x=WC(T),_={x:i,y:s},A=QT(d),z=FT(A),N=await g.getDimensions(b),M=A==="y",$=M?"top":"left",Y=M?"bottom":"right",Z=M?"clientHeight":"clientWidth",V=m.reference[z]+m.reference[A]-_[A]-m.floating[z],I=_[A]-m.reference[A],q=R==="real"?await g.getOffsetParent?.(b):y.floating;let J=y.floating[Z]||m.floating[z];(!J||!await g.isElement?.(q))&&(J=y.floating[Z]||m.floating[z]);const he=V/2-I/2,Q=J/2-N[z]/2-1,fe=Math.min(x[$],Q),re=Math.min(x[Y],Q),ce=fe,ee=J-N[z]-re,K=J/2-N[z]/2+he,L=XT(ce,K,ee),k=!S.arrow&&Ic(d)!=null&&K!==L&&m.reference[z]/2-(K<ce?fe:re)-N[z]/2<0,F=k?K<ce?K-ce:K-ee:0;return{[A]:_[A]+F,data:{[A]:L,centerOffset:K-L-F,...k&&{alignmentOffset:F}},reset:k}}}),Ij=(t,a)=>({...Zj(t),options:[t,a]}),$j={name:"hide",async fn(t){const{width:a,height:i,x:s,y:d}=t.rects.reference,m=a===0&&i===0&&s===0&&d===0;return{data:{referenceHidden:(await Oj().fn(t)).data?.referenceHidden||m}}}},WS={sideX:"left",sideY:"top"},Xj={name:"adaptiveOrigin",async fn(t){const{x:a,y:i,rects:{floating:s},elements:{floating:d},platform:m,strategy:g,placement:y}=t,S=Zn(d),b=S.getComputedStyle(d);if(!(b.transitionDuration!=="0s"&&b.transitionDuration!==""))return{x:a,y:i,data:WS};const R=await m.getOffsetParent?.(d);let x={width:0,height:0};if(g==="fixed"&&S?.visualViewport)x={width:S.visualViewport.width,height:S.visualViewport.height};else if(R===S){const $=It(d);x={width:$.documentElement.clientWidth,height:$.documentElement.clientHeight}}else await m.isElement?.(R)&&(x=await m.getDimensions(R));const _=Pr(y);let A=a,z=i;_==="left"&&(A=x.width-(a+s.width)),_==="top"&&(z=x.height-(i+s.height));const N=_==="left"?"right":WS.sideX,M=_==="top"?"bottom":WS.sideY;return{x:A,y:z,data:{sideX:N,sideY:M}}}};function RA(t,a,i){const s=t==="inline-start"||t==="inline-end";return{top:"top",right:s?i?"inline-start":"inline-end":"right",bottom:"bottom",left:s?i?"inline-end":"inline-start":"left"}[a]}function xA(t,a,i){const{rects:s,placement:d}=t;return{side:RA(a,Pr(d),i),align:Ic(d)||"center",anchor:{width:s.reference.width,height:s.reference.height},positioner:{width:s.floating.width,height:s.floating.height}}}function OA(t){const{anchor:a,positionMethod:i="absolute",side:s="bottom",sideOffset:d=0,align:m="center",alignOffset:g=0,collisionBoundary:y,collisionPadding:S=5,sticky:b=!1,arrowPadding:T=5,disableAnchorTracking:R=!1,keepMounted:x=!1,floatingRootContext:_,mounted:A,collisionAvoidance:z,shiftCrossAxis:N=!1,nodeId:M,adaptiveOrigin:$,lazyFlip:Y=!1,externalTree:Z}=t,[V,I]=C.useState(null);!A&&V!==null&&I(null);const q=z.side||"flip",J=z.align||"flip",he=z.fallbackAxisSide||"end",Q=typeof a=="function"?a:void 0,fe=nt(Q),re=Q?fe:a,ce=Fo(a),ee=Fo(A),L=TA()==="rtl",k=V||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":L?"left":"right","inline-start":L?"right":"left"}[s],F=m==="center"?k:`${k}-${m}`;let W=S;const de=1,U=s==="bottom"?de:0,P=s==="top"?de:0,te=s==="right"?de:0,ae=s==="left"?de:0;typeof W=="number"?W={top:W+U,right:W+ae,bottom:W+P,left:W+te}:W&&(W={top:(W.top||0)+U,right:(W.right||0)+ae,bottom:(W.bottom||0)+P,left:(W.left||0)+te});const Se={boundary:y==="clipping-ancestors"?"clippingAncestors":y,padding:W},Re=C.useRef(null),Te=Fo(d),Me=Fo(g),Ae=[Ej(H=>{const le=xA(H,s,L),ze=typeof Te.current=="function"?Te.current(le):Te.current,He=typeof Me.current=="function"?Me.current(le):Me.current;return{mainAxis:ze,crossAxis:He,alignmentAxis:He}},[typeof d!="function"?d:0,typeof g!="function"?g:0,L,s])],Le=J==="none"&&q!=="shift",rt=!Le&&(b||N||q==="shift"),ot=q==="none"?null:Rj({...Se,padding:{top:W.top+de,right:W.right+de,bottom:W.bottom+de,left:W.left+de},mainAxis:!N&&q==="flip",crossAxis:J==="flip"?"alignment":!1,fallbackAxisSideDirection:he}),We=Le?null:wj(H=>{const le=It(H.elements.floating).documentElement;return{...Se,rootBoundary:N?{x:0,y:0,width:le.clientWidth,height:le.clientHeight}:void 0,mainAxis:J!=="none",crossAxis:rt,limiter:b||N?void 0:Tj(ze=>{if(!Re.current)return{};const{width:He,height:et}=Re.current.getBoundingClientRect(),lt=Kl(Pr(ze.placement)),ft=lt==="y"?He:et,At=lt==="y"?W.left+W.right:W.top+W.bottom;return{offset:ft/2+At/2}})}},[Se,b,N,W,J]);q==="shift"||J==="shift"||m==="center"?Ae.push(We,ot):Ae.push(ot,We),Ae.push(xj({...Se,apply({elements:{floating:H},availableWidth:le,availableHeight:ze,rects:He}){if(!ee.current)return;const et=H.style;et.setProperty("--available-width",`${le}px`),et.setProperty("--available-height",`${ze}px`);const lt=Zn(H).devicePixelRatio||1,{x:ft,y:At,width:st,height:je}=He.reference,Fe=(Math.round((ft+st)*lt)-Math.round(ft*lt))/lt,dt=(Math.round((At+je)*lt)-Math.round(At*lt))/lt;et.setProperty("--anchor-width",`${Fe}px`),et.setProperty("--anchor-height",`${dt}px`)}}),Ij(()=>({element:Re.current||It(Re.current).createElement("div"),padding:T,offsetParent:"floating"}),[T]),{name:"transformOrigin",fn(H){const{elements:le,middlewareData:ze,placement:He,rects:et,y:lt}=H,ft=Pr(He),At=Kl(ft),st=Re.current,je=ze.arrow?.x||0,Fe=ze.arrow?.y||0,dt=st?.clientWidth||0,Lt=st?.clientHeight||0,qt=je+dt/2,Dt=Fe+Lt/2,Qt=Math.abs(ze.shift?.y||0),xt=et.reference.height/2,Et=typeof d=="function"?d(xA(H,s,L)):d,Ht=Qt>Et,kt={top:`${qt}px calc(100% + ${Et}px)`,bottom:`${qt}px ${-Et}px`,left:`calc(100% + ${Et}px) ${Dt}px`,right:`${-Et}px ${Dt}px`}[ft],$t=`${qt}px ${et.reference.y+xt-lt}px`;return le.floating.style.setProperty("--transform-origin",rt&&At==="y"&&Ht?$t:kt),{}}},$j,$),ht(()=>{!A&&_&&_.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[A,_]);const Ze=C.useMemo(()=>({elementResize:!R&&typeof ResizeObserver<"u",layoutShift:!R&&typeof IntersectionObserver<"u"}),[R]),{refs:Je,elements:ct,x:tt,y:Ye,middlewareData:ne,update:Ee,placement:be,context:me,isPositioned:$e,floatingStyles:Pe}=Dj({rootContext:_,open:x?A:void 0,placement:F,middleware:Ae,strategy:i,whileElementsMounted:x?void 0:(...H)=>lA(...H,Ze),nodeId:M,externalTree:Z}),{sideX:Xe,sideY:at}=ne.adaptiveOrigin||WS,zt=$e?i:"fixed",yt=C.useMemo(()=>{const H=$?{position:zt,[Xe]:tt,[at]:Ye}:{position:zt,...Pe};return $e||(H.opacity=0),H},[$,zt,Xe,tt,at,Ye,Pe,$e]),St=C.useRef(null);ht(()=>{if(!A)return;const H=ce.current,le=typeof H=="function"?H():H,He=(CA(le)?le.current:le)||null||null;He!==St.current&&(Je.setPositionReference(He),St.current=He)},[A,Je,re,ce]),C.useEffect(()=>{if(!A)return;const H=ce.current;typeof H!="function"&&CA(H)&&H.current!==St.current&&(Je.setPositionReference(H.current),St.current=H.current)},[A,Je,re,ce]),C.useEffect(()=>{if(x&&A&&ct.domReference&&ct.floating)return lA(ct.domReference,ct.floating,Ee,Ze)},[x,A,ct,Ee,Ze]);const Rt=Pr(be),_t=RA(s,Rt,L),Ot=Ic(be)||"center",Nt=!!ne.hide?.referenceHidden;ht(()=>{Y&&A&&$e&&I(Rt)},[Y,A,$e,Rt]);const Yt=C.useMemo(()=>({position:"absolute",top:ne.arrow?.y,left:ne.arrow?.x}),[ne.arrow]),gn=ne.arrow?.centerOffset!==0;return C.useMemo(()=>({positionerStyles:yt,arrowStyles:Yt,arrowRef:Re,arrowUncentered:gn,side:_t,align:Ot,physicalSide:Rt,anchorHidden:Nt,refs:Je,context:me,isPositioned:$e,update:Ee}),[yt,Yt,Re,gn,_t,Ot,Rt,Nt,Je,me,$e,Ee])}function CA(t){return t!=null&&"current"in t}let Er=(function(t){return t.open="data-open",t.closed="data-closed",t[t.startingStyle=zd.startingStyle]="startingStyle",t[t.endingStyle=zd.endingStyle]="endingStyle",t.anchorHidden="data-anchor-hidden",t.side="data-side",t.align="data-align",t})({}),M2=(function(t){return t.popupOpen="data-popup-open",t.pressed="data-pressed",t})({});const Pj={[M2.popupOpen]:""},Fj={[M2.popupOpen]:"",[M2.pressed]:""},Qj={[Er.open]:""},Jj={[Er.closed]:""},Kj={[Er.anchorHidden]:""},_A={open(t){return t?Pj:null}},AA={open(t){return t?Fj:null}},Lu={open(t){return t?Qj:Jj},anchorHidden(t){return t?Kj:null}};function z2(t){return t==="starting"?r9:No}function DA(t,a,{styles:i,transitionStatus:s,props:d,refs:m,hidden:g,inert:y=!1}){const S={...i};return y&&(S.pointerEvents="none"),Dn("div",t,{state:a,ref:m,props:[{role:"presentation",hidden:g,style:S},z2(s),d],stateAttributesMapping:Lu})}function MA(){const t=C.useContext(cS);if(!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":vo(73));const a=t.useState("toasts");return C.useMemo(()=>({toasts:a,add:t.addToast,close:t.closeToast,update:t.updateToast,promise:t.promiseToast}),[a,t])}function kd(...t){return CT(pC(t))}const zA={Viewport:"_Viewport_ai81v_1",Toast:"_Toast_ai81v_14"};let Ph=null,Py=3e3;function Wj({timeout:t}){const a=MA();return C.useEffect(()=>(Ph=a,Py=t,()=>{Ph=null}),[a,t]),null}const Uo={success:(t,a)=>Ph?.add({description:t,timeout:a?.timeout||Py}),error:(t,a)=>Ph?.add({description:t,timeout:a?.timeout||Py}),info:(t,a)=>Ph?.add({description:t,timeout:a?.timeout||Py}),warning:(t,a)=>Ph?.add({description:t,timeout:a?.timeout||Py})};function e7({toastConfigs:t}){const a=t?.timeout??3e3;return X.jsxs(d_,{timeout:a,children:[X.jsx(Wj,{timeout:a}),X.jsx(t7,{configs:t})]})}function t7({configs:t}){const{toasts:a}=MA();return X.jsx(qj,{children:X.jsx(T_,{className:kd(zA.Viewport,t?.viewportClassName),children:a.map(i=>X.jsx(C_,{toast:i,className:kd("pointer-events-none flex items-center justify-center px-6 py-3 min-w-[200px] max-w-[80vw]","text-white text-base rounded-md bg-black/80",zA.Toast,t?.className),style:t?.style,children:X.jsx(D_,{className:"text-xs",children:i.description})},i.id))})})}class n7{baseUrl;credentials;interceptors;timeout;onError;headers;constructor({baseUrl:a,timeout:i=1/0,responseInterceptor:s=S=>S.data,requestInterceptor:d=S=>S,onError:m=()=>{},headers:g,credentials:y="include"}){this.baseUrl=a,this.timeout=i,this.credentials=y,this.interceptors={request:d,response:s},this.headers=new Headers({"Content-Type":"application/json",...g}),this.onError=m}async request(a){const i=new AbortController;a.url=`${this.baseUrl}${a.url}`,a=this.interceptors.request(a);const s=new Headers(this.headers);Object.entries(a.headers||{}).forEach(([y,S])=>{s.set(y,S)});const d=this.headers.get("content-type");let m=null;if(a.data instanceof FormData)m=a.data,s.delete("Content-Type");else if(a.data!==void 0&&a.method!=="GET")if(d==="application/x-www-form-urlencoded"){const y=new URLSearchParams;for(const S in a.data)a.data[S]!==void 0&&y.append(S,a.data[S]);m=y.toString()}else m=JSON.stringify(a.data);else if(a.method==="GET"){const y=new URLSearchParams;for(const b in a.data)a.data[b]!==void 0&&y.append(b,a.data[b]);const S=y.toString();a.url+=S?`?${S}`:""}const g=fetch(a.url,{method:a.method,headers:s,body:m,signal:a.signal||i.signal,credentials:this.credentials});try{const y=a.timeout||this.timeout,{timeoutId:S,timeoutPromise:b}=this._setTimeout(y,i),T=await Promise.race([g,b].filter(Boolean));if(S&&clearTimeout(S),T.ok){const R=await T.json();return this.interceptors.response(R,T).catch(x=>(this.onError({data:x,response:T}),Promise.reject(R)))}else{const R=await T.json();return this.onError({data:R,response:T}),Promise.reject(R)}}catch(y){return y.name!=="AbortError"&&this.onError({}),Promise.reject(y)}}_setTimeout(a,i){let s=null,d=null;return a!==1/0&&(d=new Promise((m,g)=>{s=setTimeout(()=>{g(new Error("请求超时")),i.abort()},a)})),{timeoutPromise:d,timeoutId:s}}get(a,i,s){return this.request({...s,url:a,method:"GET",data:i})}post(a,i,s){return this.request({...s,url:a,method:"POST",data:i})}put(a,i,s){return this.request({...s,url:a,method:"PUT",data:i})}delete(a,i){return this.request({...i,url:a,method:"DELETE"})}patch(a,i,s){return this.request({...s,url:a,method:"PATCH",data:i})}}const ja=new n7({baseUrl:"https://apis.sdk.mobileztgame.com",credentials:"omit",headers:{"Content-Type":"application/x-www-form-urlencoded"},async responseInterceptor(t,a){if(["/passport-api/v2/ztgame/auth/login","/passport-api/v2/sms-captchas","/passport-api/v2/ztgame/auth/mobile-register","/passport-api/v2/ztgame/auth/auth","/passport-api/v2/ztgame/auth/re-auth","/passport-api/v2/ztgame/user-center/forget-password/forget-password-keys","/passport-api/v2/ztgame/user-center/forget-password/","/passport-api/v2/ztgame/user-center/forget-password/sms-captchas","/passport-api/v2/ztgame/user-center/forget-password/forget-password-update","/idcard"].some(s=>a.url.includes(s))){const s=a.headers.get("set-authentication")||a.headers.get("Set-Authentication")||"";return{...t,_auth:s}}if(t?.code!==0)throw new Error(t.error);return t},onError({response:t,data:a}){if(t&&t?.status!==401){const i=`${a?.message||a?.detail||"未知错误"}`;Uo.error(i)}}});function NA(t){ja.headers.set("Authentication",t)}const eo={ROLE_ID:"roleid",GIANT:"giant",MOBILE:"mobile"},e1={default:{types:[eo.GIANT,eo.MOBILE],default:eo.GIANT},5327:{types:[eo.GIANT,eo.MOBILE],default:eo.MOBILE},5273:{types:[eo.ROLE_ID],default:eo.ROLE_ID},5199:{types:[eo.ROLE_ID],default:eo.ROLE_ID},5012:{types:[eo.ROLE_ID],default:eo.ROLE_ID},5242:{types:[eo.GIANT,eo.MOBILE],default:eo.MOBILE}};function ha(...t){return CT(pC(t))}function o7(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(a,i)=>String.fromCharCode(Number.parseInt(i,16))))}function a7(t){return t==="5199"||t==="5012"}function r7(t){const{entity:a,gaplaySign:i}=t;return o7(`${JSON.stringify(a)}$$${i}`)}function t1(t,a){return a||e1[t]?.types||e1.default?.types||[]}function l7(t,a){return a||e1[t]?.default||e1.default?.default}function UA({loginTypes:t,gameId:a}){return t1(a,t).includes(eo.GIANT)}function jA({loginTypes:t,gameId:a}){return t1(a,t).includes(eo.ROLE_ID)}function LA({loginTypes:t,gameId:a}){return t1(a,t).includes(eo.MOBILE)}function HA({gameId:t}){ja.headers.set("X-GAME-ID",t),ja.headers.set("X-Login-H5","1");const a=localStorage.getItem("UNIQUE_ID");a&&ja.headers.set("X-Client-Info",JSON.stringify({sdk_version:"3.0.0",device_udid:a,appunid:a}))}async function i7({gameId:t}){HA({gameId:t});let a=localStorage.getItem("UNIQUE_ID");a||(a=(await(await k5.load()).get()).visitorId,localStorage.setItem("UNIQUE_ID",a)),ja.headers.set("X-Client-Info",JSON.stringify({sdk_version:"3.0.0",device_udid:a,appunid:a}))}const u7=[{code:"86",name:"中国大陆"},{code:"886",name:"台湾地区"},{code:"852",name:"香港特别行政区"},{code:"853",name:"澳门特别行政区"},{code:"1",name:"美国"},{code:"81",name:"日本"},{code:"376",name:"安道尔"},{code:"971",name:"阿拉伯联合酋长国"},{code:"93",name:"阿富汗"},{code:"1268",name:"安提瓜和巴布达"},{code:"1264",name:"安圭拉"},{code:"355",name:"阿尔巴尼亚"},{code:"374",name:"亚美尼亚"},{code:"244",name:"安哥拉"},{code:"54",name:"阿根廷"},{code:"1684",name:"美属萨摩亚"},{code:"43",name:"奥地利"},{code:"61",name:"澳大利亚"},{code:"297",name:"阿鲁巴"},{code:"994",name:"阿塞拜疆"},{code:"387",name:"波斯尼亚和黑塞哥维那"},{code:"1246",name:"巴巴多斯"},{code:"880",name:"孟加拉国"},{code:"32",name:"比利时"},{code:"226",name:"布基纳法索"},{code:"359",name:"保加利亚"},{code:"973",name:"巴林"},{code:"257",name:"布隆迪"},{code:"229",name:"贝宁"},{code:"1441",name:"百慕大群岛"},{code:"673",name:"文莱"},{code:"591",name:"玻利维亚"},{code:"599",name:"荷兰加勒比"},{code:"55",name:"巴西"},{code:"1242",name:"巴哈马"},{code:"975",name:"不丹"},{code:"267",name:"博茨瓦纳"},{code:"375",name:"白俄罗斯"},{code:"501",name:"伯利兹"},{code:"1",name:"加拿大"},{code:"243",name:"刚果民主共和国"},{code:"236",name:"中非共和国"},{code:"242",name:"刚果共和国"},{code:"41",name:"瑞士"},{code:"225",name:"象牙海岸"},{code:"682",name:"库克群岛"},{code:"56",name:"智利"},{code:"237",name:"喀麦隆"},{code:"57",name:"哥伦比亚"},{code:"506",name:"哥斯达黎加"},{code:"53",name:"古巴"},{code:"238",name:"佛得角共和国"},{code:"599",name:"库拉索"},{code:"357",name:"塞浦路斯"},{code:"420",name:"捷克"},{code:"49",name:"德国"},{code:"253",name:"吉布提"},{code:"45",name:"丹麦"},{code:"1767",name:"多米尼加"},{code:"1809",name:"多米尼加共和国"},{code:"213",name:"阿尔及利亚"},{code:"593",name:"厄瓜多尔"},{code:"372",name:"爱沙尼亚"},{code:"20",name:"埃及"},{code:"291",name:"厄立特里亚"},{code:"34",name:"西班牙"},{code:"251",name:"埃塞俄比亚"},{code:"358",name:"芬兰"},{code:"679",name:"斐济"},{code:"691",name:"密克罗尼西亚"},{code:"298",name:"法罗群岛"},{code:"33",name:"法国"},{code:"241",name:"加蓬"},{code:"44",name:"英国"},{code:"1473",name:"格林纳达"},{code:"995",name:"格鲁吉亚"},{code:"594",name:"法属圭亚那"},{code:"233",name:"加纳"},{code:"350",name:"直布罗陀"},{code:"299",name:"格陵兰岛"},{code:"220",name:"冈比亚"},{code:"224",name:"几内亚"},{code:"590",name:"瓜德罗普岛"},{code:"240",name:"赤道几内亚"},{code:"30",name:"希腊"},{code:"502",name:"瓜地马拉"},{code:"1671",name:"关岛"},{code:"245",name:"几内亚比绍共和国"},{code:"592",name:"圭亚那"},{code:"504",name:"洪都拉斯"},{code:"385",name:"克罗地亚"},{code:"509",name:"海地"},{code:"36",name:"匈牙利"},{code:"62",name:"印度尼西亚"},{code:"353",name:"爱尔兰"},{code:"972",name:"以色列"},{code:"91",name:"印度"},{code:"964",name:"伊拉克"},{code:"98",name:"伊朗"},{code:"354",name:"冰岛"},{code:"39",name:"意大利"},{code:"1876",name:"牙买加"},{code:"962",name:"约旦"},{code:"254",name:"肯尼亚"},{code:"996",name:"吉尔吉斯斯坦"},{code:"855",name:"柬埔寨"},{code:"686",name:"基里巴斯"},{code:"269",name:"科摩罗"},{code:"1869",name:"圣基茨和尼维斯"},{code:"850",name:"朝鲜"},{code:"82",name:"韩国"},{code:"965",name:"科威特"},{code:"1345",name:"开曼群岛"},{code:"7",name:"哈萨克斯坦"},{code:"856",name:"老挝"},{code:"961",name:"黎巴嫩"},{code:"1758",name:"圣露西亚"},{code:"423",name:"列支敦士登"},{code:"94",name:"斯里兰卡"},{code:"231",name:"利比里亚"},{code:"266",name:"莱索托"},{code:"370",name:"立陶宛"},{code:"352",name:"卢森堡"},{code:"371",name:"拉脱维亚"},{code:"218",name:"利比亚"},{code:"212",name:"摩洛哥"},{code:"377",name:"摩纳哥"},{code:"373",name:"摩尔多瓦"},{code:"382",name:"黑山"},{code:"261",name:"马达加斯加"},{code:"692",name:"马绍尔群岛"},{code:"389",name:"北马其顿"},{code:"223",name:"马里"},{code:"95",name:"缅甸"},{code:"976",name:"蒙古"},{code:"222",name:"毛里塔尼亚"},{code:"1664",name:"蒙特塞拉特岛"},{code:"356",name:"马耳他"},{code:"230",name:"毛里求斯"},{code:"960",name:"马尔代夫"},{code:"265",name:"马拉维"},{code:"52",name:"墨西哥"},{code:"60",name:"马来西亚"},{code:"258",name:"莫桑比克"},{code:"264",name:"纳米比亚"},{code:"687",name:"新喀里多尼亚"},{code:"227",name:"尼日尔"},{code:"234",name:"尼日利亚"},{code:"505",name:"尼加拉瓜"},{code:"31",name:"荷兰"},{code:"47",name:"挪威"},{code:"977",name:"尼泊尔"},{code:"674",name:"拿鲁岛"},{code:"64",name:"新西兰"},{code:"968",name:"阿曼"},{code:"507",name:"巴拿马"},{code:"51",name:"秘鲁"},{code:"689",name:"法属波利尼西亚"},{code:"675",name:"巴布亚新几内亚"},{code:"63",name:"菲律宾"},{code:"92",name:"巴基斯坦"},{code:"48",name:"波兰"},{code:"508",name:"圣彼埃尔和密克隆岛"},{code:"1787",name:"波多黎各"},{code:"351",name:"葡萄牙"},{code:"680",name:"帕劳"},{code:"595",name:"巴拉圭"},{code:"974",name:"卡塔尔"},{code:"262",name:"留尼汪"},{code:"40",name:"罗马尼亚"},{code:"381",name:"塞尔维亚"},{code:"7",name:"俄罗斯"},{code:"250",name:"卢旺达"},{code:"966",name:"沙特阿拉伯"},{code:"677",name:"所罗门群岛"},{code:"248",name:"塞舌尔"},{code:"249",name:"苏丹"},{code:"46",name:"瑞典"},{code:"65",name:"新加坡"},{code:"386",name:"斯洛文尼亚"},{code:"421",name:"斯洛伐克"},{code:"232",name:"塞拉利昂"},{code:"378",name:"圣马力诺"},{code:"221",name:"塞内加尔"},{code:"252",name:"索马里"},{code:"597",name:"苏里南"},{code:"239",name:"圣多美和普林西比"},{code:"503",name:"萨尔瓦多"},{code:"963",name:"叙利亚"},{code:"268",name:"埃斯瓦蒂尼"},{code:"1649",name:"特克斯和凯科斯群岛"},{code:"235",name:"乍得"},{code:"228",name:"多哥"},{code:"66",name:"泰国"},{code:"992",name:"塔吉克斯坦"},{code:"670",name:"东帝汶"},{code:"993",name:"土库曼斯坦"},{code:"216",name:"突尼斯"},{code:"676",name:"汤加"},{code:"90",name:"土耳其"},{code:"1868",name:"特立尼达和多巴哥"},{code:"255",name:"坦桑尼亚"},{code:"380",name:"乌克兰"},{code:"256",name:"乌干达"},{code:"598",name:"乌拉圭"},{code:"998",name:"乌兹别克斯坦"},{code:"1784",name:"圣文森特和格林纳丁斯"},{code:"58",name:"委内瑞拉"},{code:"1284",name:"英属处女群岛"},{code:"84",name:"越南"},{code:"678",name:"瓦努阿图"},{code:"685",name:"萨摩亚"},{code:"967",name:"也门"},{code:"269",name:"马约特"},{code:"27",name:"南非"},{code:"260",name:"赞比亚"},{code:"263",name:"津巴布韦"}].map(t=>({label:t.name,value:t.code,id:`${t.code}-${t.name}`}));function s7(t){return u7}function c7(t){return"account"in t}function f7({gameId:t,serverUserInfo:a,extraState:i}){const s={game_id:t,xToken:r7(a),saveTime:a.entity.time,$version:"v2",extraState:i};if(c7(a))s.openid=a.entity.openid,s.gaplaySign=a.gaplaySign,s.account=a.account,s.username=a.account.view_name,s.loginByRoleMail=!1,s.channelId=a.channel||6;else if(a.gaplaySign){const{ZONEID:d,openid:m,CHARID:g,NAME:y,REALZONEID:S,ZONENAME:b}=a.entity;s.openid=m,s.zone={zoneid:S||d,zonename:b,area:d},s.char={...a.entity,CHARID:g,NAME:y,GAMEPOINT:a.entity.GAMEPOINT,VIPLEVEL:a.entity.VIPLEVEL},s.loginByRoleMail=!0,s.gaplaySign=a.gaplaySign}else{const{ZONEID:d,CHARID:m,NAME:g,REALZONEID:y,ZONENAME:S,OPENID:b,CHANNELID:T,GAMEPOINT:R,VIPLEVEL:x}=a.entity;s.openid=b,s.channelId=T,s.char={CHARID:m,NAME:g,GAMEPOINT:R,VIPLEVEL:x},s.loginByRoleMail=!1,s.username=g,s.zone={zoneid:y||d,zonename:S,area:d},s.xToken=void 0}return s}function VA(){try{const t=localStorage.getItem("userInfo")||"[]";return JSON.parse(t)}catch{return[]}}function N2(t){return VA().find(i=>i.game_id===t)}function d7(t){const a=localStorage.getItem("userInfo")||"[]",i=JSON.parse(a),s=i.find(m=>m.game_id===t);s?.openid&&kA(s.openid,t);const d=i.filter(m=>m.game_id!==t);localStorage.setItem("userInfo",JSON.stringify(d))}function p7(t){const a=VA(),i=N2(t.game_id),s=a.findIndex(d=>d.game_id===t.game_id);i?a[s]=t:a.push(t),localStorage.setItem("userInfo",JSON.stringify(a))}const Fy="LOGIN_SDK_ACCOUNTS";function Fh(t){try{const a=JSON.parse(localStorage.getItem(Fy)||"[]");return t?a.filter(i=>i.gameId===t):a}catch{return[]}}function n1(t,a,i){if(!i)return;const s=JSON.parse(localStorage.getItem(Fy)||"[]");let d=1;const m=s.filter(S=>S.openid===t.accid&&S.gameId===i?(d=(S.loginCnt||1)+1,!1):!0),y=[{openid:t.accid,username:t.account?.view_name||"",uid:t.account?.uid||"",mobile:t.account?.mobile||"",accountType:t.account?.account_type||0,authorization:a,loginAt:Date.now(),loginCnt:d,gameId:i},...m].slice(0,20);localStorage.setItem(Fy,JSON.stringify(y))}function kA(t,a){if(!a)return;const s=JSON.parse(localStorage.getItem(Fy)||"[]").filter(d=>!(d.openid===t&&d.gameId===a));localStorage.setItem(Fy,JSON.stringify(s))}let BA={};function YA(t){BA=t}function Bd(t){const a=t||BA.gameId;if(!a)throw new Error("gameId is required. Call init({ gameId }) first or pass it as an argument.");return a}const GA=C.createContext(void 0),h7={enabled:!0,days:7},qA={"--primary-color":"#787bf4","--icon-color":"#a9aad1","--input-border-color":"#cad0e0","--input-label-color":"var(--jssdk-primary-color)","--input-bg-color":"#fff"};function As(){const t=C.use(GA);if(!t)throw new Error("useConfig 必须在 ConfigProvider 中使用");return t}function ZA({children:t,value:a}){const i=Bd(a.gameId),s=t1(i,a.loginTypes),d=l7(i,a.defaultLoginType),m=C.useRef(null);HA({gameId:i});const g=Nh.useMemo(()=>!a.defaultLoginType&&Fh(i).length>0?"quick":d,[a.defaultLoginType,i,d]),[y,S]=C.useState(g),[b,T]=C.useState(!0),[R,x]=C.useState(!1),[_,A]=C.useState(!1),[z,N]=C.useState(""),M=()=>{x(!0)};C.useEffect(()=>{i7({gameId:i})},[i]);const $={...a,gameId:i,loginTypes:s,defaultLoginType:d,autoLoginConfig:{...h7,...a.autoLoginConfig}};C.useEffect(()=>{document.body.classList.add(`game-${i}`)},[i]);function Y(Z){Object.entries(Z).forEach(([V,I])=>{const q=`--jssdk-${V.replace(/^--/,"")}`;document.documentElement.style.setProperty(q,I)})}return C.useEffect(()=>{const Z=m.current;if(Z){const V={...qA,...a.styleVars};Y(V)}return()=>{Z&&Y(qA)}},[a.styleVars]),X.jsx("div",{ref:m,children:X.jsx(GA,{value:{...$,currentLoginType:y,setCurrentLoginType:S,isShowGiantLogo:b,setIsShowGiantLogo:T,showRealNameModal:R,setShowRealNameModal:x,triggerRealNameAuth:M,isAutoLoggingIn:_,setIsAutoLoggingIn:A,autoLoginAccountName:z,setAutoLoginAccountName:N,onClose:a.onClose},children:t})})}function Qy({controlled:t,default:a,name:i,state:s="value"}){const{current:d}=C.useRef(t!==void 0),[m,g]=C.useState(a),y=d?t:m;if(process.env.NODE_ENV!=="production"){C.useEffect(()=>{d!==(t!==void 0)&&Ud([`A component is changing the ${d?"":"un"}controlled ${s} state of ${i} to be ${d?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${i} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
259
259
  `))},[s,i,t]);const{current:b}=C.useRef(a);C.useEffect(()=>{!d&&IA(b)!==IA(a)&&Ud([`A component is changing the default ${s} state of an uncontrolled ${i} after being initialized. To suppress this warning opt to use a controlled ${i}.`].join(`
260
260
  `))},[a])}const S=C.useCallback(b=>{d||g(b)},[]);return[y,S]}function IA(t){let a=0;const i=new WeakMap;try{return JSON.stringify(t,function(m,g){if(!(m==="_owner"&&this!=null&&typeof this=="object"&&"$$typeof"in this)){if(typeof g=="bigint")return`__bigint__:${g}`;if(g!==null&&typeof g=="object"){const y=i.get(g);if(y!==void 0)return`__object__:${y}`;i.set(g,a),a+=1}return g}})??`__top__:${typeof t}`}catch{return"__unserializable__"}}const U2=C.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});process.env.NODE_ENV!=="production"&&(U2.displayName="CompositeListContext");function m7(){return C.useContext(U2)}function g7(t){const{children:a,elementsRef:i,labelsRef:s,onMapChange:d}=t,m=nt(d),g=C.useRef(0),y=pa(v7).current,S=pa(y7).current,[b,T]=C.useState(0),R=C.useRef(b),x=nt((M,$)=>{S.set(M,$??null),R.current+=1,T(R.current)}),_=nt(M=>{S.delete(M),R.current+=1,T(R.current)}),A=C.useMemo(()=>{const M=new Map;return Array.from(S.keys()).filter(Y=>Y.isConnected).sort(b7).forEach((Y,Z)=>{const V=S.get(Y)??{};M.set(Y,{...V,index:Z})}),M},[S,b]);ht(()=>{if(typeof MutationObserver!="function"||A.size===0)return;const M=new MutationObserver($=>{const Y=new Set,Z=V=>Y.has(V)?Y.delete(V):Y.add(V);$.forEach(V=>{V.removedNodes.forEach(Z),V.addedNodes.forEach(Z)}),Y.size===0&&(R.current+=1,T(R.current))});return A.forEach(($,Y)=>{Y.parentElement&&M.observe(Y.parentElement,{childList:!0})}),()=>{M.disconnect()}},[A]),ht(()=>{R.current===b&&(i.current.length!==A.size&&(i.current.length=A.size),s&&s.current.length!==A.size&&(s.current.length=A.size),g.current=A.size),m(A)},[m,A,i,s,b]),ht(()=>()=>{i.current=[]},[i]),ht(()=>()=>{s&&(s.current=[])},[s]);const z=nt(M=>(y.add(M),()=>{y.delete(M)}));ht(()=>{y.forEach(M=>M(A))},[y,A]);const N=C.useMemo(()=>({register:x,unregister:_,subscribeMapChange:z,elementsRef:i,labelsRef:s,nextIndexRef:g}),[x,_,z,i,s,g]);return X.jsx(U2.Provider,{value:N,children:a})}function y7(){return new Map}function v7(){return new Set}function b7(t,a){const i=t.compareDocumentPosition(a);return i&Node.DOCUMENT_POSITION_FOLLOWING||i&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:i&Node.DOCUMENT_POSITION_PRECEDING||i&Node.DOCUMENT_POSITION_CONTAINS?1:0}function vl(t){return Xc(t,"base-ui")}let $A=(function(t){return t[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t})({});function S7(t={}){const{label:a,metadata:i,textRef:s,indexGuessBehavior:d,index:m}=t,{register:g,unregister:y,subscribeMapChange:S,elementsRef:b,labelsRef:T,nextIndexRef:R}=m7(),x=C.useRef(-1),[_,A]=C.useState(m??(d===$A.GuessFromOrder?()=>{if(x.current===-1){const M=R.current;R.current+=1,x.current=M}return x.current}:-1)),z=C.useRef(null),N=C.useCallback(M=>{if(z.current=M,_!==-1&&M!==null&&(b.current[_]=M,T)){const $=a!==void 0;T.current[_]=$?a:s?.current?.textContent??M.textContent}},[_,b,T,a,s]);return ht(()=>{if(m!=null)return;const M=z.current;if(M)return g(M,i),()=>{y(M)}},[m,g,y,i]),ht(()=>{if(m==null)return S(M=>{const $=z.current?M.get(z.current)?.index:null;$!=null&&A($)})},[m,S,A]),C.useMemo(()=>({ref:N,index:_}),[_,N])}const XA="ArrowUp",PA="ArrowDown",FA="ArrowLeft",QA="ArrowRight",JA="Home",KA="End",E7=new Set([FA,QA]),w7=new Set([XA,PA]),T7=new Set([...E7,...w7]);[...T7];const o1=new Set([XA,PA,FA,QA,JA,KA]);function j2(t){const a=C.useRef(!0);a.current&&(a.current=!1,t())}let WA={},eD={},tD="";function R7(t){if(typeof document>"u")return!1;const a=It(t);return Zn(a).innerWidth-a.documentElement.clientWidth>0}function x7(t){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const i=It(t),s=i.documentElement,d=i.body,m=Gc(s)?s:d,g=m.style.overflowY,y=s.style.scrollbarGutter;s.style.scrollbarGutter="stable",m.style.overflowY="scroll";const S=m.offsetWidth;m.style.overflowY="hidden";const b=m.offsetWidth;return m.style.overflowY=g,s.style.scrollbarGutter=y,S===b}function O7(t){const a=It(t),i=a.documentElement,s=a.body,d=Gc(i)?i:s,m={overflowY:d.style.overflowY,overflowX:d.style.overflowX};return Object.assign(d.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(d.style,m)}}function C7(t){const a=It(t),i=a.documentElement,s=a.body,d=Zn(i);let m=0,g=0,y=!1;const S=Au.create();if(YT&&(d.visualViewport?.scale??1)!==1)return()=>{};function b(){const _=d.getComputedStyle(i),A=d.getComputedStyle(s),M=(_.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";m=i.scrollTop,g=i.scrollLeft,WA={scrollbarGutter:i.style.scrollbarGutter,overflowY:i.style.overflowY,overflowX:i.style.overflowX},tD=i.style.scrollBehavior,eD={position:s.style.position,height:s.style.height,width:s.style.width,boxSizing:s.style.boxSizing,overflowY:s.style.overflowY,overflowX:s.style.overflowX,scrollBehavior:s.style.scrollBehavior};const $=i.scrollHeight>i.clientHeight,Y=i.scrollWidth>i.clientWidth,Z=_.overflowY==="scroll"||A.overflowY==="scroll",V=_.overflowX==="scroll"||A.overflowX==="scroll",I=Math.max(0,d.innerWidth-s.clientWidth),q=Math.max(0,d.innerHeight-s.clientHeight),J=parseFloat(A.marginTop)+parseFloat(A.marginBottom),he=parseFloat(A.marginLeft)+parseFloat(A.marginRight),Q=Gc(i)?i:s;if(y=x7(t),y){i.style.scrollbarGutter=M,Q.style.overflowY="hidden",Q.style.overflowX="hidden";return}Object.assign(i.style,{scrollbarGutter:M,overflowY:"hidden",overflowX:"hidden"}),($||Z)&&(i.style.overflowY="scroll"),(Y||V)&&(i.style.overflowX="scroll"),Object.assign(s.style,{position:"relative",height:J||q?`calc(100dvh - ${J+q}px)`:"100dvh",width:he||I?`calc(100vw - ${he+I}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),s.scrollTop=m,s.scrollLeft=g,i.setAttribute("data-base-ui-scroll-locked",""),i.style.scrollBehavior="unset"}function T(){Object.assign(i.style,WA),Object.assign(s.style,eD),y||(i.scrollTop=m,i.scrollLeft=g,i.removeAttribute("data-base-ui-scroll-locked"),i.style.scrollBehavior=tD)}function R(){T(),S.request(b)}b();const x=rn(d,"resize",R);return()=>{S.cancel(),T(),typeof d.removeEventListener=="function"&&x()}}class _7{lockCount=0;restore=null;timeoutLock=hl.create();timeoutUnlock=hl.create();acquire(a){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(a)),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(a){if(this.lockCount===0||this.restore!==null)return;const s=It(a).documentElement,d=Zn(s).getComputedStyle(s).overflowY;if(d==="hidden"||d==="clip"){this.restore=Ta;return}const m=YC||!R7(a);this.restore=m?O7(a):C7(a)}}const A7=new _7;function nD(t=!0,a=null){ht(()=>{if(t)return A7.acquire(a)},[t,a])}function D7(t){const a=C.useRef(""),i=C.useCallback(d=>{d.defaultPrevented||(a.current=d.pointerType,t(d,d.pointerType))},[t]);return{onClick:C.useCallback(d=>{if(d.detail===0){t(d,"keyboard");return}"pointerType"in d?t(d,d.pointerType):t(d,a.current),a.current=""},[t]),onPointerDown:i}}function a1(t,a){const i=C.useRef(t),s=nt(a);ht(()=>{i.current!==t&&s(i.current)},[t,s]),ht(()=>{i.current=t},[t])}function L2(t){const[a,i]=C.useState(null),s=nt((g,y)=>{t||i(y||(YC?"touch":""))});a1(t,g=>{g&&!t&&i(null)});const{onClick:d,onPointerDown:m}=D7(s);return C.useMemo(()=>({openMethod:a,triggerProps:{onClick:d,onPointerDown:m}}),[a,d,m])}function M7(t){const{store:a,parentContext:i,actionsRef:s,isDrawer:d}=t,m=a.useState("open"),g=a.useState("disablePointerDismissal"),y=a.useState("modal"),S=a.useState("popupElement"),{openMethod:b,triggerProps:T}=L2(m);cA(a);const{forceUnmount:R}=fA(m,a),x=C.useCallback(()=>{a.setOpen(!1,tn(j_))},[a]);C.useImperativeHandle(s,()=>({unmount:R,close:x}),[R,x]);const _=mA({popupStore:a,onOpenChange:a.setOpen,treatPopupAsFloatingElement:!0}),[A,z]=C.useState(0),[N,M]=C.useState(0),$=A===0,Y=bA(_),Z=R2(_,{outsidePressEvent(){return a.context.internalBackdropRef.current||a.context.backdropRef.current?"intentional":{mouse:y==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(fe){if(!a.context.outsidePressEnabledRef.current||"button"in fe&&fe.button!==0||"touches"in fe&&fe.touches.length!==1)return!1;const re=fo(fe);if($&&!g){const ce=re;return y&&(a.context.internalBackdropRef.current||a.context.backdropRef.current)?a.context.internalBackdropRef.current===ce||a.context.backdropRef.current===ce||Tt(ce,S)&&!ce?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:$});nD(m&&y===!0,S);const{getReferenceProps:V,getFloatingProps:I,getTriggerProps:q}=Xy([Y,Z]);a.useContextCallback("onNestedDialogOpen",(fe,re)=>{z(fe),M(re)}),a.useContextCallback("onNestedDialogClose",()=>{z(0),M(0)}),C.useEffect(()=>(i?.onNestedDialogOpen&&m&&i.onNestedDialogOpen(A+1,N+(d?1:0)),i?.onNestedDialogClose&&!m&&i.onNestedDialogClose(),()=>{i?.onNestedDialogClose&&m&&i.onNestedDialogClose()}),[d,m,A,N,i]);const J=C.useMemo(()=>V(T),[V,T]),he=C.useMemo(()=>q(T),[q,T]),Q=C.useMemo(()=>I(),[I]);a.useSyncedValues({openMethod:b,activeTriggerProps:J,inactiveTriggerProps:he,popupProps:Q,floatingRootContext:_,nestedOpenDialogCount:A,nestedOpenDrawerCount:N})}const H2=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(H2.displayName="DialogRootContext");function wr(t){const a=C.useContext(H2);if(t===!1&&a===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.":vo(27));return a}const z7={...pA,modal:ut(t=>t.modal),nested:ut(t=>t.nested),nestedOpenDialogCount:ut(t=>t.nestedOpenDialogCount),nestedOpenDrawerCount:ut(t=>t.nestedOpenDrawerCount),disablePointerDismissal:ut(t=>t.disablePointerDismissal),openMethod:ut(t=>t.openMethod),descriptionElementId:ut(t=>t.descriptionElementId),titleElementId:ut(t=>t.titleElementId),viewportElement:ut(t=>t.viewportElement),role:ut(t=>t.role)};class V2 extends mS{constructor(a){super(N7(a),{popupRef:C.createRef(),backdropRef:C.createRef(),internalBackdropRef:C.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new qS,onOpenChange:void 0,onOpenChangeComplete:void 0},z7)}setOpen=(a,i)=>{if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!a&&i.trigger==null&&this.state.activeTriggerId!=null&&(i.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(a,i),i.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(a,i);const s={open:a},d=i.trigger?.id??null;(d||a)&&(s.activeTriggerId=d,s.activeTriggerElement=i.trigger??null),this.update(s)};static useStore(a,i){const s=pa(()=>new V2(i)).current;return a??s}}function N7(t={}){return{...dA(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...t}}const r1=C.createContext(!1);process.env.NODE_ENV!=="production"&&(r1.displayName="IsDrawerContext");function k2(t){const{children:a,open:i,defaultOpen:s=!1,onOpenChange:d,onOpenChangeComplete:m,disablePointerDismissal:g=!1,modal:y=!0,actionsRef:S,handle:b,triggerId:T,defaultTriggerId:R=null}=t,x=wr(!0),_=C.useContext(r1),A=!!x,z=V2.useStore(b?.store,{open:s,openProp:i,activeTriggerId:R,triggerIdProp:T,modal:y,disablePointerDismissal:g,nested:A});j2(()=>{i===void 0&&z.state.open===!1&&s===!0&&z.update({open:!0,activeTriggerId:R})}),z.useControlledProp("openProp",i),z.useControlledProp("triggerIdProp",T),z.useSyncedValues({disablePointerDismissal:g,nested:A,modal:y}),z.useContextCallback("onOpenChange",d),z.useContextCallback("onOpenChangeComplete",m);const N=z.useState("payload");M7({store:z,actionsRef:S,parentContext:x?.store.context,isDrawer:_});const M=C.useMemo(()=>({store:z}),[z]);return X.jsx(r1.Provider,{value:!1,children:X.jsx(H2.Provider,{value:M,children:typeof a=="function"?a({payload:N}):a})})}const U7={...Lu,...Wl},B2=C.forwardRef(function(a,i){const{render:s,className:d,style:m,forceRender:g=!1,...y}=a,{store:S}=wr(),b=S.useState("open"),T=S.useState("nested"),R=S.useState("mounted"),x=S.useState("transitionStatus");return Dn("div",a,{state:{open:b,transitionStatus:x},ref:[S.context.backdropRef,i],stateAttributesMapping:U7,props:[{role:"presentation",hidden:!R,style:{userSelect:"none",WebkitUserSelect:"none"}},y],enabled:g||!T})});process.env.NODE_ENV!=="production"&&(B2.displayName="DialogBackdrop");const Y2=C.forwardRef(function(a,i){const{render:s,className:d,disabled:m=!1,nativeButton:g=!0,style:y,...S}=a,{store:b}=wr(),T=b.useState("open");function R(z){T&&b.setOpen(!1,tn(w9,z.nativeEvent))}const{getButtonProps:x,buttonRef:_}=Ih({disabled:m,native:g});return Dn("button",a,{state:{disabled:m},ref:[i,_],props:[{onClick:R},S,x]})});process.env.NODE_ENV!=="production"&&(Y2.displayName="DialogClose");const G2=C.forwardRef(function(a,i){const{render:s,className:d,style:m,id:g,...y}=a,{store:S}=wr(),b=vl(g);return S.useSyncedValueWithCleanup("descriptionElementId",b),Dn("p",a,{ref:i,props:[{id:b},y]})});process.env.NODE_ENV!=="production"&&(G2.displayName="DialogDescription");let j7=(function(t){return t.nestedDialogs="--nested-dialogs",t})({}),L7=(function(t){return t[t.open=Er.open]="open",t[t.closed=Er.closed]="closed",t[t.startingStyle=Er.startingStyle]="startingStyle",t[t.endingStyle=Er.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const q2=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(q2.displayName="DialogPortalContext");function Z2(){const t=C.useContext(q2);if(t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Portal> is missing.":vo(26));return t}const H7={...Lu,...Wl,nestedDialogOpen(t){return t?{[L7.nestedDialogOpen]:""}:null}},I2=C.forwardRef(function(a,i){const{className:s,finalFocus:d,initialFocus:m,render:g,style:y,...S}=a,{store:b}=wr(),T=b.useState("descriptionElementId"),R=b.useState("disablePointerDismissal"),x=b.useState("floatingRootContext"),_=b.useState("popupProps"),A=b.useState("modal"),z=b.useState("mounted"),N=b.useState("nested"),M=b.useState("nestedOpenDialogCount"),$=b.useState("open"),Y=b.useState("openMethod"),Z=b.useState("titleElementId"),V=b.useState("transitionStatus"),I=b.useState("role");Z2(),ju({open:$,ref:b.context.popupRef,onComplete(){$&&b.context.onOpenChangeComplete?.(!0)}});function q(re){return re==="touch"?b.context.popupRef.current:!0}const J=m===void 0?q:m,he=M>0,fe=Dn("div",a,{state:{open:$,nested:N,transitionStatus:V,nestedDialogOpen:he},props:[_,{"aria-labelledby":Z??void 0,"aria-describedby":T??void 0,role:I,tabIndex:-1,hidden:!z,onKeyDown(re){o1.has(re.key)&&re.stopPropagation()},style:{[j7.nestedDialogs]:M}},S],ref:[i,b.context.popupRef,b.useStateSetter("popupElement")],stateAttributesMapping:H7});return X.jsx(kS,{context:x,openInteractionType:Y,disabled:!z,closeOnFocusOut:!R,initialFocus:J,returnFocus:d,modal:A!==!1,restoreFocus:"popup",children:fe})});process.env.NODE_ENV!=="production"&&(I2.displayName="DialogPopup");const l1=C.forwardRef(function(a,i){const{cutout:s,...d}=a;let m;if(s){const g=s.getBoundingClientRect();m=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${g.left}px ${g.top}px,${g.left}px ${g.bottom}px,${g.right}px ${g.bottom}px,${g.right}px ${g.top}px,${g.left}px ${g.top}px)`}return X.jsx("div",{ref:i,role:"presentation","data-base-ui-inert":"",...d,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:m}})});process.env.NODE_ENV!=="production"&&(l1.displayName="InternalBackdrop");const i1=C.forwardRef(function(a,i){const{keepMounted:s=!1,...d}=a,{store:m}=wr(),g=m.useState("mounted"),y=m.useState("modal"),S=m.useState("open");return g||s?X.jsx(q2.Provider,{value:s,children:X.jsxs(VS,{ref:i,...d,children:[g&&y===!0&&X.jsx(l1,{ref:m.context.internalBackdropRef,inert:zS(!S)}),a.children]})}):null});process.env.NODE_ENV!=="production"&&(i1.displayName="DialogPortal");const u1=C.forwardRef(function(a,i){const{render:s,className:d,style:m,id:g,...y}=a,{store:S}=wr(),b=vl(g);return S.useSyncedValueWithCleanup("titleElementId",b),Dn("h2",a,{ref:i,props:[{id:b},y]})});process.env.NODE_ENV!=="production"&&(u1.displayName="DialogTitle");const s1=C.forwardRef(function(a,i){const{render:s,className:d,disabled:m=!1,nativeButton:g=!0,id:y,payload:S,handle:b,style:T,...R}=a,x=wr(!0),_=b?.store??x?.store;if(!_)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.":vo(79));const A=vl(y),z=_.useState("floatingRootContext"),N=_.useState("isOpenedByTrigger",A),M=C.useRef(null),{registerTrigger:$,isMountedByThisTrigger:Y}=sA(A,M,_,{payload:S}),{getButtonProps:Z,buttonRef:V}=Ih({disabled:m,native:g}),I=T2(z,{enabled:z!=null}),q=Xy([I]),J={disabled:m,open:N},he=_.useState("triggerProps",Y);return Dn("button",a,{state:J,ref:[V,i,$,M],props:[q.getReferenceProps(),he,{[u2]:"",id:A},R,Z],stateAttributesMapping:_A})});process.env.NODE_ENV!=="production"&&(s1.displayName="DialogTrigger");let oD=(function(t){return t[t.open=Er.open]="open",t[t.closed=Er.closed]="closed",t[t.startingStyle=Er.startingStyle]="startingStyle",t[t.endingStyle=Er.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const V7={...Lu,...Wl,nested(t){return t?{[oD.nested]:""}:null},nestedDialogOpen(t){return t?{[oD.nestedDialogOpen]:""}:null}},aD=C.forwardRef(function(a,i){const{className:s,render:d,children:m,style:g,...y}=a,S=Z2(),{store:b}=wr(),T=b.useState("open"),R=b.useState("nested"),x=b.useState("transitionStatus"),_=b.useState("nestedOpenDialogCount"),A=b.useState("mounted"),z=_>0;return Dn("div",a,{enabled:S||A,state:{open:T,nested:R,transitionStatus:x,nestedDialogOpen:z},ref:[i,b.useStateSetter("viewportElement")],stateAttributesMapping:V7,props:[{role:"presentation",hidden:!A,style:{pointerEvents:T?void 0:"none"},children:m},y]})});process.env.NODE_ENV!=="production"&&(aD.displayName="DialogViewport");const k7=(t,a)=>Object.is(t,a);function Qh(t,a,i){return t==null||a==null?Object.is(t,a):i(t,a)}function B7(t,a,i){return!t||t.length===0?!1:t.some(s=>s===void 0?!1:Qh(a,s,i))}function Jy(t,a,i){return!t||t.length===0?-1:t.findIndex(s=>s===void 0?!1:Qh(s,a,i))}function Y7(t,a,i){return t.filter(s=>!Qh(a,s,i))}function $2(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function G7(t){return t!=null&&t.length>0&&typeof t[0]=="object"&&t[0]!=null&&"items"in t[0]}function q7(t){if(!Array.isArray(t))return t!=null&&"null"in t;const a=t;if(G7(a)){for(const i of a)for(const s of i.items)if(s&&s.value==null&&s.label!=null)return!0;return!1}for(const i of a)if(i&&i.value==null&&i.label!=null)return!0;return!1}function Z7(t,a){if(a&&t!=null)return a(t)??"";if(t&&typeof t=="object"){if("label"in t&&t.label!=null)return String(t.label);if("value"in t)return String(t.value)}return $2(t)}function Jh(t,a){return a&&t!=null?a(t)??"":t&&typeof t=="object"&&"value"in t&&"label"in t?$2(t.value):$2(t)}let rD=(function(t){return t.disabled="data-disabled",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t})({});const c1={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ky={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},I7={disabled:!1,...Ky},Yd={valid(t){return t===null?null:t?{[rD.valid]:""}:{[rD.invalid]:""}}},X2=C.createContext({invalid:void 0,name:void 0,validityData:{state:c1,errors:[],error:"",value:"",initialValue:null},setValidityData:Ta,disabled:void 0,touched:Ky.touched,setTouched:Ta,dirty:Ky.dirty,setDirty:Ta,filled:Ky.filled,setFilled:Ta,focused:Ky.focused,setFocused:Ta,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:I7,markedDirtyRef:{current:!1},registerFieldControl:Ta,validation:{getValidationProps:(t=No)=>t,getInputValidationProps:(t=No)=>t,inputRef:{current:null},commit:async()=>{}}});process.env.NODE_ENV!=="production"&&(X2.displayName="FieldRootContext");function Gd(t=!0){const a=C.useContext(X2);if(a.setValidityData===Ta&&!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.":vo(28));return a}function P2(t,a){const{enabled:i=!0,getValue:s,id:d,value:m}=a,{registerFieldControl:g}=Gd(),y=C.useRef(null);y.current||(y.current=Symbol()),ht(()=>{const S=y.current;if(!(!S||!i))return g(S,{controlRef:t,getValue:s,id:d,value:m}),()=>{g(S,void 0)}},[t,i,s,d,g,m])}const F2=C.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Ta,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});process.env.NODE_ENV!=="production"&&(F2.displayName="FormContext");function Kh(){return C.useContext(F2)}const Q2=C.createContext({controlId:void 0,registerControlId:Ta,labelId:void 0,setLabelId:Ta,messageIds:[],setMessageIds:Ta,getDescriptionProps:t=>t});process.env.NODE_ENV!=="production"&&(Q2.displayName="LabelableContext");function Ds(){return C.useContext(Q2)}function J2(t={}){const{id:a,implicit:i=!1,controlRef:s}=t,{controlId:d,registerControlId:m}=Ds(),g=vl(a),y=i?d:void 0,S=pa(()=>Symbol("labelable-control")),b=C.useRef(!1),T=C.useRef(a!=null),R=nt(()=>{!b.current||m===Ta||(b.current=!1,m(S.current,void 0))});return ht(()=>{if(m===Ta)return;let x;if(i){const _=s?.current;dn(_)&&_.closest("label")!=null?x=a??null:x=y??g}else if(a!=null)T.current=!0,x=a;else if(T.current)x=g;else{R();return}if(x===void 0){R();return}b.current=!0,m(S.current,x)},[a,s,y,m,i,g,S,R]),C.useEffect(()=>R,[R]),d??g}function $7(t){const a=t.getBoundingClientRect();if(process.env.NODE_ENV!=="production")return a;const i=Zn(t),s=i.getComputedStyle(t,"::before"),d=i.getComputedStyle(t,"::after");if(!(s.content!=="none"||d.content!=="none"))return a;const g=parseFloat(s.width)||0,y=parseFloat(s.height)||0,S=parseFloat(d.width)||0,b=parseFloat(d.height)||0,T=Math.max(a.width,g,S),R=Math.max(a.height,y,b),x=T-a.width,_=R-a.height;return{left:a.left-x/2,right:a.right+x/2,top:a.top-_/2,bottom:a.bottom+_/2}}function X7(t,a){return t??a}const P7=20;function lD(t,a,i,s){const[d,m]=C.useState(!1);ht(()=>{if(!t||!a||i==null){m(!1);return}const g=It(i).documentElement.clientWidth,y=i.offsetWidth;m(g>0&&y>0&&y>=g-P7)},[t,a,i]),nD(t&&(!a||d),s)}let iD=(function(t){return t.checked="data-checked",t.unchecked="data-unchecked",t.indeterminate="data-indeterminate",t.disabled="data-disabled",t.readonly="data-readonly",t.required="data-required",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t})({});function uD(t){return C.useMemo(()=>({checked(a){return t.indeterminate?{}:a?{[iD.checked]:""}:{[iD.unchecked]:""}},...Yd}),[t.indeterminate])}const sD=C.createContext({disabled:!1});process.env.NODE_ENV!=="production"&&(sD.displayName="FieldItemContext");function F7(){return C.useContext(sD)}function Q7(t,a,i,s=!0,d){const[m,g]=C.useState(),y=vl(d?`${d}-label`:void 0),S=t??a??m;return ht(()=>{const b=t||a||!s?void 0:J7(i.current,y);m!==b&&g(b)}),S}function J7(t,a){const i=K7(t);if(i)return!i.id&&a&&(i.id=a),i.id||void 0}function K7(t){if(!t)return;const a=t.parentElement;if(a&&a.tagName==="LABEL")return a;const i=t.id;if(i){const d=t.nextElementSibling;if(d&&d.htmlFor===i)return d}const s=t.labels;return s&&s[0]}const cD=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(cD.displayName="CheckboxGroupContext");function W7(t=!0){const a=C.useContext(cD);if(a===void 0&&!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>.":vo(3));return a}const K2=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(K2.displayName="CheckboxRootContext");function eL(){const t=C.useContext(K2);if(t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CheckboxRootContext is missing. Checkbox parts must be placed within <Checkbox.Root>.":vo(14));return t}const tL="data-parent",W2=C.forwardRef(function(a,i){const{checked:s,className:d,defaultChecked:m=!1,"aria-labelledby":g,disabled:y=!1,form:S,id:b,indeterminate:T=!1,inputRef:R,name:x,onCheckedChange:_,parent:A=!1,readOnly:z=!1,render:N,required:M=!1,uncheckedValue:$,value:Y,nativeButton:Z=!1,style:V,...I}=a,{clearErrors:q}=Kh(),{disabled:J,name:he,setDirty:Q,setFilled:fe,setFocused:re,setTouched:ce,state:ee,validationMode:K,validityData:L,shouldValidateOnChange:k,validation:F}=Gd(),W=F7(),{labelId:de,controlId:U,registerControlId:P,getDescriptionProps:te}=Ds(),ae=W7(),Se=ae?.parent,Re=Se&&ae.allValues,Te=J||W.disabled||ae?.disabled||y,Me=he??x,Be=Y??Me,Qe=vl(),Ae=vl();let Le=U;Re?Le=A?Ae:`${Se.id}-${Be}`:b&&(Le=b);let rt={};Re&&(A?rt=ae.parent.getParentProps():Be&&(rt=ae.parent.getChildProps(Be)));const ot=nt(_),{checked:We=s,indeterminate:Ze=T,onCheckedChange:Je,...ct}=rt,tt=ae?.value,Ye=ae?.setValue,ne=ae?.defaultValue,Ee=C.useRef(null),be=pa(()=>Symbol("checkbox-control")),me=C.useRef(!1),{getButtonProps:$e,buttonRef:Pe}=Ih({disabled:Te,native:Z}),Xe=ae?.validation??F,[at,zt]=Qy({controlled:Be&&tt&&!A?tt.includes(Be):We,default:Be&&ne&&!A?ne.includes(Be):m,name:"Checkbox",state:"checked"});ht(()=>{P!==Ta&&(me.current=!0,P(be.current,Le))},[Le,ae,P,A,be]),C.useEffect(()=>{const le=be.current;return()=>{!me.current||P===Ta||(me.current=!1,P(le,void 0))}},[P,be]),P2(Ee,{enabled:!ae,id:Qe,value:at});const yt=C.useRef(null),St=Md(R,yt,Xe.inputRef),Rt=Q7(g,de,yt,!Z,Le??void 0);ht(()=>{yt.current&&(yt.current.indeterminate=Ze,at&&fe(!0))},[at,Ze,fe]),a1(at,()=>{ae&&!A||(q(Me),fe(at),Q(at!==L.initialValue),k()?Xe.commit(at):Xe.commit(at,!0))});const _t=Uu({checked:at,disabled:Te,form:S,name:A?void 0:Me,id:Z?void 0:Le??void 0,required:M,ref:St,style:Me?h_:AS,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(le){if(le.nativeEvent.defaultPrevented)return;if(z){le.preventDefault();return}const ze=le.currentTarget.checked,He=tn(jd,le.nativeEvent);if(Je?.(ze,He),ot(ze,He),!He.isCanceled&&(zt(ze),Be&&tt&&Ye&&!A&&!Re)){const et=ze?[...tt,Be]:tt.filter(lt=>lt!==Be);Ye(et,He)}},onFocus(){Ee.current?.focus()}},Y!==void 0?{value:(ae?at&&Y:Y)||""}:No,te,ae?Xe.getValidationProps:Xe.getInputValidationProps),Ot=Re?!!We:at,Nt=Re&&Ze||T;C.useEffect(()=>{if(!Se||!Be)return;const le=Se.disabledStatesRef.current;return le.set(Be,Te),()=>{le.delete(Be)}},[Se,Te,Be]);const Yt=C.useMemo(()=>({...ee,checked:Ot,disabled:Te,readOnly:z,required:M,indeterminate:Nt}),[ee,Ot,Te,z,M,Nt]),gn=uD(Yt),H=Dn("span",a,{state:Yt,ref:[Pe,Ee,i,ae?.registerControlRef],props:[{id:Z?Le??void 0:Qe,role:"checkbox","aria-checked":Ze?"mixed":at,"aria-readonly":z||void 0,"aria-required":M||void 0,"aria-labelledby":Rt,[tL]:A?"":void 0,onFocus(){re(!0)},onBlur(){const le=yt.current;le&&(ce(!0),re(!1),K==="onBlur"&&Xe.commit(ae?tt:le.checked))},onClick(le){z||Te||(le.preventDefault(),yt.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:le.shiftKey,ctrlKey:le.ctrlKey,altKey:le.altKey,metaKey:le.metaKey})))}},te,Xe.getValidationProps,I,ct,$e],stateAttributesMapping:gn});return X.jsxs(K2.Provider,{value:Yt,children:[H,!at&&!ae&&Me&&!A&&$!==void 0&&X.jsx("input",{type:"hidden",form:S,name:Me,value:$}),X.jsx("input",{..._t,suppressHydrationWarning:!0})]})});process.env.NODE_ENV!=="production"&&(W2.displayName="CheckboxRoot");const eR=C.forwardRef(function(a,i){const{render:s,className:d,style:m,keepMounted:g=!1,...y}=a,S=eL(),b=S.checked||S.indeterminate,{mounted:T,transitionStatus:R,setMounted:x}=$y(b),_=C.useRef(null),A={...S,transitionStatus:R};ju({open:b,ref:_,onComplete(){b||x(!1)}});const z=uD(S),N=C.useMemo(()=>({...z,...Wl,...Yd}),[z]),M=g||T,$=Dn("span",a,{ref:[i,_],state:A,stateAttributesMapping:N,props:y});return M?$:null});process.env.NODE_ENV!=="production"&&(eR.displayName="CheckboxIndicator");function nL(t,a){const i=vl(t);return ht(()=>(a(i),()=>{a(void 0)}),[i,a]),i}function oL(t={}){const{id:a,fallbackControlId:i,native:s=!1,setLabelId:d,focusControl:m}=t,{controlId:g,setLabelId:y}=Ds(),S=nt(_=>{y(_),d?.(_)}),b=nL(a,S),T=g??i;function R(_){if(m){m(_,T);return}if(!T)return;const A=It(_.currentTarget).getElementById(T);Wn(A)&&aL(A)}function x(_){fo(_.nativeEvent)?.closest("button,input,select,textarea")||(!_.defaultPrevented&&_.detail>1&&_.preventDefault(),!s&&R(_))}return s?{id:b,htmlFor:T??void 0,onMouseDown:x}:{id:b,onClick:x,onPointerDown(_){_.preventDefault()}}}function aL(t){t.focus({focusVisible:!0})}const fD=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(fD.displayName="ToolbarRootContext");function dD(t){return C.useContext(fD)}function rL(t,a){const i=C.useRef(null),s=nt(m=>{Jl.flushSync(()=>{t.setOpen(!1,tn(Ld,m.nativeEvent,m.currentTarget))}),zU(i.current)?.focus()}),d=nt(m=>{const g=t.select("positionerElement");if(g&&qh(m,g))t.context.beforeContentFocusGuardRef.current?.focus();else{Jl.flushSync(()=>{t.setOpen(!1,tn(Ld,m.nativeEvent,m.currentTarget))});let y=MU(t.context.triggerFocusTargetRef.current||a.current);for(;y!==null&&Tt(g,y);){const S=y;if(y=n2(y),y===S)break}y?.focus()}});return{preFocusGuardRef:i,handlePreFocusGuardFocus:s,handleFocusTargetFocus:d}}function lL(t){const[a,i]=C.useState({current:t,previous:null});return t!==a.current&&i({current:t,previous:a.current}),a.previous}const pD=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(pD.displayName="CSPContext");const iL={disableStyleElements:!1};function uL(){return C.useContext(pD)??iL}let Ra=(function(t){return t.nestedDrawers="--nested-drawers",t.height="--drawer-height",t.frontmostHeight="--drawer-frontmost-height",t.swipeMovementX="--drawer-swipe-movement-x",t.swipeMovementY="--drawer-swipe-movement-y",t.snapPointOffset="--drawer-snap-point-offset",t.swipeStrength="--drawer-swipe-strength",t})({}),Ms=(function(t){return t.swipeProgress="--drawer-swipe-progress",t})({});const sL={...Lu,...Wl},hD=C.forwardRef(function(a,i){const{render:s,className:d,style:m,forceRender:g=!1,...y}=a,{store:S}=wr(),b=S.useState("open"),T=S.useState("nested"),R=S.useState("mounted"),x=S.useState("transitionStatus");return Dn("div",a,{state:{open:b,transitionStatus:x},ref:[S.context.backdropRef,i],stateAttributesMapping:sL,props:[{role:"presentation",hidden:!R,style:{pointerEvents:b?void 0:"none",userSelect:"none",WebkitUserSelect:"none",[Ms.swipeProgress]:"0",[Ra.swipeStrength]:"1"}},y],enabled:g||!T})});process.env.NODE_ENV!=="production"&&(hD.displayName="DrawerBackdrop");const mD="data-drawer-content",gD=C.forwardRef(function(a,i){const{render:s,className:d,style:m,...g}=a;return wr(),Dn("div",a,{ref:i,props:[{[mD]:""},g]})});process.env.NODE_ENV!=="production"&&(gD.displayName="DrawerContent");const yD=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(yD.displayName="DrawerProviderContext");function vD(t){return C.useContext(yD)}let Pi=(function(t){return t[t.open=Er.open]="open",t[t.closed=Er.closed]="closed",t[t.startingStyle=Er.startingStyle]="startingStyle",t[t.endingStyle=Er.endingStyle]="endingStyle",t.expanded="data-expanded",t.nestedDrawerOpen="data-nested-drawer-open",t.nestedDrawerSwiping="data-nested-drawer-swiping",t.swipeDismiss="data-swipe-dismiss",t.swipeDirection="data-swipe-direction",t.swiping="data-swiping",t})({});const tR=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(tR.displayName="DrawerRootContext");function f1(t){const a=C.useContext(tR);if(t===!1&&a===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DrawerRootContext is missing. Drawer parts must be placed within <Drawer.Root>.":vo(90));return a}function Qo(t,a=Number.MIN_SAFE_INTEGER,i=Number.MAX_SAFE_INTEGER){return Math.max(a,Math.min(t,i))}function bD(t,a,i){if(!Number.isFinite(a)||a<=0)return null;if(typeof t=="number")return Number.isFinite(t)?t<=1?Qo(t,0,1)*a:t:null;const s=t.trim();if(s.endsWith("px")){const d=Number.parseFloat(s);return Number.isFinite(d)?d:null}if(s.endsWith("rem")){const d=Number.parseFloat(s);return Number.isFinite(d)?d*i:null}return null}function cL(t,a){let i=null,s=1/0;for(const d of a){const m=Math.abs(d.height-t);m<s&&(s=m,i=d)}return i}function SD(){const{store:t}=wr(),{snapPoints:a,activeSnapPoint:i,setActiveSnapPoint:s,popupHeight:d}=f1(),m=t.useState("viewportElement"),[g,y]=C.useState(0),[S,b]=C.useState(16),T=nt(()=>{const A=It(m).documentElement;m&&y(m.offsetHeight),m||y(A.clientHeight);const z=parseFloat(getComputedStyle(A).fontSize);Number.isFinite(z)&&b(z)});ht(()=>{if(T(),!m||typeof ResizeObserver!="function")return;const _=new ResizeObserver(T);return _.observe(m),()=>{_.disconnect()}},[T,m]);const R=C.useMemo(()=>{if(!a||a.length===0||g<=0||d<=0)return[];const _=Math.min(d,g);if(!Number.isFinite(_)||_<=0)return[];const A=a.map(M=>{const $=bD(M,g,S);if($===null||!Number.isFinite($))return null;const Y=Qo($,0,_);return{value:M,height:Y,offset:Math.max(0,d-Y)}}).filter(M=>!!M);if(A.length<=1)return A;const z=[],N=[];for(let M=A.length-1;M>=0;M-=1){const $=A[M];N.some(Z=>Math.abs(Z-$.height)<=1)||(N.push($.height),z.push($))}return z.reverse(),z},[d,S,a,g]),x=C.useMemo(()=>{if(i===void 0)return R[0];if(i===null)return;const _=R.find(M=>Object.is(M.value,i));if(_)return _;const A=Math.min(d,g),z=bD(i,g,S);if(z===null||!Number.isFinite(z))return;const N=Qo(z,0,A);return cL(N,R)??void 0},[i,d,R,S,g]);return{snapPoints:a,activeSnapPoint:i,setActiveSnapPoint:s,popupHeight:d,viewportHeight:g,resolvedSnapPoints:R,activeSnapPointOffset:x?.offset??null}}const nR=C.createContext(null);process.env.NODE_ENV!=="production"&&(nR.displayName="DrawerViewportContext");function fL(t){return C.useContext(nR)}let ED=!1;function dL(){ED||(typeof CSS<"u"&&"registerProperty"in CSS&&([Ra.swipeMovementX,Ra.swipeMovementY,Ra.snapPointOffset].forEach(t=>{try{CSS.registerProperty({name:t,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),[{name:Ms.swipeProgress,initialValue:"0"},{name:Ra.swipeStrength,initialValue:"1"}].forEach(({name:t,initialValue:a})=>{try{CSS.registerProperty({name:t,syntax:"<number>",inherits:!1,initialValue:a})}catch{}})),ED=!0)}const pL={...Lu,...Wl,expanded(t){return t?{[Pi.expanded]:""}:null},nestedDrawerOpen(t){return t?{[Pi.nestedDrawerOpen]:""}:null},nestedDrawerSwiping(t){return t?{[Pi.nestedDrawerSwiping]:""}:null},swipeDirection(t){return t?{[Pi.swipeDirection]:t}:null},swiping(t){return t?{[Pi.swiping]:""}:null}},wD=C.forwardRef(function(a,i){const{className:s,finalFocus:d,initialFocus:m,render:g,style:y,...S}=a,{store:b}=wr(),{swipeDirection:T,frontmostHeight:R,hasNestedDrawer:x,nestedSwiping:_,nestedSwipeProgressStore:A,onPopupHeightChange:z,notifyParentFrontmostHeight:N,notifyParentHasNestedDrawer:M}=f1(),$=b.useState("descriptionElementId"),Y=b.useState("disablePointerDismissal"),Z=b.useState("floatingRootContext"),V=b.useState("popupProps"),I=b.useState("modal"),q=b.useState("mounted"),J=b.useState("nested"),he=b.useState("nestedOpenDrawerCount"),Q=b.useState("transitionStatus"),fe=b.useState("open"),re=b.useState("openMethod"),ce=b.useState("titleElementId"),ee=b.useState("role"),K=he>0,L=fL(),k=L?.swiping??!1,F=L?.swipeStrength??null,{snapPoints:W,activeSnapPoint:de,activeSnapPointOffset:U}=SD();Z2();const[P,te]=C.useState(0),ae=C.useRef(0);process.env.NODE_ENV!=="production"&&C.useEffect(()=>{if(L)return;const ot=Zh.captureOwnerStack?.()||"";Ud(`<Drawer.Popup> expected to be rendered within <Drawer.Viewport>. Omitting the viewport disables drawer swipe handling and touch scroll locking. Wrap <Drawer.Popup> in <Drawer.Viewport>.${ot}`)},[L]);const Se=nt(()=>{const ot=b.context.popupRef.current;if(!ot)return;const We=ot.offsetHeight;if(ae.current>0&&R>ae.current&&We>ae.current)return;if(ae.current>0&&x){const ct=ae.current;te(ct),z(ct);return}const Je=We;Je!==ae.current&&(ae.current=Je,te(Je),z(Je))});ht(()=>{if(!q){ae.current=0,te(0),z(0);return}const ot=b.context.popupRef.current;if(!ot||(dL(),Se(),typeof ResizeObserver!="function"))return;const We=new ResizeObserver(Se);return We.observe(ot),()=>{We.disconnect()}},[Se,q,K,z,b.context.popupRef]),ht(()=>{const ot=b.context.popupRef,We=()=>{const Je=ot.current;if(!Je)return;const ct=A.getSnapshot();ct>0?Je.style.setProperty(Ms.swipeProgress,`${ct}`):Je.style.setProperty(Ms.swipeProgress,"0")};We();const Ze=A.subscribe(We);return()=>{Ze();const Je=ot.current;Je&&Je.style.setProperty(Ms.swipeProgress,"0")}},[A,b.context.popupRef]),C.useEffect(()=>{if(fe)return N?.(R),()=>{N?.(0)}},[R,fe,N]),C.useEffect(()=>M?(M(fe||Q==="ending"),()=>{M(!1)}):void 0,[M,fe,Q]),ju({open:fe,ref:b.context.popupRef,onComplete(){fe&&b.context.onOpenChangeComplete?.(!0)}});const Re=m===void 0?b.context.popupRef:m,Te={open:fe,nested:J,transitionStatus:Q,expanded:de===1,nestedDrawerOpen:K,nestedDrawerSwiping:_,swipeDirection:T,swiping:k};let Me;P&&!(!x&&Q!=="ending")&&(Me=`${P}px`);const Qe=W&&W.length>0&&(T==="down"||T==="up");let Ae=null;Qe&&U!==null&&(Ae=T==="up"?-U:U);let Le=L?L.getDragStyles():No;if(Qe&&T==="down"){const ot=U??0,We=Number.parseFloat(String(Le[Ra.swipeMovementY]??0)),Ze=Number.isFinite(We)?ot+We:ot,Je=Ze<0;if(k&&Je&&Number.isFinite(We)){const ct=Math.abs(Ze),Ye=-Math.sqrt(ct)-ot;Le={...Le,transform:void 0,[Ra.swipeMovementY]:`${Ye}px`}}else Le={...Le,transform:void 0}}const rt=Dn("div",a,{state:Te,props:[V,{"aria-labelledby":ce,"aria-describedby":$,role:ee,tabIndex:-1,hidden:!q,onKeyDown(ot){o1.has(ot.key)&&ot.stopPropagation()},style:{...Le,[Ms.swipeProgress]:"0",[Ra.nestedDrawers]:he,[Ra.height]:Me,[Ra.snapPointOffset]:typeof Ae=="number"?`${Ae}px`:"0px",[Ra.frontmostHeight]:R?`${R}px`:void 0,[Ra.swipeStrength]:typeof F=="number"&&Number.isFinite(F)&&F>0?`${F}`:"1"}},S],ref:[i,b.context.popupRef,b.useStateSetter("popupElement")],stateAttributesMapping:pL});return X.jsx(kS,{context:Z,openInteractionType:re,disabled:!q,closeOnFocusOut:!Y,initialFocus:Re,returnFocus:d,modal:I!==!1,restoreFocus:"popup",children:rt})});process.env.NODE_ENV!=="production"&&(wD.displayName="DrawerPopup");const hL=i1;var TD,RD;function mL(t){const{children:a,open:i,defaultOpen:s=!1,onOpenChange:d,onOpenChangeComplete:m,disablePointerDismissal:g=!1,modal:y=!0,actionsRef:S,handle:b,triggerId:T,defaultTriggerId:R=null,swipeDirection:x="down",snapToSequentialPoints:_=!1,snapPoints:A,snapPoint:z,defaultSnapPoint:N,onSnapPointChange:M}=t,$=nt(M),Y=f1(!0),Z=Y?.onNestedSwipeProgressChange,V=Y?.onNestedFrontmostHeightChange,I=Y?.onNestedSwipingChange,q=Y?.onNestedDrawerPresenceChange,[J,he]=C.useState(0),[Q,fe]=C.useState(0),[re,ce]=C.useState(!1),[ee,K]=C.useState(!1),[L]=C.useState(gL),k=N!==void 0?N:A?.[0]??null,F=z!==void 0,[W,de]=Qy({controlled:z,default:k,name:"Drawer",state:"snapPoint"}),U=C.useRef(!1),P=nt((Le,rt)=>{const ot=rt??tn(jd);$?.(Le,ot),!ot.isCanceled&&de(Le)}),te=C.useMemo(()=>F||!A||A.length===0?W:W===null||!A.some(Le=>Object.is(Le,W))?k:W,[W,F,k,A]),ae=nt(Le=>{he(Le),!U.current&&Le>0&&fe(Le)}),Se=nt(Le=>{if(Le>0){U.current=!0,fe(Le);return}U.current=!1,J>0&&fe(J)}),Re=nt(Le=>{ce(Le)}),Te=nt(Le=>{L.set(Le),Z?.(Le)}),Me=nt(Le=>{K(Le),I?.(Le)}),Be=nt((Le,rt)=>{d?.(Le,rt),!rt.isCanceled&&!Le&&A&&A.length>0&&P(k,tn(rt.reason,rt.event,rt.trigger))}),Qe=C.useMemo(()=>({swipeDirection:x,snapToSequentialPoints:_,snapPoints:A,activeSnapPoint:te,setActiveSnapPoint:P,frontmostHeight:Q,popupHeight:J,hasNestedDrawer:re,nestedSwiping:ee,nestedSwipeProgressStore:L,onNestedDrawerPresenceChange:Re,onPopupHeightChange:ae,onNestedFrontmostHeightChange:Se,onNestedSwipingChange:Me,onNestedSwipeProgressChange:Te,notifyParentFrontmostHeight:V,notifyParentSwipingChange:I,notifyParentSwipeProgressChange:Z,notifyParentHasNestedDrawer:q}),[te,Q,re,ee,L,q,Z,I,V,Re,Se,Te,Me,ae,J,P,A,_,x]),Ae=typeof a=="function"?Le=>X.jsxs(C.Fragment,{children:[TD||(TD=X.jsx(xD,{})),a(Le)]}):X.jsxs(C.Fragment,{children:[RD||(RD=X.jsx(xD,{})),a]});return X.jsx(tR.Provider,{value:Qe,children:X.jsx(r1.Provider,{value:!0,children:X.jsx(k2,{open:i,defaultOpen:s,onOpenChange:Be,onOpenChangeComplete:m,disablePointerDismissal:g,modal:y,actionsRef:S,handle:b,triggerId:T,defaultTriggerId:R,children:Ae})})})}function gL(){let t=0;const a=new Set;return{getSnapshot:()=>t,set(i){const s=Number.isFinite(i)?i:0;s!==t&&(t=s,a.forEach(d=>{d()}))},subscribe(i){return a.add(i),()=>{a.delete(i)}}}}function xD(){const t=Xc(),a=vD(),i=wr(!1),s=i.store.useState("open"),d=i.store.useState("nestedOpenDialogCount"),m=i.store.useState("popupElement"),g=d===0;return C.useEffect(()=>{if(!(!a||t==null))return()=>{a.removeDrawer(t)}},[t,a]),C.useEffect(()=>{t!=null&&a?.setDrawerOpen(t,s)},[t,s,a]),C.useEffect(()=>{if(!s||!g||!wS)return;const S=Zn(m).CloseWatcher;if(!S)return;function b(x){i.store.select("open")&&i.store.setOpen(!1,tn(T9,x))}const T=new S,R=rn(T,"close",b);return()=>{R(),T.destroy()}},[i.store,g,s,m]),null}function oR(t,a){const i=vr(t);if(a==="vertical"){const d=i.overflowY;return(d==="auto"||d==="scroll")&&t.scrollHeight>t.clientHeight}const s=i.overflowX;return(s==="auto"||s==="scroll")&&t.scrollWidth>t.clientWidth}function yL(t,a,i){let s=t;for(;s&&s!==a;){for(const d of i)if(oR(s,d))return!0;s=s.parentElement}return!1}function Wh(t,a,i="vertical"){let s=Wn(t)?t:null;for(;s&&s!==a;){if(oR(s,i))return s;s=s.parentElement}return oR(a,i)?a:null}function d1(t,a,i){return typeof t?.elementFromPoint=="function"?t.elementFromPoint(a,i):null}const vL=40,bL=10,SL=1,EL=50,OD=16,wL=80,TL='button,a,input,select,textarea,label,[role="button"]';function aR(t,a,i){switch(t){case"up":return-i;case"down":return i;case"left":return-a;case"right":return a;default:return 0}}function RL(t){const i=Zn(t).getComputedStyle(t).transform;let s=0,d=0,m=1;if(i&&i!=="none"){const g=i.match(/matrix(?:3d)?\(([^)]+)\)/);if(g){const y=g[1].split(", ").map(parseFloat);y.length===6?(s=y[4],d=y[5],m=Math.sqrt(y[0]*y[0]+y[1]*y[1])):y.length===16&&(s=y[12],d=y[13],m=y[0])}}return{x:s,y:d,scale:m}}function p1(t){return Number.isFinite(t)&&t>0?t:null}function xL(t){return t%2===1}function rR(t,a,i){const s=t[i];if(typeof s=="function")try{s.call(t,a)}catch(d){if(d&&typeof d=="object"&&"name"in d&&d.name==="NotFoundError")return;throw d}}function OL(t){const{enabled:a,directions:i,elementRef:s,movementCssVars:d,canStart:m,ignoreSelectorWhenTouch:g=!0,ignoreScrollableAncestors:y=!1,swipeThreshold:S,onDismiss:b,onProgress:T,onCancel:R,onSwipeStart:x,onRelease:_,onSwipingChange:A,trackDrag:z=!0}=t,N=TL,M=i.length===1?i[0]:void 0,$=Math.max(0,typeof S=="number"?S:vL),Y=i.includes("left"),Z=i.includes("right"),V=i.includes("up"),I=i.includes("down"),q=Y||Z,J=V||I,he=C.useMemo(()=>{const je=[];return J&&je.push("vertical"),q&&je.push("horizontal"),je},[q,J]),[Q,fe]=C.useState(void 0),[re,ce]=C.useState(!1),[ee,K]=C.useState(!1),[L,k]=C.useState(!1),[F,W]=C.useState({x:0,y:0}),[de,U]=C.useState({x:0,y:0,scale:1}),[P,te]=C.useState(null),ae=C.useRef({x:0,y:0}),Se=C.useRef({x:0,y:0}),Re=C.useRef(null),Te=C.useRef({x:0,y:0,scale:1}),Me=C.useRef(void 0),Be=C.useRef(0),Qe=C.useRef(!1),Ae=C.useRef({x:0,y:0}),Le=C.useRef(!1),rt=C.useRef(!1),ot=C.useRef(null),We=C.useRef(!1),Ze=C.useRef(!1),Je=C.useRef({width:0,height:0}),ct=C.useRef(0),tt=C.useRef($),Ye=C.useRef(null),ne=C.useRef(null),Ee=C.useRef({x:0,y:0}),be=C.useRef(null),me=C.useRef(!1),$e=nt(je=>{me.current!==je&&(me.current=je,ce(je),A?.(je))});function Pe(je){if(!je)return;if(typeof S!="function"){tt.current=$;return}const Fe=s.current;if(!Fe)return;const dt=S({element:Fe,direction:je});tt.current=Math.max(0,dt)}const Xe=nt((je,Fe)=>{const dt=Number.isFinite(je)?Qo(je,0,1):0,Lt=dt!==ct.current;let qt=!1;if(Fe){const Dt=be.current;qt=!Dt||Dt.deltaX!==Fe.deltaX||Dt.deltaY!==Fe.deltaY||Dt.direction!==Fe.direction}!Lt&&!qt||(ct.current=dt,Fe?be.current=Fe:Lt&&(be.current=null),T?.(dt,Fe))});function at(je,Fe){if(Fe===null)return;const dt=ne.current;if(dt&&Fe>dt.time){const Lt=Math.max(Fe-dt.time,OD);Ee.current={x:(je.x-dt.x)/Lt,y:(je.y-dt.y)/Lt}}ne.current={x:je.x,y:je.y,time:Fe}}const zt=C.useCallback(()=>{fe(void 0),$e(!1),K(!1),k(!1),W({x:0,y:0}),U({x:0,y:0,scale:1}),te(null),Xe(0),tt.current=$,ae.current={x:0,y:0},Se.current={x:0,y:0},Te.current={x:0,y:0,scale:1},Me.current=void 0,Be.current=0,Qe.current=!1,Ae.current={x:0,y:0},Le.current=!1,Re.current=null,rt.current=!1,ot.current=null,We.current=!1,Ze.current=!1,Je.current={width:0,height:0},Ye.current=null,ne.current=null,Ee.current={x:0,y:0},be.current=null},[$e,$,Xe]);C.useEffect(()=>{typeof S!="function"&&(tt.current=$)},[$,S]);function yt(je){if("touches"in je){const Fe=je.touches[0];return Fe?{x:Fe.clientX,y:Fe.clientY}:null}return{x:je.clientX,y:je.clientY}}function St(je){return"touches"in je?!0:je.pointerType==="touch"}function Rt(je,Fe){const dt=It(s.current);return d1(dt,je.x,je.y)??fo(Fe)}function _t(je,Fe){return q&&!J?Wh(je,Fe,"horizontal"):J&&!q?Wh(je,Fe,"vertical"):Wh(je,Fe,"vertical")??Wh(je,Fe,"horizontal")}function Ot(je,Fe,dt){We.current=!1;const Lt=St(je),qt=Rt(Fe,je.nativeEvent),Qt=It(s.current).body,xt=Lt&&Qt?_t(qt,Qt):null,Et=dt?.ignoreScrollableTarget??!1;if(xt&&!Et||(We.current=!!(xt&&Et),(qt?qt.closest(N):!1)&&(!Lt||g)))return!1;const kt=s.current;if(y&&kt&&qt&&he.length>0&&!(dt?.ignoreScrollableAncestors??!1)&&yL(qt,kt,he))return!1;if(Qe.current=!1,Me.current=void 0,Be.current=0,ae.current=Fe,Ye.current=p1(je.timeStamp),Ae.current=Fe,Re.current=Fe,kt){Je.current={width:kt.offsetWidth,height:kt.offsetHeight},Pe(M);const $t=RL(kt);Te.current=$t,Se.current={x:$t.x,y:$t.y},U($t),W({x:$t.x,y:$t.y}),at({x:$t.x,y:$t.y},Ye.current),"touches"in je||rR(kt,je.pointerId,"setPointerCapture")}return x?.(je.nativeEvent),$e(!0),K(!1),te(null),Le.current=!0,Xe(0),!0}function Nt(){Yt(),We.current=!1,Re.current=null}function Yt(){rt.current=!1,ot.current=null}function gn(je){if(Nt(),!me.current)return;$e(!1),K(!1),te(null);const Fe=z?de:Te.current;Se.current={x:Fe.x,y:Fe.y},W({x:Fe.x,y:Fe.y}),fe(void 0),Ze.current=!1;const dt=s.current;dt&&rR(dt,je.pointerId,"releasePointerCapture"),Xe(0,{deltaX:0,deltaY:0,direction:void 0}),R?.(je.nativeEvent)}function H(je,Fe){const dt=Qt=>Qt>=0?Qt**.5:-(Math.abs(Qt)**.5),Lt=(Qt,xt,Et)=>!xt&&Qt<0||!Et&&Qt>0?dt(Qt):Qt,qt=q?Lt(je,Y,Z):dt(je),Dt=J?Lt(Fe,V,I):dt(Fe);return{x:qt,y:Dt}}function le(je,Fe,dt){const Lt=Math.abs(Fe),qt=Math.abs(dt);if(J&&dt!==0&&(!q||qt>=Lt)){const xt=Math.max(0,je.scrollHeight-je.clientHeight),Et=je.scrollTop<=0,Ht=je.scrollTop>=xt,kt=dt>0,$t=dt<0;return kt&&Et&&I||$t&&Ht&&V}if(q&&Fe!==0&&(!J||Lt>qt)){const xt=Math.max(0,je.scrollWidth-je.clientWidth),Et=je.scrollLeft<=0,Ht=je.scrollLeft>=xt,kt=Fe>0,$t=Fe<0;return kt&&Et&&Z||$t&&Ht&&Y}return null}const ze=nt(je=>{if(!a||je.defaultPrevented||je.nativeEvent.defaultPrevented||!("touches"in je)&&je.button!==0)return;const Fe=yt(je);!Fe||(rt.current=!0,ot.current=Fe,We.current=!1,Ze.current=!1,!(m?m(Fe,{nativeEvent:je.nativeEvent,direction:M}):!0))||Ot(je,Fe)&&Yt()});function He(je,Fe,dt){if(!a||!me.current)return;const Lt=fo(je.nativeEvent);if(St(je)&&!We.current){const Yo=je.currentTarget;if(_t(Lt,Yo))return}if("touches"in je||je.preventDefault(),Le.current){ae.current=Fe;const Yo=p1(je.timeStamp);Yo!==null&&(Ye.current=Yo),Le.current=!1}const qt=Fe.x,Dt=Fe.y,Qt=dt.x,xt=dt.y;(xt<0&&Dt>Ae.current.y||xt>0&&Dt<Ae.current.y)&&(Ae.current={x:Ae.current.x,y:Dt}),(Qt<0&&qt>Ae.current.x||Qt>0&&qt<Ae.current.x)&&(Ae.current={x:qt,y:Ae.current.y});const Et=qt-ae.current.x,Ht=Dt-ae.current.y,kt=Dt-Ae.current.y,$t=qt-Ae.current.x;if(!ee&&Math.sqrt(Et*Et+Ht*Ht)>=SL&&(K(!0),P===null&&q&&J)){const lr=Math.abs(Et),Rn=Math.abs(Ht);te(lr>Rn?"horizontal":"vertical")}let vt;if(!Me.current)P==="vertical"?Ht>0?vt="down":Ht<0&&(vt="up"):P==="horizontal"?Et>0?vt="right":Et<0&&(vt="left"):Math.abs(Et)>=Math.abs(Ht)?vt=Et>0?"right":"left":vt=Ht>0?"down":"up",vt&&(vt==="left"&&Y||vt==="right"&&Z||vt==="up"&&V||vt==="down"&&I)&&(Me.current=vt,Be.current=aR(vt,Et,Ht),fe(vt),Pe(vt));else{const Yo=Me.current,lr=aR(Yo,$t,kt);lr>tt.current?(Qe.current=!1,fe(Yo)):!(Y&&Z)&&!(V&&I)&&Be.current-lr>=bL&&(Qe.current=!0)}const In=H(Et,Ht);let Oo=Te.current.x,ko=Te.current.y;P==="horizontal"?q&&(Oo+=In.x):(P==="vertical"||q&&(Oo+=In.x),J&&(ko+=In.y)),Se.current={x:Oo,y:ko},z&&W({x:Oo,y:ko}),at({x:Oo,y:ko},p1(je.timeStamp));const Qr=Oo-Te.current.x,Rr=ko-Te.current.y,bl=Me.current,Jo=M??Me.current;if(!Jo){Xe(0,{deltaX:Qr,deltaY:Rr,direction:bl});return}const Ha=Jo==="left"||Jo==="right"?Je.current.width:Je.current.height,Bo=Te.current.scale||1;if(Ha<=0||Bo<=0){Xe(0,{deltaX:Qr,deltaY:Rr,direction:bl});return}const Va=aR(Jo,Oo-Te.current.x,ko-Te.current.y);if(Va<=0){Xe(0,{deltaX:Qr,deltaY:Rr,direction:bl});return}Xe(Va/(Ha*Bo),{deltaX:Qr,deltaY:Rr,direction:bl})}const et=nt(je=>{const Fe=yt(je);if(!Fe)return;if(!("touches"in je)){const qt=xL(je.buttons);qt&&(Ze.current=!0);const Dt=je.buttons===0&&Ze.current;if(je.buttons!==0&&!qt||Dt){gn(je);return}}if(!re&&rt.current){if(!St(je)&&(je.defaultPrevented||je.nativeEvent.defaultPrevented)){Nt();return}if(m?m(Fe,{nativeEvent:je.nativeEvent,direction:M}):!0){const Dt=ot.current;let Qt=!1;if(St(je)){const Et=s.current;if(Dt&&Et){const Ht=Rt(Fe,je.nativeEvent),$t=It(Et).body,vt=$t?_t(Ht,$t):null;if(vt&&(Tt(Et,vt)||Tt(vt,Et))){const In=Fe.x-Dt.x,Oo=Fe.y-Dt.y,ko=le(vt,In,Oo);if(ko===!1)return;ko===!0&&(Qt=!0)}}}Ot(je,Fe,{ignoreScrollableTarget:Qt,ignoreScrollableAncestors:Qt})&&(Dt&&Qt?(Yt(),ae.current=Dt,Ae.current=Dt,Re.current=Dt,Le.current=!1):(Yt(),We.current=!1))}}const dt=Re.current,Lt=dt===null?{x:0,y:0}:{x:Fe.x-dt.x,y:Fe.y-dt.y};Re.current=Fe,He(je,Fe,Lt)}),lt=nt(je=>{if(!a)return;const Fe=Se.current,dt=Te.current,Lt=Fe.x-dt.x,qt=Fe.y-dt.y,Dt={deltaX:Lt,deltaY:qt,direction:Q??Me.current};if(!me.current){Nt(),Xe(0,Dt);return}$e(!1),K(!1),te(null),Nt(),Ze.current=!1;const Qt=s.current;Qt&&("touches"in je||rR(Qt,je.pointerId,"releasePointerCapture"));const xt=Lt,Et=qt,Ht=Ye.current,kt=p1(je.timeStamp),$t=Ht!==null&&kt!==null&&kt>Ht?kt-Ht:0,vt=$t>0?Math.max($t,EL):0,In=vt>0?xt/vt:0,Oo=vt>0?Et/vt:0;let ko=Ee.current.x,Qr=Ee.current.y;const Rr=ne.current;if(Rr&&kt!==null&&kt>=Rr.time){const Va=kt-Rr.time;if(Va<=wL){const Yo=Math.max(Va,OD),lr=Fe.x-Rr.x,Rn=Fe.y-Rr.y,ti=lr/Yo,Sl=Rn/Yo;ti!==0&&(ko=ti),Sl!==0&&(Qr=Sl)}else ko=0,Qr=0}const bl=_?.({event:je.nativeEvent,direction:Q??Me.current,deltaX:xt,deltaY:Et,velocityX:In,velocityY:Oo,releaseVelocityX:ko,releaseVelocityY:Qr}),Jo=typeof bl=="boolean";if(Qe.current&&!Jo){Se.current={x:dt.x,y:dt.y},W({x:dt.x,y:dt.y}),fe(void 0),Xe(0,Dt);return}let Ha=!1,Bo;if(Jo)Ha=bl,Bo=Q??Me.current??M;else for(const Va of i){switch(Va){case"right":xt>tt.current&&(Ha=!0,Bo="right");break;case"left":xt<-tt.current&&(Ha=!0,Bo="left");break;case"down":Et>tt.current&&(Ha=!0,Bo="down");break;case"up":Et<-tt.current&&(Ha=!0,Bo="up");break}if(Ha)break}Ha&&Bo?(fe(Bo),k(!0),b?.(je.nativeEvent,{direction:Bo})):(Se.current={x:dt.x,y:dt.y},W({x:dt.x,y:dt.y}),fe(void 0),Xe(0,Dt))}),ft=C.useCallback(()=>{const je=z?F:Se.current,Fe=z?de:Te.current;if(!re&&je.x===Fe.x&&je.y===Fe.y&&!L)return{[d.x]:"0px",[d.y]:"0px"};const dt=je.x-Fe.x,Lt=je.y-Fe.y;return{transition:re?"none":void 0,transform:re?`translateX(${je.x}px) translateY(${je.y}px) scale(${Fe.scale})`:void 0,[d.x]:`${dt}px`,[d.y]:`${Lt}px`}},[L,F,de,re,d,z]),At=C.useCallback(()=>a?{onPointerDown:ze,onPointerMove:et,onPointerUp:lt,onPointerCancel:lt}:{},[a,lt,et,ze]),st=C.useCallback(()=>a?{onTouchStart:ze,onTouchMove:et,onTouchEnd:lt,onTouchCancel:lt}:{},[a,lt,et,ze]);return{swiping:re,swipeDirection:Q,dragDismissed:L,getPointerProps:At,getTouchProps:st,getDragStyles:ft,reset:zt}}const CL=u1,_L=s1,lR=10,CD=.5,_D=.5,AL=300,AD=4,DD=.2,DL=4,iR=80,MD=360,uR=.1,zD=1,ML=`[${mD}]`,ND=C.forwardRef(function(a,i){const{className:s,render:d,style:m,children:g,...y}=a,{store:S}=wr(),{swipeDirection:b,notifyParentSwipingChange:T,notifyParentSwipeProgressChange:R,frontmostHeight:x,snapToSequentialPoints:_}=f1(),z=vD()?.visualStateStore,N=S.useState("open"),M=S.useState("mounted"),$=S.useState("nested"),Y=S.useState("nestedOpenDrawerCount"),Z=S.useState("viewportElement"),V=S.useState("popupElement"),I=Y>0,q=b==="left"||b==="right"?"horizontal":"vertical",J=q==="vertical",he=J?"horizontal":"vertical",{snapPoints:Q,resolvedSnapPoints:fe,activeSnapPoint:re,activeSnapPointOffset:ce,setActiveSnapPoint:ee,popupHeight:K}=SD(),[L,k]=C.useState(null),F=C.useRef(void 0),W=C.useRef(null),de=Ly(),U=C.useRef(!1),P=C.useRef(""),te=C.useRef(!1),ae=C.useRef(!1),Se=C.useRef(null),Re=C.useMemo(()=>{if(!Q||Q.length<2||b!=="down"&&b!=="up"||fe.length<2)return null;const ne=fe.map(Pe=>Pe.offset).filter(Pe=>Number.isFinite(Pe)).sort((Pe,Xe)=>Pe-Xe);if(ne.length<2)return null;const Ee=ne[0],be=ne[1],me=ne[ne.length-1];let $e=be-Ee;if(!Number.isFinite($e)||$e<=0){const Pe=me-Ee;if(!Number.isFinite(Pe)||Pe<=0)return null;$e=Pe}return{minOffset:Ee,range:$e}},[fe,Q,b]),Te=C.useMemo(()=>!Re||ce===null?null:Qo((ce-Re.minOffset)/Re.range,0,1),[ce,Re]),Me=C.useMemo(()=>Q&&Q.length>0&&(b==="down"||b==="up")?b==="down"?["down","up"]:["up","down"]:[b],[Q,b]),Be=nt(ne=>{UD(S.context.popupRef.current,S.context.backdropRef.current,ne)}),Qe=nt(()=>{Be(!1),S.context.popupRef.current?.removeAttribute(zd.endingStyle),k(null)}),Ae=nt(()=>{U.current&&(U.current=!1,T?.(!1))}),Le=nt(({resolvedProgress:ne,shouldTrackProgress:Ee,notifyParent:be})=>{const me=N&&!$&&Ee,$e=me?ne:0,Pe=N&&Ee?ne:0;be&&R&&(R(Pe),Pe<=0&&Ae()),z?.set({swipeProgress:$e,frontmostHeight:$e>0?x:0});const Xe=S.context.backdropRef.current;if(Xe){if(!me||$e<=0){Xe.style.setProperty(Ms.swipeProgress,"0"),Xe.style.removeProperty(Ra.height);return}Xe.style.setProperty(Ms.swipeProgress,`${$e}`),x>0?Xe.style.setProperty(Ra.height,`${x}px`):Xe.style.removeProperty(Ra.height)}});function rt({direction:ne,deltaX:Ee,deltaY:be,velocityX:me,velocityY:$e,releaseVelocityX:Pe,releaseVelocityY:Xe}){if(!ne)return null;const at=S.context.popupRef.current;if(!at)return null;const zt=ne==="left"||ne==="right"?at.offsetWidth:at.offsetHeight;if(!Number.isFinite(zt)||zt<=0)return null;const yt=ne==="left"||ne==="right"?Ee:be,St=Q&&Q.length>0?ce??0:0;let Rt=0;ne==="down"?Rt=St:ne==="up"&&(Rt=-St);const _t=Rt+yt,Ot=ne==="left"||ne==="up"?-_t:_t,Nt=Math.max(0,zt-Ot);if(!Number.isFinite(Nt)||Nt<=0)return null;const Yt=ne==="left"||ne==="right"?Pe:Xe,gn=ne==="left"||ne==="right"?me:$e,H=Math.abs(Yt)>0&&Number.isFinite(Yt)?Yt:gn,le=ne==="left"||ne==="up"?-H:H;if(!Number.isFinite(le)||le<=DD)return null;const ze=Qo(le,DD,DL),He=Qo(Nt/ze,iR,MD);if(!Number.isFinite(He))return null;const et=(He-iR)/(MD-iR),lt=Qo(uR+et*(zD-uR),uR,zD);return!Number.isFinite(lt)||lt<=0?null:lt}function ot(ne){if(U.current||!ne)return;const Ee=ne.direction??b,be=Ee==="left"||Ee==="right"?ne.deltaX:ne.deltaY;!Number.isFinite(be)||Math.abs(be)<lR||(U.current=!0,T?.(!0))}const We=OL({enabled:M&&!I,directions:Me,elementRef:S.context.popupRef,ignoreSelectorWhenTouch:!1,ignoreScrollableAncestors:!0,movementCssVars:{x:Ra.swipeMovementX,y:Ra.swipeMovementY},onSwipeStart(ne){if("touches"in ne||"pointerType"in ne&&ne.pointerType==="touch")return;const Ee=S.context.popupRef.current;if(!Ee)return;const me=It(Ee).getSelection?.();if(!me||me.isCollapsed)return;const $e=dn(me.anchorNode)?me.anchorNode:me.anchorNode?.parentElement,Pe=dn(me.focusNode)?me.focusNode:me.focusNode?.parentElement;!Tt(Ee,$e)&&!Tt(Ee,Pe)||me.removeAllRanges()},onSwipingChange(ne){jD(S.context.backdropRef.current,ne),!ne&&!R&&Ae()},swipeThreshold({element:ne,direction:Ee}){return LD(ne,Ee)},canStart(ne,Ee){const be=S.context.popupRef.current;if(!be)return!1;const me=be.ownerDocument,$e=d1(me,ne.x,ne.y);if(!$e||!Tt(be,$e))return!1;const Pe=Ee.nativeEvent;return!(("touches"in Pe||"pointerType"in Pe&&Pe.pointerType==="touch")&&VD(me,be)||Pe.type==="touchstart"&&sR($e))},onProgress(ne,Ee){ot(Ee);const be=Ee?.direction??We.swipeDirection,me=be===void 0||be===b,$e=!!(Q&&Q.length>0),Xe=$e&&(b==="down"||b==="up")||!$e||b==="left"||b==="right"||me;let at=ne;if(Re&&K>0){if(Ee&&Number.isFinite(Ee.deltaY)){const zt=ce??Re.minOffset,yt=Qo(zt+Ee.deltaY,0,K);at=Qo((yt-Re.minOffset)/Re.range,0,1)}else if(Te!==null)at=Te;else if(be==="down"||be==="up"){const zt=ne*K,yt=ce??Re.minOffset,St=be==="down"?yt+zt:yt-zt;at=Qo((St-Re.minOffset)/Re.range,0,1)}}Le({resolvedProgress:at,shouldTrackProgress:Xe,notifyParent:!0})},onRelease({event:ne,deltaX:Ee,deltaY:be,direction:me,velocityX:$e,velocityY:Pe,releaseVelocityX:Xe,releaseVelocityY:at}){const zt={deltaX:Ee,deltaY:be,velocityX:$e,velocityY:Pe,releaseVelocityX:Xe,releaseVelocityY:at};function yt(st){const je=S.context.popupRef.current;je&&(Ae(),Be(!0),je.style.removeProperty("transition"),je.setAttribute(zd.endingStyle,""),Jl.flushSync(()=>{k(rt({direction:st,...zt}))}))}if(!Q||Q.length===0){if(!me){Qe();return}const st=S.context.popupRef.current;if(!st){Qe();return}const je=LD(st,me),Fe=me==="left"||me==="right"?Ee:be;if(!Number.isFinite(Fe)){Qe();return}const dt=me==="left"||me==="up"?-Fe:Fe;if(dt<=0)return Qe(),!1;const Lt=me==="left"||me==="right"?$e:Pe;if((me==="left"||me==="up"?-Lt:Lt)>=CD&&dt>0)return yt(me),!0;const Dt=dt>je;return Dt?yt(me):Qe(),Dt}if(b!=="down"&&b!=="up"){Qe();return}if(!K||fe.length===0){Qe();return}const St=b==="down"?be:-be;if(!Number.isFinite(St)){Qe();return}const Rt=Math.sign(St),_t=b==="down"?at:-at,Ot=b==="down"?Pe:-Pe;let Nt=Number.isFinite(_t)?_t:Ot;if(Rt!==0&&Math.abs(St)>=lR&&Number.isFinite(Nt)){const st=Math.sign(Nt);st!==0&&st!==Rt&&(Nt=Ot)}const Yt=ce??0,gn=Qo(Yt+St,0,K),H=Number.isFinite(Nt)&&Math.abs(Nt)>=_D?Qo(Nt,-AD,AD)*AL:0,le=_?gn:Qo(gn+H,0,K),ze=tn(US,ne),He=()=>(F.current=re,ee?.(null,ze),yt(b),!0);if(_){const st=[...fe].sort((Ht,kt)=>Ht.offset-kt.offset);if(st.length===0)return Qe(),!1;let je=0,Fe=Math.abs(Yt-st[0].offset);for(let Ht=1;Ht<st.length;Ht+=1){const kt=Math.abs(Yt-st[Ht].offset);kt<Fe&&(Fe=kt,je=Ht)}let dt=st[0];Fe=Math.abs(le-dt.offset);for(const Ht of st){const kt=Math.abs(le-Ht.offset);kt<Fe&&(Fe=kt,dt=Ht)}const Lt=Math.sign(Nt),qt=Rt!==0&&Lt!==0&&Lt===Rt&&Math.abs(Nt)>=_D;let Dt=le;if(qt){const Ht=Qo(je+Rt,0,st.length-1);if(Ht!==je){const kt=st[Ht];(Rt>0?le<kt.offset:le>kt.offset)&&(dt=kt,Dt=kt.offset)}else if(Rt>0)return He()}const xt=Math.abs(Dt-K),Et=Math.abs(Dt-dt.offset);return xt<Et?He():(ee?.(dt.value,ze),Qe(),!1)}if(Nt>=CD&&St>0)return He();let et=fe[0],lt=Math.abs(le-et.offset);for(const st of fe){const je=Math.abs(le-st.offset);je<lt&&(lt=je,et=st)}return Math.abs(le-K)<lt?He():(ee?.(et.value,ze),Qe(),!1)},onDismiss(ne){z?.set({swipeProgress:0,frontmostHeight:0});const Ee=S.context.backdropRef.current;Ee&&(Ee.style.setProperty(Ms.swipeProgress,"0"),Ee.style.removeProperty(Ra.height));const be=tn(US,ne);if(S.setOpen(!1,be),be.isCanceled){const me=F.current;me!==void 0&&ee?.(me,tn(US,ne)),F.current=void 0,W.current?.(),Qe();return}if(S.select("open")){const me=ne;de.request(()=>{if(S.select("open")){const $e=F.current;$e!==void 0&&ee?.($e,tn(US,me)),F.current=void 0,Qe(),W.current?.()}else F.current=void 0});return}F.current=void 0,Be(!0)}}),Ze=We.getPointerProps(),Je=We.getTouchProps(),ct=We.reset;W.current=ct,C.useEffect(()=>{const ne=Z??V;if(!ne)return;const Ee=ne,be=It(Ee),me=Zn(be);function $e(Pe){if(ae.current)return;const Xe=Se.current,at=Pe.touches[0];if(!at||!Xe)return;const zt=J?at.clientY-Xe.lastY:at.clientX-Xe.lastX;if(kD(Pe,me)){Xe.allowSwipe=!1,qd(Xe,at);return}if(Pe.touches.length===2){qd(Xe,at);return}if(VD(be,Ee)||!N||!M||I){qd(Xe,at);return}if(jL(Xe,at,J)){qd(Xe,at);return}const St=Xe.scrollTarget;if(!St||St===be.documentElement||St===be.body){Pe.cancelable&&Pe.preventDefault(),qd(Xe,at);return}if(!LL(St,q)){Pe.cancelable&&Pe.preventDefault(),qd(Xe,at);return}const _t=zt;if(_t!==0){const Ot=VL(St,q,b,_t);Xe.allowSwipe?Pe.cancelable&&Pe.preventDefault():Pe.cancelable&&Ot?(Xe.allowSwipe=!0,Pe.preventDefault()):Xe.allowSwipe=!1}qd(Xe,at)}return rn(be,"touchmove",$e,{passive:!1,capture:!0})},[M,I,N,V,J,q,b,Z]),C.useEffect(()=>{if(!Re||We.swiping)return;Le({resolvedProgress:!N||$?0:Te??0,shouldTrackProgress:!0,notifyParent:!1})},[Le,x,$,R,N,Te,Re,We.swiping,S,z]),C.useEffect(()=>{if(R)return N||R(0),()=>{R(0)}},[R,N]),C.useEffect(()=>{N&&(ct(),Qe())},[Qe,N,ct]),C.useEffect(()=>()=>{z?.set({swipeProgress:0,frontmostHeight:0}),jD(S.context.backdropRef.current,!1),Ae()},[Ae,S,z]);const tt=C.useMemo(()=>({swiping:We.swiping,getDragStyles:We.getDragStyles,swipeStrength:L??null,setSwipeDismissed(ne){UD(S.context.popupRef.current,S.context.backdropRef.current,ne)}}),[S,We.getDragStyles,We.swiping,L]);function Ye(){ae.current=!1,Se.current=null,P.current="",te.current=!1}return X.jsx(aD,{ref:i,className:s,render:d,...Uu(y,{onPointerDown(ne){if(P.current=ne.pointerType,te.current=ne.pointerType==="pen",!N||!M||I)return;const Ee=It(ne.currentTarget),be=d1(Ee,ne.clientX,ne.clientY);sR(be)||zL(be)||ne.pointerType!=="touch"&&Ze.onPointerDown?.(ne)},onPointerMove(ne){ne.pointerType!=="touch"&&Ze.onPointerMove?.(ne)},onPointerUp(ne){P.current===ne.pointerType&&(P.current=""),ne.pointerType!=="touch"&&Ze.onPointerUp?.(ne)},onPointerCancel(ne){P.current===ne.pointerType&&(P.current=""),ne.pointerType!=="touch"&&Ze.onPointerCancel?.(ne)},onTouchStart(ne){if(P.current==="pen"&&te.current){te.current=!1,ae.current=!1,Se.current=null;return}if(!N||!M||I){ae.current=!1,Se.current=null;return}const be=ne.touches[0];if(!be)return;if(BD(ne)){ae.current=!1,Se.current=null;return}const me=It(ne.currentTarget),$e=d1(me,be.clientX,be.clientY);if(ae.current=sR($e),ae.current){Se.current=null;return}const Pe=Z??V,Xe=fo(ne.nativeEvent),at=dn(Xe)?Xe:null;if(Pe&&at&&!Tt(Pe,at)){ae.current=!0,Se.current=null;return}let zt=null,yt=!1;Pe&&at&&(zt=Wh(at,Pe,q),yt=Wh(at,Pe,he)!=null);let St=null;zt&&(St=HL(zt,q,b)?null:!1),Se.current={startX:be.clientX,startY:be.clientY,lastX:be.clientX,lastY:be.clientY,scrollTarget:zt,hasCrossAxisScrollableContent:yt,allowSwipe:St,preserveNativeCrossAxisScroll:!1},Je.onTouchStart?.(ne)},onTouchMove(ne){if(ae.current||BD(ne))return;const Ee=Se.current;Ee?.preserveNativeCrossAxisScroll||Ee?.allowSwipe===!1||Ee?.scrollTarget!=null&&!Ee.allowSwipe||Je.onTouchMove?.(ne)},onTouchEnd(ne){Ye(),Je.onTouchEnd?.(ne)},onTouchCancel(ne){Ye(),Je.onTouchCancel?.(ne)},"data-nested-dialog-open":void 0}),children:X.jsx(nR.Provider,{value:tt,children:g})})});process.env.NODE_ENV!=="production"&&(ND.displayName="DrawerViewport");function UD(t,a,i){if(i){t?.setAttribute(Pi.swipeDismiss,""),a?.setAttribute(Pi.swipeDismiss,"");return}t?.removeAttribute(Pi.swipeDismiss),a?.removeAttribute(Pi.swipeDismiss)}function jD(t,a){if(t){if(a){t.setAttribute(Pi.swiping,"");return}t.removeAttribute(Pi.swiping)}}function sR(t){return!!t?.closest(x_)}function zL(t){return!!t?.closest(ML)}function LD(t,a){const i=a==="left"||a==="right"?t.offsetWidth:t.offsetHeight;return Math.max(i*.5,lR)}function HD(t,a){return t instanceof a.HTMLInputElement&&t.type==="range"}function NL(t){return dn(t)?t.tagName==="INPUT"||t.tagName==="TEXTAREA":!1}function UL(t,a){const i=dn(t.anchorNode)?t.anchorNode:t.anchorNode?.parentElement,s=dn(t.focusNode)?t.focusNode:t.focusNode?.parentElement;return t.containsNode(a,!0)||Tt(a,i)||Tt(a,s)}function VD(t,a){const i=Ua(t);if(!!(i&&Tt(a,i))&&NL(i)){const{selectionStart:m,selectionEnd:g}=i;if(m!=null&&g!=null&&m<g)return!0}const d=t.getSelection?.();return!d||d.isCollapsed?!1:UL(d,a)}function kD(t,a){const i=t.composedPath();return i?i.some(s=>HD(s,a)):HD(fo(t),a)}function BD(t){return kD(t.nativeEvent,Zn(t.currentTarget))}function qd(t,a){t.lastX=a.clientX,t.lastY=a.clientY}function jL(t,a,i){if(t.preserveNativeCrossAxisScroll)return!0;if(t.allowSwipe===!0||!t.hasCrossAxisScrollableContent)return!1;const s=i?a.clientY-t.startY:a.clientX-t.startX,d=i?a.clientX-t.startX:a.clientY-t.startY,m=Math.abs(s),g=Math.abs(d);return g<6||g<=m+2?!1:(t.preserveNativeCrossAxisScroll=!0,!0)}function LL(t,a){return a==="vertical"?t.scrollHeight>t.clientHeight:t.scrollWidth>t.clientWidth}function YD(t,a){if(a==="vertical"){const s=Math.max(0,t.scrollHeight-t.clientHeight);return{offset:t.scrollTop,max:s}}const i=Math.max(0,t.scrollWidth-t.clientWidth);return{offset:t.scrollLeft,max:i}}function HL(t,a,i){const{offset:s,max:d}=YD(t,a),m=GD(i,a);return m===null?!1:m?s<=0:s>=d}function VL(t,a,i,s){const{offset:d,max:m}=YD(t,a),g=GD(i,a);return g===null||!(g?s>0:s<0)?!1:g?d<=0:d>=m}function GD(t,a){return a==="vertical"?t==="down"?!0:t==="up"?!1:null:t==="right"?!0:t==="left"?!1:null}const qD=C.createContext({legendId:void 0,setLegendId:()=>{},disabled:void 0});process.env.NODE_ENV!=="production"&&(qD.displayName="FieldsetRootContext");function kL(t=!1){const a=C.useContext(qD);if(!a&&!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>.":vo(86));return a}const ZD=function(a){const i=vl(),s=a.controlId===void 0?i:a.controlId,[d,m]=C.useState(s),[g,y]=C.useState(a.labelId),[S,b]=C.useState([]),T=pa(()=>new Map),{messageIds:R}=Ds(),x=nt((z,N)=>{const M=T.current;if(N===void 0){M.delete(z);return}M.set(z,N),m($=>{if(M.size===0)return;let Y;for(const Z of M.values()){if($!==void 0&&Z===$)return $;Y===void 0&&(Y=Z)}return Y})}),_=C.useCallback(z=>Uu({"aria-describedby":R.concat(S).join(" ")||void 0},z),[R,S]),A=C.useMemo(()=>({controlId:d,registerControlId:x,labelId:g,setLabelId:y,messageIds:S,setMessageIds:b,getDescriptionProps:_}),[d,x,g,y,S,b,_]);return X.jsx(Q2.Provider,{value:A,children:a.children})};process.env.NODE_ENV!=="production"&&(ZD.displayName="LabelableProvider");function h1(t,a){return{...t,state:{...t.state,valid:!a&&t.state.valid}}}const m1=Object.keys(c1);function BL(t){if(!t||t.valid||!t.valueMissing)return!1;let a=!1;for(const i of m1)i!=="valid"&&(i==="valueMissing"&&(a=t[i]),t[i]&&(a=!1));return a}function YL(t){const{formRef:a,clearErrors:i}=Kh(),{setValidityData:s,validate:d,validityData:m,validationDebounceTime:g,invalid:y,markedDirtyRef:S,state:b,name:T,shouldValidateOnChange:R}=t,{controlId:x,getDescriptionProps:_}=Ds(),A=ml(),z=C.useRef(null),N=nt(async(Y,Z=!1)=>{const V=z.current;if(!V)return;if(Z){if(b.valid!==!1)return;const ce=V.validity;if(!ce.valueMissing){const K={value:Y,state:{...c1,valid:!0},error:"",errors:[],initialValue:m.initialValue};if(V.setCustomValidity(""),x){const L=a.current.fields.get(x);L&&a.current.fields.set(x,{...L,...h1(K,!1)})}s(K);return}const ee=m1.reduce((K,L)=>(K[L]=ce[L],K),{});if(!ee.valid&&!BL(ee))return}function I(ce){const ee=m1.reduce((L,k)=>(L[k]=ce.validity[k],L),{});let K=!1;for(const L of m1)if(L!=="valid"){if(L==="valueMissing"&&ee[L])K=!0;else if(ee[L])return ee}return K&&!S.current&&(ee.valid=!0,ee.valueMissing=!1),ee}A.clear();let q=null,J=[];const he=I(V);let Q;const fe=R();if(V.validationMessage&&!fe)Q=V.validationMessage,J=[V.validationMessage];else{const ce=Array.from(a.current.fields.values()).reduce((K,L)=>(L.name&&(K[L.name]=L.getValue()),K),{}),ee=d(Y,ce);typeof ee=="object"&&ee!==null&&"then"in ee?q=await ee:q=ee,q!==null?(he.valid=!1,he.customError=!0,Array.isArray(q)?(J=q,V.setCustomValidity(q.join(`
261
- `))):q&&(J=[q],V.setCustomValidity(q))):fe&&(V.setCustomValidity(""),he.customError=!1,V.validationMessage?(Q=V.validationMessage,J=[V.validationMessage]):V.validity.valid&&!he.valid&&(he.valid=!0))}const re={value:Y,state:he,error:Q??(Array.isArray(q)?q[0]:q??""),errors:J,initialValue:m.initialValue};if(x){const ce=a.current.fields.get(x);ce&&a.current.fields.set(x,{...ce,...h1(re,y)})}s(re)}),M=C.useCallback((Y={})=>Uu(_,b.valid===!1?{"aria-invalid":!0}:No,Y),[_,b.valid]),$=C.useCallback((Y={})=>Uu({onChange(Z){if(Z.nativeEvent.defaultPrevented)return;if(i(T),!R()){N(Z.currentTarget.value,!0);return}const V=Z.currentTarget;if(V.value===""){N(V.value);return}A.clear(),g?A.start(g,()=>{N(V.value)}):N(V.value)}},M(Y)),[M,i,T,A,N,g,R]);return C.useMemo(()=>({getValidationProps:M,getInputValidationProps:$,inputRef:z,commit:N}),[M,$,N])}function GL(t){const{commit:a,invalid:i,markedDirtyRef:s,name:d,setValidityData:m,validityData:g}=t,{formRef:y}=Kh(),S=C.useRef(null),b=C.useRef(null),T=C.useRef(null),R=nt(()=>{const N=b.current;if(N)return N.getValue?N.getValue():N.value}),x=nt((N=!0)=>{const M=b.current;if(!M)return;let $=M.value;$===void 0&&($=R()),s.current=!0,N?Jl.flushSync(()=>a($)):a($)});function _(){const N=b.current;!N||!N.id||y.current.fields.set(N.id,{getValue:R,name:d,controlRef:N.controlRef??T,validityData:h1(g,i),validate:x})}function A(N=b.current?.id){N&&y.current.fields.delete(N)}function z(){const N=b.current;if(!N)return;let M=N.value;M===void 0&&(M=R()),g.initialValue===null&&M!==null&&m($=>({...$,initialValue:M}))}return ht(()=>{const N=b.current;!N||!N.id||y.current.fields.set(N.id,{getValue:R,name:d,controlRef:N.controlRef??T,validityData:h1(g,i),validate:x})},[y,R,i,d,x,g]),ht(()=>{const N=y.current.fields;return()=>{const M=b.current?.id;M&&N.delete(M)}},[y]),nt((N,M)=>{if(!M){S.current===N&&(S.current=null,A(),b.current=null);return}const $=b.current?.id;S.current=N,b.current=M,$&&$!==M.id&&A($),z(),_()})}const ID=C.forwardRef(function(a,i){const{errors:s,validationMode:d,submitAttemptedRef:m}=Kh(),{render:g,className:y,validate:S,validationDebounceTime:b=0,validationMode:T=d,name:R,disabled:x=!1,invalid:_,dirty:A,touched:z,actionsRef:N,style:M,...$}=a,{disabled:Y}=kL(),Z=nt(S||(()=>null)),V=Y||x,[I,q]=C.useState(!1),[J,he]=C.useState(!1),[Q,fe]=C.useState(!1),[re,ce]=C.useState(!1),ee=A??J,K=z??I,L=C.useRef(!1),k=nt(Ae=>{A===void 0&&(Ae&&(L.current=!0),he(Ae))}),F=nt(Ae=>{z===void 0&&q(Ae)}),W=nt(()=>T==="onChange"||T==="onSubmit"&&m.current),de=!!R&&Object.hasOwn(s,R)&&s[R]!==void 0,U=_===!0||de,[P,te]=C.useState({state:c1,error:"",errors:[],value:null,initialValue:null}),ae=!U&&P.state.valid,Se=C.useMemo(()=>({disabled:V,touched:K,dirty:ee,valid:ae,filled:Q,focused:re}),[V,K,ee,ae,Q,re]),Re=YL({setValidityData:te,validate:Z,validityData:P,validationDebounceTime:b,invalid:U,markedDirtyRef:L,state:Se,name:R,shouldValidateOnChange:W}),Te=C.useCallback(()=>{L.current=!0,Re.commit(P.value)},[Re,P]),Me=GL({commit:Re.commit,invalid:U,markedDirtyRef:L,name:R,setValidityData:te,validityData:P});C.useImperativeHandle(N,()=>({validate:Te}),[Te]);const Be=C.useMemo(()=>({invalid:U,name:R,validityData:P,setValidityData:te,disabled:V,touched:K,setTouched:F,dirty:ee,setDirty:k,filled:Q,setFilled:fe,focused:re,setFocused:ce,validate:Z,validationMode:T,validationDebounceTime:b,shouldValidateOnChange:W,state:Se,markedDirtyRef:L,registerFieldControl:Me,validation:Re}),[U,R,P,V,K,F,ee,k,Q,fe,re,ce,Z,T,b,W,Se,Me,Re]),Qe=Dn("div",a,{ref:i,state:Se,props:$,stateAttributesMapping:Yd});return X.jsx(X2.Provider,{value:Be,children:Qe})});process.env.NODE_ENV!=="production"&&(ID.displayName="FieldRootInner");const em=C.forwardRef(function(a,i){return X.jsx(ZD,{children:X.jsx(ID,{...a,ref:i})})});process.env.NODE_ENV!=="production"&&(em.displayName="FieldRoot");const cR=C.forwardRef(function(a,i){const{render:s,className:d,style:m,id:g,nativeLabel:y=!0,...S}=a,b=Gd(!1),{labelId:T}=Ds(),R=C.useRef(null),x=oL({id:T??g,native:y});return process.env.NODE_ENV!=="production"&&C.useEffect(()=>{if(!R.current)return;const A=R.current.tagName==="LABEL";if(y){if(!A){const z=Zh.captureOwnerStack?.()||"";Ud(`<Field.Label> expected a <label> element because the \`nativeLabel\` prop is true. Rendering a non-<label> disables native label association, so \`htmlFor\` will not work. Use a real <label> in the \`render\` prop, or set \`nativeLabel\` to \`false\`.${z}`)}}else if(A){const z=Zh.captureOwnerStack?.()||"";Ud(`<Field.Label> expected a non-<label> element because the \`nativeLabel\` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the \`render\` prop, or set \`nativeLabel\` to \`true\`.${z}`)}},[y]),Dn("label",a,{ref:[i,R],state:b.state,props:[x,S],stateAttributesMapping:Yd})});process.env.NODE_ENV!=="production"&&(cR.displayName="FieldLabel");const qL={...Yd,...Wl},g1=C.forwardRef(function(a,i){const{render:s,id:d,className:m,match:g,style:y,...S}=a,b=vl(d),{validityData:T,state:R,name:x}=Gd(!1),{setMessageIds:_}=Ds(),{errors:A}=Kh(),z=x?A[x]:null,N=typeof g=="string";let M=!1;g===!0?M=!0:N?M=!!T.state[g]:M=!!z||T.state.valid===!1;const{mounted:$,transitionStatus:Y,setMounted:Z}=$y(M);ht(()=>{if(!(!M||!b))return _(K=>K.concat(b)),()=>{_(K=>K.filter(L=>L!==b))}},[M,b,_]);const V=C.useRef(null),[I,q]=C.useState(null),[J,he]=C.useState(null),Q=T.errors.length>1?X.jsx("ul",{children:T.errors.map(K=>X.jsx("li",{children:K},K))}):T.error,fe=N?Q:z||Q;let re=T.error;z!=null?re=Array.isArray(z)?JSON.stringify(z):z:T.errors.length>1&&(re=JSON.stringify(T.errors)),M&&re!==J&&(he(re),q(fe)),ju({open:M,ref:V,onComplete(){M||Z(!1)}});const ce={...R,transitionStatus:Y},ee=Dn("div",a,{ref:[i,V],state:ce,props:[{id:b,children:M?fe:I},S],stateAttributesMapping:qL,enabled:$});return $?ee:null});process.env.NODE_ENV!=="production"&&(g1.displayName="FieldError");const y1=C.forwardRef(function(a,i){const{render:s,className:d,id:m,name:g,value:y,disabled:S=!1,onValueChange:b,defaultValue:T,autoFocus:R=!1,style:x,..._}=a,{state:A,name:z,disabled:N,setTouched:M,setDirty:$,validityData:Y,setFocused:Z,setFilled:V,validationMode:I,validation:q}=Gd(),J=N||S,he=z??g,Q={...A,disabled:J},{labelId:fe}=Ds(),re=J2({id:m});ht(()=>{const W=y!=null;q.inputRef.current?.value||W&&y!==""?V(!0):W&&y===""&&V(!1)},[q.inputRef,V,y]);const ce=C.useRef(null);ht(()=>{R&&ce.current===Ua(It(ce.current))&&Z(!0)},[R,Z]);const[ee]=Qy({controlled:y,default:T,name:"FieldControl",state:"value"}),K=y!==void 0,L=K?ee:void 0,k=nt(()=>q.inputRef.current?.value);return P2(q.inputRef,{id:re,value:L,getValue:k}),Dn("input",a,{ref:[i,ce],state:Q,props:[{id:re,disabled:J,name:he,ref:q.inputRef,"aria-labelledby":fe,autoFocus:R,...K?{value:L}:{defaultValue:T},onChange(W){const de=W.currentTarget.value;b?.(de,tn(jd,W.nativeEvent)),$(de!==Y.initialValue),V(de!=="")},onFocus(){Z(!0)},onBlur(W){M(!0),Z(!1),I==="onBlur"&&q.commit(W.currentTarget.value)},onKeyDown(W){W.currentTarget.tagName==="INPUT"&&W.key==="Enter"&&(M(!0),q.commit(W.currentTarget.value))}},q.getInputValidationProps(),_],stateAttributesMapping:Yd})});process.env.NODE_ENV!=="production"&&(y1.displayName="FieldControl");const Wy=C.forwardRef(function(a,i){const{render:s,className:d,validationMode:m="onSubmit",errors:g,onSubmit:y,onFormSubmit:S,actionsRef:b,style:T,...R}=a,x=C.useRef({fields:new Map}),_=C.useRef(!1),A=C.useRef(!1),z=nt(I=>{I&&(I.focus(),I.tagName==="INPUT"&&I.select())}),[N,M]=C.useState(g);a1(g,()=>{M(g)}),C.useEffect(()=>{if(!_.current)return;_.current=!1;const I=Array.from(x.current.fields.values()).filter(q=>q.validityData.state.valid===!1);I.length&&z(I[0].controlRef.current)},[N,z]);const $=C.useCallback(I=>{const q=Array.from(x.current.fields.values());if(I){const J=q.find(he=>he.name===I);J&&J.validate(!1)}else q.forEach(J=>{J.validate(!1)})},[]);C.useImperativeHandle(b,()=>({validate:$}),[$]);const Y=Dn("form",a,{ref:i,props:[{noValidate:!0,onSubmit(I){A.current=!0;let q=Array.from(x.current.fields.values());q.forEach(he=>{he.validate()}),q=Array.from(x.current.fields.values());const J=q.filter(he=>!he.validityData.state.valid);if(J.length)I.preventDefault(),z(J[0].controlRef.current);else if(_.current=!0,y?.(I),S){I.preventDefault();const he=q.reduce((Q,fe)=>(fe.name&&(Q[fe.name]=fe.getValue()),Q),{});S(he,O9(jd,I.nativeEvent))}}},R]}),Z=nt(I=>{if(I&&N&&No.hasOwnProperty.call(N,I)){const q={...N};delete q[I],M(q)}}),V=C.useMemo(()=>({formRef:x,validationMode:m,errors:N??No,clearErrors:Z,submitAttemptedRef:A}),[x,m,N,Z]);return X.jsx(F2.Provider,{value:V,children:Y})});process.env.NODE_ENV!=="production"&&(Wy.displayName="Form");const fR=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(fR.displayName="PopoverRootContext");function zs(t){const a=C.useContext(fR);if(a===void 0&&!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverRootContext is missing. Popover parts must be placed within <Popover.Root>.":vo(47));return a}function ZL(){return{...dA(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const IL={...pA,disabled:ut(t=>t.disabled),instantType:ut(t=>t.instantType),openMethod:ut(t=>t.openMethod),openChangeReason:ut(t=>t.openChangeReason),modal:ut(t=>t.modal),focusManagerModal:ut(t=>t.focusManagerModal),stickIfOpen:ut(t=>t.stickIfOpen),titleElementId:ut(t=>t.titleElementId),descriptionElementId:ut(t=>t.descriptionElementId),openOnHover:ut(t=>t.openOnHover),closeDelay:ut(t=>t.closeDelay),hasViewport:ut(t=>t.hasViewport)};class dR extends mS{constructor(a){const i={...ZL(),...a};i.open&&a?.mounted===void 0&&(i.mounted=!0),super(i,{popupRef:C.createRef(),backdropRef:C.createRef(),internalBackdropRef:C.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:C.createRef(),beforeContentFocusGuardRef:C.createRef(),stickIfOpenTimeout:new hl,triggerElements:new qS},IL)}setOpen=(a,i)=>{const s=i.reason===Sr,d=i.reason===$h&&i.event.detail===0,m=!a&&(i.reason===U_||i.reason==null);if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(a,i),i.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(a,i);const g=()=>{const y={open:a,openChangeReason:i.reason},S=i.trigger?.id??null;(S||a)&&(y.activeTriggerId=S,y.activeTriggerElement=i.trigger??null),this.update(y)};s?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(a9,()=>{this.set("stickIfOpen",!1)}),Jl.flushSync(g)):g(),d||m?this.set("instantType",d?"click":"dismiss"):i.reason===Ld?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(a,i){const s=pa(()=>new dR(i)).current,d=a??s;return Uy(s.disposeEffect),d}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function $D({props:t}){const{children:a,open:i,defaultOpen:s=!1,onOpenChange:d,onOpenChangeComplete:m,modal:g=!1,handle:y,triggerId:S,defaultTriggerId:b=null}=t,T=dR.useStore(y?.store,{modal:g,open:s,openProp:i,activeTriggerId:b,triggerIdProp:S});j2(()=>{i===void 0&&T.state.open===!1&&s===!0&&T.update({open:!0,activeTriggerId:b})}),T.useControlledProp("openProp",i),T.useControlledProp("triggerIdProp",S);const R=T.useState("open"),x=T.useState("payload");T.useContextCallback("onOpenChange",d),T.useContextCallback("onOpenChangeComplete",m);const{openMethod:_,triggerProps:A}=L2(R);cA(T);const{forceUnmount:z}=fA(R,T,()=>{T.update({stickIfOpen:!0,openChangeReason:null})});C.useEffect(()=>{R||T.context.stickIfOpenTimeout.clear()},[T,R]);const N=C.useCallback(()=>{T.setOpen(!1,tn(j_))},[T]);C.useImperativeHandle(t.actionsRef,()=>({unmount:z,close:N}),[z,N]);const M=mA({popupStore:T,onOpenChange:T.setOpen}),$=R2(M,{outsidePressEvent:{mouse:g==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),Y=bA(M),{getReferenceProps:Z,getFloatingProps:V,getTriggerProps:I}=Xy([$,Y]),q=C.useMemo(()=>Z(A),[Z,A]),J=C.useMemo(()=>I(A),[I,A]),he=C.useMemo(()=>V(),[V]);T.useSyncedValues({modal:g,openMethod:_,activeTriggerProps:q,inactiveTriggerProps:J,popupProps:he,floatingRootContext:M,nested:Pc()!=null});const Q=C.useMemo(()=>({store:T}),[T]);return X.jsx(fR.Provider,{value:Q,children:typeof a=="function"?a({payload:x}):a})}function $L(t){return zs(!0)?X.jsx($D,{props:t}):X.jsx(U9,{children:X.jsx($D,{props:t})})}const XL=300,XD=C.forwardRef(function(a,i){const{render:s,className:d,disabled:m=!1,nativeButton:g=!0,handle:y,payload:S,openOnHover:b=!1,delay:T=XL,closeDelay:R=0,id:x,style:_,...A}=a,z=zs(!0),N=y?.store??z?.store;if(!N)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Trigger> must be either used within a <Popover.Root> component or provided with a handle.":vo(74));const M=vl(x),$=N.useState("isTriggerActive",M),Y=N.useState("floatingRootContext"),Z=N.useState("isOpenedByTrigger",M),V=C.useRef(null),{registerTrigger:I,isMountedByThisTrigger:q}=sA(M,V,N,{payload:S,disabled:m,openOnHover:b,closeDelay:R}),J=N.useState("openChangeReason"),he=N.useState("stickIfOpen"),Q=N.useState("openMethod"),fe=N.useState("focusManagerModal"),re=Nj(Y,{enabled:Y!=null&&b&&(Q!=="touch"||J!==$h),mouseOnly:!0,move:!1,handleClose:Gj(),restMs:T,delay:{close:R},triggerElementRef:V,isActiveTrigger:$,isClosing:()=>N.select("transitionStatus")==="ending"}),ce=T2(Y,{enabled:Y!=null,stickIfOpen:he}),ee=Xy([ce]),K=N.useState("triggerProps",q),L={disabled:m,open:Z},{getButtonProps:k,buttonRef:F}=Ih({disabled:m,native:g}),W=C.useMemo(()=>({open(ae){return ae&&J===$h?AA.open(ae):_A.open(ae)}}),[J]),de=Dn("button",a,{state:L,ref:[F,i,I,V],props:[ee.getReferenceProps(),re,K,{[u2]:"",id:M},A,k],stateAttributesMapping:W}),{preFocusGuardRef:U,handlePreFocusGuardFocus:P,handleFocusTargetFocus:te}=rL(N,V);return $&&!fe?X.jsxs(C.Fragment,{children:[X.jsx(Nu,{ref:U,onFocus:P}),X.jsx(C.Fragment,{children:de},M),X.jsx(Nu,{ref:N.context.triggerFocusTargetRef,onFocus:te})]}):X.jsx(C.Fragment,{children:de},M)});process.env.NODE_ENV!=="production"&&(XD.displayName="PopoverTrigger");const pR=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(pR.displayName="PopoverPortalContext");function PL(){const t=C.useContext(pR);if(t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Portal> is missing.":vo(45));return t}const PD=C.forwardRef(function(a,i){const{keepMounted:s=!1,...d}=a,{store:m}=zs();return m.useState("mounted")||s?X.jsx(pR.Provider,{value:s,children:X.jsx(VS,{ref:i,...d})}):null});process.env.NODE_ENV!=="production"&&(PD.displayName="PopoverPortal");const hR=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(hR.displayName="PopoverPositionerContext");function FD(){const t=C.useContext(hR);if(!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.":vo(46));return t}const QD=C.forwardRef(function(a,i){const{render:s,className:d,anchor:m,positionMethod:g="absolute",side:y="bottom",align:S="center",sideOffset:b=0,alignOffset:T=0,collisionBoundary:R="clipping-ancestors",collisionPadding:x=5,arrowPadding:_=5,sticky:A=!1,disableAnchorTracking:z=!1,collisionAvoidance:N=c9,style:M,...$}=a,{store:Y}=zs(),Z=PL(),V=z9(),I=Y.useState("floatingRootContext"),q=Y.useState("mounted"),J=Y.useState("open"),he=Y.useState("openChangeReason"),Q=Y.useState("activeTriggerElement"),fe=Y.useState("modal"),re=Y.useState("openMethod"),ce=Y.useState("positionerElement"),ee=Y.useState("instantType"),K=Y.useState("transitionStatus"),L=Y.useState("hasViewport"),k=C.useRef(null),F=R_(ce,!1,!1),W=OA({anchor:m,floatingRootContext:I,positionMethod:g,mounted:q,side:y,sideOffset:b,align:S,alignOffset:T,arrowPadding:_,collisionBoundary:R,collisionPadding:x,sticky:A,disableAnchorTracking:z,keepMounted:Z,nodeId:V,collisionAvoidance:N,adaptiveOrigin:L?Xj:void 0}),de=I.useState("domReferenceElement");ht(()=>{const ae=de,Se=k.current;if(ae&&(k.current=ae),Se&&ae&&ae!==Se){Y.set("instantType",void 0);const Re=new AbortController;return F(()=>{Y.set("instantType","trigger-change")},Re.signal),()=>{Re.abort()}}},[de,F,Y]);const U={open:J,side:W.side,align:W.align,anchorHidden:W.anchorHidden,instant:ee};lD(J&&fe===!0&&he!==Sr,re==="touch",ce,Q);const P=C.useCallback(ae=>{Y.set("positionerElement",ae)},[Y]),te=DA(a,U,{styles:W.positionerStyles,transitionStatus:K,props:$,refs:[i,P],hidden:!q,inert:!J});return X.jsxs(hR.Provider,{value:W,children:[q&&fe===!0&&he!==Sr&&X.jsx(l1,{ref:Y.context.internalBackdropRef,inert:zS(!J),cutout:Q}),X.jsx(N9,{id:V,children:te})]})});process.env.NODE_ENV!=="production"&&(QD.displayName="PopoverPositioner");const JD=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(JD.displayName="ClosePartContext");function FL(){const[t,a]=C.useState(0),i=nt(()=>(a(d=>d+1),()=>{a(d=>Math.max(0,d-1))}));return{context:C.useMemo(()=>({register:i}),[i]),hasClosePart:t>0}}function QL(t){const{value:a,children:i}=t;return X.jsx(JD.Provider,{value:a,children:i})}const JL={...Lu,...Wl},KD=C.forwardRef(function(a,i){const{className:s,render:d,initialFocus:m,finalFocus:g,style:y,...S}=a,{store:b}=zs(),T=FD(),R=dD()!=null,{context:x,hasClosePart:_}=FL(),A=b.useState("open"),z=b.useState("openMethod"),N=b.useState("instantType"),M=b.useState("transitionStatus"),$=b.useState("popupProps"),Y=b.useState("titleElementId"),Z=b.useState("descriptionElementId"),V=b.useState("modal"),I=b.useState("mounted"),q=b.useState("openChangeReason"),J=b.useState("activeTriggerElement"),he=b.useState("floatingRootContext");ju({open:A,ref:b.context.popupRef,onComplete(){A&&b.context.onOpenChangeComplete?.(!0)}});const Q=b.useState("disabled"),fe=b.useState("openOnHover"),re=b.useState("closeDelay");Mj(he,{enabled:fe&&!Q,closeDelay:re});function ce(W){return W==="touch"?b.context.popupRef.current:!0}const ee=m===void 0?ce:m,K={open:A,side:T.side,align:T.align,instant:N,transitionStatus:M},L=V!==!1&&_;b.useSyncedValue("focusManagerModal",L);const k=C.useCallback(W=>{b.set("popupElement",W)},[b]),F=Dn("div",a,{state:K,ref:[i,b.context.popupRef,k],props:[$,{"aria-labelledby":Y,"aria-describedby":Z,onKeyDown(W){R&&o1.has(W.key)&&W.stopPropagation()}},z2(M),S],stateAttributesMapping:JL});return X.jsx(kS,{context:he,openInteractionType:z,modal:L,disabled:!I||q===Sr,initialFocus:ee,returnFocus:g,restoreFocus:"popup",previousFocusableElement:Wn(J)?J:void 0,nextFocusableElement:b.context.triggerFocusTargetRef,beforeContentFocusGuardRef:b.context.beforeContentFocusGuardRef,children:X.jsx(QL,{value:x,children:F})})});process.env.NODE_ENV!=="production"&&(KD.displayName="PopoverPopup");const WD=C.forwardRef(function(a,i){const{className:s,render:d,style:m,...g}=a,{store:y}=zs(),S=y.useState("open"),{arrowRef:b,side:T,align:R,arrowUncentered:x,arrowStyles:_}=FD();return Dn("div",a,{state:{open:S,side:T,align:R,uncentered:x},ref:[i,b],props:[{style:_,"aria-hidden":!0},g],stateAttributesMapping:Lu})});process.env.NODE_ENV!=="production"&&(WD.displayName="PopoverArrow");const KL={...Lu,...Wl},eM=C.forwardRef(function(a,i){const{className:s,render:d,style:m,...g}=a,{store:y}=zs(),S=y.useState("open"),b=y.useState("mounted"),T=y.useState("transitionStatus"),R=y.useState("openChangeReason");return Dn("div",a,{state:{open:S,transitionStatus:T},ref:[y.context.backdropRef,i],props:[{role:"presentation",hidden:!b,style:{pointerEvents:R===Sr?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},g],stateAttributesMapping:KL})});process.env.NODE_ENV!=="production"&&(eM.displayName="PopoverBackdrop");const tM=C.forwardRef(function(a,i){const{render:s,className:d,style:m,...g}=a,{store:y}=zs(),S=vl(g.id);return ht(()=>(y.set("titleElementId",S),()=>{y.set("titleElementId",void 0)}),[y,S]),Dn("h2",a,{ref:i,props:[{id:S},g]})});process.env.NODE_ENV!=="production"&&(tM.displayName="PopoverTitle");const nM=C.forwardRef(function(a,i){const{render:s,className:d,style:m,...g}=a,{store:y}=zs(),S=vl(g.id);return ht(()=>(y.set("descriptionElementId",S),()=>{y.set("descriptionElementId",void 0)}),[y,S]),Dn("p",a,{ref:i,props:[{id:S},g]})});process.env.NODE_ENV!=="production"&&(nM.displayName="PopoverDescription");const v1="base-ui-disable-scrollbar",mR={className:v1,getElement(t){return X.jsx("style",{nonce:t,href:v1,precedence:"base-ui:low",children:`.${v1}{scrollbar-width:none}.${v1}::-webkit-scrollbar{display:none}`})}};process.env.NODE_ENV!=="production"&&(mR.getElement.displayName="styleDisableScrollbar.getElement");const Ns=1;function oM(t,a){return Math.max(0,t-a)}function WL(t,a){if(a<=0)return 0;const i=Qo(t,0,a),s=i,d=a-i,m=s<=Ns,g=d<=Ns;return m&&g?s<=d?0:a:m?0:g?a:i}const gR=C.createContext(null);process.env.NODE_ENV!=="production"&&(gR.displayName="SelectRootContext");const yR=C.createContext(null);process.env.NODE_ENV!=="production"&&(yR.displayName="SelectFloatingContext");function tm(){const t=C.useContext(gR);if(t===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.":vo(60));return t}function aM(){const t=C.useContext(yR);if(t===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.":vo(61));return t}const Sn={id:ut(t=>t.id),labelId:ut(t=>t.labelId),modal:ut(t=>t.modal),multiple:ut(t=>t.multiple),items:ut(t=>t.items),itemToStringLabel:ut(t=>t.itemToStringLabel),itemToStringValue:ut(t=>t.itemToStringValue),isItemEqualToValue:ut(t=>t.isItemEqualToValue),value:ut(t=>t.value),hasSelectedValue:ut(t=>{const{value:a,multiple:i,itemToStringValue:s}=t;return a==null?!1:i&&Array.isArray(a)?a.length>0:Jh(a,s)!==""}),hasNullItemLabel:ut((t,a)=>a?q7(t.items):!1),open:ut(t=>t.open),mounted:ut(t=>t.mounted),forceMount:ut(t=>t.forceMount),transitionStatus:ut(t=>t.transitionStatus),openMethod:ut(t=>t.openMethod),activeIndex:ut(t=>t.activeIndex),selectedIndex:ut(t=>t.selectedIndex),isActive:ut((t,a)=>t.activeIndex===a),isSelected:ut((t,a,i)=>{const s=t.isItemEqualToValue,d=t.value;return t.multiple?Array.isArray(d)&&d.some(m=>Qh(i,m,s)):t.selectedIndex===a&&t.selectedIndex!==null?!0:Qh(i,d,s)}),isSelectedByFocus:ut((t,a)=>t.selectedIndex===a),popupProps:ut(t=>t.popupProps),triggerProps:ut(t=>t.triggerProps),triggerElement:ut(t=>t.triggerElement),positionerElement:ut(t=>t.positionerElement),listElement:ut(t=>t.listElement),scrollUpArrowVisible:ut(t=>t.scrollUpArrowVisible),scrollDownArrowVisible:ut(t=>t.scrollDownArrowVisible),hasScrollArrows:ut(t=>t.hasScrollArrows)};function eH(t){const{id:a,value:i,defaultValue:s=null,onValueChange:d,open:m,defaultOpen:g=!1,onOpenChange:y,name:S,form:b,autoComplete:T,disabled:R=!1,readOnly:x=!1,required:_=!1,modal:A=!0,actionsRef:z,inputRef:N,onOpenChangeComplete:M,items:$,multiple:Y=!1,itemToStringLabel:Z,itemToStringValue:V,isItemEqualToValue:I=k7,highlightItemOnHover:q=!0,children:J}=t,{clearErrors:he}=Kh(),{setDirty:Q,setTouched:fe,setFocused:re,shouldValidateOnChange:ce,validityData:ee,setFilled:K,name:L,disabled:k,validation:F,validationMode:W}=Gd(),de=J2({id:a}),U=k||R,P=L??S,[te,ae]=Qy({controlled:i,default:Y?s??jC:s,name:"Select",state:"value"}),[Se,Re]=Qy({controlled:m,default:g,name:"Select",state:"open"}),Te=C.useRef([]),Me=C.useRef([]),Be=C.useRef(null),Qe=C.useRef(null),Ae=C.useRef(0),Le=C.useRef(null),rt=C.useRef([]),ot=C.useRef(!1),We=C.useRef(!1),Ze=C.useRef(null),Je=C.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ct=C.useRef(!1),{mounted:tt,setMounted:Ye,transitionStatus:ne}=$y(Se),{openMethod:Ee,triggerProps:be}=L2(Se),me=pa(()=>new UC({id:de,labelId:void 0,modal:A,multiple:Y,itemToStringLabel:Z,itemToStringValue:V,isItemEqualToValue:I,value:te,open:Se,mounted:tt,transitionStatus:ne,items:$,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,$e=bn(me,Sn.activeIndex),Pe=bn(me,Sn.selectedIndex),Xe=bn(me,Sn.triggerElement),at=bn(me,Sn.positionerElement),zt=lL(Ee),yt=Ee??zt,St=C.useMemo(()=>Y&&Array.isArray(te)&&te.length===0?"":Jh(te,V),[Y,te,V]),Rt=C.useMemo(()=>Y&&Array.isArray(te)?te.map(xt=>Jh(xt,V)):Jh(te,V),[Y,te,V]),_t=Fo(me.state.triggerElement),Ot=nt(()=>Rt);P2(_t,{id:de,value:te,getValue:Ot});const Nt=C.useRef(te);ht(()=>{te!==Nt.current&&me.set("forceMount",!0)},[me,te]),ht(()=>{K(Y?Array.isArray(te)&&te.length>0:te!=null)},[Y,te,K]),ht(function(){if(Se)return;const Et=rt.current;if(Y){const kt=Array.isArray(te)?te:[];if(kt.length===0){me.set("selectedIndex",null);return}const $t=kt[kt.length-1],vt=Jy(Et,$t,I);me.set("selectedIndex",vt===-1?null:vt);return}const Ht=Jy(Et,te,I);me.set("selectedIndex",Ht===-1?null:Ht)},[Y,Se,te,rt,I,me]),a1(te,()=>{he(P),Q(te!==ee.initialValue),ce()?F.commit(te):F.commit(te,!0)});const Yt=nt((xt,Et)=>{if(y?.(xt,Et),!Et.isCanceled&&(Re(xt),!xt&&(Et.reason===Ld||Et.reason===f2)&&(fe(!0),re(!1),W==="onBlur"&&F.commit(te)),!xt&&me.state.activeIndex!==null)){const Ht=Te.current[me.state.activeIndex];queueMicrotask(()=>{Ht?.setAttribute("tabindex","-1")})}}),gn=nt(()=>{Ye(!1),me.update({activeIndex:null,openMethod:null}),M?.(!1)});ju({enabled:!z,open:Se,ref:Be,onComplete(){Se||gn()}}),C.useImperativeHandle(z,()=>({unmount:gn}),[gn]);const H=nt((xt,Et)=>{d?.(xt,Et),!Et.isCanceled&&ae(xt)}),le=nt(()=>{const xt=me.state.listElement||Be.current;if(!xt)return;const Et=oM(xt.scrollHeight,xt.clientHeight),Ht=WL(xt.scrollTop,Et),kt=Ht>0,$t=Ht<Et;me.state.scrollUpArrowVisible!==kt&&me.set("scrollUpArrowVisible",kt),me.state.scrollDownArrowVisible!==$t&&me.set("scrollDownArrowVisible",$t)}),ze=hA({open:Se,onOpenChange:Yt,elements:{reference:Xe,floating:at}}),He=T2(ze,{enabled:!x&&!U,event:"mousedown"}),et=R2(ze,{bubbles:!1}),lt=Hj(ze,{enabled:!x&&!U,listRef:Te,activeIndex:$e,selectedIndex:Pe,disabledIndices:jC,onNavigate(xt){xt===null&&!Se||me.set("activeIndex",xt)},focusItemOnHover:q}),ft=kj(ze,{enabled:!x&&!U&&(Se||!Y),listRef:Me,activeIndex:$e,selectedIndex:Pe,onMatch(xt){Se?me.set("activeIndex",xt):H(rt.current[xt],tn("none"))},onTypingChange(xt){ot.current=xt}}),{getReferenceProps:At,getFloatingProps:st,getItemProps:je}=Xy([He,et,lt,ft]),Fe=C.useMemo(()=>Uu(At(),be,de?{id:de}:No),[At,be,de]);j2(()=>{me.update({popupProps:st(),triggerProps:Fe})}),ht(()=>{me.update({id:de,modal:A,multiple:Y,value:te,open:Se,mounted:tt,transitionStatus:ne,popupProps:st(),triggerProps:Fe,items:$,itemToStringLabel:Z,itemToStringValue:V,isItemEqualToValue:I,openMethod:yt})},[me,de,A,Y,te,Se,tt,ne,st,Fe,$,Z,V,I,yt]);const dt=C.useMemo(()=>({store:me,name:P,required:_,disabled:U,readOnly:x,multiple:Y,highlightItemOnHover:q,setValue:H,setOpen:Yt,listRef:Te,popupRef:Be,scrollHandlerRef:Qe,handleScrollArrowVisibility:le,scrollArrowsMountedCountRef:Ae,getItemProps:je,events:ze.context.events,valueRef:Le,valuesRef:rt,labelsRef:Me,typingRef:ot,selectionRef:Je,selectedItemTextRef:Ze,validation:F,onOpenChangeComplete:M,keyboardActiveRef:We,alignItemWithTriggerActiveRef:ct,initialValueRef:Nt}),[me,P,_,U,x,Y,q,H,Yt,je,ze.context.events,F,M,le]),Lt=Md(N,F.inputRef),qt=Y&&Array.isArray(te)&&te.length>0,Dt=Y?void 0:P,Qt=C.useMemo(()=>!Y||!Array.isArray(te)||!P?null:te.map(xt=>{const Et=Jh(xt,V);return X.jsx("input",{type:"hidden",form:b,name:P,value:Et},Et)}),[Y,te,b,P,V]);return X.jsx(gR.Provider,{value:dt,children:X.jsxs(yR.Provider,{value:ze,children:[J,X.jsx("input",{...F.getInputValidationProps({onFocus(){me.state.triggerElement?.focus({focusVisible:!0})},onChange(xt){if(xt.nativeEvent.defaultPrevented)return;const Et=xt.currentTarget.value,Ht=tn(jd,xt.nativeEvent);function kt(){if(Y)return;const $t=rt.current.find(vt=>Jh(vt,V).toLowerCase()===Et.toLowerCase()||Z7(vt,Z).toLowerCase()===Et.toLowerCase());$t!=null&&(Q($t!==ee.initialValue),H($t,Ht),ce()&&F.commit($t))}me.set("forceMount",!0),queueMicrotask(kt)}}),id:de&&Dt==null?`${de}-hidden-input`:void 0,form:b,name:Dt,autoComplete:T,value:St,disabled:U,required:_&&!qt,readOnly:x,ref:Lt,style:P?h_:AS,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Qt]})})}const b1=2,tH=400,rM=200,nH={...AA,...Yd,value:()=>null},lM=C.forwardRef(function(a,i){const{render:s,className:d,id:m,disabled:g=!1,nativeButton:y=!0,style:S,...b}=a,{setTouched:T,setFocused:R,validationMode:x,state:_,disabled:A}=Gd(),{labelId:z}=Ds(),{store:N,setOpen:M,selectionRef:$,validation:Y,readOnly:Z,required:V,alignItemWithTriggerActiveRef:I,disabled:q,keyboardActiveRef:J}=tm(),he=A||q||g,Q=bn(N,Sn.open),fe=bn(N,Sn.value),re=bn(N,Sn.triggerProps),ce=bn(N,Sn.positionerElement),ee=bn(N,Sn.listElement),K=bn(N,Sn.id),L=bn(N,Sn.labelId),k=bn(N,Sn.hasSelectedValue),F=!k&&Q,W=bn(N,Sn.hasNullItemLabel,F),de=m??K,U=X7(z,L);J2({id:de});const P=Fo(ce),te=C.useRef(null),{getButtonProps:ae,buttonRef:Se}=Ih({disabled:he,native:y}),Re=nt(We=>{N.set("triggerElement",We)}),Te=Md(i,te,Se,Re),Me=ml(),Be=ml(),Qe=ml(),Ae=ml();C.useEffect(()=>{if(Q)return!(k||W)?Qe.start(tH,()=>{$.current.allowUnselectedMouseUp=!0,$.current.allowSelectedMouseUp=!0}):Ae.start(rM,()=>{$.current.allowUnselectedMouseUp=!0,Qe.start(rM,()=>{$.current.allowSelectedMouseUp=!0})}),()=>{Qe.clear(),Ae.clear()};$.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},Be.clear()},[Q,k,W,$,Be,Qe,Ae]);const Le=C.useMemo(()=>ee?.id??ky(ce)?.id,[ee,ce]),rt=Uu(re,{id:de,role:"combobox","aria-expanded":Q?"true":"false","aria-haspopup":"listbox","aria-controls":Q?Le:void 0,"aria-labelledby":U,"aria-readonly":Z||void 0,"aria-required":V||void 0,tabIndex:he?-1:0,ref:Te,onFocus(We){R(!0),Q&&I.current&&M(!1,tn(jd,We.nativeEvent)),Me.start(0,()=>{N.set("forceMount",!0)})},onBlur(We){Tt(ce,We.relatedTarget)||(T(!0),R(!1),x==="onBlur"&&Y.commit(fe))},onPointerMove(){J.current=!1},onKeyDown(){J.current=!0},onMouseDown(We){if(Q)return;const Ze=It(We.currentTarget);function Je(ct){if(!te.current)return;const tt=ct.target;if(Tt(te.current,tt)||Tt(P.current,tt)||tt===te.current)return;const Ye=$7(te.current);ct.clientX>=Ye.left-b1&&ct.clientX<=Ye.right+b1&&ct.clientY>=Ye.top-b1&&ct.clientY<=Ye.bottom+b1||M(!1,tn(R9,ct))}Be.start(0,()=>{Ze.addEventListener("mouseup",Je,{once:!0})})}},Y.getValidationProps,b,ae);rt.role="combobox";const ot={..._,open:Q,disabled:he,value:fe,readOnly:Z,placeholder:!k};return Dn("button",a,{ref:[i,te],state:ot,stateAttributesMapping:nH,props:rt})});process.env.NODE_ENV!=="production"&&(lM.displayName="SelectTrigger");const iM=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(iM.displayName="SelectPortalContext");const uM=C.forwardRef(function(a,i){const{store:s}=tm(),d=bn(s,Sn.mounted),m=bn(s,Sn.forceMount);return d||m?X.jsx(iM.Provider,{value:!0,children:X.jsx(VS,{ref:i,...a})}):null});process.env.NODE_ENV!=="production"&&(uM.displayName="SelectPortal");const vR=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(vR.displayName="SelectPositionerContext");function oH(){const t=C.useContext(vR);if(!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.":vo(59));return t}function S1(t,a){t&&Object.assign(t.style,a)}const aH={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},rH={position:"fixed"},sM=C.forwardRef(function(a,i){const{anchor:s,positionMethod:d="absolute",className:m,render:g,side:y="bottom",align:S="center",sideOffset:b=0,alignOffset:T=0,collisionBoundary:R="clipping-ancestors",collisionPadding:x,arrowPadding:_=5,sticky:A=!1,disableAnchorTracking:z,alignItemWithTrigger:N=!0,collisionAvoidance:M=s9,style:$,...Y}=a,{store:Z,listRef:V,labelsRef:I,alignItemWithTriggerActiveRef:q,selectedItemTextRef:J,valuesRef:he,initialValueRef:Q,popupRef:fe,setValue:re}=tm(),ce=aM(),ee=bn(Z,Sn.open),K=bn(Z,Sn.mounted),L=bn(Z,Sn.modal),k=bn(Z,Sn.value),F=bn(Z,Sn.openMethod),W=bn(Z,Sn.positionerElement),de=bn(Z,Sn.triggerElement),U=bn(Z,Sn.isItemEqualToValue),P=bn(Z,Sn.transitionStatus),te=C.useRef(null),ae=C.useRef(null),[Se,Re]=C.useState(N),Te=K&&Se&&F!=="touch";!K&&Se!==N&&Re(N),ht(()=>{K||(Sn.scrollUpArrowVisible(Z.state)&&Z.set("scrollUpArrowVisible",!1),Sn.scrollDownArrowVisible(Z.state)&&Z.set("scrollDownArrowVisible",!1))},[Z,K]),C.useImperativeHandle(q,()=>Te),lD((Te||L)&&ee,F==="touch",W,de);const Me=OA({anchor:s,floatingRootContext:ce,positionMethod:d,mounted:K,side:y,sideOffset:b,align:S,alignOffset:T,arrowPadding:_,collisionBoundary:R,collisionPadding:x,sticky:A,disableAnchorTracking:z??Te,collisionAvoidance:M,keepMounted:!0}),Be=Te?"none":Me.side,Qe=Te?rH:Me.positionerStyles,Ae={open:ee,side:Be,align:Me.align,anchorHidden:Me.anchorHidden},Le=nt(Je=>{Z.set("positionerElement",Je)}),rt=DA(a,Ae,{styles:Qe,transitionStatus:P,props:Y,refs:[i,Le],hidden:!K,inert:!ee}),ot=C.useRef(0),We=nt(Je=>{if(Je.size===0&&ot.current===0||he.current.length===0)return;const ct=ot.current;if(ot.current=Je.size,Je.size===ct)return;const tt=tn(jd);if(ct!==0&&!Z.state.multiple&&k!==null&&Jy(he.current,k,U)===-1){const ne=Q.current,be=ne!=null&&Jy(he.current,ne,U)!==-1?ne:null;re(be,tt),be===null&&(Z.set("selectedIndex",null),J.current=null)}if(ct!==0&&Z.state.multiple&&Array.isArray(k)){const Ye=Ee=>Jy(he.current,Ee,U)!==-1,ne=k.filter(Ee=>Ye(Ee));(ne.length!==k.length||ne.some(Ee=>!B7(k,Ee,U)))&&(re(ne,tt),ne.length===0&&(Z.set("selectedIndex",null),J.current=null))}if(ee&&Te){Z.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Ye={height:""};S1(W,Ye),S1(fe.current,Ye)}}),Ze=C.useMemo(()=>({...Me,side:Be,alignItemWithTriggerActive:Te,setControlledAlignItemWithTrigger:Re,scrollUpArrowRef:te,scrollDownArrowRef:ae}),[Me,Be,Te,Re]);return X.jsx(g7,{elementsRef:V,labelsRef:I,onMapChange:We,children:X.jsxs(vR.Provider,{value:Ze,children:[K&&L&&X.jsx(l1,{inert:zS(!ee),cutout:de}),rt]})})});process.env.NODE_ENV!=="production"&&(sM.displayName="SelectPositioner");const lH={...Lu,...Wl},cM=C.forwardRef(function(a,i){const{render:s,className:d,style:m,finalFocus:g,...y}=a,{store:S,popupRef:b,onOpenChangeComplete:T,setOpen:R,valueRef:x,selectedItemTextRef:_,keyboardActiveRef:A,multiple:z,handleScrollArrowVisibility:N,scrollHandlerRef:M,listRef:$,highlightItemOnHover:Y}=tm(),{side:Z,align:V,alignItemWithTriggerActive:I,isPositioned:q,setControlledAlignItemWithTrigger:J,scrollDownArrowRef:he,scrollUpArrowRef:Q}=oH(),fe=dD()!=null,re=aM(),ce=TA(),{nonce:ee,disableStyleElements:K}=uL(),L=bn(S,Sn.id),k=bn(S,Sn.open),F=bn(S,Sn.mounted),W=bn(S,Sn.popupProps),de=bn(S,Sn.transitionStatus),U=bn(S,Sn.triggerElement),P=bn(S,Sn.positionerElement),te=bn(S,Sn.listElement),ae=C.useRef(!1),Se=C.useRef(!1),Re=C.useRef({}),Te=Ly(),Me=nt(Le=>{if(!P||!b.current||!Se.current)return;if(ae.current||!I){N();return}const rt=P.style.top==="0px",ot=P.style.bottom==="0px";if(!rt&&!ot){N();return}const We=dM(P),Ze=ev(P.getBoundingClientRect().height,"y",We),Je=It(P),ct=getComputedStyle(P),tt=parseFloat(ct.marginTop),Ye=parseFloat(ct.marginBottom),ne=fM(getComputedStyle(b.current)),Ee=Math.min(Je.documentElement.clientHeight-tt-Ye,ne),be=Le.scrollTop,me=E1(Le);let $e=0,Pe=null,Xe=!1,at=!1;const zt=_t=>{P.style.height=`${_t}px`},yt=(_t,Ot)=>{const Nt=Qo(_t,0,Ee-Ze);Nt>0&&zt(Ze+Nt),Le.scrollTop=Ot,Ee-(Ze+Nt)<=Ns&&(ae.current=!0),N()},St=rt?me-be:be,Rt=Math.min(Ze+St,Ee);if($e=Rt,St<=Ns){yt(St,rt?me:0);return}if(Ee-Rt>Ns)rt?at=!0:Pe=0;else if(Xe=!0,ot&&be<me){const _t=Ze+St-Ee;Pe=be-(St-_t)}if($e=Math.ceil($e),$e!==0&&zt($e),at||Pe!=null){const _t=E1(Le),Ot=at?_t:Qo(Pe,0,_t);Math.abs(Le.scrollTop-Ot)>Ns&&(Le.scrollTop=Ot)}(Xe||$e>=Ee-Ns)&&(ae.current=!0),N()});C.useImperativeHandle(M,()=>Me,[Me]),ju({open:k,ref:b,onComplete(){k&&T?.(!0)}});const Be={open:k,transitionStatus:de,side:Z,align:V};ht(()=>{!P||!b.current||Object.keys(Re.current).length||(Re.current={top:P.style.top||"0",left:P.style.left||"0",right:P.style.right,height:P.style.height,bottom:P.style.bottom,minHeight:P.style.minHeight,maxHeight:P.style.maxHeight,marginTop:P.style.marginTop,marginBottom:P.style.marginBottom})},[b,P]),ht(()=>{k||I||(Se.current=!1,ae.current=!1,S1(P,Re.current))},[k,I,P,b]),ht(()=>{const Le=b.current;if(!k||!U||!P||!Le||I&&!q||S.state.transitionStatus==="ending")return;if(!I){Se.current=!0,Te.request(N),Le.style.removeProperty("--transform-origin");return}const rt=iH(Le);Le.style.removeProperty("--transform-origin");try{const ot=_.current,We=x.current,Ze=getComputedStyle(P),Je=getComputedStyle(Le),ct=It(U),tt=Zn(P),Ye=dM(U),ne=w1(U.getBoundingClientRect(),Ye),Ee=w1(P.getBoundingClientRect(),Ye),be=ne.height,me=te||Le,$e=me.scrollHeight,Pe=parseFloat(Je.borderBottomWidth),Xe=parseFloat(Ze.marginTop)||10,at=parseFloat(Ze.marginBottom)||10,zt=parseFloat(Ze.minHeight)||100,yt=fM(Je),St=5,Rt=5,_t=20,Ot=ct.documentElement.clientHeight-Xe-at,Nt=ct.documentElement.clientWidth,Yt=Ot-ne.bottom+be;let gn,H=ce==="rtl"?ne.right-Ee.width:ne.left,le=0;if(ot&&We){const Lt=w1(We.getBoundingClientRect(),Ye);gn=w1(ot.getBoundingClientRect(),Ye),H=Ee.left+(ce==="rtl"?Lt.right-gn.right:Lt.left-gn.left);const qt=Lt.top-ne.top+Lt.height/2;le=gn.top-Ee.top+gn.height/2-qt}const ze=Yt+le+at+Pe;let He=Math.min(Ot,ze);const et=Ot-Xe-at,lt=ze-He,ft=Nt-Rt;P.style.left=`${Qo(H,St,ft-Ee.width)}px`,P.style.height=`${He}px`,P.style.maxHeight="auto",P.style.marginTop=`${Xe}px`,P.style.marginBottom=`${at}px`,Le.style.height="100%";const At=E1(me),st=lt>=At-Ns;st&&(He=Math.min(Ot,Ee.height)-(lt-At));const je=ne.top<_t||ne.bottom>Ot-_t||Math.ceil(He)+Ns<Math.min($e,zt),Fe=(tt.visualViewport?.scale??1)!==1&&YT;if(je||Fe){Se.current=!0,S1(P,Re.current),J(!1);return}const dt=Math.max(zt,He);if(st){const Lt=Math.max(0,Ot-ze);P.style.top=Ee.height>=et?"0":`${Lt}px`,P.style.height=`${He}px`,me.scrollTop=E1(me)}else P.style.bottom="0",me.scrollTop=lt;if(gn){const Lt=Ee.top,qt=Ee.height,Dt=gn.top+gn.height/2,Qt=qt>0?(Dt-Lt)/qt*100:50,xt=Qo(Qt,0,100);Le.style.setProperty("--transform-origin",`50% ${xt}%`)}(dt===Ot||He>=yt)&&(ae.current=!0),N(),Y&&S.state.selectedIndex===null&&S.state.activeIndex===null&&$.current[0]!=null&&S.set("activeIndex",0),Se.current=!0}finally{rt()}},[S,k,P,U,x,_,b,N,I,J,Te,he,Q,te,$,Y,ce,q]),C.useEffect(()=>{if(!I||!P||!k)return;const Le=Zn(P);function rt(ot){R(!1,tn(x9,ot))}return rn(Le,"resize",rt)},[R,I,P,k]);const Qe={...te?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":z||void 0,id:`${L}-list`},onKeyDown(Le){A.current=!0,fe&&o1.has(Le.key)&&Le.stopPropagation()},onMouseMove(){A.current=!1},onScroll(Le){te||Me(Le.currentTarget)},...I&&{style:te?{height:"100%"}:aH}},Ae=Dn("div",a,{ref:[i,b],state:Be,stateAttributesMapping:lH,props:[W,Qe,z2(de),{className:!te&&I?mR.className:void 0},y]});return X.jsxs(C.Fragment,{children:[!K&&mR.getElement(ee),X.jsx(kS,{context:re,modal:!1,disabled:!F,returnFocus:g,restoreFocus:!0,children:Ae})]})});process.env.NODE_ENV!=="production"&&(cM.displayName="SelectPopup");function fM(t){const a=t.maxHeight||"";return a.endsWith("px")&&parseFloat(a)||1/0}function E1(t){return oM(t.scrollHeight,t.clientHeight)}function dM(t){return aA.getScale(t)}function ev(t,a,i){return t/i[a]}function w1(t,a){return Yy({x:ev(t.x,"x",a),y:ev(t.y,"y",a),width:ev(t.width,"x",a),height:ev(t.height,"y",a)})}const pM=[["transform","none"],["scale","1"],["translate","0 0"]];function iH(t){const{style:a}=t,i={};for(const[s,d]of pM)i[s]=a.getPropertyValue(s),a.setProperty(s,d,"important");return()=>{for(const[s]of pM){const d=i[s];d?a.setProperty(s,d):a.removeProperty(s)}}}const bR=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(bR.displayName="SelectItemContext");function SR(){const t=C.useContext(bR);if(!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.":vo(57));return t}const hM=C.memo(C.forwardRef(function(a,i){const{render:s,className:d,value:m=null,label:g,disabled:y=!1,nativeButton:S=!1,style:b,...T}=a,R=C.useRef(null),x=S7({label:g,textRef:R,indexGuessBehavior:$A.GuessFromOrder}),{store:_,getItemProps:A,setOpen:z,setValue:N,selectionRef:M,typingRef:$,valuesRef:Y,multiple:Z,selectedItemTextRef:V}=tm(),I=bn(_,Sn.isActive,x.index),q=bn(_,Sn.isSelected,x.index,m),J=bn(_,Sn.isSelectedByFocus,x.index),he=bn(_,Sn.isItemEqualToValue),Q=x.index,fe=Q!==-1,re=C.useRef(null),ce=Fo(Q);ht(()=>{if(!fe)return;const Se=Y.current;return Se[Q]=m,()=>{delete Se[Q]}},[fe,Q,m,Y]),ht(()=>{if(!fe)return;const Se=_.state.value;let Re=Se;Z&&Array.isArray(Se)&&Se.length>0&&(Re=Se[Se.length-1]),Re!==void 0&&Qh(m,Re,he)&&(_.set("selectedIndex",Q),R.current&&(V.current=R.current))},[fe,Q,Z,he,_,m,V]);const ee={disabled:y,selected:q,highlighted:I},K=A({active:I,selected:q});K.id=void 0;const L=C.useRef(null),k=C.useRef("mouse"),F=C.useRef(!1),{getButtonProps:W,buttonRef:de}=Ih({disabled:y,focusableWhenDisabled:!0,native:S,composite:!0});function U(Se){const Re=_.state.value;if(Z){const Te=Array.isArray(Re)?Re:[],Me=q?Y7(Te,m,he):[...Te,m];N(Me,tn(d2,Se))}else N(m,tn(d2,Se)),z(!1,tn(d2,Se))}const P={role:"option","aria-selected":q,tabIndex:I?0:-1,onTouchStart(){M.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(Se){L.current=Se.key,_.set("activeIndex",Q),Se.key===" "&&$.current&&Se.preventDefault()},onClick(Se){F.current=!1,!(Se.type==="keydown"&&L.current===null)&&(y||Se.type==="keydown"&&L.current===" "&&$.current||k.current!=="touch"&&!I||(L.current=null,U(Se.nativeEvent)))},onPointerEnter(Se){k.current=Se.pointerType},onPointerDown(Se){k.current=Se.pointerType,F.current=!0},onMouseUp(){if(y)return;if(F.current){F.current=!1;return}const Se=!M.current.allowSelectedMouseUp&&q,Re=!M.current.allowUnselectedMouseUp&&!q;Se||Re||k.current!=="touch"&&!I||re.current?.click()}},te=Dn("div",a,{ref:[de,i,x.ref,re],state:ee,props:[K,P,T,W]}),ae=C.useMemo(()=>({selected:q,indexRef:ce,textRef:R,selectedByFocus:J,hasRegistered:fe}),[q,ce,R,J,fe]);return X.jsx(bR.Provider,{value:ae,children:te})}));process.env.NODE_ENV!=="production"&&(hM.displayName="SelectItem");const mM=C.forwardRef(function(a,i){const s=a.keepMounted??!1,{selected:d}=SR();return s||d?X.jsx(gM,{...a,ref:i}):null});process.env.NODE_ENV!=="production"&&(mM.displayName="SelectItemIndicator");const gM=C.memo(C.forwardRef((t,a)=>{const{render:i,className:s,style:d,keepMounted:m,...g}=t,{selected:y}=SR(),S=C.useRef(null),{transitionStatus:b,setMounted:T}=$y(y),x=Dn("span",t,{ref:[a,S],state:{selected:y,transitionStatus:b},props:[{"aria-hidden":!0,children:"✔️"},g],stateAttributesMapping:Wl});return ju({open:y,ref:S,onComplete(){y||T(!1)}}),x}));process.env.NODE_ENV!=="production"&&(gM.displayName="Inner");const yM=C.memo(C.forwardRef(function(a,i){const{indexRef:s,textRef:d,selectedByFocus:m,hasRegistered:g}=SR(),{selectedItemTextRef:y}=tm(),{className:S,render:b,style:T,...R}=a,x=C.useCallback(A=>{if(!A||!g)return;const z=y.current===null||!y.current.isConnected;(m||z&&s.current===0)&&(y.current=A)},[y,s,m,g]);return Dn("div",a,{ref:[x,i,d],props:R})}));process.env.NODE_ENV!=="production"&&(yM.displayName="SelectItemText");function rr({as:t,children:a,className:i,disabled:s,...d}){const m=t||"button",g=m==="button";return X.jsx(m,{className:CT("align-middle inline-flex items-center justify-center transition-all cursor-pointer hover:brightness-110 active:brightness-90 active:scale-90 disabled:cursor-not-allowed disabled:grayscale",i),...g?{disabled:s}:{"aria-disabled":s},...s&&!g?{onClick:y=>{y.preventDefault(),y.stopPropagation()}}:{},...d,children:a})}const uH=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),sH=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,i,s)=>s?s.toUpperCase():i.toLowerCase()),vM=t=>{const a=sH(t);return a.charAt(0).toUpperCase()+a.slice(1)},bM=(...t)=>t.filter((a,i,s)=>!!a&&a.trim()!==""&&s.indexOf(a)===i).join(" ").trim(),cH=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var fH={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const dH=C.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:i=2,absoluteStrokeWidth:s,className:d="",children:m,iconNode:g,...y},S)=>C.createElement("svg",{ref:S,...fH,width:a,height:a,stroke:t,strokeWidth:s?Number(i)*24/Number(a):i,className:bM("lucide",d),...!m&&!cH(y)&&{"aria-hidden":"true"},...y},[...g.map(([b,T])=>C.createElement(b,T)),...Array.isArray(m)?m:[m]]));const Us=(t,a)=>{const i=C.forwardRef(({className:s,...d},m)=>C.createElement(dH,{ref:m,iconNode:a,className:bM(`lucide-${uH(vM(t))}`,`lucide-${t}`,s),...d}));return i.displayName=vM(t),i};const ER=Us("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const SM=Us("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const EM=Us("eye-closed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);const wM=Us("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const pH=Us("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const hH=Us("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const mH=Us("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);const gH=Us("user",[["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"}]]);const TM=Us("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function yH(t){return ja.get("/channel/game/role/mail-captcha",t)}function vH(t){return ja.get("/channel/game/role/auth",t)}function bH(t){return ja.post("/passport-api/v2/ztgame/auth/login",{account:t.account,password:t.password,channel_login:1,channel_id:6})}function SH(t){return ja.post("/passport-api/v2/sms-captchas",{mobile:t.mobile,type:t.type||"register",is_voice:0,nationcode:t.countryCode})}function EH(t){return ja.post("/passport-api/v2/ztgame/auth/mobile-register",{mobile:t.mobile,captcha:t.captcha,channel_login:1,channel_id:6,nationcode:t.countryCode,ad_id:""})}function RM(){return ja.post("/passport-api/v2/ztgame/auth/auth",{channel_login:1,channel_id:6})}function wH(t){return ja.post(`/passport-api/v2/ztgame/users/${t.uid}/idcard`,{name:t.name,idcard:t.idcard},{headers:{Authentication:t.authorization}})}function TH(t){return ja.post("/passport-api/v2/ztgame/auth/re-auth",{type:"auth",channel_id:6,ad_id:"",channel_login:1},{headers:{Authentication:t}})}function RH(t){return ja.post("/passport-api/v2/ztgame/user-center/forget-password/",t)}function xH(t){return ja.post("/passport-api/v2/ztgame/user-center/forget-password/sms-captchas",t)}function xM(t){return ja.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-keys",t)}function OH(t){return ja.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-update",t)}const CH="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAXCAYAAADk3wSdAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFJ0lEQVQ4jW2VW4ydVRXHf2tfvu87Z+5znEtnxnLR0pYJatEHWxhBEZUSCE8YESImRnzwQTEEY6KJGrQJXiFGXzAxaowkSkyoIgjYlEqEIIrSS6KmpTPDdJgz55w5t++29/bhjDQFVrKf9lq/rGSt/3/J+v2XExRQgNsKuJbH9QLFKaE4BWqUu6TCvXhGQsajOD6D4BJfQBCuvvaLLE/uhLTN/8PwVlGCxIJZCJ9XYzwYBEIGdLkztBE8d1rvSJWlbSLw/oJy9UZe8AOAGglfNbt4UE2CSkBikASwfKpE6blOncdndtOauAjy3gWM8516wCGiuFGPyT2Mhw+EQvC9wZ+UEAw4UfXZtBU6cZX7Fm+C4IDwBmgAPHdguEGPy1VqSO0MObhewHc9UgC5gAKXKmpbW3fV8i1/8JovsDyzG5ortxK4DpFzwP1A2yAcUpHciwURCLngOgFVBkIOOPBd/qrWir/MrTV/k6nk2N3v/Rx/uHgJmqvfrqb5l3sioBVofTsi18hrDywGqQ46IQBFwHcCRT1QrrmfDjXaP/TrvNRerrIiM/xq98d4bH6ROK3fV3XlV0QU60azajTOGND6R4YIpAqiAsEDVnB1UM30lonQ/t0/G3t4uXkZqxM1TkztpDmUXP7uzVcO2SA3FVrR0hoEOkrRCAFCGDMScUJX3V6lPCEIrqexsb82quVHnji6xJ9PH8Bbtc9G2f4dW42PznbDzc5qerGlnURURMidEPT2sIw5bFTMYVMp94rxEASfyananu6RI0/t49G/f4gdMxu/jExxm/QF1fMURtEdshRKMSo5GZa1OKJlDVSSc1STx4wedi/paomKPMELSfAv9NKY5569jNGk89nIFLeFIAQFISiMC9jCMZzlHJ+cfPn5uem9G6AQBdXkReKoacxw0TDDHhWX4BQqLjY3z4zTaVapVLODIch5YchAHNa7rJ4k1//pit3LRRT9h9a2RCvJJtai7JgbN1ObqOlzqJlzMJxPjF7cZnSkT78V/1Hk/GJLgKBlKyqLfUcX33m0mJu9lLIU4giSGOJ4gjhG2Zn6uxhvk+kqfRvDWPdKc8UrfPgTz+E2R34cUvMwKhAEvOL0Rcud95+pLZw4eeB94N2VGAtRNHjW7qOajBlG+gcb3QXq3XHaZUzFdvfOmY2r5JNnjw39+2/Iz3Z9vGbCDyTORyr94ul/LEbFr+8YhWoLmvJpbDSQqggYPUsSf0TSjYmw0p6nnlnqmWUji8Frp4bzm1eS7PfHf3sJ5eMLjHQtJ/eUPH39GAzNvI2txUdIZ66mtzVwKQGshaHqz00ImsxruqWmkRleS4W1VOvQqBz2OvnJ2aW1B55cXD1BfQqG50fpRbdTn/oG0UQNayC24MIAGllQqiO+FX13pXnp3Sebk5zuaZZ7hvVU86+e5vlMcIWjwDxJmG3i3/5B9PwkageoKWAanAKXDUzCmrMovWRE5V+aH//vcaS8oe+n97/at3ObheLFAtK+h7wCevo6dA10ddsjuxASEAW6UqLNMSR6BpHv4GkaPIjJH1oYXn+onY1E3UJuXE3VPb0tvZ9Cg66A0oNz4FNQMfg20Gkj5lvI+C9Qc8vI1GCJX3d+D6mzlEHy2PhH3lF1B95T8d9ECYQAFBByCH3wLXBnnsWd2QP9Q6CXt+X2Fs6/7Xy5F4oAOyxfQ/sGRfa919NCAX75GVBLmF1AzGBCF8abDp8ARuDVnoJMvo/JSrz/OpIaKJ7CN25Batul4U1AgP8BRjZPP9WeeTQAAAAASUVORK5CYII=";function _H(t){return X.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 500 500",...t,children:[X.jsx("path",{fill:"url(#a)",d:"M0 250C0 111.929 111.929 0 250 0s250 111.929 250 250-111.929 250-250 250S0 388.071 0 250Z"}),X.jsx("path",{fill:"#fff",d:"M159.432 341h-33.008V158.949h33.008V341Zm220.263-76.172c0 11.087-1.946 21.286-5.84 30.596-3.808 9.31-9.098 17.35-15.869 24.121-6.771 6.686-14.811 11.934-24.121 15.742-9.31 3.809-19.424 5.713-30.342 5.713h-89.121c-2.369 0-4.57-.423-6.601-1.27-2.031-.846-3.809-1.988-5.332-3.427-1.439-1.524-2.582-3.301-3.428-5.332-.846-2.032-1.27-4.232-1.27-6.602V175.58c0-2.285.424-4.443 1.27-6.475.846-2.031 1.989-3.808 3.428-5.332a16.354 16.354 0 0 1 5.332-3.554c2.031-.847 4.232-1.27 6.601-1.27h89.121c10.918 0 21.032 1.905 30.342 5.713 9.31 3.809 17.35 9.098 24.121 15.869 6.771 6.686 12.061 14.727 15.869 24.121 3.894 9.31 5.84 19.466 5.84 30.469v29.707Zm-33.007-29.707c0-6.432-1.058-12.314-3.174-17.646-2.032-5.332-4.952-9.86-8.76-13.584-3.809-3.809-8.379-6.729-13.711-8.76-5.247-2.116-11.087-3.174-17.52-3.174h-72.744v116.035h72.744c6.433 0 12.273-1.015 17.52-3.047 5.332-2.116 9.902-5.035 13.711-8.759 3.808-3.809 6.728-8.337 8.76-13.584 2.116-5.332 3.174-11.257 3.174-17.774v-29.707Z"}),X.jsx("defs",{children:X.jsxs("linearGradient",{id:"a",x1:250,x2:250,y1:0,y2:500,gradientUnits:"userSpaceOnUse",children:[X.jsx("stop",{stopColor:"#497EFE"}),X.jsx("stop",{offset:1,stopColor:"#947AFA"})]})})]})}function T1(){const{gameId:t,loginTypes:a,currentLoginType:i,setCurrentLoginType:s}=As(),d=jA({loginTypes:a,gameId:t}),m=LA({loginTypes:a,gameId:t}),g=UA({loginTypes:a,gameId:t}),y=[];return g&&i!==eo.GIANT&&y.push({type:eo.GIANT,label:t==="5327"?"账号密码登录":"巨人账号",icon:t==="5327"?null:X.jsx("img",{className:"size-4",src:CH})}),m&&i!==eo.MOBILE&&y.push({type:eo.MOBILE,label:"手机号登录",icon:X.jsx(pH,{className:"size-4"})}),d&&i!==eo.ROLE_ID&&y.push({type:eo.ROLE_ID,label:"ID 登录",icon:X.jsx(_H,{className:"size-4"})}),i!=="quick"&&Fh(t).length>0&&y.push({type:"quick",label:"快捷登录",icon:X.jsx(gH,{className:"size-4"})}),y.length?X.jsx("div",{className:"text-gray-500 text-xs flex justify-center items-center gap-2 mb-4",children:y.map((S,b)=>X.jsxs(rr,{className:"h-7 px-3 border rounded-full border-gray-300 gap-1.5",onClick:()=>s(S.type),children:[S.icon,X.jsx("span",{children:S.label})]},S.type))}):null}function AH(t){return X.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 90 90",fill:"currentColor",...t,children:X.jsx("path",{d:"M41.415 1.601c6.427-2.244 13.363 2.04 14.18 8.773.611 5.508-2.959 10.609-8.365 11.833-.408.102-.918.203-1.326.305-.918.204-1.735.409-2.653.613-.306.102-.714.204-1.122.306h-.101c-.816.306-1.633.51-2.448.816-.306.102-.715.306-1.021.408l-2.754 1.223c-.408.103-.714.307-1.02.511-1.224.612-2.346 1.326-3.468 2.142l-.307.306c-.612.409-1.122.919-1.632 1.327-.51.408-1.02.816-1.53 1.326-.408.306-.714.713-1.122 1.02-.408.407-.816.918-1.326 1.428-.306.612-.409 1.224-.612 1.836-.204 1.122-.51 2.143-.714 3.265-.204 1.02-.408 2.04-.51 3.06 0 .611-.103 1.122-.103 1.734v1.632c0 1.02 0 1.938.103 2.958.102 1.02.306 2.143.51 3.163.204.816.408 1.733.612 2.55.204.816.408 1.53.612 2.346.102.306.204.51.408.714.51.612 1.122 1.122 1.632 1.734 1.02.918 2.04 1.836 3.162 2.754.816.612 1.734 1.224 2.55 1.836.51.306.919.612 1.429.918.102 0 .204 0 .204.103.204 0 .306.102.51.204.408.204.714.408 1.122.612.918.408 1.734.714 2.652 1.122.714.204 1.326.51 2.04.714 1.122.306 2.143.612 3.265.918.51.204 1.122.204 1.632 0 .306-.102.51-.102.816-.204.816-.204 1.53-.51 2.346-.714 1.53-.408 2.958-1.02 4.386-1.633h.102c.816-.408 1.735-.815 2.55-1.325.307-.204.714-.408 1.02-.612 1.02-.714 2.04-1.428 3.06-2.244.613-.51 1.123-1.02 1.735-1.53l2.142-2.143c.408-.408.714-.816.816-1.428 0-.102.103-.102.103-.204.306-1.02.611-2.142.815-3.162.306-1.326.612-2.755.714-4.183v-.204c.102-1.224.103-2.448.103-3.672-.102-.816-.102-1.53-.204-2.346 0-.102 0-.204-.102-.205-.918.408-1.735.715-2.55 1.225-1.633.918-3.061 1.938-4.489 3.06-.102.101-.204.102-.306.204-1.02.918-1.938 1.734-2.856 2.652-1.02 1.02-2.041 2.04-2.96 3.162-1.937 2.244-4.487 3.469-7.445 3.673-5.713.306-10.61-3.673-11.324-9.283-.816-5.61 2.959-10.813 8.467-11.935a52.639 52.639 0 0 0 7.856-2.142h.101c.816-.408 1.734-.715 2.55-1.122 3.264-1.53 6.121-3.672 8.773-6.12 1.327-1.327 2.652-2.653 3.876-4.082 2.347-2.55 5.305-3.774 8.773-3.57 5.1.306 9.283 4.285 9.895 9.283.204 1.53.102 3.06-.408 4.489-.612 1.938-1.224 3.876-1.734 5.916-.102 1.02-.408 1.939-.51 2.958-.408 2.449-.51 4.795-.306 7.141v.306c.102.816.204 1.53.306 2.347a46.28 46.28 0 0 0 1.224 5.406c.102 0 .102.102.102.204.51 1.632 1.224 3.264 1.224 4.794.306 3.162-.51 5.917-2.55 8.365-1.632 1.938-3.774 3.06-6.223 3.57-1.734.408-3.57.817-5.304 1.326-.102.102-.204.102-.306.102-1.836.612-3.775 1.326-5.509 2.244h-.101c-.918.408-1.735.919-2.551 1.429-.306.204-.714.51-1.02.714a30.738 30.738 0 0 0-2.856 2.244c-.816.714-1.633 1.53-2.347 2.244a.22.22 0 0 1-.204.204c-.918.918-1.734 1.836-2.55 2.754-2.346 2.55-5.202 3.877-8.67 3.775-3.06-.102-5.61-1.428-7.651-3.672-1.428-1.633-2.958-3.163-4.488-4.591v-.102c-.51-.408-1.02-.918-1.53-1.326-.715-.612-1.53-1.122-2.245-1.734l-1.53-.918c-.612-.306-1.122-.612-1.734-.918l-2.754-1.225c-1.326-.612-2.653-1.02-4.081-1.428-1.326-.407-2.652-.714-3.978-1.02a11.146 11.146 0 0 1-3.673-1.224c-3.264-1.734-5.1-4.489-5.61-8.16-.204-1.633 0-3.265.51-4.795.816-2.244 1.428-4.59 1.938-6.936.102-.102.102-.103.102-.204.102-.715.204-1.531.306-2.347.102-.714.205-1.428.205-2.142V43.63l-.087-.956a39.328 39.328 0 0 0-1.24-6.695c-.102-.102-.102-.205-.102-.306-.51-1.734-1.224-3.469-1.53-5.203-1.122-5.712 2.55-11.22 8.263-12.445.714-.204 1.53-.306 2.244-.51 1.224-.306 2.55-.612 3.775-1.02 1.224-.408 2.448-.816 3.672-1.326l1.223-.612c.918-.408 1.837-.918 2.755-1.428 1.122-.714 2.244-1.53 3.366-2.346.408-.306.715-.612 1.122-.918.408-.408.918-.918 1.428-1.326a40.49 40.49 0 0 0 2.96-2.96c1.53-1.835 3.161-3.16 5.405-3.977Z"})})}function DH(t){return X.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",fill:"currentColor",...t,children:X.jsx("path",{d:"M842.667 384H768V277.333a234.667 234.667 0 1 0-469.333 0V384H224a53.393 53.393 0 0 0-53.333 53.333V928A53.393 53.393 0 0 0 224 981.333h618.667A53.393 53.393 0 0 0 896 928V437.333A53.393 53.393 0 0 0 842.667 384zm-288 295.007v110.326a21.333 21.333 0 0 1-42.667 0V679.007a64 64 0 1 1 42.667 0zM725.333 384h-384V277.333c0-105.866 86.134-192 192-192s192 86.134 192 192z"})})}var wR,OM;function MH(){if(OM)return wR;OM=1;var t="Expected a function",a=NaN,i="[object Symbol]",s=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,m=/^0b[01]+$/i,g=/^0o[0-7]+$/i,y=parseInt,S=typeof Qb=="object"&&Qb&&Qb.Object===Object&&Qb,b=typeof self=="object"&&self&&self.Object===Object&&self,T=S||b||Function("return this")(),R=Object.prototype,x=R.toString,_=Math.max,A=Math.min,z=function(){return T.Date.now()};function N(V,I,q){var J,he,Q,fe,re,ce,ee=0,K=!1,L=!1,k=!0;if(typeof V!="function")throw new TypeError(t);I=Z(I)||0,M(q)&&(K=!!q.leading,L="maxWait"in q,Q=L?_(Z(q.maxWait)||0,I):Q,k="trailing"in q?!!q.trailing:k);function F(Te){var Me=J,Be=he;return J=he=void 0,ee=Te,fe=V.apply(Be,Me),fe}function W(Te){return ee=Te,re=setTimeout(P,I),K?F(Te):fe}function de(Te){var Me=Te-ce,Be=Te-ee,Qe=I-Me;return L?A(Qe,Q-Be):Qe}function U(Te){var Me=Te-ce,Be=Te-ee;return ce===void 0||Me>=I||Me<0||L&&Be>=Q}function P(){var Te=z();if(U(Te))return te(Te);re=setTimeout(P,de(Te))}function te(Te){return re=void 0,k&&J?F(Te):(J=he=void 0,fe)}function ae(){re!==void 0&&clearTimeout(re),ee=0,J=ce=he=re=void 0}function Se(){return re===void 0?fe:te(z())}function Re(){var Te=z(),Me=U(Te);if(J=arguments,he=this,ce=Te,Me){if(re===void 0)return W(ce);if(L)return re=setTimeout(P,I),F(ce)}return re===void 0&&(re=setTimeout(P,I)),fe}return Re.cancel=ae,Re.flush=Se,Re}function M(V){var I=typeof V;return!!V&&(I=="object"||I=="function")}function $(V){return!!V&&typeof V=="object"}function Y(V){return typeof V=="symbol"||$(V)&&x.call(V)==i}function Z(V){if(typeof V=="number")return V;if(Y(V))return a;if(M(V)){var I=typeof V.valueOf=="function"?V.valueOf():V;V=M(I)?I+"":I}if(typeof V!="string")return V===0?V:+V;V=V.replace(s,"");var q=m.test(V);return q||g.test(V)?y(V.slice(2),q?2:8):d.test(V)?a:+V}return wR=N,wR}MH();function zH(t=!1){if(typeof t!="boolean")throw new Error("defaultValue must be `true` or `false`");const[a,i]=C.useState(t),s=C.useCallback(()=>{i(!0)},[]),d=C.useCallback(()=>{i(!1)},[]),m=C.useCallback(()=>{i(g=>!g)},[]);return{value:a,setValue:i,setTrue:s,setFalse:d,toggle:m}}var CM=typeof window<"u"?C.useLayoutEffect:C.useEffect;function NH(t){const[a,i]=C.useState(t),s=C.useCallback(()=>{i(g=>g+1)},[]),d=C.useCallback(()=>{i(g=>g-1)},[]),m=C.useCallback(()=>{i(t)},[t]);return{count:a,increment:s,decrement:d,reset:m,setCount:i}}function UH(t,a){const i=C.useRef(t);CM(()=>{i.current=t},[t]),C.useEffect(()=>{if(a===null)return;const s=setInterval(()=>{i.current()},a);return()=>{clearInterval(s)}},[a])}function jH({countStart:t,countStop:a=0,intervalMs:i=1e3,isIncrement:s=!1}){const{count:d,increment:m,decrement:g,reset:y}=NH(t),{value:S,setTrue:b,setFalse:T}=zH(!1),R=C.useCallback(()=>{T(),y()},[T,y]),x=C.useCallback(()=>{if(d===a){T();return}s?m():g()},[d,a,g,m,s,T]);return UH(x,S?i:null),[d,{startCountdown:b,stopCountdown:T,resetCountdown:R}]}var LH=typeof window>"u";function HH(t,{defaultValue:a=!1,initializeWithValue:i=!0}={}){const s=y=>LH?a:window.matchMedia(y).matches,[d,m]=C.useState(()=>i?s(t):a);function g(){m(s(t))}return CM(()=>{const y=window.matchMedia(t);return g(),y.addListener?y.addListener(g):y.addEventListener("change",g),()=>{y.removeListener?y.removeListener(g):y.removeEventListener("change",g)}},[t]),d}function _M({trigger:t,title:a,description:i,children:s,open:d,showCloseIcon:m=!0,onOpenChange:g,zIndex:y,classNames:S}){return HH("(min-width: 1024px)")?X.jsxs(k2,{open:d,onOpenChange:g,disablePointerDismissal:!0,children:[t&&X.jsx(s1,{className:S?.trigger,children:t}),X.jsxs(i1,{children:[X.jsx(B2,{style:{zIndex:y},className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm"}),X.jsxs(I2,{style:{zIndex:y},className:kd("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[991]",S?.desktopPopup),children:[a&&X.jsx(u1,{className:kd("-mt-1.5 mb-1 text-lg font-medium",S?.title),children:a}),i&&X.jsx(G2,{className:kd("mb-6 text-base text-gray-600",S?.description),children:i}),m&&X.jsx(Y2,{className:"absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",children:X.jsx(TM,{})}),X.jsx("div",{children:s})]})]})]}):X.jsxs(mL,{open:d,onOpenChange:g,children:[t&&X.jsx(_L,{className:S?.trigger,children:t}),X.jsxs(hL,{children:[X.jsx(hD,{style:{zIndex:y},className:kd("fixed inset-0 bg-black/70 transition-opacity duration-300 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",S?.backdrop)}),X.jsx(ND,{style:{zIndex:y},className:"fixed inset-0 z-[991]",children:X.jsx(wD,{className:kd("fixed bottom-0 left-0 right-0 rounded-t-xl bg-white p-4 transition-transform duration-300 data-[starting-style]:translate-y-full data-[ending-style]:translate-y-full","[transform:translateY(var(--drawer-swipe-movement-y))]",S?.mobilePopup),children:X.jsxs(gD,{children:[X.jsx("div",{"aria-hidden":!0,className:"mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-gray-300 mb-4"}),X.jsx(CL,{className:"sr-only",children:a}),X.jsx("div",{children:s})]})})})]})]})}function AM({checked:t,onChange:a}){const[i,s]=C.useState(!1),[d,m]=C.useState(!1);return X.jsxs("div",{children:[X.jsx(_M,{title:"用户协议",open:i,onOpenChange:s,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:X.jsx("iframe",{src:"https://www.gatribe.com/license-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),X.jsx(_M,{title:"隐私政策",open:d,onOpenChange:m,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:X.jsx("iframe",{src:"https://www.gatribe.com/privacy-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),X.jsx(em,{name:"rememberLogin",children:X.jsxs(cR,{className:"flex items-center justify-center text-gray-500 text-xs md:text-sm",children:[X.jsx(W2,{checked:t,className:"size-4 md:size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-[var(--jssdk-input-border-color)]",onCheckedChange:g=>a(!!g),children:X.jsx(eR,{children:X.jsx(ER,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),X.jsx("span",{className:"ml-2",children:"我已详细阅读并同意"}),X.jsx(rr,{className:"text-[var(--jssdk-primary-color)]",onClick:()=>s(!0),type:"button",children:"《用户协议》"}),X.jsx("span",{children:"及"}),X.jsx(rr,{className:"text-[var(--jssdk-primary-color)]",onClick:()=>m(!0),type:"button",children:"《隐私政策》"})]})})]})}function tv({trigger:t,title:a,description:i,children:s,open:d,showCloseIcon:m=!0,onOpenChange:g,disablePointerDismissal:y=!1,classNames:S}){return X.jsxs(k2,{open:d,onOpenChange:g,disablePointerDismissal:y,children:[t&&X.jsx(s1,{className:S?.trigger,children:t}),X.jsxs(i1,{children:[X.jsx(B2,{className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",forceRender:!0}),X.jsxs(I2,{className:ha("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[990]",S?.popup),children:[a&&X.jsx(u1,{className:ha("-mt-1.5 mb-1 text-lg font-medium",S?.title),children:a}),i&&X.jsx(G2,{className:ha("mb-6 text-base text-gray-600",S?.description),children:i}),m&&X.jsx(Y2,{className:ha("absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",S?.close),children:X.jsx(TM,{})}),X.jsx("div",{children:s})]})]})]})}function Hu({name:t,prefix:a,suffix:i,className:s,inputClassName:d,error:m,...g}){return X.jsxs(em,{name:t,className:"group",children:[X.jsxs("div",{className:ha("flex items-center border border-[var(--jssdk-input-border-color)] group-data-[focused]:border-[var(--jssdk-primary-color)] group-data-[focused]:shadow-[0_0_6px_color-mix(in_srgb,var(--jssdk-primary-color),transparent_80%)] rounded-full bg-white px-3 gap-2 h-12 transition-all duration-200",m&&"border-red-500",s),children:[a,X.jsx(y1,{className:ha("flex-1 w-0 outline-none rounded-full h-full pl-1",d),...g}),i]}),X.jsx(g1,{className:"text-red-500 text-xs mt-1 ml-3"})]})}function VH({account:t,forgetPasswordKey:a,onSuccess:i}){const[s,d]=C.useState(""),[m,g]=C.useState(!1),{mutate:y,isPending:S}=Zi({mutationFn:()=>OH({account:t,forget_password_key:a,password:s}),onSuccess:T=>{T?.code===0||!T?.error?i():Uo.warning(T.detail||T.error||"重置失败")}}),b=()=>{if(!s){Uo.warning("请输入新密码");return}if(s.length<6||s.length>18){Uo.warning("密码长度需要在6-18位之间");return}y()};return X.jsxs("div",{className:"space-y-4",children:[X.jsx("div",{className:"text-sm text-gray-500 mb-4 text-center",children:"请设置新的登录密码"}),X.jsx(Hu,{name:"password",type:m?"text":"password",autoComplete:"off",inputClassName:"placeholder:text-sm",placeholder:"请输入6-18位由数字、字母组成的密码",value:s,autoFocus:!0,onValueChange:T=>d(T),suffix:X.jsx(rr,{onClick:()=>g(!m),type:"button",children:m?X.jsx(wM,{className:"size-5 text-gray-400"}):X.jsx(EM,{className:"size-5 text-gray-400"})})}),X.jsx(rr,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:b,disabled:!s||S,children:S?"重置中...":"确定修改"})]})}var kH=function(t){return typeof t=="number"};function BH(t){var a=C.useRef(t);return a.current=t,a}var R1={exports:{}},YH=R1.exports,DM;function GH(){return DM||(DM=1,(function(t,a){(function(i,s){t.exports=s()})(YH,(function(){var i=1e3,s=6e4,d=36e5,m="millisecond",g="second",y="minute",S="hour",b="day",T="week",R="month",x="quarter",_="year",A="date",z="Invalid Date",N=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,M=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,$={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(ee){var K=["th","st","nd","rd"],L=ee%100;return"["+ee+(K[(L-20)%10]||K[L]||K[0])+"]"}},Y=function(ee,K,L){var k=String(ee);return!k||k.length>=K?ee:""+Array(K+1-k.length).join(L)+ee},Z={s:Y,z:function(ee){var K=-ee.utcOffset(),L=Math.abs(K),k=Math.floor(L/60),F=L%60;return(K<=0?"+":"-")+Y(k,2,"0")+":"+Y(F,2,"0")},m:function ee(K,L){if(K.date()<L.date())return-ee(L,K);var k=12*(L.year()-K.year())+(L.month()-K.month()),F=K.clone().add(k,R),W=L-F<0,de=K.clone().add(k+(W?-1:1),R);return+(-(k+(L-F)/(W?F-de:de-F))||0)},a:function(ee){return ee<0?Math.ceil(ee)||0:Math.floor(ee)},p:function(ee){return{M:R,y:_,w:T,d:b,D:A,h:S,m:y,s:g,ms:m,Q:x}[ee]||String(ee||"").toLowerCase().replace(/s$/,"")},u:function(ee){return ee===void 0}},V="en",I={};I[V]=$;var q="$isDayjsObject",J=function(ee){return ee instanceof re||!(!ee||!ee[q])},he=function ee(K,L,k){var F;if(!K)return V;if(typeof K=="string"){var W=K.toLowerCase();I[W]&&(F=W),L&&(I[W]=L,F=W);var de=K.split("-");if(!F&&de.length>1)return ee(de[0])}else{var U=K.name;I[U]=K,F=U}return!k&&F&&(V=F),F||!k&&V},Q=function(ee,K){if(J(ee))return ee.clone();var L=typeof K=="object"?K:{};return L.date=ee,L.args=arguments,new re(L)},fe=Z;fe.l=he,fe.i=J,fe.w=function(ee,K){return Q(ee,{locale:K.$L,utc:K.$u,x:K.$x,$offset:K.$offset})};var re=(function(){function ee(L){this.$L=he(L.locale,null,!0),this.parse(L),this.$x=this.$x||L.x||{},this[q]=!0}var K=ee.prototype;return K.parse=function(L){this.$d=(function(k){var F=k.date,W=k.utc;if(F===null)return new Date(NaN);if(fe.u(F))return new Date;if(F instanceof Date)return new Date(F);if(typeof F=="string"&&!/Z$/i.test(F)){var de=F.match(N);if(de){var U=de[2]-1||0,P=(de[7]||"0").substring(0,3);return W?new Date(Date.UTC(de[1],U,de[3]||1,de[4]||0,de[5]||0,de[6]||0,P)):new Date(de[1],U,de[3]||1,de[4]||0,de[5]||0,de[6]||0,P)}}return new Date(F)})(L),this.init()},K.init=function(){var L=this.$d;this.$y=L.getFullYear(),this.$M=L.getMonth(),this.$D=L.getDate(),this.$W=L.getDay(),this.$H=L.getHours(),this.$m=L.getMinutes(),this.$s=L.getSeconds(),this.$ms=L.getMilliseconds()},K.$utils=function(){return fe},K.isValid=function(){return this.$d.toString()!==z},K.isSame=function(L,k){var F=Q(L);return this.startOf(k)<=F&&F<=this.endOf(k)},K.isAfter=function(L,k){return Q(L)<this.startOf(k)},K.isBefore=function(L,k){return this.endOf(k)<Q(L)},K.$g=function(L,k,F){return fe.u(L)?this[k]:this.set(F,L)},K.unix=function(){return Math.floor(this.valueOf()/1e3)},K.valueOf=function(){return this.$d.getTime()},K.startOf=function(L,k){var F=this,W=!!fe.u(k)||k,de=fe.p(L),U=function(Be,Qe){var Ae=fe.w(F.$u?Date.UTC(F.$y,Qe,Be):new Date(F.$y,Qe,Be),F);return W?Ae:Ae.endOf(b)},P=function(Be,Qe){return fe.w(F.toDate()[Be].apply(F.toDate("s"),(W?[0,0,0,0]:[23,59,59,999]).slice(Qe)),F)},te=this.$W,ae=this.$M,Se=this.$D,Re="set"+(this.$u?"UTC":"");switch(de){case _:return W?U(1,0):U(31,11);case R:return W?U(1,ae):U(0,ae+1);case T:var Te=this.$locale().weekStart||0,Me=(te<Te?te+7:te)-Te;return U(W?Se-Me:Se+(6-Me),ae);case b:case A:return P(Re+"Hours",0);case S:return P(Re+"Minutes",1);case y:return P(Re+"Seconds",2);case g:return P(Re+"Milliseconds",3);default:return this.clone()}},K.endOf=function(L){return this.startOf(L,!1)},K.$set=function(L,k){var F,W=fe.p(L),de="set"+(this.$u?"UTC":""),U=(F={},F[b]=de+"Date",F[A]=de+"Date",F[R]=de+"Month",F[_]=de+"FullYear",F[S]=de+"Hours",F[y]=de+"Minutes",F[g]=de+"Seconds",F[m]=de+"Milliseconds",F)[W],P=W===b?this.$D+(k-this.$W):k;if(W===R||W===_){var te=this.clone().set(A,1);te.$d[U](P),te.init(),this.$d=te.set(A,Math.min(this.$D,te.daysInMonth())).$d}else U&&this.$d[U](P);return this.init(),this},K.set=function(L,k){return this.clone().$set(L,k)},K.get=function(L){return this[fe.p(L)]()},K.add=function(L,k){var F,W=this;L=Number(L);var de=fe.p(k),U=function(ae){var Se=Q(W);return fe.w(Se.date(Se.date()+Math.round(ae*L)),W)};if(de===R)return this.set(R,this.$M+L);if(de===_)return this.set(_,this.$y+L);if(de===b)return U(1);if(de===T)return U(7);var P=(F={},F[y]=s,F[S]=d,F[g]=i,F)[de]||1,te=this.$d.getTime()+L*P;return fe.w(te,this)},K.subtract=function(L,k){return this.add(-1*L,k)},K.format=function(L){var k=this,F=this.$locale();if(!this.isValid())return F.invalidDate||z;var W=L||"YYYY-MM-DDTHH:mm:ssZ",de=fe.z(this),U=this.$H,P=this.$m,te=this.$M,ae=F.weekdays,Se=F.months,Re=F.meridiem,Te=function(Qe,Ae,Le,rt){return Qe&&(Qe[Ae]||Qe(k,W))||Le[Ae].slice(0,rt)},Me=function(Qe){return fe.s(U%12||12,Qe,"0")},Be=Re||function(Qe,Ae,Le){var rt=Qe<12?"AM":"PM";return Le?rt.toLowerCase():rt};return W.replace(M,(function(Qe,Ae){return Ae||(function(Le){switch(Le){case"YY":return String(k.$y).slice(-2);case"YYYY":return fe.s(k.$y,4,"0");case"M":return te+1;case"MM":return fe.s(te+1,2,"0");case"MMM":return Te(F.monthsShort,te,Se,3);case"MMMM":return Te(Se,te);case"D":return k.$D;case"DD":return fe.s(k.$D,2,"0");case"d":return String(k.$W);case"dd":return Te(F.weekdaysMin,k.$W,ae,2);case"ddd":return Te(F.weekdaysShort,k.$W,ae,3);case"dddd":return ae[k.$W];case"H":return String(U);case"HH":return fe.s(U,2,"0");case"h":return Me(1);case"hh":return Me(2);case"a":return Be(U,P,!0);case"A":return Be(U,P,!1);case"m":return String(P);case"mm":return fe.s(P,2,"0");case"s":return String(k.$s);case"ss":return fe.s(k.$s,2,"0");case"SSS":return fe.s(k.$ms,3,"0");case"Z":return de}return null})(Qe)||de.replace(":","")}))},K.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},K.diff=function(L,k,F){var W,de=this,U=fe.p(k),P=Q(L),te=(P.utcOffset()-this.utcOffset())*s,ae=this-P,Se=function(){return fe.m(de,P)};switch(U){case _:W=Se()/12;break;case R:W=Se();break;case x:W=Se()/3;break;case T:W=(ae-te)/6048e5;break;case b:W=(ae-te)/864e5;break;case S:W=ae/d;break;case y:W=ae/s;break;case g:W=ae/i;break;default:W=ae}return F?W:fe.a(W)},K.daysInMonth=function(){return this.endOf(R).$D},K.$locale=function(){return I[this.$L]},K.locale=function(L,k){if(!L)return this.$L;var F=this.clone(),W=he(L,k,!0);return W&&(F.$L=W),F},K.clone=function(){return fe.w(this.$d,this)},K.toDate=function(){return new Date(this.valueOf())},K.toJSON=function(){return this.isValid()?this.toISOString():null},K.toISOString=function(){return this.$d.toISOString()},K.toString=function(){return this.$d.toUTCString()},ee})(),ce=re.prototype;return Q.prototype=ce,[["$ms",m],["$s",g],["$m",y],["$H",S],["$W",b],["$M",R],["$y",_],["$D",A]].forEach((function(ee){ce[ee[1]]=function(K){return this.$g(K,ee[0],ee[1])}})),Q.extend=function(ee,K){return ee.$i||(ee(K,re,Q),ee.$i=!0),Q},Q.locale=he,Q.isDayjs=J,Q.unix=function(ee){return Q(1e3*ee)},Q.en=I[V],Q.Ls=I,Q.p={},Q}))})(R1)),R1.exports}var qH=GH();const ZH=lT(qH);var TR=function(t){if(!t)return 0;var a=ZH(t).valueOf()-Date.now();return a<0?0:a},IH=function(t){return{days:Math.floor(t/864e5),hours:Math.floor(t/36e5)%24,minutes:Math.floor(t/6e4)%60,seconds:Math.floor(t/1e3)%60,milliseconds:Math.floor(t)%1e3}},MM=function(t){t===void 0&&(t={});var a=t||{},i=a.leftTime,s=a.targetDate,d=a.interval,m=d===void 0?1e3:d,g=a.onEnd,y=C.useMemo(function(){return kH(i)&&i>0?Date.now()+i:void 0},[i]),S="leftTime"in t?y:s,b=_N(C.useState(function(){return TR(S)}),2),T=b[0],R=b[1],x=BH(g);C.useEffect(function(){if(!S){R(0);return}R(TR(S));var A=setInterval(function(){var z,N=TR(S);R(N),N===0&&(clearInterval(A),(z=x.current)===null||z===void 0||z.call(x))},m);return function(){return clearInterval(A)}},[S,m]);var _=C.useMemo(function(){return IH(T)},[T]);return[T,_]};function $H({account:t,mobile:a,onNext:i}){const[s,d]=C.useState(""),[m,g]=C.useState(),[y]=MM({leftTime:m?m*1e3:void 0,interval:1e3,onEnd(){g(void 0)}}),{mutate:S,isPending:b}=Zi({mutationFn:()=>xH({account:t,type:"reset-password",is_voice:0,t:"ctoken"}),onSuccess:_=>{g(_.lock_time),Uo.success("验证码已发送,请注意查收")}}),{mutate:T,isPending:R}=Zi({mutationFn:()=>xM({account:t,captcha:s,t:"reset-password"}),onSuccess:_=>{_?.forget_password_key?i(_.forget_password_key):Uo.warning("安全验证失败")},onError:_=>{Uo.warning(_?.message||_?.detail||"验证失败")}}),x=()=>{if(!s){Uo.warning("请输入验证码");return}T()};return X.jsxs("div",{className:"space-y-4",children:[X.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",X.jsx("br",{}),"请输入验证码,短信将发送至您的绑定手机"," ",X.jsx("span",{className:"font-semibold text-gray-700",children:a})]}),X.jsx(Hu,{name:"verificationCode",placeholder:"请输入验证码",value:s,type:"number",autoFocus:!0,onValueChange:_=>d(_),suffix:X.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>S(),disabled:!!m||b,children:b?"发送中...":m?`${Math.round(y/1e3)}s 后重新获取`:"获取验证码"})}),X.jsx(rr,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:x,disabled:R,children:R?"验证中...":"下一步"})]})}function XH({account:t,onNext:a}){const[i,s]=C.useState(""),{mutate:d,isPending:m}=Zi({mutationFn:()=>xM({account:t,idcard:i,t:"reset-password"}),onSuccess:y=>{y?.forget_password_key?a(y.forget_password_key):Uo.warning("安全验证失败")}}),g=()=>{if(!i){Uo.warning("请输入身份证号");return}d()};return X.jsxs("div",{className:"space-y-4",children:[X.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",X.jsx("br",{}),"该账号未绑定手机,请输入注册时填写的身份证信息"]}),X.jsx(Hu,{name:"idCard",placeholder:"请输入身份证号",value:i,autoFocus:!0,onChange:y=>s(y.currentTarget.value)}),X.jsx(rr,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:g,disabled:m,children:m?"验证中...":"下一步"})]})}function PH({onClose:t,defaultAccount:a=""}){const[i,s]=C.useState("account"),[d,m]=C.useState(a),[g,y]=C.useState(""),[S,b]=C.useState(2),[T,R]=C.useState(""),x=C.useRef(null);C.useEffect(()=>{if(!window.captchaZtgame){const M=document.createElement("script");M.type="text/javascript",M.src=`//nocaptcha.ztgame.com/static/verify2023/js/captcha.js?t=${new Date().getTime()}`,M.id="captchaZtgameScript",document.body.appendChild(M)}},[]);const{mutate:_,isPending:A}=Zi({mutationFn:async M=>RH({account:d,nonce:M.nonce,token:M.token,type:M.type,t:"ctoken"}),onSuccess:M=>{const $=M.type;b($),y($===2?M.mobile:""),s("secure"),x.current?.onRefresh?.()},onError:M=>{Uo.warning(M?.message||M?.detail||"验证失败"),x.current?.onRefresh?.()}}),z=()=>{if(!d){Uo.warning("请输入账号信息");return}window.captchaZtgame?window.captchaZtgame.init({appsceneid:"pt_login",usertype:"1",el:"captcha-forget-pwd",mode:"popup",styles:{width:300,height:150,fontSize:"14px"},popupStyles:{position:"fixed",top:"30%",left:"50%",zIndex:"99999"},onSuccess(M,$){x.current=M,_({nonce:M.nonce,token:$.data.token,type:M.type})},onLoad(M){x.current=M,M.onVerify()},onFail(){}}):Uo.warning("安全组件未加载,请稍后再试")},N=M=>{R(M),s("reset")};return X.jsxs("div",{className:"space-y-5",children:[X.jsx("div",{id:"captcha-forget-pwd"}),i==="account"&&X.jsxs("div",{className:"space-y-4",children:[X.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",X.jsx("br",{}),"请输入您的账号信息"]}),X.jsx(Hu,{name:"account",placeholder:"请输入账号信息",autoFocus:!0,value:d,onChange:M=>m(M.currentTarget.value)}),X.jsx(rr,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:z,disabled:!d||A,children:A?"验证中...":"下一步"})]}),i==="secure"&&(S===2?X.jsx($H,{account:d,mobile:g,onNext:N}):X.jsx(XH,{account:d,onNext:N})),i==="reset"&&X.jsx(VH,{account:d,forgetPasswordKey:T,onSuccess:()=>s("success")}),i==="success"&&X.jsxs("div",{className:"space-y-4 py-6",children:[X.jsx("div",{className:"text-center text-lg font-medium text-gray-800",children:"重置密码成功"}),X.jsx(rr,{className:"mt-6 h-10 w-full bg-gray-100 text-gray-700 rounded-full hover:bg-gray-200",onClick:()=>t?.(),children:"返回登录"})]})]})}function FH(){const{gameId:t,onAccountLoginSuccess:a,onLoginSuccess:i,onLoginError:s,triggerRealNameAuth:d}=As(),m=C.useRef(null),[g,y]=C.useState(""),[S,b]=C.useState(""),[T,R]=C.useState(!1),[x,_]=C.useState(!0),[A,z]=C.useState(!1),{mutate:N,isPending:M}=Zi({mutationFn:()=>bH({account:g,password:S}),onSuccess:Y=>{const Z={account:Y.account,entity:Y.channel_info.entity,token:Y.channel_info.token,sign:Y.channel_info.sign,accid:Y.channel_info.entity.openid,extra_data:Y.channel_info.extra_data,gaplaySign:Y.channel_info.gaplaySign,realname:Y.channel_info.realname};if(n1(Z,Y._auth,t),Z.realname&&Z.realname.reject>=2){d();return}a?.(Z),i?.(Z)},onError:Y=>{s?.(Y)}});async function $(Y){if(Y.preventDefault(),!x){Uo.warning("请先阅读并同意用户协议和隐私政策");return}if(!g||!S){Uo.warning("请输入账号和密码");return}N()}return X.jsx(X.Fragment,{children:X.jsxs(Wy,{ref:m,onSubmit:$,className:"space-y-5",children:[X.jsx(Hu,{name:"account",placeholder:t==="5327"?"请输入账号":"请输入巨人通行证账号",autoFocus:!0,onChange:Y=>y(Y.currentTarget.value),prefix:t==="5327"?X.jsx(mH,{className:"size-5 text-gray-400"}):X.jsx(AH,{className:"size-5 text-gray-400"})}),X.jsx(Hu,{name:"password",type:T?"text":"password",autoComplete:"off",placeholder:"请输入密码",value:S,onValueChange:Y=>b(Y),prefix:X.jsx(DH,{className:"size-5 text-gray-400"}),suffix:X.jsx(rr,{onClick:()=>R(!T),type:"button",children:T?X.jsx(wM,{className:"size-5 text-gray-400"}):X.jsx(EM,{className:"size-5 text-gray-400"})})}),X.jsxs("section",{children:[X.jsx("div",{className:"flex justify-end mb-1",children:X.jsx(tv,{title:"忘记密码",open:A,onOpenChange:z,trigger:X.jsx("button",{type:"button",className:"text-[var(--jssdk-primary-color)] text-sm",children:"忘记密码"}),children:X.jsx(PH,{onClose:()=>z(!1),defaultAccount:g})})}),X.jsx(rr,{className:"h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",type:"submit",disabled:M,children:"登录"})]}),X.jsx(T1,{}),X.jsx(AM,{checked:x,onChange:_})]})})}var zM;function Ke(t,a,i){function s(y,S){if(y._zod||Object.defineProperty(y,"_zod",{value:{def:S,constr:g,traits:new Set},enumerable:!1}),y._zod.traits.has(t))return;y._zod.traits.add(t),a(y,S);const b=g.prototype,T=Object.keys(b);for(let R=0;R<T.length;R++){const x=T[R];x in y||(y[x]=b[x].bind(y))}}const d=i?.Parent??Object;class m extends d{}Object.defineProperty(m,"name",{value:t});function g(y){var S;const b=i?.Parent?new m:this;s(b,y),(S=b._zod).deferred??(S.deferred=[]);for(const T of b._zod.deferred)T();return b}return Object.defineProperty(g,"init",{value:s}),Object.defineProperty(g,Symbol.hasInstance,{value:y=>i?.Parent&&y instanceof i.Parent?!0:y?._zod?.traits?.has(t)}),Object.defineProperty(g,"name",{value:t}),g}class nm extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class NM extends Error{constructor(a){super(`Encountered unidirectional transform during encode: ${a}`),this.name="ZodEncodeError"}}(zM=globalThis).__zod_globalConfig??(zM.__zod_globalConfig={});const RR=globalThis.__zod_globalConfig;function Zd(t){return RR}function UM(t){const a=Object.values(t).filter(s=>typeof s=="number");return Object.entries(t).filter(([s,d])=>a.indexOf(+s)===-1).map(([s,d])=>d)}function xR(t,a){return typeof a=="bigint"?a.toString():a}function OR(t){return{get value(){{const a=t();return Object.defineProperty(this,"value",{value:a}),a}}}}function CR(t){return t==null}function _R(t){const a=t.startsWith("^")?1:0,i=t.endsWith("$")?t.length-1:t.length;return t.slice(a,i)}const jM=Symbol("evaluating");function Xn(t,a,i){let s;Object.defineProperty(t,a,{get(){if(s!==jM)return s===void 0&&(s=jM,s=i()),s},set(d){Object.defineProperty(t,a,{value:d})},configurable:!0})}function Id(t,a,i){Object.defineProperty(t,a,{value:i,writable:!0,enumerable:!0,configurable:!0})}function Qc(...t){const a={};for(const i of t){const s=Object.getOwnPropertyDescriptors(i);Object.assign(a,s)}return Object.defineProperties({},a)}function LM(t){return JSON.stringify(t)}function QH(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const HM="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function x1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const JH=OR(()=>{if(RR.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function nv(t){if(x1(t)===!1)return!1;const a=t.constructor;if(a===void 0||typeof a!="function")return!0;const i=a.prototype;return!(x1(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function VM(t){return nv(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const KH=new Set(["string","number","symbol"]);function O1(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jc(t,a,i){const s=new t._zod.constr(a??t._zod.def);return(!a||i?.parent)&&(s._zod.parent=t),s}function Jt(t){const a=t;if(!a)return{};if(typeof a=="string")return{error:()=>a};if(a?.message!==void 0){if(a?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");a.error=a.message}return delete a.message,typeof a.error=="string"?{...a,error:()=>a.error}:a}function WH(t){return Object.keys(t).filter(a=>t[a]._zod.optin==="optional"&&t[a]._zod.optout==="optional")}function eV(t,a){const i=t._zod.def,s=i.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const m=Qc(t._zod.def,{get shape(){const g={};for(const y in a){if(!(y in i.shape))throw new Error(`Unrecognized key: "${y}"`);a[y]&&(g[y]=i.shape[y])}return Id(this,"shape",g),g},checks:[]});return Jc(t,m)}function tV(t,a){const i=t._zod.def,s=i.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const m=Qc(t._zod.def,{get shape(){const g={...t._zod.def.shape};for(const y in a){if(!(y in i.shape))throw new Error(`Unrecognized key: "${y}"`);a[y]&&delete g[y]}return Id(this,"shape",g),g},checks:[]});return Jc(t,m)}function nV(t,a){if(!nv(a))throw new Error("Invalid input to extend: expected a plain object");const i=t._zod.def.checks;if(i&&i.length>0){const m=t._zod.def.shape;for(const g in a)if(Object.getOwnPropertyDescriptor(m,g)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const d=Qc(t._zod.def,{get shape(){const m={...t._zod.def.shape,...a};return Id(this,"shape",m),m}});return Jc(t,d)}function oV(t,a){if(!nv(a))throw new Error("Invalid input to safeExtend: expected a plain object");const i=Qc(t._zod.def,{get shape(){const s={...t._zod.def.shape,...a};return Id(this,"shape",s),s}});return Jc(t,i)}function aV(t,a){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const i=Qc(t._zod.def,{get shape(){const s={...t._zod.def.shape,...a._zod.def.shape};return Id(this,"shape",s),s},get catchall(){return a._zod.def.catchall},checks:a._zod.def.checks??[]});return Jc(t,i)}function rV(t,a,i){const d=a._zod.def.checks;if(d&&d.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const g=Qc(a._zod.def,{get shape(){const y=a._zod.def.shape,S={...y};if(i)for(const b in i){if(!(b in y))throw new Error(`Unrecognized key: "${b}"`);i[b]&&(S[b]=t?new t({type:"optional",innerType:y[b]}):y[b])}else for(const b in y)S[b]=t?new t({type:"optional",innerType:y[b]}):y[b];return Id(this,"shape",S),S},checks:[]});return Jc(a,g)}function lV(t,a,i){const s=Qc(a._zod.def,{get shape(){const d=a._zod.def.shape,m={...d};if(i)for(const g in i){if(!(g in m))throw new Error(`Unrecognized key: "${g}"`);i[g]&&(m[g]=new t({type:"nonoptional",innerType:d[g]}))}else for(const g in d)m[g]=new t({type:"nonoptional",innerType:d[g]});return Id(this,"shape",m),m}});return Jc(a,s)}function om(t,a=0){if(t.aborted===!0)return!0;for(let i=a;i<t.issues.length;i++)if(t.issues[i]?.continue!==!0)return!0;return!1}function iV(t,a=0){if(t.aborted===!0)return!0;for(let i=a;i<t.issues.length;i++)if(t.issues[i]?.continue===!1)return!0;return!1}function kM(t,a){return a.map(i=>{var s;return(s=i).path??(s.path=[]),i.path.unshift(t),i})}function C1(t){return typeof t=="string"?t:t?.message}function $d(t,a,i){const s=t.message?t.message:C1(t.inst?._zod.def?.error?.(t))??C1(a?.error?.(t))??C1(i.customError?.(t))??C1(i.localeError?.(t))??"Invalid input",{inst:d,continue:m,input:g,...y}=t;return y.path??(y.path=[]),y.message=s,a?.reportInput&&(y.input=g),y}function AR(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function ov(...t){const[a,i,s]=t;return typeof a=="string"?{message:a,code:"custom",input:i,inst:s}:{...a}}const BM=(t,a)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:a,enumerable:!1}),t.message=JSON.stringify(a,xR,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},YM=Ke("$ZodError",BM),GM=Ke("$ZodError",BM,{Parent:Error});function _1(t,a=i=>i.message){const i={},s=[];for(const d of t.issues)d.path.length>0?(i[d.path[0]]=i[d.path[0]]||[],i[d.path[0]].push(a(d))):s.push(a(d));return{formErrors:s,fieldErrors:i}}function uV(t,a=i=>i.message){const i={_errors:[]},s=(d,m=[])=>{for(const g of d.issues)if(g.code==="invalid_union"&&g.errors.length)g.errors.map(y=>s({issues:y},[...m,...g.path]));else if(g.code==="invalid_key")s({issues:g.issues},[...m,...g.path]);else if(g.code==="invalid_element")s({issues:g.issues},[...m,...g.path]);else{const y=[...m,...g.path];if(y.length===0)i._errors.push(a(g));else{let S=i,b=0;for(;b<y.length;){const T=y[b];b===y.length-1?(S[T]=S[T]||{_errors:[]},S[T]._errors.push(a(g))):S[T]=S[T]||{_errors:[]},S=S[T],b++}}}};return s(t),i}const DR=t=>(a,i,s,d)=>{const m=s?{...s,async:!1}:{async:!1},g=a._zod.run({value:i,issues:[]},m);if(g instanceof Promise)throw new nm;if(g.issues.length){const y=new(d?.Err??t)(g.issues.map(S=>$d(S,m,Zd())));throw HM(y,d?.callee),y}return g.value},MR=t=>async(a,i,s,d)=>{const m=s?{...s,async:!0}:{async:!0};let g=a._zod.run({value:i,issues:[]},m);if(g instanceof Promise&&(g=await g),g.issues.length){const y=new(d?.Err??t)(g.issues.map(S=>$d(S,m,Zd())));throw HM(y,d?.callee),y}return g.value},A1=t=>(a,i,s)=>{const d=s?{...s,async:!1}:{async:!1},m=a._zod.run({value:i,issues:[]},d);if(m instanceof Promise)throw new nm;return m.issues.length?{success:!1,error:new(t??YM)(m.issues.map(g=>$d(g,d,Zd())))}:{success:!0,data:m.value}},sV=A1(GM),D1=t=>async(a,i,s)=>{const d=s?{...s,async:!0}:{async:!0};let m=a._zod.run({value:i,issues:[]},d);return m instanceof Promise&&(m=await m),m.issues.length?{success:!1,error:new t(m.issues.map(g=>$d(g,d,Zd())))}:{success:!0,data:m.value}},cV=D1(GM),fV=t=>(a,i,s)=>{const d=s?{...s,direction:"backward"}:{direction:"backward"};return DR(t)(a,i,d)},dV=t=>(a,i,s)=>DR(t)(a,i,s),pV=t=>async(a,i,s)=>{const d=s?{...s,direction:"backward"}:{direction:"backward"};return MR(t)(a,i,d)},hV=t=>async(a,i,s)=>MR(t)(a,i,s),mV=t=>(a,i,s)=>{const d=s?{...s,direction:"backward"}:{direction:"backward"};return A1(t)(a,i,d)},gV=t=>(a,i,s)=>A1(t)(a,i,s),yV=t=>async(a,i,s)=>{const d=s?{...s,direction:"backward"}:{direction:"backward"};return D1(t)(a,i,d)},vV=t=>async(a,i,s)=>D1(t)(a,i,s),bV=/^[cC][0-9a-z]{6,}$/,SV=/^[0-9a-z]+$/,EV=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wV=/^[0-9a-vA-V]{20}$/,TV=/^[A-Za-z0-9]{27}$/,RV=/^[a-zA-Z0-9_-]{21}$/,xV=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,OV=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,qM=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,CV=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_V="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function AV(){return new RegExp(_V,"u")}const DV=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,MV=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,zV=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,NV=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,UV=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ZM=/^[A-Za-z0-9_-]*$/,jV=/^https?$/,LV=/^\+[1-9]\d{6,14}$/,IM="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",HV=new RegExp(`^${IM}$`);function $M(t){const a="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${a}`:t.precision===0?`${a}:[0-5]\\d`:`${a}:[0-5]\\d\\.\\d{${t.precision}}`:`${a}(?::[0-5]\\d(?:\\.\\d+)?)?`}function VV(t){return new RegExp(`^${$M(t)}$`)}function kV(t){const a=$M({precision:t.precision}),i=["Z"];t.local&&i.push(""),t.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${a}(?:${i.join("|")})`;return new RegExp(`^${IM}T(?:${s})$`)}const BV=t=>{const a=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${a}$`)},YV=/^[^A-Z]*$/,GV=/^[^a-z]*$/,Vu=Ke("$ZodCheck",(t,a)=>{var i;t._zod??(t._zod={}),t._zod.def=a,(i=t._zod).onattach??(i.onattach=[])}),qV=Ke("$ZodCheckMaxLength",(t,a)=>{var i;Vu.init(t,a),(i=t._zod.def).when??(i.when=s=>{const d=s.value;return!CR(d)&&d.length!==void 0}),t._zod.onattach.push(s=>{const d=s._zod.bag.maximum??Number.POSITIVE_INFINITY;a.maximum<d&&(s._zod.bag.maximum=a.maximum)}),t._zod.check=s=>{const d=s.value;if(d.length<=a.maximum)return;const g=AR(d);s.issues.push({origin:g,code:"too_big",maximum:a.maximum,inclusive:!0,input:d,inst:t,continue:!a.abort})}}),ZV=Ke("$ZodCheckMinLength",(t,a)=>{var i;Vu.init(t,a),(i=t._zod.def).when??(i.when=s=>{const d=s.value;return!CR(d)&&d.length!==void 0}),t._zod.onattach.push(s=>{const d=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;a.minimum>d&&(s._zod.bag.minimum=a.minimum)}),t._zod.check=s=>{const d=s.value;if(d.length>=a.minimum)return;const g=AR(d);s.issues.push({origin:g,code:"too_small",minimum:a.minimum,inclusive:!0,input:d,inst:t,continue:!a.abort})}}),IV=Ke("$ZodCheckLengthEquals",(t,a)=>{var i;Vu.init(t,a),(i=t._zod.def).when??(i.when=s=>{const d=s.value;return!CR(d)&&d.length!==void 0}),t._zod.onattach.push(s=>{const d=s._zod.bag;d.minimum=a.length,d.maximum=a.length,d.length=a.length}),t._zod.check=s=>{const d=s.value,m=d.length;if(m===a.length)return;const g=AR(d),y=m>a.length;s.issues.push({origin:g,...y?{code:"too_big",maximum:a.length}:{code:"too_small",minimum:a.length},inclusive:!0,exact:!0,input:s.value,inst:t,continue:!a.abort})}}),M1=Ke("$ZodCheckStringFormat",(t,a)=>{var i,s;Vu.init(t,a),t._zod.onattach.push(d=>{const m=d._zod.bag;m.format=a.format,a.pattern&&(m.patterns??(m.patterns=new Set),m.patterns.add(a.pattern))}),a.pattern?(i=t._zod).check??(i.check=d=>{a.pattern.lastIndex=0,!a.pattern.test(d.value)&&d.issues.push({origin:"string",code:"invalid_format",format:a.format,input:d.value,...a.pattern?{pattern:a.pattern.toString()}:{},inst:t,continue:!a.abort})}):(s=t._zod).check??(s.check=()=>{})}),$V=Ke("$ZodCheckRegex",(t,a)=>{M1.init(t,a),t._zod.check=i=>{a.pattern.lastIndex=0,!a.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:a.pattern.toString(),inst:t,continue:!a.abort})}}),XV=Ke("$ZodCheckLowerCase",(t,a)=>{a.pattern??(a.pattern=YV),M1.init(t,a)}),PV=Ke("$ZodCheckUpperCase",(t,a)=>{a.pattern??(a.pattern=GV),M1.init(t,a)}),FV=Ke("$ZodCheckIncludes",(t,a)=>{Vu.init(t,a);const i=O1(a.includes),s=new RegExp(typeof a.position=="number"?`^.{${a.position}}${i}`:i);a.pattern=s,t._zod.onattach.push(d=>{const m=d._zod.bag;m.patterns??(m.patterns=new Set),m.patterns.add(s)}),t._zod.check=d=>{d.value.includes(a.includes,a.position)||d.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:a.includes,input:d.value,inst:t,continue:!a.abort})}}),QV=Ke("$ZodCheckStartsWith",(t,a)=>{Vu.init(t,a);const i=new RegExp(`^${O1(a.prefix)}.*`);a.pattern??(a.pattern=i),t._zod.onattach.push(s=>{const d=s._zod.bag;d.patterns??(d.patterns=new Set),d.patterns.add(i)}),t._zod.check=s=>{s.value.startsWith(a.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:a.prefix,input:s.value,inst:t,continue:!a.abort})}}),JV=Ke("$ZodCheckEndsWith",(t,a)=>{Vu.init(t,a);const i=new RegExp(`.*${O1(a.suffix)}$`);a.pattern??(a.pattern=i),t._zod.onattach.push(s=>{const d=s._zod.bag;d.patterns??(d.patterns=new Set),d.patterns.add(i)}),t._zod.check=s=>{s.value.endsWith(a.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:a.suffix,input:s.value,inst:t,continue:!a.abort})}}),KV=Ke("$ZodCheckOverwrite",(t,a)=>{Vu.init(t,a),t._zod.check=i=>{i.value=a.tx(i.value)}});class WV{constructor(a=[]){this.content=[],this.indent=0,this&&(this.args=a)}indented(a){this.indent+=1,a(this),this.indent-=1}write(a){if(typeof a=="function"){a(this,{execution:"sync"}),a(this,{execution:"async"});return}const s=a.split(`
261
+ `))):q&&(J=[q],V.setCustomValidity(q))):fe&&(V.setCustomValidity(""),he.customError=!1,V.validationMessage?(Q=V.validationMessage,J=[V.validationMessage]):V.validity.valid&&!he.valid&&(he.valid=!0))}const re={value:Y,state:he,error:Q??(Array.isArray(q)?q[0]:q??""),errors:J,initialValue:m.initialValue};if(x){const ce=a.current.fields.get(x);ce&&a.current.fields.set(x,{...ce,...h1(re,y)})}s(re)}),M=C.useCallback((Y={})=>Uu(_,b.valid===!1?{"aria-invalid":!0}:No,Y),[_,b.valid]),$=C.useCallback((Y={})=>Uu({onChange(Z){if(Z.nativeEvent.defaultPrevented)return;if(i(T),!R()){N(Z.currentTarget.value,!0);return}const V=Z.currentTarget;if(V.value===""){N(V.value);return}A.clear(),g?A.start(g,()=>{N(V.value)}):N(V.value)}},M(Y)),[M,i,T,A,N,g,R]);return C.useMemo(()=>({getValidationProps:M,getInputValidationProps:$,inputRef:z,commit:N}),[M,$,N])}function GL(t){const{commit:a,invalid:i,markedDirtyRef:s,name:d,setValidityData:m,validityData:g}=t,{formRef:y}=Kh(),S=C.useRef(null),b=C.useRef(null),T=C.useRef(null),R=nt(()=>{const N=b.current;if(N)return N.getValue?N.getValue():N.value}),x=nt((N=!0)=>{const M=b.current;if(!M)return;let $=M.value;$===void 0&&($=R()),s.current=!0,N?Jl.flushSync(()=>a($)):a($)});function _(){const N=b.current;!N||!N.id||y.current.fields.set(N.id,{getValue:R,name:d,controlRef:N.controlRef??T,validityData:h1(g,i),validate:x})}function A(N=b.current?.id){N&&y.current.fields.delete(N)}function z(){const N=b.current;if(!N)return;let M=N.value;M===void 0&&(M=R()),g.initialValue===null&&M!==null&&m($=>({...$,initialValue:M}))}return ht(()=>{const N=b.current;!N||!N.id||y.current.fields.set(N.id,{getValue:R,name:d,controlRef:N.controlRef??T,validityData:h1(g,i),validate:x})},[y,R,i,d,x,g]),ht(()=>{const N=y.current.fields;return()=>{const M=b.current?.id;M&&N.delete(M)}},[y]),nt((N,M)=>{if(!M){S.current===N&&(S.current=null,A(),b.current=null);return}const $=b.current?.id;S.current=N,b.current=M,$&&$!==M.id&&A($),z(),_()})}const ID=C.forwardRef(function(a,i){const{errors:s,validationMode:d,submitAttemptedRef:m}=Kh(),{render:g,className:y,validate:S,validationDebounceTime:b=0,validationMode:T=d,name:R,disabled:x=!1,invalid:_,dirty:A,touched:z,actionsRef:N,style:M,...$}=a,{disabled:Y}=kL(),Z=nt(S||(()=>null)),V=Y||x,[I,q]=C.useState(!1),[J,he]=C.useState(!1),[Q,fe]=C.useState(!1),[re,ce]=C.useState(!1),ee=A??J,K=z??I,L=C.useRef(!1),k=nt(Ae=>{A===void 0&&(Ae&&(L.current=!0),he(Ae))}),F=nt(Ae=>{z===void 0&&q(Ae)}),W=nt(()=>T==="onChange"||T==="onSubmit"&&m.current),de=!!R&&Object.hasOwn(s,R)&&s[R]!==void 0,U=_===!0||de,[P,te]=C.useState({state:c1,error:"",errors:[],value:null,initialValue:null}),ae=!U&&P.state.valid,Se=C.useMemo(()=>({disabled:V,touched:K,dirty:ee,valid:ae,filled:Q,focused:re}),[V,K,ee,ae,Q,re]),Re=YL({setValidityData:te,validate:Z,validityData:P,validationDebounceTime:b,invalid:U,markedDirtyRef:L,state:Se,name:R,shouldValidateOnChange:W}),Te=C.useCallback(()=>{L.current=!0,Re.commit(P.value)},[Re,P]),Me=GL({commit:Re.commit,invalid:U,markedDirtyRef:L,name:R,setValidityData:te,validityData:P});C.useImperativeHandle(N,()=>({validate:Te}),[Te]);const Be=C.useMemo(()=>({invalid:U,name:R,validityData:P,setValidityData:te,disabled:V,touched:K,setTouched:F,dirty:ee,setDirty:k,filled:Q,setFilled:fe,focused:re,setFocused:ce,validate:Z,validationMode:T,validationDebounceTime:b,shouldValidateOnChange:W,state:Se,markedDirtyRef:L,registerFieldControl:Me,validation:Re}),[U,R,P,V,K,F,ee,k,Q,fe,re,ce,Z,T,b,W,Se,Me,Re]),Qe=Dn("div",a,{ref:i,state:Se,props:$,stateAttributesMapping:Yd});return X.jsx(X2.Provider,{value:Be,children:Qe})});process.env.NODE_ENV!=="production"&&(ID.displayName="FieldRootInner");const em=C.forwardRef(function(a,i){return X.jsx(ZD,{children:X.jsx(ID,{...a,ref:i})})});process.env.NODE_ENV!=="production"&&(em.displayName="FieldRoot");const cR=C.forwardRef(function(a,i){const{render:s,className:d,style:m,id:g,nativeLabel:y=!0,...S}=a,b=Gd(!1),{labelId:T}=Ds(),R=C.useRef(null),x=oL({id:T??g,native:y});return process.env.NODE_ENV!=="production"&&C.useEffect(()=>{if(!R.current)return;const A=R.current.tagName==="LABEL";if(y){if(!A){const z=Zh.captureOwnerStack?.()||"";Ud(`<Field.Label> expected a <label> element because the \`nativeLabel\` prop is true. Rendering a non-<label> disables native label association, so \`htmlFor\` will not work. Use a real <label> in the \`render\` prop, or set \`nativeLabel\` to \`false\`.${z}`)}}else if(A){const z=Zh.captureOwnerStack?.()||"";Ud(`<Field.Label> expected a non-<label> element because the \`nativeLabel\` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the \`render\` prop, or set \`nativeLabel\` to \`true\`.${z}`)}},[y]),Dn("label",a,{ref:[i,R],state:b.state,props:[x,S],stateAttributesMapping:Yd})});process.env.NODE_ENV!=="production"&&(cR.displayName="FieldLabel");const qL={...Yd,...Wl},g1=C.forwardRef(function(a,i){const{render:s,id:d,className:m,match:g,style:y,...S}=a,b=vl(d),{validityData:T,state:R,name:x}=Gd(!1),{setMessageIds:_}=Ds(),{errors:A}=Kh(),z=x?A[x]:null,N=typeof g=="string";let M=!1;g===!0?M=!0:N?M=!!T.state[g]:M=!!z||T.state.valid===!1;const{mounted:$,transitionStatus:Y,setMounted:Z}=$y(M);ht(()=>{if(!(!M||!b))return _(K=>K.concat(b)),()=>{_(K=>K.filter(L=>L!==b))}},[M,b,_]);const V=C.useRef(null),[I,q]=C.useState(null),[J,he]=C.useState(null),Q=T.errors.length>1?X.jsx("ul",{children:T.errors.map(K=>X.jsx("li",{children:K},K))}):T.error,fe=N?Q:z||Q;let re=T.error;z!=null?re=Array.isArray(z)?JSON.stringify(z):z:T.errors.length>1&&(re=JSON.stringify(T.errors)),M&&re!==J&&(he(re),q(fe)),ju({open:M,ref:V,onComplete(){M||Z(!1)}});const ce={...R,transitionStatus:Y},ee=Dn("div",a,{ref:[i,V],state:ce,props:[{id:b,children:M?fe:I},S],stateAttributesMapping:qL,enabled:$});return $?ee:null});process.env.NODE_ENV!=="production"&&(g1.displayName="FieldError");const y1=C.forwardRef(function(a,i){const{render:s,className:d,id:m,name:g,value:y,disabled:S=!1,onValueChange:b,defaultValue:T,autoFocus:R=!1,style:x,..._}=a,{state:A,name:z,disabled:N,setTouched:M,setDirty:$,validityData:Y,setFocused:Z,setFilled:V,validationMode:I,validation:q}=Gd(),J=N||S,he=z??g,Q={...A,disabled:J},{labelId:fe}=Ds(),re=J2({id:m});ht(()=>{const W=y!=null;q.inputRef.current?.value||W&&y!==""?V(!0):W&&y===""&&V(!1)},[q.inputRef,V,y]);const ce=C.useRef(null);ht(()=>{R&&ce.current===Ua(It(ce.current))&&Z(!0)},[R,Z]);const[ee]=Qy({controlled:y,default:T,name:"FieldControl",state:"value"}),K=y!==void 0,L=K?ee:void 0,k=nt(()=>q.inputRef.current?.value);return P2(q.inputRef,{id:re,value:L,getValue:k}),Dn("input",a,{ref:[i,ce],state:Q,props:[{id:re,disabled:J,name:he,ref:q.inputRef,"aria-labelledby":fe,autoFocus:R,...K?{value:L}:{defaultValue:T},onChange(W){const de=W.currentTarget.value;b?.(de,tn(jd,W.nativeEvent)),$(de!==Y.initialValue),V(de!=="")},onFocus(){Z(!0)},onBlur(W){M(!0),Z(!1),I==="onBlur"&&q.commit(W.currentTarget.value)},onKeyDown(W){W.currentTarget.tagName==="INPUT"&&W.key==="Enter"&&(M(!0),q.commit(W.currentTarget.value))}},q.getInputValidationProps(),_],stateAttributesMapping:Yd})});process.env.NODE_ENV!=="production"&&(y1.displayName="FieldControl");const Wy=C.forwardRef(function(a,i){const{render:s,className:d,validationMode:m="onSubmit",errors:g,onSubmit:y,onFormSubmit:S,actionsRef:b,style:T,...R}=a,x=C.useRef({fields:new Map}),_=C.useRef(!1),A=C.useRef(!1),z=nt(I=>{I&&(I.focus(),I.tagName==="INPUT"&&I.select())}),[N,M]=C.useState(g);a1(g,()=>{M(g)}),C.useEffect(()=>{if(!_.current)return;_.current=!1;const I=Array.from(x.current.fields.values()).filter(q=>q.validityData.state.valid===!1);I.length&&z(I[0].controlRef.current)},[N,z]);const $=C.useCallback(I=>{const q=Array.from(x.current.fields.values());if(I){const J=q.find(he=>he.name===I);J&&J.validate(!1)}else q.forEach(J=>{J.validate(!1)})},[]);C.useImperativeHandle(b,()=>({validate:$}),[$]);const Y=Dn("form",a,{ref:i,props:[{noValidate:!0,onSubmit(I){A.current=!0;let q=Array.from(x.current.fields.values());q.forEach(he=>{he.validate()}),q=Array.from(x.current.fields.values());const J=q.filter(he=>!he.validityData.state.valid);if(J.length)I.preventDefault(),z(J[0].controlRef.current);else if(_.current=!0,y?.(I),S){I.preventDefault();const he=q.reduce((Q,fe)=>(fe.name&&(Q[fe.name]=fe.getValue()),Q),{});S(he,O9(jd,I.nativeEvent))}}},R]}),Z=nt(I=>{if(I&&N&&No.hasOwnProperty.call(N,I)){const q={...N};delete q[I],M(q)}}),V=C.useMemo(()=>({formRef:x,validationMode:m,errors:N??No,clearErrors:Z,submitAttemptedRef:A}),[x,m,N,Z]);return X.jsx(F2.Provider,{value:V,children:Y})});process.env.NODE_ENV!=="production"&&(Wy.displayName="Form");const fR=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(fR.displayName="PopoverRootContext");function zs(t){const a=C.useContext(fR);if(a===void 0&&!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverRootContext is missing. Popover parts must be placed within <Popover.Root>.":vo(47));return a}function ZL(){return{...dA(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const IL={...pA,disabled:ut(t=>t.disabled),instantType:ut(t=>t.instantType),openMethod:ut(t=>t.openMethod),openChangeReason:ut(t=>t.openChangeReason),modal:ut(t=>t.modal),focusManagerModal:ut(t=>t.focusManagerModal),stickIfOpen:ut(t=>t.stickIfOpen),titleElementId:ut(t=>t.titleElementId),descriptionElementId:ut(t=>t.descriptionElementId),openOnHover:ut(t=>t.openOnHover),closeDelay:ut(t=>t.closeDelay),hasViewport:ut(t=>t.hasViewport)};class dR extends mS{constructor(a){const i={...ZL(),...a};i.open&&a?.mounted===void 0&&(i.mounted=!0),super(i,{popupRef:C.createRef(),backdropRef:C.createRef(),internalBackdropRef:C.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:C.createRef(),beforeContentFocusGuardRef:C.createRef(),stickIfOpenTimeout:new hl,triggerElements:new qS},IL)}setOpen=(a,i)=>{const s=i.reason===Sr,d=i.reason===$h&&i.event.detail===0,m=!a&&(i.reason===U_||i.reason==null);if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(a,i),i.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(a,i);const g=()=>{const y={open:a,openChangeReason:i.reason},S=i.trigger?.id??null;(S||a)&&(y.activeTriggerId=S,y.activeTriggerElement=i.trigger??null),this.update(y)};s?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(a9,()=>{this.set("stickIfOpen",!1)}),Jl.flushSync(g)):g(),d||m?this.set("instantType",d?"click":"dismiss"):i.reason===Ld?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(a,i){const s=pa(()=>new dR(i)).current,d=a??s;return Uy(s.disposeEffect),d}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function $D({props:t}){const{children:a,open:i,defaultOpen:s=!1,onOpenChange:d,onOpenChangeComplete:m,modal:g=!1,handle:y,triggerId:S,defaultTriggerId:b=null}=t,T=dR.useStore(y?.store,{modal:g,open:s,openProp:i,activeTriggerId:b,triggerIdProp:S});j2(()=>{i===void 0&&T.state.open===!1&&s===!0&&T.update({open:!0,activeTriggerId:b})}),T.useControlledProp("openProp",i),T.useControlledProp("triggerIdProp",S);const R=T.useState("open"),x=T.useState("payload");T.useContextCallback("onOpenChange",d),T.useContextCallback("onOpenChangeComplete",m);const{openMethod:_,triggerProps:A}=L2(R);cA(T);const{forceUnmount:z}=fA(R,T,()=>{T.update({stickIfOpen:!0,openChangeReason:null})});C.useEffect(()=>{R||T.context.stickIfOpenTimeout.clear()},[T,R]);const N=C.useCallback(()=>{T.setOpen(!1,tn(j_))},[T]);C.useImperativeHandle(t.actionsRef,()=>({unmount:z,close:N}),[z,N]);const M=mA({popupStore:T,onOpenChange:T.setOpen}),$=R2(M,{outsidePressEvent:{mouse:g==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),Y=bA(M),{getReferenceProps:Z,getFloatingProps:V,getTriggerProps:I}=Xy([$,Y]),q=C.useMemo(()=>Z(A),[Z,A]),J=C.useMemo(()=>I(A),[I,A]),he=C.useMemo(()=>V(),[V]);T.useSyncedValues({modal:g,openMethod:_,activeTriggerProps:q,inactiveTriggerProps:J,popupProps:he,floatingRootContext:M,nested:Pc()!=null});const Q=C.useMemo(()=>({store:T}),[T]);return X.jsx(fR.Provider,{value:Q,children:typeof a=="function"?a({payload:x}):a})}function $L(t){return zs(!0)?X.jsx($D,{props:t}):X.jsx(U9,{children:X.jsx($D,{props:t})})}const XL=300,XD=C.forwardRef(function(a,i){const{render:s,className:d,disabled:m=!1,nativeButton:g=!0,handle:y,payload:S,openOnHover:b=!1,delay:T=XL,closeDelay:R=0,id:x,style:_,...A}=a,z=zs(!0),N=y?.store??z?.store;if(!N)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Trigger> must be either used within a <Popover.Root> component or provided with a handle.":vo(74));const M=vl(x),$=N.useState("isTriggerActive",M),Y=N.useState("floatingRootContext"),Z=N.useState("isOpenedByTrigger",M),V=C.useRef(null),{registerTrigger:I,isMountedByThisTrigger:q}=sA(M,V,N,{payload:S,disabled:m,openOnHover:b,closeDelay:R}),J=N.useState("openChangeReason"),he=N.useState("stickIfOpen"),Q=N.useState("openMethod"),fe=N.useState("focusManagerModal"),re=Nj(Y,{enabled:Y!=null&&b&&(Q!=="touch"||J!==$h),mouseOnly:!0,move:!1,handleClose:Gj(),restMs:T,delay:{close:R},triggerElementRef:V,isActiveTrigger:$,isClosing:()=>N.select("transitionStatus")==="ending"}),ce=T2(Y,{enabled:Y!=null,stickIfOpen:he}),ee=Xy([ce]),K=N.useState("triggerProps",q),L={disabled:m,open:Z},{getButtonProps:k,buttonRef:F}=Ih({disabled:m,native:g}),W=C.useMemo(()=>({open(ae){return ae&&J===$h?AA.open(ae):_A.open(ae)}}),[J]),de=Dn("button",a,{state:L,ref:[F,i,I,V],props:[ee.getReferenceProps(),re,K,{[u2]:"",id:M},A,k],stateAttributesMapping:W}),{preFocusGuardRef:U,handlePreFocusGuardFocus:P,handleFocusTargetFocus:te}=rL(N,V);return $&&!fe?X.jsxs(C.Fragment,{children:[X.jsx(Nu,{ref:U,onFocus:P}),X.jsx(C.Fragment,{children:de},M),X.jsx(Nu,{ref:N.context.triggerFocusTargetRef,onFocus:te})]}):X.jsx(C.Fragment,{children:de},M)});process.env.NODE_ENV!=="production"&&(XD.displayName="PopoverTrigger");const pR=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(pR.displayName="PopoverPortalContext");function PL(){const t=C.useContext(pR);if(t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Popover.Portal> is missing.":vo(45));return t}const PD=C.forwardRef(function(a,i){const{keepMounted:s=!1,...d}=a,{store:m}=zs();return m.useState("mounted")||s?X.jsx(pR.Provider,{value:s,children:X.jsx(VS,{ref:i,...d})}):null});process.env.NODE_ENV!=="production"&&(PD.displayName="PopoverPortal");const hR=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(hR.displayName="PopoverPositionerContext");function FD(){const t=C.useContext(hR);if(!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.":vo(46));return t}const QD=C.forwardRef(function(a,i){const{render:s,className:d,anchor:m,positionMethod:g="absolute",side:y="bottom",align:S="center",sideOffset:b=0,alignOffset:T=0,collisionBoundary:R="clipping-ancestors",collisionPadding:x=5,arrowPadding:_=5,sticky:A=!1,disableAnchorTracking:z=!1,collisionAvoidance:N=c9,style:M,...$}=a,{store:Y}=zs(),Z=PL(),V=z9(),I=Y.useState("floatingRootContext"),q=Y.useState("mounted"),J=Y.useState("open"),he=Y.useState("openChangeReason"),Q=Y.useState("activeTriggerElement"),fe=Y.useState("modal"),re=Y.useState("openMethod"),ce=Y.useState("positionerElement"),ee=Y.useState("instantType"),K=Y.useState("transitionStatus"),L=Y.useState("hasViewport"),k=C.useRef(null),F=R_(ce,!1,!1),W=OA({anchor:m,floatingRootContext:I,positionMethod:g,mounted:q,side:y,sideOffset:b,align:S,alignOffset:T,arrowPadding:_,collisionBoundary:R,collisionPadding:x,sticky:A,disableAnchorTracking:z,keepMounted:Z,nodeId:V,collisionAvoidance:N,adaptiveOrigin:L?Xj:void 0}),de=I.useState("domReferenceElement");ht(()=>{const ae=de,Se=k.current;if(ae&&(k.current=ae),Se&&ae&&ae!==Se){Y.set("instantType",void 0);const Re=new AbortController;return F(()=>{Y.set("instantType","trigger-change")},Re.signal),()=>{Re.abort()}}},[de,F,Y]);const U={open:J,side:W.side,align:W.align,anchorHidden:W.anchorHidden,instant:ee};lD(J&&fe===!0&&he!==Sr,re==="touch",ce,Q);const P=C.useCallback(ae=>{Y.set("positionerElement",ae)},[Y]),te=DA(a,U,{styles:W.positionerStyles,transitionStatus:K,props:$,refs:[i,P],hidden:!q,inert:!J});return X.jsxs(hR.Provider,{value:W,children:[q&&fe===!0&&he!==Sr&&X.jsx(l1,{ref:Y.context.internalBackdropRef,inert:zS(!J),cutout:Q}),X.jsx(N9,{id:V,children:te})]})});process.env.NODE_ENV!=="production"&&(QD.displayName="PopoverPositioner");const JD=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(JD.displayName="ClosePartContext");function FL(){const[t,a]=C.useState(0),i=nt(()=>(a(d=>d+1),()=>{a(d=>Math.max(0,d-1))}));return{context:C.useMemo(()=>({register:i}),[i]),hasClosePart:t>0}}function QL(t){const{value:a,children:i}=t;return X.jsx(JD.Provider,{value:a,children:i})}const JL={...Lu,...Wl},KD=C.forwardRef(function(a,i){const{className:s,render:d,initialFocus:m,finalFocus:g,style:y,...S}=a,{store:b}=zs(),T=FD(),R=dD()!=null,{context:x,hasClosePart:_}=FL(),A=b.useState("open"),z=b.useState("openMethod"),N=b.useState("instantType"),M=b.useState("transitionStatus"),$=b.useState("popupProps"),Y=b.useState("titleElementId"),Z=b.useState("descriptionElementId"),V=b.useState("modal"),I=b.useState("mounted"),q=b.useState("openChangeReason"),J=b.useState("activeTriggerElement"),he=b.useState("floatingRootContext");ju({open:A,ref:b.context.popupRef,onComplete(){A&&b.context.onOpenChangeComplete?.(!0)}});const Q=b.useState("disabled"),fe=b.useState("openOnHover"),re=b.useState("closeDelay");Mj(he,{enabled:fe&&!Q,closeDelay:re});function ce(W){return W==="touch"?b.context.popupRef.current:!0}const ee=m===void 0?ce:m,K={open:A,side:T.side,align:T.align,instant:N,transitionStatus:M},L=V!==!1&&_;b.useSyncedValue("focusManagerModal",L);const k=C.useCallback(W=>{b.set("popupElement",W)},[b]),F=Dn("div",a,{state:K,ref:[i,b.context.popupRef,k],props:[$,{"aria-labelledby":Y,"aria-describedby":Z,onKeyDown(W){R&&o1.has(W.key)&&W.stopPropagation()}},z2(M),S],stateAttributesMapping:JL});return X.jsx(kS,{context:he,openInteractionType:z,modal:L,disabled:!I||q===Sr,initialFocus:ee,returnFocus:g,restoreFocus:"popup",previousFocusableElement:Wn(J)?J:void 0,nextFocusableElement:b.context.triggerFocusTargetRef,beforeContentFocusGuardRef:b.context.beforeContentFocusGuardRef,children:X.jsx(QL,{value:x,children:F})})});process.env.NODE_ENV!=="production"&&(KD.displayName="PopoverPopup");const WD=C.forwardRef(function(a,i){const{className:s,render:d,style:m,...g}=a,{store:y}=zs(),S=y.useState("open"),{arrowRef:b,side:T,align:R,arrowUncentered:x,arrowStyles:_}=FD();return Dn("div",a,{state:{open:S,side:T,align:R,uncentered:x},ref:[i,b],props:[{style:_,"aria-hidden":!0},g],stateAttributesMapping:Lu})});process.env.NODE_ENV!=="production"&&(WD.displayName="PopoverArrow");const KL={...Lu,...Wl},eM=C.forwardRef(function(a,i){const{className:s,render:d,style:m,...g}=a,{store:y}=zs(),S=y.useState("open"),b=y.useState("mounted"),T=y.useState("transitionStatus"),R=y.useState("openChangeReason");return Dn("div",a,{state:{open:S,transitionStatus:T},ref:[y.context.backdropRef,i],props:[{role:"presentation",hidden:!b,style:{pointerEvents:R===Sr?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},g],stateAttributesMapping:KL})});process.env.NODE_ENV!=="production"&&(eM.displayName="PopoverBackdrop");const tM=C.forwardRef(function(a,i){const{render:s,className:d,style:m,...g}=a,{store:y}=zs(),S=vl(g.id);return ht(()=>(y.set("titleElementId",S),()=>{y.set("titleElementId",void 0)}),[y,S]),Dn("h2",a,{ref:i,props:[{id:S},g]})});process.env.NODE_ENV!=="production"&&(tM.displayName="PopoverTitle");const nM=C.forwardRef(function(a,i){const{render:s,className:d,style:m,...g}=a,{store:y}=zs(),S=vl(g.id);return ht(()=>(y.set("descriptionElementId",S),()=>{y.set("descriptionElementId",void 0)}),[y,S]),Dn("p",a,{ref:i,props:[{id:S},g]})});process.env.NODE_ENV!=="production"&&(nM.displayName="PopoverDescription");const v1="base-ui-disable-scrollbar",mR={className:v1,getElement(t){return X.jsx("style",{nonce:t,href:v1,precedence:"base-ui:low",children:`.${v1}{scrollbar-width:none}.${v1}::-webkit-scrollbar{display:none}`})}};process.env.NODE_ENV!=="production"&&(mR.getElement.displayName="styleDisableScrollbar.getElement");const Ns=1;function oM(t,a){return Math.max(0,t-a)}function WL(t,a){if(a<=0)return 0;const i=Qo(t,0,a),s=i,d=a-i,m=s<=Ns,g=d<=Ns;return m&&g?s<=d?0:a:m?0:g?a:i}const gR=C.createContext(null);process.env.NODE_ENV!=="production"&&(gR.displayName="SelectRootContext");const yR=C.createContext(null);process.env.NODE_ENV!=="production"&&(yR.displayName="SelectFloatingContext");function tm(){const t=C.useContext(gR);if(t===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.":vo(60));return t}function aM(){const t=C.useContext(yR);if(t===null)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.":vo(61));return t}const Sn={id:ut(t=>t.id),labelId:ut(t=>t.labelId),modal:ut(t=>t.modal),multiple:ut(t=>t.multiple),items:ut(t=>t.items),itemToStringLabel:ut(t=>t.itemToStringLabel),itemToStringValue:ut(t=>t.itemToStringValue),isItemEqualToValue:ut(t=>t.isItemEqualToValue),value:ut(t=>t.value),hasSelectedValue:ut(t=>{const{value:a,multiple:i,itemToStringValue:s}=t;return a==null?!1:i&&Array.isArray(a)?a.length>0:Jh(a,s)!==""}),hasNullItemLabel:ut((t,a)=>a?q7(t.items):!1),open:ut(t=>t.open),mounted:ut(t=>t.mounted),forceMount:ut(t=>t.forceMount),transitionStatus:ut(t=>t.transitionStatus),openMethod:ut(t=>t.openMethod),activeIndex:ut(t=>t.activeIndex),selectedIndex:ut(t=>t.selectedIndex),isActive:ut((t,a)=>t.activeIndex===a),isSelected:ut((t,a,i)=>{const s=t.isItemEqualToValue,d=t.value;return t.multiple?Array.isArray(d)&&d.some(m=>Qh(i,m,s)):t.selectedIndex===a&&t.selectedIndex!==null?!0:Qh(i,d,s)}),isSelectedByFocus:ut((t,a)=>t.selectedIndex===a),popupProps:ut(t=>t.popupProps),triggerProps:ut(t=>t.triggerProps),triggerElement:ut(t=>t.triggerElement),positionerElement:ut(t=>t.positionerElement),listElement:ut(t=>t.listElement),scrollUpArrowVisible:ut(t=>t.scrollUpArrowVisible),scrollDownArrowVisible:ut(t=>t.scrollDownArrowVisible),hasScrollArrows:ut(t=>t.hasScrollArrows)};function eH(t){const{id:a,value:i,defaultValue:s=null,onValueChange:d,open:m,defaultOpen:g=!1,onOpenChange:y,name:S,form:b,autoComplete:T,disabled:R=!1,readOnly:x=!1,required:_=!1,modal:A=!0,actionsRef:z,inputRef:N,onOpenChangeComplete:M,items:$,multiple:Y=!1,itemToStringLabel:Z,itemToStringValue:V,isItemEqualToValue:I=k7,highlightItemOnHover:q=!0,children:J}=t,{clearErrors:he}=Kh(),{setDirty:Q,setTouched:fe,setFocused:re,shouldValidateOnChange:ce,validityData:ee,setFilled:K,name:L,disabled:k,validation:F,validationMode:W}=Gd(),de=J2({id:a}),U=k||R,P=L??S,[te,ae]=Qy({controlled:i,default:Y?s??jC:s,name:"Select",state:"value"}),[Se,Re]=Qy({controlled:m,default:g,name:"Select",state:"open"}),Te=C.useRef([]),Me=C.useRef([]),Be=C.useRef(null),Qe=C.useRef(null),Ae=C.useRef(0),Le=C.useRef(null),rt=C.useRef([]),ot=C.useRef(!1),We=C.useRef(!1),Ze=C.useRef(null),Je=C.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ct=C.useRef(!1),{mounted:tt,setMounted:Ye,transitionStatus:ne}=$y(Se),{openMethod:Ee,triggerProps:be}=L2(Se),me=pa(()=>new UC({id:de,labelId:void 0,modal:A,multiple:Y,itemToStringLabel:Z,itemToStringValue:V,isItemEqualToValue:I,value:te,open:Se,mounted:tt,transitionStatus:ne,items:$,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,$e=bn(me,Sn.activeIndex),Pe=bn(me,Sn.selectedIndex),Xe=bn(me,Sn.triggerElement),at=bn(me,Sn.positionerElement),zt=lL(Ee),yt=Ee??zt,St=C.useMemo(()=>Y&&Array.isArray(te)&&te.length===0?"":Jh(te,V),[Y,te,V]),Rt=C.useMemo(()=>Y&&Array.isArray(te)?te.map(xt=>Jh(xt,V)):Jh(te,V),[Y,te,V]),_t=Fo(me.state.triggerElement),Ot=nt(()=>Rt);P2(_t,{id:de,value:te,getValue:Ot});const Nt=C.useRef(te);ht(()=>{te!==Nt.current&&me.set("forceMount",!0)},[me,te]),ht(()=>{K(Y?Array.isArray(te)&&te.length>0:te!=null)},[Y,te,K]),ht(function(){if(Se)return;const Et=rt.current;if(Y){const kt=Array.isArray(te)?te:[];if(kt.length===0){me.set("selectedIndex",null);return}const $t=kt[kt.length-1],vt=Jy(Et,$t,I);me.set("selectedIndex",vt===-1?null:vt);return}const Ht=Jy(Et,te,I);me.set("selectedIndex",Ht===-1?null:Ht)},[Y,Se,te,rt,I,me]),a1(te,()=>{he(P),Q(te!==ee.initialValue),ce()?F.commit(te):F.commit(te,!0)});const Yt=nt((xt,Et)=>{if(y?.(xt,Et),!Et.isCanceled&&(Re(xt),!xt&&(Et.reason===Ld||Et.reason===f2)&&(fe(!0),re(!1),W==="onBlur"&&F.commit(te)),!xt&&me.state.activeIndex!==null)){const Ht=Te.current[me.state.activeIndex];queueMicrotask(()=>{Ht?.setAttribute("tabindex","-1")})}}),gn=nt(()=>{Ye(!1),me.update({activeIndex:null,openMethod:null}),M?.(!1)});ju({enabled:!z,open:Se,ref:Be,onComplete(){Se||gn()}}),C.useImperativeHandle(z,()=>({unmount:gn}),[gn]);const H=nt((xt,Et)=>{d?.(xt,Et),!Et.isCanceled&&ae(xt)}),le=nt(()=>{const xt=me.state.listElement||Be.current;if(!xt)return;const Et=oM(xt.scrollHeight,xt.clientHeight),Ht=WL(xt.scrollTop,Et),kt=Ht>0,$t=Ht<Et;me.state.scrollUpArrowVisible!==kt&&me.set("scrollUpArrowVisible",kt),me.state.scrollDownArrowVisible!==$t&&me.set("scrollDownArrowVisible",$t)}),ze=hA({open:Se,onOpenChange:Yt,elements:{reference:Xe,floating:at}}),He=T2(ze,{enabled:!x&&!U,event:"mousedown"}),et=R2(ze,{bubbles:!1}),lt=Hj(ze,{enabled:!x&&!U,listRef:Te,activeIndex:$e,selectedIndex:Pe,disabledIndices:jC,onNavigate(xt){xt===null&&!Se||me.set("activeIndex",xt)},focusItemOnHover:q}),ft=kj(ze,{enabled:!x&&!U&&(Se||!Y),listRef:Me,activeIndex:$e,selectedIndex:Pe,onMatch(xt){Se?me.set("activeIndex",xt):H(rt.current[xt],tn("none"))},onTypingChange(xt){ot.current=xt}}),{getReferenceProps:At,getFloatingProps:st,getItemProps:je}=Xy([He,et,lt,ft]),Fe=C.useMemo(()=>Uu(At(),be,de?{id:de}:No),[At,be,de]);j2(()=>{me.update({popupProps:st(),triggerProps:Fe})}),ht(()=>{me.update({id:de,modal:A,multiple:Y,value:te,open:Se,mounted:tt,transitionStatus:ne,popupProps:st(),triggerProps:Fe,items:$,itemToStringLabel:Z,itemToStringValue:V,isItemEqualToValue:I,openMethod:yt})},[me,de,A,Y,te,Se,tt,ne,st,Fe,$,Z,V,I,yt]);const dt=C.useMemo(()=>({store:me,name:P,required:_,disabled:U,readOnly:x,multiple:Y,highlightItemOnHover:q,setValue:H,setOpen:Yt,listRef:Te,popupRef:Be,scrollHandlerRef:Qe,handleScrollArrowVisibility:le,scrollArrowsMountedCountRef:Ae,getItemProps:je,events:ze.context.events,valueRef:Le,valuesRef:rt,labelsRef:Me,typingRef:ot,selectionRef:Je,selectedItemTextRef:Ze,validation:F,onOpenChangeComplete:M,keyboardActiveRef:We,alignItemWithTriggerActiveRef:ct,initialValueRef:Nt}),[me,P,_,U,x,Y,q,H,Yt,je,ze.context.events,F,M,le]),Lt=Md(N,F.inputRef),qt=Y&&Array.isArray(te)&&te.length>0,Dt=Y?void 0:P,Qt=C.useMemo(()=>!Y||!Array.isArray(te)||!P?null:te.map(xt=>{const Et=Jh(xt,V);return X.jsx("input",{type:"hidden",form:b,name:P,value:Et},Et)}),[Y,te,b,P,V]);return X.jsx(gR.Provider,{value:dt,children:X.jsxs(yR.Provider,{value:ze,children:[J,X.jsx("input",{...F.getInputValidationProps({onFocus(){me.state.triggerElement?.focus({focusVisible:!0})},onChange(xt){if(xt.nativeEvent.defaultPrevented)return;const Et=xt.currentTarget.value,Ht=tn(jd,xt.nativeEvent);function kt(){if(Y)return;const $t=rt.current.find(vt=>Jh(vt,V).toLowerCase()===Et.toLowerCase()||Z7(vt,Z).toLowerCase()===Et.toLowerCase());$t!=null&&(Q($t!==ee.initialValue),H($t,Ht),ce()&&F.commit($t))}me.set("forceMount",!0),queueMicrotask(kt)}}),id:de&&Dt==null?`${de}-hidden-input`:void 0,form:b,name:Dt,autoComplete:T,value:St,disabled:U,required:_&&!qt,readOnly:x,ref:Lt,style:P?h_:AS,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Qt]})})}const b1=2,tH=400,rM=200,nH={...AA,...Yd,value:()=>null},lM=C.forwardRef(function(a,i){const{render:s,className:d,id:m,disabled:g=!1,nativeButton:y=!0,style:S,...b}=a,{setTouched:T,setFocused:R,validationMode:x,state:_,disabled:A}=Gd(),{labelId:z}=Ds(),{store:N,setOpen:M,selectionRef:$,validation:Y,readOnly:Z,required:V,alignItemWithTriggerActiveRef:I,disabled:q,keyboardActiveRef:J}=tm(),he=A||q||g,Q=bn(N,Sn.open),fe=bn(N,Sn.value),re=bn(N,Sn.triggerProps),ce=bn(N,Sn.positionerElement),ee=bn(N,Sn.listElement),K=bn(N,Sn.id),L=bn(N,Sn.labelId),k=bn(N,Sn.hasSelectedValue),F=!k&&Q,W=bn(N,Sn.hasNullItemLabel,F),de=m??K,U=X7(z,L);J2({id:de});const P=Fo(ce),te=C.useRef(null),{getButtonProps:ae,buttonRef:Se}=Ih({disabled:he,native:y}),Re=nt(We=>{N.set("triggerElement",We)}),Te=Md(i,te,Se,Re),Me=ml(),Be=ml(),Qe=ml(),Ae=ml();C.useEffect(()=>{if(Q)return!(k||W)?Qe.start(tH,()=>{$.current.allowUnselectedMouseUp=!0,$.current.allowSelectedMouseUp=!0}):Ae.start(rM,()=>{$.current.allowUnselectedMouseUp=!0,Qe.start(rM,()=>{$.current.allowSelectedMouseUp=!0})}),()=>{Qe.clear(),Ae.clear()};$.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},Be.clear()},[Q,k,W,$,Be,Qe,Ae]);const Le=C.useMemo(()=>ee?.id??ky(ce)?.id,[ee,ce]),rt=Uu(re,{id:de,role:"combobox","aria-expanded":Q?"true":"false","aria-haspopup":"listbox","aria-controls":Q?Le:void 0,"aria-labelledby":U,"aria-readonly":Z||void 0,"aria-required":V||void 0,tabIndex:he?-1:0,ref:Te,onFocus(We){R(!0),Q&&I.current&&M(!1,tn(jd,We.nativeEvent)),Me.start(0,()=>{N.set("forceMount",!0)})},onBlur(We){Tt(ce,We.relatedTarget)||(T(!0),R(!1),x==="onBlur"&&Y.commit(fe))},onPointerMove(){J.current=!1},onKeyDown(){J.current=!0},onMouseDown(We){if(Q)return;const Ze=It(We.currentTarget);function Je(ct){if(!te.current)return;const tt=ct.target;if(Tt(te.current,tt)||Tt(P.current,tt)||tt===te.current)return;const Ye=$7(te.current);ct.clientX>=Ye.left-b1&&ct.clientX<=Ye.right+b1&&ct.clientY>=Ye.top-b1&&ct.clientY<=Ye.bottom+b1||M(!1,tn(R9,ct))}Be.start(0,()=>{Ze.addEventListener("mouseup",Je,{once:!0})})}},Y.getValidationProps,b,ae);rt.role="combobox";const ot={..._,open:Q,disabled:he,value:fe,readOnly:Z,placeholder:!k};return Dn("button",a,{ref:[i,te],state:ot,stateAttributesMapping:nH,props:rt})});process.env.NODE_ENV!=="production"&&(lM.displayName="SelectTrigger");const iM=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(iM.displayName="SelectPortalContext");const uM=C.forwardRef(function(a,i){const{store:s}=tm(),d=bn(s,Sn.mounted),m=bn(s,Sn.forceMount);return d||m?X.jsx(iM.Provider,{value:!0,children:X.jsx(VS,{ref:i,...a})}):null});process.env.NODE_ENV!=="production"&&(uM.displayName="SelectPortal");const vR=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(vR.displayName="SelectPositionerContext");function oH(){const t=C.useContext(vR);if(!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.":vo(59));return t}function S1(t,a){t&&Object.assign(t.style,a)}const aH={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},rH={position:"fixed"},sM=C.forwardRef(function(a,i){const{anchor:s,positionMethod:d="absolute",className:m,render:g,side:y="bottom",align:S="center",sideOffset:b=0,alignOffset:T=0,collisionBoundary:R="clipping-ancestors",collisionPadding:x,arrowPadding:_=5,sticky:A=!1,disableAnchorTracking:z,alignItemWithTrigger:N=!0,collisionAvoidance:M=s9,style:$,...Y}=a,{store:Z,listRef:V,labelsRef:I,alignItemWithTriggerActiveRef:q,selectedItemTextRef:J,valuesRef:he,initialValueRef:Q,popupRef:fe,setValue:re}=tm(),ce=aM(),ee=bn(Z,Sn.open),K=bn(Z,Sn.mounted),L=bn(Z,Sn.modal),k=bn(Z,Sn.value),F=bn(Z,Sn.openMethod),W=bn(Z,Sn.positionerElement),de=bn(Z,Sn.triggerElement),U=bn(Z,Sn.isItemEqualToValue),P=bn(Z,Sn.transitionStatus),te=C.useRef(null),ae=C.useRef(null),[Se,Re]=C.useState(N),Te=K&&Se&&F!=="touch";!K&&Se!==N&&Re(N),ht(()=>{K||(Sn.scrollUpArrowVisible(Z.state)&&Z.set("scrollUpArrowVisible",!1),Sn.scrollDownArrowVisible(Z.state)&&Z.set("scrollDownArrowVisible",!1))},[Z,K]),C.useImperativeHandle(q,()=>Te),lD((Te||L)&&ee,F==="touch",W,de);const Me=OA({anchor:s,floatingRootContext:ce,positionMethod:d,mounted:K,side:y,sideOffset:b,align:S,alignOffset:T,arrowPadding:_,collisionBoundary:R,collisionPadding:x,sticky:A,disableAnchorTracking:z??Te,collisionAvoidance:M,keepMounted:!0}),Be=Te?"none":Me.side,Qe=Te?rH:Me.positionerStyles,Ae={open:ee,side:Be,align:Me.align,anchorHidden:Me.anchorHidden},Le=nt(Je=>{Z.set("positionerElement",Je)}),rt=DA(a,Ae,{styles:Qe,transitionStatus:P,props:Y,refs:[i,Le],hidden:!K,inert:!ee}),ot=C.useRef(0),We=nt(Je=>{if(Je.size===0&&ot.current===0||he.current.length===0)return;const ct=ot.current;if(ot.current=Je.size,Je.size===ct)return;const tt=tn(jd);if(ct!==0&&!Z.state.multiple&&k!==null&&Jy(he.current,k,U)===-1){const ne=Q.current,be=ne!=null&&Jy(he.current,ne,U)!==-1?ne:null;re(be,tt),be===null&&(Z.set("selectedIndex",null),J.current=null)}if(ct!==0&&Z.state.multiple&&Array.isArray(k)){const Ye=Ee=>Jy(he.current,Ee,U)!==-1,ne=k.filter(Ee=>Ye(Ee));(ne.length!==k.length||ne.some(Ee=>!B7(k,Ee,U)))&&(re(ne,tt),ne.length===0&&(Z.set("selectedIndex",null),J.current=null))}if(ee&&Te){Z.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Ye={height:""};S1(W,Ye),S1(fe.current,Ye)}}),Ze=C.useMemo(()=>({...Me,side:Be,alignItemWithTriggerActive:Te,setControlledAlignItemWithTrigger:Re,scrollUpArrowRef:te,scrollDownArrowRef:ae}),[Me,Be,Te,Re]);return X.jsx(g7,{elementsRef:V,labelsRef:I,onMapChange:We,children:X.jsxs(vR.Provider,{value:Ze,children:[K&&L&&X.jsx(l1,{inert:zS(!ee),cutout:de}),rt]})})});process.env.NODE_ENV!=="production"&&(sM.displayName="SelectPositioner");const lH={...Lu,...Wl},cM=C.forwardRef(function(a,i){const{render:s,className:d,style:m,finalFocus:g,...y}=a,{store:S,popupRef:b,onOpenChangeComplete:T,setOpen:R,valueRef:x,selectedItemTextRef:_,keyboardActiveRef:A,multiple:z,handleScrollArrowVisibility:N,scrollHandlerRef:M,listRef:$,highlightItemOnHover:Y}=tm(),{side:Z,align:V,alignItemWithTriggerActive:I,isPositioned:q,setControlledAlignItemWithTrigger:J,scrollDownArrowRef:he,scrollUpArrowRef:Q}=oH(),fe=dD()!=null,re=aM(),ce=TA(),{nonce:ee,disableStyleElements:K}=uL(),L=bn(S,Sn.id),k=bn(S,Sn.open),F=bn(S,Sn.mounted),W=bn(S,Sn.popupProps),de=bn(S,Sn.transitionStatus),U=bn(S,Sn.triggerElement),P=bn(S,Sn.positionerElement),te=bn(S,Sn.listElement),ae=C.useRef(!1),Se=C.useRef(!1),Re=C.useRef({}),Te=Ly(),Me=nt(Le=>{if(!P||!b.current||!Se.current)return;if(ae.current||!I){N();return}const rt=P.style.top==="0px",ot=P.style.bottom==="0px";if(!rt&&!ot){N();return}const We=dM(P),Ze=ev(P.getBoundingClientRect().height,"y",We),Je=It(P),ct=getComputedStyle(P),tt=parseFloat(ct.marginTop),Ye=parseFloat(ct.marginBottom),ne=fM(getComputedStyle(b.current)),Ee=Math.min(Je.documentElement.clientHeight-tt-Ye,ne),be=Le.scrollTop,me=E1(Le);let $e=0,Pe=null,Xe=!1,at=!1;const zt=_t=>{P.style.height=`${_t}px`},yt=(_t,Ot)=>{const Nt=Qo(_t,0,Ee-Ze);Nt>0&&zt(Ze+Nt),Le.scrollTop=Ot,Ee-(Ze+Nt)<=Ns&&(ae.current=!0),N()},St=rt?me-be:be,Rt=Math.min(Ze+St,Ee);if($e=Rt,St<=Ns){yt(St,rt?me:0);return}if(Ee-Rt>Ns)rt?at=!0:Pe=0;else if(Xe=!0,ot&&be<me){const _t=Ze+St-Ee;Pe=be-(St-_t)}if($e=Math.ceil($e),$e!==0&&zt($e),at||Pe!=null){const _t=E1(Le),Ot=at?_t:Qo(Pe,0,_t);Math.abs(Le.scrollTop-Ot)>Ns&&(Le.scrollTop=Ot)}(Xe||$e>=Ee-Ns)&&(ae.current=!0),N()});C.useImperativeHandle(M,()=>Me,[Me]),ju({open:k,ref:b,onComplete(){k&&T?.(!0)}});const Be={open:k,transitionStatus:de,side:Z,align:V};ht(()=>{!P||!b.current||Object.keys(Re.current).length||(Re.current={top:P.style.top||"0",left:P.style.left||"0",right:P.style.right,height:P.style.height,bottom:P.style.bottom,minHeight:P.style.minHeight,maxHeight:P.style.maxHeight,marginTop:P.style.marginTop,marginBottom:P.style.marginBottom})},[b,P]),ht(()=>{k||I||(Se.current=!1,ae.current=!1,S1(P,Re.current))},[k,I,P,b]),ht(()=>{const Le=b.current;if(!k||!U||!P||!Le||I&&!q||S.state.transitionStatus==="ending")return;if(!I){Se.current=!0,Te.request(N),Le.style.removeProperty("--transform-origin");return}const rt=iH(Le);Le.style.removeProperty("--transform-origin");try{const ot=_.current,We=x.current,Ze=getComputedStyle(P),Je=getComputedStyle(Le),ct=It(U),tt=Zn(P),Ye=dM(U),ne=w1(U.getBoundingClientRect(),Ye),Ee=w1(P.getBoundingClientRect(),Ye),be=ne.height,me=te||Le,$e=me.scrollHeight,Pe=parseFloat(Je.borderBottomWidth),Xe=parseFloat(Ze.marginTop)||10,at=parseFloat(Ze.marginBottom)||10,zt=parseFloat(Ze.minHeight)||100,yt=fM(Je),St=5,Rt=5,_t=20,Ot=ct.documentElement.clientHeight-Xe-at,Nt=ct.documentElement.clientWidth,Yt=Ot-ne.bottom+be;let gn,H=ce==="rtl"?ne.right-Ee.width:ne.left,le=0;if(ot&&We){const Lt=w1(We.getBoundingClientRect(),Ye);gn=w1(ot.getBoundingClientRect(),Ye),H=Ee.left+(ce==="rtl"?Lt.right-gn.right:Lt.left-gn.left);const qt=Lt.top-ne.top+Lt.height/2;le=gn.top-Ee.top+gn.height/2-qt}const ze=Yt+le+at+Pe;let He=Math.min(Ot,ze);const et=Ot-Xe-at,lt=ze-He,ft=Nt-Rt;P.style.left=`${Qo(H,St,ft-Ee.width)}px`,P.style.height=`${He}px`,P.style.maxHeight="auto",P.style.marginTop=`${Xe}px`,P.style.marginBottom=`${at}px`,Le.style.height="100%";const At=E1(me),st=lt>=At-Ns;st&&(He=Math.min(Ot,Ee.height)-(lt-At));const je=ne.top<_t||ne.bottom>Ot-_t||Math.ceil(He)+Ns<Math.min($e,zt),Fe=(tt.visualViewport?.scale??1)!==1&&YT;if(je||Fe){Se.current=!0,S1(P,Re.current),J(!1);return}const dt=Math.max(zt,He);if(st){const Lt=Math.max(0,Ot-ze);P.style.top=Ee.height>=et?"0":`${Lt}px`,P.style.height=`${He}px`,me.scrollTop=E1(me)}else P.style.bottom="0",me.scrollTop=lt;if(gn){const Lt=Ee.top,qt=Ee.height,Dt=gn.top+gn.height/2,Qt=qt>0?(Dt-Lt)/qt*100:50,xt=Qo(Qt,0,100);Le.style.setProperty("--transform-origin",`50% ${xt}%`)}(dt===Ot||He>=yt)&&(ae.current=!0),N(),Y&&S.state.selectedIndex===null&&S.state.activeIndex===null&&$.current[0]!=null&&S.set("activeIndex",0),Se.current=!0}finally{rt()}},[S,k,P,U,x,_,b,N,I,J,Te,he,Q,te,$,Y,ce,q]),C.useEffect(()=>{if(!I||!P||!k)return;const Le=Zn(P);function rt(ot){R(!1,tn(x9,ot))}return rn(Le,"resize",rt)},[R,I,P,k]);const Qe={...te?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":z||void 0,id:`${L}-list`},onKeyDown(Le){A.current=!0,fe&&o1.has(Le.key)&&Le.stopPropagation()},onMouseMove(){A.current=!1},onScroll(Le){te||Me(Le.currentTarget)},...I&&{style:te?{height:"100%"}:aH}},Ae=Dn("div",a,{ref:[i,b],state:Be,stateAttributesMapping:lH,props:[W,Qe,z2(de),{className:!te&&I?mR.className:void 0},y]});return X.jsxs(C.Fragment,{children:[!K&&mR.getElement(ee),X.jsx(kS,{context:re,modal:!1,disabled:!F,returnFocus:g,restoreFocus:!0,children:Ae})]})});process.env.NODE_ENV!=="production"&&(cM.displayName="SelectPopup");function fM(t){const a=t.maxHeight||"";return a.endsWith("px")&&parseFloat(a)||1/0}function E1(t){return oM(t.scrollHeight,t.clientHeight)}function dM(t){return aA.getScale(t)}function ev(t,a,i){return t/i[a]}function w1(t,a){return Yy({x:ev(t.x,"x",a),y:ev(t.y,"y",a),width:ev(t.width,"x",a),height:ev(t.height,"y",a)})}const pM=[["transform","none"],["scale","1"],["translate","0 0"]];function iH(t){const{style:a}=t,i={};for(const[s,d]of pM)i[s]=a.getPropertyValue(s),a.setProperty(s,d,"important");return()=>{for(const[s]of pM){const d=i[s];d?a.setProperty(s,d):a.removeProperty(s)}}}const bR=C.createContext(void 0);process.env.NODE_ENV!=="production"&&(bR.displayName="SelectItemContext");function SR(){const t=C.useContext(bR);if(!t)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.":vo(57));return t}const hM=C.memo(C.forwardRef(function(a,i){const{render:s,className:d,value:m=null,label:g,disabled:y=!1,nativeButton:S=!1,style:b,...T}=a,R=C.useRef(null),x=S7({label:g,textRef:R,indexGuessBehavior:$A.GuessFromOrder}),{store:_,getItemProps:A,setOpen:z,setValue:N,selectionRef:M,typingRef:$,valuesRef:Y,multiple:Z,selectedItemTextRef:V}=tm(),I=bn(_,Sn.isActive,x.index),q=bn(_,Sn.isSelected,x.index,m),J=bn(_,Sn.isSelectedByFocus,x.index),he=bn(_,Sn.isItemEqualToValue),Q=x.index,fe=Q!==-1,re=C.useRef(null),ce=Fo(Q);ht(()=>{if(!fe)return;const Se=Y.current;return Se[Q]=m,()=>{delete Se[Q]}},[fe,Q,m,Y]),ht(()=>{if(!fe)return;const Se=_.state.value;let Re=Se;Z&&Array.isArray(Se)&&Se.length>0&&(Re=Se[Se.length-1]),Re!==void 0&&Qh(m,Re,he)&&(_.set("selectedIndex",Q),R.current&&(V.current=R.current))},[fe,Q,Z,he,_,m,V]);const ee={disabled:y,selected:q,highlighted:I},K=A({active:I,selected:q});K.id=void 0;const L=C.useRef(null),k=C.useRef("mouse"),F=C.useRef(!1),{getButtonProps:W,buttonRef:de}=Ih({disabled:y,focusableWhenDisabled:!0,native:S,composite:!0});function U(Se){const Re=_.state.value;if(Z){const Te=Array.isArray(Re)?Re:[],Me=q?Y7(Te,m,he):[...Te,m];N(Me,tn(d2,Se))}else N(m,tn(d2,Se)),z(!1,tn(d2,Se))}const P={role:"option","aria-selected":q,tabIndex:I?0:-1,onTouchStart(){M.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(Se){L.current=Se.key,_.set("activeIndex",Q),Se.key===" "&&$.current&&Se.preventDefault()},onClick(Se){F.current=!1,!(Se.type==="keydown"&&L.current===null)&&(y||Se.type==="keydown"&&L.current===" "&&$.current||k.current!=="touch"&&!I||(L.current=null,U(Se.nativeEvent)))},onPointerEnter(Se){k.current=Se.pointerType},onPointerDown(Se){k.current=Se.pointerType,F.current=!0},onMouseUp(){if(y)return;if(F.current){F.current=!1;return}const Se=!M.current.allowSelectedMouseUp&&q,Re=!M.current.allowUnselectedMouseUp&&!q;Se||Re||k.current!=="touch"&&!I||re.current?.click()}},te=Dn("div",a,{ref:[de,i,x.ref,re],state:ee,props:[K,P,T,W]}),ae=C.useMemo(()=>({selected:q,indexRef:ce,textRef:R,selectedByFocus:J,hasRegistered:fe}),[q,ce,R,J,fe]);return X.jsx(bR.Provider,{value:ae,children:te})}));process.env.NODE_ENV!=="production"&&(hM.displayName="SelectItem");const mM=C.forwardRef(function(a,i){const s=a.keepMounted??!1,{selected:d}=SR();return s||d?X.jsx(gM,{...a,ref:i}):null});process.env.NODE_ENV!=="production"&&(mM.displayName="SelectItemIndicator");const gM=C.memo(C.forwardRef((t,a)=>{const{render:i,className:s,style:d,keepMounted:m,...g}=t,{selected:y}=SR(),S=C.useRef(null),{transitionStatus:b,setMounted:T}=$y(y),x=Dn("span",t,{ref:[a,S],state:{selected:y,transitionStatus:b},props:[{"aria-hidden":!0,children:"✔️"},g],stateAttributesMapping:Wl});return ju({open:y,ref:S,onComplete(){y||T(!1)}}),x}));process.env.NODE_ENV!=="production"&&(gM.displayName="Inner");const yM=C.memo(C.forwardRef(function(a,i){const{indexRef:s,textRef:d,selectedByFocus:m,hasRegistered:g}=SR(),{selectedItemTextRef:y}=tm(),{className:S,render:b,style:T,...R}=a,x=C.useCallback(A=>{if(!A||!g)return;const z=y.current===null||!y.current.isConnected;(m||z&&s.current===0)&&(y.current=A)},[y,s,m,g]);return Dn("div",a,{ref:[x,i,d],props:R})}));process.env.NODE_ENV!=="production"&&(yM.displayName="SelectItemText");function rr({as:t,children:a,className:i,disabled:s,...d}){const m=t||"button",g=m==="button";return X.jsx(m,{className:CT("align-middle inline-flex items-center justify-center transition-all cursor-pointer hover:brightness-110 active:brightness-90 active:scale-90 disabled:cursor-not-allowed disabled:grayscale",i),...g?{disabled:s}:{"aria-disabled":s},...s&&!g?{onClick:y=>{y.preventDefault(),y.stopPropagation()}}:{},...d,children:a})}const uH=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),sH=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,i,s)=>s?s.toUpperCase():i.toLowerCase()),vM=t=>{const a=sH(t);return a.charAt(0).toUpperCase()+a.slice(1)},bM=(...t)=>t.filter((a,i,s)=>!!a&&a.trim()!==""&&s.indexOf(a)===i).join(" ").trim(),cH=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var fH={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const dH=C.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:i=2,absoluteStrokeWidth:s,className:d="",children:m,iconNode:g,...y},S)=>C.createElement("svg",{ref:S,...fH,width:a,height:a,stroke:t,strokeWidth:s?Number(i)*24/Number(a):i,className:bM("lucide",d),...!m&&!cH(y)&&{"aria-hidden":"true"},...y},[...g.map(([b,T])=>C.createElement(b,T)),...Array.isArray(m)?m:[m]]));const Us=(t,a)=>{const i=C.forwardRef(({className:s,...d},m)=>C.createElement(dH,{ref:m,iconNode:a,className:bM(`lucide-${uH(vM(t))}`,`lucide-${t}`,s),...d}));return i.displayName=vM(t),i};const ER=Us("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const SM=Us("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const EM=Us("eye-closed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);const wM=Us("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const pH=Us("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const hH=Us("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const mH=Us("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);const gH=Us("user",[["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"}]]);const TM=Us("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function yH(t){return ja.get("/channel/game/role/mail-captcha",t)}function vH(t){return ja.get("/channel/game/role/auth",t)}function bH(t){return ja.post("/passport-api/v2/ztgame/auth/login",{account:t.account,password:t.password,channel_login:1,channel_id:6})}function SH(t){return ja.post("/passport-api/v2/sms-captchas",{mobile:t.mobile,type:t.type||"register",is_voice:0,nationcode:t.countryCode})}function EH(t){return ja.post("/passport-api/v2/ztgame/auth/mobile-register",{mobile:t.mobile,captcha:t.captcha,channel_login:1,channel_id:6,nationcode:t.countryCode,ad_id:""})}function RM(){return ja.post("/passport-api/v2/ztgame/auth/auth",{channel_login:1,channel_id:6})}function wH(t){return ja.post(`/passport-api/v2/ztgame/users/${t.uid}/idcard`,{name:t.name,idcard:t.idcard},{headers:{Authentication:t.authorization}})}function TH(t){return ja.post("/passport-api/v2/ztgame/auth/re-auth",{type:"auth",channel_id:6,ad_id:"",channel_login:1},{headers:{Authentication:t}})}function RH(t){return ja.post("/passport-api/v2/ztgame/user-center/forget-password/",t)}function xH(t){return ja.post("/passport-api/v2/ztgame/user-center/forget-password/sms-captchas",t)}function xM(t){return ja.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-keys",t)}function OH(t){return ja.post("/passport-api/v2/ztgame/user-center/forget-password/forget-password-update",t)}const CH="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAXCAYAAADk3wSdAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFJ0lEQVQ4jW2VW4ydVRXHf2tfvu87Z+5znEtnxnLR0pYJatEHWxhBEZUSCE8YESImRnzwQTEEY6KJGrQJXiFGXzAxaowkSkyoIgjYlEqEIIrSS6KmpTPDdJgz55w5t++29/bhjDQFVrKf9lq/rGSt/3/J+v2XExRQgNsKuJbH9QLFKaE4BWqUu6TCvXhGQsajOD6D4BJfQBCuvvaLLE/uhLTN/8PwVlGCxIJZCJ9XYzwYBEIGdLkztBE8d1rvSJWlbSLw/oJy9UZe8AOAGglfNbt4UE2CSkBikASwfKpE6blOncdndtOauAjy3gWM8516wCGiuFGPyT2Mhw+EQvC9wZ+UEAw4UfXZtBU6cZX7Fm+C4IDwBmgAPHdguEGPy1VqSO0MObhewHc9UgC5gAKXKmpbW3fV8i1/8JovsDyzG5ortxK4DpFzwP1A2yAcUpHciwURCLngOgFVBkIOOPBd/qrWir/MrTV/k6nk2N3v/Rx/uHgJmqvfrqb5l3sioBVofTsi18hrDywGqQ46IQBFwHcCRT1QrrmfDjXaP/TrvNRerrIiM/xq98d4bH6ROK3fV3XlV0QU60azajTOGND6R4YIpAqiAsEDVnB1UM30lonQ/t0/G3t4uXkZqxM1TkztpDmUXP7uzVcO2SA3FVrR0hoEOkrRCAFCGDMScUJX3V6lPCEIrqexsb82quVHnji6xJ9PH8Bbtc9G2f4dW42PznbDzc5qerGlnURURMidEPT2sIw5bFTMYVMp94rxEASfyananu6RI0/t49G/f4gdMxu/jExxm/QF1fMURtEdshRKMSo5GZa1OKJlDVSSc1STx4wedi/paomKPMELSfAv9NKY5569jNGk89nIFLeFIAQFISiMC9jCMZzlHJ+cfPn5uem9G6AQBdXkReKoacxw0TDDHhWX4BQqLjY3z4zTaVapVLODIch5YchAHNa7rJ4k1//pit3LRRT9h9a2RCvJJtai7JgbN1ObqOlzqJlzMJxPjF7cZnSkT78V/1Hk/GJLgKBlKyqLfUcX33m0mJu9lLIU4giSGOJ4gjhG2Zn6uxhvk+kqfRvDWPdKc8UrfPgTz+E2R34cUvMwKhAEvOL0Rcud95+pLZw4eeB94N2VGAtRNHjW7qOajBlG+gcb3QXq3XHaZUzFdvfOmY2r5JNnjw39+2/Iz3Z9vGbCDyTORyr94ul/LEbFr+8YhWoLmvJpbDSQqggYPUsSf0TSjYmw0p6nnlnqmWUji8Frp4bzm1eS7PfHf3sJ5eMLjHQtJ/eUPH39GAzNvI2txUdIZ66mtzVwKQGshaHqz00ImsxruqWmkRleS4W1VOvQqBz2OvnJ2aW1B55cXD1BfQqG50fpRbdTn/oG0UQNayC24MIAGllQqiO+FX13pXnp3Sebk5zuaZZ7hvVU86+e5vlMcIWjwDxJmG3i3/5B9PwkageoKWAanAKXDUzCmrMovWRE5V+aH//vcaS8oe+n97/at3ObheLFAtK+h7wCevo6dA10ddsjuxASEAW6UqLNMSR6BpHv4GkaPIjJH1oYXn+onY1E3UJuXE3VPb0tvZ9Cg66A0oNz4FNQMfg20Gkj5lvI+C9Qc8vI1GCJX3d+D6mzlEHy2PhH3lF1B95T8d9ECYQAFBByCH3wLXBnnsWd2QP9Q6CXt+X2Fs6/7Xy5F4oAOyxfQ/sGRfa919NCAX75GVBLmF1AzGBCF8abDp8ARuDVnoJMvo/JSrz/OpIaKJ7CN25Batul4U1AgP8BRjZPP9WeeTQAAAAASUVORK5CYII=";function _H(t){return X.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 500 500",...t,children:[X.jsx("path",{fill:"url(#a)",d:"M0 250C0 111.929 111.929 0 250 0s250 111.929 250 250-111.929 250-250 250S0 388.071 0 250Z"}),X.jsx("path",{fill:"#fff",d:"M159.432 341h-33.008V158.949h33.008V341Zm220.263-76.172c0 11.087-1.946 21.286-5.84 30.596-3.808 9.31-9.098 17.35-15.869 24.121-6.771 6.686-14.811 11.934-24.121 15.742-9.31 3.809-19.424 5.713-30.342 5.713h-89.121c-2.369 0-4.57-.423-6.601-1.27-2.031-.846-3.809-1.988-5.332-3.427-1.439-1.524-2.582-3.301-3.428-5.332-.846-2.032-1.27-4.232-1.27-6.602V175.58c0-2.285.424-4.443 1.27-6.475.846-2.031 1.989-3.808 3.428-5.332a16.354 16.354 0 0 1 5.332-3.554c2.031-.847 4.232-1.27 6.601-1.27h89.121c10.918 0 21.032 1.905 30.342 5.713 9.31 3.809 17.35 9.098 24.121 15.869 6.771 6.686 12.061 14.727 15.869 24.121 3.894 9.31 5.84 19.466 5.84 30.469v29.707Zm-33.007-29.707c0-6.432-1.058-12.314-3.174-17.646-2.032-5.332-4.952-9.86-8.76-13.584-3.809-3.809-8.379-6.729-13.711-8.76-5.247-2.116-11.087-3.174-17.52-3.174h-72.744v116.035h72.744c6.433 0 12.273-1.015 17.52-3.047 5.332-2.116 9.902-5.035 13.711-8.759 3.808-3.809 6.728-8.337 8.76-13.584 2.116-5.332 3.174-11.257 3.174-17.774v-29.707Z"}),X.jsx("defs",{children:X.jsxs("linearGradient",{id:"a",x1:250,x2:250,y1:0,y2:500,gradientUnits:"userSpaceOnUse",children:[X.jsx("stop",{stopColor:"#497EFE"}),X.jsx("stop",{offset:1,stopColor:"#947AFA"})]})})]})}function T1(){const{gameId:t,loginTypes:a,currentLoginType:i,setCurrentLoginType:s}=As(),d=jA({loginTypes:a,gameId:t}),m=LA({loginTypes:a,gameId:t}),g=UA({loginTypes:a,gameId:t}),y=[];return g&&i!==eo.GIANT&&y.push({type:eo.GIANT,label:t==="5327"?"账号密码登录":"巨人账号",icon:t==="5327"?null:X.jsx("img",{className:"size-4",src:CH})}),m&&i!==eo.MOBILE&&y.push({type:eo.MOBILE,label:"手机号登录",icon:X.jsx(pH,{className:"size-4"})}),d&&i!==eo.ROLE_ID&&y.push({type:eo.ROLE_ID,label:"ID 登录",icon:X.jsx(_H,{className:"size-4"})}),i!=="quick"&&Fh(t).length>0&&y.push({type:"quick",label:"快捷登录",icon:X.jsx(gH,{className:"size-4"})}),y.length?X.jsx("div",{className:"text-gray-500 text-xs flex justify-center items-center gap-2 mb-4",children:y.map((S,b)=>X.jsxs(rr,{className:"h-7 px-3 border rounded-full border-gray-300 gap-1.5",onClick:()=>s(S.type),children:[S.icon,X.jsx("span",{children:S.label})]},S.type))}):null}function AH(t){return X.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 90 90",fill:"currentColor",...t,children:X.jsx("path",{d:"M41.415 1.601c6.427-2.244 13.363 2.04 14.18 8.773.611 5.508-2.959 10.609-8.365 11.833-.408.102-.918.203-1.326.305-.918.204-1.735.409-2.653.613-.306.102-.714.204-1.122.306h-.101c-.816.306-1.633.51-2.448.816-.306.102-.715.306-1.021.408l-2.754 1.223c-.408.103-.714.307-1.02.511-1.224.612-2.346 1.326-3.468 2.142l-.307.306c-.612.409-1.122.919-1.632 1.327-.51.408-1.02.816-1.53 1.326-.408.306-.714.713-1.122 1.02-.408.407-.816.918-1.326 1.428-.306.612-.409 1.224-.612 1.836-.204 1.122-.51 2.143-.714 3.265-.204 1.02-.408 2.04-.51 3.06 0 .611-.103 1.122-.103 1.734v1.632c0 1.02 0 1.938.103 2.958.102 1.02.306 2.143.51 3.163.204.816.408 1.733.612 2.55.204.816.408 1.53.612 2.346.102.306.204.51.408.714.51.612 1.122 1.122 1.632 1.734 1.02.918 2.04 1.836 3.162 2.754.816.612 1.734 1.224 2.55 1.836.51.306.919.612 1.429.918.102 0 .204 0 .204.103.204 0 .306.102.51.204.408.204.714.408 1.122.612.918.408 1.734.714 2.652 1.122.714.204 1.326.51 2.04.714 1.122.306 2.143.612 3.265.918.51.204 1.122.204 1.632 0 .306-.102.51-.102.816-.204.816-.204 1.53-.51 2.346-.714 1.53-.408 2.958-1.02 4.386-1.633h.102c.816-.408 1.735-.815 2.55-1.325.307-.204.714-.408 1.02-.612 1.02-.714 2.04-1.428 3.06-2.244.613-.51 1.123-1.02 1.735-1.53l2.142-2.143c.408-.408.714-.816.816-1.428 0-.102.103-.102.103-.204.306-1.02.611-2.142.815-3.162.306-1.326.612-2.755.714-4.183v-.204c.102-1.224.103-2.448.103-3.672-.102-.816-.102-1.53-.204-2.346 0-.102 0-.204-.102-.205-.918.408-1.735.715-2.55 1.225-1.633.918-3.061 1.938-4.489 3.06-.102.101-.204.102-.306.204-1.02.918-1.938 1.734-2.856 2.652-1.02 1.02-2.041 2.04-2.96 3.162-1.937 2.244-4.487 3.469-7.445 3.673-5.713.306-10.61-3.673-11.324-9.283-.816-5.61 2.959-10.813 8.467-11.935a52.639 52.639 0 0 0 7.856-2.142h.101c.816-.408 1.734-.715 2.55-1.122 3.264-1.53 6.121-3.672 8.773-6.12 1.327-1.327 2.652-2.653 3.876-4.082 2.347-2.55 5.305-3.774 8.773-3.57 5.1.306 9.283 4.285 9.895 9.283.204 1.53.102 3.06-.408 4.489-.612 1.938-1.224 3.876-1.734 5.916-.102 1.02-.408 1.939-.51 2.958-.408 2.449-.51 4.795-.306 7.141v.306c.102.816.204 1.53.306 2.347a46.28 46.28 0 0 0 1.224 5.406c.102 0 .102.102.102.204.51 1.632 1.224 3.264 1.224 4.794.306 3.162-.51 5.917-2.55 8.365-1.632 1.938-3.774 3.06-6.223 3.57-1.734.408-3.57.817-5.304 1.326-.102.102-.204.102-.306.102-1.836.612-3.775 1.326-5.509 2.244h-.101c-.918.408-1.735.919-2.551 1.429-.306.204-.714.51-1.02.714a30.738 30.738 0 0 0-2.856 2.244c-.816.714-1.633 1.53-2.347 2.244a.22.22 0 0 1-.204.204c-.918.918-1.734 1.836-2.55 2.754-2.346 2.55-5.202 3.877-8.67 3.775-3.06-.102-5.61-1.428-7.651-3.672-1.428-1.633-2.958-3.163-4.488-4.591v-.102c-.51-.408-1.02-.918-1.53-1.326-.715-.612-1.53-1.122-2.245-1.734l-1.53-.918c-.612-.306-1.122-.612-1.734-.918l-2.754-1.225c-1.326-.612-2.653-1.02-4.081-1.428-1.326-.407-2.652-.714-3.978-1.02a11.146 11.146 0 0 1-3.673-1.224c-3.264-1.734-5.1-4.489-5.61-8.16-.204-1.633 0-3.265.51-4.795.816-2.244 1.428-4.59 1.938-6.936.102-.102.102-.103.102-.204.102-.715.204-1.531.306-2.347.102-.714.205-1.428.205-2.142V43.63l-.087-.956a39.328 39.328 0 0 0-1.24-6.695c-.102-.102-.102-.205-.102-.306-.51-1.734-1.224-3.469-1.53-5.203-1.122-5.712 2.55-11.22 8.263-12.445.714-.204 1.53-.306 2.244-.51 1.224-.306 2.55-.612 3.775-1.02 1.224-.408 2.448-.816 3.672-1.326l1.223-.612c.918-.408 1.837-.918 2.755-1.428 1.122-.714 2.244-1.53 3.366-2.346.408-.306.715-.612 1.122-.918.408-.408.918-.918 1.428-1.326a40.49 40.49 0 0 0 2.96-2.96c1.53-1.835 3.161-3.16 5.405-3.977Z"})})}function DH(t){return X.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",fill:"currentColor",...t,children:X.jsx("path",{d:"M842.667 384H768V277.333a234.667 234.667 0 1 0-469.333 0V384H224a53.393 53.393 0 0 0-53.333 53.333V928A53.393 53.393 0 0 0 224 981.333h618.667A53.393 53.393 0 0 0 896 928V437.333A53.393 53.393 0 0 0 842.667 384zm-288 295.007v110.326a21.333 21.333 0 0 1-42.667 0V679.007a64 64 0 1 1 42.667 0zM725.333 384h-384V277.333c0-105.866 86.134-192 192-192s192 86.134 192 192z"})})}var wR,OM;function MH(){if(OM)return wR;OM=1;var t="Expected a function",a=NaN,i="[object Symbol]",s=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,m=/^0b[01]+$/i,g=/^0o[0-7]+$/i,y=parseInt,S=typeof Qb=="object"&&Qb&&Qb.Object===Object&&Qb,b=typeof self=="object"&&self&&self.Object===Object&&self,T=S||b||Function("return this")(),R=Object.prototype,x=R.toString,_=Math.max,A=Math.min,z=function(){return T.Date.now()};function N(V,I,q){var J,he,Q,fe,re,ce,ee=0,K=!1,L=!1,k=!0;if(typeof V!="function")throw new TypeError(t);I=Z(I)||0,M(q)&&(K=!!q.leading,L="maxWait"in q,Q=L?_(Z(q.maxWait)||0,I):Q,k="trailing"in q?!!q.trailing:k);function F(Te){var Me=J,Be=he;return J=he=void 0,ee=Te,fe=V.apply(Be,Me),fe}function W(Te){return ee=Te,re=setTimeout(P,I),K?F(Te):fe}function de(Te){var Me=Te-ce,Be=Te-ee,Qe=I-Me;return L?A(Qe,Q-Be):Qe}function U(Te){var Me=Te-ce,Be=Te-ee;return ce===void 0||Me>=I||Me<0||L&&Be>=Q}function P(){var Te=z();if(U(Te))return te(Te);re=setTimeout(P,de(Te))}function te(Te){return re=void 0,k&&J?F(Te):(J=he=void 0,fe)}function ae(){re!==void 0&&clearTimeout(re),ee=0,J=ce=he=re=void 0}function Se(){return re===void 0?fe:te(z())}function Re(){var Te=z(),Me=U(Te);if(J=arguments,he=this,ce=Te,Me){if(re===void 0)return W(ce);if(L)return re=setTimeout(P,I),F(ce)}return re===void 0&&(re=setTimeout(P,I)),fe}return Re.cancel=ae,Re.flush=Se,Re}function M(V){var I=typeof V;return!!V&&(I=="object"||I=="function")}function $(V){return!!V&&typeof V=="object"}function Y(V){return typeof V=="symbol"||$(V)&&x.call(V)==i}function Z(V){if(typeof V=="number")return V;if(Y(V))return a;if(M(V)){var I=typeof V.valueOf=="function"?V.valueOf():V;V=M(I)?I+"":I}if(typeof V!="string")return V===0?V:+V;V=V.replace(s,"");var q=m.test(V);return q||g.test(V)?y(V.slice(2),q?2:8):d.test(V)?a:+V}return wR=N,wR}MH();function zH(t=!1){if(typeof t!="boolean")throw new Error("defaultValue must be `true` or `false`");const[a,i]=C.useState(t),s=C.useCallback(()=>{i(!0)},[]),d=C.useCallback(()=>{i(!1)},[]),m=C.useCallback(()=>{i(g=>!g)},[]);return{value:a,setValue:i,setTrue:s,setFalse:d,toggle:m}}var CM=typeof window<"u"?C.useLayoutEffect:C.useEffect;function NH(t){const[a,i]=C.useState(t),s=C.useCallback(()=>{i(g=>g+1)},[]),d=C.useCallback(()=>{i(g=>g-1)},[]),m=C.useCallback(()=>{i(t)},[t]);return{count:a,increment:s,decrement:d,reset:m,setCount:i}}function UH(t,a){const i=C.useRef(t);CM(()=>{i.current=t},[t]),C.useEffect(()=>{if(a===null)return;const s=setInterval(()=>{i.current()},a);return()=>{clearInterval(s)}},[a])}function jH({countStart:t,countStop:a=0,intervalMs:i=1e3,isIncrement:s=!1}){const{count:d,increment:m,decrement:g,reset:y}=NH(t),{value:S,setTrue:b,setFalse:T}=zH(!1),R=C.useCallback(()=>{T(),y()},[T,y]),x=C.useCallback(()=>{if(d===a){T();return}s?m():g()},[d,a,g,m,s,T]);return UH(x,S?i:null),[d,{startCountdown:b,stopCountdown:T,resetCountdown:R}]}var LH=typeof window>"u";function HH(t,{defaultValue:a=!1,initializeWithValue:i=!0}={}){const s=y=>LH?a:window.matchMedia(y).matches,[d,m]=C.useState(()=>i?s(t):a);function g(){m(s(t))}return CM(()=>{const y=window.matchMedia(t);return g(),y.addListener?y.addListener(g):y.addEventListener("change",g),()=>{y.removeListener?y.removeListener(g):y.removeEventListener("change",g)}},[t]),d}function _M({trigger:t,title:a,description:i,children:s,open:d,showCloseIcon:m=!0,onOpenChange:g,zIndex:y,classNames:S}){return HH("(min-width: 1024px)")?X.jsxs(k2,{open:d,onOpenChange:g,disablePointerDismissal:!0,children:[t&&X.jsx(s1,{className:S?.trigger,children:t}),X.jsxs(i1,{children:[X.jsx(B2,{style:{zIndex:y},className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm"}),X.jsxs(I2,{style:{zIndex:y},className:kd("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[991]",S?.desktopPopup),children:[a&&X.jsx(u1,{className:kd("-mt-1.5 mb-1 text-lg font-medium",S?.title),children:a}),i&&X.jsx(G2,{className:kd("mb-6 text-base text-gray-600",S?.description),children:i}),m&&X.jsx(Y2,{className:"absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",children:X.jsx(TM,{})}),X.jsx("div",{children:s})]})]})]}):X.jsxs(mL,{open:d,onOpenChange:g,children:[t&&X.jsx(_L,{className:S?.trigger,children:t}),X.jsxs(hL,{children:[X.jsx(hD,{style:{zIndex:y},className:kd("fixed inset-0 bg-black/70 transition-opacity duration-300 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",S?.backdrop)}),X.jsx(ND,{style:{zIndex:y},className:"fixed inset-0 z-[991]",children:X.jsx(wD,{className:kd("fixed bottom-0 left-0 right-0 rounded-t-xl bg-white p-4 transition-transform duration-300 data-[starting-style]:translate-y-full data-[ending-style]:translate-y-full","[transform:translateY(var(--drawer-swipe-movement-y))]",S?.mobilePopup),children:X.jsxs(gD,{children:[X.jsx("div",{"aria-hidden":!0,className:"mx-auto w-12 h-1.5 flex-shrink-0 rounded-full bg-gray-300 mb-4"}),X.jsx(CL,{className:"sr-only",children:a}),X.jsx("div",{children:s})]})})})]})]})}function AM({checked:t,onChange:a}){const[i,s]=C.useState(!1),[d,m]=C.useState(!1);return X.jsxs("div",{children:[X.jsx(_M,{title:"用户协议",open:i,onOpenChange:s,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:X.jsx("iframe",{src:"https://www.gatribe.com/license-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),X.jsx(_M,{title:"隐私政策",open:d,onOpenChange:m,zIndex:993,classNames:{desktopPopup:"w-[90vw] lg:w-[60vw]"},children:X.jsx("iframe",{src:"https://www.gatribe.com/privacy-light.html?channel_id=1&game_id=5327",className:"w-full h-[70vh]"})}),X.jsx(em,{name:"rememberLogin",children:X.jsxs(cR,{className:"flex items-center justify-center text-gray-500 text-xs md:text-sm",children:[X.jsx(W2,{checked:t,className:"size-4 md:size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-[var(--jssdk-input-border-color)]",onCheckedChange:g=>a(!!g),children:X.jsx(eR,{children:X.jsx(ER,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),X.jsx("span",{className:"ml-2 text-xs md:text-sm",children:"我已详细阅读并同意"}),X.jsx(rr,{className:"text-[var(--jssdk-primary-color)] text-xs md:text-sm",onClick:()=>s(!0),type:"button",children:"《用户协议》"}),X.jsx("span",{children:"及"}),X.jsx(rr,{className:"text-[var(--jssdk-primary-color)] text-xs md:text-sm",onClick:()=>m(!0),type:"button",children:"《隐私政策》"})]})})]})}function tv({trigger:t,title:a,description:i,children:s,open:d,showCloseIcon:m=!0,onOpenChange:g,disablePointerDismissal:y=!1,classNames:S}){return X.jsxs(k2,{open:d,onOpenChange:g,disablePointerDismissal:y,children:[t&&X.jsx(s1,{className:S?.trigger,children:t}),X.jsxs(i1,{children:[X.jsx(B2,{className:"fixed inset-0 bg-black/70 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:opacity-70 z-[990] backdrop-blur-sm",forceRender:!0}),X.jsxs(I2,{className:ha("fixed top-1/2 left-1/2 w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg bg-gray-50 p-4 text-gray-900 transition-all duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 z-[990]",S?.popup),children:[a&&X.jsx(u1,{className:ha("-mt-1.5 mb-1 text-lg font-medium",S?.title),children:a}),i&&X.jsx(G2,{className:ha("mb-6 text-base text-gray-600",S?.description),children:i}),m&&X.jsx(Y2,{className:ha("absolute right-4 top-4 text-gray-700 hover:bg-gray-200 rounded p-0.5",S?.close),children:X.jsx(TM,{})}),X.jsx("div",{children:s})]})]})]})}function Hu({name:t,prefix:a,suffix:i,className:s,inputClassName:d,error:m,...g}){return X.jsxs(em,{name:t,className:"group",children:[X.jsxs("div",{className:ha("flex items-center border border-[var(--jssdk-input-border-color)] group-data-[focused]:border-[var(--jssdk-primary-color)] group-data-[focused]:shadow-[0_0_6px_color-mix(in_srgb,var(--jssdk-primary-color),transparent_80%)] rounded-full bg-white px-3 gap-2 h-12 transition-all duration-200",m&&"border-red-500",s),children:[a,X.jsx(y1,{className:ha("flex-1 w-0 outline-none rounded-full h-full pl-1",d),...g}),i]}),X.jsx(g1,{className:"text-red-500 text-xs mt-1 ml-3"})]})}function VH({account:t,forgetPasswordKey:a,onSuccess:i}){const[s,d]=C.useState(""),[m,g]=C.useState(!1),{mutate:y,isPending:S}=Zi({mutationFn:()=>OH({account:t,forget_password_key:a,password:s}),onSuccess:T=>{T?.code===0||!T?.error?i():Uo.warning(T.detail||T.error||"重置失败")}}),b=()=>{if(!s){Uo.warning("请输入新密码");return}if(s.length<6||s.length>18){Uo.warning("密码长度需要在6-18位之间");return}y()};return X.jsxs("div",{className:"space-y-4",children:[X.jsx("div",{className:"text-sm text-gray-500 mb-4 text-center",children:"请设置新的登录密码"}),X.jsx(Hu,{name:"password",type:m?"text":"password",autoComplete:"off",inputClassName:"placeholder:text-sm",placeholder:"请输入6-18位由数字、字母组成的密码",value:s,autoFocus:!0,onValueChange:T=>d(T),suffix:X.jsx(rr,{onClick:()=>g(!m),type:"button",children:m?X.jsx(wM,{className:"size-5 text-gray-400"}):X.jsx(EM,{className:"size-5 text-gray-400"})})}),X.jsx(rr,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:b,disabled:!s||S,children:S?"重置中...":"确定修改"})]})}var kH=function(t){return typeof t=="number"};function BH(t){var a=C.useRef(t);return a.current=t,a}var R1={exports:{}},YH=R1.exports,DM;function GH(){return DM||(DM=1,(function(t,a){(function(i,s){t.exports=s()})(YH,(function(){var i=1e3,s=6e4,d=36e5,m="millisecond",g="second",y="minute",S="hour",b="day",T="week",R="month",x="quarter",_="year",A="date",z="Invalid Date",N=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,M=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,$={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(ee){var K=["th","st","nd","rd"],L=ee%100;return"["+ee+(K[(L-20)%10]||K[L]||K[0])+"]"}},Y=function(ee,K,L){var k=String(ee);return!k||k.length>=K?ee:""+Array(K+1-k.length).join(L)+ee},Z={s:Y,z:function(ee){var K=-ee.utcOffset(),L=Math.abs(K),k=Math.floor(L/60),F=L%60;return(K<=0?"+":"-")+Y(k,2,"0")+":"+Y(F,2,"0")},m:function ee(K,L){if(K.date()<L.date())return-ee(L,K);var k=12*(L.year()-K.year())+(L.month()-K.month()),F=K.clone().add(k,R),W=L-F<0,de=K.clone().add(k+(W?-1:1),R);return+(-(k+(L-F)/(W?F-de:de-F))||0)},a:function(ee){return ee<0?Math.ceil(ee)||0:Math.floor(ee)},p:function(ee){return{M:R,y:_,w:T,d:b,D:A,h:S,m:y,s:g,ms:m,Q:x}[ee]||String(ee||"").toLowerCase().replace(/s$/,"")},u:function(ee){return ee===void 0}},V="en",I={};I[V]=$;var q="$isDayjsObject",J=function(ee){return ee instanceof re||!(!ee||!ee[q])},he=function ee(K,L,k){var F;if(!K)return V;if(typeof K=="string"){var W=K.toLowerCase();I[W]&&(F=W),L&&(I[W]=L,F=W);var de=K.split("-");if(!F&&de.length>1)return ee(de[0])}else{var U=K.name;I[U]=K,F=U}return!k&&F&&(V=F),F||!k&&V},Q=function(ee,K){if(J(ee))return ee.clone();var L=typeof K=="object"?K:{};return L.date=ee,L.args=arguments,new re(L)},fe=Z;fe.l=he,fe.i=J,fe.w=function(ee,K){return Q(ee,{locale:K.$L,utc:K.$u,x:K.$x,$offset:K.$offset})};var re=(function(){function ee(L){this.$L=he(L.locale,null,!0),this.parse(L),this.$x=this.$x||L.x||{},this[q]=!0}var K=ee.prototype;return K.parse=function(L){this.$d=(function(k){var F=k.date,W=k.utc;if(F===null)return new Date(NaN);if(fe.u(F))return new Date;if(F instanceof Date)return new Date(F);if(typeof F=="string"&&!/Z$/i.test(F)){var de=F.match(N);if(de){var U=de[2]-1||0,P=(de[7]||"0").substring(0,3);return W?new Date(Date.UTC(de[1],U,de[3]||1,de[4]||0,de[5]||0,de[6]||0,P)):new Date(de[1],U,de[3]||1,de[4]||0,de[5]||0,de[6]||0,P)}}return new Date(F)})(L),this.init()},K.init=function(){var L=this.$d;this.$y=L.getFullYear(),this.$M=L.getMonth(),this.$D=L.getDate(),this.$W=L.getDay(),this.$H=L.getHours(),this.$m=L.getMinutes(),this.$s=L.getSeconds(),this.$ms=L.getMilliseconds()},K.$utils=function(){return fe},K.isValid=function(){return this.$d.toString()!==z},K.isSame=function(L,k){var F=Q(L);return this.startOf(k)<=F&&F<=this.endOf(k)},K.isAfter=function(L,k){return Q(L)<this.startOf(k)},K.isBefore=function(L,k){return this.endOf(k)<Q(L)},K.$g=function(L,k,F){return fe.u(L)?this[k]:this.set(F,L)},K.unix=function(){return Math.floor(this.valueOf()/1e3)},K.valueOf=function(){return this.$d.getTime()},K.startOf=function(L,k){var F=this,W=!!fe.u(k)||k,de=fe.p(L),U=function(Be,Qe){var Ae=fe.w(F.$u?Date.UTC(F.$y,Qe,Be):new Date(F.$y,Qe,Be),F);return W?Ae:Ae.endOf(b)},P=function(Be,Qe){return fe.w(F.toDate()[Be].apply(F.toDate("s"),(W?[0,0,0,0]:[23,59,59,999]).slice(Qe)),F)},te=this.$W,ae=this.$M,Se=this.$D,Re="set"+(this.$u?"UTC":"");switch(de){case _:return W?U(1,0):U(31,11);case R:return W?U(1,ae):U(0,ae+1);case T:var Te=this.$locale().weekStart||0,Me=(te<Te?te+7:te)-Te;return U(W?Se-Me:Se+(6-Me),ae);case b:case A:return P(Re+"Hours",0);case S:return P(Re+"Minutes",1);case y:return P(Re+"Seconds",2);case g:return P(Re+"Milliseconds",3);default:return this.clone()}},K.endOf=function(L){return this.startOf(L,!1)},K.$set=function(L,k){var F,W=fe.p(L),de="set"+(this.$u?"UTC":""),U=(F={},F[b]=de+"Date",F[A]=de+"Date",F[R]=de+"Month",F[_]=de+"FullYear",F[S]=de+"Hours",F[y]=de+"Minutes",F[g]=de+"Seconds",F[m]=de+"Milliseconds",F)[W],P=W===b?this.$D+(k-this.$W):k;if(W===R||W===_){var te=this.clone().set(A,1);te.$d[U](P),te.init(),this.$d=te.set(A,Math.min(this.$D,te.daysInMonth())).$d}else U&&this.$d[U](P);return this.init(),this},K.set=function(L,k){return this.clone().$set(L,k)},K.get=function(L){return this[fe.p(L)]()},K.add=function(L,k){var F,W=this;L=Number(L);var de=fe.p(k),U=function(ae){var Se=Q(W);return fe.w(Se.date(Se.date()+Math.round(ae*L)),W)};if(de===R)return this.set(R,this.$M+L);if(de===_)return this.set(_,this.$y+L);if(de===b)return U(1);if(de===T)return U(7);var P=(F={},F[y]=s,F[S]=d,F[g]=i,F)[de]||1,te=this.$d.getTime()+L*P;return fe.w(te,this)},K.subtract=function(L,k){return this.add(-1*L,k)},K.format=function(L){var k=this,F=this.$locale();if(!this.isValid())return F.invalidDate||z;var W=L||"YYYY-MM-DDTHH:mm:ssZ",de=fe.z(this),U=this.$H,P=this.$m,te=this.$M,ae=F.weekdays,Se=F.months,Re=F.meridiem,Te=function(Qe,Ae,Le,rt){return Qe&&(Qe[Ae]||Qe(k,W))||Le[Ae].slice(0,rt)},Me=function(Qe){return fe.s(U%12||12,Qe,"0")},Be=Re||function(Qe,Ae,Le){var rt=Qe<12?"AM":"PM";return Le?rt.toLowerCase():rt};return W.replace(M,(function(Qe,Ae){return Ae||(function(Le){switch(Le){case"YY":return String(k.$y).slice(-2);case"YYYY":return fe.s(k.$y,4,"0");case"M":return te+1;case"MM":return fe.s(te+1,2,"0");case"MMM":return Te(F.monthsShort,te,Se,3);case"MMMM":return Te(Se,te);case"D":return k.$D;case"DD":return fe.s(k.$D,2,"0");case"d":return String(k.$W);case"dd":return Te(F.weekdaysMin,k.$W,ae,2);case"ddd":return Te(F.weekdaysShort,k.$W,ae,3);case"dddd":return ae[k.$W];case"H":return String(U);case"HH":return fe.s(U,2,"0");case"h":return Me(1);case"hh":return Me(2);case"a":return Be(U,P,!0);case"A":return Be(U,P,!1);case"m":return String(P);case"mm":return fe.s(P,2,"0");case"s":return String(k.$s);case"ss":return fe.s(k.$s,2,"0");case"SSS":return fe.s(k.$ms,3,"0");case"Z":return de}return null})(Qe)||de.replace(":","")}))},K.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},K.diff=function(L,k,F){var W,de=this,U=fe.p(k),P=Q(L),te=(P.utcOffset()-this.utcOffset())*s,ae=this-P,Se=function(){return fe.m(de,P)};switch(U){case _:W=Se()/12;break;case R:W=Se();break;case x:W=Se()/3;break;case T:W=(ae-te)/6048e5;break;case b:W=(ae-te)/864e5;break;case S:W=ae/d;break;case y:W=ae/s;break;case g:W=ae/i;break;default:W=ae}return F?W:fe.a(W)},K.daysInMonth=function(){return this.endOf(R).$D},K.$locale=function(){return I[this.$L]},K.locale=function(L,k){if(!L)return this.$L;var F=this.clone(),W=he(L,k,!0);return W&&(F.$L=W),F},K.clone=function(){return fe.w(this.$d,this)},K.toDate=function(){return new Date(this.valueOf())},K.toJSON=function(){return this.isValid()?this.toISOString():null},K.toISOString=function(){return this.$d.toISOString()},K.toString=function(){return this.$d.toUTCString()},ee})(),ce=re.prototype;return Q.prototype=ce,[["$ms",m],["$s",g],["$m",y],["$H",S],["$W",b],["$M",R],["$y",_],["$D",A]].forEach((function(ee){ce[ee[1]]=function(K){return this.$g(K,ee[0],ee[1])}})),Q.extend=function(ee,K){return ee.$i||(ee(K,re,Q),ee.$i=!0),Q},Q.locale=he,Q.isDayjs=J,Q.unix=function(ee){return Q(1e3*ee)},Q.en=I[V],Q.Ls=I,Q.p={},Q}))})(R1)),R1.exports}var qH=GH();const ZH=lT(qH);var TR=function(t){if(!t)return 0;var a=ZH(t).valueOf()-Date.now();return a<0?0:a},IH=function(t){return{days:Math.floor(t/864e5),hours:Math.floor(t/36e5)%24,minutes:Math.floor(t/6e4)%60,seconds:Math.floor(t/1e3)%60,milliseconds:Math.floor(t)%1e3}},MM=function(t){t===void 0&&(t={});var a=t||{},i=a.leftTime,s=a.targetDate,d=a.interval,m=d===void 0?1e3:d,g=a.onEnd,y=C.useMemo(function(){return kH(i)&&i>0?Date.now()+i:void 0},[i]),S="leftTime"in t?y:s,b=_N(C.useState(function(){return TR(S)}),2),T=b[0],R=b[1],x=BH(g);C.useEffect(function(){if(!S){R(0);return}R(TR(S));var A=setInterval(function(){var z,N=TR(S);R(N),N===0&&(clearInterval(A),(z=x.current)===null||z===void 0||z.call(x))},m);return function(){return clearInterval(A)}},[S,m]);var _=C.useMemo(function(){return IH(T)},[T]);return[T,_]};function $H({account:t,mobile:a,onNext:i}){const[s,d]=C.useState(""),[m,g]=C.useState(),[y]=MM({leftTime:m?m*1e3:void 0,interval:1e3,onEnd(){g(void 0)}}),{mutate:S,isPending:b}=Zi({mutationFn:()=>xH({account:t,type:"reset-password",is_voice:0,t:"ctoken"}),onSuccess:_=>{g(_.lock_time),Uo.success("验证码已发送,请注意查收")}}),{mutate:T,isPending:R}=Zi({mutationFn:()=>xM({account:t,captcha:s,t:"reset-password"}),onSuccess:_=>{_?.forget_password_key?i(_.forget_password_key):Uo.warning("安全验证失败")},onError:_=>{Uo.warning(_?.message||_?.detail||"验证失败")}}),x=()=>{if(!s){Uo.warning("请输入验证码");return}T()};return X.jsxs("div",{className:"space-y-4",children:[X.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",X.jsx("br",{}),"请输入验证码,短信将发送至您的绑定手机"," ",X.jsx("span",{className:"font-semibold text-gray-700",children:a})]}),X.jsx(Hu,{name:"verificationCode",placeholder:"请输入验证码",value:s,type:"number",autoFocus:!0,onValueChange:_=>d(_),suffix:X.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>S(),disabled:!!m||b,children:b?"发送中...":m?`${Math.round(y/1e3)}s 后重新获取`:"获取验证码"})}),X.jsx(rr,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:x,disabled:R,children:R?"验证中...":"下一步"})]})}function XH({account:t,onNext:a}){const[i,s]=C.useState(""),{mutate:d,isPending:m}=Zi({mutationFn:()=>xM({account:t,idcard:i,t:"reset-password"}),onSuccess:y=>{y?.forget_password_key?a(y.forget_password_key):Uo.warning("安全验证失败")}}),g=()=>{if(!i){Uo.warning("请输入身份证号");return}d()};return X.jsxs("div",{className:"space-y-4",children:[X.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",X.jsx("br",{}),"该账号未绑定手机,请输入注册时填写的身份证信息"]}),X.jsx(Hu,{name:"idCard",placeholder:"请输入身份证号",value:i,autoFocus:!0,onChange:y=>s(y.currentTarget.value)}),X.jsx(rr,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:g,disabled:m,children:m?"验证中...":"下一步"})]})}function PH({onClose:t,defaultAccount:a=""}){const[i,s]=C.useState("account"),[d,m]=C.useState(a),[g,y]=C.useState(""),[S,b]=C.useState(2),[T,R]=C.useState(""),x=C.useRef(null);C.useEffect(()=>{if(!window.captchaZtgame){const M=document.createElement("script");M.type="text/javascript",M.src=`//nocaptcha.ztgame.com/static/verify2023/js/captcha.js?t=${new Date().getTime()}`,M.id="captchaZtgameScript",document.body.appendChild(M)}},[]);const{mutate:_,isPending:A}=Zi({mutationFn:async M=>RH({account:d,nonce:M.nonce,token:M.token,type:M.type,t:"ctoken"}),onSuccess:M=>{const $=M.type;b($),y($===2?M.mobile:""),s("secure"),x.current?.onRefresh?.()},onError:M=>{Uo.warning(M?.message||M?.detail||"验证失败"),x.current?.onRefresh?.()}}),z=()=>{if(!d){Uo.warning("请输入账号信息");return}window.captchaZtgame?window.captchaZtgame.init({appsceneid:"pt_login",usertype:"1",el:"captcha-forget-pwd",mode:"popup",styles:{width:300,height:150,fontSize:"14px"},popupStyles:{position:"fixed",top:"30%",left:"50%",zIndex:"99999"},onSuccess(M,$){x.current=M,_({nonce:M.nonce,token:$.data.token,type:M.type})},onLoad(M){x.current=M,M.onVerify()},onFail(){}}):Uo.warning("安全组件未加载,请稍后再试")},N=M=>{R(M),s("reset")};return X.jsxs("div",{className:"space-y-5",children:[X.jsx("div",{id:"captcha-forget-pwd"}),i==="account"&&X.jsxs("div",{className:"space-y-4",children:[X.jsxs("div",{className:"text-sm text-gray-500 mb-4 text-center",children:["为了您的账号安全,请先进行安全验证",X.jsx("br",{}),"请输入您的账号信息"]}),X.jsx(Hu,{name:"account",placeholder:"请输入账号信息",autoFocus:!0,value:d,onChange:M=>m(M.currentTarget.value)}),X.jsx(rr,{className:"mt-6 h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",onClick:z,disabled:!d||A,children:A?"验证中...":"下一步"})]}),i==="secure"&&(S===2?X.jsx($H,{account:d,mobile:g,onNext:N}):X.jsx(XH,{account:d,onNext:N})),i==="reset"&&X.jsx(VH,{account:d,forgetPasswordKey:T,onSuccess:()=>s("success")}),i==="success"&&X.jsxs("div",{className:"space-y-4 py-6",children:[X.jsx("div",{className:"text-center text-lg font-medium text-gray-800",children:"重置密码成功"}),X.jsx(rr,{className:"mt-6 h-10 w-full bg-gray-100 text-gray-700 rounded-full hover:bg-gray-200",onClick:()=>t?.(),children:"返回登录"})]})]})}function FH(){const{gameId:t,onAccountLoginSuccess:a,onLoginSuccess:i,onLoginError:s,triggerRealNameAuth:d}=As(),m=C.useRef(null),[g,y]=C.useState(""),[S,b]=C.useState(""),[T,R]=C.useState(!1),[x,_]=C.useState(!0),[A,z]=C.useState(!1),{mutate:N,isPending:M}=Zi({mutationFn:()=>bH({account:g,password:S}),onSuccess:Y=>{const Z={account:Y.account,entity:Y.channel_info.entity,token:Y.channel_info.token,sign:Y.channel_info.sign,accid:Y.channel_info.entity.openid,extra_data:Y.channel_info.extra_data,gaplaySign:Y.channel_info.gaplaySign,realname:Y.channel_info.realname};if(n1(Z,Y._auth,t),Z.realname&&Z.realname.reject>=2){d();return}a?.(Z),i?.(Z)},onError:Y=>{s?.(Y)}});async function $(Y){if(Y.preventDefault(),!x){Uo.warning("请先阅读并同意用户协议和隐私政策");return}if(!g||!S){Uo.warning("请输入账号和密码");return}N()}return X.jsx(X.Fragment,{children:X.jsxs(Wy,{ref:m,onSubmit:$,className:"space-y-5",children:[X.jsx(Hu,{name:"account",placeholder:t==="5327"?"请输入账号":"请输入巨人通行证账号",autoFocus:!0,onChange:Y=>y(Y.currentTarget.value),prefix:t==="5327"?X.jsx(mH,{className:"size-5 text-gray-400"}):X.jsx(AH,{className:"size-5 text-gray-400"})}),X.jsx(Hu,{name:"password",type:T?"text":"password",autoComplete:"off",placeholder:"请输入密码",value:S,onValueChange:Y=>b(Y),prefix:X.jsx(DH,{className:"size-5 text-gray-400"}),suffix:X.jsx(rr,{onClick:()=>R(!T),type:"button",children:T?X.jsx(wM,{className:"size-5 text-gray-400"}):X.jsx(EM,{className:"size-5 text-gray-400"})})}),X.jsxs("section",{children:[X.jsx("div",{className:"flex justify-end mb-1",children:X.jsx(tv,{title:"忘记密码",open:A,onOpenChange:z,trigger:X.jsx("button",{type:"button",className:"text-[var(--jssdk-primary-color)] text-sm",children:"忘记密码"}),children:X.jsx(PH,{onClose:()=>z(!1),defaultAccount:g})})}),X.jsx(rr,{className:"h-10 w-full text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",type:"submit",disabled:M,children:"登录"})]}),X.jsx(T1,{}),X.jsx(AM,{checked:x,onChange:_})]})})}var zM;function Ke(t,a,i){function s(y,S){if(y._zod||Object.defineProperty(y,"_zod",{value:{def:S,constr:g,traits:new Set},enumerable:!1}),y._zod.traits.has(t))return;y._zod.traits.add(t),a(y,S);const b=g.prototype,T=Object.keys(b);for(let R=0;R<T.length;R++){const x=T[R];x in y||(y[x]=b[x].bind(y))}}const d=i?.Parent??Object;class m extends d{}Object.defineProperty(m,"name",{value:t});function g(y){var S;const b=i?.Parent?new m:this;s(b,y),(S=b._zod).deferred??(S.deferred=[]);for(const T of b._zod.deferred)T();return b}return Object.defineProperty(g,"init",{value:s}),Object.defineProperty(g,Symbol.hasInstance,{value:y=>i?.Parent&&y instanceof i.Parent?!0:y?._zod?.traits?.has(t)}),Object.defineProperty(g,"name",{value:t}),g}class nm extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class NM extends Error{constructor(a){super(`Encountered unidirectional transform during encode: ${a}`),this.name="ZodEncodeError"}}(zM=globalThis).__zod_globalConfig??(zM.__zod_globalConfig={});const RR=globalThis.__zod_globalConfig;function Zd(t){return RR}function UM(t){const a=Object.values(t).filter(s=>typeof s=="number");return Object.entries(t).filter(([s,d])=>a.indexOf(+s)===-1).map(([s,d])=>d)}function xR(t,a){return typeof a=="bigint"?a.toString():a}function OR(t){return{get value(){{const a=t();return Object.defineProperty(this,"value",{value:a}),a}}}}function CR(t){return t==null}function _R(t){const a=t.startsWith("^")?1:0,i=t.endsWith("$")?t.length-1:t.length;return t.slice(a,i)}const jM=Symbol("evaluating");function Xn(t,a,i){let s;Object.defineProperty(t,a,{get(){if(s!==jM)return s===void 0&&(s=jM,s=i()),s},set(d){Object.defineProperty(t,a,{value:d})},configurable:!0})}function Id(t,a,i){Object.defineProperty(t,a,{value:i,writable:!0,enumerable:!0,configurable:!0})}function Qc(...t){const a={};for(const i of t){const s=Object.getOwnPropertyDescriptors(i);Object.assign(a,s)}return Object.defineProperties({},a)}function LM(t){return JSON.stringify(t)}function QH(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const HM="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function x1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const JH=OR(()=>{if(RR.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function nv(t){if(x1(t)===!1)return!1;const a=t.constructor;if(a===void 0||typeof a!="function")return!0;const i=a.prototype;return!(x1(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function VM(t){return nv(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const KH=new Set(["string","number","symbol"]);function O1(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jc(t,a,i){const s=new t._zod.constr(a??t._zod.def);return(!a||i?.parent)&&(s._zod.parent=t),s}function Jt(t){const a=t;if(!a)return{};if(typeof a=="string")return{error:()=>a};if(a?.message!==void 0){if(a?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");a.error=a.message}return delete a.message,typeof a.error=="string"?{...a,error:()=>a.error}:a}function WH(t){return Object.keys(t).filter(a=>t[a]._zod.optin==="optional"&&t[a]._zod.optout==="optional")}function eV(t,a){const i=t._zod.def,s=i.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const m=Qc(t._zod.def,{get shape(){const g={};for(const y in a){if(!(y in i.shape))throw new Error(`Unrecognized key: "${y}"`);a[y]&&(g[y]=i.shape[y])}return Id(this,"shape",g),g},checks:[]});return Jc(t,m)}function tV(t,a){const i=t._zod.def,s=i.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const m=Qc(t._zod.def,{get shape(){const g={...t._zod.def.shape};for(const y in a){if(!(y in i.shape))throw new Error(`Unrecognized key: "${y}"`);a[y]&&delete g[y]}return Id(this,"shape",g),g},checks:[]});return Jc(t,m)}function nV(t,a){if(!nv(a))throw new Error("Invalid input to extend: expected a plain object");const i=t._zod.def.checks;if(i&&i.length>0){const m=t._zod.def.shape;for(const g in a)if(Object.getOwnPropertyDescriptor(m,g)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const d=Qc(t._zod.def,{get shape(){const m={...t._zod.def.shape,...a};return Id(this,"shape",m),m}});return Jc(t,d)}function oV(t,a){if(!nv(a))throw new Error("Invalid input to safeExtend: expected a plain object");const i=Qc(t._zod.def,{get shape(){const s={...t._zod.def.shape,...a};return Id(this,"shape",s),s}});return Jc(t,i)}function aV(t,a){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const i=Qc(t._zod.def,{get shape(){const s={...t._zod.def.shape,...a._zod.def.shape};return Id(this,"shape",s),s},get catchall(){return a._zod.def.catchall},checks:a._zod.def.checks??[]});return Jc(t,i)}function rV(t,a,i){const d=a._zod.def.checks;if(d&&d.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const g=Qc(a._zod.def,{get shape(){const y=a._zod.def.shape,S={...y};if(i)for(const b in i){if(!(b in y))throw new Error(`Unrecognized key: "${b}"`);i[b]&&(S[b]=t?new t({type:"optional",innerType:y[b]}):y[b])}else for(const b in y)S[b]=t?new t({type:"optional",innerType:y[b]}):y[b];return Id(this,"shape",S),S},checks:[]});return Jc(a,g)}function lV(t,a,i){const s=Qc(a._zod.def,{get shape(){const d=a._zod.def.shape,m={...d};if(i)for(const g in i){if(!(g in m))throw new Error(`Unrecognized key: "${g}"`);i[g]&&(m[g]=new t({type:"nonoptional",innerType:d[g]}))}else for(const g in d)m[g]=new t({type:"nonoptional",innerType:d[g]});return Id(this,"shape",m),m}});return Jc(a,s)}function om(t,a=0){if(t.aborted===!0)return!0;for(let i=a;i<t.issues.length;i++)if(t.issues[i]?.continue!==!0)return!0;return!1}function iV(t,a=0){if(t.aborted===!0)return!0;for(let i=a;i<t.issues.length;i++)if(t.issues[i]?.continue===!1)return!0;return!1}function kM(t,a){return a.map(i=>{var s;return(s=i).path??(s.path=[]),i.path.unshift(t),i})}function C1(t){return typeof t=="string"?t:t?.message}function $d(t,a,i){const s=t.message?t.message:C1(t.inst?._zod.def?.error?.(t))??C1(a?.error?.(t))??C1(i.customError?.(t))??C1(i.localeError?.(t))??"Invalid input",{inst:d,continue:m,input:g,...y}=t;return y.path??(y.path=[]),y.message=s,a?.reportInput&&(y.input=g),y}function AR(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function ov(...t){const[a,i,s]=t;return typeof a=="string"?{message:a,code:"custom",input:i,inst:s}:{...a}}const BM=(t,a)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:a,enumerable:!1}),t.message=JSON.stringify(a,xR,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},YM=Ke("$ZodError",BM),GM=Ke("$ZodError",BM,{Parent:Error});function _1(t,a=i=>i.message){const i={},s=[];for(const d of t.issues)d.path.length>0?(i[d.path[0]]=i[d.path[0]]||[],i[d.path[0]].push(a(d))):s.push(a(d));return{formErrors:s,fieldErrors:i}}function uV(t,a=i=>i.message){const i={_errors:[]},s=(d,m=[])=>{for(const g of d.issues)if(g.code==="invalid_union"&&g.errors.length)g.errors.map(y=>s({issues:y},[...m,...g.path]));else if(g.code==="invalid_key")s({issues:g.issues},[...m,...g.path]);else if(g.code==="invalid_element")s({issues:g.issues},[...m,...g.path]);else{const y=[...m,...g.path];if(y.length===0)i._errors.push(a(g));else{let S=i,b=0;for(;b<y.length;){const T=y[b];b===y.length-1?(S[T]=S[T]||{_errors:[]},S[T]._errors.push(a(g))):S[T]=S[T]||{_errors:[]},S=S[T],b++}}}};return s(t),i}const DR=t=>(a,i,s,d)=>{const m=s?{...s,async:!1}:{async:!1},g=a._zod.run({value:i,issues:[]},m);if(g instanceof Promise)throw new nm;if(g.issues.length){const y=new(d?.Err??t)(g.issues.map(S=>$d(S,m,Zd())));throw HM(y,d?.callee),y}return g.value},MR=t=>async(a,i,s,d)=>{const m=s?{...s,async:!0}:{async:!0};let g=a._zod.run({value:i,issues:[]},m);if(g instanceof Promise&&(g=await g),g.issues.length){const y=new(d?.Err??t)(g.issues.map(S=>$d(S,m,Zd())));throw HM(y,d?.callee),y}return g.value},A1=t=>(a,i,s)=>{const d=s?{...s,async:!1}:{async:!1},m=a._zod.run({value:i,issues:[]},d);if(m instanceof Promise)throw new nm;return m.issues.length?{success:!1,error:new(t??YM)(m.issues.map(g=>$d(g,d,Zd())))}:{success:!0,data:m.value}},sV=A1(GM),D1=t=>async(a,i,s)=>{const d=s?{...s,async:!0}:{async:!0};let m=a._zod.run({value:i,issues:[]},d);return m instanceof Promise&&(m=await m),m.issues.length?{success:!1,error:new t(m.issues.map(g=>$d(g,d,Zd())))}:{success:!0,data:m.value}},cV=D1(GM),fV=t=>(a,i,s)=>{const d=s?{...s,direction:"backward"}:{direction:"backward"};return DR(t)(a,i,d)},dV=t=>(a,i,s)=>DR(t)(a,i,s),pV=t=>async(a,i,s)=>{const d=s?{...s,direction:"backward"}:{direction:"backward"};return MR(t)(a,i,d)},hV=t=>async(a,i,s)=>MR(t)(a,i,s),mV=t=>(a,i,s)=>{const d=s?{...s,direction:"backward"}:{direction:"backward"};return A1(t)(a,i,d)},gV=t=>(a,i,s)=>A1(t)(a,i,s),yV=t=>async(a,i,s)=>{const d=s?{...s,direction:"backward"}:{direction:"backward"};return D1(t)(a,i,d)},vV=t=>async(a,i,s)=>D1(t)(a,i,s),bV=/^[cC][0-9a-z]{6,}$/,SV=/^[0-9a-z]+$/,EV=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wV=/^[0-9a-vA-V]{20}$/,TV=/^[A-Za-z0-9]{27}$/,RV=/^[a-zA-Z0-9_-]{21}$/,xV=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,OV=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,qM=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,CV=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_V="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function AV(){return new RegExp(_V,"u")}const DV=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,MV=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,zV=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,NV=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,UV=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ZM=/^[A-Za-z0-9_-]*$/,jV=/^https?$/,LV=/^\+[1-9]\d{6,14}$/,IM="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",HV=new RegExp(`^${IM}$`);function $M(t){const a="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${a}`:t.precision===0?`${a}:[0-5]\\d`:`${a}:[0-5]\\d\\.\\d{${t.precision}}`:`${a}(?::[0-5]\\d(?:\\.\\d+)?)?`}function VV(t){return new RegExp(`^${$M(t)}$`)}function kV(t){const a=$M({precision:t.precision}),i=["Z"];t.local&&i.push(""),t.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${a}(?:${i.join("|")})`;return new RegExp(`^${IM}T(?:${s})$`)}const BV=t=>{const a=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${a}$`)},YV=/^[^A-Z]*$/,GV=/^[^a-z]*$/,Vu=Ke("$ZodCheck",(t,a)=>{var i;t._zod??(t._zod={}),t._zod.def=a,(i=t._zod).onattach??(i.onattach=[])}),qV=Ke("$ZodCheckMaxLength",(t,a)=>{var i;Vu.init(t,a),(i=t._zod.def).when??(i.when=s=>{const d=s.value;return!CR(d)&&d.length!==void 0}),t._zod.onattach.push(s=>{const d=s._zod.bag.maximum??Number.POSITIVE_INFINITY;a.maximum<d&&(s._zod.bag.maximum=a.maximum)}),t._zod.check=s=>{const d=s.value;if(d.length<=a.maximum)return;const g=AR(d);s.issues.push({origin:g,code:"too_big",maximum:a.maximum,inclusive:!0,input:d,inst:t,continue:!a.abort})}}),ZV=Ke("$ZodCheckMinLength",(t,a)=>{var i;Vu.init(t,a),(i=t._zod.def).when??(i.when=s=>{const d=s.value;return!CR(d)&&d.length!==void 0}),t._zod.onattach.push(s=>{const d=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;a.minimum>d&&(s._zod.bag.minimum=a.minimum)}),t._zod.check=s=>{const d=s.value;if(d.length>=a.minimum)return;const g=AR(d);s.issues.push({origin:g,code:"too_small",minimum:a.minimum,inclusive:!0,input:d,inst:t,continue:!a.abort})}}),IV=Ke("$ZodCheckLengthEquals",(t,a)=>{var i;Vu.init(t,a),(i=t._zod.def).when??(i.when=s=>{const d=s.value;return!CR(d)&&d.length!==void 0}),t._zod.onattach.push(s=>{const d=s._zod.bag;d.minimum=a.length,d.maximum=a.length,d.length=a.length}),t._zod.check=s=>{const d=s.value,m=d.length;if(m===a.length)return;const g=AR(d),y=m>a.length;s.issues.push({origin:g,...y?{code:"too_big",maximum:a.length}:{code:"too_small",minimum:a.length},inclusive:!0,exact:!0,input:s.value,inst:t,continue:!a.abort})}}),M1=Ke("$ZodCheckStringFormat",(t,a)=>{var i,s;Vu.init(t,a),t._zod.onattach.push(d=>{const m=d._zod.bag;m.format=a.format,a.pattern&&(m.patterns??(m.patterns=new Set),m.patterns.add(a.pattern))}),a.pattern?(i=t._zod).check??(i.check=d=>{a.pattern.lastIndex=0,!a.pattern.test(d.value)&&d.issues.push({origin:"string",code:"invalid_format",format:a.format,input:d.value,...a.pattern?{pattern:a.pattern.toString()}:{},inst:t,continue:!a.abort})}):(s=t._zod).check??(s.check=()=>{})}),$V=Ke("$ZodCheckRegex",(t,a)=>{M1.init(t,a),t._zod.check=i=>{a.pattern.lastIndex=0,!a.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:a.pattern.toString(),inst:t,continue:!a.abort})}}),XV=Ke("$ZodCheckLowerCase",(t,a)=>{a.pattern??(a.pattern=YV),M1.init(t,a)}),PV=Ke("$ZodCheckUpperCase",(t,a)=>{a.pattern??(a.pattern=GV),M1.init(t,a)}),FV=Ke("$ZodCheckIncludes",(t,a)=>{Vu.init(t,a);const i=O1(a.includes),s=new RegExp(typeof a.position=="number"?`^.{${a.position}}${i}`:i);a.pattern=s,t._zod.onattach.push(d=>{const m=d._zod.bag;m.patterns??(m.patterns=new Set),m.patterns.add(s)}),t._zod.check=d=>{d.value.includes(a.includes,a.position)||d.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:a.includes,input:d.value,inst:t,continue:!a.abort})}}),QV=Ke("$ZodCheckStartsWith",(t,a)=>{Vu.init(t,a);const i=new RegExp(`^${O1(a.prefix)}.*`);a.pattern??(a.pattern=i),t._zod.onattach.push(s=>{const d=s._zod.bag;d.patterns??(d.patterns=new Set),d.patterns.add(i)}),t._zod.check=s=>{s.value.startsWith(a.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:a.prefix,input:s.value,inst:t,continue:!a.abort})}}),JV=Ke("$ZodCheckEndsWith",(t,a)=>{Vu.init(t,a);const i=new RegExp(`.*${O1(a.suffix)}$`);a.pattern??(a.pattern=i),t._zod.onattach.push(s=>{const d=s._zod.bag;d.patterns??(d.patterns=new Set),d.patterns.add(i)}),t._zod.check=s=>{s.value.endsWith(a.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:a.suffix,input:s.value,inst:t,continue:!a.abort})}}),KV=Ke("$ZodCheckOverwrite",(t,a)=>{Vu.init(t,a),t._zod.check=i=>{i.value=a.tx(i.value)}});class WV{constructor(a=[]){this.content=[],this.indent=0,this&&(this.args=a)}indented(a){this.indent+=1,a(this),this.indent-=1}write(a){if(typeof a=="function"){a(this,{execution:"sync"}),a(this,{execution:"async"});return}const s=a.split(`
262
262
  `).filter(g=>g),d=Math.min(...s.map(g=>g.length-g.trimStart().length)),m=s.map(g=>g.slice(d)).map(g=>" ".repeat(this.indent*2)+g);for(const g of m)this.content.push(g)}compile(){const a=Function,i=this?.args,d=[...(this?.content??[""]).map(m=>` ${m}`)];return new a(...i,d.join(`
263
263
  `))}}const ek={major:4,minor:4,patch:3},ma=Ke("$ZodType",(t,a)=>{var i;t??(t={}),t._zod.def=a,t._zod.bag=t._zod.bag||{},t._zod.version=ek;const s=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&s.unshift(t);for(const d of s)for(const m of d._zod.onattach)m(t);if(s.length===0)(i=t._zod).deferred??(i.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{const d=(g,y,S)=>{let b=om(g),T;for(const R of y){if(R._zod.def.when){if(iV(g)||!R._zod.def.when(g))continue}else if(b)continue;const x=g.issues.length,_=R._zod.check(g);if(_ instanceof Promise&&S?.async===!1)throw new nm;if(T||_ instanceof Promise)T=(T??Promise.resolve()).then(async()=>{await _,g.issues.length!==x&&(b||(b=om(g,x)))});else{if(g.issues.length===x)continue;b||(b=om(g,x))}}return T?T.then(()=>g):g},m=(g,y,S)=>{if(om(g))return g.aborted=!0,g;const b=d(y,s,S);if(b instanceof Promise){if(S.async===!1)throw new nm;return b.then(T=>t._zod.parse(T,S))}return t._zod.parse(b,S)};t._zod.run=(g,y)=>{if(y.skipChecks)return t._zod.parse(g,y);if(y.direction==="backward"){const b=t._zod.parse({value:g.value,issues:[]},{...y,skipChecks:!0});return b instanceof Promise?b.then(T=>m(T,g,y)):m(b,g,y)}const S=t._zod.parse(g,y);if(S instanceof Promise){if(y.async===!1)throw new nm;return S.then(b=>d(b,s,y))}return d(S,s,y)}}Xn(t,"~standard",()=>({validate:d=>{try{const m=sV(t,d);return m.success?{value:m.data}:{issues:m.error?.issues}}catch{return cV(t,d).then(g=>g.success?{value:g.data}:{issues:g.error?.issues})}},vendor:"zod",version:1}))}),zR=Ke("$ZodString",(t,a)=>{ma.init(t,a),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??BV(t._zod.bag),t._zod.parse=(i,s)=>{if(a.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:t}),i}}),bo=Ke("$ZodStringFormat",(t,a)=>{M1.init(t,a),zR.init(t,a)}),tk=Ke("$ZodGUID",(t,a)=>{a.pattern??(a.pattern=OV),bo.init(t,a)}),nk=Ke("$ZodUUID",(t,a)=>{if(a.version){const s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[a.version];if(s===void 0)throw new Error(`Invalid UUID version: "${a.version}"`);a.pattern??(a.pattern=qM(s))}else a.pattern??(a.pattern=qM());bo.init(t,a)}),ok=Ke("$ZodEmail",(t,a)=>{a.pattern??(a.pattern=CV),bo.init(t,a)}),ak=Ke("$ZodURL",(t,a)=>{bo.init(t,a),t._zod.check=i=>{try{const s=i.value.trim();if(!a.normalize&&a.protocol?.source===jV.source&&!/^https?:\/\//i.test(s)){i.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:i.value,inst:t,continue:!a.abort});return}const d=new URL(s);a.hostname&&(a.hostname.lastIndex=0,a.hostname.test(d.hostname)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:a.hostname.source,input:i.value,inst:t,continue:!a.abort})),a.protocol&&(a.protocol.lastIndex=0,a.protocol.test(d.protocol.endsWith(":")?d.protocol.slice(0,-1):d.protocol)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:a.protocol.source,input:i.value,inst:t,continue:!a.abort})),a.normalize?i.value=d.href:i.value=s;return}catch{i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:t,continue:!a.abort})}}}),rk=Ke("$ZodEmoji",(t,a)=>{a.pattern??(a.pattern=AV()),bo.init(t,a)}),lk=Ke("$ZodNanoID",(t,a)=>{a.pattern??(a.pattern=RV),bo.init(t,a)}),ik=Ke("$ZodCUID",(t,a)=>{a.pattern??(a.pattern=bV),bo.init(t,a)}),uk=Ke("$ZodCUID2",(t,a)=>{a.pattern??(a.pattern=SV),bo.init(t,a)}),sk=Ke("$ZodULID",(t,a)=>{a.pattern??(a.pattern=EV),bo.init(t,a)}),ck=Ke("$ZodXID",(t,a)=>{a.pattern??(a.pattern=wV),bo.init(t,a)}),fk=Ke("$ZodKSUID",(t,a)=>{a.pattern??(a.pattern=TV),bo.init(t,a)}),dk=Ke("$ZodISODateTime",(t,a)=>{a.pattern??(a.pattern=kV(a)),bo.init(t,a)}),pk=Ke("$ZodISODate",(t,a)=>{a.pattern??(a.pattern=HV),bo.init(t,a)}),hk=Ke("$ZodISOTime",(t,a)=>{a.pattern??(a.pattern=VV(a)),bo.init(t,a)}),mk=Ke("$ZodISODuration",(t,a)=>{a.pattern??(a.pattern=xV),bo.init(t,a)}),gk=Ke("$ZodIPv4",(t,a)=>{a.pattern??(a.pattern=DV),bo.init(t,a),t._zod.bag.format="ipv4"}),yk=Ke("$ZodIPv6",(t,a)=>{a.pattern??(a.pattern=MV),bo.init(t,a),t._zod.bag.format="ipv6",t._zod.check=i=>{try{new URL(`http://[${i.value}]`)}catch{i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:t,continue:!a.abort})}}}),vk=Ke("$ZodCIDRv4",(t,a)=>{a.pattern??(a.pattern=zV),bo.init(t,a)}),bk=Ke("$ZodCIDRv6",(t,a)=>{a.pattern??(a.pattern=NV),bo.init(t,a),t._zod.check=i=>{const s=i.value.split("/");try{if(s.length!==2)throw new Error;const[d,m]=s;if(!m)throw new Error;const g=Number(m);if(`${g}`!==m)throw new Error;if(g<0||g>128)throw new Error;new URL(`http://[${d}]`)}catch{i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:t,continue:!a.abort})}}});function XM(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Sk=Ke("$ZodBase64",(t,a)=>{a.pattern??(a.pattern=UV),bo.init(t,a),t._zod.bag.contentEncoding="base64",t._zod.check=i=>{XM(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:t,continue:!a.abort})}});function Ek(t){if(!ZM.test(t))return!1;const a=t.replace(/[-_]/g,s=>s==="-"?"+":"/"),i=a.padEnd(Math.ceil(a.length/4)*4,"=");return XM(i)}const wk=Ke("$ZodBase64URL",(t,a)=>{a.pattern??(a.pattern=ZM),bo.init(t,a),t._zod.bag.contentEncoding="base64url",t._zod.check=i=>{Ek(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:t,continue:!a.abort})}}),Tk=Ke("$ZodE164",(t,a)=>{a.pattern??(a.pattern=LV),bo.init(t,a)});function Rk(t,a=null){try{const i=t.split(".");if(i.length!==3)return!1;const[s]=i;if(!s)return!1;const d=JSON.parse(atob(s));return!("typ"in d&&d?.typ!=="JWT"||!d.alg||a&&(!("alg"in d)||d.alg!==a))}catch{return!1}}const xk=Ke("$ZodJWT",(t,a)=>{bo.init(t,a),t._zod.check=i=>{Rk(i.value,a.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:t,continue:!a.abort})}}),Ok=Ke("$ZodUnknown",(t,a)=>{ma.init(t,a),t._zod.parse=i=>i}),Ck=Ke("$ZodNever",(t,a)=>{ma.init(t,a),t._zod.parse=(i,s)=>(i.issues.push({expected:"never",code:"invalid_type",input:i.value,inst:t}),i)});function PM(t,a,i){t.issues.length&&a.issues.push(...kM(i,t.issues)),a.value[i]=t.value}const _k=Ke("$ZodArray",(t,a)=>{ma.init(t,a),t._zod.parse=(i,s)=>{const d=i.value;if(!Array.isArray(d))return i.issues.push({expected:"array",code:"invalid_type",input:d,inst:t}),i;i.value=Array(d.length);const m=[];for(let g=0;g<d.length;g++){const y=d[g],S=a.element._zod.run({value:y,issues:[]},s);S instanceof Promise?m.push(S.then(b=>PM(b,i,g))):PM(S,i,g)}return m.length?Promise.all(m).then(()=>i):i}});function z1(t,a,i,s,d,m){const g=i in s;if(t.issues.length){if(d&&m&&!g)return;a.issues.push(...kM(i,t.issues))}if(!g&&!d){t.issues.length||a.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[i]});return}t.value===void 0?g&&(a.value[i]=void 0):a.value[i]=t.value}function FM(t){const a=Object.keys(t.shape);for(const s of a)if(!t.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${s}": expected a Zod schema`);const i=WH(t.shape);return{...t,keys:a,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(i)}}function QM(t,a,i,s,d,m){const g=[],y=d.keySet,S=d.catchall._zod,b=S.def.type,T=S.optin==="optional",R=S.optout==="optional";for(const x in a){if(x==="__proto__"||y.has(x))continue;if(b==="never"){g.push(x);continue}const _=S.run({value:a[x],issues:[]},s);_ instanceof Promise?t.push(_.then(A=>z1(A,i,x,a,T,R))):z1(_,i,x,a,T,R)}return g.length&&i.issues.push({code:"unrecognized_keys",keys:g,input:a,inst:m}),t.length?Promise.all(t).then(()=>i):i}const Ak=Ke("$ZodObject",(t,a)=>{if(ma.init(t,a),!Object.getOwnPropertyDescriptor(a,"shape")?.get){const y=a.shape;Object.defineProperty(a,"shape",{get:()=>{const S={...y};return Object.defineProperty(a,"shape",{value:S}),S}})}const s=OR(()=>FM(a));Xn(t._zod,"propValues",()=>{const y=a.shape,S={};for(const b in y){const T=y[b]._zod;if(T.values){S[b]??(S[b]=new Set);for(const R of T.values)S[b].add(R)}}return S});const d=x1,m=a.catchall;let g;t._zod.parse=(y,S)=>{g??(g=s.value);const b=y.value;if(!d(b))return y.issues.push({expected:"object",code:"invalid_type",input:b,inst:t}),y;y.value={};const T=[],R=g.shape;for(const x of g.keys){const _=R[x],A=_._zod.optin==="optional",z=_._zod.optout==="optional",N=_._zod.run({value:b[x],issues:[]},S);N instanceof Promise?T.push(N.then(M=>z1(M,y,x,b,A,z))):z1(N,y,x,b,A,z)}return m?QM(T,b,y,S,s.value,t):T.length?Promise.all(T).then(()=>y):y}}),Dk=Ke("$ZodObjectJIT",(t,a)=>{Ak.init(t,a);const i=t._zod.parse,s=OR(()=>FM(a)),d=x=>{const _=new WV(["shape","payload","ctx"]),A=s.value,z=Y=>{const Z=LM(Y);return`shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`};_.write("const input = payload.value;");const N=Object.create(null);let M=0;for(const Y of A.keys)N[Y]=`key_${M++}`;_.write("const newResult = {};");for(const Y of A.keys){const Z=N[Y],V=LM(Y),I=x[Y],q=I?._zod?.optin==="optional",J=I?._zod?.optout==="optional";_.write(`const ${Z} = ${z(Y)};`),q&&J?_.write(`
264
264
  if (${Z}.issues.length) {