import{c as V,r as c,a as ge,u as Ze,j as o,b as Je,d as we,e as Ee,f as D,P as I,g as w,A as Ae,h as U,i as Qe,k as et,l as tt,m as rt,n as ot,F as nt,D as at,o as st,s as ct,t as F,B as W,v as hr,w as We,X as mr,x as vr,y as lt,z as B,E as it,I as xr,G as gr,H as wr,J as ut,K as br,L as Sr,C as Cr,M as Be,N as Pr,O as Ve,p as L,S as _r,U as Mr,V as Rr,W as yr,Y as jr}from"./index-lkxwLA74.js";import{r as Er}from"./app-DrgD6EWn.js";/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nr=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ar=V("chevron-left",Nr);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tr=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Dr=V("chevron-right",Tr);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ir=[["path",{d:"M11 20H2",key:"nlcfvz"}],["path",{d:"M11 4.562v16.157a1 1 0 0 0 1.242.97L19 20V5.562a2 2 0 0 0-1.515-1.94l-4-1A2 2 0 0 0 11 4.561z",key:"au4z13"}],["path",{d:"M11 4H8a2 2 0 0 0-2 2v14",key:"74r1mk"}],["path",{d:"M14 12h.01",key:"1jfl7z"}],["path",{d:"M22 20h-3",key:"vhrsz"}]],Or=V("door-open",Ir);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kr=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Lr=V("ellipsis",kr);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fr=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],dt=V("eye-off",Fr);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zr=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ft=V("eye",zr);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $r=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ur=V("search",$r);/**
 * @license lucide-react v0.540.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gr=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Kr=V("square-pen",Gr);var be="Popover",[pt,oa]=we(be,[ge]),ie=ge(),[Hr,X]=pt(be),ht=e=>{const{__scopePopover:r,children:t,open:n,defaultOpen:a,onOpenChange:s,modal:l=!1}=e,i=ie(r),u=c.useRef(null),[p,d]=c.useState(!1),[f,h]=Ze({prop:n,defaultProp:a??!1,onChange:s,caller:be});return o.jsx(Je,{...i,children:o.jsx(Hr,{scope:r,contentId:Ee(),triggerRef:u,open:f,onOpenChange:h,onOpenToggle:c.useCallback(()=>h(m=>!m),[h]),hasCustomAnchor:p,onCustomAnchorAdd:c.useCallback(()=>d(!0),[]),onCustomAnchorRemove:c.useCallback(()=>d(!1),[]),modal:l,children:t})})};ht.displayName=be;var mt="PopoverAnchor",Wr=c.forwardRef((e,r)=>{const{__scopePopover:t,...n}=e,a=X(mt,t),s=ie(t),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=a;return c.useEffect(()=>(l(),()=>i()),[l,i]),o.jsx(Ae,{...s,...n,ref:r})});Wr.displayName=mt;var vt="PopoverTrigger",xt=c.forwardRef((e,r)=>{const{__scopePopover:t,...n}=e,a=X(vt,t),s=ie(t),l=D(r,a.triggerRef),i=o.jsx(I.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Ct(a.open),...n,ref:l,onClick:w(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?i:o.jsx(Ae,{asChild:!0,...s,children:i})});xt.displayName=vt;var Te="PopoverPortal",[Br,Vr]=pt(Te,{forceMount:void 0}),gt=e=>{const{__scopePopover:r,forceMount:t,children:n,container:a}=e,s=X(Te,r);return o.jsx(Br,{scope:r,forceMount:t,children:o.jsx(U,{present:t||s.open,children:o.jsx(Qe,{asChild:!0,container:a,children:n})})})};gt.displayName=Te;var re="PopoverContent",wt=c.forwardRef((e,r)=>{const t=Vr(re,e.__scopePopover),{forceMount:n=t.forceMount,...a}=e,s=X(re,e.__scopePopover);return o.jsx(U,{present:n||s.open,children:s.modal?o.jsx(Yr,{...a,ref:r}):o.jsx(qr,{...a,ref:r})})});wt.displayName=re;var Xr=rt("PopoverContent.RemoveScroll"),Yr=c.forwardRef((e,r)=>{const t=X(re,e.__scopePopover),n=c.useRef(null),a=D(r,n),s=c.useRef(!1);return c.useEffect(()=>{const l=n.current;if(l)return et(l)},[]),o.jsx(tt,{as:Xr,allowPinchZoom:!0,children:o.jsx(bt,{...e,ref:a,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:w(e.onCloseAutoFocus,l=>{l.preventDefault(),s.current||t.triggerRef.current?.focus()}),onPointerDownOutside:w(e.onPointerDownOutside,l=>{const i=l.detail.originalEvent,u=i.button===0&&i.ctrlKey===!0,p=i.button===2||u;s.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:w(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),qr=c.forwardRef((e,r)=>{const t=X(re,e.__scopePopover),n=c.useRef(!1),a=c.useRef(!1);return o.jsx(bt,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(n.current||t.triggerRef.current?.focus(),s.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(n.current=!0,s.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=s.target;t.triggerRef.current?.contains(l)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&a.current&&s.preventDefault()}})}),bt=c.forwardRef((e,r)=>{const{__scopePopover:t,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:d,...f}=e,h=X(re,t),m=ie(t);return ot(),o.jsx(nt,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o.jsx(at,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:d,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:p,onDismiss:()=>h.onOpenChange(!1),children:o.jsx(st,{"data-state":Ct(h.open),role:"dialog",id:h.contentId,...m,...f,ref:r,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),St="PopoverClose",Zr=c.forwardRef((e,r)=>{const{__scopePopover:t,...n}=e,a=X(St,t);return o.jsx(I.button,{type:"button",...n,ref:r,onClick:w(e.onClick,()=>a.onOpenChange(!1))})});Zr.displayName=St;var Jr="PopoverArrow",Qr=c.forwardRef((e,r)=>{const{__scopePopover:t,...n}=e,a=ie(t);return o.jsx(ct,{...a,...n,ref:r})});Qr.displayName=Jr;function Ct(e){return e?"open":"closed"}var eo=ht,to=xt,ro=gt,oo=wt;function no({...e}){return o.jsx(eo,{"data-slot":"popover",...e})}function ao({...e}){return o.jsx(to,{"data-slot":"popover-trigger",...e})}function so({className:e,align:r="center",sideOffset:t=4,container:n,...a}){return o.jsx(ro,{container:n,children:o.jsx(oo,{"data-slot":"popover-content",align:r,sideOffset:t,className:F("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 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...a})})}function co(){return o.jsx(ao,{asChild:!0,children:o.jsx(W,{size:"icon",children:o.jsx(Or,{})})})}function lo({filter:e,setFilter:r,activeFiltersCount:t,clearFilters:n}){return o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(hr,{size:"sm",type:"single",value:e.statusFilter||"",onValueChange:a=>r({statusFilter:a||""}),className:"flex items-center gap-1 p-1 bg-muted rounded-lg",children:[o.jsxs(We,{size:"sm",value:"listed","aria-label":"Hiển thị công khai",className:"flex items-center gap-2 px-3 py-2 rounded-md data-[state=on]:bg-green-100 data-[state=on]:text-green-700 data-[state=on]:border-green-200 hover:bg-green-50 transition-colors",children:[o.jsx(ft,{className:"h-2 w-2"}),o.jsx("span",{className:"text-sm font-medium",children:"Listed"})]}),o.jsxs(We,{size:"sm",value:"unlisted","aria-label":"Ẩn khỏi danh sách",className:"flex items-center gap-2 px-3 py-2 rounded-md data-[state=on]:bg-orange-100 data-[state=on]:text-orange-700 data-[state=on]:border-orange-200 hover:bg-orange-50 transition-colors",children:[o.jsx(dt,{className:"h-2 w-2"}),o.jsx("span",{className:"text-sm font-medium",children:"Unlisted"})]})]}),t>0&&o.jsxs(W,{variant:"outline",size:"sm",onClick:n,className:"flex items-center gap-2 text-muted-foreground hover:text-foreground bg-transparent","aria-label":"clear",children:[o.jsx(mr,{className:"h-2 w-2"}),o.jsx("span",{className:"text-sm",children:"Clear"})]})]})}var Ne=["Enter"," "],io=["ArrowDown","PageUp","Home"],Pt=["ArrowUp","PageDown","End"],uo=[...io,...Pt],fo={ltr:[...Ne,"ArrowRight"],rtl:[...Ne,"ArrowLeft"]},po={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ue="Menu",[ce,ho,mo]=vr(ue),[q,_t]=we(ue,[mo,ge,lt]),Se=ge(),Mt=lt(),[vo,Z]=q(ue),[xo,de]=q(ue),Rt=e=>{const{__scopeMenu:r,open:t=!1,children:n,dir:a,onOpenChange:s,modal:l=!0}=e,i=Se(r),[u,p]=c.useState(null),d=c.useRef(!1),f=B(s),h=it(a);return c.useEffect(()=>{const m=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),o.jsx(Je,{...i,children:o.jsx(vo,{scope:r,open:t,onOpenChange:f,content:u,onContentChange:p,children:o.jsx(xo,{scope:r,onClose:c.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:l,children:n})})})};Rt.displayName=ue;var go="MenuAnchor",De=c.forwardRef((e,r)=>{const{__scopeMenu:t,...n}=e,a=Se(t);return o.jsx(Ae,{...a,...n,ref:r})});De.displayName=go;var Ie="MenuPortal",[wo,yt]=q(Ie,{forceMount:void 0}),jt=e=>{const{__scopeMenu:r,forceMount:t,children:n,container:a}=e,s=Z(Ie,r);return o.jsx(wo,{scope:r,forceMount:t,children:o.jsx(U,{present:t||s.open,children:o.jsx(Qe,{asChild:!0,container:a,children:n})})})};jt.displayName=Ie;var O="MenuContent",[bo,Oe]=q(O),Et=c.forwardRef((e,r)=>{const t=yt(O,e.__scopeMenu),{forceMount:n=t.forceMount,...a}=e,s=Z(O,e.__scopeMenu),l=de(O,e.__scopeMenu);return o.jsx(ce.Provider,{scope:e.__scopeMenu,children:o.jsx(U,{present:n||s.open,children:o.jsx(ce.Slot,{scope:e.__scopeMenu,children:l.modal?o.jsx(So,{...a,ref:r}):o.jsx(Co,{...a,ref:r})})})})}),So=c.forwardRef((e,r)=>{const t=Z(O,e.__scopeMenu),n=c.useRef(null),a=D(r,n);return c.useEffect(()=>{const s=n.current;if(s)return et(s)},[]),o.jsx(ke,{...e,ref:a,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:w(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)})}),Co=c.forwardRef((e,r)=>{const t=Z(O,e.__scopeMenu);return o.jsx(ke,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)})}),Po=rt("MenuContent.ScrollLock"),ke=c.forwardRef((e,r)=>{const{__scopeMenu:t,loop:n=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEntryFocus:u,onEscapeKeyDown:p,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:m,disableOutsideScroll:g,...M}=e,j=Z(O,t),S=de(O,t),N=Se(t),z=Mt(t),A=ho(t),[v,b]=c.useState(null),C=c.useRef(null),K=D(r,C,j.onContentChange),P=c.useRef(0),_=c.useRef(""),$=c.useRef(0),H=c.useRef(null),R=c.useRef("right"),y=c.useRef(0),J=g?tt:c.Fragment,Re=g?{as:Po,allowPinchZoom:!0}:void 0,pr=x=>{const ee=_.current+x,Y=A().filter(T=>!T.disabled),ne=document.activeElement,ye=Y.find(T=>T.ref.current===ne)?.textValue,je=Y.map(T=>T.textValue),Ke=Oo(je,ee,ye),ae=Y.find(T=>T.textValue===Ke)?.ref.current;(function T(He){_.current=He,window.clearTimeout(P.current),He!==""&&(P.current=window.setTimeout(()=>T(""),1e3))})(ee),ae&&setTimeout(()=>ae.focus())};c.useEffect(()=>()=>window.clearTimeout(P.current),[]),ot();const Q=c.useCallback(x=>R.current===H.current?.side&&Lo(x,H.current?.area),[]);return o.jsx(bo,{scope:t,searchRef:_,onItemEnter:c.useCallback(x=>{Q(x)&&x.preventDefault()},[Q]),onItemLeave:c.useCallback(x=>{Q(x)||(C.current?.focus(),b(null))},[Q]),onTriggerLeave:c.useCallback(x=>{Q(x)&&x.preventDefault()},[Q]),pointerGraceTimerRef:$,onPointerGraceIntentChange:c.useCallback(x=>{H.current=x},[]),children:o.jsx(J,{...Re,children:o.jsx(nt,{asChild:!0,trapped:a,onMountAutoFocus:w(s,x=>{x.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:o.jsx(at,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:p,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:m,children:o.jsx(wr,{asChild:!0,...z,dir:S.dir,orientation:"vertical",loop:n,currentTabStopId:v,onCurrentTabStopIdChange:b,onEntryFocus:w(u,x=>{S.isUsingKeyboardRef.current||x.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(st,{role:"menu","aria-orientation":"vertical","data-state":Wt(j.open),"data-radix-menu-content":"",dir:S.dir,...N,...M,ref:K,style:{outline:"none",...M.style},onKeyDown:w(M.onKeyDown,x=>{const Y=x.target.closest("[data-radix-menu-content]")===x.currentTarget,ne=x.ctrlKey||x.altKey||x.metaKey,ye=x.key.length===1;Y&&(x.key==="Tab"&&x.preventDefault(),!ne&&ye&&pr(x.key));const je=C.current;if(x.target!==je||!uo.includes(x.key))return;x.preventDefault();const ae=A().filter(T=>!T.disabled).map(T=>T.ref.current);Pt.includes(x.key)&&ae.reverse(),Do(ae)}),onBlur:w(e.onBlur,x=>{x.currentTarget.contains(x.target)||(window.clearTimeout(P.current),_.current="")}),onPointerMove:w(e.onPointerMove,le(x=>{const ee=x.target,Y=y.current!==x.clientX;if(x.currentTarget.contains(ee)&&Y){const ne=x.clientX>y.current?"right":"left";R.current=ne,y.current=x.clientX}}))})})})})})})});Et.displayName=O;var _o="MenuGroup",Le=c.forwardRef((e,r)=>{const{__scopeMenu:t,...n}=e;return o.jsx(I.div,{role:"group",...n,ref:r})});Le.displayName=_o;var Mo="MenuLabel",Nt=c.forwardRef((e,r)=>{const{__scopeMenu:t,...n}=e;return o.jsx(I.div,{...n,ref:r})});Nt.displayName=Mo;var he="MenuItem",Xe="menu.itemSelect",Ce=c.forwardRef((e,r)=>{const{disabled:t=!1,onSelect:n,...a}=e,s=c.useRef(null),l=de(he,e.__scopeMenu),i=Oe(he,e.__scopeMenu),u=D(r,s),p=c.useRef(!1),d=()=>{const f=s.current;if(!t&&f){const h=new CustomEvent(Xe,{bubbles:!0,cancelable:!0});f.addEventListener(Xe,m=>n?.(m),{once:!0}),gr(f,h),h.defaultPrevented?p.current=!1:l.onClose()}};return o.jsx(At,{...a,ref:u,disabled:t,onClick:w(e.onClick,d),onPointerDown:f=>{e.onPointerDown?.(f),p.current=!0},onPointerUp:w(e.onPointerUp,f=>{p.current||f.currentTarget?.click()}),onKeyDown:w(e.onKeyDown,f=>{const h=i.searchRef.current!=="";t||h&&f.key===" "||Ne.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Ce.displayName=he;var At=c.forwardRef((e,r)=>{const{__scopeMenu:t,disabled:n=!1,textValue:a,...s}=e,l=Oe(he,t),i=Mt(t),u=c.useRef(null),p=D(r,u),[d,f]=c.useState(!1),[h,m]=c.useState("");return c.useEffect(()=>{const g=u.current;g&&m((g.textContent??"").trim())},[s.children]),o.jsx(ce.ItemSlot,{scope:t,disabled:n,textValue:a??h,children:o.jsx(xr,{asChild:!0,...i,focusable:!n,children:o.jsx(I.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:p,onPointerMove:w(e.onPointerMove,le(g=>{n?l.onItemLeave(g):(l.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:w(e.onPointerLeave,le(g=>l.onItemLeave(g))),onFocus:w(e.onFocus,()=>f(!0)),onBlur:w(e.onBlur,()=>f(!1))})})})}),Ro="MenuCheckboxItem",Tt=c.forwardRef((e,r)=>{const{checked:t=!1,onCheckedChange:n,...a}=e;return o.jsx(Lt,{scope:e.__scopeMenu,checked:t,children:o.jsx(Ce,{role:"menuitemcheckbox","aria-checked":me(t)?"mixed":t,...a,ref:r,"data-state":ze(t),onSelect:w(a.onSelect,()=>n?.(me(t)?!0:!t),{checkForDefaultPrevented:!1})})})});Tt.displayName=Ro;var Dt="MenuRadioGroup",[yo,jo]=q(Dt,{value:void 0,onValueChange:()=>{}}),It=c.forwardRef((e,r)=>{const{value:t,onValueChange:n,...a}=e,s=B(n);return o.jsx(yo,{scope:e.__scopeMenu,value:t,onValueChange:s,children:o.jsx(Le,{...a,ref:r})})});It.displayName=Dt;var Ot="MenuRadioItem",kt=c.forwardRef((e,r)=>{const{value:t,...n}=e,a=jo(Ot,e.__scopeMenu),s=t===a.value;return o.jsx(Lt,{scope:e.__scopeMenu,checked:s,children:o.jsx(Ce,{role:"menuitemradio","aria-checked":s,...n,ref:r,"data-state":ze(s),onSelect:w(n.onSelect,()=>a.onValueChange?.(t),{checkForDefaultPrevented:!1})})})});kt.displayName=Ot;var Fe="MenuItemIndicator",[Lt,Eo]=q(Fe,{checked:!1}),Ft=c.forwardRef((e,r)=>{const{__scopeMenu:t,forceMount:n,...a}=e,s=Eo(Fe,t);return o.jsx(U,{present:n||me(s.checked)||s.checked===!0,children:o.jsx(I.span,{...a,ref:r,"data-state":ze(s.checked)})})});Ft.displayName=Fe;var No="MenuSeparator",zt=c.forwardRef((e,r)=>{const{__scopeMenu:t,...n}=e;return o.jsx(I.div,{role:"separator","aria-orientation":"horizontal",...n,ref:r})});zt.displayName=No;var Ao="MenuArrow",$t=c.forwardRef((e,r)=>{const{__scopeMenu:t,...n}=e,a=Se(t);return o.jsx(ct,{...a,...n,ref:r})});$t.displayName=Ao;var To="MenuSub",[na,Ut]=q(To),se="MenuSubTrigger",Gt=c.forwardRef((e,r)=>{const t=Z(se,e.__scopeMenu),n=de(se,e.__scopeMenu),a=Ut(se,e.__scopeMenu),s=Oe(se,e.__scopeMenu),l=c.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:u}=s,p={__scopeMenu:e.__scopeMenu},d=c.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return c.useEffect(()=>d,[d]),c.useEffect(()=>{const f=i.current;return()=>{window.clearTimeout(f),u(null)}},[i,u]),o.jsx(De,{asChild:!0,...p,children:o.jsx(At,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":t.open,"aria-controls":a.contentId,"data-state":Wt(t.open),...e,ref:ut(r,a.onTriggerChange),onClick:f=>{e.onClick?.(f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),t.open||t.onOpenChange(!0))},onPointerMove:w(e.onPointerMove,le(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!t.open&&!l.current&&(s.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{t.onOpenChange(!0),d()},100))})),onPointerLeave:w(e.onPointerLeave,le(f=>{d();const h=t.content?.getBoundingClientRect();if(h){const m=t.content?.dataset.side,g=m==="right",M=g?-5:5,j=h[g?"left":"right"],S=h[g?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+M,y:f.clientY},{x:j,y:h.top},{x:S,y:h.top},{x:S,y:h.bottom},{x:j,y:h.bottom}],side:m}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:w(e.onKeyDown,f=>{const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||fo[n.dir].includes(f.key)&&(t.onOpenChange(!0),t.content?.focus(),f.preventDefault())})})})});Gt.displayName=se;var Kt="MenuSubContent",Ht=c.forwardRef((e,r)=>{const t=yt(O,e.__scopeMenu),{forceMount:n=t.forceMount,...a}=e,s=Z(O,e.__scopeMenu),l=de(O,e.__scopeMenu),i=Ut(Kt,e.__scopeMenu),u=c.useRef(null),p=D(r,u);return o.jsx(ce.Provider,{scope:e.__scopeMenu,children:o.jsx(U,{present:n||s.open,children:o.jsx(ce.Slot,{scope:e.__scopeMenu,children:o.jsx(ke,{id:i.contentId,"aria-labelledby":i.triggerId,...a,ref:p,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{l.isUsingKeyboardRef.current&&u.current?.focus(),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:w(e.onFocusOutside,d=>{d.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:w(e.onEscapeKeyDown,d=>{l.onClose(),d.preventDefault()}),onKeyDown:w(e.onKeyDown,d=>{const f=d.currentTarget.contains(d.target),h=po[l.dir].includes(d.key);f&&h&&(s.onOpenChange(!1),i.trigger?.focus(),d.preventDefault())})})})})})});Ht.displayName=Kt;function Wt(e){return e?"open":"closed"}function me(e){return e==="indeterminate"}function ze(e){return me(e)?"indeterminate":e?"checked":"unchecked"}function Do(e){const r=document.activeElement;for(const t of e)if(t===r||(t.focus(),document.activeElement!==r))return}function Io(e,r){return e.map((t,n)=>e[(r+n)%e.length])}function Oo(e,r,t){const a=r.length>1&&Array.from(r).every(p=>p===r[0])?r[0]:r,s=t?e.indexOf(t):-1;let l=Io(e,Math.max(s,0));a.length===1&&(l=l.filter(p=>p!==t));const u=l.find(p=>p.toLowerCase().startsWith(a.toLowerCase()));return u!==t?u:void 0}function ko(e,r){const{x:t,y:n}=e;let a=!1;for(let s=0,l=r.length-1;s<r.length;l=s++){const i=r[s],u=r[l],p=i.x,d=i.y,f=u.x,h=u.y;d>n!=h>n&&t<(f-p)*(n-d)/(h-d)+p&&(a=!a)}return a}function Lo(e,r){if(!r)return!1;const t={x:e.clientX,y:e.clientY};return ko(t,r)}function le(e){return r=>r.pointerType==="mouse"?e(r):void 0}var Fo=Rt,zo=De,$o=jt,Uo=Et,Go=Le,Ko=Nt,Ho=Ce,Wo=Tt,Bo=It,Vo=kt,Xo=Ft,Yo=zt,qo=$t,Zo=Gt,Jo=Ht,Pe="DropdownMenu",[Qo,aa]=we(Pe,[_t]),E=_t(),[en,Bt]=Qo(Pe),Vt=e=>{const{__scopeDropdownMenu:r,children:t,dir:n,open:a,defaultOpen:s,onOpenChange:l,modal:i=!0}=e,u=E(r),p=c.useRef(null),[d,f]=Ze({prop:a,defaultProp:s??!1,onChange:l,caller:Pe});return o.jsx(en,{scope:r,triggerId:Ee(),triggerRef:p,contentId:Ee(),open:d,onOpenChange:f,onOpenToggle:c.useCallback(()=>f(h=>!h),[f]),modal:i,children:o.jsx(Fo,{...u,open:d,onOpenChange:f,dir:n,modal:i,children:t})})};Vt.displayName=Pe;var Xt="DropdownMenuTrigger",Yt=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,disabled:n=!1,...a}=e,s=Bt(Xt,t),l=E(t);return o.jsx(zo,{asChild:!0,...l,children:o.jsx(I.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...a,ref:ut(r,s.triggerRef),onPointerDown:w(e.onPointerDown,i=>{!n&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:w(e.onKeyDown,i=>{n||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Yt.displayName=Xt;var tn="DropdownMenuPortal",qt=e=>{const{__scopeDropdownMenu:r,...t}=e,n=E(r);return o.jsx($o,{...n,...t})};qt.displayName=tn;var Zt="DropdownMenuContent",Jt=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=Bt(Zt,t),s=E(t),l=c.useRef(!1);return o.jsx(Uo,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...n,ref:r,onCloseAutoFocus:w(e.onCloseAutoFocus,i=>{l.current||a.triggerRef.current?.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:w(e.onInteractOutside,i=>{const u=i.detail.originalEvent,p=u.button===0&&u.ctrlKey===!0,d=u.button===2||p;(!a.modal||d)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Jt.displayName=Zt;var rn="DropdownMenuGroup",on=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Go,{...a,...n,ref:r})});on.displayName=rn;var nn="DropdownMenuLabel",an=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Ko,{...a,...n,ref:r})});an.displayName=nn;var sn="DropdownMenuItem",Qt=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Ho,{...a,...n,ref:r})});Qt.displayName=sn;var cn="DropdownMenuCheckboxItem",ln=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Wo,{...a,...n,ref:r})});ln.displayName=cn;var un="DropdownMenuRadioGroup",dn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Bo,{...a,...n,ref:r})});dn.displayName=un;var fn="DropdownMenuRadioItem",pn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Vo,{...a,...n,ref:r})});pn.displayName=fn;var hn="DropdownMenuItemIndicator",mn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Xo,{...a,...n,ref:r})});mn.displayName=hn;var vn="DropdownMenuSeparator",xn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Yo,{...a,...n,ref:r})});xn.displayName=vn;var gn="DropdownMenuArrow",wn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(qo,{...a,...n,ref:r})});wn.displayName=gn;var bn="DropdownMenuSubTrigger",Sn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Zo,{...a,...n,ref:r})});Sn.displayName=bn;var Cn="DropdownMenuSubContent",Pn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Jo,{...a,...n,ref:r,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Pn.displayName=Cn;var _n=Vt,Mn=Yt,Rn=qt,yn=Jt,jn=Qt;function En({...e}){return o.jsx(_n,{"data-slot":"dropdown-menu",...e})}function Nn({...e}){return o.jsx(Mn,{"data-slot":"dropdown-menu-trigger",...e})}function An({className:e,sideOffset:r=4,container:t,...n}){return o.jsx(Rn,{container:t,children:o.jsx(yn,{"data-slot":"dropdown-menu-content",sideOffset:r,className:F("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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Ye({className:e,inset:r,variant:t="default",...n}){return o.jsx(jn,{"data-slot":"dropdown-menu-item","data-inset":r,"data-variant":t,className:F("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function Tn(e,r){return c.useReducer((t,n)=>r[t][n]??t,e)}var $e="ScrollArea",[er,sa]=we($e),[Dn,k]=er($e),tr=c.forwardRef((e,r)=>{const{__scopeScrollArea:t,type:n="hover",dir:a,scrollHideDelay:s=600,...l}=e,[i,u]=c.useState(null),[p,d]=c.useState(null),[f,h]=c.useState(null),[m,g]=c.useState(null),[M,j]=c.useState(null),[S,N]=c.useState(0),[z,A]=c.useState(0),[v,b]=c.useState(!1),[C,K]=c.useState(!1),P=D(r,$=>u($)),_=it(a);return o.jsx(Dn,{scope:t,type:n,dir:_,scrollHideDelay:s,scrollArea:i,viewport:p,onViewportChange:d,content:f,onContentChange:h,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:v,onScrollbarXEnabledChange:b,scrollbarY:M,onScrollbarYChange:j,scrollbarYEnabled:C,onScrollbarYEnabledChange:K,onCornerWidthChange:N,onCornerHeightChange:A,children:o.jsx(I.div,{dir:_,...l,ref:P,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":z+"px",...e.style}})})});tr.displayName=$e;var rr="ScrollAreaViewport",or=c.forwardRef((e,r)=>{const{__scopeScrollArea:t,children:n,nonce:a,...s}=e,l=k(rr,t),i=c.useRef(null),u=D(r,i,l.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),o.jsx(I.div,{"data-radix-scroll-area-viewport":"",...s,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});or.displayName=rr;var G="ScrollAreaScrollbar",nr=c.forwardRef((e,r)=>{const{forceMount:t,...n}=e,a=k(G,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:l}=a,i=e.orientation==="horizontal";return c.useEffect(()=>(i?s(!0):l(!0),()=>{i?s(!1):l(!1)}),[i,s,l]),a.type==="hover"?o.jsx(In,{...n,ref:r,forceMount:t}):a.type==="scroll"?o.jsx(On,{...n,ref:r,forceMount:t}):a.type==="auto"?o.jsx(ar,{...n,ref:r,forceMount:t}):a.type==="always"?o.jsx(Ue,{...n,ref:r}):null});nr.displayName=G;var In=c.forwardRef((e,r)=>{const{forceMount:t,...n}=e,a=k(G,e.__scopeScrollArea),[s,l]=c.useState(!1);return c.useEffect(()=>{const i=a.scrollArea;let u=0;if(i){const p=()=>{window.clearTimeout(u),l(!0)},d=()=>{u=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",p),i.addEventListener("pointerleave",d),()=>{window.clearTimeout(u),i.removeEventListener("pointerenter",p),i.removeEventListener("pointerleave",d)}}},[a.scrollArea,a.scrollHideDelay]),o.jsx(U,{present:t||s,children:o.jsx(ar,{"data-state":s?"visible":"hidden",...n,ref:r})})}),On=c.forwardRef((e,r)=>{const{forceMount:t,...n}=e,a=k(G,e.__scopeScrollArea),s=e.orientation==="horizontal",l=Me(()=>u("SCROLL_END"),100),[i,u]=Tn("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return c.useEffect(()=>{if(i==="idle"){const p=window.setTimeout(()=>u("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(p)}},[i,a.scrollHideDelay,u]),c.useEffect(()=>{const p=a.viewport,d=s?"scrollLeft":"scrollTop";if(p){let f=p[d];const h=()=>{const m=p[d];f!==m&&(u("SCROLL"),l()),f=m};return p.addEventListener("scroll",h),()=>p.removeEventListener("scroll",h)}},[a.viewport,s,u,l]),o.jsx(U,{present:t||i!=="hidden",children:o.jsx(Ue,{"data-state":i==="hidden"?"hidden":"visible",...n,ref:r,onPointerEnter:w(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:w(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),ar=c.forwardRef((e,r)=>{const t=k(G,e.__scopeScrollArea),{forceMount:n,...a}=e,[s,l]=c.useState(!1),i=e.orientation==="horizontal",u=Me(()=>{if(t.viewport){const p=t.viewport.offsetWidth<t.viewport.scrollWidth,d=t.viewport.offsetHeight<t.viewport.scrollHeight;l(i?p:d)}},10);return oe(t.viewport,u),oe(t.content,u),o.jsx(U,{present:n||s,children:o.jsx(Ue,{"data-state":s?"visible":"hidden",...a,ref:r})})}),Ue=c.forwardRef((e,r)=>{const{orientation:t="vertical",...n}=e,a=k(G,e.__scopeScrollArea),s=c.useRef(null),l=c.useRef(0),[i,u]=c.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=ur(i.viewport,i.content),d={...n,sizes:i,onSizesChange:u,hasThumb:p>0&&p<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:h=>l.current=h};function f(h,m){return Un(h,l.current,i,m)}return t==="horizontal"?o.jsx(kn,{...d,ref:r,onThumbPositionChange:()=>{if(a.viewport&&s.current){const h=a.viewport.scrollLeft,m=qe(h,i,a.dir);s.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollLeft=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollLeft=f(h,a.dir))}}):t==="vertical"?o.jsx(Ln,{...d,ref:r,onThumbPositionChange:()=>{if(a.viewport&&s.current){const h=a.viewport.scrollTop,m=qe(h,i);s.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollTop=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollTop=f(h))}}):null}),kn=c.forwardRef((e,r)=>{const{sizes:t,onSizesChange:n,...a}=e,s=k(G,e.__scopeScrollArea),[l,i]=c.useState(),u=c.useRef(null),p=D(r,u,s.onScrollbarXChange);return c.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),o.jsx(cr,{"data-orientation":"horizontal",...a,ref:p,sizes:t,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":_e(t)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(s.viewport){const h=s.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),fr(h,f)&&d.preventDefault()}},onResize:()=>{u.current&&s.viewport&&l&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:xe(l.paddingLeft),paddingEnd:xe(l.paddingRight)}})}})}),Ln=c.forwardRef((e,r)=>{const{sizes:t,onSizesChange:n,...a}=e,s=k(G,e.__scopeScrollArea),[l,i]=c.useState(),u=c.useRef(null),p=D(r,u,s.onScrollbarYChange);return c.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),o.jsx(cr,{"data-orientation":"vertical",...a,ref:p,sizes:t,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":_e(t)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(s.viewport){const h=s.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),fr(h,f)&&d.preventDefault()}},onResize:()=>{u.current&&s.viewport&&l&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:xe(l.paddingTop),paddingEnd:xe(l.paddingBottom)}})}})}),[Fn,sr]=er(G),cr=c.forwardRef((e,r)=>{const{__scopeScrollArea:t,sizes:n,hasThumb:a,onThumbChange:s,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:u,onDragScroll:p,onWheelScroll:d,onResize:f,...h}=e,m=k(G,t),[g,M]=c.useState(null),j=D(r,P=>M(P)),S=c.useRef(null),N=c.useRef(""),z=m.viewport,A=n.content-n.viewport,v=B(d),b=B(u),C=Me(f,10);function K(P){if(S.current){const _=P.clientX-S.current.left,$=P.clientY-S.current.top;p({x:_,y:$})}}return c.useEffect(()=>{const P=_=>{const $=_.target;g?.contains($)&&v(_,A)};return document.addEventListener("wheel",P,{passive:!1}),()=>document.removeEventListener("wheel",P,{passive:!1})},[z,g,A,v]),c.useEffect(b,[n,b]),oe(g,C),oe(m.content,C),o.jsx(Fn,{scope:t,scrollbar:g,hasThumb:a,onThumbChange:B(s),onThumbPointerUp:B(l),onThumbPositionChange:b,onThumbPointerDown:B(i),children:o.jsx(I.div,{...h,ref:j,style:{position:"absolute",...h.style},onPointerDown:w(e.onPointerDown,P=>{P.button===0&&(P.target.setPointerCapture(P.pointerId),S.current=g.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),K(P))}),onPointerMove:w(e.onPointerMove,K),onPointerUp:w(e.onPointerUp,P=>{const _=P.target;_.hasPointerCapture(P.pointerId)&&_.releasePointerCapture(P.pointerId),document.body.style.webkitUserSelect=N.current,m.viewport&&(m.viewport.style.scrollBehavior=""),S.current=null})})})}),ve="ScrollAreaThumb",lr=c.forwardRef((e,r)=>{const{forceMount:t,...n}=e,a=sr(ve,e.__scopeScrollArea);return o.jsx(U,{present:t||a.hasThumb,children:o.jsx(zn,{ref:r,...n})})}),zn=c.forwardRef((e,r)=>{const{__scopeScrollArea:t,style:n,...a}=e,s=k(ve,t),l=sr(ve,t),{onThumbPositionChange:i}=l,u=D(r,f=>l.onThumbChange(f)),p=c.useRef(void 0),d=Me(()=>{p.current&&(p.current(),p.current=void 0)},100);return c.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(d(),!p.current){const m=Gn(f,i);p.current=m,i()}};return i(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,d,i]),o.jsx(I.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:w(e.onPointerDownCapture,f=>{const m=f.target.getBoundingClientRect(),g=f.clientX-m.left,M=f.clientY-m.top;l.onThumbPointerDown({x:g,y:M})}),onPointerUp:w(e.onPointerUp,l.onThumbPointerUp)})});lr.displayName=ve;var Ge="ScrollAreaCorner",ir=c.forwardRef((e,r)=>{const t=k(Ge,e.__scopeScrollArea),n=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&n?o.jsx($n,{...e,ref:r}):null});ir.displayName=Ge;var $n=c.forwardRef((e,r)=>{const{__scopeScrollArea:t,...n}=e,a=k(Ge,t),[s,l]=c.useState(0),[i,u]=c.useState(0),p=!!(s&&i);return oe(a.scrollbarX,()=>{const d=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(d),u(d)}),oe(a.scrollbarY,()=>{const d=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(d),l(d)}),p?o.jsx(I.div,{...n,ref:r,style:{width:s,height:i,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function xe(e){return e?parseInt(e,10):0}function ur(e,r){const t=e/r;return isNaN(t)?0:t}function _e(e){const r=ur(e.viewport,e.content),t=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-t)*r;return Math.max(n,18)}function Un(e,r,t,n="ltr"){const a=_e(t),s=a/2,l=r||s,i=a-l,u=t.scrollbar.paddingStart+l,p=t.scrollbar.size-t.scrollbar.paddingEnd-i,d=t.content-t.viewport,f=n==="ltr"?[0,d]:[d*-1,0];return dr([u,p],f)(e)}function qe(e,r,t="ltr"){const n=_e(r),a=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,s=r.scrollbar.size-a,l=r.content-r.viewport,i=s-n,u=t==="ltr"?[0,l]:[l*-1,0],p=Sr(e,u);return dr([0,l],[0,i])(p)}function dr(e,r){return t=>{if(e[0]===e[1]||r[0]===r[1])return r[0];const n=(r[1]-r[0])/(e[1]-e[0]);return r[0]+n*(t-e[0])}}function fr(e,r){return e>0&&e<r}var Gn=(e,r=()=>{})=>{let t={left:e.scrollLeft,top:e.scrollTop},n=0;return(function a(){const s={left:e.scrollLeft,top:e.scrollTop},l=t.left!==s.left,i=t.top!==s.top;(l||i)&&r(),t=s,n=window.requestAnimationFrame(a)})(),()=>window.cancelAnimationFrame(n)};function Me(e,r){const t=B(e),n=c.useRef(0);return c.useEffect(()=>()=>window.clearTimeout(n.current),[]),c.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(t,r)},[t,r])}function oe(e,r){const t=B(r);br(()=>{let n=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(t)});return a.observe(e),()=>{window.cancelAnimationFrame(n),a.unobserve(e)}}},[e,t])}var Kn=tr,Hn=or,Wn=ir;function Bn({className:e,children:r,...t}){return o.jsxs(Kn,{"data-slot":"scroll-area",className:F("relative",e),...t,children:[o.jsx(Hn,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:r}),o.jsx(Vn,{}),o.jsx(Wn,{})]})}function Vn({className:e,orientation:r="vertical",...t}){return o.jsx(nr,{"data-slot":"scroll-area-scrollbar",orientation:r,className:F("flex touch-none p-px transition-colors select-none",r==="vertical"&&"h-full w-2.5 border-l border-l-transparent",r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...t,children:o.jsx(lr,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function Xn({className:e,...r}){return o.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:o.jsx("table",{"data-slot":"table",className:F("w-full caption-bottom text-sm",e),...r})})}function Yn({className:e,...r}){return o.jsx("thead",{"data-slot":"table-header",className:F("[&_tr]:border-b",e),...r})}function qn({className:e,...r}){return o.jsx("tbody",{"data-slot":"table-body",className:F("[&_tr:last-child]:border-0",e),...r})}function fe({className:e,...r}){return o.jsx("tr",{"data-slot":"table-row",className:F("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...r})}function pe({className:e,...r}){return o.jsx("th",{"data-slot":"table-head",className:F("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...r})}function te({className:e,...r}){return o.jsx("td",{"data-slot":"table-cell",className:F("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...r})}function Zn(e=Cr.ID_EXTENSION){const[r,t]=c.useState(null);return c.useEffect(()=>{const n=document.getElementById(e);n?.shadowRoot?t(n.shadowRoot):t(document.body)},[e]),r}function Jn(e,r,t,n){var a=this,s=c.useRef(null),l=c.useRef(0),i=c.useRef(0),u=c.useRef(null),p=c.useRef([]),d=c.useRef(),f=c.useRef(),h=c.useRef(e),m=c.useRef(!0);h.current=e;var g=typeof window<"u",M=!r&&r!==0&&g;if(typeof e!="function")throw new TypeError("Expected a function");r=+r||0;var j=!!(t=t||{}).leading,S=!("trailing"in t)||!!t.trailing,N="maxWait"in t,z="debounceOnServer"in t&&!!t.debounceOnServer,A=N?Math.max(+t.maxWait||0,r):null;c.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var v=c.useMemo(function(){var b=function(R){var y=p.current,J=d.current;return p.current=d.current=null,l.current=R,i.current=i.current||R,f.current=h.current.apply(J,y)},C=function(R,y){M&&cancelAnimationFrame(u.current),u.current=M?requestAnimationFrame(R):setTimeout(R,y)},K=function(R){if(!m.current)return!1;var y=R-s.current;return!s.current||y>=r||y<0||N&&R-l.current>=A},P=function(R){return u.current=null,S&&p.current?b(R):(p.current=d.current=null,f.current)},_=function R(){var y=Date.now();if(j&&i.current===l.current&&$(),K(y))return P(y);if(m.current){var J=r-(y-s.current),Re=N?Math.min(J,A-(y-l.current)):J;C(R,Re)}},$=function(){n&&n({})},H=function(){if(g||z){var R=Date.now(),y=K(R);if(p.current=[].slice.call(arguments),d.current=a,s.current=R,y){if(!u.current&&m.current)return l.current=s.current,C(_,r),j?b(s.current):f.current;if(N)return C(_,r),b(s.current)}return u.current||C(_,r),f.current}};return H.cancel=function(){u.current&&(M?cancelAnimationFrame(u.current):clearTimeout(u.current)),l.current=0,p.current=s.current=d.current=u.current=null},H.isPending=function(){return!!u.current},H.flush=function(){return u.current?P(Date.now()):f.current},H},[j,N,r,A,S,M,g,z,n]);return v}function Qn(e,r){return e===r}function ea(e,r,t){var n=Qn,a=c.useRef(e),s=c.useState({})[1],l=Jn(c.useCallback(function(u){a.current=u,s({})},[s]),r,t,s),i=c.useRef(e);return n(i.current,e)||(l(e),i.current=e),[a.current,l]}function ca(){const e=Zn(),[r,t]=c.useState(""),[n,a]=c.useState({}),[s,l]=c.useState(1),[i]=ea(r,400),u=c.useMemo(()=>["products",{currentPage:s,search:i,filter:n}],[s,i,n]),{data:p,isFetching:d}=Be({queryKey:u,queryFn:async()=>await L.apiRequest("index",Er({skip:(s-1)*L.item_per_page,where:{productModelCode:r,status_listing:n?.statusFilter==="all"?void 0:n.statusFilter}}))}),{data:f}=Be({queryKey:["publised-products"],queryFn:async()=>await L.apiRequest("getPublistedProducts",{})??[],staleTime:0,refetchOnMount:"always"}),h=Pr({mutationKey:["action-mutaions"],mutationFn:async v=>{if(v.status)return L.apiRequest("unlist",v);const b=await L.apiRequest("get",v);if(!(!b||!b?.data))return L.apiRequest("publist",{...v,images:Ve({...b?.data}).images})}}),m=c.useMemo(()=>!p||!p?.data?[]:p?.data.map(v=>Ve(v)),[p]),g=v=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(v),M=()=>{t(""),a({statusFilter:""}),l(1)},j=[n.statusFilter,r!==""].filter(Boolean).length,S=c.useMemo(()=>p?.total?Math.ceil(p.total/L.item_per_page):0,[p?.total,L.item_per_page]),N=c.useMemo(()=>(s-1)*L.item_per_page+1,[s]),z=c.useMemo(()=>Math.min(s*L.item_per_page,p?.total??0),[s,p]),A=async v=>{console.log({post:v}),h.mutate(v)};return c.useEffect(()=>{const v=setInterval(async()=>{try{if(!document.hidden){const b=await L.apiRequest("dequeue",{});b&&_r[b.type](b.title,{description:b.message})}}catch(b){console.error("Error in interval:",b)}},1e3);return()=>clearInterval(v)},[]),o.jsxs(no,{children:[o.jsx(co,{}),o.jsx(so,{container:e,side:"left",align:"end",className:"w-auto ",children:o.jsxs("div",{className:"space-y-4 h-[78vh] min-w-[638px]",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(Ur,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Mr,{placeholder:"Search...",value:r,onChange:v=>t(v.target.value),className:"pl-10"})]}),o.jsx(lo,{filter:n,setFilter:a,activeFiltersCount:j,clearFilters:M})]}),o.jsxs("div",{className:"flex items-center justify-between w-full gap-8",children:[o.jsxs("span",{children:["Showing ",N,"-",z," of ",p?.total??0," products"]}),S>1&&o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[o.jsxs(W,{variant:"outline",size:"xs",onClick:()=>l(v=>Math.max(1,v-1)),disabled:s===1,children:[o.jsx(Ar,{}),"Previous"]}),o.jsx("div",{className:"flex items-center gap-1",children:S<=7?Array.from({length:S},(v,b)=>o.jsx(W,{variant:s===b+1?"default":"outline",size:"xs",onClick:()=>l(b+1),children:b+1},b+1)):o.jsxs(o.Fragment,{children:[o.jsx(W,{variant:s===1?"default":"outline",size:"xs",onClick:()=>l(1),children:"1"}),s>4&&o.jsx("span",{className:"px-2 text-muted-foreground",children:"..."}),Array.from({length:3},(v,b)=>{let C;return s<=4?C=b+2:s>=S-3?C=S-4+b:C=s-1+b,C>1&&C<S?o.jsx(W,{variant:s===C?"default":"outline",size:"xs",onClick:()=>l(C),children:C},C):null}).filter(Boolean),s<S-3&&o.jsx("span",{className:"px-2 text-muted-foreground",children:"..."}),o.jsx(W,{variant:s===S?"default":"outline",size:"xs",onClick:()=>l(S),children:S})]})}),o.jsxs(W,{variant:"outline",size:"xs",onClick:()=>l(v=>Math.min(S,v+1)),disabled:s===S,children:["Next",o.jsx(Dr,{})]})]})]}),o.jsx("div",{className:"rounded-md border overflow-x-auto relative",children:o.jsx(Bn,{className:"h-[66vh] w-full",children:o.jsxs(Xn,{className:"h-fit",children:[o.jsx(Yn,{children:o.jsxs(fe,{children:[o.jsx(pe,{className:"min-w-[200px]",children:"Name"}),o.jsx(pe,{className:"w-[80px]",children:"Price"}),o.jsx(pe,{className:"w-[80px]",children:"Status"}),o.jsx(pe,{className:"w-[80px] text-center sticky right-0 bg-background border-l shadow-[-4px_0_8px_rgba(0,0,0,0.1)]",children:"Actions"})]})}),o.jsxs(qn,{className:"relative",children:[d&&o.jsx(fe,{children:o.jsx(te,{colSpan:10,className:"text-center py-8 text-muted-foreground ",children:o.jsx("div",{className:"h-full flex items-center justify-center w-full",children:o.jsx(Rr,{})})})}),m.length===0&&!d?o.jsx(fe,{children:o.jsx(te,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:o.jsx("div",{className:"h-full flex items-center justify-center w-full",children:o.jsx("span",{children:" No products found"})})})}):m.map(v=>{const b=f?.some(C=>C.title.includes(v.sku));return v.status=b,o.jsxs(fe,{children:[o.jsxs(te,{className:"font-medium",children:[o.jsx("div",{className:"truncate max-w-[340px] w-fit",title:v.title,children:v.title}),o.jsx("div",{className:"text-sm text-muted-foreground truncate max-w-[340px]",title:v.description,children:v.description})]}),o.jsx(te,{className:"font-semibold",children:g(v.price)}),o.jsx(te,{children:o.jsx(yr,{variant:"secondary",children:v?.status?"Listed":"Unlisted"})}),o.jsx(te,{className:"text-center sticky right-0 bg-background border-l shadow-[-4px_0_8px_rgba(0,0,0,0.1)]",children:o.jsxs(En,{children:[o.jsx(Nn,{asChild:!0,children:o.jsx("div",{className:"w-full flex items-center justify-center",children:o.jsx(W,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 mx-auto",children:o.jsx(Lr,{className:"h-4 w-4"})})})}),o.jsxs(An,{container:e,align:"end",children:[o.jsx(jr,{data:v,children:o.jsxs(Ye,{onSelect:C=>{C.preventDefault(),C.stopPropagation()},children:[o.jsx(Kr,{className:"h-4 w-4 mr-2"})," Review"]})}),o.jsxs(Ye,{onClick:()=>A(v),children:[v.status?o.jsx(dt,{className:"h-4 w-4 mr-2"}):o.jsx(ft,{className:"h-4 w-4 mr-2"}),v.status?"Unlist":"List"]})]})]})})]},v.id)})]})]})})})]})})]})}export{ca as P};
