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