import{c as oe,r as c,a as ge,u as qe,j as o,b as Ze,d as we,e as Ee,f as I,P as O,g as b,A as Ae,h as $,i as Je,k as Qe,l as et,m as tt,n as rt,F as ot,D as nt,o as at,s as st,t as F,B as K,v as pr,w as We,E as ct,x as lt,X as hr,y as mr,z as it,G as W,H as ut,I as vr,J as xr,K as gr,L as dt,M as wr,N as br,C as Sr,O as Be,S as Cr,U as Pr,p as B,V as _r,W as Mr,Y as Rr,Z as yr,_ as jr}from"./index-Byk7tiZd.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=oe("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=oe("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=oe("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=oe("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:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],zr=oe("search",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 Ur=[["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"}]],$r=oe("square-pen",Ur);var be="Popover",[ft,ta]=we(be,[ge]),ie=ge(),[Gr,V]=ft(be),pt=e=>{const{__scopePopover:r,children:t,open:n,defaultOpen:a,onOpenChange:s,modal:l=!1}=e,i=ie(r),d=c.useRef(null),[h,f]=c.useState(!1),[u,p]=qe({prop:n,defaultProp:a??!1,onChange:s,caller:be});return o.jsx(Ze,{...i,children:o.jsx(Gr,{scope:r,contentId:Ee(),triggerRef:d,open:u,onOpenChange:p,onOpenToggle:c.useCallback(()=>p(m=>!m),[p]),hasCustomAnchor:h,onCustomAnchorAdd:c.useCallback(()=>f(!0),[]),onCustomAnchorRemove:c.useCallback(()=>f(!1),[]),modal:l,children:t})})};pt.displayName=be;var ht="PopoverAnchor",Hr=c.forwardRef((e,r)=>{const{__scopePopover:t,...n}=e,a=V(ht,t),s=ie(t),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=a;return c.useEffect(()=>(l(),()=>i()),[l,i]),o.jsx(Ae,{...s,...n,ref:r})});Hr.displayName=ht;var mt="PopoverTrigger",vt=c.forwardRef((e,r)=>{const{__scopePopover:t,...n}=e,a=V(mt,t),s=ie(t),l=I(r,a.triggerRef),i=o.jsx(O.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":St(a.open),...n,ref:l,onClick:b(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?i:o.jsx(Ae,{asChild:!0,...s,children:i})});vt.displayName=mt;var Te="PopoverPortal",[Kr,Wr]=ft(Te,{forceMount:void 0}),xt=e=>{const{__scopePopover:r,forceMount:t,children:n,container:a}=e,s=V(Te,r);return o.jsx(Kr,{scope:r,forceMount:t,children:o.jsx($,{present:t||s.open,children:o.jsx(Je,{asChild:!0,container:a,children:n})})})};xt.displayName=Te;var te="PopoverContent",gt=c.forwardRef((e,r)=>{const t=Wr(te,e.__scopePopover),{forceMount:n=t.forceMount,...a}=e,s=V(te,e.__scopePopover);return o.jsx($,{present:n||s.open,children:s.modal?o.jsx(Vr,{...a,ref:r}):o.jsx(Xr,{...a,ref:r})})});gt.displayName=te;var Br=tt("PopoverContent.RemoveScroll"),Vr=c.forwardRef((e,r)=>{const t=V(te,e.__scopePopover),n=c.useRef(null),a=I(r,n),s=c.useRef(!1);return c.useEffect(()=>{const l=n.current;if(l)return Qe(l)},[]),o.jsx(et,{as:Br,allowPinchZoom:!0,children:o.jsx(wt,{...e,ref:a,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:b(e.onCloseAutoFocus,l=>{l.preventDefault(),s.current||t.triggerRef.current?.focus()}),onPointerDownOutside:b(e.onPointerDownOutside,l=>{const i=l.detail.originalEvent,d=i.button===0&&i.ctrlKey===!0,h=i.button===2||d;s.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:b(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),Xr=c.forwardRef((e,r)=>{const t=V(te,e.__scopePopover),n=c.useRef(!1),a=c.useRef(!1);return o.jsx(wt,{...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()}})}),wt=c.forwardRef((e,r)=>{const{__scopePopover:t,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,...u}=e,p=V(te,t),m=ie(t);return rt(),o.jsx(ot,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:s,children:o.jsx(nt,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:i,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>p.onOpenChange(!1),children:o.jsx(at,{"data-state":St(p.open),role:"dialog",id:p.contentId,...m,...u,ref:r,style:{...u.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)"}})})})}),bt="PopoverClose",Yr=c.forwardRef((e,r)=>{const{__scopePopover:t,...n}=e,a=V(bt,t);return o.jsx(O.button,{type:"button",...n,ref:r,onClick:b(e.onClick,()=>a.onOpenChange(!1))})});Yr.displayName=bt;var qr="PopoverArrow",Zr=c.forwardRef((e,r)=>{const{__scopePopover:t,...n}=e,a=ie(t);return o.jsx(st,{...a,...n,ref:r})});Zr.displayName=qr;function St(e){return e?"open":"closed"}var Jr=pt,Qr=vt,eo=xt,to=gt;function ro({...e}){return o.jsx(Jr,{"data-slot":"popover",...e})}function oo({...e}){return o.jsx(Qr,{"data-slot":"popover-trigger",...e})}function no({className:e,align:r="center",sideOffset:t=4,container:n,...a}){return o.jsx(eo,{container:n,children:o.jsx(to,{"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 ao(){return o.jsx(oo,{asChild:!0,children:o.jsx(K,{size:"icon",children:o.jsx(Or,{})})})}function so({filter:e,setFilter:r,activeFiltersCount:t,clearFilters:n}){return o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(pr,{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(ct,{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(lt,{className:"h-2 w-2"}),o.jsx("span",{className:"text-sm font-medium",children:"Unlisted"})]})]}),t>0&&o.jsxs(K,{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(hr,{className:"h-2 w-2"}),o.jsx("span",{className:"text-sm",children:"Clear"})]})]})}var Ne=["Enter"," "],co=["ArrowDown","PageUp","Home"],Ct=["ArrowUp","PageDown","End"],lo=[...co,...Ct],io={ltr:[...Ne,"ArrowRight"],rtl:[...Ne,"ArrowLeft"]},uo={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ue="Menu",[ce,fo,po]=mr(ue),[Y,Pt]=we(ue,[po,ge,it]),Se=ge(),_t=it(),[ho,q]=Y(ue),[mo,de]=Y(ue),Mt=e=>{const{__scopeMenu:r,open:t=!1,children:n,dir:a,onOpenChange:s,modal:l=!0}=e,i=Se(r),[d,h]=c.useState(null),f=c.useRef(!1),u=W(s),p=ut(a);return c.useEffect(()=>{const m=()=>{f.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>f.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),o.jsx(Ze,{...i,children:o.jsx(ho,{scope:r,open:t,onOpenChange:u,content:d,onContentChange:h,children:o.jsx(mo,{scope:r,onClose:c.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:p,modal:l,children:n})})})};Mt.displayName=ue;var vo="MenuAnchor",De=c.forwardRef((e,r)=>{const{__scopeMenu:t,...n}=e,a=Se(t);return o.jsx(Ae,{...a,...n,ref:r})});De.displayName=vo;var Ie="MenuPortal",[xo,Rt]=Y(Ie,{forceMount:void 0}),yt=e=>{const{__scopeMenu:r,forceMount:t,children:n,container:a}=e,s=q(Ie,r);return o.jsx(xo,{scope:r,forceMount:t,children:o.jsx($,{present:t||s.open,children:o.jsx(Je,{asChild:!0,container:a,children:n})})})};yt.displayName=Ie;var k="MenuContent",[go,Oe]=Y(k),jt=c.forwardRef((e,r)=>{const t=Rt(k,e.__scopeMenu),{forceMount:n=t.forceMount,...a}=e,s=q(k,e.__scopeMenu),l=de(k,e.__scopeMenu);return o.jsx(ce.Provider,{scope:e.__scopeMenu,children:o.jsx($,{present:n||s.open,children:o.jsx(ce.Slot,{scope:e.__scopeMenu,children:l.modal?o.jsx(wo,{...a,ref:r}):o.jsx(bo,{...a,ref:r})})})})}),wo=c.forwardRef((e,r)=>{const t=q(k,e.__scopeMenu),n=c.useRef(null),a=I(r,n);return c.useEffect(()=>{const s=n.current;if(s)return Qe(s)},[]),o.jsx(ke,{...e,ref:a,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:b(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)})}),bo=c.forwardRef((e,r)=>{const t=q(k,e.__scopeMenu);return o.jsx(ke,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)})}),So=tt("MenuContent.ScrollLock"),ke=c.forwardRef((e,r)=>{const{__scopeMenu:t,loop:n=!1,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEntryFocus:d,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:p,onDismiss:m,disableOutsideScroll:w,...P}=e,j=q(k,t),M=de(k,t),N=Se(t),C=_t(t),T=fo(t),[z,A]=c.useState(null),v=c.useRef(null),S=I(r,v,j.onContentChange),x=c.useRef(0),_=c.useRef(""),U=c.useRef(0),H=c.useRef(null),R=c.useRef("right"),y=c.useRef(0),Z=w?et:c.Fragment,Re=w?{as:So,allowPinchZoom:!0}:void 0,fr=g=>{const Q=_.current+g,X=T().filter(D=>!D.disabled),ne=document.activeElement,ye=X.find(D=>D.ref.current===ne)?.textValue,je=X.map(D=>D.textValue),He=Do(je,Q,ye),ae=X.find(D=>D.textValue===He)?.ref.current;(function D(Ke){_.current=Ke,window.clearTimeout(x.current),Ke!==""&&(x.current=window.setTimeout(()=>D(""),1e3))})(Q),ae&&setTimeout(()=>ae.focus())};c.useEffect(()=>()=>window.clearTimeout(x.current),[]),rt();const J=c.useCallback(g=>R.current===H.current?.side&&Oo(g,H.current?.area),[]);return o.jsx(go,{scope:t,searchRef:_,onItemEnter:c.useCallback(g=>{J(g)&&g.preventDefault()},[J]),onItemLeave:c.useCallback(g=>{J(g)||(v.current?.focus(),A(null))},[J]),onTriggerLeave:c.useCallback(g=>{J(g)&&g.preventDefault()},[J]),pointerGraceTimerRef:U,onPointerGraceIntentChange:c.useCallback(g=>{H.current=g},[]),children:o.jsx(Z,{...Re,children:o.jsx(ot,{asChild:!0,trapped:a,onMountAutoFocus:b(s,g=>{g.preventDefault(),v.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:o.jsx(nt,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:p,onDismiss:m,children:o.jsx(gr,{asChild:!0,...C,dir:M.dir,orientation:"vertical",loop:n,currentTabStopId:z,onCurrentTabStopIdChange:A,onEntryFocus:b(d,g=>{M.isUsingKeyboardRef.current||g.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(at,{role:"menu","aria-orientation":"vertical","data-state":Kt(j.open),"data-radix-menu-content":"",dir:M.dir,...N,...P,ref:S,style:{outline:"none",...P.style},onKeyDown:b(P.onKeyDown,g=>{const X=g.target.closest("[data-radix-menu-content]")===g.currentTarget,ne=g.ctrlKey||g.altKey||g.metaKey,ye=g.key.length===1;X&&(g.key==="Tab"&&g.preventDefault(),!ne&&ye&&fr(g.key));const je=v.current;if(g.target!==je||!lo.includes(g.key))return;g.preventDefault();const ae=T().filter(D=>!D.disabled).map(D=>D.ref.current);Ct.includes(g.key)&&ae.reverse(),Ao(ae)}),onBlur:b(e.onBlur,g=>{g.currentTarget.contains(g.target)||(window.clearTimeout(x.current),_.current="")}),onPointerMove:b(e.onPointerMove,le(g=>{const Q=g.target,X=y.current!==g.clientX;if(g.currentTarget.contains(Q)&&X){const ne=g.clientX>y.current?"right":"left";R.current=ne,y.current=g.clientX}}))})})})})})})});jt.displayName=k;var Co="MenuGroup",Le=c.forwardRef((e,r)=>{const{__scopeMenu:t,...n}=e;return o.jsx(O.div,{role:"group",...n,ref:r})});Le.displayName=Co;var Po="MenuLabel",Et=c.forwardRef((e,r)=>{const{__scopeMenu:t,...n}=e;return o.jsx(O.div,{...n,ref:r})});Et.displayName=Po;var he="MenuItem",Ve="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),d=I(r,s),h=c.useRef(!1),f=()=>{const u=s.current;if(!t&&u){const p=new CustomEvent(Ve,{bubbles:!0,cancelable:!0});u.addEventListener(Ve,m=>n?.(m),{once:!0}),xr(u,p),p.defaultPrevented?h.current=!1:l.onClose()}};return o.jsx(Nt,{...a,ref:d,disabled:t,onClick:b(e.onClick,f),onPointerDown:u=>{e.onPointerDown?.(u),h.current=!0},onPointerUp:b(e.onPointerUp,u=>{h.current||u.currentTarget?.click()}),onKeyDown:b(e.onKeyDown,u=>{const p=i.searchRef.current!=="";t||p&&u.key===" "||Ne.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})});Ce.displayName=he;var Nt=c.forwardRef((e,r)=>{const{__scopeMenu:t,disabled:n=!1,textValue:a,...s}=e,l=Oe(he,t),i=_t(t),d=c.useRef(null),h=I(r,d),[f,u]=c.useState(!1),[p,m]=c.useState("");return c.useEffect(()=>{const w=d.current;w&&m((w.textContent??"").trim())},[s.children]),o.jsx(ce.ItemSlot,{scope:t,disabled:n,textValue:a??p,children:o.jsx(vr,{asChild:!0,...i,focusable:!n,children:o.jsx(O.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:h,onPointerMove:b(e.onPointerMove,le(w=>{n?l.onItemLeave(w):(l.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:b(e.onPointerLeave,le(w=>l.onItemLeave(w))),onFocus:b(e.onFocus,()=>u(!0)),onBlur:b(e.onBlur,()=>u(!1))})})})}),_o="MenuCheckboxItem",At=c.forwardRef((e,r)=>{const{checked:t=!1,onCheckedChange:n,...a}=e;return o.jsx(kt,{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:b(a.onSelect,()=>n?.(me(t)?!0:!t),{checkForDefaultPrevented:!1})})})});At.displayName=_o;var Tt="MenuRadioGroup",[Mo,Ro]=Y(Tt,{value:void 0,onValueChange:()=>{}}),Dt=c.forwardRef((e,r)=>{const{value:t,onValueChange:n,...a}=e,s=W(n);return o.jsx(Mo,{scope:e.__scopeMenu,value:t,onValueChange:s,children:o.jsx(Le,{...a,ref:r})})});Dt.displayName=Tt;var It="MenuRadioItem",Ot=c.forwardRef((e,r)=>{const{value:t,...n}=e,a=Ro(It,e.__scopeMenu),s=t===a.value;return o.jsx(kt,{scope:e.__scopeMenu,checked:s,children:o.jsx(Ce,{role:"menuitemradio","aria-checked":s,...n,ref:r,"data-state":ze(s),onSelect:b(n.onSelect,()=>a.onValueChange?.(t),{checkForDefaultPrevented:!1})})})});Ot.displayName=It;var Fe="MenuItemIndicator",[kt,yo]=Y(Fe,{checked:!1}),Lt=c.forwardRef((e,r)=>{const{__scopeMenu:t,forceMount:n,...a}=e,s=yo(Fe,t);return o.jsx($,{present:n||me(s.checked)||s.checked===!0,children:o.jsx(O.span,{...a,ref:r,"data-state":ze(s.checked)})})});Lt.displayName=Fe;var jo="MenuSeparator",Ft=c.forwardRef((e,r)=>{const{__scopeMenu:t,...n}=e;return o.jsx(O.div,{role:"separator","aria-orientation":"horizontal",...n,ref:r})});Ft.displayName=jo;var Eo="MenuArrow",zt=c.forwardRef((e,r)=>{const{__scopeMenu:t,...n}=e,a=Se(t);return o.jsx(st,{...a,...n,ref:r})});zt.displayName=Eo;var No="MenuSub",[ra,Ut]=Y(No),se="MenuSubTrigger",$t=c.forwardRef((e,r)=>{const t=q(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:d}=s,h={__scopeMenu:e.__scopeMenu},f=c.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return c.useEffect(()=>f,[f]),c.useEffect(()=>{const u=i.current;return()=>{window.clearTimeout(u),d(null)}},[i,d]),o.jsx(De,{asChild:!0,...h,children:o.jsx(Nt,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":t.open,"aria-controls":a.contentId,"data-state":Kt(t.open),...e,ref:dt(r,a.onTriggerChange),onClick:u=>{e.onClick?.(u),!(e.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),t.open||t.onOpenChange(!0))},onPointerMove:b(e.onPointerMove,le(u=>{s.onItemEnter(u),!u.defaultPrevented&&!e.disabled&&!t.open&&!l.current&&(s.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{t.onOpenChange(!0),f()},100))})),onPointerLeave:b(e.onPointerLeave,le(u=>{f();const p=t.content?.getBoundingClientRect();if(p){const m=t.content?.dataset.side,w=m==="right",P=w?-5:5,j=p[w?"left":"right"],M=p[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:u.clientX+P,y:u.clientY},{x:j,y:p.top},{x:M,y:p.top},{x:M,y:p.bottom},{x:j,y:p.bottom}],side:m}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(u),u.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:b(e.onKeyDown,u=>{const p=s.searchRef.current!=="";e.disabled||p&&u.key===" "||io[n.dir].includes(u.key)&&(t.onOpenChange(!0),t.content?.focus(),u.preventDefault())})})})});$t.displayName=se;var Gt="MenuSubContent",Ht=c.forwardRef((e,r)=>{const t=Rt(k,e.__scopeMenu),{forceMount:n=t.forceMount,...a}=e,s=q(k,e.__scopeMenu),l=de(k,e.__scopeMenu),i=Ut(Gt,e.__scopeMenu),d=c.useRef(null),h=I(r,d);return o.jsx(ce.Provider,{scope:e.__scopeMenu,children:o.jsx($,{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:h,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{l.isUsingKeyboardRef.current&&d.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:b(e.onFocusOutside,f=>{f.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:b(e.onEscapeKeyDown,f=>{l.onClose(),f.preventDefault()}),onKeyDown:b(e.onKeyDown,f=>{const u=f.currentTarget.contains(f.target),p=uo[l.dir].includes(f.key);u&&p&&(s.onOpenChange(!1),i.trigger?.focus(),f.preventDefault())})})})})})});Ht.displayName=Gt;function Kt(e){return e?"open":"closed"}function me(e){return e==="indeterminate"}function ze(e){return me(e)?"indeterminate":e?"checked":"unchecked"}function Ao(e){const r=document.activeElement;for(const t of e)if(t===r||(t.focus(),document.activeElement!==r))return}function To(e,r){return e.map((t,n)=>e[(r+n)%e.length])}function Do(e,r,t){const a=r.length>1&&Array.from(r).every(h=>h===r[0])?r[0]:r,s=t?e.indexOf(t):-1;let l=To(e,Math.max(s,0));a.length===1&&(l=l.filter(h=>h!==t));const d=l.find(h=>h.toLowerCase().startsWith(a.toLowerCase()));return d!==t?d:void 0}function Io(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],d=r[l],h=i.x,f=i.y,u=d.x,p=d.y;f>n!=p>n&&t<(u-h)*(n-f)/(p-f)+h&&(a=!a)}return a}function Oo(e,r){if(!r)return!1;const t={x:e.clientX,y:e.clientY};return Io(t,r)}function le(e){return r=>r.pointerType==="mouse"?e(r):void 0}var ko=Mt,Lo=De,Fo=yt,zo=jt,Uo=Le,$o=Et,Go=Ce,Ho=At,Ko=Dt,Wo=Ot,Bo=Lt,Vo=Ft,Xo=zt,Yo=$t,qo=Ht,Pe="DropdownMenu",[Zo,oa]=we(Pe,[Pt]),E=Pt(),[Jo,Wt]=Zo(Pe),Bt=e=>{const{__scopeDropdownMenu:r,children:t,dir:n,open:a,defaultOpen:s,onOpenChange:l,modal:i=!0}=e,d=E(r),h=c.useRef(null),[f,u]=qe({prop:a,defaultProp:s??!1,onChange:l,caller:Pe});return o.jsx(Jo,{scope:r,triggerId:Ee(),triggerRef:h,contentId:Ee(),open:f,onOpenChange:u,onOpenToggle:c.useCallback(()=>u(p=>!p),[u]),modal:i,children:o.jsx(ko,{...d,open:f,onOpenChange:u,dir:n,modal:i,children:t})})};Bt.displayName=Pe;var Vt="DropdownMenuTrigger",Xt=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,disabled:n=!1,...a}=e,s=Wt(Vt,t),l=E(t);return o.jsx(Lo,{asChild:!0,...l,children:o.jsx(O.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:dt(r,s.triggerRef),onPointerDown:b(e.onPointerDown,i=>{!n&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:b(e.onKeyDown,i=>{n||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Xt.displayName=Vt;var Qo="DropdownMenuPortal",Yt=e=>{const{__scopeDropdownMenu:r,...t}=e,n=E(r);return o.jsx(Fo,{...n,...t})};Yt.displayName=Qo;var qt="DropdownMenuContent",Zt=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=Wt(qt,t),s=E(t),l=c.useRef(!1);return o.jsx(zo,{id:a.contentId,"aria-labelledby":a.triggerId,...s,...n,ref:r,onCloseAutoFocus:b(e.onCloseAutoFocus,i=>{l.current||a.triggerRef.current?.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:b(e.onInteractOutside,i=>{const d=i.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0,f=d.button===2||h;(!a.modal||f)&&(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)"}})});Zt.displayName=qt;var en="DropdownMenuGroup",tn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Uo,{...a,...n,ref:r})});tn.displayName=en;var rn="DropdownMenuLabel",on=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx($o,{...a,...n,ref:r})});on.displayName=rn;var nn="DropdownMenuItem",Jt=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Go,{...a,...n,ref:r})});Jt.displayName=nn;var an="DropdownMenuCheckboxItem",sn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Ho,{...a,...n,ref:r})});sn.displayName=an;var cn="DropdownMenuRadioGroup",ln=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Ko,{...a,...n,ref:r})});ln.displayName=cn;var un="DropdownMenuRadioItem",dn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Wo,{...a,...n,ref:r})});dn.displayName=un;var fn="DropdownMenuItemIndicator",pn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Bo,{...a,...n,ref:r})});pn.displayName=fn;var hn="DropdownMenuSeparator",mn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Vo,{...a,...n,ref:r})});mn.displayName=hn;var vn="DropdownMenuArrow",xn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Xo,{...a,...n,ref:r})});xn.displayName=vn;var gn="DropdownMenuSubTrigger",wn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(Yo,{...a,...n,ref:r})});wn.displayName=gn;var bn="DropdownMenuSubContent",Sn=c.forwardRef((e,r)=>{const{__scopeDropdownMenu:t,...n}=e,a=E(t);return o.jsx(qo,{...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)"}})});Sn.displayName=bn;var Cn=Bt,Pn=Xt,_n=Yt,Mn=Zt,Rn=Jt;function yn({...e}){return o.jsx(Cn,{"data-slot":"dropdown-menu",...e})}function jn({...e}){return o.jsx(Pn,{"data-slot":"dropdown-menu-trigger",...e})}function En({className:e,sideOffset:r=4,container:t,...n}){return o.jsx(_n,{container:t,children:o.jsx(Mn,{"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 Xe({className:e,inset:r,variant:t="default",...n}){return o.jsx(Rn,{"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 Nn(e,r){return c.useReducer((t,n)=>r[t][n]??t,e)}var Ue="ScrollArea",[Qt,na]=we(Ue),[An,L]=Qt(Ue),er=c.forwardRef((e,r)=>{const{__scopeScrollArea:t,type:n="hover",dir:a,scrollHideDelay:s=600,...l}=e,[i,d]=c.useState(null),[h,f]=c.useState(null),[u,p]=c.useState(null),[m,w]=c.useState(null),[P,j]=c.useState(null),[M,N]=c.useState(0),[C,T]=c.useState(0),[z,A]=c.useState(!1),[v,S]=c.useState(!1),x=I(r,U=>d(U)),_=ut(a);return o.jsx(An,{scope:t,type:n,dir:_,scrollHideDelay:s,scrollArea:i,viewport:h,onViewportChange:f,content:u,onContentChange:p,scrollbarX:m,onScrollbarXChange:w,scrollbarXEnabled:z,onScrollbarXEnabledChange:A,scrollbarY:P,onScrollbarYChange:j,scrollbarYEnabled:v,onScrollbarYEnabledChange:S,onCornerWidthChange:N,onCornerHeightChange:T,children:o.jsx(O.div,{dir:_,...l,ref:x,style:{position:"relative","--radix-scroll-area-corner-width":M+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})});er.displayName=Ue;var tr="ScrollAreaViewport",rr=c.forwardRef((e,r)=>{const{__scopeScrollArea:t,children:n,nonce:a,...s}=e,l=L(tr,t),i=c.useRef(null),d=I(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(O.div,{"data-radix-scroll-area-viewport":"",...s,ref:d,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})})]})});rr.displayName=tr;var G="ScrollAreaScrollbar",or=c.forwardRef((e,r)=>{const{forceMount:t,...n}=e,a=L(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(Tn,{...n,ref:r,forceMount:t}):a.type==="scroll"?o.jsx(Dn,{...n,ref:r,forceMount:t}):a.type==="auto"?o.jsx(nr,{...n,ref:r,forceMount:t}):a.type==="always"?o.jsx($e,{...n,ref:r}):null});or.displayName=G;var Tn=c.forwardRef((e,r)=>{const{forceMount:t,...n}=e,a=L(G,e.__scopeScrollArea),[s,l]=c.useState(!1);return c.useEffect(()=>{const i=a.scrollArea;let d=0;if(i){const h=()=>{window.clearTimeout(d),l(!0)},f=()=>{d=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",h),i.addEventListener("pointerleave",f),()=>{window.clearTimeout(d),i.removeEventListener("pointerenter",h),i.removeEventListener("pointerleave",f)}}},[a.scrollArea,a.scrollHideDelay]),o.jsx($,{present:t||s,children:o.jsx(nr,{"data-state":s?"visible":"hidden",...n,ref:r})})}),Dn=c.forwardRef((e,r)=>{const{forceMount:t,...n}=e,a=L(G,e.__scopeScrollArea),s=e.orientation==="horizontal",l=Me(()=>d("SCROLL_END"),100),[i,d]=Nn("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 h=window.setTimeout(()=>d("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(h)}},[i,a.scrollHideDelay,d]),c.useEffect(()=>{const h=a.viewport,f=s?"scrollLeft":"scrollTop";if(h){let u=h[f];const p=()=>{const m=h[f];u!==m&&(d("SCROLL"),l()),u=m};return h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[a.viewport,s,d,l]),o.jsx($,{present:t||i!=="hidden",children:o.jsx($e,{"data-state":i==="hidden"?"hidden":"visible",...n,ref:r,onPointerEnter:b(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:b(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),nr=c.forwardRef((e,r)=>{const t=L(G,e.__scopeScrollArea),{forceMount:n,...a}=e,[s,l]=c.useState(!1),i=e.orientation==="horizontal",d=Me(()=>{if(t.viewport){const h=t.viewport.offsetWidth<t.viewport.scrollWidth,f=t.viewport.offsetHeight<t.viewport.scrollHeight;l(i?h:f)}},10);return re(t.viewport,d),re(t.content,d),o.jsx($,{present:n||s,children:o.jsx($e,{"data-state":s?"visible":"hidden",...a,ref:r})})}),$e=c.forwardRef((e,r)=>{const{orientation:t="vertical",...n}=e,a=L(G,e.__scopeScrollArea),s=c.useRef(null),l=c.useRef(0),[i,d]=c.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=ir(i.viewport,i.content),f={...n,sizes:i,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:p=>l.current=p};function u(p,m){return zn(p,l.current,i,m)}return t==="horizontal"?o.jsx(In,{...f,ref:r,onThumbPositionChange:()=>{if(a.viewport&&s.current){const p=a.viewport.scrollLeft,m=Ye(p,i,a.dir);s.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollLeft=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollLeft=u(p,a.dir))}}):t==="vertical"?o.jsx(On,{...f,ref:r,onThumbPositionChange:()=>{if(a.viewport&&s.current){const p=a.viewport.scrollTop,m=Ye(p,i);s.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:p=>{a.viewport&&(a.viewport.scrollTop=p)},onDragScroll:p=>{a.viewport&&(a.viewport.scrollTop=u(p))}}):null}),In=c.forwardRef((e,r)=>{const{sizes:t,onSizesChange:n,...a}=e,s=L(G,e.__scopeScrollArea),[l,i]=c.useState(),d=c.useRef(null),h=I(r,d,s.onScrollbarXChange);return c.useEffect(()=>{d.current&&i(getComputedStyle(d.current))},[d]),o.jsx(sr,{"data-orientation":"horizontal",...a,ref:h,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:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,u)=>{if(s.viewport){const p=s.viewport.scrollLeft+f.deltaX;e.onWheelScroll(p),dr(p,u)&&f.preventDefault()}},onResize:()=>{d.current&&s.viewport&&l&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:xe(l.paddingLeft),paddingEnd:xe(l.paddingRight)}})}})}),On=c.forwardRef((e,r)=>{const{sizes:t,onSizesChange:n,...a}=e,s=L(G,e.__scopeScrollArea),[l,i]=c.useState(),d=c.useRef(null),h=I(r,d,s.onScrollbarYChange);return c.useEffect(()=>{d.current&&i(getComputedStyle(d.current))},[d]),o.jsx(sr,{"data-orientation":"vertical",...a,ref:h,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:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,u)=>{if(s.viewport){const p=s.viewport.scrollTop+f.deltaY;e.onWheelScroll(p),dr(p,u)&&f.preventDefault()}},onResize:()=>{d.current&&s.viewport&&l&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:xe(l.paddingTop),paddingEnd:xe(l.paddingBottom)}})}})}),[kn,ar]=Qt(G),sr=c.forwardRef((e,r)=>{const{__scopeScrollArea:t,sizes:n,hasThumb:a,onThumbChange:s,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:f,onResize:u,...p}=e,m=L(G,t),[w,P]=c.useState(null),j=I(r,x=>P(x)),M=c.useRef(null),N=c.useRef(""),C=m.viewport,T=n.content-n.viewport,z=W(f),A=W(d),v=Me(u,10);function S(x){if(M.current){const _=x.clientX-M.current.left,U=x.clientY-M.current.top;h({x:_,y:U})}}return c.useEffect(()=>{const x=_=>{const U=_.target;w?.contains(U)&&z(_,T)};return document.addEventListener("wheel",x,{passive:!1}),()=>document.removeEventListener("wheel",x,{passive:!1})},[C,w,T,z]),c.useEffect(A,[n,A]),re(w,v),re(m.content,v),o.jsx(kn,{scope:t,scrollbar:w,hasThumb:a,onThumbChange:W(s),onThumbPointerUp:W(l),onThumbPositionChange:A,onThumbPointerDown:W(i),children:o.jsx(O.div,{...p,ref:j,style:{position:"absolute",...p.style},onPointerDown:b(e.onPointerDown,x=>{x.button===0&&(x.target.setPointerCapture(x.pointerId),M.current=w.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),S(x))}),onPointerMove:b(e.onPointerMove,S),onPointerUp:b(e.onPointerUp,x=>{const _=x.target;_.hasPointerCapture(x.pointerId)&&_.releasePointerCapture(x.pointerId),document.body.style.webkitUserSelect=N.current,m.viewport&&(m.viewport.style.scrollBehavior=""),M.current=null})})})}),ve="ScrollAreaThumb",cr=c.forwardRef((e,r)=>{const{forceMount:t,...n}=e,a=ar(ve,e.__scopeScrollArea);return o.jsx($,{present:t||a.hasThumb,children:o.jsx(Ln,{ref:r,...n})})}),Ln=c.forwardRef((e,r)=>{const{__scopeScrollArea:t,style:n,...a}=e,s=L(ve,t),l=ar(ve,t),{onThumbPositionChange:i}=l,d=I(r,u=>l.onThumbChange(u)),h=c.useRef(void 0),f=Me(()=>{h.current&&(h.current(),h.current=void 0)},100);return c.useEffect(()=>{const u=s.viewport;if(u){const p=()=>{if(f(),!h.current){const m=Un(u,i);h.current=m,i()}};return i(),u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[s.viewport,f,i]),o.jsx(O.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:b(e.onPointerDownCapture,u=>{const m=u.target.getBoundingClientRect(),w=u.clientX-m.left,P=u.clientY-m.top;l.onThumbPointerDown({x:w,y:P})}),onPointerUp:b(e.onPointerUp,l.onThumbPointerUp)})});cr.displayName=ve;var Ge="ScrollAreaCorner",lr=c.forwardRef((e,r)=>{const t=L(Ge,e.__scopeScrollArea),n=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&n?o.jsx(Fn,{...e,ref:r}):null});lr.displayName=Ge;var Fn=c.forwardRef((e,r)=>{const{__scopeScrollArea:t,...n}=e,a=L(Ge,t),[s,l]=c.useState(0),[i,d]=c.useState(0),h=!!(s&&i);return re(a.scrollbarX,()=>{const f=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(f),d(f)}),re(a.scrollbarY,()=>{const f=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(f),l(f)}),h?o.jsx(O.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 ir(e,r){const t=e/r;return isNaN(t)?0:t}function _e(e){const r=ir(e.viewport,e.content),t=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-t)*r;return Math.max(n,18)}function zn(e,r,t,n="ltr"){const a=_e(t),s=a/2,l=r||s,i=a-l,d=t.scrollbar.paddingStart+l,h=t.scrollbar.size-t.scrollbar.paddingEnd-i,f=t.content-t.viewport,u=n==="ltr"?[0,f]:[f*-1,0];return ur([d,h],u)(e)}function Ye(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,d=t==="ltr"?[0,l]:[l*-1,0],h=br(e,d);return ur([0,l],[0,i])(h)}function ur(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 dr(e,r){return e>0&&e<r}var Un=(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=W(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 re(e,r){const t=W(r);wr(()=>{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 $n=er,Gn=rr,Hn=lr;function Kn({className:e,children:r,...t}){return o.jsxs($n,{"data-slot":"scroll-area",className:F("relative",e),...t,children:[o.jsx(Gn,{"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(Wn,{}),o.jsx(Hn,{})]})}function Wn({className:e,orientation:r="vertical",...t}){return o.jsx(or,{"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(cr,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function Bn({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 Vn({className:e,...r}){return o.jsx("thead",{"data-slot":"table-header",className:F("[&_tr]:border-b",e),...r})}function Xn({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 ee({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 Yn(e=Sr.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 qn(e,r,t,n){var a=this,s=c.useRef(null),l=c.useRef(0),i=c.useRef(0),d=c.useRef(null),h=c.useRef([]),f=c.useRef(),u=c.useRef(),p=c.useRef(e),m=c.useRef(!0);p.current=e;var w=typeof window<"u",P=!r&&r!==0&&w;if(typeof e!="function")throw new TypeError("Expected a function");r=+r||0;var j=!!(t=t||{}).leading,M=!("trailing"in t)||!!t.trailing,N="maxWait"in t,C="debounceOnServer"in t&&!!t.debounceOnServer,T=N?Math.max(+t.maxWait||0,r):null;c.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var z=c.useMemo(function(){var A=function(R){var y=h.current,Z=f.current;return h.current=f.current=null,l.current=R,i.current=i.current||R,u.current=p.current.apply(Z,y)},v=function(R,y){P&&cancelAnimationFrame(d.current),d.current=P?requestAnimationFrame(R):setTimeout(R,y)},S=function(R){if(!m.current)return!1;var y=R-s.current;return!s.current||y>=r||y<0||N&&R-l.current>=T},x=function(R){return d.current=null,M&&h.current?A(R):(h.current=f.current=null,u.current)},_=function R(){var y=Date.now();if(j&&i.current===l.current&&U(),S(y))return x(y);if(m.current){var Z=r-(y-s.current),Re=N?Math.min(Z,T-(y-l.current)):Z;v(R,Re)}},U=function(){n&&n({})},H=function(){if(w||C){var R=Date.now(),y=S(R);if(h.current=[].slice.call(arguments),f.current=a,s.current=R,y){if(!d.current&&m.current)return l.current=s.current,v(_,r),j?A(s.current):u.current;if(N)return v(_,r),A(s.current)}return d.current||v(_,r),u.current}};return H.cancel=function(){d.current&&(P?cancelAnimationFrame(d.current):clearTimeout(d.current)),l.current=0,h.current=s.current=f.current=d.current=null},H.isPending=function(){return!!d.current},H.flush=function(){return d.current?x(Date.now()):u.current},H},[j,N,r,T,M,P,w,C,n]);return z}function Zn(e,r){return e===r}function Jn(e,r,t){var n=Zn,a=c.useRef(e),s=c.useState({})[1],l=qn(c.useCallback(function(d){a.current=d,s({})},[s]),r,t,s),i=c.useRef(e);return n(i.current,e)||(l(e),i.current=e),[a.current,l]}function aa(){const e=Yn(),[r,t]=c.useState(""),[n,a]=c.useState({}),[s,l]=c.useState(1),[i]=Jn(r,400),[d,h]=c.useState(!1),f=c.useMemo(()=>["products",{currentPage:s,search:i,filter:n}],[s,i,n]),{data:u,isFetching:p}=Be({queryKey:f,queryFn:async()=>await B.apiRequest("index",Er({skip:(s-1)*B.item_per_page,where:{productModelCode:r,status_listing:n?.statusFilter==="all"?void 0:n.statusFilter}}))}),{data:m}=Be({queryKey:["publised-products"],queryFn:async()=>await B.apiRequest("getPublistedProducts",{})??[],staleTime:0,refetchOnMount:"always"}),w=Cr(),P=c.useMemo(()=>!u||!u?.data?[]:u?.data.map(v=>Pr(v)),[u]),j=v=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(v),M=()=>{t(""),a({statusFilter:""}),l(1)},N=[n.statusFilter,r!==""].filter(Boolean).length,C=c.useMemo(()=>u?.total?Math.ceil(u.total/B.item_per_page):0,[u?.total,B.item_per_page]),T=c.useMemo(()=>(s-1)*B.item_per_page+1,[s]),z=c.useMemo(()=>Math.min(s*B.item_per_page,u?.total??0),[s,u]),A=async v=>{w.mutate(v)};return c.useEffect(()=>{const v=setInterval(async()=>{try{if(!document.hidden&&chrome?.runtime?.id){const S=await B.apiRequest("dequeue",{});S&&_r[S.type](S.title,{description:S.message})}}catch(S){console.error("Error in interval:",S)}},1e3);return()=>clearInterval(v)},[]),o.jsxs(ro,{open:d,onOpenChange:h,children:[o.jsx(ao,{}),o.jsx(no,{container:e,side:"left",align:"end",className:"w-auto ",children:o.jsxs("div",{className:"space-y-4 h-[78vh] min-w-[638px] ex-root",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(zr,{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(so,{filter:n,setFilter:a,activeFiltersCount:N,clearFilters:M})]}),o.jsxs("div",{className:"flex items-center justify-between w-full gap-8",children:[o.jsxs("span",{children:["Showing ",T,"-",z," of ",u?.total??0," products"]}),C>1&&o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[o.jsxs(K,{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:C<=7?Array.from({length:C},(v,S)=>o.jsx(K,{variant:s===S+1?"default":"outline",size:"xs",onClick:()=>l(S+1),children:S+1},S+1)):o.jsxs(o.Fragment,{children:[o.jsx(K,{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,S)=>{let x;return s<=4?x=S+2:s>=C-3?x=C-4+S:x=s-1+S,x>1&&x<C?o.jsx(K,{variant:s===x?"default":"outline",size:"xs",onClick:()=>l(x),children:x},x):null}).filter(Boolean),s<C-3&&o.jsx("span",{className:"px-2 text-muted-foreground",children:"..."}),o.jsx(K,{variant:s===C?"default":"outline",size:"xs",onClick:()=>l(C),children:C})]})}),o.jsxs(K,{variant:"outline",size:"xs",onClick:()=>l(v=>Math.min(C,v+1)),disabled:s===C,children:["Next",o.jsx(Dr,{})]})]})]}),o.jsx("div",{className:"rounded-md border overflow-x-auto relative",children:o.jsx(Kn,{className:"h-[66vh] w-full",children:o.jsxs(Bn,{className:"h-fit",children:[o.jsx(Vn,{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(Xn,{className:"relative",children:[p&&o.jsx(fe,{children:o.jsx(ee,{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,{})})})}),P.length===0&&!p?o.jsx(fe,{children:o.jsx(ee,{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"})})})}):P.map(v=>{const S=m?.some(x=>x.title.includes(v.sku));return v.status=S,o.jsxs(fe,{children:[o.jsxs(ee,{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(ee,{className:"font-semibold",children:j(v.price)}),o.jsx(ee,{children:o.jsx(yr,{variant:"secondary",children:v?.status?"Listed":"Unlisted"})}),o.jsx(ee,{className:"text-center sticky right-0 bg-background border-l shadow-[-4px_0_8px_rgba(0,0,0,0.1)]",children:o.jsxs(yn,{children:[o.jsx(jn,{asChild:!0,children:o.jsx("div",{className:"w-full flex items-center justify-center",children:o.jsx(K,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 mx-auto",children:o.jsx(Lr,{className:"h-4 w-4"})})})}),o.jsxs(En,{container:e,align:"end",children:[o.jsx(jr,{data:v,children:o.jsxs(Xe,{onSelect:x=>{x.preventDefault(),x.stopPropagation()},children:[o.jsx($r,{className:"h-4 w-4 mr-2"})," Review"]})}),o.jsxs(Xe,{onClick:()=>A(v),children:[v.status?o.jsx(lt,{className:"h-4 w-4 mr-2"}):o.jsx(ct,{className:"h-4 w-4 mr-2"}),v.status?"Unlist":"List"]})]})]})})]},v.id)})]})]})})})]})})]})}export{aa as P};
