import{r,j as o,R as Te}from"./app-DYGATBs5.js";import{b as Ne,c as ct,u as be,P as A,a as R,i as Y,e as dt,r as Ee,d as ut,h as pt,f as ft,R as mt,F as ht,D as vt}from"./Combination-DVN9R3_Q.js";import{a as je,u as gt,R as xt,c as St,A as wt,V as yt,C as Ct,b as bt}from"./index-DonAjmT5.js";import{u as V,S as It}from"./index-BCUj1oI9.js";import{c as k}from"./utils-TqigrGrV.js";import{c as Me}from"./createLucideIcon-BtQHVCpb.js";import{C as Tt}from"./check-KddZBb0u.js";import{C as Nt}from"./circle-alert-C2CB-9yq.js";/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pt=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ae=Me("ChevronDown",Pt);/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rt=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],_t=Me("ChevronUp",Rt);function Pe(e,[n,t]){return Math.min(t,Math.max(n,e))}function Et(e){const n=r.useRef({value:e,previous:e});return r.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}var jt=[" ","Enter","ArrowUp","ArrowDown"],Mt=[" ","Enter"],se="Select",[ce,de,At]=St(se),[oe,Eo]=ct(se,[At,je]),ue=je(),[Ot,q]=oe(se),[Dt,Lt]=oe(se),Oe=e=>{const{__scopeSelect:n,children:t,open:l,defaultOpen:a,onOpenChange:p,value:s,defaultValue:c,onValueChange:i,dir:f,name:v,autoComplete:x,disabled:T,required:N,form:b}=e,u=ue(n),[g,S]=r.useState(null),[m,d]=r.useState(null),[_,P]=r.useState(!1),B=gt(f),[E=!1,D]=Ne({prop:l,defaultProp:a,onChange:p}),[K,Z]=Ne({prop:s,defaultProp:c,onChange:i}),H=r.useRef(null),F=g?b||!!g.closest("form"):!0,[$,U]=r.useState(new Set),W=Array.from($).map(j=>j.props.value).join(";");return o.jsx(xt,{...u,children:o.jsxs(Ot,{required:N,scope:n,trigger:g,onTriggerChange:S,valueNode:m,onValueNodeChange:d,valueNodeHasChildren:_,onValueNodeHasChildrenChange:P,contentId:be(),value:K,onValueChange:Z,open:E,onOpenChange:D,dir:B,triggerPointerDownPosRef:H,disabled:T,children:[o.jsx(ce.Provider,{scope:n,children:o.jsx(Dt,{scope:e.__scopeSelect,onNativeOptionAdd:r.useCallback(j=>{U(L=>new Set(L).add(j))},[]),onNativeOptionRemove:r.useCallback(j=>{U(L=>{const z=new Set(L);return z.delete(j),z})},[]),children:t})}),F?o.jsxs(st,{"aria-hidden":!0,required:N,tabIndex:-1,name:v,autoComplete:x,value:K,onChange:j=>Z(j.target.value),disabled:T,form:b,children:[K===void 0?o.jsx("option",{value:""}):null,Array.from($)]},W):null]})})};Oe.displayName=se;var De="SelectTrigger",Le=r.forwardRef((e,n)=>{const{__scopeSelect:t,disabled:l=!1,...a}=e,p=ue(t),s=q(De,t),c=s.disabled||l,i=V(n,s.onTriggerChange),f=de(t),v=r.useRef("touch"),[x,T,N]=lt(u=>{const g=f().filter(d=>!d.disabled),S=g.find(d=>d.value===s.value),m=at(g,u,S);m!==void 0&&s.onValueChange(m.value)}),b=u=>{c||(s.onOpenChange(!0),N()),u&&(s.triggerPointerDownPosRef.current={x:Math.round(u.pageX),y:Math.round(u.pageY)})};return o.jsx(wt,{asChild:!0,...p,children:o.jsx(A.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":rt(s.value)?"":void 0,...a,ref:i,onClick:R(a.onClick,u=>{u.currentTarget.focus(),v.current!=="mouse"&&b(u)}),onPointerDown:R(a.onPointerDown,u=>{v.current=u.pointerType;const g=u.target;g.hasPointerCapture(u.pointerId)&&g.releasePointerCapture(u.pointerId),u.button===0&&u.ctrlKey===!1&&u.pointerType==="mouse"&&(b(u),u.preventDefault())}),onKeyDown:R(a.onKeyDown,u=>{const g=x.current!=="";!(u.ctrlKey||u.altKey||u.metaKey)&&u.key.length===1&&T(u.key),!(g&&u.key===" ")&&jt.includes(u.key)&&(b(),u.preventDefault())})})})});Le.displayName=De;var ke="SelectValue",Ve=r.forwardRef((e,n)=>{const{__scopeSelect:t,className:l,style:a,children:p,placeholder:s="",...c}=e,i=q(ke,t),{onValueNodeHasChildrenChange:f}=i,v=p!==void 0,x=V(n,i.onValueNodeChange);return Y(()=>{f(v)},[f,v]),o.jsx(A.span,{...c,ref:x,style:{pointerEvents:"none"},children:rt(i.value)?o.jsx(o.Fragment,{children:s}):p})});Ve.displayName=ke;var kt="SelectIcon",Be=r.forwardRef((e,n)=>{const{__scopeSelect:t,children:l,...a}=e;return o.jsx(A.span,{"aria-hidden":!0,...a,ref:n,children:l||"▼"})});Be.displayName=kt;var Vt="SelectPortal",He=e=>o.jsx(dt,{asChild:!0,...e});He.displayName=Vt;var ee="SelectContent",Fe=r.forwardRef((e,n)=>{const t=q(ee,e.__scopeSelect),[l,a]=r.useState();if(Y(()=>{a(new DocumentFragment)},[]),!t.open){const p=l;return p?Ee.createPortal(o.jsx(Ue,{scope:e.__scopeSelect,children:o.jsx(ce.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),p):null}return o.jsx(We,{...e,ref:n})});Fe.displayName=ee;var O=10,[Ue,X]=oe(ee),Bt="SelectContentImpl",We=r.forwardRef((e,n)=>{const{__scopeSelect:t,position:l="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:p,onPointerDownOutside:s,side:c,sideOffset:i,align:f,alignOffset:v,arrowPadding:x,collisionBoundary:T,collisionPadding:N,sticky:b,hideWhenDetached:u,avoidCollisions:g,...S}=e,m=q(ee,t),[d,_]=r.useState(null),[P,B]=r.useState(null),E=V(n,h=>_(h)),[D,K]=r.useState(null),[Z,H]=r.useState(null),F=de(t),[$,U]=r.useState(!1),W=r.useRef(!1);r.useEffect(()=>{if(d)return pt(d)},[d]),ft();const j=r.useCallback(h=>{const[I,...M]=F().map(y=>y.ref.current),[C]=M.slice(-1),w=document.activeElement;for(const y of h)if(y===w||(y==null||y.scrollIntoView({block:"nearest"}),y===I&&P&&(P.scrollTop=0),y===C&&P&&(P.scrollTop=P.scrollHeight),y==null||y.focus(),document.activeElement!==w))return},[F,P]),L=r.useCallback(()=>j([D,d]),[j,D,d]);r.useEffect(()=>{$&&L()},[$,L]);const{onOpenChange:z,triggerPointerDownPosRef:G}=m;r.useEffect(()=>{if(d){let h={x:0,y:0};const I=C=>{var w,y;h={x:Math.abs(Math.round(C.pageX)-(((w=G.current)==null?void 0:w.x)??0)),y:Math.abs(Math.round(C.pageY)-(((y=G.current)==null?void 0:y.y)??0))}},M=C=>{h.x<=10&&h.y<=10?C.preventDefault():d.contains(C.target)||z(!1),document.removeEventListener("pointermove",I),G.current=null};return G.current!==null&&(document.addEventListener("pointermove",I),document.addEventListener("pointerup",M,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",M,{capture:!0})}}},[d,z,G]),r.useEffect(()=>{const h=()=>z(!1);return window.addEventListener("blur",h),window.addEventListener("resize",h),()=>{window.removeEventListener("blur",h),window.removeEventListener("resize",h)}},[z]);const[pe,le]=lt(h=>{const I=F().filter(w=>!w.disabled),M=I.find(w=>w.ref.current===document.activeElement),C=at(I,h,M);C&&setTimeout(()=>C.ref.current.focus())}),fe=r.useCallback((h,I,M)=>{const C=!W.current&&!M;(m.value!==void 0&&m.value===I||C)&&(K(h),C&&(W.current=!0))},[m.value]),me=r.useCallback(()=>d==null?void 0:d.focus(),[d]),te=r.useCallback((h,I,M)=>{const C=!W.current&&!M;(m.value!==void 0&&m.value===I||C)&&H(h)},[m.value]),ae=l==="popper"?xe:ze,ne=ae===xe?{side:c,sideOffset:i,align:f,alignOffset:v,arrowPadding:x,collisionBoundary:T,collisionPadding:N,sticky:b,hideWhenDetached:u,avoidCollisions:g}:{};return o.jsx(Ue,{scope:t,content:d,viewport:P,onViewportChange:B,itemRefCallback:fe,selectedItem:D,onItemLeave:me,itemTextRefCallback:te,focusSelectedItem:L,selectedItemText:Z,position:l,isPositioned:$,searchRef:pe,children:o.jsx(mt,{as:It,allowPinchZoom:!0,children:o.jsx(ht,{asChild:!0,trapped:m.open,onMountAutoFocus:h=>{h.preventDefault()},onUnmountAutoFocus:R(a,h=>{var I;(I=m.trigger)==null||I.focus({preventScroll:!0}),h.preventDefault()}),children:o.jsx(vt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:p,onPointerDownOutside:s,onFocusOutside:h=>h.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:o.jsx(ae,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:h=>h.preventDefault(),...S,...ne,onPlaced:()=>U(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:R(S.onKeyDown,h=>{const I=h.ctrlKey||h.altKey||h.metaKey;if(h.key==="Tab"&&h.preventDefault(),!I&&h.key.length===1&&le(h.key),["ArrowUp","ArrowDown","Home","End"].includes(h.key)){let C=F().filter(w=>!w.disabled).map(w=>w.ref.current);if(["ArrowUp","End"].includes(h.key)&&(C=C.slice().reverse()),["ArrowUp","ArrowDown"].includes(h.key)){const w=h.target,y=C.indexOf(w);C=C.slice(y+1)}setTimeout(()=>j(C)),h.preventDefault()}})})})})})})});We.displayName=Bt;var Ht="SelectItemAlignedPosition",ze=r.forwardRef((e,n)=>{const{__scopeSelect:t,onPlaced:l,...a}=e,p=q(ee,t),s=X(ee,t),[c,i]=r.useState(null),[f,v]=r.useState(null),x=V(n,E=>v(E)),T=de(t),N=r.useRef(!1),b=r.useRef(!0),{viewport:u,selectedItem:g,selectedItemText:S,focusSelectedItem:m}=s,d=r.useCallback(()=>{if(p.trigger&&p.valueNode&&c&&f&&u&&g&&S){const E=p.trigger.getBoundingClientRect(),D=f.getBoundingClientRect(),K=p.valueNode.getBoundingClientRect(),Z=S.getBoundingClientRect();if(p.dir!=="rtl"){const w=Z.left-D.left,y=K.left-w,J=E.left-y,Q=E.width+J,he=Math.max(Q,D.width),ve=window.innerWidth-O,ge=Pe(y,[O,Math.max(O,ve-he)]);c.style.minWidth=Q+"px",c.style.left=ge+"px"}else{const w=D.right-Z.right,y=window.innerWidth-K.right-w,J=window.innerWidth-E.right-y,Q=E.width+J,he=Math.max(Q,D.width),ve=window.innerWidth-O,ge=Pe(y,[O,Math.max(O,ve-he)]);c.style.minWidth=Q+"px",c.style.right=ge+"px"}const H=T(),F=window.innerHeight-O*2,$=u.scrollHeight,U=window.getComputedStyle(f),W=parseInt(U.borderTopWidth,10),j=parseInt(U.paddingTop,10),L=parseInt(U.borderBottomWidth,10),z=parseInt(U.paddingBottom,10),G=W+j+$+z+L,pe=Math.min(g.offsetHeight*5,G),le=window.getComputedStyle(u),fe=parseInt(le.paddingTop,10),me=parseInt(le.paddingBottom,10),te=E.top+E.height/2-O,ae=F-te,ne=g.offsetHeight/2,h=g.offsetTop+ne,I=W+j+h,M=G-I;if(I<=te){const w=H.length>0&&g===H[H.length-1].ref.current;c.style.bottom="0px";const y=f.clientHeight-u.offsetTop-u.offsetHeight,J=Math.max(ae,ne+(w?me:0)+y+L),Q=I+J;c.style.height=Q+"px"}else{const w=H.length>0&&g===H[0].ref.current;c.style.top="0px";const J=Math.max(te,W+u.offsetTop+(w?fe:0)+ne)+M;c.style.height=J+"px",u.scrollTop=I-te+u.offsetTop}c.style.margin=`${O}px 0`,c.style.minHeight=pe+"px",c.style.maxHeight=F+"px",l==null||l(),requestAnimationFrame(()=>N.current=!0)}},[T,p.trigger,p.valueNode,c,f,u,g,S,p.dir,l]);Y(()=>d(),[d]);const[_,P]=r.useState();Y(()=>{f&&P(window.getComputedStyle(f).zIndex)},[f]);const B=r.useCallback(E=>{E&&b.current===!0&&(d(),m==null||m(),b.current=!1)},[d,m]);return o.jsx(Ut,{scope:t,contentWrapper:c,shouldExpandOnScrollRef:N,onScrollButtonChange:B,children:o.jsx("div",{ref:i,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:o.jsx(A.div,{...a,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});ze.displayName=Ht;var Ft="SelectPopperPosition",xe=r.forwardRef((e,n)=>{const{__scopeSelect:t,align:l="start",collisionPadding:a=O,...p}=e,s=ue(t);return o.jsx(Ct,{...s,...p,ref:n,align:l,collisionPadding:a,style:{boxSizing:"border-box",...p.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xe.displayName=Ft;var[Ut,Ie]=oe(ee,{}),Se="SelectViewport",Ke=r.forwardRef((e,n)=>{const{__scopeSelect:t,nonce:l,...a}=e,p=X(Se,t),s=Ie(Se,t),c=V(n,p.onViewportChange),i=r.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),o.jsx(ce.Slot,{scope:t,children:o.jsx(A.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:R(a.onScroll,f=>{const v=f.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:T}=s;if(T!=null&&T.current&&x){const N=Math.abs(i.current-v.scrollTop);if(N>0){const b=window.innerHeight-O*2,u=parseFloat(x.style.minHeight),g=parseFloat(x.style.height),S=Math.max(u,g);if(S<b){const m=S+N,d=Math.min(b,m),_=m-d;x.style.height=d+"px",x.style.bottom==="0px"&&(v.scrollTop=_>0?_:0,x.style.justifyContent="flex-end")}}}i.current=v.scrollTop})})})]})});Ke.displayName=Se;var $e="SelectGroup",[Wt,zt]=oe($e),Ge=r.forwardRef((e,n)=>{const{__scopeSelect:t,...l}=e,a=be();return o.jsx(Wt,{scope:t,id:a,children:o.jsx(A.div,{role:"group","aria-labelledby":a,...l,ref:n})})});Ge.displayName=$e;var Ye="SelectLabel",qe=r.forwardRef((e,n)=>{const{__scopeSelect:t,...l}=e,a=zt(Ye,t);return o.jsx(A.div,{id:a.id,...l,ref:n})});qe.displayName=Ye;var ie="SelectItem",[Kt,Xe]=oe(ie),Ze=r.forwardRef((e,n)=>{const{__scopeSelect:t,value:l,disabled:a=!1,textValue:p,...s}=e,c=q(ie,t),i=X(ie,t),f=c.value===l,[v,x]=r.useState(p??""),[T,N]=r.useState(!1),b=V(n,m=>{var d;return(d=i.itemRefCallback)==null?void 0:d.call(i,m,l,a)}),u=be(),g=r.useRef("touch"),S=()=>{a||(c.onValueChange(l),c.onOpenChange(!1))};if(l==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(Kt,{scope:t,value:l,disabled:a,textId:u,isSelected:f,onItemTextChange:r.useCallback(m=>{x(d=>d||((m==null?void 0:m.textContent)??"").trim())},[]),children:o.jsx(ce.ItemSlot,{scope:t,value:l,disabled:a,textValue:v,children:o.jsx(A.div,{role:"option","aria-labelledby":u,"data-highlighted":T?"":void 0,"aria-selected":f&&T,"data-state":f?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...s,ref:b,onFocus:R(s.onFocus,()=>N(!0)),onBlur:R(s.onBlur,()=>N(!1)),onClick:R(s.onClick,()=>{g.current!=="mouse"&&S()}),onPointerUp:R(s.onPointerUp,()=>{g.current==="mouse"&&S()}),onPointerDown:R(s.onPointerDown,m=>{g.current=m.pointerType}),onPointerMove:R(s.onPointerMove,m=>{var d;g.current=m.pointerType,a?(d=i.onItemLeave)==null||d.call(i):g.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(s.onPointerLeave,m=>{var d;m.currentTarget===document.activeElement&&((d=i.onItemLeave)==null||d.call(i))}),onKeyDown:R(s.onKeyDown,m=>{var _;((_=i.searchRef)==null?void 0:_.current)!==""&&m.key===" "||(Mt.includes(m.key)&&S(),m.key===" "&&m.preventDefault())})})})})});Ze.displayName=ie;var re="SelectItemText",Je=r.forwardRef((e,n)=>{const{__scopeSelect:t,className:l,style:a,...p}=e,s=q(re,t),c=X(re,t),i=Xe(re,t),f=Lt(re,t),[v,x]=r.useState(null),T=V(n,S=>x(S),i.onItemTextChange,S=>{var m;return(m=c.itemTextRefCallback)==null?void 0:m.call(c,S,i.value,i.disabled)}),N=v==null?void 0:v.textContent,b=r.useMemo(()=>o.jsx("option",{value:i.value,disabled:i.disabled,children:N},i.value),[i.disabled,i.value,N]),{onNativeOptionAdd:u,onNativeOptionRemove:g}=f;return Y(()=>(u(b),()=>g(b)),[u,g,b]),o.jsxs(o.Fragment,{children:[o.jsx(A.span,{id:i.textId,...p,ref:T}),i.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ee.createPortal(p.children,s.valueNode):null]})});Je.displayName=re;var Qe="SelectItemIndicator",et=r.forwardRef((e,n)=>{const{__scopeSelect:t,...l}=e;return Xe(Qe,t).isSelected?o.jsx(A.span,{"aria-hidden":!0,...l,ref:n}):null});et.displayName=Qe;var we="SelectScrollUpButton",tt=r.forwardRef((e,n)=>{const t=X(we,e.__scopeSelect),l=Ie(we,e.__scopeSelect),[a,p]=r.useState(!1),s=V(n,l.onScrollButtonChange);return Y(()=>{if(t.viewport&&t.isPositioned){let c=function(){const f=i.scrollTop>0;p(f)};const i=t.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[t.viewport,t.isPositioned]),a?o.jsx(nt,{...e,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=t;c&&i&&(c.scrollTop=c.scrollTop-i.offsetHeight)}}):null});tt.displayName=we;var ye="SelectScrollDownButton",ot=r.forwardRef((e,n)=>{const t=X(ye,e.__scopeSelect),l=Ie(ye,e.__scopeSelect),[a,p]=r.useState(!1),s=V(n,l.onScrollButtonChange);return Y(()=>{if(t.viewport&&t.isPositioned){let c=function(){const f=i.scrollHeight-i.clientHeight,v=Math.ceil(i.scrollTop)<f;p(v)};const i=t.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[t.viewport,t.isPositioned]),a?o.jsx(nt,{...e,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=t;c&&i&&(c.scrollTop=c.scrollTop+i.offsetHeight)}}):null});ot.displayName=ye;var nt=r.forwardRef((e,n)=>{const{__scopeSelect:t,onAutoScroll:l,...a}=e,p=X("SelectScrollButton",t),s=r.useRef(null),c=de(t),i=r.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return r.useEffect(()=>()=>i(),[i]),Y(()=>{var v;const f=c().find(x=>x.ref.current===document.activeElement);(v=f==null?void 0:f.ref.current)==null||v.scrollIntoView({block:"nearest"})},[c]),o.jsx(A.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:R(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(l,50))}),onPointerMove:R(a.onPointerMove,()=>{var f;(f=p.onItemLeave)==null||f.call(p),s.current===null&&(s.current=window.setInterval(l,50))}),onPointerLeave:R(a.onPointerLeave,()=>{i()})})}),$t="SelectSeparator",Gt=r.forwardRef((e,n)=>{const{__scopeSelect:t,...l}=e;return o.jsx(A.div,{"aria-hidden":!0,...l,ref:n})});Gt.displayName=$t;var Ce="SelectArrow",Yt=r.forwardRef((e,n)=>{const{__scopeSelect:t,...l}=e,a=ue(t),p=q(Ce,t),s=X(Ce,t);return p.open&&s.position==="popper"?o.jsx(bt,{...a,...l,ref:n}):null});Yt.displayName=Ce;function rt(e){return e===""||e===void 0}var st=r.forwardRef((e,n)=>{const{value:t,...l}=e,a=r.useRef(null),p=V(n,a),s=Et(t);return r.useEffect(()=>{const c=a.current,i=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(i,"value").set;if(s!==t&&v){const x=new Event("change",{bubbles:!0});v.call(c,t),c.dispatchEvent(x)}},[s,t]),o.jsx(yt,{asChild:!0,children:o.jsx("select",{...l,ref:p,defaultValue:t})})});st.displayName="BubbleSelect";function lt(e){const n=ut(e),t=r.useRef(""),l=r.useRef(0),a=r.useCallback(s=>{const c=t.current+s;n(c),function i(f){t.current=f,window.clearTimeout(l.current),f!==""&&(l.current=window.setTimeout(()=>i(""),1e3))}(c)},[n]),p=r.useCallback(()=>{t.current="",window.clearTimeout(l.current)},[]);return r.useEffect(()=>()=>window.clearTimeout(l.current),[]),[t,a,p]}function at(e,n,t){const a=n.length>1&&Array.from(n).every(f=>f===n[0])?n[0]:n,p=t?e.indexOf(t):-1;let s=qt(e,Math.max(p,0));a.length===1&&(s=s.filter(f=>f!==t));const i=s.find(f=>f.textValue.toLowerCase().startsWith(a.toLowerCase()));return i!==t?i:void 0}function qt(e,n){return e.map((t,l)=>e[(n+l)%e.length])}var Xt=Oe,Zt=Le,Jt=Ve,Qt=Be,eo=He,to=Fe,oo=Ke,no=Ge,ro=qe,so=Ze,lo=Je,ao=et,io=tt,co=ot;function uo({...e}){return o.jsx(Xt,{"data-slot":"select",...e})}function Re({...e}){return o.jsx(no,{"data-slot":"select-group",...e})}function po({...e}){return o.jsx(Jt,{"data-slot":"select-value",...e})}function fo({className:e,children:n,...t}){return o.jsxs(Zt,{"data-slot":"select-trigger",className:k("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex h-9 w-full items-center justify-between rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&>span]:line-clamp-1",e),...t,children:[n,o.jsx(Qt,{asChild:!0,children:o.jsx(Ae,{className:"size-4 opacity-50"})})]})}function mo({className:e,children:n,position:t="popper",...l}){return o.jsx(eo,{children:o.jsxs(to,{"data-slot":"select-content",className:k("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md",t==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:t,...l,children:[o.jsx(vo,{}),o.jsx(oo,{className:k("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:n}),o.jsx(go,{})]})})}function ho({className:e,...n}){return o.jsx(ro,{"data-slot":"select-label",className:k("px-2 py-1.5 text-sm font-medium",e),...n})}function _e({className:e,children:n,...t}){return o.jsxs(so,{"data-slot":"select-item",className:k("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...t,children:[o.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:o.jsx(ao,{children:o.jsx(Tt,{className:"size-4"})})}),o.jsx(lo,{children:n})]})}function vo({className:e,...n}){return o.jsx(io,{"data-slot":"select-scroll-up-button",className:k("flex cursor-default items-center justify-center py-1",e),...n,children:o.jsx(_t,{className:"size-4"})})}function go({className:e,...n}){return o.jsx(co,{"data-slot":"select-scroll-down-button",className:k("flex cursor-default items-center justify-center py-1",e),...n,children:o.jsx(Ae,{className:"size-4"})})}var xo="Label",it=r.forwardRef((e,n)=>o.jsx(A.label,{...e,ref:n,onMouseDown:t=>{var a;t.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));it.displayName=xo;var So=it;function wo({className:e,...n}){return o.jsx(So,{"data-slot":"label",className:k("text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...n})}const yo=Te.forwardRef(({name:e,id:n=e,label:t,value:l,defaultValue:a,onChange:p,options:s,placeholder:c="Select an option",disabled:i=!1,required:f=!1,errors:v,className:x="",triggerClassName:T="",contentClassName:N=""},b)=>{const u=Te.useMemo(()=>s.some(d=>"options"in d),[s]),g=d=>{if(d===""||d===void 0||d===null)return null;const P=(u?s.flatMap(B=>B.options):s).find(B=>String(B.value)===String(d));return P?P.label:null},S=d=>{p==null||p(d)},m=()=>u?s.map((d,_)=>o.jsxs(Re,{children:[d.label&&o.jsx(ho,{children:d.label}),d.options.map(P=>o.jsx(_e,{className:"text-sm",value:String(P.value),disabled:P.disabled,children:P.label},`${_}-${P.value}`))]},`group-${_}`)):o.jsx(Re,{children:s.map(d=>o.jsx(_e,{className:"text-sm",value:String(d.value),disabled:d.disabled,children:d.label},String(d.value)))});return o.jsxs("div",{id:n,className:k("text-sm flex flex-col gap-1",x),children:[t&&o.jsxs(wo,{htmlFor:n,children:[t,f&&o.jsx("span",{className:"text-destructive",children:" *"})]}),o.jsxs(uo,{value:l!=null?String(l):void 0,defaultValue:a!=null?String(a):void 0,onValueChange:S,disabled:i,required:f,name:e,children:[o.jsx(fo,{ref:b,id:n,className:k("w-full",T,(v==null?void 0:v[e])&&"border-destructive"),"aria-invalid":!!(v!=null&&v[e]),"aria-required":f,children:o.jsx(po,{placeholder:c,children:(l!=null&&l!==""&&g(l))??c})}),o.jsx(mo,{className:N,children:m()})]}),(v==null?void 0:v[e])&&o.jsxs("p",{className:"flex items-center gap-2 text-xs text-destructive mt-1",children:[o.jsx(Nt,{className:"w-4 h-4"}),v[e]]})]})});yo.displayName="SelectInput";export{yo as S};
