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