2 lines
59 KiB
JavaScript
2 lines
59 KiB
JavaScript
import{$ as A,r as u,a as yl,j as y,b as bl,o as H,d as Ne,u as vl,c as $l}from"./index-f45b8810.js";import{d as N,e as pe,f as He,g as ee,i as xl,j as Kl,k as Pl,l as wl,m as Ue,n as Sl,o as se,p as ae,q as ce,r as J,b as ie,s as Ml,t as Cl,v as Ve,w as Al,x as Il,y as $e,z as kl,A as We,C as El,D as xe,E as Ke,F as Fl,G as Xe,H as Ol,I as Pe,J as Tl,K as Dl,M as jl,N as we,P as T,O as qe,Q as Ze,a as Rl,R as Ll,B as Q,L as Ye,S as Bl,u as zl,h as Nl}from"./fetch.client-5aab1c76.js";import{A as Hl}from"./alert-38484668.js";import{H as Ul,a as Vl,b as Wl,L as Xl,E as ql}from"./label-979d47e9.js";function Ge(l){return null}Ge.getCollectionNode=function*(e,t){let{childItems:s,title:i,children:r}=e,n=e.title||e.children,o=e.textValue||(typeof n=="string"?n:"")||e["aria-label"]||"";!o&&!(t!=null&&t.suppressTextValueWarning)&&console.warn("<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop."),yield{type:"item",props:e,rendered:n,textValue:o,"aria-label":e["aria-label"],hasChildNodes:Zl(e),*childNodes(){if(s)for(let a of s)yield{type:"item",value:a};else if(i){let a=[];A.Children.forEach(r,d=>{a.push({type:"item",element:d})}),yield*a}}}};function Zl(l){return l.hasChildItems!=null?l.hasChildItems:!!(l.childItems||l.title&&A.Children.count(l.children)>0)}let Yl=Ge;class Gl{build(e,t){return this.context=t,Se(()=>this.iterateCollection(e))}*iterateCollection(e){let{children:t,items:s}=e;if(typeof t=="function"){if(!s)throw new Error("props.children was a function but props.items is missing");for(let i of e.items)yield*this.getFullNode({value:i},{renderer:t})}else{let i=[];A.Children.forEach(t,n=>{i.push(n)});let r=0;for(let n of i){let o=this.getFullNode({element:n,index:r},{});for(let a of o)r++,yield a}}}getKey(e,t,s,i){if(e.key!=null)return e.key;if(t.type==="cell"&&t.key!=null)return`${i}${t.key}`;let r=t.value;if(r!=null){var n;let o=(n=r.key)!==null&&n!==void 0?n:r.id;if(o==null)throw new Error("No key found for item");return o}return i?`${i}.${t.index}`:`$.${t.index}`}getChildState(e,t){return{renderer:t.renderer||e.renderer}}*getFullNode(e,t,s,i){let r=e.element;if(!r&&e.value&&t&&t.renderer){let a=this.cache.get(e.value);if(a&&(!a.shouldInvalidate||!a.shouldInvalidate(this.context))){a.index=e.index,a.parentKey=i?i.key:null,yield a;return}r=t.renderer(e.value)}if(A.isValidElement(r)){let a=r.type;if(typeof a!="function"&&typeof a.getCollectionNode!="function"){let b=typeof r.type=="function"?r.type.name:r.type;throw new Error(`Unknown element <${b}> in collection.`)}let d=a.getCollectionNode(r.props,this.context),m=e.index,$=d.next();for(;!$.done&&$.value;){let b=$.value;e.index=m;let c=b.key;c||(c=b.element?null:this.getKey(r,e,t,s));let v=[...this.getFullNode({...b,key:c,index:m,wrapper:Jl(e.wrapper,b.wrapper)},this.getChildState(t,b),s?`${s}${r.key}`:r.key,i)];for(let g of v){if(g.value=b.value||e.value,g.value&&this.cache.set(g.value,g),e.type&&g.type!==e.type)throw new Error(`Unsupported type <${re(g.type)}> in <${re(i.type)}>. Only <${re(e.type)}> is supported.`);m++,yield g}$=d.next(v)}return}if(e.key==null)return;let n=this,o={type:e.type,props:e.props,key:e.key,parentKey:i?i.key:null,value:e.value,level:i?i.level+1:0,index:e.index,rendered:e.rendered,textValue:e.textValue,"aria-label":e["aria-label"],wrapper:e.wrapper,shouldInvalidate:e.shouldInvalidate,hasChildNodes:e.hasChildNodes,childNodes:Se(function*(){if(!e.hasChildNodes)return;let a=0;for(let d of e.childNodes()){d.key!=null&&(d.key=`${o.key}${d.key}`),d.index=a;let m=n.getFullNode(d,n.getChildState(t,d),o.key,o);for(let $ of m)a++,yield $}})};yield o}constructor(){this.cache=new WeakMap}}function Se(l){let e=[],t=null;return{*[Symbol.iterator](){for(let s of e)yield s;t||(t=l());for(let s of t)e.push(s),yield s}}}function Jl(l,e){if(l&&e)return t=>l(e(t));if(l)return l;if(e)return e}function re(l){return l[0].toUpperCase()+l.slice(1)}function Ql(l,e,t){let s=u.useMemo(()=>new Gl,[]),{children:i,items:r,collection:n}=l;return u.useMemo(()=>{if(n)return n;let a=s.build({children:i,items:r},t);return e(a)},[s,i,r,n,t,e])}function Je(l,e){return typeof e.getChildren=="function"?e.getChildren(l.key):l.childNodes}function _l(l){return es(l,0)}function es(l,e){if(e<0)return;let t=0;for(let s of l){if(t===e)return s;t++}}function ne(l,e,t){if(e.parentKey===t.parentKey)return e.index-t.index;let s=[...Me(l,e),e],i=[...Me(l,t),t],r=s.slice(0,i.length).findIndex((n,o)=>n!==i[o]);return r!==-1?(e=s[r],t=i[r],e.index-t.index):s.findIndex(n=>n===t)>=0?1:(i.findIndex(n=>n===e)>=0,-1)}function Me(l,e){let t=[];for(;(e==null?void 0:e.parentKey)!=null;)e=l.getItem(e.parentKey),t.unshift(e);return t}const Ce=new WeakMap;function ts(l){let e=Ce.get(l);if(e!=null)return e;e=0;let t=s=>{for(let i of s)i.type==="section"?t(Je(i,l)):e++};return t(l),Ce.set(l,e),e}const Ae={border:0,clip:"rect(0 0 0 0)",clipPath:"inset(50%)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"};function ls(l={}){let{style:e,isFocusable:t}=l,[s,i]=u.useState(!1),{focusWithinProps:r}=pe({isDisabled:!t,onFocusWithinChange:o=>i(o)}),n=u.useMemo(()=>s?e:e?{...Ae,...e}:Ae,[s]);return{visuallyHiddenProps:{...r,style:n}}}function ss(l){let{children:e,elementType:t="div",isFocusable:s,style:i,...r}=l,{visuallyHiddenProps:n}=ls(l);return A.createElement(t,N(r,n),e)}function is(l){return l&&l.__esModule?l.default:l}const Ie={top:"top",bottom:"top",left:"left",right:"left"},te={top:"bottom",bottom:"top",left:"right",right:"left"},rs={top:"left",left:"top"},de={top:"height",left:"width"},ns={width:"totalWidth",height:"totalHeight"},_={};let q=typeof document<"u"&&window.visualViewport;function ke(l){let e=0,t=0,s=0,i=0,r=0,n=0,o={};if(l.tagName==="BODY"){let m=document.documentElement;s=m.clientWidth,i=m.clientHeight;var a;e=(a=q==null?void 0:q.width)!==null&&a!==void 0?a:s;var d;t=(d=q==null?void 0:q.height)!==null&&d!==void 0?d:i,o.top=m.scrollTop||l.scrollTop,o.left=m.scrollLeft||l.scrollLeft}else({width:e,height:t,top:r,left:n}=Y(l)),o.top=l.scrollTop,o.left=l.scrollLeft,s=e,i=t;return{width:e,height:t,totalWidth:s,totalHeight:i,scroll:o,top:r,left:n}}function os(l){return{top:l.scrollTop,left:l.scrollLeft,width:l.scrollWidth,height:l.scrollHeight}}function Ee(l,e,t,s,i,r){let n=i.scroll[l],o=s[de[l]],a=e-r-n,d=e+r-n+t;return a<0?-a:d>o?Math.max(o-d,-a):0}function as(l){let e=window.getComputedStyle(l);return{top:parseInt(e.marginTop,10)||0,bottom:parseInt(e.marginBottom,10)||0,left:parseInt(e.marginLeft,10)||0,right:parseInt(e.marginRight,10)||0}}function Fe(l){if(_[l])return _[l];let[e,t]=l.split(" "),s=Ie[e]||"right",i=rs[s];Ie[t]||(t="center");let r=de[s],n=de[i];return _[l]={placement:e,crossPlacement:t,axis:s,crossAxis:i,size:r,crossSize:n},_[l]}function oe(l,e,t,s,i,r,n,o,a,d){let{placement:m,crossPlacement:$,axis:b,crossAxis:c,size:h,crossSize:v}=s,g={};g[c]=l[c],$==="center"?g[c]+=(l[v]-t[v])/2:$!==c&&(g[c]+=l[v]-t[v]),g[c]+=r;const w=l[c]-t[v]+a+d,x=l[c]+l[v]-a-d;if(g[c]=ae(g[c],w,x),m===b){const P=o?n[h]:e[ns[h]];g[te[b]]=Math.floor(P-l[b]+i)}else g[b]=Math.floor(l[b]+l[h]+i);return g}function cs(l,e,t,s,i,r){return l.top!=null?Math.max(0,e.height+e.top+e.scroll.top-(t.top+l.top)-(i.top+i.bottom+r)):Math.max(0,s.top+t.top-(e.top+e.scroll.top)-(i.top+i.bottom+r))}function Oe(l,e,t,s,i,r){let{placement:n,axis:o,size:a}=r;return n===o?Math.max(0,t[o]-l[o]-l.scroll[o]+e[o]-s[o]-s[te[o]]-i):Math.max(0,l[a]+l[o]+l.scroll[o]-e[o]-t[o]-t[a]-s[o]-s[te[o]]-i)}function ds(l,e,t,s,i,r,n,o,a,d,m,$,b,c,h,v){let g=Fe(l),{size:w,crossAxis:x,crossSize:P,placement:S,crossPlacement:M}=g,k=oe(e,o,t,g,m,$,d,b,h,v),I=m,F=Oe(o,d,e,i,r+m,g);if(n&&s[w]>F){let V=Fe(`${te[S]} ${M}`),G=oe(e,o,t,V,m,$,d,b,h,v);Oe(o,d,e,i,r+m,V)>F&&(g=V,k=G,I=m)}let O=Ee(x,k[x],t[P],o,a,r);k[x]+=O;let f=cs(k,o,d,e,i,r);c&&c<f&&(f=c),t.height=Math.min(t.height,f),k=oe(e,o,t,g,I,$,d,b,h,v),O=Ee(x,k[x],t[P],o,a,r),k[x]+=O;let C={},D=e[x]+.5*e[P]-t[x];const E=h/2+v,R=t[P]-h/2-v,L=e[x]-t[x]+h/2,U=e[x]+e[P]-t[x]-h/2,p=ae(D,L,U);return C[x]=ae(p,E,R),{position:k,maxHeight:f,arrowOffsetLeft:C.left,arrowOffsetTop:C.top,placement:g.placement}}function us(l){let{placement:e,targetNode:t,overlayNode:s,scrollNode:i,padding:r,shouldFlip:n,boundaryElement:o,offset:a,crossOffset:d,maxHeight:m,arrowSize:$=0,arrowBoundaryOffset:b=0}=l,c=s instanceof HTMLElement?fs(s):document.documentElement,h=c===document.documentElement;const v=window.getComputedStyle(c).position;let g=!!v&&v!=="static",w=h?Y(t):Te(t,c);if(!h){let{marginTop:F,marginLeft:O}=window.getComputedStyle(t);w.top+=parseInt(F,10)||0,w.left+=parseInt(O,10)||0}let x=Y(s),P=as(s);x.width+=P.left+P.right,x.height+=P.top+P.bottom;let S=os(i),M=ke(o),k=ke(c),I=o.tagName==="BODY"?Y(c):Te(c,o);return ds(e,w,x,S,P,r,n,M,k,I,a,d,g,m,$,b)}function Y(l){let{top:e,left:t,width:s,height:i}=l.getBoundingClientRect(),{scrollTop:r,scrollLeft:n,clientTop:o,clientLeft:a}=document.documentElement;return{top:e+r-o,left:t+n-a,width:s,height:i}}function Te(l,e){let t=window.getComputedStyle(l),s;if(t.position==="fixed"){let{top:i,left:r,width:n,height:o}=l.getBoundingClientRect();s={top:i,left:r,width:n,height:o}}else{s=Y(l);let i=Y(e),r=window.getComputedStyle(e);i.top+=(parseInt(r.borderTopWidth,10)||0)-e.scrollTop,i.left+=(parseInt(r.borderLeftWidth,10)||0)-e.scrollLeft,s.top-=i.top,s.left-=i.left}return s.top-=parseInt(t.marginTop,10)||0,s.left-=parseInt(t.marginLeft,10)||0,s}function fs(l){let e=l.offsetParent;if(e&&e===document.body&&window.getComputedStyle(e).position==="static"&&!De(e)&&(e=document.documentElement),e==null)for(e=l.parentElement;e&&!De(e);)e=e.parentElement;return e||document.documentElement}function De(l){let e=window.getComputedStyle(l);return e.transform!=="none"||/transform|perspective/.test(e.willChange)||e.filter!=="none"||e.contain==="paint"||"backdropFilter"in e&&e.backdropFilter!=="none"||"WebkitBackdropFilter"in e&&e.WebkitBackdropFilter!=="none"}const Qe=new WeakMap;function hs(l){let{triggerRef:e,isOpen:t,onClose:s}=l;u.useEffect(()=>{if(!t||s===null)return;let i=r=>{let n=r.target;if(!e.current||n instanceof Node&&!n.contains(e.current))return;let o=s||Qe.get(e.current);o&&o()};return window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("scroll",i,!0)}},[t,s,e])}let j=typeof document<"u"&&window.visualViewport;function gs(l){let{direction:e}=He(),{arrowSize:t=0,targetRef:s,overlayRef:i,scrollRef:r=i,placement:n="bottom",containerPadding:o=12,shouldFlip:a=!0,boundaryElement:d=typeof document<"u"?document.body:null,offset:m=0,crossOffset:$=0,shouldUpdatePosition:b=!0,isOpen:c=!0,onClose:h,maxHeight:v,arrowBoundaryOffset:g=0}=l,[w,x]=u.useState({position:{},arrowOffsetLeft:void 0,arrowOffsetTop:void 0,maxHeight:void 0,placement:void 0}),P=[b,n,i.current,s.current,r.current,o,a,d,m,$,c,e,v,g,t],S=u.useCallback(()=>{if(b===!1||!c||!i.current||!s.current||!r.current||!d)return;let I=us({placement:ms(n,e),overlayNode:i.current,targetNode:s.current,scrollNode:r.current,padding:o,shouldFlip:a,boundaryElement:d,offset:m,crossOffset:$,maxHeight:v,arrowSize:t,arrowBoundaryOffset:g});Object.keys(I.position).forEach(F=>i.current.style[F]=I.position[F]+"px"),i.current.style.maxHeight=I.maxHeight!=null?I.maxHeight+"px":void 0,x(I)},P);ee(S,P),ps(S),xl({ref:i,onResize:S});let M=u.useRef(!1);ee(()=>{let I,F=()=>{M.current=!0,clearTimeout(I),I=setTimeout(()=>{M.current=!1},500),S()};return j==null||j.addEventListener("resize",F),j==null||j.addEventListener("scroll",F),()=>{j==null||j.removeEventListener("resize",F),j==null||j.removeEventListener("scroll",F)}},[S]);let k=u.useCallback(()=>{M.current||h()},[h,M]);return hs({triggerRef:s,isOpen:c,onClose:h&&k}),{overlayProps:{style:{position:"absolute",zIndex:1e5,...w.position,maxHeight:w.maxHeight}},placement:w.placement,arrowProps:{"aria-hidden":"true",role:"presentation",style:{left:w.arrowOffsetLeft,top:w.arrowOffsetTop}},updatePosition:S}}function ps(l){ee(()=>(window.addEventListener("resize",l,!1),()=>{window.removeEventListener("resize",l,!1)}),[l])}function ms(l,e){return e==="rtl"?l.replace("start","right").replace("end","left"):l.replace("start","left").replace("end","right")}const z=[];function ys(l,e){let{onClose:t,shouldCloseOnBlur:s,isOpen:i,isDismissable:r=!1,isKeyboardDismissDisabled:n=!1,shouldCloseOnInteractOutside:o}=l;u.useEffect(()=>(i&&z.push(e),()=>{let h=z.indexOf(e);h>=0&&z.splice(h,1)}),[i,e]);let a=()=>{z[z.length-1]===e&&t&&t()},d=h=>{(!o||o(h.target))&&z[z.length-1]===e&&(h.stopPropagation(),h.preventDefault())},m=h=>{(!o||o(h.target))&&(z[z.length-1]===e&&(h.stopPropagation(),h.preventDefault()),a())},$=h=>{h.key==="Escape"&&!n&&(h.stopPropagation(),h.preventDefault(),a())};Kl({ref:e,onInteractOutside:r?m:null,onInteractOutsideStart:d});let{focusWithinProps:b}=pe({isDisabled:!s,onBlurWithin:h=>{!h.relatedTarget||Pl(h.relatedTarget)||(!o||o(h.relatedTarget))&&t()}}),c=h=>{h.target===h.currentTarget&&h.preventDefault()};return{overlayProps:{onKeyDown:$,...b},underlayProps:{onPointerDown:c}}}function bs(l,e,t){let{type:s}=l,{isOpen:i}=e;u.useEffect(()=>{t&&t.current&&Qe.set(t.current,e.close)});let r;s==="menu"?r=!0:s==="listbox"&&(r="listbox");let n=se();return{triggerProps:{"aria-haspopup":r,"aria-expanded":i,"aria-controls":i?n:null,onPress:e.toggle},overlayProps:{id:n}}}const le=A.createContext(null);function _e(l){let{children:e}=l,t=u.useContext(le),[s,i]=u.useState(0),r=u.useMemo(()=>({parent:t,modalCount:s,addModal(){i(n=>n+1),t&&t.addModal()},removeModal(){i(n=>n-1),t&&t.removeModal()}}),[t,s]);return A.createElement(le.Provider,{value:r},e)}function vs(){let l=u.useContext(le);return{modalProviderProps:{"aria-hidden":l&&l.modalCount>0?!0:null}}}function $s(l){let{modalProviderProps:e}=vs();return A.createElement("div",{"data-overlay-container":!0,...l,...e})}function xs(l){return A.createElement(_e,null,A.createElement($s,l))}function Ks(l){let e=wl(),{portalContainer:t=e?null:document.body,...s}=l;if(A.useEffect(()=>{if(t!=null&&t.closest("[data-overlay-container]"))throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.")},[t]),!t)return null;let i=A.createElement(xs,s);return yl.createPortal(i,t)}function Ps(l){let e=u.useContext(le);if(!e)throw new Error("Modal is not contained within a provider");return u.useEffect(()=>{if(!(l!=null&&l.isDisabled||!e||!e.parent))return e.parent.addModal(),()=>{e&&e.parent&&e.parent.removeModal()}},[e,e.parent,l==null?void 0:l.isDisabled]),{modalProps:{"data-ismodal":!(l!=null&&l.isDisabled)}}}var et={},tt={};tt={dismiss:"تجاهل"};var lt={};lt={dismiss:"Отхвърляне"};var st={};st={dismiss:"Odstranit"};var it={};it={dismiss:"Luk"};var rt={};rt={dismiss:"Schließen"};var nt={};nt={dismiss:"Απόρριψη"};var ot={};ot={dismiss:"Dismiss"};var at={};at={dismiss:"Descartar"};var ct={};ct={dismiss:"Lõpeta"};var dt={};dt={dismiss:"Hylkää"};var ut={};ut={dismiss:"Rejeter"};var ft={};ft={dismiss:"התעלם"};var ht={};ht={dismiss:"Odbaci"};var gt={};gt={dismiss:"Elutasítás"};var pt={};pt={dismiss:"Ignora"};var mt={};mt={dismiss:"閉じる"};var yt={};yt={dismiss:"무시"};var bt={};bt={dismiss:"Atmesti"};var vt={};vt={dismiss:"Nerādīt"};var $t={};$t={dismiss:"Lukk"};var xt={};xt={dismiss:"Negeren"};var Kt={};Kt={dismiss:"Zignoruj"};var Pt={};Pt={dismiss:"Descartar"};var wt={};wt={dismiss:"Dispensar"};var St={};St={dismiss:"Revocare"};var Mt={};Mt={dismiss:"Пропустить"};var Ct={};Ct={dismiss:"Zrušiť"};var At={};At={dismiss:"Opusti"};var It={};It={dismiss:"Odbaci"};var kt={};kt={dismiss:"Avvisa"};var Et={};Et={dismiss:"Kapat"};var Ft={};Ft={dismiss:"Скасувати"};var Ot={};Ot={dismiss:"取消"};var Tt={};Tt={dismiss:"關閉"};et={"ar-AE":tt,"bg-BG":lt,"cs-CZ":st,"da-DK":it,"de-DE":rt,"el-GR":nt,"en-US":ot,"es-ES":at,"et-EE":ct,"fi-FI":dt,"fr-FR":ut,"he-IL":ft,"hr-HR":ht,"hu-HU":gt,"it-IT":pt,"ja-JP":mt,"ko-KR":yt,"lt-LT":bt,"lv-LV":vt,"nb-NO":$t,"nl-NL":xt,"pl-PL":Kt,"pt-BR":Pt,"pt-PT":wt,"ro-RO":St,"ru-RU":Mt,"sk-SK":Ct,"sl-SI":At,"sr-SP":It,"sv-SE":kt,"tr-TR":Et,"uk-UA":Ft,"zh-CN":Ot,"zh-TW":Tt};function ws(l){let{onDismiss:e,...t}=l,s=Ue(is(et)),i=Sl(t,s.format("dismiss")),r=()=>{e&&e()};return A.createElement(ss,null,A.createElement("button",{...i,tabIndex:-1,onClick:r}))}const Ss=A.createContext(null);function Ms(){let l=u.useContext(Ss),e=l==null?void 0:l.setContain;ee(()=>{e==null||e(!0)},[e])}function Cs(l,e){let{role:t="dialog"}=l,s=ce();s=l["aria-label"]?void 0:s;let i=u.useRef(!1);return u.useEffect(()=>{if(e.current&&!e.current.contains(document.activeElement)){J(e.current);let r=setTimeout(()=>{document.activeElement===e.current&&(i.current=!0,e.current.blur(),J(e.current),i.current=!1)},500);return()=>{clearTimeout(r)}}},[e]),Ms(),{dialogProps:{...ie(l,{labelable:!0}),role:t,tabIndex:-1,"aria-labelledby":l["aria-labelledby"]||s,onBlur:r=>{i.current&&r.stopPropagation()}},titleProps:{id:s}}}const je=300;function As(l){var P,S,M;const e=u.useRef(null),t=u.useRef(null),{popoverRef:s=e,isOpen:i,onClose:r,children:n,isCalendar:o,...a}=l,{overlayProps:d}=ys({isOpen:i,onClose:r,isDismissable:!0},s),{modalProps:m}=Ps(),{dialogProps:$}=Cs(a,s),{overlayProps:b,updatePosition:c}=gs({isOpen:i,offset:2,containerPadding:0,overlayRef:e,targetRef:t,placement:"bottom start"});u.useLayoutEffect(()=>{i&&requestAnimationFrame(()=>{c()})},[i,c]);const h=((P=t.current)==null?void 0:P.clientWidth)??0,v=parseInt(((M=(S=b.style)==null?void 0:S.left)==null?void 0:M.toString())||"0",10),g=o?je:h,w=o?h-je+v:v,x={...b.style,left:w,width:g};return y.jsx("div",{ref:t,children:y.jsx(Ks,{children:y.jsx(Ml,{contain:!0,children:y.jsxs("div",{...N(d,m,$),ref:s,className:"w-full absolute top-full bg-gray-200 dark:bg-primary border border-gray-400 dark:border-secondary rounded-md shadow-lg mt-2 p-2 z-10",style:{zIndex:999,...x},children:[n,y.jsx(ws,{onDismiss:r})]})})})})}function ue(l){return Fl()?l.altKey:l.ctrlKey}function Z(l){return Xe()?l.metaKey:l.ctrlKey}const Is=1e3;function ks(l){let{keyboardDelegate:e,selectionManager:t,onTypeSelect:s}=l,i=u.useRef({search:"",timeout:null}).current,r=n=>{let o=Es(n.key);if(!o||n.ctrlKey||n.metaKey||!n.currentTarget.contains(n.target))return;o===" "&&i.search.trim().length>0&&(n.preventDefault(),"continuePropagation"in n||n.stopPropagation()),i.search+=o;let a=e.getKeyForSearch(i.search,t.focusedKey);a==null&&(a=e.getKeyForSearch(i.search)),a!=null&&(t.setFocusedKey(a),s&&s(a)),clearTimeout(i.timeout),i.timeout=setTimeout(()=>{i.search=""},Is)};return{typeSelectProps:{onKeyDownCapture:e.getKeyForSearch?r:null}}}function Es(l){return l.length===1||!/^[A-Z]/i.test(l)?l:""}function Fs(l){let{selectionManager:e,keyboardDelegate:t,ref:s,autoFocus:i=!1,shouldFocusWrap:r=!1,disallowEmptySelection:n=!1,disallowSelectAll:o=!1,selectOnFocus:a=e.selectionBehavior==="replace",disallowTypeAhead:d=!1,shouldUseVirtualFocus:m,allowsTabNavigation:$=!1,isVirtualized:b,scrollRef:c=s,linkBehavior:h="action"}=l,{direction:v}=He(),g=Ve(),w=f=>{if(f.altKey&&f.key==="Tab"&&f.preventDefault(),!s.current.contains(f.target))return;const C=(K,W)=>{if(K!=null){if(e.isLink(K)&&h==="selection"&&a&&!ue(f)){bl.flushSync(()=>{e.setFocusedKey(K,W)});let X=c.current.querySelector(`[data-key="${K}"]`);g.open(X,f);return}if(e.setFocusedKey(K,W),e.isLink(K)&&h==="override")return;f.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(K):a&&!ue(f)&&e.replaceSelection(K)}};switch(f.key){case"ArrowDown":if(t.getKeyBelow){var D,E;f.preventDefault();let K=e.focusedKey!=null?t.getKeyBelow(e.focusedKey):(D=t.getFirstKey)===null||D===void 0?void 0:D.call(t);K==null&&r&&(K=(E=t.getFirstKey)===null||E===void 0?void 0:E.call(t,e.focusedKey)),C(K)}break;case"ArrowUp":if(t.getKeyAbove){var R,L;f.preventDefault();let K=e.focusedKey!=null?t.getKeyAbove(e.focusedKey):(R=t.getLastKey)===null||R===void 0?void 0:R.call(t);K==null&&r&&(K=(L=t.getLastKey)===null||L===void 0?void 0:L.call(t,e.focusedKey)),C(K)}break;case"ArrowLeft":if(t.getKeyLeftOf){var U,p;f.preventDefault();let K=t.getKeyLeftOf(e.focusedKey);K==null&&r&&(K=v==="rtl"?(U=t.getFirstKey)===null||U===void 0?void 0:U.call(t,e.focusedKey):(p=t.getLastKey)===null||p===void 0?void 0:p.call(t,e.focusedKey)),C(K,v==="rtl"?"first":"last")}break;case"ArrowRight":if(t.getKeyRightOf){var V,G;f.preventDefault();let K=t.getKeyRightOf(e.focusedKey);K==null&&r&&(K=v==="rtl"?(V=t.getLastKey)===null||V===void 0?void 0:V.call(t,e.focusedKey):(G=t.getFirstKey)===null||G===void 0?void 0:G.call(t,e.focusedKey)),C(K,v==="rtl"?"last":"first")}break;case"Home":if(t.getFirstKey){f.preventDefault();let K=t.getFirstKey(e.focusedKey,Z(f));e.setFocusedKey(K),Z(f)&&f.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(K):a&&e.replaceSelection(K)}break;case"End":if(t.getLastKey){f.preventDefault();let K=t.getLastKey(e.focusedKey,Z(f));e.setFocusedKey(K),Z(f)&&f.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(K):a&&e.replaceSelection(K)}break;case"PageDown":if(t.getKeyPageBelow){f.preventDefault();let K=t.getKeyPageBelow(e.focusedKey);C(K)}break;case"PageUp":if(t.getKeyPageAbove){f.preventDefault();let K=t.getKeyPageAbove(e.focusedKey);C(K)}break;case"a":Z(f)&&e.selectionMode==="multiple"&&o!==!0&&(f.preventDefault(),e.selectAll());break;case"Escape":f.preventDefault(),n||e.clearSelection();break;case"Tab":if(!$){if(f.shiftKey)s.current.focus();else{let K=Ol(s.current,{tabbable:!0}),W,X;do X=K.lastChild(),X&&(W=X);while(X);W&&!W.contains(document.activeElement)&&Pe(W)}break}}},x=u.useRef({top:0,left:0});Al(c,"scroll",b?null:()=>{x.current={top:c.current.scrollTop,left:c.current.scrollLeft}});let P=f=>{if(e.isFocused){f.currentTarget.contains(f.target)||e.setFocused(!1);return}if(f.currentTarget.contains(f.target)){if(e.setFocused(!0),e.focusedKey==null){let E=L=>{L!=null&&(e.setFocusedKey(L),a&&e.replaceSelection(L))},R=f.relatedTarget;var C,D;R&&f.currentTarget.compareDocumentPosition(R)&Node.DOCUMENT_POSITION_FOLLOWING?E((C=e.lastSelectedKey)!==null&&C!==void 0?C:t.getLastKey()):E((D=e.firstSelectedKey)!==null&&D!==void 0?D:t.getFirstKey())}else b||(c.current.scrollTop=x.current.top,c.current.scrollLeft=x.current.left);if(!b&&e.focusedKey!=null){let E=c.current.querySelector(`[data-key="${e.focusedKey}"]`);E&&(E.contains(document.activeElement)||Pe(E),Ke()==="keyboard"&&$e(E,{containingElement:s.current}))}}},S=f=>{f.currentTarget.contains(f.relatedTarget)||e.setFocused(!1)};const M=u.useRef(i);u.useEffect(()=>{if(M.current){let f=null;i==="first"&&(f=t.getFirstKey()),i==="last"&&(f=t.getLastKey());let C=e.selectedKeys;C.size&&(f=C.values().next().value),e.setFocused(!0),e.setFocusedKey(f),f==null&&!m&&J(s.current)}M.current=!1},[]);let k=u.useRef(e.focusedKey);u.useEffect(()=>{let f=Ke();if(e.isFocused&&e.focusedKey!=null&&(c!=null&&c.current)){let C=c.current.querySelector(`[data-key="${e.focusedKey}"]`);C&&f==="keyboard"&&(b||Il(c.current,C),$e(C,{containingElement:s.current}))}e.isFocused&&e.focusedKey==null&&k.current!=null&&J(s.current),k.current=e.focusedKey},[b,c,e.focusedKey,e.isFocused,s]);let I={onKeyDown:w,onFocus:P,onBlur:S,onMouseDown(f){c.current===f.target&&f.preventDefault()}},{typeSelectProps:F}=ks({keyboardDelegate:t,selectionManager:e});d||(I=N(F,I));let O;return m||(O=e.focusedKey==null?0:-1),{collectionProps:{...I,tabIndex:O}}}function Os(l){let{selectionManager:e,key:t,ref:s,shouldSelectOnPressUp:i,shouldUseVirtualFocus:r,focus:n,isDisabled:o,onAction:a,allowsDifferentPressOrigin:d,linkBehavior:m="action"}=l,$=Ve(),b=p=>{if(p.pointerType==="keyboard"&&ue(p))e.toggleSelection(t);else{if(e.selectionMode==="none")return;if(e.isLink(t)){if(m==="selection"){$.open(s.current,p),e.setSelectedKeys(e.selectedKeys);return}else if(m==="override"||m==="none")return}e.selectionMode==="single"?e.isSelected(t)&&!e.disallowEmptySelection?e.toggleSelection(t):e.replaceSelection(t):p&&p.shiftKey?e.extendSelection(t):e.selectionBehavior==="toggle"||p&&(Z(p)||p.pointerType==="touch"||p.pointerType==="virtual")?e.toggleSelection(t):e.replaceSelection(t)}};u.useEffect(()=>{t===e.focusedKey&&e.isFocused&&!r&&(n?n():document.activeElement!==s.current&&J(s.current))},[s,t,e.focusedKey,e.childFocusStrategy,e.isFocused,r]),o=o||e.isDisabled(t);let c={};!r&&!o?c={tabIndex:t===e.focusedKey?0:-1,onFocus(p){p.target===s.current&&e.setFocusedKey(t)}}:o&&(c.onMouseDown=p=>{p.preventDefault()});let h=e.isLink(t)&&m==="override",v=e.isLink(t)&&m!=="selection"&&m!=="none",g=!o&&e.canSelectItem(t)&&!h,w=(a||v)&&!o,x=w&&(e.selectionBehavior==="replace"?!g:!g||e.isEmpty),P=w&&g&&e.selectionBehavior==="replace",S=x||P,M=u.useRef(null),k=S&&g,I=u.useRef(!1),F=u.useRef(!1),O=p=>{a&&a(),v&&$.open(s.current,p)},f={};i?(f.onPressStart=p=>{M.current=p.pointerType,I.current=k,p.pointerType==="keyboard"&&(!S||Le())&&b(p)},d?(f.onPressUp=x?null:p=>{p.pointerType!=="keyboard"&&g&&b(p)},f.onPress=x?O:null):f.onPress=p=>{if(x||P&&p.pointerType!=="mouse"){if(p.pointerType==="keyboard"&&!Re())return;O(p)}else p.pointerType!=="keyboard"&&g&&b(p)}):(f.onPressStart=p=>{M.current=p.pointerType,I.current=k,F.current=x,g&&(p.pointerType==="mouse"&&!x||p.pointerType==="keyboard"&&(!w||Le()))&&b(p)},f.onPress=p=>{(p.pointerType==="touch"||p.pointerType==="pen"||p.pointerType==="virtual"||p.pointerType==="keyboard"&&S&&Re()||p.pointerType==="mouse"&&F.current)&&(S?O(p):g&&b(p))}),c["data-key"]=t,f.preventFocusOnPress=r;let{pressProps:C,isPressed:D}=kl(f),E=P?p=>{M.current==="mouse"&&(p.stopPropagation(),p.preventDefault(),O(p))}:void 0,{longPressProps:R}=We({isDisabled:!k,onLongPress(p){p.pointerType==="touch"&&(b(p),e.setSelectionBehavior("toggle"))}}),L=p=>{M.current==="touch"&&I.current&&p.preventDefault()},U=e.isLink(t)?p=>{El.isOpening||p.preventDefault()}:void 0;return{itemProps:N(c,g||x?C:{},k?R:{},{onDoubleClick:E,onDragStartCapture:L,onClick:U}),isPressed:D,isSelected:e.isSelected(t),isFocused:e.isFocused&&e.focusedKey===t,isDisabled:o,allowsSelection:g,hasAction:S}}function Re(){let l=window.event;return(l==null?void 0:l.key)==="Enter"}function Le(){let l=window.event;return(l==null?void 0:l.key)===" "||(l==null?void 0:l.code)==="Space"}class Ts{getNextKey(e){for(e=this.collection.getKeyAfter(e);e!=null;){if(this.collection.getItem(e).type==="item"&&!this.disabledKeys.has(e))return e;e=this.collection.getKeyAfter(e)}return null}getPreviousKey(e){for(e=this.collection.getKeyBefore(e);e!=null;){if(this.collection.getItem(e).type==="item"&&!this.disabledKeys.has(e))return e;e=this.collection.getKeyBefore(e)}return null}findKey(e,t,s){let i=this.getItem(e);if(!i)return null;let r=i.getBoundingClientRect();do e=t(e),i=this.getItem(e);while(i&&s(r,i.getBoundingClientRect()));return e}isSameRow(e,t){return e.top===t.top||e.left!==t.left}isSameColumn(e,t){return e.left===t.left||e.top!==t.top}getKeyBelow(e){return this.layout==="grid"&&this.orientation==="vertical"?this.findKey(e,t=>this.getNextKey(t),this.isSameRow):this.getNextKey(e)}getKeyAbove(e){return this.layout==="grid"&&this.orientation==="vertical"?this.findKey(e,t=>this.getPreviousKey(t),this.isSameRow):this.getPreviousKey(e)}getNextColumn(e,t){return t?this.getPreviousKey(e):this.getNextKey(e)}getKeyRightOf(e){return this.layout==="grid"?this.orientation==="vertical"?this.getNextColumn(e,this.direction==="rtl"):this.findKey(e,t=>this.getNextColumn(t,this.direction==="rtl"),this.isSameColumn):this.orientation==="horizontal"?this.getNextColumn(e,this.direction==="rtl"):null}getKeyLeftOf(e){return this.layout==="grid"?this.orientation==="vertical"?this.getNextColumn(e,this.direction==="ltr"):this.findKey(e,t=>this.getNextColumn(t,this.direction==="ltr"),this.isSameColumn):this.orientation==="horizontal"?this.getNextColumn(e,this.direction==="ltr"):null}getFirstKey(){let e=this.collection.getFirstKey();for(;e!=null;){if(this.collection.getItem(e).type==="item"&&!this.disabledKeys.has(e))return e;e=this.collection.getKeyAfter(e)}return null}getLastKey(){let e=this.collection.getLastKey();for(;e!=null;){if(this.collection.getItem(e).type==="item"&&!this.disabledKeys.has(e))return e;e=this.collection.getKeyBefore(e)}return null}getItem(e){return this.ref.current.querySelector(`[data-key="${e}"]`)}getKeyPageAbove(e){let t=this.ref.current,s=this.getItem(e);if(!s)return null;if(!xe(t))return this.getFirstKey();let i=t.getBoundingClientRect(),r=s.getBoundingClientRect();if(this.orientation==="horizontal"){let n=i.x-t.scrollLeft,o=Math.max(0,r.x-n+r.width-i.width);for(;s&&r.x-n>o;)e=this.getKeyAbove(e),s=e==null?null:this.getItem(e),r=s==null?void 0:s.getBoundingClientRect()}else{let n=i.y-t.scrollTop,o=Math.max(0,r.y-n+r.height-i.height);for(;s&&r.y-n>o;)e=this.getKeyAbove(e),s=e==null?null:this.getItem(e),r=s==null?void 0:s.getBoundingClientRect()}return e??this.getFirstKey()}getKeyPageBelow(e){let t=this.ref.current,s=this.getItem(e);if(!s)return null;if(!xe(t))return this.getLastKey();let i=t.getBoundingClientRect(),r=s.getBoundingClientRect();if(this.orientation==="horizontal"){let n=i.x-t.scrollLeft,o=Math.min(t.scrollWidth,r.x-n-r.width+i.width);for(;s&&r.x-n<o;)e=this.getKeyBelow(e),s=e==null?null:this.getItem(e),r=s==null?void 0:s.getBoundingClientRect()}else{let n=i.y-t.scrollTop,o=Math.min(t.scrollHeight,r.y-n-r.height+i.height);for(;s&&r.y-n<o;)e=this.getKeyBelow(e),s=e==null?null:this.getItem(e),r=s==null?void 0:s.getBoundingClientRect()}return e??this.getLastKey()}getKeyForSearch(e,t){if(!this.collator)return null;let s=this.collection,i=t||this.getFirstKey();for(;i!=null;){let r=s.getItem(i),n=r.textValue.slice(0,e.length);if(r.textValue&&this.collator.compare(n,e)===0)return i;i=this.getKeyBelow(i)}return null}constructor(...e){if(e.length===1){let t=e[0];this.collection=t.collection,this.ref=t.ref,this.collator=t.collator,this.disabledKeys=t.disabledKeys||new Set,this.orientation=t.orientation,this.direction=t.direction,this.layout=t.layout||"stack"}else this.collection=e[0],this.disabledKeys=e[1],this.ref=e[2],this.collator=e[3],this.layout="stack",this.orientation="vertical";this.layout==="stack"&&this.orientation==="vertical"&&(this.getKeyLeftOf=void 0,this.getKeyRightOf=void 0)}}function Ds(l){let{selectionManager:e,collection:t,disabledKeys:s,ref:i,keyboardDelegate:r}=l,n=Cl({usage:"search",sensitivity:"base"}),o=e.disabledBehavior,a=u.useMemo(()=>r||new Ts(t,o==="selection"?new Set:s,i,n),[r,t,s,i,n,o]),{collectionProps:d}=Fs({...l,ref:i,selectionManager:e,keyboardDelegate:a});return{listProps:d}}const me=new WeakMap;function js(l){return typeof l=="string"?l.replace(/\s*/g,""):""+l}function Rs(l,e){let t=me.get(l);if(!t)throw new Error("Unknown list");return`${t.id}-option-${js(e)}`}function Ls(l,e,t){let s=ie(l,{labelable:!0}),i=l.selectionBehavior||"toggle",r=l.linkBehavior||(i==="replace"?"action":"override");i==="toggle"&&r==="action"&&(r="override");let{listProps:n}=Ds({...l,ref:t,selectionManager:e.selectionManager,collection:e.collection,disabledKeys:e.disabledKeys,linkBehavior:r}),{focusWithinProps:o}=pe({onFocusWithin:l.onFocus,onBlurWithin:l.onBlur,onFocusWithinChange:l.onFocusChange}),a=se(l.id);me.set(e,{id:a,shouldUseVirtualFocus:l.shouldUseVirtualFocus,shouldSelectOnPressUp:l.shouldSelectOnPressUp,shouldFocusOnHover:l.shouldFocusOnHover,isVirtualized:l.isVirtualized,onAction:l.onAction,linkBehavior:r});let{labelProps:d,fieldProps:m}=Tl({...l,id:a,labelElementType:"span"});return{labelProps:d,listBoxProps:N(s,o,e.selectionManager.selectionMode==="multiple"?{"aria-multiselectable":"true"}:{},{role:"listbox",...N(m,n)})}}function Bs(l,e,t){var s;let{key:i}=l,r=me.get(e);var n;let o=(n=l.isDisabled)!==null&&n!==void 0?n:e.disabledKeys.has(i);var a;let d=(a=l.isSelected)!==null&&a!==void 0?a:e.selectionManager.isSelected(i);var m;let $=(m=l.shouldSelectOnPressUp)!==null&&m!==void 0?m:r==null?void 0:r.shouldSelectOnPressUp;var b;let c=(b=l.shouldFocusOnHover)!==null&&b!==void 0?b:r==null?void 0:r.shouldFocusOnHover;var h;let v=(h=l.shouldUseVirtualFocus)!==null&&h!==void 0?h:r==null?void 0:r.shouldUseVirtualFocus;var g;let w=(g=l.isVirtualized)!==null&&g!==void 0?g:r==null?void 0:r.isVirtualized,x=ce(),P=ce(),S={role:"option","aria-disabled":o||void 0,"aria-selected":e.selectionManager.selectionMode!=="none"?d:void 0};Xe()&&Dl()||(S["aria-label"]=l["aria-label"],S["aria-labelledby"]=x,S["aria-describedby"]=P);let M=e.collection.getItem(i);if(w){let E=Number(M==null?void 0:M.index);S["aria-posinset"]=Number.isNaN(E)?void 0:E+1,S["aria-setsize"]=ts(e.collection)}let{itemProps:k,isPressed:I,isFocused:F,hasAction:O,allowsSelection:f}=Os({selectionManager:e.selectionManager,key:i,ref:t,shouldSelectOnPressUp:$,allowsDifferentPressOrigin:$&&c,isVirtualized:w,shouldUseVirtualFocus:v,isDisabled:o,onAction:r!=null&&r.onAction?()=>{var E;return r==null||(E=r.onAction)===null||E===void 0?void 0:E.call(r,i)}:void 0,linkBehavior:r==null?void 0:r.linkBehavior}),{hoverProps:C}=jl({isDisabled:o||!c,onHoverStart(){we()||(e.selectionManager.setFocused(!0),e.selectionManager.setFocusedKey(i))}}),D=ie(M==null?void 0:M.props,{isLink:!!(!(M==null||(s=M.props)===null||s===void 0)&&s.href)});return delete D.id,{optionProps:{...S,...N(D,k,C),id:Rs(e,i)},labelProps:{id:x},descriptionProps:{id:P},isFocused:F,isFocusVisible:F&&we(),isSelected:d,isDisabled:o,isPressed:I,allowsSelection:f,hasAction:O}}var zs=["color","size","title"];function fe(){return fe=Object.assign||function(l){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(l[s]=t[s])}return l},fe.apply(this,arguments)}function Ns(l,e){if(l==null)return{};var t=Hs(l,e),s,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(l);for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(l,s)&&(t[s]=l[s])}return t}function Hs(l,e){if(l==null)return{};var t={},s=Object.keys(l),i,r;for(r=0;r<s.length;r++)i=s[r],!(e.indexOf(i)>=0)&&(t[i]=l[i]);return t}var ye=u.forwardRef(function(l,e){var t=l.color,s=l.size,i=l.title,r=Ns(l,zs);return A.createElement("svg",fe({ref:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:s,height:s,fill:t},r),i?A.createElement("title",null,i):null,A.createElement("path",{d:"M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.267.267 0 0 1 .02-.022z"}))});ye.propTypes={color:T.string,size:T.oneOfType([T.string,T.number]),title:T.string};ye.defaultProps={color:"currentColor",size:"1em",title:null};const Us=ye;var Vs=["color","size","title"];function he(){return he=Object.assign||function(l){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(l[s]=t[s])}return l},he.apply(this,arguments)}function Ws(l,e){if(l==null)return{};var t=Xs(l,e),s,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(l);for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(l,s)&&(t[s]=l[s])}return t}function Xs(l,e){if(l==null)return{};var t={},s=Object.keys(l),i,r;for(r=0;r<s.length;r++)i=s[r],!(e.indexOf(i)>=0)&&(t[i]=l[i]);return t}var be=u.forwardRef(function(l,e){var t=l.color,s=l.size,i=l.title,r=Ws(l,Vs);return A.createElement("svg",he({ref:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:s,height:s,fill:t},r),i?A.createElement("title",null,i):null,A.createElement("path",{fillRule:"evenodd",d:"M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"}))});be.propTypes={color:T.string,size:T.oneOfType([T.string,T.number]),title:T.string};be.defaultProps={color:"currentColor",size:"1em",title:null};const qs=be;var Zs=["color","size","title"];function ge(){return ge=Object.assign||function(l){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(l[s]=t[s])}return l},ge.apply(this,arguments)}function Ys(l,e){if(l==null)return{};var t=Gs(l,e),s,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(l);for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(l,s)&&(t[s]=l[s])}return t}function Gs(l,e){if(l==null)return{};var t={},s=Object.keys(l),i,r;for(r=0;r<s.length;r++)i=s[r],!(e.indexOf(i)>=0)&&(t[i]=l[i]);return t}var ve=u.forwardRef(function(l,e){var t=l.color,s=l.size,i=l.title,r=Ys(l,Zs);return A.createElement("svg",ge({ref:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:s,height:s,fill:t},r),i?A.createElement("title",null,i):null,A.createElement("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"}))});ve.propTypes={color:T.string,size:T.oneOfType([T.string,T.number]),title:T.string};ve.defaultProps={color:"currentColor",size:"1em",title:null};const Dt=ve;function Js(l){const e=u.useRef(null),{optionProps:t,isDisabled:s,isSelected:i,isFocusVisible:r}=Bs({key:l.item.key},l.state,e);return y.jsxs("li",{...t,ref:e,className:qe({variant:"transparent",size:"md",className:H("flex items-center justify-between my-1 hover:bg-gray-300 dark:hover:bg-secondary focus:bg-gray-300 dark:focus:bg-secondary",(i||r)&&"dark:bg-secondary bg-gray-300",s&&"cursor-not-allowed opacity-70")}),children:[l.item.rendered,i?y.jsx(Us,{"aria-label":`Selected ${l.item.textValue}`,className:"dark:text-gray-400"}):null]})}function Qs(l){const e=u.useRef(null),{listBoxRef:t=e,state:s}=l,{listBoxProps:i}=Ls(l,s,t),r=Ne.useTranslations("Common");return y.jsx("ul",{...i,ref:t,className:"max-h-72 overflow-auto outline-none",children:s.collection.size<=0?y.jsx("li",{className:"text-center text-sm dark:text-gray-400 text-neutral-700",children:r("noOptions")}):[...s.collection].map(n=>y.jsx(Js,{item:n,state:s},n.key))})}function _s(l){let[e,t]=Ze(l.isOpen,l.defaultOpen||!1,l.onOpenChange);const s=u.useCallback(()=>{t(!0)},[t]),i=u.useCallback(()=>{t(!1)},[t]),r=u.useCallback(()=>{t(!e)},[t,e]);return{isOpen:e,setOpen:t,open:s,close:i,toggle:r}}function ei(l){let e=_s(l),[t,s]=u.useState(null);return{focusStrategy:t,...e,open(i=null){s(i),e.open()},toggle(i=null){s(i),e.toggle()}}}class B extends Set{constructor(e,t,s){super(e),e instanceof B?(this.anchorKey=t||e.anchorKey,this.currentKey=s||e.currentKey):(this.anchorKey=t,this.currentKey=s)}}function ti(l,e){if(l.size!==e.size)return!1;for(let t of l)if(!e.has(t))return!1;return!0}function li(l){let{selectionMode:e="none",disallowEmptySelection:t,allowDuplicateSelectionEvents:s,selectionBehavior:i="toggle",disabledBehavior:r="all"}=l,n=u.useRef(!1),[,o]=u.useState(!1),a=u.useRef(null),d=u.useRef(null),[,m]=u.useState(null),$=u.useMemo(()=>Be(l.selectedKeys),[l.selectedKeys]),b=u.useMemo(()=>Be(l.defaultSelectedKeys,new B),[l.defaultSelectedKeys]),[c,h]=Ze($,b,l.onSelectionChange),v=u.useMemo(()=>l.disabledKeys?new Set(l.disabledKeys):new Set,[l.disabledKeys]),[g,w]=u.useState(i);i==="replace"&&g==="toggle"&&typeof c=="object"&&c.size===0&&w("replace");let x=u.useRef(i);return u.useEffect(()=>{i!==x.current&&(w(i),x.current=i)},[i]),{selectionMode:e,disallowEmptySelection:t,selectionBehavior:g,setSelectionBehavior:w,get isFocused(){return n.current},setFocused(P){n.current=P,o(P)},get focusedKey(){return a.current},get childFocusStrategy(){return d.current},setFocusedKey(P,S="first"){a.current=P,d.current=S,m(P)},selectedKeys:c,setSelectedKeys(P){(s||!ti(P,c))&&h(P)},disabledKeys:v,disabledBehavior:r}}function Be(l,e){return l?l==="all"?"all":new B(l):e}class si{get selectionMode(){return this.state.selectionMode}get disallowEmptySelection(){return this.state.disallowEmptySelection}get selectionBehavior(){return this.state.selectionBehavior}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}get isFocused(){return this.state.isFocused}setFocused(e){this.state.setFocused(e)}get focusedKey(){return this.state.focusedKey}get childFocusStrategy(){return this.state.childFocusStrategy}setFocusedKey(e,t){(e==null||this.collection.getItem(e))&&this.state.setFocusedKey(e,t)}get selectedKeys(){return this.state.selectedKeys==="all"?new Set(this.getSelectAllKeys()):this.state.selectedKeys}get rawSelection(){return this.state.selectedKeys}isSelected(e){return this.state.selectionMode==="none"?!1:(e=this.getKey(e),this.state.selectedKeys==="all"?this.canSelectItem(e):this.state.selectedKeys.has(e))}get isEmpty(){return this.state.selectedKeys!=="all"&&this.state.selectedKeys.size===0}get isSelectAll(){if(this.isEmpty)return!1;if(this.state.selectedKeys==="all")return!0;if(this._isSelectAll!=null)return this._isSelectAll;let e=this.getSelectAllKeys(),t=this.state.selectedKeys;return this._isSelectAll=e.every(s=>t.has(s)),this._isSelectAll}get firstSelectedKey(){let e=null;for(let t of this.state.selectedKeys){let s=this.collection.getItem(t);(!e||s&&ne(this.collection,s,e)<0)&&(e=s)}return e==null?void 0:e.key}get lastSelectedKey(){let e=null;for(let t of this.state.selectedKeys){let s=this.collection.getItem(t);(!e||s&&ne(this.collection,s,e)>0)&&(e=s)}return e==null?void 0:e.key}get disabledKeys(){return this.state.disabledKeys}get disabledBehavior(){return this.state.disabledBehavior}extendSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"){this.replaceSelection(e);return}e=this.getKey(e);let t;if(this.state.selectedKeys==="all")t=new B([e],e,e);else{let s=this.state.selectedKeys,i=s.anchorKey||e;t=new B(s,i,e);for(let r of this.getKeyRange(i,s.currentKey||e))t.delete(r);for(let r of this.getKeyRange(e,i))this.canSelectItem(r)&&t.add(r)}this.state.setSelectedKeys(t)}getKeyRange(e,t){let s=this.collection.getItem(e),i=this.collection.getItem(t);return s&&i?ne(this.collection,s,i)<=0?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){let s=[],i=e;for(;i;){let r=this.collection.getItem(i);if((r&&r.type==="item"||r.type==="cell"&&this.allowsCellSelection)&&s.push(i),i===t)return s;i=this.collection.getKeyAfter(i)}return[]}getKey(e){let t=this.collection.getItem(e);if(!t||t.type==="cell"&&this.allowsCellSelection)return e;for(;t.type!=="item"&&t.parentKey!=null;)t=this.collection.getItem(t.parentKey);return!t||t.type!=="item"?null:t.key}toggleSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"&&!this.isSelected(e)){this.replaceSelection(e);return}if(e=this.getKey(e),e==null)return;let t=new B(this.state.selectedKeys==="all"?this.getSelectAllKeys():this.state.selectedKeys);t.has(e)?t.delete(e):this.canSelectItem(e)&&(t.add(e),t.anchorKey=e,t.currentKey=e),!(this.disallowEmptySelection&&t.size===0)&&this.state.setSelectedKeys(t)}replaceSelection(e){if(this.selectionMode==="none"||(e=this.getKey(e),e==null))return;let t=this.canSelectItem(e)?new B([e],e,e):new B;this.state.setSelectedKeys(t)}setSelectedKeys(e){if(this.selectionMode==="none")return;let t=new B;for(let s of e)if(s=this.getKey(s),s!=null&&(t.add(s),this.selectionMode==="single"))break;this.state.setSelectedKeys(t)}getSelectAllKeys(){let e=[],t=s=>{for(;s;){if(this.canSelectItem(s)){let i=this.collection.getItem(s);i.type==="item"&&e.push(s),i.hasChildNodes&&(this.allowsCellSelection||i.type!=="item")&&t(_l(Je(i,this.collection)).key)}s=this.collection.getKeyAfter(s)}};return t(this.collection.getFirstKey()),e}selectAll(){!this.isSelectAll&&this.selectionMode==="multiple"&&this.state.setSelectedKeys("all")}clearSelection(){!this.disallowEmptySelection&&(this.state.selectedKeys==="all"||this.state.selectedKeys.size>0)&&this.state.setSelectedKeys(new B)}toggleSelectAll(){this.isSelectAll?this.clearSelection():this.selectAll()}select(e,t){this.selectionMode!=="none"&&(this.selectionMode==="single"?this.isSelected(e)&&!this.disallowEmptySelection?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior==="toggle"||t&&(t.pointerType==="touch"||t.pointerType==="virtual")?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys)return!0;let t=this.selectedKeys;if(e.size!==t.size)return!1;for(let s of e)if(!t.has(s))return!1;for(let s of t)if(!e.has(s))return!1;return!0}canSelectItem(e){if(this.state.selectionMode==="none"||this.state.disabledKeys.has(e))return!1;let t=this.collection.getItem(e);return!(!t||t.type==="cell"&&!this.allowsCellSelection)}isDisabled(e){return this.state.disabledKeys.has(e)&&this.state.disabledBehavior==="all"}isLink(e){var t,s;return!!(!((t=this.collection.getItem(e))===null||t===void 0||(s=t.props)===null||s===void 0)&&s.href)}constructor(e,t,s){this.collection=e,this.state=t;var i;this.allowsCellSelection=(i=s==null?void 0:s.allowsCellSelection)!==null&&i!==void 0?i:!1,this._isSelectAll=null}}class ze{*[Symbol.iterator](){yield*this.iterable}get size(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let t=this.keyMap.get(e);return t?t.prevKey:null}getKeyAfter(e){let t=this.keyMap.get(e);return t?t.nextKey:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){const t=[...this.getKeys()];return this.getItem(t[e])}getChildren(e){let t=this.keyMap.get(e);return(t==null?void 0:t.childNodes)||[]}constructor(e){this.keyMap=new Map,this.iterable=e;let t=r=>{if(this.keyMap.set(r.key,r),r.childNodes&&r.type==="section")for(let n of r.childNodes)t(n)};for(let r of e)t(r);let s,i=0;for(let[r,n]of this.keyMap)s?(s.nextKey=r,n.prevKey=s.key):(this.firstKey=r,n.prevKey=void 0),n.type==="item"&&(n.index=i++),s=n,s.nextKey=void 0;this.lastKey=s==null?void 0:s.key}}function ii(l){let{filter:e}=l,t=li(l),s=u.useMemo(()=>l.disabledKeys?new Set(l.disabledKeys):new Set,[l.disabledKeys]),i=u.useCallback(d=>e?new ze(e(d)):new ze(d),[e]),r=u.useMemo(()=>({suppressTextValueWarning:l.suppressTextValueWarning}),[l.suppressTextValueWarning]),n=Ql(l,i,r),o=u.useMemo(()=>new si(n,t),[n,t]);const a=u.useRef(null);return u.useEffect(()=>{if(t.focusedKey!=null&&!n.getItem(t.focusedKey)){const d=a.current.getItem(t.focusedKey),m=[...a.current.getKeys()].map(v=>{const g=a.current.getItem(v);return g.type==="item"?g:null}).filter(v=>v!==null),$=[...n.getKeys()].map(v=>{const g=n.getItem(v);return g.type==="item"?g:null}).filter(v=>v!==null),b=m.length-$.length;let c=Math.min(b>1?Math.max(d.index-b+1,0):d.index,$.length-1),h;for(;c>=0;){if(!o.isDisabled($[c].key)){h=$[c];break}c<$.length-1?c++:(c>d.index&&(c=d.index),c--)}t.setFocusedKey(h?h.key:null)}a.current=n},[n,o,t,t.focusedKey]),{collection:n,disabledKeys:s,selectionManager:o}}function ri(l){const{collection:e,disabledKeys:t,selectionManager:s,selectionManager:{setSelectedKeys:i,selectedKeys:r,selectionMode:n}}=ii(l),o=[],a=r.size!==0?Array.from(r).map(d=>{const m=e.getItem(d);return m||o.push(d),m}).filter(Boolean):null;return o.length&&console.warn(`Select: Keys "${o.join(", ")}" passed to "selectedKeys" are not present in the collection.`),{collection:e,disabledKeys:t,selectionManager:s,selectionMode:n,selectedKeys:r,setSelectedKeys:i.bind(s),selectedItems:a}}function ni(l){const[e,t]=u.useState(!1),s=ei(l),i=ri({...l,onSelectionChange:r=>{if(typeof l.onSelectionChange=="function")if(r==="all"&&l.onSelectionChange([...new Set(i.collection.getKeys()).values()]),l.selectionMode==="single"&&r!=="all"){const n=[...r.values()][0]??null;l.onSelectionChange(n)}else{const n=typeof r=="object"&&[...r.values()];if(!n)return;l.onSelectionChange(n)}l.selectionMode==="single"&&s.close()}});return{...i,...s,isFocused:e,setIsFocused:t}}function oi(l){return l&&l.__esModule?l.default:l}var jt={},Rt={};Rt={longPressMessage:"اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة"};var Lt={};Lt={longPressMessage:"Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто"};var Bt={};Bt={longPressMessage:"Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku"};var zt={};zt={longPressMessage:"Langt tryk eller tryk på Alt + pil ned for at åbne menuen"};var Nt={};Nt={longPressMessage:"Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen"};var Ht={};Ht={longPressMessage:"Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού"};var Ut={};Ut={longPressMessage:"Long press or press Alt + ArrowDown to open menu"};var Vt={};Vt={longPressMessage:"Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú"};var Wt={};Wt={longPressMessage:"Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool"};var Xt={};Xt={longPressMessage:"Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli"};var qt={};qt={longPressMessage:"Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu."};var Zt={};Zt={longPressMessage:"לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט"};var Yt={};Yt={longPressMessage:"Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika"};var Gt={};Gt={longPressMessage:"Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához"};var Jt={};Jt={longPressMessage:"Premere a lungo o premere Alt + Freccia giù per aprire il menu"};var Qt={};Qt={longPressMessage:"長押しまたは Alt+下矢印キーでメニューを開く"};var _t={};_t={longPressMessage:"길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기"};var el={};el={longPressMessage:"Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“."};var tl={};tl={longPressMessage:"Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa"};var ll={};ll={longPressMessage:"Langt trykk eller trykk Alt + PilNed for å åpne menyen"};var sl={};sl={longPressMessage:"Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen"};var il={};il={longPressMessage:"Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu"};var rl={};rl={longPressMessage:"Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu"};var nl={};nl={longPressMessage:"Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu"};var ol={};ol={longPressMessage:"Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul"};var al={};al={longPressMessage:"Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню"};var cl={};cl={longPressMessage:"Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol"};var dl={};dl={longPressMessage:"Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol"};var ul={};ul={longPressMessage:"Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni"};var fl={};fl={longPressMessage:"Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn"};var hl={};hl={longPressMessage:"Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın"};var gl={};gl={longPressMessage:"Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню"};var pl={};pl={longPressMessage:"长按或按 Alt + 向下方向键以打开菜单"};var ml={};ml={longPressMessage:"長按或按 Alt+向下鍵以開啟功能表"};jt={"ar-AE":Rt,"bg-BG":Lt,"cs-CZ":Bt,"da-DK":zt,"de-DE":Nt,"el-GR":Ht,"en-US":Ut,"es-ES":Vt,"et-EE":Wt,"fi-FI":Xt,"fr-FR":qt,"he-IL":Zt,"hr-HR":Yt,"hu-HU":Gt,"it-IT":Jt,"ja-JP":Qt,"ko-KR":_t,"lt-LT":el,"lv-LV":tl,"nb-NO":ll,"nl-NL":sl,"pl-PL":il,"pt-BR":rl,"pt-PT":nl,"ro-RO":ol,"ru-RU":al,"sk-SK":cl,"sl-SI":dl,"sr-SP":ul,"sv-SE":fl,"tr-TR":hl,"uk-UA":gl,"zh-CN":pl,"zh-TW":ml};function ai(l,e,t){let{type:s="menu",isDisabled:i,trigger:r="press"}=l,n=se(),{triggerProps:o,overlayProps:a}=bs({type:s},e,t),d=c=>{if(!i&&!(r==="longPress"&&!c.altKey)&&t&&t.current)switch(c.key){case"Enter":case" ":if(r==="longPress")return;case"ArrowDown":"continuePropagation"in c||c.stopPropagation(),c.preventDefault(),e.toggle("first");break;case"ArrowUp":"continuePropagation"in c||c.stopPropagation(),c.preventDefault(),e.toggle("last");break;default:"continuePropagation"in c&&c.continuePropagation()}},m=Ue(oi(jt)),{longPressProps:$}=We({isDisabled:i||r!=="longPress",accessibilityDescription:m.format("longPressMessage"),onLongPressStart(){e.close()},onLongPress(){e.open("first")}}),b={onPressStart(c){c.pointerType!=="touch"&&c.pointerType!=="keyboard"&&!i&&e.toggle(c.pointerType==="virtual"?"first":null)},onPress(c){c.pointerType==="touch"&&!i&&e.toggle()}};return delete o.onPress,{menuTriggerProps:{...o,...r==="press"?b:$,id:n,onKeyDown:d},menuProps:{...a,"aria-labelledby":n,autoFocus:e.focusStrategy||!0,onClose:e.close}}}function ci(l,e,t){const{disallowEmptySelection:s,isDisabled:i}=l,{menuTriggerProps:r,menuProps:n}=ai({isDisabled:i,type:"listbox"},e,t),{labelProps:o,errorMessageProps:a,fieldProps:d}=Rl(l),m=ie(l,{labelable:!0}),$=N(r,d),b=se();return{errorMessageProps:a,labelProps:{...o,onClick:()=>{var c;e.isFocused||i||((c=t.current)==null||c.focus(),e.setIsFocused(!0),Ll("keyboard"),e.setOpen(!0))}},triggerProps:N(m,{...$,onFocus(c){e.isFocused||(e.setIsFocused(!0),l.onFocus&&l.onFocus(c))},onBlur(c){e.isOpen||(e.setIsFocused(!1),l.onBlur&&l.onBlur(c))}}),valueProps:{id:b},menuProps:{...n,disallowEmptySelection:s,shouldSelectOnPressUp:!0}}}function di(l){return typeof l.selectedKey>"u"&&typeof l.selectedKeys>"u"?[]:l.selectedKey!==null&&typeof l.selectedKey<"u"?l.selectedKey.toString().trim().length<=0?[]:[l.selectedKey]:l.selectedKey===null?[]:l.selectedKeys==="all"?"all":l.selectedKeys instanceof Set||Array.isArray(l.selectedKeys)?l.selectedKeys:[l.selectedKeys]}function ui(l){var i;const e=Ne.useTranslations("Common"),t=l.selectionMode==="multiple"?l.state.selectedItems:null,s=l.selectionMode==="single"?(i=l.state.selectedItems)==null?void 0:i[0]:null;return t&&t.length>0?y.jsx(y.Fragment,{children:t.map(r=>{const n=l.options.find(o=>o.value===r.key);return y.jsxs("span",{className:"text-sm flex items-center justify-between px-1.5 rounded-sm bg-gray-300 dark:bg-tertiary",children:[y.jsxs(Ul,{open:n!=null&&n.description?void 0:!1,children:[y.jsx(Vl,{asChild:!0,children:y.jsx("span",{className:"pr-1",children:r.textValue})}),y.jsx(Wl,{sideOffset:7,side:"bottom",align:"center",pointerEvents:!0,children:n==null?void 0:n.description})]}),y.jsx(Q,{className:"!px-0.5 hover:!bg-gray-400 dark:hover:!bg-primary",variant:"transparent",role:"button",onPress:()=>{const o=[...l.state.selectedKeys].filter(a=>a!==r.key);l.state.setSelectedKeys(o)},children:y.jsx(Dt,{className:"w-5 h-5"})})]},r.key)})}):s?y.jsx("span",{className:"w-full inline-block overflow-hidden whitespace-nowrap text-ellipsis",children:s.textValue}):y.jsx("span",{children:e("select")})}function fi(l){var i;const e=l.selectionMode==="multiple"?l.state.selectedItems:null,t=l.selectionMode==="single"?(i=l.state.selectedItems)==null?void 0:i[0]:null,s=l.isClearable&&(e||t);return y.jsxs(y.Fragment,{children:[l.isLoading?y.jsx("div",{className:H("absolute top-0 bottom-0 flex items-center justify-center",s?"right-[82px]":"right-12"),children:y.jsx(Ye,{})}):null,s?y.jsx(Q,{isDisabled:l.isDisabled,onPress:()=>{l.state.setSelectedKeys([])},className:H("px-2 !rounded-none -mx-[1.5px]","group-hover:dark:!border-gray-500 group-hover:!border-gray-500",l.state.isOpen&&"!border-gray-800 dark:!border-gray-500",l.errorMessage&&"!border-red-500 focus:!border-red-700 dark:!focus:border-red-700"),type:"button",children:y.jsx(Dt,{className:"w-5 h-5 dark:fill-white"})}):null,y.jsx(Q,{isDisabled:l.isDisabled,onPress:()=>l.state.open(),size:"xs",type:"button",className:H("rounded-l-none",!s&&"-ml-[1.5px]","group-hover:dark:!border-gray-500 group-hover:!border-gray-500",l.state.isOpen&&"!border-gray-800 dark:!border-gray-500",l.errorMessage&&"!border-red-500 focus:!border-red-700 dark:!focus:border-red-700"),children:y.jsx(qs,{className:"w-5 h-5 dark:fill-white"})})]})}function hi(l){var g;const e=l.selectionMode??"single",t=u.useMemo(()=>l.options.map(w=>y.jsx(Yl,{textValue:w.textValue||void 0,children:w.label},w.value)),[l.options]),s=u.useMemo(()=>l.options.filter(w=>!!w.isDisabled).map(w=>w.value),[l.options]),i=u.useMemo(()=>di({selectedKey:l.selectedKey,selectedKeys:l.selectedKeys}),[l.selectedKeys,l.selectedKey]),r=!l.isClearable,n=ni({...l,selectedKeys:i,children:t,disabledKeys:s,disallowEmptySelection:r,selectionMode:e}),o=u.useRef(null),{labelProps:a,triggerProps:d,errorMessageProps:m,valueProps:$,menuProps:b}=ci({...l,selectedKey:void 0,disallowEmptySelection:r,children:t,disabledKeys:s},n,o),{buttonProps:c}=Bl(d,o),h=e==="multiple"?n.selectedItems:null,v=e==="single"?(g=n.selectedItems)==null?void 0:g[0]:null;return y.jsx(_e,{children:y.jsxs("div",{className:H("flex flex-col mb-3",l.className),children:[y.jsx(Xl,{...l,labelProps:a}),y.jsxs("div",{className:"relative group",children:[y.jsxs("div",{className:"flex",children:[y.jsx("div",{role:"button",...c,className:H(qe({variant:"default",size:"sm",className:H("px-2 cursor-default !rounded-r-none w-full min-h-[39px] h-auto flex items-center justify-between border !bg-white dark:!bg-secondary hover:dark:!bg-secondary hover:dark:!brightness-100 group-hover:dark:!border-gray-500 group-hover:!border-gray-500",l.errorMessage&&"!border-red-500 focus:!border-red-700 dark:focus:!border-red-700",n.isOpen&&"dark:!border-gray-500 !border-gray-500",l.isDisabled&&"!cursor-not-allowed opacity-60")})),ref:o,children:y.jsx("div",{...$,className:H("flex items-center gap-2 flex-wrap",!(h||v)&&"text-neutral-700 dark:text-gray-400"),children:y.jsx(ui,{options:l.options,selectionMode:e,state:n})})}),y.jsx(fi,{selectionMode:e,state:n,isClearable:l.isClearable,errorMessage:l.errorMessage,isDisabled:l.isDisabled,isLoading:l.isLoading})]}),n.isOpen&&y.jsx(As,{isCalendar:l.isCalendar,isOpen:n.isOpen,onClose:n.close,children:y.jsx(Qs,{...b,state:n})})]}),l.children,l.errorMessage&&y.jsx(ql,{errorMessage:l.errorMessage,errorMessageProps:m})]})})}function bi(){const[l,e]=u.useState(null),{hide:t,data:s}=vl(),i=zl({mutationKey:["set-unit-status"],onSuccess(n){var o;t(),$l({title:"Status updated",message:`Successfully updated your status to ${(o=n.status)==null?void 0:o.value.value}.`})},mutationFn:async n=>{if(!(s!=null&&s.url)||!s.userApiToken)throw new Error("SnailyCAD API URL and/or Personal API Token not provided.");const{data:o,error:a,errorMessage:d}=await Nl({url:s.url,path:`/dispatch/status/${s.unitId}`,method:"PUT",data:{status:n.statusId},headers:{userApiToken:s.userApiToken}});if(a||!o)throw new Error((a==null?void 0:a.message)||d||"Unknown error occurred. Please see F8 console for further details.");return o}});function r(n){n.preventDefault(),l&&i.mutate({statusId:l})}return y.jsxs("div",{className:"max-w-lg rounded-md bg-primary p-8",children:[y.jsxs("header",{className:"mb-2",children:[y.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[y.jsx("h1",{className:"text-2xl font-bold text-white",children:"Set Status"}),y.jsx(Q,{className:"px-1 text-base",onPress:t,children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",className:"bi bi-x",viewBox:"0 0 16 16",children:y.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"})})})]}),y.jsx("p",{className:"text-neutral-200",children:"Set the status for your active unit."})]}),i.error?y.jsx(Hl,{type:"error",title:"An error occurred",message:i.error.message}):null,y.jsxs("form",{onSubmit:r,className:"mt-3",children:[y.jsx(hi,{selectedKey:l,onSelectionChange:n=>e(n),label:"Status",options:((s==null?void 0:s.statusCodes)??[]).map(n=>({label:n.value.value,value:n.id}))}),y.jsxs("p",{className:"text-neutral-200 mt-2",children:["Additionally use",y.jsx("code",{className:"inline-block bg-secondary p-0.5",children:"/sn-set-status <status-code>"})]}),y.jsxs(Q,{className:"flex gap-2 items-center",type:"submit",isDisabled:i.isPending,children:[i.isPending?y.jsx(Ye,{}):null,"Save"]})]})]})}export{bi as SetStatusScreen};
|