mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 19:00:55 +00:00
7 lines
22 KiB
JavaScript
7 lines
22 KiB
JavaScript
import{y as lt,r as n,j as r,c0 as R,c1 as V,c2 as ct,c3 as _,c4 as K,c5 as it,c6 as dt,c7 as Ce,J as _e,c8 as ut,c9 as Te,ca as pt,cb as Ne,cc as ft,cd as mt,ce as ht,cf as vt,cg as gt,ch as xt,ci as St,cj as wt,ck as yt,cl as Ct,cm as bt,aI as Ee,b8 as ae,aP as It}from"./index-7T7TTikv.js";/**
|
|
* @license lucide-react v0.513.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Tt=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Pt=lt("chevron-up",Tt);function Pe(e,[o,t]){return Math.min(t,Math.max(o,e))}function _t(e){const o=n.useRef({value:e,previous:e});return n.useMemo(()=>(o.current.value!==e&&(o.current.previous=o.current.value,o.current.value=e),o.current.previous),[e])}var Re=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Nt="VisuallyHidden",Et=n.forwardRef((e,o)=>r.jsx(R.span,{...e,ref:o,style:{...Re,...e.style}}));Et.displayName=Nt;var Rt=[" ","Enter","ArrowUp","ArrowDown"],jt=[" ","Enter"],Q="Select",[pe,fe,Mt]=ft(Q),[ee]=wt(Q,[Mt,Ne]),me=Ne(),[At,$]=ee(Q),[Ot,Dt]=ee(Q),Lt="SelectProvider";function je(e){const{__scopeSelect:o,children:t,open:a,defaultOpen:l,onOpenChange:f,value:i,defaultValue:c,onValueChange:s,dir:p,name:x,autoComplete:y,disabled:C,required:P,form:I,internal_do_not_use_render:d}=e,v=me(o),[g,u]=n.useState(null),[h,N]=n.useState(null),[j,le]=n.useState(!1),E=ut(p),[O,te]=Te({prop:a,defaultProp:l??!1,onChange:f,caller:Q}),[oe,B]=Te({prop:i,defaultProp:c,onChange:s,caller:Q}),H=n.useRef(null),q=g?!!I||!!g.closest("form"):!0,[F,D]=n.useState(new Set),U=Ce(),W=Array.from(F).map(k=>k.props.value).join(";"),z=n.useCallback(k=>{D(X=>new Set(X).add(k))},[]),L=n.useCallback(k=>{D(X=>{const re=new Set(X);return re.delete(k),re})},[]),ne={required:P,trigger:g,onTriggerChange:u,valueNode:h,onValueNodeChange:N,valueNodeHasChildren:j,onValueNodeHasChildrenChange:le,contentId:U,value:oe,onValueChange:B,open:O,onOpenChange:te,dir:E,triggerPointerDownPosRef:H,disabled:C,name:x,autoComplete:y,form:I,nativeOptions:F,nativeSelectKey:W,isFormControl:q};return r.jsx(pt,{...v,children:r.jsx(At,{scope:o,...ne,children:r.jsx(pe.Provider,{scope:o,children:r.jsx(Ot,{scope:o,onNativeOptionAdd:z,onNativeOptionRemove:L,children:Qt(d)?d(ne):t})})})})}je.displayName=Lt;var Me=e=>{const{__scopeSelect:o,children:t,...a}=e;return r.jsx(je,{__scopeSelect:o,...a,internal_do_not_use_render:({isFormControl:l})=>r.jsxs(r.Fragment,{children:[t,l?r.jsx(rt,{__scopeSelect:o}):null]})})};Me.displayName=Q;var Ae="SelectTrigger",Oe=n.forwardRef((e,o)=>{const{__scopeSelect:t,disabled:a=!1,...l}=e,f=me(t),i=$(Ae,t),c=i.disabled||a,s=V(o,i.onTriggerChange),p=fe(t),x=n.useRef("touch"),[y,C,P]=st(d=>{const v=p().filter(h=>!h.disabled),g=v.find(h=>h.value===i.value),u=at(v,d,g);u!==void 0&&i.onValueChange(u.value)}),I=d=>{c||(i.onOpenChange(!0),P()),d&&(i.triggerPointerDownPosRef.current={x:Math.round(d.pageX),y:Math.round(d.pageY)})};return r.jsx(ct,{asChild:!0,...f,children:r.jsx(R.button,{type:"button",role:"combobox","aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Ie(i.value)?"":void 0,...l,ref:s,onClick:_(l.onClick,d=>{d.currentTarget.focus(),x.current!=="mouse"&&I(d)}),onPointerDown:_(l.onPointerDown,d=>{x.current=d.pointerType;const v=d.target;v.hasPointerCapture(d.pointerId)&&v.releasePointerCapture(d.pointerId),d.button===0&&d.ctrlKey===!1&&d.pointerType==="mouse"&&(I(d),d.preventDefault())}),onKeyDown:_(l.onKeyDown,d=>{const v=y.current!=="";!(d.ctrlKey||d.altKey||d.metaKey)&&d.key.length===1&&C(d.key),!(v&&d.key===" ")&&Rt.includes(d.key)&&(I(),d.preventDefault())})})})});Oe.displayName=Ae;var De="SelectValue",Le=n.forwardRef((e,o)=>{const{__scopeSelect:t,className:a,style:l,children:f,placeholder:i="",...c}=e,s=$(De,t),{onValueNodeHasChildrenChange:p}=s,x=f!==void 0,y=V(o,s.onValueNodeChange);K(()=>{p(x)},[p,x]);const C=Ie(s.value);return r.jsx(R.span,{...c,asChild:C?!1:c.asChild,ref:y,style:{pointerEvents:"none"},children:r.jsx(n.Fragment,{children:C?i:f},C?"placeholder":"value")})});Le.displayName=De;var kt="SelectIcon",ke=n.forwardRef((e,o)=>{const{__scopeSelect:t,children:a,...l}=e;return r.jsx(R.span,{"aria-hidden":!0,...l,ref:o,children:a||"▼"})});ke.displayName=kt;var Ve="SelectPortal",[Vt,Bt]=ee(Ve,{forceMount:void 0}),Be=e=>{const{__scopeSelect:o,forceMount:t,...a}=e;return r.jsx(Vt,{scope:e.__scopeSelect,forceMount:t,children:r.jsx(it,{asChild:!0,...a})})};Be.displayName=Ve;var G="SelectContent",He=n.forwardRef((e,o)=>{const t=Bt(G,e.__scopeSelect),{forceMount:a=t.forceMount,...l}=e,f=$(G,e.__scopeSelect),[i,c]=n.useState();return K(()=>{c(new DocumentFragment)},[]),r.jsx(dt,{present:a||f.open,children:({present:s})=>s?r.jsx(We,{...l,ref:o}):r.jsx(Fe,{...l,fragment:i})})});He.displayName=G;var Fe=n.forwardRef((e,o)=>{const{__scopeSelect:t,children:a,fragment:l}=e;return l?_e.createPortal(r.jsx(Ue,{scope:t,children:r.jsx(pe.Slot,{scope:t,children:r.jsx("div",{ref:o,children:a})})}),l):null});Fe.displayName="SelectContentFragment";var A=10,[Ue,Y]=ee(G),Ht="SelectContentImpl",Ft=yt("SelectContent.RemoveScroll"),We=n.forwardRef((e,o)=>{const{__scopeSelect:t}=e,{position:a="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:f,onPointerDownOutside:i,side:c,sideOffset:s,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:C,collisionPadding:P,sticky:I,hideWhenDetached:d,avoidCollisions:v,...g}=e,u=$(G,t),[h,N]=n.useState(null),[j,le]=n.useState(null),E=V(o,m=>N(m)),[O,te]=n.useState(null),[oe,B]=n.useState(null),H=fe(t),[q,F]=n.useState(!1),D=n.useRef(!1);n.useEffect(()=>{if(h)return ht(h)},[h]),vt();const U=n.useCallback(m=>{const[T,...M]=H().map(w=>w.ref.current),[b]=M.slice(-1),S=document.activeElement;for(const w of m)if(w===S||(w==null||w.scrollIntoView({block:"nearest"}),w===T&&j&&(j.scrollTop=0),w===b&&j&&(j.scrollTop=j.scrollHeight),w==null||w.focus(),document.activeElement!==S))return},[H,j]),W=n.useCallback(()=>U([O,h]),[U,O,h]);n.useEffect(()=>{q&&W()},[q,W]);const{onOpenChange:z,triggerPointerDownPosRef:L}=u;n.useEffect(()=>{if(h){let m={x:0,y:0};const T=b=>{var S,w;m={x:Math.abs(Math.round(b.pageX)-(((S=L.current)==null?void 0:S.x)??0)),y:Math.abs(Math.round(b.pageY)-(((w=L.current)==null?void 0:w.y)??0))}},M=b=>{m.x<=10&&m.y<=10?b.preventDefault():b.composedPath().includes(h)||z(!1),document.removeEventListener("pointermove",T),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",T),document.addEventListener("pointerup",M,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",M,{capture:!0})}}},[h,z,L]),n.useEffect(()=>{const m=()=>z(!1);return window.addEventListener("blur",m),window.addEventListener("resize",m),()=>{window.removeEventListener("blur",m),window.removeEventListener("resize",m)}},[z]);const[ne,k]=st(m=>{const T=H().filter(S=>!S.disabled),M=T.find(S=>S.ref.current===document.activeElement),b=at(T,m,M);b&&setTimeout(()=>b.ref.current.focus())}),X=n.useCallback((m,T,M)=>{const b=!D.current&&!M;(u.value!==void 0&&u.value===T||b)&&(te(m),b&&(D.current=!0))},[u.value]),re=n.useCallback(()=>h==null?void 0:h.focus(),[h]),se=n.useCallback((m,T,M)=>{const b=!D.current&&!M;(u.value!==void 0&&u.value===T||b)&&B(m)},[u.value]),de=a==="popper"?xe:ze,ce=de===xe?{side:c,sideOffset:s,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:C,collisionPadding:P,sticky:I,hideWhenDetached:d,avoidCollisions:v}:{};return r.jsx(Ue,{scope:t,content:h,viewport:j,onViewportChange:le,itemRefCallback:X,selectedItem:O,onItemLeave:re,itemTextRefCallback:se,focusSelectedItem:W,selectedItemText:oe,position:a,isPositioned:q,searchRef:ne,children:r.jsx(gt,{as:Ft,allowPinchZoom:!0,children:r.jsx(xt,{asChild:!0,trapped:u.open,onMountAutoFocus:m=>{m.preventDefault()},onUnmountAutoFocus:_(l,m=>{var T;(T=u.trigger)==null||T.focus({preventScroll:!0}),m.preventDefault()}),children:r.jsx(St,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:f,onPointerDownOutside:i,onFocusOutside:m=>m.preventDefault(),onDismiss:()=>u.onOpenChange(!1),children:r.jsx(de,{role:"listbox",id:u.contentId,"data-state":u.open?"open":"closed",dir:u.dir,onContextMenu:m=>m.preventDefault(),...g,...ce,onPlaced:()=>F(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:_(g.onKeyDown,m=>{const T=m.ctrlKey||m.altKey||m.metaKey;if(m.key==="Tab"&&m.preventDefault(),!T&&m.key.length===1&&k(m.key),["ArrowUp","ArrowDown","Home","End"].includes(m.key)){let b=H().filter(S=>!S.disabled).map(S=>S.ref.current);if(["ArrowUp","End"].includes(m.key)&&(b=b.slice().reverse()),["ArrowUp","ArrowDown"].includes(m.key)){const S=m.target,w=b.indexOf(S);b=b.slice(w+1)}setTimeout(()=>U(b)),m.preventDefault()}})})})})})})});We.displayName=Ht;var Ut="SelectItemAlignedPosition",ze=n.forwardRef((e,o)=>{const{__scopeSelect:t,onPlaced:a,...l}=e,f=$(G,t),i=Y(G,t),[c,s]=n.useState(null),[p,x]=n.useState(null),y=V(o,E=>x(E)),C=fe(t),P=n.useRef(!1),I=n.useRef(!0),{viewport:d,selectedItem:v,selectedItemText:g,focusSelectedItem:u}=i,h=n.useCallback(()=>{if(f.trigger&&f.valueNode&&c&&p&&d&&v&&g){const E=f.trigger.getBoundingClientRect(),O=p.getBoundingClientRect(),te=f.valueNode.getBoundingClientRect(),oe=g.getBoundingClientRect();if(f.dir!=="rtl"){const S=oe.left-O.left,w=te.left-S,Z=E.left-w,J=E.width+Z,he=Math.max(J,O.width),ve=window.innerWidth-A,ge=Pe(w,[A,Math.max(A,ve-he)]);c.style.minWidth=J+"px",c.style.left=ge+"px"}else{const S=O.right-oe.right,w=window.innerWidth-te.right-S,Z=window.innerWidth-E.right-w,J=E.width+Z,he=Math.max(J,O.width),ve=window.innerWidth-A,ge=Pe(w,[A,Math.max(A,ve-he)]);c.style.minWidth=J+"px",c.style.right=ge+"px"}const B=C(),H=window.innerHeight-A*2,q=d.scrollHeight,F=window.getComputedStyle(p),D=parseInt(F.borderTopWidth,10),U=parseInt(F.paddingTop,10),W=parseInt(F.borderBottomWidth,10),z=parseInt(F.paddingBottom,10),L=D+U+q+z+W,ne=Math.min(v.offsetHeight*5,L),k=window.getComputedStyle(d),X=parseInt(k.paddingTop,10),re=parseInt(k.paddingBottom,10),se=E.top+E.height/2-A,de=H-se,ce=v.offsetHeight/2,m=v.offsetTop+ce,T=D+U+m,M=L-T;if(T<=se){const S=B.length>0&&v===B[B.length-1].ref.current;c.style.bottom="0px";const w=p.clientHeight-d.offsetTop-d.offsetHeight,Z=Math.max(de,ce+(S?re:0)+w+W),J=T+Z;c.style.height=J+"px"}else{const S=B.length>0&&v===B[0].ref.current;c.style.top="0px";const Z=Math.max(se,D+d.offsetTop+(S?X:0)+ce)+M;c.style.height=Z+"px",d.scrollTop=T-se+d.offsetTop}c.style.margin=`${A}px 0`,c.style.minHeight=ne+"px",c.style.maxHeight=H+"px",a==null||a(),requestAnimationFrame(()=>P.current=!0)}},[C,f.trigger,f.valueNode,c,p,d,v,g,f.dir,a]);K(()=>h(),[h]);const[N,j]=n.useState();K(()=>{p&&j(window.getComputedStyle(p).zIndex)},[p]);const le=n.useCallback(E=>{E&&I.current===!0&&(h(),u==null||u(),I.current=!1)},[h,u]);return r.jsx(zt,{scope:t,contentWrapper:c,shouldExpandOnScrollRef:P,onScrollButtonChange:le,children:r.jsx("div",{ref:s,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:r.jsx(R.div,{...l,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});ze.displayName=Ut;var Wt="SelectPopperPosition",xe=n.forwardRef((e,o)=>{const{__scopeSelect:t,align:a="start",collisionPadding:l=A,...f}=e,i=me(t);return r.jsx(Ct,{...i,...f,ref:o,align:a,collisionPadding:l,style:{boxSizing:"border-box",...f.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=Wt;var[zt,be]=ee(G,{}),Se="SelectViewport",Ke=n.forwardRef((e,o)=>{const{__scopeSelect:t,nonce:a,...l}=e,f=Y(Se,t),i=be(Se,t),c=V(o,f.onViewportChange),s=n.useRef(0);return r.jsxs(r.Fragment,{children:[r.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:a}),r.jsx(pe.Slot,{scope:t,children:r.jsx(R.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:_(l.onScroll,p=>{const x=p.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:C}=i;if(C!=null&&C.current&&y){const P=Math.abs(s.current-x.scrollTop);if(P>0){const I=window.innerHeight-A*2,d=parseFloat(y.style.minHeight),v=parseFloat(y.style.height),g=Math.max(d,v);if(g<I){const u=g+P,h=Math.min(I,u),N=u-h;y.style.height=h+"px",y.style.bottom==="0px"&&(x.scrollTop=N>0?N:0,y.style.justifyContent="flex-end")}}}s.current=x.scrollTop})})})]})});Ke.displayName=Se;var Ge="SelectGroup",[Kt,Gt]=ee(Ge),$t=n.forwardRef((e,o)=>{const{__scopeSelect:t,...a}=e,l=Ce();return r.jsx(Kt,{scope:t,id:l,children:r.jsx(R.div,{role:"group","aria-labelledby":l,...a,ref:o})})});$t.displayName=Ge;var $e="SelectLabel",Yt=n.forwardRef((e,o)=>{const{__scopeSelect:t,...a}=e,l=Gt($e,t);return r.jsx(R.div,{id:l.id,...a,ref:o})});Yt.displayName=$e;var ue="SelectItem",[qt,Ye]=ee(ue),qe=n.forwardRef((e,o)=>{const{__scopeSelect:t,value:a,disabled:l=!1,textValue:f,...i}=e,c=$(ue,t),s=Y(ue,t),p=c.value===a,[x,y]=n.useState(f??""),[C,P]=n.useState(!1),I=V(o,u=>{var h;return(h=s.itemRefCallback)==null?void 0:h.call(s,u,a,l)}),d=Ce(),v=n.useRef("touch"),g=()=>{l||(c.onValueChange(a),c.onOpenChange(!1))};if(a==="")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 r.jsx(qt,{scope:t,value:a,disabled:l,textId:d,isSelected:p,onItemTextChange:n.useCallback(u=>{y(h=>h||((u==null?void 0:u.textContent)??"").trim())},[]),children:r.jsx(pe.ItemSlot,{scope:t,value:a,disabled:l,textValue:x,children:r.jsx(R.div,{role:"option","aria-labelledby":d,"data-highlighted":C?"":void 0,"aria-selected":p&&C,"data-state":p?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...i,ref:I,onFocus:_(i.onFocus,()=>P(!0)),onBlur:_(i.onBlur,()=>P(!1)),onClick:_(i.onClick,()=>{v.current!=="mouse"&&g()}),onPointerUp:_(i.onPointerUp,()=>{v.current==="mouse"&&g()}),onPointerDown:_(i.onPointerDown,u=>{v.current=u.pointerType}),onPointerMove:_(i.onPointerMove,u=>{var h;v.current=u.pointerType,l?(h=s.onItemLeave)==null||h.call(s):v.current==="mouse"&&u.currentTarget.focus({preventScroll:!0})}),onPointerLeave:_(i.onPointerLeave,u=>{var h;u.currentTarget===document.activeElement&&((h=s.onItemLeave)==null||h.call(s))}),onKeyDown:_(i.onKeyDown,u=>{var N;((N=s.searchRef)==null?void 0:N.current)!==""&&u.key===" "||(jt.includes(u.key)&&g(),u.key===" "&&u.preventDefault())})})})})});qe.displayName=ue;var ie="SelectItemText",Xe=n.forwardRef((e,o)=>{const{__scopeSelect:t,className:a,style:l,...f}=e,i=$(ie,t),c=Y(ie,t),s=Ye(ie,t),p=Dt(ie,t),[x,y]=n.useState(null),C=V(o,g=>y(g),s.onItemTextChange,g=>{var u;return(u=c.itemTextRefCallback)==null?void 0:u.call(c,g,s.value,s.disabled)}),P=x==null?void 0:x.textContent,I=n.useMemo(()=>r.jsx("option",{value:s.value,disabled:s.disabled,children:P},s.value),[s.disabled,s.value,P]),{onNativeOptionAdd:d,onNativeOptionRemove:v}=p;return K(()=>(d(I),()=>v(I)),[d,v,I]),r.jsxs(r.Fragment,{children:[r.jsx(R.span,{id:s.textId,...f,ref:C}),s.isSelected&&i.valueNode&&!i.valueNodeHasChildren?_e.createPortal(f.children,i.valueNode):null]})});Xe.displayName=ie;var Ze="SelectItemIndicator",Je=n.forwardRef((e,o)=>{const{__scopeSelect:t,...a}=e;return Ye(Ze,t).isSelected?r.jsx(R.span,{"aria-hidden":!0,...a,ref:o}):null});Je.displayName=Ze;var we="SelectScrollUpButton",Qe=n.forwardRef((e,o)=>{const t=Y(we,e.__scopeSelect),a=be(we,e.__scopeSelect),[l,f]=n.useState(!1),i=V(o,a.onScrollButtonChange);return K(()=>{if(t.viewport&&t.isPositioned){let c=function(){const p=s.scrollTop>0;f(p)};const s=t.viewport;return c(),s.addEventListener("scroll",c),()=>s.removeEventListener("scroll",c)}},[t.viewport,t.isPositioned]),l?r.jsx(tt,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:s}=t;c&&s&&(c.scrollTop=c.scrollTop-s.offsetHeight)}}):null});Qe.displayName=we;var ye="SelectScrollDownButton",et=n.forwardRef((e,o)=>{const t=Y(ye,e.__scopeSelect),a=be(ye,e.__scopeSelect),[l,f]=n.useState(!1),i=V(o,a.onScrollButtonChange);return K(()=>{if(t.viewport&&t.isPositioned){let c=function(){const p=s.scrollHeight-s.clientHeight,x=Math.ceil(s.scrollTop)<p;f(x)};const s=t.viewport;return c(),s.addEventListener("scroll",c),()=>s.removeEventListener("scroll",c)}},[t.viewport,t.isPositioned]),l?r.jsx(tt,{...e,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:s}=t;c&&s&&(c.scrollTop=c.scrollTop+s.offsetHeight)}}):null});et.displayName=ye;var tt=n.forwardRef((e,o)=>{const{__scopeSelect:t,onAutoScroll:a,...l}=e,f=Y("SelectScrollButton",t),i=n.useRef(null),c=fe(t),s=n.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return n.useEffect(()=>()=>s(),[s]),K(()=>{var x;const p=c().find(y=>y.ref.current===document.activeElement);(x=p==null?void 0:p.ref.current)==null||x.scrollIntoView({block:"nearest"})},[c]),r.jsx(R.div,{"aria-hidden":!0,...l,ref:o,style:{flexShrink:0,...l.style},onPointerDown:_(l.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:_(l.onPointerMove,()=>{var p;(p=f.onItemLeave)==null||p.call(f),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:_(l.onPointerLeave,()=>{s()})})}),Xt="SelectSeparator",Zt=n.forwardRef((e,o)=>{const{__scopeSelect:t,...a}=e;return r.jsx(R.div,{"aria-hidden":!0,...a,ref:o})});Zt.displayName=Xt;var ot="SelectArrow",Jt=n.forwardRef((e,o)=>{const{__scopeSelect:t,...a}=e,l=me(t);return Y(ot,t).position==="popper"?r.jsx(bt,{...l,...a,ref:o}):null});Jt.displayName=ot;var nt="SelectBubbleInput",rt=n.forwardRef(({__scopeSelect:e,...o},t)=>{const a=$(nt,e),{value:l,onValueChange:f,required:i,disabled:c,name:s,autoComplete:p,form:x}=a,{nativeOptions:y,nativeSelectKey:C}=a,P=n.useRef(null),I=V(t,P),d=l??"",v=_t(d);return n.useEffect(()=>{const g=P.current;if(!g)return;const u=window.HTMLSelectElement.prototype,N=Object.getOwnPropertyDescriptor(u,"value").set;if(v!==d&&N){const j=new Event("change",{bubbles:!0});N.call(g,d),g.dispatchEvent(j)}},[v,d]),r.jsxs(R.select,{"aria-hidden":!0,required:i,tabIndex:-1,name:s,autoComplete:p,disabled:c,form:x,onChange:g=>f(g.target.value),...o,style:{...Re,...o.style},ref:I,defaultValue:d,children:[Ie(l)?r.jsx("option",{value:""}):null,Array.from(y)]},C)});rt.displayName=nt;function Qt(e){return typeof e=="function"}function Ie(e){return e===""||e===void 0}function st(e){const o=mt(e),t=n.useRef(""),a=n.useRef(0),l=n.useCallback(i=>{const c=t.current+i;o(c),(function s(p){t.current=p,window.clearTimeout(a.current),p!==""&&(a.current=window.setTimeout(()=>s(""),1e3))})(c)},[o]),f=n.useCallback(()=>{t.current="",window.clearTimeout(a.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(a.current),[]),[t,l,f]}function at(e,o,t){const l=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,f=t?e.indexOf(t):-1;let i=eo(e,Math.max(f,0));l.length===1&&(i=i.filter(p=>p!==t));const s=i.find(p=>p.textValue.toLowerCase().startsWith(l.toLowerCase()));return s!==t?s:void 0}function eo(e,o){return e.map((t,a)=>e[(o+a)%e.length])}function ro({...e}){return r.jsx(Me,{"data-slot":"select",...e})}function so({...e}){return r.jsx(Le,{"data-slot":"select-value",...e})}function ao({className:e,children:o,...t}){return r.jsxs(Oe,{"data-slot":"select-trigger",className:ae("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-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *: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",e),...t,children:[o,r.jsx(ke,{asChild:!0,children:r.jsx(Ee,{className:"size-4 opacity-50"})})]})}function lo({className:e,children:o,position:t="popper",...a}){return r.jsx(Be,{children:r.jsxs(He,{"data-slot":"select-content",className:ae("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,...a,children:[r.jsx(to,{}),r.jsx(Ke,{className:ae("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),r.jsx(oo,{})]})})}function co({className:e,children:o,...t}){return r.jsxs(qe,{"data-slot":"select-item",className:ae("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:[r.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:r.jsx(Je,{children:r.jsx(It,{className:"size-4"})})}),r.jsx(Xe,{children:o})]})}function to({className:e,...o}){return r.jsx(Qe,{"data-slot":"select-scroll-up-button",className:ae("flex cursor-default items-center justify-center py-1",e),...o,children:r.jsx(Pt,{className:"size-4"})})}function oo({className:e,...o}){return r.jsx(et,{"data-slot":"select-scroll-down-button",className:ae("flex cursor-default items-center justify-center py-1",e),...o,children:r.jsx(Ee,{className:"size-4"})})}export{ro as S,ao as a,so as b,lo as c,co as d};
|