@jacshuo/onyx 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +280 -334
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Accordion:()=>De,AccordionContent:()=>Pe,AccordionItem:()=>Ae,AccordionTrigger:()=>Fe,Alert:()=>at,AlertDescription:()=>st,AlertTitle:()=>nt,Badge:()=>z,Button:()=>j,Card:()=>P,CardContent:()=>$,CardDescription:()=>V,CardFooter:()=>O,CardHeader:()=>I,CardTitle:()=>R,Chat:()=>fe,CinePlayer:()=>qt,DataTable:()=>se,Dialog:()=>Ue,DialogClose:()=>Qe,DialogContent:()=>Ge,DialogDescription:()=>Ze,DialogFooter:()=>Je,DialogHeader:()=>Ye,DialogTitle:()=>We,Dropdown:()=>M,DropdownButton:()=>T,FileExplorer:()=>Jt,FilmReel:()=>zt,Header:()=>Te,HorizontalCard:()=>K,ImageCard:()=>B,ImageCardActions:()=>U,ImageCardBody:()=>X,ImageCardDescription:()=>H,ImageCardTitle:()=>q,Input:()=>F,Label:()=>_,List:()=>ie,ListItem:()=>oe,MiniPlayer:()=>Kt,Panel:()=>G,PanelContent:()=>W,PanelHeader:()=>Y,SideNav:()=>Le,SortableTable:()=>ae,TabContent:()=>Be,TabList:()=>$e,TabPanels:()=>Ke,TabTrigger:()=>Oe,Table:()=>Z,TableBody:()=>Q,TableCell:()=>re,TableHead:()=>te,TableHeader:()=>J,TableRow:()=>ee,Tabs:()=>Ve,Tooltip:()=>tt,Tree:()=>de,TreeItem:()=>xe,accordionVariants:()=>p,alertVariants:()=>v,badgeVariants:()=>i,buttonVariants:()=>l,cardVariants:()=>d,cn:()=>n,configureAlertTopOffset:()=>ht,dialogContentVariants:()=>b,inputVariants:()=>o,labelVariants:()=>c,listVariants:()=>x,panelVariants:()=>u,tabListVariants:()=>h,tabTriggerVariants:()=>f,tableVariants:()=>m,tooltipVariants:()=>g,useAlert:()=>jt});const r=require("clsx"),a=require("tailwind-merge");function n(...e){return(0,a.twMerge)((0,r.clsx)(e))}const s=require("class-variance-authority"),l=(0,s.cva)("inline-flex cursor-pointer items-center justify-center gap-1.5 rounded font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-500 text-white hover:bg-primary-600 active:bg-primary-700",secondary:"bg-secondary-500 text-white hover:bg-secondary-600 active:bg-secondary-700",danger:"bg-danger-500 text-white hover:bg-danger-600 active:bg-danger-700",warning:"bg-warning-500 text-white hover:bg-warning-600 active:bg-warning-700",ghost:"bg-transparent text-primary-700 hover:bg-primary-100 active:bg-primary-200 dark:text-primary-300 dark:hover:bg-primary-800",outline:"border border-primary-300 bg-transparent text-primary-700 hover:bg-primary-50 dark:border-primary-600 dark:text-primary-300 dark:hover:bg-primary-800"},size:{sm:"h-7 px-3 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"h-9 px-4 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"h-11 px-6 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{intent:"primary",size:"md"}}),i=(0,s.cva)("inline-flex items-center gap-1 rounded border px-2.5 py-0.5 text-xs font-semibold [&_svg]:h-3 [&_svg]:w-3 [&_svg]:shrink-0",{variants:{intent:{success:"border-green-200 bg-green-100 text-green-800 dark:border-green-800 dark:bg-green-900/30 dark:text-green-400",warning:"border-amber-200 bg-amber-100 text-amber-800 dark:border-amber-800 dark:bg-amber-900/30 dark:text-amber-400",error:"border-red-200 bg-red-100 text-red-800 dark:border-red-800 dark:bg-red-900/30 dark:text-red-400",info:"border-blue-200 bg-blue-100 text-blue-800 dark:border-blue-800 dark:bg-blue-900/30 dark:text-blue-400",primary:"border-gray-200 bg-gray-100 text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300"}},defaultVariants:{intent:"primary"}}),o=(0,s.cva)("w-full rounded-md border bg-white text-gray-900 transition-colors placeholder:text-gray-400 focus:outline-none focus:ring-2 dark:bg-gray-900 dark:text-gray-100 dark:placeholder:text-gray-600",{variants:{state:{default:"border-gray-300 focus:border-blue-500 focus:ring-blue-500/20 dark:border-gray-600",error:"border-red-400 focus:border-red-500 focus:ring-red-500/20"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 py-2 text-sm",lg:"h-11 px-4 py-2.5 text-base"}},defaultVariants:{state:"default",size:"md"}}),c=(0,s.cva)("inline-flex items-center gap-1 font-medium [&_svg]:shrink-0",{variants:{size:{sm:"text-xs [&_svg]:h-3 [&_svg]:w-3",md:"text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"text-base [&_svg]:h-4 [&_svg]:w-4"},intent:{default:"text-primary-700 dark:text-primary-300",muted:"text-primary-400 dark:text-primary-500",required:"text-primary-700 dark:text-primary-300 after:ml-0.5 after:text-danger-500 after:content-['*']"}},defaultVariants:{size:"md",intent:"default"}}),d=(0,s.cva)("rounded-lg transition-shadow",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",elevated:"bg-white shadow-md hover:shadow-lg dark:bg-primary-900",outlined:"border-2 border-primary-300 bg-transparent dark:border-primary-600",ghost:"bg-primary-50 dark:bg-primary-800/50"},size:{sm:"p-3",md:"p-5",lg:"p-7"}},defaultVariants:{intent:"default",size:"md"}}),u=(0,s.cva)("rounded-md",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",inset:"bg-primary-50 dark:bg-primary-800/50",elevated:"bg-white shadow-lg dark:bg-primary-900"},size:{sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{intent:"default",size:"md"}}),m=(0,s.cva)("w-full text-left text-sm",{variants:{intent:{default:"",striped:"[&_tbody_tr:nth-child(even)]:bg-primary-50 dark:[&_tbody_tr:nth-child(even)]:bg-primary-800/30",bordered:"[&_th]:border [&_td]:border [&_th]:border-primary-200 [&_td]:border-primary-200 dark:[&_th]:border-primary-700 dark:[&_td]:border-primary-700"}},defaultVariants:{intent:"default"}}),x=(0,s.cva)("text-sm text-primary-700 dark:text-primary-300",{variants:{intent:{default:"space-y-1",bordered:"divide-y divide-primary-200 rounded-lg border border-primary-200 dark:divide-primary-700 dark:border-primary-700 [&>li]:px-4 [&>li]:py-2",hover:"[&>li]:rounded-md [&>li]:px-3 [&>li]:py-2 [&>li]:transition-colors [&>li:hover]:bg-primary-50 dark:[&>li:hover]:bg-primary-800/50"}},defaultVariants:{intent:"default"}}),p=(0,s.cva)("divide-y",{variants:{intent:{default:"divide-primary-300 dark:divide-primary-700",bordered:"divide-primary-300 rounded-lg border border-primary-300 bg-white px-3 shadow-sm dark:divide-primary-700 dark:border-primary-700 dark:bg-primary-800/50",ghost:"divide-transparent"}},defaultVariants:{intent:"default"}}),h=(0,s.cva)("flex",{variants:{intent:{line:"border-b border-primary-200 dark:border-primary-700",pills:"gap-1 rounded-lg bg-primary-100 p-1 dark:bg-primary-800",underline:"gap-4"}},defaultVariants:{intent:"line"}}),f=(0,s.cva)("inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",{variants:{intent:{line:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:data-[active=true]:text-primary-100",pills:"rounded-md text-primary-600 hover:text-primary-900 data-[active=true]:bg-white data-[active=true]:text-primary-900 data-[active=true]:shadow-sm dark:text-primary-400 dark:hover:text-primary-100 dark:data-[active=true]:bg-primary-700 dark:data-[active=true]:text-primary-100",underline:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:data-[active=true]:text-primary-100"}},defaultVariants:{intent:"line"}}),b=(0,s.cva)("rounded-lg bg-white p-6 shadow-xl dark:bg-primary-900",{variants:{size:{sm:"w-full max-w-sm",md:"w-full max-w-lg",lg:"w-full max-w-2xl",xl:"w-full max-w-4xl",full:"h-[calc(100vh-4rem)] w-[calc(100vw-4rem)]"}},defaultVariants:{size:"md"}}),g=(0,s.cva)("absolute z-50 rounded px-2 py-1 text-xs shadow-md animate-fade-in",{variants:{intent:{default:"bg-primary-900 text-white dark:bg-primary-100 dark:text-primary-900",light:"border border-primary-200 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-800 dark:text-primary-200"}},defaultVariants:{intent:"default"}}),v=(0,s.cva)("pointer-events-auto flex items-start gap-3 rounded-lg border p-4 shadow-lg transition-all",{variants:{intent:{success:"border-green-200 bg-green-50 text-green-800 dark:border-green-800 dark:bg-green-900/80 dark:text-green-200",warning:"border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-800 dark:bg-amber-900/80 dark:text-amber-200",error:"border-red-200 bg-red-50 text-red-800 dark:border-red-800 dark:bg-red-900/80 dark:text-red-200",info:"border-blue-200 bg-blue-50 text-blue-800 dark:border-blue-800 dark:bg-blue-900/80 dark:text-blue-200"}},defaultVariants:{intent:"info"}}),y=require("react/jsx-runtime"),w=require("react");var k=e.n(w);function j({intent:e,size:t,className:r,...a}){return(0,y.jsx)("button",{className:n(l({intent:e,size:t}),r),...a})}const N=require("lucide-react");function C(e,t){for(const r of e){if(r.value===t)return r;if(r.children){const e=C(r.children,t);if(e)return e}}}function S(e){const t=[];for(const r of e)r.children?.length||t.push(r),r.children&&t.push(...S(r.children));return t}function E({options:e,onSelect:t,depth:r=0}){const[a,s]=(0,w.useState)(null),l=(0,w.useRef)(void 0),i=()=>{l.current=setTimeout(()=>s(null),150)};return(0,w.useEffect)(()=>()=>{l.current&&clearTimeout(l.current)},[]),(0,y.jsx)("div",{className:n("absolute z-50 min-w-44 rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white","animate-fade-in",0===r?"mt-1 w-full":"top-0 ml-0.5"),style:r>0?{left:"100%"}:void 0,role:"listbox",children:e.map(e=>{const o=!!e.children?.length,c=a===e.value;return(0,y.jsxs)("div",{className:"relative",onMouseEnter:()=>{return t=e.value,l.current&&clearTimeout(l.current),void s(t);var t},onMouseLeave:i,children:[(0,y.jsxs)("div",{role:"option","aria-selected":!1,"aria-disabled":e.disabled,className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",e.disabled&&"pointer-events-none opacity-50"),onClick:()=>{e.disabled||o||t(e.value,e)},children:[e.icon&&(0,y.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:e.icon}),(0,y.jsx)("span",{className:"flex-1 truncate",children:e.label??e.value}),o&&(0,y.jsx)(N.ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),o&&c&&(0,y.jsx)(E,{options:e.children,onSelect:t,depth:r+1})]},e.value)})})}function L({options:e,filter:t,multiple:r,selected:a,canAdd:s,onSelect:l,onToggle:i,onAdd:o}){const c=(0,w.useMemo)(()=>S(e),[e]),d=t.toLowerCase(),u=t?c.filter(e=>(e.label??e.value).toLowerCase().includes(d)||e.value.toLowerCase().includes(d)):c;return(0,y.jsxs)("div",{className:n("absolute z-50 mt-1 w-full max-h-60 min-w-44 overflow-y-auto rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white","animate-fade-in"),role:"listbox","aria-multiselectable":r||void 0,children:[u.map(e=>{const t=r&&a.includes(e.value);return(0,y.jsxs)("div",{role:"option","aria-selected":!!r&&t,"aria-disabled":e.disabled,className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",e.disabled&&"pointer-events-none opacity-50"),onClick:()=>{e.disabled||(r?i(e.value):l(e.value,e))},children:[r&&(0,y.jsx)("span",{className:n("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",t?"border-blue-600 bg-blue-600 text-white dark:border-blue-500 dark:bg-blue-500":"border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800"),children:t&&(0,y.jsx)(N.Check,{className:"h-3 w-3"})}),e.icon&&(0,y.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:e.icon}),(0,y.jsx)("span",{className:"truncate",children:e.label??e.value})]},e.value)}),0===u.length&&!s&&(0,y.jsx)("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",children:"No matches"}),s&&(0,y.jsxs)("div",{className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-blue-600 hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-blue-900/30"),onClick:o,children:[(0,y.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),(0,y.jsxs)("span",{className:"truncate",children:["Add “",t.trim(),"”"]})]})]})}function M(e){const{options:t,placeholder:r="Select…",editable:a=!1,onAddItem:s,disabled:l=!1,align:i="left",className:c}=e,d=!0===e.multiple,u=d?e.selected??[]:[],[m,x]=(0,w.useState)(!1),[p,h]=(0,w.useState)(""),f=(0,w.useRef)(null),b=(0,w.useRef)(null),g=d?void 0:e.value,v=(0,w.useMemo)(()=>g?C(t,g):void 0,[t,g]);(0,w.useEffect)(()=>{if(!m)return;const e=e=>{f.current&&!f.current.contains(e.target)&&(x(!1),h(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[m]),(0,w.useEffect)(()=>{if(!m)return;const e=e=>{"Escape"===e.key&&(x(!1),h(""))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[m]);const k=(0,w.useCallback)((t,r)=>{d||e.onChange?.(t,r),x(!1),h("")},[d,e]),j=(0,w.useCallback)(t=>{if(!d)return;const r=u.includes(t)?u.filter(e=>e!==t):[...u,t];e.onSelectionChange?.(r)},[d,u,e]),M=p.toLowerCase(),T=(0,w.useMemo)(()=>!(!a||!p.trim())&&!S(t).some(e=>e.value.toLowerCase()===M||(e.label??e.value).toLowerCase()===M),[a,M,t]),z=(0,w.useCallback)(()=>{const e=p.trim();e&&(s?.(e),h(""))},[p,s]),_=(0,w.useCallback)(e=>{"Enter"===e.key&&T&&(e.preventDefault(),z())},[T,z]),D=(0,w.useCallback)(()=>{l||(x(e=>{const t=!e;return t&&a&&requestAnimationFrame(()=>b.current?.focus()),t}),h(""))},[l,a]);let A;if(d){const e=u.length;A=0===e?"":e<=2?u.map(e=>C(t,e)).map(e=>e?e.label??e.value:"").filter(Boolean).join(", "):`${e} selected`}else A=v?v.label??v.value:"";const F=d||a;return(0,y.jsxs)("div",{ref:f,className:n("relative inline-block min-w-44",c),children:[(0,y.jsxs)("div",{className:n(o({state:"default",size:"md"}),"flex cursor-pointer items-center gap-1",l&&"pointer-events-none opacity-50"),onClick:D,role:"combobox","aria-expanded":m,"aria-haspopup":"listbox",children:[a?(0,y.jsx)("input",{ref:b,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-gray-400 dark:placeholder:text-gray-600",value:m?p:A,placeholder:r,disabled:l,onChange:e=>{h(e.target.value),m||x(!0)},onKeyDown:_,onClick:e=>{e.stopPropagation(),m||x(!0)}}):(0,y.jsx)("span",{className:n("flex-1 truncate",!A&&"text-gray-400 dark:text-gray-600"),children:A||r}),v?.icon&&!a&&!d&&(0,y.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:v.icon}),d&&u.length>0&&(0,y.jsx)("span",{className:"rounded-full bg-blue-100 px-1.5 text-xs font-semibold text-blue-700 dark:bg-blue-900 dark:text-blue-300",children:u.length}),(0,y.jsx)(N.ChevronDown,{className:n("text-primary-400 h-4 w-4 shrink-0 transition-transform",m&&"rotate-180")})]}),m&&(0,y.jsx)("div",{className:n("right"===i?"right-0":"left-0","absolute w-full"),children:F?(0,y.jsx)(L,{options:t,filter:p,multiple:d,selected:u,canAdd:T,onSelect:k,onToggle:j,onAdd:z}):(0,y.jsx)(E,{options:t,onSelect:k})})]})}function T({label:e,items:t,intent:r,size:a,align:s="left",className:i,disabled:o,editable:c=!1,onAddItem:d,multiple:u=!1,selected:m=[],onSelectionChange:x,...p}){const[h,f]=(0,w.useState)(!1),[b,g]=(0,w.useState)(""),v=(0,w.useRef)(null),j=(0,w.useRef)(null),C=(0,w.useCallback)(()=>{o||f(e=>{const t=!e;return t&&c&&requestAnimationFrame(()=>j.current?.focus()),t||g(""),t})},[o,c]);(0,w.useEffect)(()=>{if(!h)return;const e=e=>{v.current&&!v.current.contains(e.target)&&(f(!1),g(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[h]),(0,w.useEffect)(()=>{if(!h)return;const e=e=>{"Escape"===e.key&&(f(!1),g(""))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[h]);const S=b.toLowerCase(),E=(0,w.useMemo)(()=>b?t.filter(e=>("string"==typeof e.label?e.label:e.key??"").toLowerCase().includes(S)):t,[t,S]),L=(0,w.useMemo)(()=>!(!c||!b.trim()||t.some(e=>("string"==typeof e.label?e.label:e.key??"").toLowerCase()===S)),[c,S,t]),M=(0,w.useCallback)(()=>{const e=b.trim();e&&(d?.(e),g(""))},[b,d]),T=(0,w.useCallback)(e=>{"Enter"===e.key&&L&&(e.preventDefault(),M())},[L,M]),z=(0,w.useCallback)(e=>{const t=m.includes(e)?m.filter(t=>t!==e):[...m,e];x?.(t)},[m,x]),_=u&&m.length>0?(0,y.jsxs)(y.Fragment,{children:[e," ",(0,y.jsx)("span",{className:"ml-1 rounded-full bg-white/20 px-1.5 text-xs font-semibold",children:m.length})]}):e;return(0,y.jsxs)("div",{ref:v,className:"relative inline-block",children:[(0,y.jsxs)("button",{type:"button",onClick:C,disabled:o,className:n(l({intent:r,size:a}),"inline-flex items-center gap-1",i),"aria-haspopup":u?"listbox":"true","aria-expanded":h?"true":"false",...p,children:[_,(0,y.jsx)(N.ChevronDown,{className:n("h-3.5 w-3.5 transition-transform",h&&"rotate-180")})]}),h&&(0,y.jsxs)("div",{className:n("absolute z-50 mt-1 min-w-44 rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white","animate-fade-in","right"===s?"right-0":"left-0"),role:u?"listbox":"menu","aria-multiselectable":u||void 0,children:[c&&(0,y.jsx)("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children:(0,y.jsx)("input",{ref:j,type:"text",value:b,onChange:e=>g(e.target.value),onKeyDown:T,placeholder:"Type to filter or add…",className:"w-full bg-transparent text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none dark:text-gray-100 dark:placeholder:text-gray-600"})}),(0,y.jsxs)("div",{className:"max-h-60 overflow-y-auto",children:[E.map((e,t)=>{const r=function(e,t){return e.key??("string"==typeof e.label?e.label:String(t))}(e,t),a=u&&m.includes(r);return(0,y.jsxs)(k().Fragment,{children:[e.divider&&(0,y.jsx)("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),(0,y.jsxs)("button",{type:"button",role:u?"option":"menuitem","aria-selected":u?a:void 0,disabled:e.disabled,className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",e.disabled&&"pointer-events-none opacity-50"),onClick:()=>{u?z(r):(e.onClick?.(),f(!1),g(""))},children:[u&&(0,y.jsx)("span",{className:n("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",a?"border-blue-600 bg-blue-600 text-white dark:border-blue-500 dark:bg-blue-500":"border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800"),children:a&&(0,y.jsx)(N.Check,{className:"h-3 w-3"})}),(0,y.jsx)("span",{className:"flex-1 truncate",children:e.label})]})]},r)}),0===E.length&&!L&&(0,y.jsx)("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",children:"No matches"}),L&&(0,y.jsxs)("button",{type:"button",className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-blue-600 hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-blue-900/30"),onClick:M,children:[(0,y.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),(0,y.jsxs)("span",{className:"truncate",children:["Add “",b.trim(),"”"]})]})]})]})]})}function z({intent:e,className:t,...r}){return(0,y.jsx)("span",{className:n(i({intent:e}),t),...r})}function _({intent:e,size:t,className:r,...a}){return(0,y.jsx)("label",{className:n(c({intent:e,size:t}),r),...a})}const D={sm:{wrapper:"h-7 text-xs",prefix:"px-2 text-xs [&_svg]:h-3 [&_svg]:w-3",input:"px-2 text-xs",icon:"px-1.5 [&_svg]:h-3 [&_svg]:w-3"},md:{wrapper:"h-9 text-sm",prefix:"px-3 text-sm [&_svg]:h-4 [&_svg]:w-4",input:"px-3 py-2 text-sm",icon:"px-2 [&_svg]:h-4 [&_svg]:w-4"},lg:{wrapper:"h-11 text-base",prefix:"px-4 text-base [&_svg]:h-5 [&_svg]:w-5",input:"px-4 py-2.5 text-base",icon:"px-2.5 [&_svg]:h-5 [&_svg]:w-5"}},A={default:"border-gray-300 focus-within:border-blue-500 focus-within:ring-2 focus-within:ring-blue-500/20 dark:border-gray-600",error:"border-red-400 focus-within:border-red-500 focus-within:ring-2 focus-within:ring-red-500/20"};function F({state:e="default",inputSize:t="md",className:r,prefix:a,suffix:s,action:l,...i}){if(!a&&!s&&!l)return(0,y.jsx)("input",{className:n(o({state:e,size:t}),r),...i});const c=D[t??"md"],d=A[e??"default"];return(0,y.jsxs)("div",{className:n("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-gray-900",c.wrapper,d,r),children:[a&&(0,y.jsx)("span",{className:n("flex shrink-0 items-center gap-1.5 self-stretch border-r border-gray-300 bg-gray-50 font-medium text-gray-600 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300",c.prefix),children:a}),(0,y.jsx)("input",{className:n("min-w-0 flex-1 bg-transparent text-gray-900 placeholder:text-gray-400 focus:outline-none dark:text-gray-100 dark:placeholder:text-gray-600",c.input,a&&"pl-2"),...i}),s&&(0,y.jsx)("span",{className:n("pointer-events-none flex shrink-0 items-center text-gray-400 dark:text-gray-500",c.icon),children:s}),l&&(0,y.jsx)("button",{type:"button",onClick:l.onClick,"aria-label":l["aria-label"]??"Action",className:n("flex shrink-0 items-center text-gray-500 transition-colors hover:text-blue-600 dark:text-gray-400 dark:hover:text-blue-400",c.icon),children:l.icon})]})}function P({intent:e,size:t,className:r,...a}){return(0,y.jsx)("div",{className:n(d({intent:e,size:t}),r),...a})}function I({className:e,...t}){return(0,y.jsx)("div",{className:n("mb-4 space-y-1",e),...t})}function R({className:e,...t}){return(0,y.jsx)("h3",{className:n("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function V({className:e,...t}){return(0,y.jsx)("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function $({className:e,...t}){return(0,y.jsx)("div",{className:n("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function O({className:e,...t}){return(0,y.jsx)("div",{className:n("border-primary-100 dark:border-primary-800 mt-4 flex items-center gap-2 border-t pt-4",e),...t})}function K({intent:e,media:t,mediaPosition:r="left",className:a,children:s,...l}){const i=(0,y.jsx)("div",{className:n("relative shrink-0 overflow-hidden","left"===r?"rounded-l-lg":"rounded-r-lg"),style:{width:t.width??"10rem"},children:t.src?(0,y.jsx)("img",{src:t.src,alt:t.alt??"",className:"h-full w-full object-cover",draggable:!1}):t.icon?(0,y.jsx)("div",{className:"bg-primary-100 text-primary-500 dark:bg-primary-800 dark:text-primary-400 flex h-full w-full items-center justify-center",children:t.icon}):null});return(0,y.jsxs)("div",{className:n(d({intent:e}),"flex overflow-hidden p-0","right"===r&&"flex-row-reverse",a),...l,children:[i,(0,y.jsx)("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:s})]})}function B({src:e,alt:t="",aspectRatio:r="16/9",className:a,children:s,...l}){return(0,y.jsxs)("div",{className:n("group overflow-hidden rounded-xl border transition-shadow duration-300","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white","dark:hover:shadow-primary-900/60 hover:shadow-lg",a),...l,children:[(0,y.jsxs)("div",{className:"relative overflow-hidden",style:{aspectRatio:r},children:[(0,y.jsx)("img",{src:e,alt:t,className:"h-full w-full object-cover transition-transform duration-500 ease-out group-hover:scale-110",draggable:!1}),(0,y.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100","aria-hidden":!0,children:(0,y.jsx)("div",{className:"animate-light-sweep absolute inset-0"})})]}),s]})}function X({className:e,...t}){return(0,y.jsx)("div",{className:n("space-y-2 p-4",e),...t})}function q({className:e,...t}){return(0,y.jsx)("h3",{className:n("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function H({className:e,...t}){return(0,y.jsx)("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function U({className:e,...t}){return(0,y.jsx)("div",{className:n("border-primary-100 dark:border-primary-800 flex items-center gap-2 border-t px-4 py-3",e),...t})}function G({intent:e,size:t,className:r,...a}){return(0,y.jsx)("div",{className:n(u({intent:e,size:t}),r),...a})}function Y({className:e,...t}){return(0,y.jsx)("div",{className:n("border-primary-200 text-primary-900 dark:border-primary-700 dark:text-primary-100 mb-3 flex items-center gap-1.5 border-b pb-3 text-sm font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function W({className:e,...t}){return(0,y.jsx)("div",{className:n("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function Z({intent:e,className:t,...r}){return(0,y.jsx)("div",{className:"w-full overflow-auto",children:(0,y.jsx)("table",{className:n(m({intent:e}),t),...r})})}function J({className:e,...t}){return(0,y.jsx)("thead",{className:n("bg-primary-50 text-primary-600 dark:bg-primary-800/50 dark:text-primary-400",e),...t})}function Q({className:e,...t}){return(0,y.jsx)("tbody",{className:n("[&_tr:last-child]:border-0",e),...t})}function ee({className:e,...t}){return(0,y.jsx)("tr",{className:n("border-primary-200 hover:bg-primary-50/50 dark:border-primary-700 dark:hover:bg-primary-800/30 border-b transition-colors",e),...t})}function te({className:e,...t}){return(0,y.jsx)("th",{className:n("px-4 py-3 text-left text-xs font-semibold tracking-wider uppercase",e),...t})}function re({className:e,...t}){return(0,y.jsx)("td",{className:n("text-primary-700 dark:text-primary-300 px-4 py-3",e),...t})}function ae({columns:e,data:t,sort:r,onSortChange:a,defaultSort:s=null,rowKey:l,intent:i,className:o}){const[c,d]=(0,w.useState)(s),u=r??c,m=(0,w.useCallback)(e=>{const t=u?.column===e?"asc"===u.direction?{column:e,direction:"desc"}:null:{column:e,direction:"asc"};a?a(t):d(t)},[u,a]),x=(0,w.useMemo)(()=>{if(!u)return t;const r=e.find(e=>e.key===u.column);if(!r)return t;const a=r.compareFn??((e,t)=>{const a=r.cell(e),n=r.cell(t);return null==a&&null==n?0:null==a?-1:null==n?1:"number"==typeof a&&"number"==typeof n?a-n:String(a).localeCompare(String(n))}),n=[...t].sort(a);return"desc"===u.direction?n.reverse():n},[t,u,e]);return(0,y.jsxs)(Z,{intent:i,className:o,children:[(0,y.jsx)(J,{children:(0,y.jsx)(ee,{children:e.map(e=>{const t=!1!==e.sortable,r=u?.column===e.key;return(0,y.jsx)(te,{className:n(t&&"cursor-pointer select-none",e.headerClassName),onClick:t?()=>m(e.key):void 0,"aria-sort":r?"asc"===u.direction?"ascending":"descending":void 0,children:(0,y.jsxs)("span",{className:"inline-flex items-center gap-1",children:[e.header,t&&(0,y.jsx)(le,{active:r,direction:r?u.direction:null})]})},e.key)})})}),(0,y.jsx)(Q,{children:x.map((t,r)=>(0,y.jsx)(ee,{children:e.map(e=>(0,y.jsx)(re,{className:e.cellClassName,children:e.cell(t)},e.key))},l?l(t,r):r))})]})}function ne({value:e,onCommit:t,onCancel:r}){const[a,n]=(0,w.useState)(e),s=(0,w.useRef)(null);(0,w.useEffect)(()=>{s.current?.focus(),s.current?.select()},[]);const l=()=>t(a);return(0,y.jsxs)("span",{className:"flex items-center gap-1",children:[(0,y.jsx)("input",{ref:s,type:"text",value:a,onChange:e=>n(e.target.value),onKeyDown:e=>{"Enter"===e.key&&l(),"Escape"===e.key&&r()},"aria-label":"Edit cell",className:"min-w-0 flex-1 rounded border border-blue-400 bg-white px-1.5 py-0.5 text-sm outline-none focus:ring-1 focus:ring-blue-400 dark:border-blue-600 dark:bg-gray-800"}),(0,y.jsx)("button",{type:"button",onClick:l,className:"text-green-600 hover:text-green-700 dark:text-green-400","aria-label":"Confirm",children:(0,y.jsx)(N.Check,{className:"h-3.5 w-3.5"})}),(0,y.jsx)("button",{type:"button",onClick:r,className:"text-red-500 hover:text-red-600 dark:text-red-400","aria-label":"Cancel",children:(0,y.jsx)(N.X,{className:"h-3.5 w-3.5"})})]})}function se({columns:e,data:t,rowKey:r,sort:a,onSortChange:s,defaultSort:l=null,selectionMode:i="none",selected:o,onSelectionChange:c,editable:d=!1,onCellEdit:u,toolbar:m=!1,onAdd:x,onDelete:p,intent:h,className:f}){const[b,g]=(0,w.useState)(l),v=a??b,k=(0,w.useCallback)(e=>{const t=v?.column===e?"asc"===v.direction?{column:e,direction:"desc"}:null:{column:e,direction:"asc"};s?s(t):g(t)},[v,s]),j=(0,w.useMemo)(()=>{if(!v)return t;const r=e.find(e=>e.key===v.column);if(!r)return t;const a=r.compareFn??((e,t)=>{const a=r.cell(e),n=r.cell(t);return null==a&&null==n?0:null==a?-1:null==n?1:"number"==typeof a&&"number"==typeof n?a-n:String(a).localeCompare(String(n))}),n=[...t].sort(a);return"desc"===v.direction?n.reverse():n},[t,v,e]),[C,S]=(0,w.useState)([]),E=o??C,L=c??S,M=(0,w.useMemo)(()=>j.map((e,t)=>r(e,t)),[j,r]),T="multiple"===i&&M.length>0&&M.every(e=>E.includes(e)),z="multiple"===i&&E.length>0&&!T,_=(0,w.useCallback)(e=>{"single"===i?L(E.includes(e)?[]:[e]):"multiple"===i&&L(E.includes(e)?E.filter(t=>t!==e):[...E,e])},[i,E,L]),D=(0,w.useCallback)(()=>{L(T?[]:M)},[T,M,L]),[A,F]=(0,w.useState)(null),P=(0,w.useCallback)((e,t,r)=>{d&&!1!==r&&F({rowKey:e,colKey:t})},[d]),I=(0,w.useCallback)((e,t,r)=>{u?.(e,t,r),F(null)},[u]),R=m;return(0,y.jsxs)("div",{className:"space-y-2",children:[R&&(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,y.jsxs)("button",{type:"button",onClick:x,className:"inline-flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700",children:[(0,y.jsx)(N.Plus,{className:"h-3.5 w-3.5"})," Add"]}),p&&(0,y.jsxs)("button",{type:"button",onClick:()=>p(E),disabled:0===E.length,className:"inline-flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm font-medium text-red-600 transition-colors hover:bg-red-50 disabled:opacity-40 disabled:pointer-events-none dark:border-gray-600 dark:bg-gray-800 dark:text-red-400 dark:hover:bg-red-900/20",children:[(0,y.jsx)(N.Trash2,{className:"h-3.5 w-3.5"})," Delete",E.length>0&&` (${E.length})`]}),d&&1===E.length&&(0,y.jsxs)("button",{type:"button",onClick:()=>{const t=e.find(e=>!1!==e.editable);t&&F({rowKey:E[0],colKey:t.key})},className:"inline-flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700",children:[(0,y.jsx)(N.Pencil,{className:"h-3.5 w-3.5"})," Edit"]}),E.length>0&&(0,y.jsxs)("span",{className:"ml-auto text-sm text-gray-500 dark:text-gray-400",children:[E.length," row",E.length>1?"s":""," selected"]})]}),(0,y.jsxs)(Z,{intent:h,className:f,children:[(0,y.jsx)(J,{children:(0,y.jsxs)(ee,{children:["multiple"===i&&(0,y.jsx)(te,{className:"w-10",children:(0,y.jsx)("input",{type:"checkbox",checked:T,ref:e=>{e&&(e.indeterminate=z)},onChange:D,className:"h-4 w-4 cursor-pointer rounded border-gray-300 accent-blue-600","aria-label":"Select all"})}),"single"===i&&(0,y.jsx)(te,{className:"w-10"}),e.map(e=>{const t=!1!==e.sortable,r=v?.column===e.key;return(0,y.jsx)(te,{className:n(t&&"cursor-pointer select-none",e.headerClassName),onClick:t?()=>k(e.key):void 0,"aria-sort":r?"asc"===v.direction?"ascending":"descending":void 0,children:(0,y.jsxs)("span",{className:"inline-flex items-center gap-1",children:[e.header,t&&(0,y.jsx)(le,{active:r,direction:r?v.direction:null})]})},e.key)})]})}),(0,y.jsx)(Q,{children:j.map((t,a)=>{const s=r(t,a),l=E.includes(s);return(0,y.jsxs)(ee,{className:n(l&&"bg-blue-50/60 dark:bg-blue-900/20"),onClick:()=>{"none"!==i&&_(s)},children:["multiple"===i&&(0,y.jsx)(re,{className:"w-10",children:(0,y.jsx)("input",{type:"checkbox",checked:l,onChange:()=>_(s),onClick:e=>e.stopPropagation(),className:"h-4 w-4 cursor-pointer rounded border-gray-300 accent-blue-600","aria-label":"Select row"})}),"single"===i&&(0,y.jsx)(re,{className:"w-10",children:(0,y.jsx)("input",{type:"radio",checked:l,onChange:()=>_(s),onClick:e=>e.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-blue-600","aria-label":"Select row"})}),e.map(e=>{const r=A?.rowKey===s&&A?.colKey===e.key,a=e.editValue?.(t)??(()=>{const r=e.cell(t);return"string"==typeof r||"number"==typeof r?String(r):""})();return(0,y.jsx)(re,{className:n(e.cellClassName,d&&!1!==e.editable&&"cursor-text"),onDoubleClick:t=>{t.stopPropagation(),P(s,e.key,e.editable)},children:r?(0,y.jsx)(ne,{value:a,onCommit:t=>I(s,e.key,t),onCancel:()=>F(null)}):e.cell(t)},e.key)})]},s)})})]})]})}function le({active:e,direction:t}){const r="h-3.5 w-3.5 shrink-0";return e&&t?"asc"===t?(0,y.jsx)(N.ArrowUp,{className:n(r,"opacity-70")}):(0,y.jsx)(N.ArrowDown,{className:n(r,"opacity-70")}):(0,y.jsx)(N.ArrowUpDown,{className:n(r,"opacity-30")})}function ie({intent:e,className:t,...r}){return(0,y.jsx)("ul",{className:n(x({intent:e}),t),...r})}function oe({className:e,...t}){return(0,y.jsx)("li",{className:n("flex items-center gap-1.5 [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",e),...t})}const ce=(0,w.createContext)({showLines:!0,expandedKeys:null,onToggleKey:()=>{}});function de({showLines:e=!0,showRoot:t=!0,expandedKeys:r,defaultExpandedKeys:a="all",onExpandedKeysChange:s,className:l,children:i,...o}){const[c,d]=(0,w.useState)(()=>a),u=(0,w.useCallback)(e=>{if(r){const t=new Set(r);t.has(e)?t.delete(e):t.add(e),s?.(t)}else d(t=>{if("all"===t)return new Set(["__ALL_MINUS__",e]);const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[r,s]),m=r??("all"===c?null:c);return(0,y.jsx)(ce.Provider,{value:{showLines:e,expandedKeys:m,onToggleKey:u},children:t?(0,y.jsx)("ul",{className:n("text-sm",l),role:"tree",...o,children:i}):(0,y.jsx)("ul",{className:n("text-sm",l),role:"tree",...o,children:(0,y.jsx)(ue,{children:i})})})}function ue({children:e}){const t=me(e);return(0,y.jsx)(y.Fragment,{children:t.map(e=>k().isValidElement(e)&&e.props.children?e.props.children:null)})}function me(e){const t=[];return k().Children.forEach(e,e=>{k().isValidElement(e)&&e.type===k().Fragment?t.push(...me(e.props.children)):t.push(e)}),t}function xe({nodeKey:e,label:t,icon:r,defaultExpanded:a=!1,expanded:s,onToggle:l,children:i,className:o}){const{showLines:c,expandedKeys:d,onToggleKey:u}=(0,w.useContext)(ce),[m,x]=(0,w.useState)(a),p=k().Children.count(i)>0,h=e??("string"==typeof t?t:"");let f;return f=null!=s?s:null!=d&&h?d.has("__ALL_MINUS__")?!d.has(h):d.has(h):m,(0,y.jsxs)("li",{className:n("select-none",o),role:"treeitem","aria-expanded":p?f:void 0,children:[(0,y.jsxs)("div",{className:n("hover:bg-primary-50 dark:hover:bg-primary-800/50 flex items-center gap-1 rounded-md px-1 py-1",p?"cursor-pointer":"cursor-default"),onClick:p?()=>{const e=!f;l?l(e):null!=d&&h?u(h):x(e)}:void 0,children:[p?(0,y.jsx)(N.ChevronRight,{className:n("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",f&&"rotate-90")}):(0,y.jsx)("span",{className:"w-4 shrink-0"}),r&&(0,y.jsx)("span",{className:"shrink-0",children:r}),(0,y.jsx)("span",{className:"text-primary-700 dark:text-primary-300 truncate",children:t})]}),p&&(0,y.jsx)("div",{className:n("grid transition-[grid-template-rows] duration-200 ease-out",f?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:(0,y.jsx)("div",{className:"overflow-hidden",children:(0,y.jsx)("ul",{className:n("ml-4 pl-2",c&&"border-primary-200 dark:border-primary-700 border-l"),role:"group",children:i})})})]})}function pe({avatar:e,sender:t}){return e?"string"==typeof e?/^(?:https?|data|blob):/.test(e)?(0,y.jsx)("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:!1}):(0,y.jsx)("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):(0,y.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):(0,y.jsx)("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function he({msg:e,alignRight:t}){return(0,y.jsxs)("div",{className:n("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[(0,y.jsx)(pe,{avatar:e.avatar,sender:e.sender}),(0,y.jsxs)("div",{className:n("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[(0,y.jsx)("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),(0,y.jsx)("div",{className:n("rounded-xl px-3 py-2 text-sm leading-relaxed",t?"rounded-tr-sm bg-blue-500 text-white dark:bg-blue-600":"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-200 rounded-tl-sm"),children:e.content}),e.time&&(0,y.jsx)("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function fe({messages:e,mode:t="split",autoScroll:r=!0,className:a,...s}){const l=(0,w.useRef)(null);return(0,w.useEffect)(()=>{r&&l.current?.scrollIntoView({behavior:"smooth"})},[e,r]),(0,y.jsxs)("div",{className:n("flex flex-col gap-4 overflow-y-auto rounded-lg border p-4","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white",a),...s,children:[e.map(e=>{const r="split"===t&&!!e.self;return(0,y.jsx)(he,{msg:e,alignRight:r},e.id)}),(0,y.jsx)("div",{ref:l})]})}const be=require("react-dom"),ge="flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors cursor-pointer",ve="bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100 font-medium",ye="text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200",we="flex items-center justify-center rounded-md p-2 transition-colors cursor-pointer text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200";function ke({to:e,className:t,style:r,children:a}){const n="function"==typeof t?t({isActive:!1}):t;return(0,y.jsx)("a",{href:e,className:n,style:r,children:a})}const je=["expanded","icons","mini"];function Ne(e){const t=new Set;for(const r of e)if(r.children&&r.children.length>0){t.add(r.key??r.label);for(const e of Ne(r.children))t.add(e)}return t}function Ce({item:e,basePath:t,depth:r,onItemClick:a,LinkComponent:s,showLines:l,expandedKeys:i,onToggle:o}){const c=e.key??e.label,d=e.children&&e.children.length>0,[u,m]=(0,w.useState)(e.defaultOpen??!0),x=i?i.has(c):u,p=(0,w.useCallback)(()=>{i?o(c):m(e=>!e)},[i,o,c]),h=r>0?1.25*r+"rem":void 0;if(d)return(0,y.jsxs)("div",{children:[(0,y.jsxs)("button",{type:"button",onClick:p,className:n(ge,ye,"justify-between"),style:{paddingLeft:h},children:[(0,y.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),(0,y.jsx)(N.ChevronRight,{className:n("h-3.5 w-3.5 transition-transform",x&&"rotate-90")})]}),x&&(0,y.jsx)("div",{className:n("flex flex-col gap-0.5 pt-0.5",l?"ml-2.5 border-l border-primary-200 dark:border-primary-700":"ml-2"),children:e.children.map(e=>(0,y.jsx)(Ce,{item:e,basePath:t,depth:r+1,onItemClick:a,LinkComponent:s,showLines:l,expandedKeys:i,onToggle:o},e.key??e.path??e.label))})]});if(null!=e.path){const r=t+e.path;return a?(0,y.jsxs)("button",{type:"button",onClick:()=>a(e,r),className:n(ge,ye),style:{paddingLeft:h},children:[e.icon,e.label]}):(0,y.jsxs)(s,{to:r,className:({isActive:e})=>n(ge,e?ve:ye),style:{paddingLeft:h},children:[e.icon,e.label]})}return(0,y.jsxs)("span",{className:n(ge,ye,"cursor-default"),style:{paddingLeft:h},children:[e.icon,e.label]})}function Se({item:e,basePath:t,onItemClick:r,LinkComponent:a}){const[s,l]=(0,w.useState)(!1),i=(0,w.useRef)(null),o=(0,w.useRef)(void 0),[c,d]=(0,w.useState)({top:0,left:0}),u=()=>{clearTimeout(o.current),l(!0)},m=()=>{o.current=setTimeout(()=>l(!1),200)};(0,w.useLayoutEffect)(()=>{if(s&&i.current){const e=i.current.getBoundingClientRect();d({top:e.top,left:e.right+4})}},[s]);const x=e.icon||(0,y.jsx)("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return(0,y.jsxs)("div",{onMouseEnter:u,onMouseLeave:m,children:[(0,y.jsx)("button",{ref:i,type:"button",className:n(we,"w-full"),title:e.label,onClick:()=>l(e=>!e),children:x}),s&&(0,be.createPortal)((0,y.jsxs)("div",{className:"fixed z-50 min-w-44 rounded-md border border-primary-200 bg-white p-1 shadow-lg dark:border-primary-700 dark:bg-primary-900",style:{top:c.top,left:c.left},onMouseEnter:u,onMouseLeave:m,children:[(0,y.jsx)("div",{className:"px-2.5 py-1.5 text-xs font-semibold uppercase text-primary-500 dark:text-primary-400",children:e.label}),(0,y.jsx)("div",{className:"flex flex-col gap-0.5",children:e.children?.map(e=>{const s=e.key??e.path??e.label;if(null!=e.path){const i=t+e.path;return r?(0,y.jsxs)("button",{type:"button",onClick:()=>{r(e,i),l(!1)},className:n(ge,ye),children:[e.icon,e.label]},s):(0,y.jsxs)(a,{to:i,className:({isActive:e})=>n(ge,e?ve:ye),children:[e.icon,e.label]},s)}return(0,y.jsxs)("span",{className:n(ge,"cursor-default text-primary-400"),children:[e.icon,e.label]},s)})})]}),document.body)]})}function Ee({item:e,basePath:t,onItemClick:r,LinkComponent:a}){const s=e.icon||(0,y.jsx)("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});if(null!=e.path){const l=t+e.path;return r?(0,y.jsx)("button",{type:"button",onClick:()=>r(e,l),className:n(we,"w-full"),title:e.label,children:s}):(0,y.jsx)(a,{to:l,className:({isActive:e})=>n(we,"w-full",e&&"bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100"),children:(0,y.jsx)("span",{title:e.label,children:s})})}return(0,y.jsx)("span",{className:n(we,"w-full cursor-default"),title:e.label,children:s})}function Le({items:e,title:t,basePath:r="/",onItemClick:a,LinkComponent:s=ke,collapsible:l,collapseMode:i,defaultCollapseMode:o="expanded",onCollapseModeChange:c,showLines:d=!0,expandedKeys:u,defaultExpandedKeys:m="all",onExpandedKeysChange:x,className:p,...h}){const[f,b]=(0,w.useState)(o),g=i??f,v=k().useMemo(()=>Ne(e),[e]),[j,C]=(0,w.useState)(()=>"all"===m?new Set(v):new Set(m)),S=u??null,E=S??j,L=(0,w.useCallback)(e=>{const t=new Set(E);t.has(e)?t.delete(e):t.add(e),C(t),x?.(t)},[E,x]),M=(0,w.useCallback)(()=>{const e=function(e){const t=je.indexOf(e);return je[(t+1)%je.length]}(g);b(e),c?.(e)},[g,c]);return(0,y.jsxs)("nav",{className:n("flex flex-col gap-0.5","mini"===g&&"items-center",p),...h,children:[l&&(0,y.jsx)("div",{className:n("flex shrink-0 mb-1","expanded"===g?"justify-end":"justify-center"),children:(0,y.jsx)("button",{type:"button",onClick:M,className:we,"aria-label":"mini"===g?"Expand sidebar":"Collapse sidebar",title:"mini"===g?"Expand sidebar":"Collapse sidebar",children:"mini"===g?(0,y.jsx)(N.Menu,{className:"h-5 w-5"}):(0,y.jsx)(N.ChevronsLeft,{className:"h-4 w-4"})})}),"expanded"===g&&(0,y.jsxs)(y.Fragment,{children:[t&&(0,y.jsx)("h2",{className:"text-primary-500 dark:text-primary-400 mb-3 text-sm font-semibold uppercase",children:t}),e.map(e=>(0,y.jsx)(Ce,{item:e,basePath:r,depth:0,onItemClick:a,LinkComponent:s,showLines:d,expandedKeys:S,onToggle:L},e.key??e.path??e.label))]}),"icons"===g&&e.map(e=>{const t=e.key??e.path??e.label;return e.children&&e.children.length>0?(0,y.jsx)(Se,{item:e,basePath:r,onItemClick:a,LinkComponent:s},t):(0,y.jsx)(Ee,{item:e,basePath:r,onItemClick:a,LinkComponent:s},t)})]})}function Me({href:e,className:t,onClick:r,children:a}){return(0,y.jsx)("a",{href:e,className:t,onClick:r,children:a})}function Te({brand:e,onBrandClick:t,navItems:r=[],actions:a=[],linkComponent:s=Me,height:l="h-12",className:i,children:o}){return(0,y.jsxs)("header",{className:n("flex shrink-0 items-center justify-between border-b px-5","border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",l,i),children:[(0,y.jsxs)("div",{className:"flex items-center gap-6",children:[e&&(0,y.jsx)("div",{className:n("text-lg font-bold text-primary-800 dark:text-primary-100",t&&"cursor-pointer"),onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,onKeyDown:t?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t(e))}:void 0,children:e}),r.length>0&&(0,y.jsx)("nav",{className:"flex items-center gap-4 text-sm",children:r.map((e,t)=>{const r="string"==typeof e.label?e.label:t,a=e.active?"text-primary-900 font-medium dark:text-primary-100":"text-primary-500 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-200 transition-colors";return e.href?(0,y.jsx)(s,{href:e.href,className:a,onClick:e.onClick,children:e.label},r):(0,y.jsx)("button",{type:"button",className:n(a,"cursor-pointer"),onClick:e.onClick,children:e.label},r)})})]}),o&&(0,y.jsx)("div",{className:"flex items-center",children:o}),a.length>0&&(0,y.jsx)("div",{className:"flex items-center gap-1",children:a.map((e,t)=>{const r="rounded-md p-1.5 text-primary-500 hover:bg-primary-100 hover:text-primary-700 dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-200 transition-colors [&_svg]:h-5 [&_svg]:w-5";return e.href?(0,y.jsx)("a",{href:e.href,target:e.external?"_blank":void 0,rel:e.external?"noopener noreferrer":void 0,className:r,"aria-label":e["aria-label"],onClick:e.onClick,children:e.icon},e.key??t):(0,y.jsx)("button",{type:"button",className:r,"aria-label":e["aria-label"],onClick:e.onClick,children:e.icon},e.key??t)})})]})}const ze=(0,w.createContext)(null),_e=(0,w.createContext)(null);function De({type:e="single",defaultValue:t=[],value:r,onValueChange:a,intent:s,className:l,children:i,...o}){const[c,d]=(0,w.useState)(t),u=r??c,m=(0,w.useCallback)(t=>{const r=r=>r.includes(t)?r.filter(e=>e!==t):"single"===e?[t]:[...r,t];a?a(r(u)):d(r)},[e,u,a]);return(0,y.jsx)(ze.Provider,{value:{expandedItems:u,toggleItem:m},children:(0,y.jsx)("div",{className:n(p({intent:s}),l),...o,children:i})})}function Ae({value:e,className:t,children:r,...a}){const s=(0,w.useContext)(ze),l=s?.expandedItems.includes(e)??!1;return(0,y.jsx)(_e.Provider,{value:{value:e,isExpanded:l},children:(0,y.jsx)("div",{className:n("",t),...a,children:r})})}function Fe({className:e,children:t,...r}){const a=(0,w.useContext)(ze),s=(0,w.useContext)(_e);return(0,y.jsxs)("button",{className:n("text-primary-800 hover:text-primary-600 dark:text-primary-100 dark:hover:text-primary-300 flex w-full cursor-pointer items-center justify-between gap-2 py-3 text-sm font-medium transition-colors [&>svg]:shrink-0",e),onClick:()=>s&&a?.toggleItem(s.value),"aria-expanded":s?.isExpanded?"true":"false",...r,children:[(0,y.jsx)("span",{className:"flex items-center gap-1.5 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:t}),(0,y.jsx)(N.ChevronDown,{className:n("h-4 w-4 shrink-0 transition-transform duration-200",s?.isExpanded&&"rotate-180")})]})}function Pe({className:e,children:t,...r}){const a=(0,w.useContext)(_e);return(0,y.jsx)("div",{className:n("grid transition-[grid-template-rows] duration-200 ease-out",a?.isExpanded?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:(0,y.jsx)("div",{className:"overflow-hidden",children:(0,y.jsx)("div",{className:n("text-primary-500 dark:text-primary-400 pb-3 text-sm",e),...r,children:t})})})}const Ie=(0,w.createContext)(null),Re=(0,w.createContext)(!1);function Ve({defaultValue:e="",value:t,onValueChange:r,intent:a,children:n,className:s}){const[l,i]=(0,w.useState)(e),o=t??l,c=(0,w.useRef)(new Map),d=(0,w.useCallback)(e=>{r?r(e):i(e)},[r]),u=(0,w.useCallback)((e,t)=>{t?c.current.set(e,t):c.current.delete(e)},[]);return(0,y.jsx)(Ie.Provider,{value:{activeValue:o,setActiveValue:d,intent:a,registerTrigger:u},children:(0,y.jsx)("div",{className:s,children:n})})}function $e({className:e,...t}){const r=(0,w.useContext)(Ie),a=(0,w.useRef)(null),[s,l]=(0,w.useState)(null),i=(0,w.useCallback)(()=>{if(!r||!a.current)return;const e=a.current.querySelectorAll('[role="tab"][data-active="true"]')[0];if(!e)return void l(null);const t=a.current.getBoundingClientRect(),n=e.getBoundingClientRect();l({left:n.left-t.left,width:n.width})},[r]);(0,w.useLayoutEffect)(i,[r?.activeValue,i]),(0,w.useEffect)(()=>{const e=new ResizeObserver(i);return a.current&&e.observe(a.current),()=>e.disconnect()},[i]);const o=r?.intent??"line",c=s&&("line"===o||"underline"===o);return(0,y.jsxs)("div",{ref:a,className:n(h({intent:r?.intent}),"relative",e),role:"tablist",...t,children:[t.children,c&&(0,y.jsx)("span",{className:"absolute bottom-0 h-0.5 rounded-full bg-primary-600 dark:bg-primary-400 transition-all duration-300 ease-in-out",style:{left:s.left,width:s.width},"aria-hidden":!0})]})}function Oe({value:e,className:t,children:r,...a}){const s=(0,w.useContext)(Ie),l=s?.activeValue===e,i=(0,w.useCallback)(t=>s?.registerTrigger(e,t),[s,e]);return(0,y.jsx)("button",{ref:i,className:n(f({intent:s?.intent}),t),role:"tab","data-active":l,"aria-selected":l,onClick:()=>s?.setActiveValue(e),...a,children:r})}function Ke({className:e,children:t,...r}){const a=(0,w.useContext)(Ie);if(!a)return null;const s=k().Children.toArray(t).filter(e=>k().isValidElement(e)),l=Math.max(0,s.findIndex(e=>e.props.value===a.activeValue));return(0,y.jsx)("div",{className:n("overflow-hidden",e),...r,children:(0,y.jsx)(Re.Provider,{value:!0,children:(0,y.jsx)("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${100*l}%)`},children:s.map((e,t)=>(0,y.jsx)("div",{className:"w-full shrink-0","aria-hidden":t!==l,children:e},e.props.value??t))})})})}function Be({value:e,className:t,children:r,...a}){const s=(0,w.useContext)(Ie);return(0,w.useContext)(Re)?(0,y.jsx)("div",{className:n("pt-4",t),role:"tabpanel",...a,children:r}):s?.activeValue!==e?null:(0,y.jsx)("div",{className:n("pt-4",t),role:"tabpanel",...a,children:r})}const Xe=[];function qe(e){return Xe.length>0&&Xe[Xe.length-1]===e}const He=(0,w.createContext)(null);function Ue({open:e,onOpenChange:t,modal:r=!0,closeOnOutsideClick:a=!1,children:n}){const s=(0,w.useId)();return(0,w.useEffect)(()=>{if(e)return function(e){Xe.push(e)}(s),()=>function(e){const t=Xe.indexOf(e);-1!==t&&Xe.splice(t,1)}(s)},[e,s]),(0,w.useEffect)(()=>{if(!e||!r)return;const a=e=>{"Escape"===e.key&&qe(s)&&t(!1)};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,r,t,s]),(0,w.useEffect)(()=>{if(!e||!r)return;const t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=t}},[e,r]),e?(0,y.jsx)(He.Provider,{value:{id:s,onOpenChange:t,modal:r,closeOnOutsideClick:a},children:(0,be.createPortal)(n,document.body)}):null}function Ge({size:e,className:t,children:r,...a}){const s=(0,w.useContext)(He);if(!s)return null;const l=200+10*function(e){const t=Xe.indexOf(e);return-1!==t?t:Xe.length}(s.id);return s.modal?(0,y.jsx)("div",{className:"animate-fade-in fixed inset-0 flex items-center justify-center bg-black/50 p-4",style:{zIndex:l},onClick:()=>{s.closeOnOutsideClick&&qe(s.id)&&s.onOpenChange(!1)},children:(0,y.jsx)("div",{className:n(b({size:e}),"animate-scale-in",t),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation(),...a,children:r})}):(0,y.jsx)("div",{className:n("fixed inset-0 flex items-center justify-center p-4",s.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:l},onClick:s.closeOnOutsideClick&&qe(s.id)?()=>s.onOpenChange(!1):void 0,children:(0,y.jsx)("div",{className:n(b({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",t),role:"dialog",onClick:s.closeOnOutsideClick?e=>e.stopPropagation():void 0,...a,children:r})})}function Ye({className:e,...t}){return(0,y.jsx)("div",{className:n("mb-4 space-y-1",e),...t})}function We({className:e,...t}){return(0,y.jsx)("h2",{className:n("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",e),...t})}function Ze({className:e,...t}){return(0,y.jsx)("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Je({className:e,...t}){return(0,y.jsx)("div",{className:n("mt-6 flex justify-end gap-2",e),...t})}function Qe({className:e,...t}){const r=(0,w.useContext)(He);return(0,y.jsx)("button",{className:n("text-primary-400 hover:text-primary-600 dark:hover:text-primary-200 absolute top-4 right-4 rounded-md p-1 transition-colors",e),onClick:()=>r?.onOpenChange(!1),"aria-label":"Close",...t,children:(0,y.jsx)(N.X,{className:"h-4 w-4"})})}const et={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};function tt({content:e,position:t="top",intent:r,delay:a=200,children:s,className:l}){const[i,o]=(0,w.useState)(!1),[c,d]=(0,w.useState)();return(0,y.jsxs)("span",{className:"relative inline-flex",onMouseEnter:()=>{const e=setTimeout(()=>o(!0),a);d(e)},onMouseLeave:()=>{clearTimeout(c),o(!1)},children:[s,i&&(0,y.jsx)("span",{className:n(g({intent:r}),et[t],"pointer-events-none whitespace-nowrap",l),role:"tooltip",children:e})]})}const rt=require("react-dom/client");function at({intent:e,className:t,children:r,...a}){return(0,y.jsx)("div",{className:n(v({intent:e}),t),role:"alert",...a,children:r})}function nt({className:e,...t}){return(0,y.jsx)("h5",{className:n("flex items-center gap-1.5 font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function st({className:e,...t}){return(0,y.jsx)("p",{className:n("text-sm opacity-90",e),...t})}let lt=0,it=[];const ot=new Map,ct=new Set;function dt(){return it}function ut(){ct.forEach(e=>e())}function mt(e){const t=ot.get(e);t&&(clearTimeout(t),ot.delete(e)),it=it.map(t=>t.id===e?{...t,exiting:!0}:t),ut(),setTimeout(()=>{it=it.filter(t=>t.id!==e),ut()},200)}function xt(e){const t="alert-"+ ++lt;it=[...it,{...e,id:t}],ut();const r=e.duration??5e3;if(r>0){const e=setTimeout(()=>{ot.delete(t),mt(t)},r);ot.set(t,e)}return t}let pt=16;function ht(e){pt=e}const ft={"top-right":"right-4 items-end","top-left":"left-4 items-start","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","top-center":"left-1/2 -translate-x-1/2 items-center","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},bt={"top-right":"animate-slide-in-right","top-left":"animate-slide-in-left","bottom-right":"animate-slide-in-right","bottom-left":"animate-slide-in-left","top-center":"animate-slide-in-top","bottom-center":"animate-slide-in-bottom"},gt={success:N.CircleCheck,warning:N.TriangleAlert,error:N.CircleX,info:N.Info};function vt({alert:e,onClose:t}){const r=e.intent??"info",a=gt[r],s=e.position??"top-right";return(0,y.jsxs)("div",{className:n(v({intent:r}),bt[s],e.exiting&&"opacity-0 transition-opacity duration-200","w-80"),role:"alert",children:[(0,y.jsx)(a,{className:"mt-0.5 h-5 w-5 shrink-0"}),(0,y.jsxs)("div",{className:"flex-1",children:[e.title&&(0,y.jsx)("p",{className:"font-semibold",children:e.title}),(0,y.jsx)("p",{className:n(e.title&&"text-sm opacity-90"),children:e.message})]}),(0,y.jsx)("button",{onClick:t,"aria-label":"Close notification",className:"shrink-0 cursor-pointer opacity-50 transition-opacity hover:opacity-100",children:(0,y.jsx)(N.X,{className:"h-4 w-4"})})]})}const yt=e=>e.startsWith("top");function wt(){const e=(0,w.useSyncExternalStore)(e=>(ct.add(e),()=>ct.delete(e)),dt),t=(0,w.useRef)(pt);if((0,w.useEffect)(()=>{t.current=pt},[]),0===e.length)return null;const r=e.reduce((e,t)=>{const r=t.position??"top-right";return(e[r]??(e[r]=[])).push(t),e},{});return(0,be.createPortal)((0,y.jsx)(y.Fragment,{children:Object.entries(r).map(([e,r])=>(0,y.jsx)("div",{style:yt(e)?{top:`${t.current}px`}:void 0,className:n("pointer-events-none fixed z-100 flex flex-col gap-2",ft[e]),children:r.map(e=>(0,y.jsx)(vt,{alert:e,onClose:()=>mt(e.id)},e.id))},e))}),document.body)}let kt=!1;function jt(){return(0,w.useEffect)(()=>{!function(){if(kt)return;kt=!0;const e=document.createElement("div");e.id="alert-toast-root",document.body.appendChild(e),(0,rt.createRoot)(e).render((0,y.jsx)(wt,{}))}()},[]),{addAlert:xt,removeAlert:mt}}const Nt="#1c1914",Ct="#130f0b",St="#2e261e",Et="#504638",Lt="#6b5d4d",Mt="url(\"data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",Tt=[{key:"like",icon:(0,y.jsx)(N.Heart,{className:"h-5 w-5"}),activeIcon:(0,y.jsx)(N.Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:!0},{key:"dislike",icon:(0,y.jsx)(N.ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:(0,y.jsx)(N.Bookmark,{className:"h-5 w-5"}),activeIcon:(0,y.jsx)(N.Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:!0},{key:"share",icon:(0,y.jsx)(N.Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:(0,y.jsx)(N.Download,{className:"h-5 w-5"}),label:"Download"}];function zt({photos:e,layout:t="strip",actions:r=Tt,onAction:a,className:n,showGrain:s=!0,sheetTitle:l,sheetLabel:i}){const[o,c]=(0,w.useState)(null),[d,u]=(0,w.useState)(new Set),m=(0,w.useCallback)(e=>c(e),[]),x=(0,w.useCallback)(()=>c(null),[]),p=(0,w.useCallback)((t,n)=>{const s=r.find(e=>e.key===t);if(s?.toggle){const e=`${n}-${t}`;u(t=>{const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})}a?.(t,e[n],n)},[r,a,e]),h="strip"===t?Dt:"sheet"===t?At:Ft;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(h,{photos:e,onPhotoClick:m,showGrain:s,className:n,sheetTitle:l,sheetLabel:i}),null!==o&&(0,be.createPortal)((0,y.jsx)(Pt,{photos:e,currentIndex:o,onIndexChange:c,onClose:x,actions:r,activeActions:d,onAction:p,showGrain:s}),document.body)]})}function _t({count:e=30}){return(0,y.jsx)("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Nt},children:Array.from({length:e}).map((e,t)=>(0,y.jsx)("div",{className:"rounded-xs",style:{width:12,height:8,background:St}},t))})}function Dt({photos:e,onPhotoClick:t,showGrain:r,className:a}){const s=(0,w.useRef)(null);return(0,y.jsxs)("div",{className:n("select-none rounded-lg overflow-hidden",a),style:{background:Ct},children:[(0,y.jsx)(_t,{count:Math.max(30,6*e.length)}),(0,y.jsx)("div",{ref:s,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:Nt,scrollSnapType:"x mandatory"},children:e.map((e,a)=>(0,y.jsxs)("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(a),children:[(0,y.jsxs)("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:Et,width:280,height:187},children:[(0,y.jsx)("img",{src:e.src,alt:e.alt??e.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:!1}),(0,y.jsx)("div",{className:"pointer-events-none absolute inset-0 mix-blend-multiply opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"rgba(255, 175, 60, 0.06)"}}),r&&(0,y.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:Mt,animation:"film-grain-shift 0.6s steps(5) infinite"}}),(0,y.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-30 transition-opacity duration-300 group-hover:opacity-50",style:{background:"radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%)"}})]}),(0,y.jsxs)("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:Lt},children:[String(a+1).padStart(2,"0"),a%2==0?"":"A"]})]},a))}),(0,y.jsx)(_t,{count:Math.max(30,6*e.length)})]})}function At({photos:e,onPhotoClick:t,showGrain:r,className:a,sheetTitle:s,sheetLabel:l}){return(0,y.jsxs)("div",{className:n("rounded-lg p-5",a),style:{background:Ct},children:[(0,y.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,y.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:Lt},children:s??`JAC·Film 35mm · ${e.length} exposures`}),(0,y.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:Lt},children:l??"Contact Sheet"})]}),(0,y.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((e,a)=>(0,y.jsxs)("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${50*a}ms both`},onClick:()=>t(a),children:[(0,y.jsx)("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:Lt},children:String(a+1).padStart(2,"0")}),(0,y.jsxs)("div",{className:"relative overflow-hidden rounded-[1px] border transition-all duration-300 group-hover:border-amber-600/50 group-hover:shadow-[0_0_20px_rgba(217,171,89,0.15)]",style:{borderColor:Et,aspectRatio:"3/2"},children:[(0,y.jsx)("img",{src:e.src,alt:e.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:!1}),r&&(0,y.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Mt}}),(0,y.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 translate-y-full bg-linear-to-t from-black/70 to-transparent p-2 pt-6 transition-transform duration-300 group-hover:translate-y-0",children:(0,y.jsx)("span",{className:"text-xs font-medium text-white/90",children:e.title})})]})]},a))})]})}function Ft({photos:e,onPhotoClick:t,showGrain:r,className:a}){const[s,l]=(0,w.useState)(!1),[i,o]=(0,w.useState)(null),c=Math.min(e.length,8),d=e.slice(0,c),u=e=>{const t=1e4*Math.sin(137.508*e+1);return`rotate(${(t%12-6).toFixed(1)}deg) translate(${(t/7%8-4).toFixed(1)}px, ${(t/13%6-3).toFixed(1)}px)`},m=(e,t)=>{const r=(t-1)/2,a=(7*(e-r)).toFixed(1);return`translateX(${(110*(e-r)).toFixed(0)}px) translateY(${(10*-Math.abs(e-r)+(i===e?-18:0)).toFixed(0)}px) rotate(${a}deg)`};return(0,y.jsxs)("div",{className:n("flex flex-col items-center gap-4",a),children:[(0,y.jsx)("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>l(!0),onMouseLeave:()=>{l(!1),o(null)},children:d.map((e,a)=>(0,y.jsx)("div",{className:"absolute cursor-pointer rounded-lg shadow-xl transition-all duration-500",style:{transitionTimingFunction:"cubic-bezier(0.34, 1.56, 0.64, 1)",transitionDelay:s?35*a+"ms":25*(c-a)+"ms",transform:s?m(a,d.length):u(a),zIndex:s?a+1:d.length-a,width:220,height:147},onClick:()=>t(a),onMouseEnter:()=>s&&o(a),onMouseLeave:()=>o(null),children:(0,y.jsxs)("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:s&&i===a?"rgba(217,171,89,0.5)":Et,boxShadow:s&&i===a?"0 25px 50px rgba(0,0,0,0.5), 0 0 30px rgba(217,171,89,0.1)":"0 10px 30px rgba(0,0,0,0.4)"},children:[(0,y.jsx)("img",{src:e.src,alt:e.alt??"",className:"h-full w-full object-cover",draggable:!1}),r&&(0,y.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Mt}}),(0,y.jsx)("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%)"}}),s&&i===a&&(0,y.jsx)("div",{className:"absolute inset-x-0 bottom-0 bg-linear-to-t from-black/80 to-transparent p-3 pt-8",style:{animation:"reveal-up 0.25s ease-out"},children:(0,y.jsx)("span",{className:"text-sm font-medium text-white/90",children:e.title})})]})},a))}),e.length>c&&(0,y.jsxs)("span",{className:"font-mono text-xs",style:{color:Lt},children:["+ ",e.length-c," more"]}),(0,y.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:Lt,opacity:s?0:.7},children:"Hover to explore"})]})}function Pt({photos:e,currentIndex:t,onIndexChange:r,onClose:a,actions:s,activeActions:l,onAction:i,showGrain:o}){const c=e[t],[d,u]=(0,w.useState)(1),[m,x]=(0,w.useState)({x:0,y:0}),[p,h]=(0,w.useState)(!1),[f,b]=(0,w.useState)(!1),g=(0,w.useRef)(!1),v=(0,w.useRef)({x:0,y:0}),k=(0,w.useRef)(null);(0,w.useLayoutEffect)(()=>{requestAnimationFrame(()=>b(!0))},[]),(0,w.useEffect)(()=>{const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[]),(0,w.useEffect)(()=>{const e=e=>{switch(e.key){case"Escape":a();break;case"ArrowLeft":j(-1);break;case"ArrowRight":j(1);break;case"i":case"I":h(e=>!e)}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),(0,w.useEffect)(()=>{const e=k.current;if(!e)return;const t=e=>{e.preventDefault();const t=e.deltaY<0?1.12:.89;u(e=>{const r=Math.min(8,Math.max(1,e*t));return r<=1&&x({x:0,y:0}),r})};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]);const j=(0,w.useCallback)(a=>{const n=t+a;n>=0&&n<e.length&&(r(n),u(1),x({x:0,y:0}))},[t,e.length,r]),C=(0,w.useCallback)(e=>{d<=1||(g.current=!0,v.current={x:e.clientX,y:e.clientY},e.target.setPointerCapture(e.pointerId))},[d]),S=(0,w.useCallback)(e=>{if(!g.current)return;const t=e.clientX-v.current.x,r=e.clientY-v.current.y;v.current={x:e.clientX,y:e.clientY},x(e=>({x:e.x+t/d,y:e.y+r/d}))},[d]),E=(0,w.useCallback)(()=>{g.current=!1},[]),L=(0,w.useCallback)(()=>{d>1?(u(1),x({x:0,y:0})):u(2.5)},[d]),M=c.metadata;return(0,y.jsxs)("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[(0,y.jsx)("div",{className:"absolute inset-0 bg-black/95",onClick:a}),o&&(0,y.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:Mt,animation:"film-grain-shift 0.6s steps(5) infinite"}}),(0,y.jsxs)("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[(0,y.jsxs)("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),(0,y.jsxs)("div",{className:"flex items-center gap-1",children:[(0,y.jsxs)("span",{className:"mr-2 font-mono text-xs text-white/40",children:[d.toFixed(1),"x"]}),(0,y.jsx)("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>u(e=>Math.min(8,1.3*e)),title:"Zoom in",children:(0,y.jsx)(N.ZoomIn,{className:"h-4 w-4"})}),(0,y.jsx)("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{u(e=>{const t=Math.max(1,.7*e);return t<=1&&x({x:0,y:0}),t})},title:"Zoom out",children:(0,y.jsx)(N.ZoomOut,{className:"h-4 w-4"})}),(0,y.jsx)("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:a,title:"Close",children:(0,y.jsx)(N.X,{className:"h-5 w-5"})})]})]}),(0,y.jsxs)("div",{ref:k,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:d>1?"grab":"default"},onPointerDown:C,onPointerMove:S,onPointerUp:E,onDoubleClick:L,children:[(0,y.jsx)("img",{src:c.src,alt:c.alt??c.title??"",className:"max-h-full max-w-full select-none object-contain",style:{animation:"lightbox-photo-in 0.35s cubic-bezier(0.16, 1, 0.3, 1)",transform:`scale(${d}) translate(${m.x}px, ${m.y}px)`,transition:g.current?"none":"transform 0.15s ease-out"},draggable:!1},t),t>0&&(0,y.jsx)("button",{className:"absolute left-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:e=>{e.stopPropagation(),j(-1)},children:(0,y.jsx)(N.ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&(0,y.jsx)("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:e=>{e.stopPropagation(),j(1)},children:(0,y.jsx)(N.ChevronRight,{className:"h-6 w-6"})})]}),(0,y.jsx)("div",{className:n("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",p?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:(0,y.jsxs)("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[c.title&&(0,y.jsx)("h3",{className:"mb-3 text-xl font-semibold text-white",children:c.title}),c.description&&(0,y.jsx)("p",{className:"mb-4 max-w-xl border-l-2 border-amber-500/40 pl-4 text-sm leading-relaxed text-white/60 italic",style:{animation:"reveal-up 0.4s ease-out 0.1s both"},children:c.description}),M&&(0,y.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[M.camera&&(0,y.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,y.jsx)(N.Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",M.camera,M.lens&&(0,y.jsx)("span",{className:"text-white/40",children:"·"}),M.lens&&M.lens]}),(M.aperture||M.shutter||M.iso)&&(0,y.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,y.jsx)(N.Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[M.aperture,M.shutter,M.iso&&`ISO ${M.iso}`].filter(Boolean).join(" · ")]}),M.date&&(0,y.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,y.jsx)(N.Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",M.date]}),M.location&&(0,y.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,y.jsx)(N.MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",M.location]})]})]})}),(0,y.jsx)("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:(0,y.jsxs)("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[s.map(e=>{const r=e.toggle&&(a=e.key,l.has(`${t}-${a}`));var a;return(0,y.jsx)("button",{className:n("rounded-full p-2.5 transition-all duration-200",r?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>i(e.key,t),title:e.label,children:r&&e.activeIcon?e.activeIcon:e.icon},e.key)}),(0,y.jsx)("div",{className:"mx-1 h-5 w-px bg-white/10"}),(0,y.jsx)("button",{className:n("rounded-full p-2.5 transition-all duration-200",p?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>h(e=>!e),title:"Photo info (I)",children:(0,y.jsx)(N.Info,{className:"h-5 w-5"})})]})})]})}const It="data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">\n <rect width="200" height="200" fill="#1e1b2e"/>\n <circle cx="100" cy="100" r="60" fill="none" stroke="#6366f1" stroke-width="1.5" opacity="0.3"/>\n <circle cx="100" cy="100" r="20" fill="none" stroke="#6366f1" stroke-width="1" opacity="0.4"/>\n <text x="100" y="108" text-anchor="middle" font-family="monospace" font-size="18" fill="#6366f1" opacity="0.6">♪</text>\n </svg>');function Rt(e){return!isFinite(e)||e<0?"0:00":`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}const Vt={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},$t={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Ot={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function Kt({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:a,theme:s,docked:l=!1,visible:i,onVisibleChange:o,onTrackChange:c,onLike:d,autoPlay:u=!0,shuffle:m=!1,loop:x=!1,accent:p="#8b5cf6",className:h}){const[f,b]=(0,w.useState)(t),[g,v]=(0,w.useState)(!1),[k,j]=(0,w.useState)(0),[C,S]=(0,w.useState)(0),[E,L]=(0,w.useState)(.8),[M,T]=(0,w.useState)(!1),[z,_]=(0,w.useState)(new Set),[D,A]=(0,w.useState)(!1),[F,P]=(0,w.useState)(i??!l),[I,R]=(0,w.useState)(!1),[V,$]=(0,w.useState)(!1),[O,K]=(0,w.useState)(m),[B,X]=(0,w.useState)(x),q=(0,w.useRef)(!1),H=(0,w.useRef)(null),U=(0,w.useRef)(null),G=(0,w.useRef)(void 0),Y=i??F,W=a??((Z=r).startsWith("bottom")?"bottom":Z.startsWith("top")?"top":"right");var Z;const J=e[f],Q=l,ee="dark"===s?"dark":"light"===s?"light":"",te="text-(--mp-text)",re="text-(--mp-text-muted)",ae="text-(--accent)",ne="border-(--mp-border)";(0,w.useEffect)(()=>{const e=H.current;e&&(e.src=J.src,e.load(),g&&e.play().catch(()=>{}))},[f,J.src]),(0,w.useEffect)(()=>{if(!u||q.current)return;const e=H.current;if(!e)return;const t=()=>{q.current=!0,v(!0),e.play().catch(()=>{})};return e.addEventListener("canplaythrough",t,{once:!0}),()=>e.removeEventListener("canplaythrough",t)},[u]),(0,w.useEffect)(()=>{const e=H.current;e&&(g?e.play().catch(()=>{}):e.pause())},[g]),(0,w.useEffect)(()=>{const e=H.current;e&&(e.volume=M?0:E)},[E,M]),(0,w.useEffect)(()=>{const e=H.current;if(!e)return;const t=()=>j(e.currentTime),r=()=>S(e.duration),a=()=>{B?(e.currentTime=0,e.play().catch(()=>{})):le()};return e.addEventListener("timeupdate",t),e.addEventListener("loadedmetadata",r),e.addEventListener("ended",a),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("loadedmetadata",r),e.removeEventListener("ended",a)}},[f,e.length]);const se=(0,w.useCallback)(t=>{const r=(t%e.length+e.length)%e.length;b(r),j(0),c?.(r,e[r]),Y||(P(!0),o?.(!0))},[e,Y,c,o]),le=(0,w.useCallback)(()=>{if(O){let t;do{t=Math.floor(Math.random()*e.length)}while(t===f&&e.length>1);se(t)}else se(f+1)},[se,f,O,e.length]),ie=(0,w.useCallback)(()=>{if(O){let t;do{t=Math.floor(Math.random()*e.length)}while(t===f&&e.length>1);se(t)}else se(f-1)},[se,f,O,e.length]),oe=(0,w.useCallback)(()=>{const e=z.has(f);_(t=>{const r=new Set(t);return e?r.delete(f):r.add(f),r}),d?.(f,J,!e)},[f,z,d,J]),ce=(0,w.useCallback)(e=>{const t=e.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(1,(e.clientX-t.left)/t.width))*C;H.current&&(H.current.currentTime=r),j(r)},[C]),de=(0,w.useCallback)(()=>{R(!0);const e=Q?200:400;G.current=setTimeout(()=>{R(!1),P(!1),o?.(!1)},e)},[Q,o]);(0,w.useEffect)(()=>()=>{G.current&&clearTimeout(G.current)},[]);const ue=V?"fade-in 0.2s ease-out both":`mp-enter-${W} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,me=V?"fade-in 0.2s ease-in reverse both":`mp-exit-${W} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,xe=C>0?k/C*100:0;return!Q||Y||I?Y||I?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("audio",{ref:H,preload:"metadata"}),(0,y.jsx)("div",{className:n("fixed z-100",Q?$t[r]:Vt[r],ee),style:{"--accent":p,...I?{animation:me}:{animation:ue}},onMouseEnter:()=>{Q&&(G.current&&(clearTimeout(G.current),G.current=void 0),I&&R(!1),$(!0))},onMouseLeave:()=>{Q&&($(!1),de())},children:(0,y.jsxs)("div",{className:n("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl","bg-(--mp-bg)",ne,Q&&"rounded-none",r.endsWith("right")&&Q&&"rounded-l-2xl",r.endsWith("left")&&Q&&"rounded-r-2xl",h),children:[(0,y.jsxs)("div",{className:"relative",children:[(0,y.jsx)("div",{className:"absolute inset-0 overflow-hidden",children:(0,y.jsx)("img",{src:J.cover||It,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:!1})}),(0,y.jsxs)("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[(0,y.jsxs)("div",{className:"relative h-14 w-14 shrink-0",children:[(0,y.jsxs)("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:g?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[(0,y.jsx)("img",{src:J.cover||It,alt:J.album??J.title,className:"h-full w-full object-cover",draggable:!1}),(0,y.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,y.jsx)("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),g&&(0,y.jsx)("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),(0,y.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,y.jsx)("div",{className:n("truncate text-sm font-semibold",te),children:J.title}),J.artist&&(0,y.jsx)("div",{className:n("truncate text-xs",re),children:J.artist}),J.album&&(0,y.jsx)("div",{className:n("mt-0.5 truncate text-[10px] tracking-wide",re,"opacity-60"),children:J.album})]}),(0,y.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,y.jsx)("button",{className:n("rounded-full p-1.5 transition-all duration-200",z.has(f)?"text-rose-500 hover:text-rose-400":n(re,"hover:text-rose-500")),onClick:oe,title:"Like",children:(0,y.jsx)(N.Heart,{className:"h-4 w-4",fill:z.has(f)?"currentColor":"none"})}),(0,y.jsx)("button",{className:n("rounded-full p-1.5 transition-colors",re,"hover:"+te.split(" ")[0]),onClick:()=>A(e=>!e),title:"Playlist",children:(0,y.jsx)(N.ListMusic,{className:"h-4 w-4"})}),!Q&&(0,y.jsx)("button",{className:n("rounded-full p-1.5 transition-colors",re,"hover:"+te.split(" ")[0]),onClick:de,title:"Dismiss",children:(0,y.jsx)(N.X,{className:"h-3.5 w-3.5"})})]})]})]}),(0,y.jsxs)("div",{className:"px-4",children:[(0,y.jsxs)("div",{ref:U,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:ce,children:[(0,y.jsx)("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${xe}%`}}),(0,y.jsx)("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${xe}% - 6px)`}})]}),(0,y.jsxs)("div",{className:n("mt-1 flex justify-between text-[10px] font-mono",re),children:[(0,y.jsx)("span",{children:Rt(k)}),(0,y.jsx)("span",{children:Rt(C)})]})]}),(0,y.jsxs)("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[(0,y.jsx)("button",{className:n("rounded-full p-1.5 transition-colors",O?ae:re,"hover:text-(--mp-text)"),onClick:()=>K(e=>!e),title:O?"Shuffle On":"Shuffle Off",children:(0,y.jsx)(N.Shuffle,{className:"h-3.5 w-3.5"})}),(0,y.jsx)("button",{className:n("rounded-full p-1.5 transition-colors",B?ae:re,"hover:text-(--mp-text)"),onClick:()=>X(e=>!e),title:B?"Loop On":"Loop Off",children:(0,y.jsx)(N.Repeat1,{className:"h-3.5 w-3.5"})}),(0,y.jsx)("button",{className:n("rounded-full p-2 transition-colors",re,"hover:text-(--mp-text)"),onClick:ie,title:"Previous",children:(0,y.jsx)(N.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),(0,y.jsx)("button",{className:n("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>v(e=>!e),title:g?"Pause":"Play",children:g?(0,y.jsx)(N.Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):(0,y.jsx)(N.Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),(0,y.jsx)("button",{className:n("rounded-full p-2 transition-colors",re,"hover:text-(--mp-text)"),onClick:le,title:"Next",children:(0,y.jsx)(N.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),(0,y.jsxs)("div",{className:"ml-2 flex items-center gap-1.5",children:[(0,y.jsx)("button",{className:n("rounded-full p-1 transition-colors",re,"hover:text-(--mp-text)"),onClick:()=>T(e=>!e),title:M?"Unmute":"Mute",children:M||0===E?(0,y.jsx)(N.VolumeX,{className:"h-3.5 w-3.5"}):(0,y.jsx)(N.Volume2,{className:"h-3.5 w-3.5"})}),(0,y.jsx)("input",{type:"range",min:0,max:1,step:.01,value:M?0:E,onChange:e=>{L(Number(e.target.value)),M&&T(!1)},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),(0,y.jsx)("div",{className:n("overflow-hidden transition-all duration-300 ease-in-out",D?"max-h-60":"max-h-0"),children:(0,y.jsx)("div",{className:n("border-t px-2 py-2",ne),children:(0,y.jsx)("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((e,t)=>{const r=t===f;return(0,y.jsxs)("button",{className:n("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",r?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{se(t),v(!0)},children:[(0,y.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:r&&g?(0,y.jsx)("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(e=>(0,y.jsx)("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:8+4*e+"px",animation:`mp-eq-bar ${.4+.15*e}s ease-in-out infinite alternate`}},e))}):r?(0,y.jsx)(N.Disc3,{className:n("h-4 w-4",ae)}):(0,y.jsx)("span",{className:n("text-xs font-mono",re),children:t+1})}),(0,y.jsx)("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:(0,y.jsx)("img",{src:e.cover||It,alt:"",className:"h-full w-full object-cover",draggable:!1})}),(0,y.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,y.jsx)("div",{className:n("truncate text-xs font-medium",r?ae:te),children:e.title}),e.artist&&(0,y.jsx)("div",{className:n("truncate text-[10px]",re),children:e.artist})]}),z.has(t)&&(0,y.jsx)(N.Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},t)})})})})]})})]}):(0,y.jsx)("audio",{ref:H,preload:"metadata"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("audio",{ref:H,preload:"metadata"}),(0,y.jsxs)("div",{className:n("fixed z-100 cursor-pointer transition-all duration-300",Ot[r]),style:{"--accent":p},onMouseEnter:()=>{$(!0),P(!0),o?.(!0)},children:[(0,y.jsx)("div",{className:n("h-full w-full rounded-full",g?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:g?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),g&&(0,y.jsx)("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]})}function Bt(e){if(!isFinite(e)||e<0)return"0:00";const t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=Math.floor(e%60);return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}const Xt={title:(e,t)=>e.title.localeCompare(t.title),type:(e,t)=>(e.type??"").localeCompare(t.type??""),duration:(e,t)=>(e.duration??0)-(t.duration??0)};function qt({playlist:e,initialTrack:t=0,autoPlay:r=!1,shuffle:a=!1,loop:s=!1,onTrackChange:l,onPlayChange:i,accent:o="#8b5cf6",className:c}){const[d,u]=(0,w.useState)(t),[m,x]=(0,w.useState)(!1),[p,h]=(0,w.useState)(0),[f,b]=(0,w.useState)(0),[g,v]=(0,w.useState)(0),[j,C]=(0,w.useState)(.8),[S,E]=(0,w.useState)(!1),[L,M]=(0,w.useState)(a),[T,z]=(0,w.useState)(s),[_,D]=(0,w.useState)(!1),[A,F]=(0,w.useState)("title"),[P,I]=(0,w.useState)(!0),[R,V]=(0,w.useState)(!1),[$,O]=(0,w.useState)(!1),[K,B]=(0,w.useState)(!1),[X,q]=(0,w.useState)(!0),[H,U]=(0,w.useState)(!1),[G,Y]=(0,w.useState)(null),W=(0,w.useRef)(null),Z=(0,w.useRef)(null),J=(0,w.useRef)(void 0),Q=(0,w.useRef)(!1),ee=e[d],te=k().useMemo(()=>{const t=e.map((e,t)=>({media:e,originalIndex:t}));return t.sort((e,t)=>{const r=Xt[A](e.media,t.media);return P?r:-r}),t},[e,A,P]);(0,w.useEffect)(()=>{const e=W.current;if(!e)return;U(!0),e.src=ee.src,ee.poster&&(e.poster=ee.poster),e.load();const t=()=>{U(!1),m&&e.play().catch(()=>{})};return e.addEventListener("loadeddata",t,{once:!0}),()=>e.removeEventListener("loadeddata",t)},[d,ee.src]),(0,w.useEffect)(()=>{if(!r||Q.current)return;const e=W.current;if(!e)return;const t=()=>{Q.current=!0,x(!0),e.play().catch(()=>{})};return e.addEventListener("canplaythrough",t,{once:!0}),()=>e.removeEventListener("canplaythrough",t)},[r]),(0,w.useEffect)(()=>{const e=W.current;e&&(m?e.play().catch(()=>{}):e.pause(),i?.(m))},[m]),(0,w.useEffect)(()=>{const e=W.current;e&&(e.volume=S?0:j)},[j,S]),(0,w.useEffect)(()=>{const e=W.current;if(!e)return;const t=()=>h(e.currentTime),r=()=>b(e.duration),a=()=>{e.buffered.length>0&&v(e.buffered.end(e.buffered.length-1))},n=()=>{T?(e.currentTime=0,e.play().catch(()=>{})):ne()};return e.addEventListener("timeupdate",t),e.addEventListener("loadedmetadata",r),e.addEventListener("progress",a),e.addEventListener("ended",n),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("loadedmetadata",r),e.removeEventListener("progress",a),e.removeEventListener("ended",n)}},[d,e.length,T]);const re=(0,w.useCallback)(()=>{q(!0),J.current&&clearTimeout(J.current),J.current=setTimeout(()=>{m&&q(!1)},3e3)},[m]);(0,w.useEffect)(()=>{m?re():(q(!0),J.current&&clearTimeout(J.current))},[m,re]),(0,w.useEffect)(()=>()=>{J.current&&clearTimeout(J.current)},[]);const ae=(0,w.useCallback)(t=>{const r=(t%e.length+e.length)%e.length;u(r),h(0),x(!0),l?.(r,e[r])},[e,l]),ne=(0,w.useCallback)(()=>{if(L){let t;do{t=Math.floor(Math.random()*e.length)}while(t===d&&e.length>1);ae(t)}else ae(d+1)},[ae,d,L,e.length]),se=(0,w.useCallback)(()=>{if(L){let t;do{t=Math.floor(Math.random()*e.length)}while(t===d&&e.length>1);ae(t)}else ae(d-1)},[ae,d,L,e.length]),le=(0,w.useCallback)(e=>{const t=e.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(1,(e.clientX-t.left)/t.width))*f;W.current&&(W.current.currentTime=r),h(r)},[f]),ie=(0,w.useCallback)(e=>{const t=e.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(1,(e.clientX-t.left)/t.width));Y(r*f)},[f]),oe=(0,w.useCallback)(()=>{Z.current&&(document.fullscreenElement?document.exitFullscreen():Z.current.requestFullscreen())},[]);(0,w.useEffect)(()=>{const e=()=>B(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]);const ce=(0,w.useCallback)(()=>{R?(O(!0),setTimeout(()=>{V(!1),O(!1)},500)):V(!0)},[R]),de=(0,w.useCallback)(()=>{D(e=>!e)},[]),ue=(0,w.useCallback)(()=>{const e=["title","type","duration"],t=e.indexOf(A);P?I(!1):(I(!0),F(e[(t+1)%e.length]))},[A,P]);(0,w.useEffect)(()=>{const e=e=>{if(!(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))switch(e.key){case" ":case"k":e.preventDefault(),x(e=>!e);break;case"f":e.preventDefault(),oe();break;case"t":e.preventDefault(),ce();break;case"ArrowLeft":e.preventDefault(),W.current&&(W.current.currentTime=Math.max(0,p-5));break;case"ArrowRight":e.preventDefault(),W.current&&(W.current.currentTime=Math.min(f,p+5));break;case"ArrowUp":e.preventDefault(),C(e=>Math.min(1,e+.05));break;case"ArrowDown":e.preventDefault(),C(e=>Math.max(0,e-.05));break;case"Escape":R&&ce();break;case"n":e.preventDefault(),ne();break;case"p":e.preventDefault(),se();break;case"l":e.preventDefault(),de()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,ce,de,ne,se,p,f,R]);const me=f>0?p/f*100:0,xe=f>0?g/f*100:0,pe="text-(--accent)",he=(0,y.jsxs)("div",{ref:Z,className:n("group flex overflow-hidden",K?"h-full w-full":"aspect-video w-full",!K&&"rounded-xl",!K&&m&&"shadow-2xl",!K&&!m&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",c),style:{"--accent":o,background:"var(--cp-bg)"},tabIndex:0,children:[(0,y.jsxs)("div",{className:n("relative flex-1 min-w-0 h-full overflow-hidden",H&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:re,onMouseLeave:()=>{m&&q(!1)},children:[(0,y.jsx)("video",{ref:W,className:"h-full w-full object-contain",poster:ee.poster,playsInline:!0,preload:"metadata",onClick:()=>x(e=>!e)}),!m&&!H&&(0,y.jsx)("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>x(!0),children:(0,y.jsx)("div",{className:"flex h-20 w-20 items-center justify-center rounded-full backdrop-blur-md transition-transform hover:scale-110 active:scale-95",style:{background:"var(--cp-surface-hover)"},children:(0,y.jsx)(N.Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),H&&(0,y.jsx)("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:(0,y.jsxs)("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[(0,y.jsx)("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:ee.title}),ee.subtitle&&(0,y.jsx)("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:ee.subtitle})]})}),(0,y.jsx)("div",{className:n("absolute inset-x-0 top-0 z-10 bg-linear-to-b from-black/70 to-transparent px-5 pb-8 pt-4 transition-opacity duration-500",X?"opacity-100":"pointer-events-none opacity-0"),children:(0,y.jsxs)("div",{className:"flex items-center justify-between",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:ee.title}),ee.subtitle&&(0,y.jsx)("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:ee.subtitle})]}),ee.type&&(0,y.jsx)("span",{className:"rounded-full bg-(--accent)/70 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider backdrop-blur-sm",style:{color:"var(--cp-text-strong)"},children:ee.type})]})}),(0,y.jsxs)("div",{className:n("absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/80 via-black/40 to-transparent px-4 pb-3 pt-10 transition-all duration-500",X?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[(0,y.jsxs)("div",{className:"group/seek relative mb-3 h-1 cursor-pointer rounded-full transition-[height] duration-200 hover:h-1.5",style:{background:"var(--cp-seek-track)"},onClick:le,onMouseMove:ie,onMouseLeave:()=>Y(null),children:[(0,y.jsx)("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${xe}%`,background:"var(--cp-seek-buffer)"}}),(0,y.jsx)("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${me}%`}}),null!==G&&(0,y.jsx)("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:G/f*100+"%",background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:Bt(G)}),(0,y.jsx)("div",{className:"absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2 rounded-full border-2 border-(--accent) bg-white opacity-0 shadow-lg transition-opacity group-hover/seek:opacity-100",style:{left:`calc(${me}% - 7px)`}})]}),(0,y.jsxs)("div",{className:"flex items-center gap-1",children:[(0,y.jsx)("button",{className:"cp-btn",onClick:()=>x(e=>!e),title:m?"Pause (k)":"Play (k)",children:m?(0,y.jsx)(N.Pause,{className:"h-5 w-5",fill:"currentColor"}):(0,y.jsx)(N.Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),(0,y.jsx)("button",{className:"cp-btn",onClick:se,title:"Previous (p)",children:(0,y.jsx)(N.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),(0,y.jsx)("button",{className:"cp-btn",onClick:ne,title:"Next (n)",children:(0,y.jsx)(N.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),(0,y.jsxs)("div",{className:"group/vol ml-1 flex items-center",children:[(0,y.jsx)("button",{className:"cp-btn",onClick:()=>E(e=>!e),title:S?"Unmute":"Mute",children:S||0===j?(0,y.jsx)(N.VolumeX,{className:"h-4 w-4"}):(0,y.jsx)(N.Volume2,{className:"h-4 w-4"})}),(0,y.jsx)("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:(0,y.jsx)("input",{type:"range",min:0,max:1,step:.01,value:S?0:j,onChange:e=>{C(Number(e.target.value)),S&&E(!1)},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),(0,y.jsxs)("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[Bt(p)," / ",Bt(f)]}),(0,y.jsx)("div",{className:"flex-1"}),(0,y.jsx)("button",{className:n("cp-btn",L&&pe),onClick:()=>M(e=>!e),title:"Shuffle",children:(0,y.jsx)(N.Shuffle,{className:"h-4 w-4"})}),(0,y.jsx)("button",{className:n("cp-btn",T&&pe),onClick:()=>z(e=>!e),title:"Loop",children:(0,y.jsx)(N.Repeat1,{className:"h-4 w-4"})}),(0,y.jsx)("button",{className:n("cp-btn",_&&pe),onClick:de,title:"Playlist",children:(0,y.jsx)(N.ListVideo,{className:"h-4 w-4"})}),(0,y.jsx)("button",{className:n("cp-btn",R&&pe),onClick:ce,title:"Cinema mode (t)",children:(0,y.jsx)(N.Theater,{className:"h-4 w-4"})}),(0,y.jsx)("button",{className:"cp-btn",onClick:oe,title:"Fullscreen (f)",children:K?(0,y.jsx)(N.Minimize,{className:"h-4 w-4"}):(0,y.jsx)(N.Maximize,{className:"h-4 w-4"})})]})]})]}),(0,y.jsx)("div",{className:n("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",_?"w-72":"w-0"),children:(0,y.jsxs)("div",{className:"flex h-full w-72 flex-col backdrop-blur-xl",style:{borderLeft:"1px solid var(--cp-border)",background:"var(--cp-panel-bg)"},children:[(0,y.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[(0,y.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),(0,y.jsxs)("div",{className:"flex items-center gap-1",children:[(0,y.jsxs)("button",{className:"flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors",style:{color:"var(--cp-text-muted)"},onClick:ue,title:`Sort: ${A} ${P?"↑":"↓"}`,children:[(0,y.jsx)(N.ArrowUpDown,{className:"h-3 w-3"}),A,P?" ↑":" ↓"]}),(0,y.jsx)("button",{className:"cp-btn p-1!",onClick:de,title:"Close",children:(0,y.jsx)(N.X,{className:"h-3.5 w-3.5"})})]})]}),(0,y.jsx)("div",{className:"flex-1 overflow-y-auto",children:te.map(({media:e,originalIndex:t})=>{const r=t===d;return(0,y.jsxs)("button",{className:n("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",r?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:r?void 0:{color:"var(--cp-text)"},onClick:()=>{ae(t)},children:[(0,y.jsxs)("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[e.poster?(0,y.jsx)("img",{src:e.poster,alt:"",className:"h-full w-full object-cover",draggable:!1}):(0,y.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,y.jsx)(N.Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),r&&m&&(0,y.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:(0,y.jsx)("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(e=>(0,y.jsx)("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:6+3*e+"px",animation:`mp-eq-bar ${.3+.12*e}s ease-in-out infinite alternate`}},e))})})]}),(0,y.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,y.jsx)("div",{className:"truncate text-xs font-medium",children:e.title}),(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[e.type&&(0,y.jsx)("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:e.type}),null!=e.duration&&(0,y.jsx)("span",{className:"font-mono text-[10px] opacity-40",children:Bt(e.duration)})]})]}),r&&(0,y.jsx)(N.ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},t)})})]})}),(0,y.jsx)("style",{children:"\n .cp-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 6px;\n border-radius: 9999px;\n color: var(--cp-text);\n transition: color 0.15s, background 0.15s, transform 0.15s;\n }\n .cp-btn:hover { color: var(--cp-text-strong); background: var(--cp-surface-hover); }\n .cp-btn:active { transform: scale(0.9); }\n @keyframes cp-glow-pulse {\n 0%, 100% { box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 25%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }\n 50% { box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 55%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }\n }\n "})]});return(0,y.jsx)("div",{className:n(R&&"fixed inset-0 z-100 flex items-center justify-center p-8",R&&($?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:R?e=>{e.target===e.currentTarget&&ce()}:void 0,children:(0,y.jsx)("div",{className:n(R&&"w-full",R&&!K&&"max-w-5xl"),children:he})})}function Ht(e){const t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Ut(e){return null==e?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(2)} GB`}function Gt(e){return e?("string"==typeof e?new Date(e):e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}const Yt={".png":N.Image,".jpg":N.Image,".jpeg":N.Image,".gif":N.Image,".svg":N.Image,".webp":N.Image,".ico":N.Image,".bmp":N.Image,".mp3":N.Music,".wav":N.Music,".flac":N.Music,".ogg":N.Music,".aac":N.Music,".m4a":N.Music,".mp4":N.Video,".mkv":N.Video,".avi":N.Video,".mov":N.Video,".wmv":N.Video,".webm":N.Video,".ts":N.FileCode,".tsx":N.FileCode,".js":N.FileCode,".jsx":N.FileCode,".json":N.FileCode,".html":N.FileCode,".css":N.FileCode,".scss":N.FileCode,".py":N.FileCode,".rs":N.FileCode,".go":N.FileCode,".java":N.FileCode,".c":N.FileCode,".cpp":N.FileCode,".h":N.FileCode,".sh":N.Terminal,".bat":N.Terminal,".ps1":N.Terminal,".md":N.FileText,".txt":N.FileText,".pdf":N.FileText,".doc":N.FileText,".docx":N.FileText,".rtf":N.FileText,".csv":N.FileSpreadsheet,".xls":N.FileSpreadsheet,".xlsx":N.FileSpreadsheet,".db":N.Database,".sqlite":N.Database,".sql":N.Database,".zip":N.FileArchive,".tar":N.FileArchive,".gz":N.FileArchive,".rar":N.FileArchive,".7z":N.FileArchive};function Wt(e){if("directory"===e.type)return N.Folder;const t=e.extension||Ht(e.name);return Yt[t]||N.File}function Zt(e,t,r){return Math.max(t,Math.min(r,e))}function Jt({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:a="list",initialPosition:s,initialSize:l,dockable:i=!1,dockSide:o="right",visible:c=!0,onFileOpen:d,onSelectionChange:u,onNavigate:m,onDelete:x,onClose:p,onMinimize:h,onPathSubmit:f,defaultInputMode:b="search",actions:g,resizable:v=!0,minSize:C={width:400,height:300},className:S}){const[E,L]=(0,w.useState)(a),[M,T]=(0,w.useState)(new Set),[z,_]=(0,w.useState)(null),[D,A]=(0,w.useState)(!1),[F,P]=(0,w.useState)(!1),[I,R]=(0,w.useState)(""),[V,$]=(0,w.useState)(b),[O,K]=(0,w.useState)(c),[B,X]=(0,w.useState)(!1),q=l??{width:720,height:520},[H,U]=(0,w.useState)(s??{x:Math.max(0,Math.round((window.innerWidth-q.width)/2)),y:Math.max(0,Math.round((window.innerHeight-q.height)/2))}),[G,Y]=(0,w.useState)(q),[W,Z]=(0,w.useState)(null),J=(0,w.useRef)(!1),Q=(0,w.useRef)({x:0,y:0}),ee=(0,w.useRef)(null),te=(0,w.useRef)(!1),re=(0,w.useRef)({x:0,y:0,w:0,h:0,px:0,py:0}),ae=void 0!==c?c:O,ne=(0,w.useMemo)(()=>{const t=e.filter(e=>"directory"===e.type),r=e.filter(e=>"file"===e.type);return t.sort((e,t)=>e.name.localeCompare(t.name)),r.sort((e,t)=>e.name.localeCompare(t.name)),[...t,...r]},[e]),se=(0,w.useMemo)(()=>{if("search"!==V||!I.trim())return ne;const e=I.toLowerCase();return ne.filter(t=>t.name.toLowerCase().includes(e))},[ne,I,V]),le=null!=z?se[z]:null,ie=(0,w.useCallback)((e,t)=>{T(r=>{const a=new Set(r);return t.ctrlKey||t.metaKey?a.has(e)?a.delete(e):a.add(e):(a.clear(),a.add(e)),a}),_(e)},[]);(0,w.useEffect)(()=>{if(!u)return;const e=Array.from(M).map(e=>se[e]).filter(Boolean);u(e)},[M]);const oe=(0,w.useCallback)(e=>{const t=se[e];t&&("directory"===t.type?m?.(t.path):d?.(t))},[se,d,m]),ce=(0,w.useCallback)(e=>{D||e.target.closest("button")||(J.current=!0,Q.current={x:e.clientX-H.x,y:e.clientY-H.y},e.preventDefault())},[H,D]);(0,w.useEffect)(()=>{const e=e=>{if(!J.current)return;const t=window.innerWidth-100,r=window.innerHeight-40;U({x:Zt(e.clientX-Q.current.x,0,t),y:Zt(e.clientY-Q.current.y,0,r)})},t=()=>{J.current=!1,te.current=!1,document.body.style.cursor="",document.body.style.userSelect=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const de=(0,w.useCallback)((e,t)=>{D||(t.preventDefault(),t.stopPropagation(),te.current=e,re.current={x:t.clientX,y:t.clientY,w:G.width,h:G.height,px:H.x,py:H.y},document.body.style.cursor="e"===e||"w"===e?"ew-resize":"n"===e||"s"===e?"ns-resize":"nw"===e||"se"===e?"nwse-resize":"nesw-resize",document.body.style.userSelect="none")},[D,G,H]);(0,w.useEffect)(()=>{const e=e=>{if(!te.current)return;const t=te.current,r=e.clientX-re.current.x,a=e.clientY-re.current.y;let{w:n,h:s,px:l,py:i}=re.current;if(t.includes("e")&&(n=Math.max(C.width,n+r)),t.includes("w")){const e=Math.max(C.width,n-r);l+=n-e,n=e}if(t.includes("s")&&(s=Math.max(C.height,s+a)),t.includes("n")){const e=Math.max(C.height,s-a);i+=s-e,s=e}Y({width:n,height:s}),U({x:l,y:i})},t=()=>{te.current=!1,document.body.style.cursor="",document.body.style.userSelect=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[C]);const ue=(0,w.useCallback)(()=>{D?(W&&(U(W.pos),Y(W.size)),A(!1)):(Z({pos:H,size:G}),A(!0))},[D,H,G,W]),me=(0,w.useCallback)(()=>{F?P(!1):(D&&(A(!1),W&&(U(W.pos),Y(W.size))),P(!0),h?.())},[F,D,W,h]);(0,w.useEffect)(()=>{if(!ae||F)return;const e=e=>{if(ee.current?.contains(document.activeElement)||document.activeElement===ee.current){if("Escape"===e.key&&(_(null),T(new Set)),e.ctrlKey&&"a"===e.key){e.preventDefault();const t=new Set(se.map((e,t)=>t));T(t)}"Delete"===e.key&&M.size>0&&x&&(e.preventDefault(),X(!0))}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ae,F,se,M,x]);const xe={"--fe-accent":r};return F?(0,y.jsx)("div",{className:n("fixed z-100 cursor-pointer transition-all duration-300","right"===o?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:xe,onClick:()=>P(!1),title:`Restore ${t}`,children:(0,y.jsxs)("div",{className:"fe-dock flex items-center gap-1.5 rounded-l-lg px-2 py-3 backdrop-blur-md",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:[(0,y.jsx)(N.HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),(0,y.jsx)("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})}):ae?(0,y.jsxs)("div",{ref:ee,className:n("fe-window fixed z-100 flex flex-col overflow-hidden","rounded-xl border border-(--fe-border)","animate-[fe-window-in_0.35s_cubic-bezier(0.16,1,0.3,1)_both]",D&&"rounded-none",S),style:{...xe,left:D?0:H.x,top:D?0:H.y,width:D?"100vw":G.width,height:D?"100vh":G.height,transition:D?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[(0,y.jsxs)("div",{className:"fe-titlebar group/titlebar flex h-10 shrink-0 cursor-grab items-center justify-between px-3 select-none active:cursor-grabbing",onMouseDown:ce,onDoubleClick:ue,children:[(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[(0,y.jsx)("div",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:"color-mix(in srgb, var(--fe-accent) 25%, transparent)"},children:(0,y.jsx)(N.HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),(0,y.jsx)("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),(0,y.jsx)("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),(0,y.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,y.jsx)("button",{className:"fe-btn mr-1",onClick:()=>L(e=>"list"===e?"grid":"list"),title:"list"===E?"Grid view":"List view",children:"list"===E?(0,y.jsx)(N.LayoutGrid,{className:"h-3.5 w-3.5"}):(0,y.jsx)(N.LayoutList,{className:"h-3.5 w-3.5"})}),i&&(0,y.jsx)("button",{className:"fe-btn",onClick:me,title:"Dock to edge",children:(0,y.jsx)(N.Minus,{className:"h-3.5 w-3.5"})}),(0,y.jsx)("button",{className:"fe-btn",onClick:ue,title:D?"Restore":"Maximize",children:D?(0,y.jsx)(N.Minimize2,{className:"h-3.5 w-3.5"}):(0,y.jsx)(N.Maximize2,{className:"h-3.5 w-3.5"})}),(0,y.jsx)("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{p?.(),K(!1)},title:"Close",children:(0,y.jsx)(N.X,{className:"h-3.5 w-3.5"})})]})]}),(0,y.jsxs)("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[(0,y.jsx)("button",{className:"fe-btn p-1",onClick:()=>m?.(".."),title:"Go up",children:(0,y.jsx)(N.FolderUp,{className:"h-3.5 w-3.5"})}),(0,y.jsx)("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:"navigate"===V?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>$(e=>"search"===e?"navigate":"search"),title:"search"===V?"Switch to path navigation":"Switch to file search",children:"search"===V?(0,y.jsx)(N.Search,{className:"h-3 w-3"}):(0,y.jsx)(N.CornerRightDown,{className:"h-3 w-3"})}),(0,y.jsx)("div",{className:"relative flex-1",children:(0,y.jsx)("input",{type:"text",value:I,onChange:e=>R(e.target.value),onKeyDown:e=>{"Enter"===e.key&&I.trim()&&"navigate"===V&&(f?.(I.trim())??m?.(I.trim()))},placeholder:"search"===V?"Search files…":"Enter path and press Enter…",className:"h-6 w-full rounded border border-(--fe-input-border) bg-(--fe-input-bg) px-2 text-[11px] text-(--fe-text-strong) placeholder:text-(--fe-text-muted) outline-none transition-colors focus:border-(--fe-accent)/40 focus:bg-(--fe-input-bg)"})}),(0,y.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[se.length," item",1!==se.length?"s":"",M.size>0&&` · ${M.size} selected`]})]}),(0,y.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,y.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:e=>{e.target===e.currentTarget&&(T(new Set),_(null))},children:0===se.length?(0,y.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[(0,y.jsx)(N.Folder,{className:"mb-2 h-10 w-10"}),(0,y.jsx)("span",{className:"text-xs",children:"No files found"})]}):"list"===E?(0,y.jsx)("div",{className:"space-y-px",children:se.map((e,t)=>{const r=Wt(e),a=M.has(t),s=e.extension||Ht(e.name);return(0,y.jsxs)("div",{className:n("fe-item group/item flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-(--fe-text) transition-all duration-150 cursor-pointer",a?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:a?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:e=>ie(t,e),onDoubleClick:()=>oe(t),children:[(0,y.jsx)(r,{className:n("h-4 w-4 shrink-0","directory"===e.type?"text-(--fe-accent)":"text-(--fe-text-muted)")}),(0,y.jsx)("span",{className:"flex-1 truncate text-xs font-medium",children:e.name}),s&&"file"===e.type&&(0,y.jsx)("span",{className:"shrink-0 rounded bg-(--fe-badge-bg) px-1.5 py-0.5 font-mono text-[9px] uppercase text-(--fe-text-muted)",children:s}),null!=e.size&&(0,y.jsx)("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Ut(e.size)}),e.modifiedAt&&(0,y.jsx)("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Gt(e.modifiedAt)})]},e.path+t)})}):(0,y.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:se.map((e,t)=>{const r=Wt(e),a=M.has(t),s=e.extension||Ht(e.name);return(0,y.jsxs)("div",{className:n("fe-item group/item flex cursor-pointer flex-col items-center gap-1 rounded-lg px-2 py-2.5 text-center transition-all duration-150",a?"bg-(--fe-accent)/15 text-(--fe-text-strong) ring-1 ring-(--fe-accent)/30":"text-(--fe-text) hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),onClick:e=>ie(t,e),onDoubleClick:()=>oe(t),children:[(0,y.jsx)(r,{className:n("h-7 w-7","directory"===e.type?"text-(--fe-accent)":"text-(--fe-text-muted)")}),(0,y.jsx)("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:e.name}),s&&"file"===e.type&&(0,y.jsx)("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:s})]},e.path+t)})})}),(0,y.jsx)("div",{className:n("shrink-0 overflow-hidden transition-[width] duration-300 ease-out",le?"w-56":"w-0"),children:le&&(0,y.jsxs)("div",{className:"fe-panel flex h-full w-56 flex-col border-l border-(--fe-border) p-4",children:[(0,y.jsxs)("div",{className:"mb-3 flex flex-col items-center",children:[k().createElement(Wt(le),{className:n("h-10 w-10 mb-2","directory"===le.type?"text-(--fe-accent)":"text-(--fe-text-muted)")}),(0,y.jsx)("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:le.name})]}),(0,y.jsxs)("div",{className:"space-y-2.5 text-[10px]",children:[(0,y.jsx)(Qt,{label:"Type",value:"directory"===le.type?"Directory":le.mimeType||le.extension||Ht(le.name)||"File"}),null!=le.size&&(0,y.jsx)(Qt,{label:"Size",value:Ut(le.size)}),(0,y.jsx)(Qt,{label:"Path",value:le.path,mono:!0}),le.extension&&(0,y.jsx)(Qt,{label:"Extension",value:le.extension}),le.modifiedAt&&(0,y.jsx)(Qt,{label:"Modified",value:Gt(le.modifiedAt)}),le.createdAt&&(0,y.jsx)(Qt,{label:"Created",value:Gt(le.createdAt)})]}),(0,y.jsxs)("div",{className:"mt-auto flex flex-col gap-1.5",children:["file"===le.type&&d&&(0,y.jsxs)("button",{className:"flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text-strong) transition-colors",style:{background:"color-mix(in srgb, var(--fe-accent) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--fe-accent) 30%, transparent)"},onClick:()=>d(le),children:[(0,y.jsx)(N.ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),g?.map(e=>(0,y.jsxs)("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>e.onClick(le),children:[e.icon&&k().createElement(e.icon,{className:"h-3 w-3"}),e.label]},e.key))]})]})})]}),(0,y.jsxs)("div",{className:"fe-statusbar flex h-6 shrink-0 items-center justify-between px-3 text-[9px] font-mono text-(--fe-text-muted)",children:[(0,y.jsxs)("span",{children:[se.length," items"]}),(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[M.size>0&&(0,y.jsxs)("span",{className:"text-(--fe-accent)/70",children:[M.size," selected"]}),(0,y.jsx)("span",{className:"opacity-50",children:"Ctrl+Click multi-select · Esc clear"})]})]}),v&&!D&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"absolute top-0 left-2 right-2 h-1.5 cursor-ns-resize",onMouseDown:e=>de("n",e)}),(0,y.jsx)("div",{className:"absolute bottom-0 left-2 right-2 h-1.5 cursor-ns-resize",onMouseDown:e=>de("s",e)}),(0,y.jsx)("div",{className:"absolute top-2 left-0 bottom-2 w-1.5 cursor-ew-resize",onMouseDown:e=>de("w",e)}),(0,y.jsx)("div",{className:"absolute top-2 right-0 bottom-2 w-1.5 cursor-ew-resize",onMouseDown:e=>de("e",e)}),(0,y.jsx)("div",{className:"absolute top-0 left-0 h-3 w-3 cursor-nwse-resize",onMouseDown:e=>de("nw",e)}),(0,y.jsx)("div",{className:"absolute top-0 right-0 h-3 w-3 cursor-nesw-resize",onMouseDown:e=>de("ne",e)}),(0,y.jsx)("div",{className:"absolute bottom-0 left-0 h-3 w-3 cursor-nesw-resize",onMouseDown:e=>de("sw",e)}),(0,y.jsx)("div",{className:"absolute bottom-0 right-0 h-3 w-3 cursor-nwse-resize",onMouseDown:e=>de("se",e)})]}),(0,y.jsx)("style",{children:"\n .fe-window {\n background: var(--fe-bg);\n box-shadow: var(--fe-shadow);\n }\n .fe-titlebar {\n background: linear-gradient(90deg, color-mix(in srgb, var(--fe-accent) 6%, transparent), transparent 60%);\n border-bottom: 1px solid var(--fe-border);\n }\n .fe-toolbar {\n border-bottom: 1px solid var(--fe-border);\n background: var(--fe-surface);\n }\n .fe-panel {\n background: var(--fe-surface);\n }\n .fe-statusbar {\n border-top: 1px solid var(--fe-border);\n background: var(--fe-surface);\n }\n .fe-dock {\n background: var(--fe-dock-bg);\n border-left: 2px solid var(--fe-accent);\n box-shadow: var(--fe-dock-shadow);\n }\n .fe-action {\n background: var(--fe-surface-hover);\n border: 1px solid var(--fe-border);\n }\n .fe-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 5px;\n border-radius: 6px;\n color: var(--fe-btn-color);\n transition: color 0.15s, background 0.15s, transform 0.1s;\n }\n .fe-btn:hover {\n color: var(--fe-btn-hover);\n background: var(--fe-btn-hover-bg);\n }\n .fe-btn:active { transform: scale(0.9); }\n .fe-item {\n animation: fe-item-in 0.25s ease-out both;\n }\n @keyframes fe-window-in {\n from { opacity: 0; transform: scale(0.95) translateY(10px); }\n to { opacity: 1; transform: scale(1) translateY(0); }\n }\n @keyframes fe-item-in {\n from { opacity: 0; transform: translateX(-4px); }\n to { opacity: 1; transform: translateX(0); }\n }\n "}),(0,y.jsx)(Ue,{open:B,onOpenChange:X,children:(0,y.jsxs)(Ge,{size:"sm",children:[(0,y.jsxs)(Ye,{children:[(0,y.jsxs)(We,{children:[(0,y.jsx)(N.AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),(0,y.jsxs)(Ze,{children:[1===M.size?`Are you sure you want to delete "${se[Array.from(M)[0]]?.name}"?`:`Are you sure you want to delete ${M.size} selected items?`," ","This action cannot be undone."]})]}),(0,y.jsxs)(Je,{children:[(0,y.jsx)(j,{intent:"ghost",onClick:()=>X(!1),children:"Cancel"}),(0,y.jsxs)(j,{intent:"danger",onClick:()=>{const e=Array.from(M).map(e=>se[e]).filter(Boolean);x?.(e),T(new Set),_(null),X(!1)},children:[(0,y.jsx)(N.Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]}):null}function Qt({label:e,value:t,mono:r}){return(0,y.jsxs)("div",{children:[(0,y.jsx)("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),(0,y.jsx)("div",{className:n("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}module.exports=t})();
|
|
1
|
+
(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Accordion:()=>De,AccordionContent:()=>Pe,AccordionItem:()=>Ae,AccordionTrigger:()=>Fe,Alert:()=>at,AlertDescription:()=>st,AlertTitle:()=>nt,Badge:()=>z,Button:()=>j,Card:()=>P,CardContent:()=>$,CardDescription:()=>V,CardFooter:()=>O,CardHeader:()=>I,CardTitle:()=>R,Chat:()=>fe,CinePlayer:()=>qt,DataTable:()=>se,Dialog:()=>Ue,DialogClose:()=>Qe,DialogContent:()=>Ge,DialogDescription:()=>Ze,DialogFooter:()=>Je,DialogHeader:()=>Ye,DialogTitle:()=>We,Dropdown:()=>M,DropdownButton:()=>T,FileExplorer:()=>Jt,FilmReel:()=>zt,Header:()=>Te,HorizontalCard:()=>K,ImageCard:()=>B,ImageCardActions:()=>U,ImageCardBody:()=>X,ImageCardDescription:()=>H,ImageCardTitle:()=>q,Input:()=>F,Label:()=>_,List:()=>le,ListItem:()=>oe,MiniPlayer:()=>Kt,Panel:()=>G,PanelContent:()=>W,PanelHeader:()=>Y,SideNav:()=>Le,SortableTable:()=>ae,TabContent:()=>Be,TabList:()=>$e,TabPanels:()=>Ke,TabTrigger:()=>Oe,Table:()=>Z,TableBody:()=>Q,TableCell:()=>re,TableHead:()=>te,TableHeader:()=>J,TableRow:()=>ee,Tabs:()=>Ve,Tooltip:()=>tt,Tree:()=>de,TreeItem:()=>xe,accordionVariants:()=>p,alertVariants:()=>y,badgeVariants:()=>l,buttonVariants:()=>i,cardVariants:()=>d,cn:()=>n,configureAlertTopOffset:()=>ht,dialogContentVariants:()=>b,inputVariants:()=>o,labelVariants:()=>c,listVariants:()=>x,panelVariants:()=>u,tabListVariants:()=>h,tabTriggerVariants:()=>f,tableVariants:()=>m,tooltipVariants:()=>g,useAlert:()=>jt});const r=require("clsx"),a=require("tailwind-merge");function n(...e){return(0,a.twMerge)((0,r.clsx)(e))}const s=require("class-variance-authority"),i=(0,s.cva)("inline-flex cursor-pointer items-center justify-center gap-1.5 rounded font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-500 text-white hover:bg-primary-600 active:bg-primary-700",secondary:"bg-secondary-500 text-white hover:bg-secondary-600 active:bg-secondary-700",danger:"bg-danger-500 text-white hover:bg-danger-600 active:bg-danger-700",warning:"bg-warning-500 text-white hover:bg-warning-600 active:bg-warning-700",ghost:"bg-transparent text-primary-700 hover:bg-primary-100 active:bg-primary-200 dark:text-primary-300 dark:hover:bg-primary-800",outline:"border border-primary-300 bg-transparent text-primary-700 hover:bg-primary-50 dark:border-primary-600 dark:text-primary-300 dark:hover:bg-primary-800"},size:{sm:"h-7 px-3 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"h-9 px-4 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"h-11 px-6 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{intent:"primary",size:"md"}}),l=(0,s.cva)("inline-flex items-center gap-1 rounded border px-2.5 py-0.5 text-xs font-semibold [&_svg]:h-3 [&_svg]:w-3 [&_svg]:shrink-0",{variants:{intent:{success:"border-success-200 bg-success-100 text-success-800 dark:border-success-800 dark:bg-success-900/30 dark:text-success-400",warning:"border-warning-200 bg-warning-100 text-warning-800 dark:border-warning-800 dark:bg-warning-900/30 dark:text-warning-400",error:"border-danger-200 bg-danger-100 text-danger-800 dark:border-danger-800 dark:bg-danger-900/30 dark:text-danger-400",info:"border-primary-200 bg-primary-100 text-primary-800 dark:border-primary-800 dark:bg-primary-900/30 dark:text-primary-400",primary:"border-secondary-200 bg-secondary-100 text-secondary-700 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-300"}},defaultVariants:{intent:"primary"}}),o=(0,s.cva)("w-full rounded-md border bg-white text-secondary-900 transition-colors placeholder:text-secondary-400 focus:outline-none focus:ring-2 dark:bg-secondary-900 dark:text-secondary-100 dark:placeholder:text-secondary-600",{variants:{state:{default:"border-secondary-300 focus:border-primary-500 focus:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus:border-danger-500 focus:ring-danger-500/20"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 py-2 text-sm",lg:"h-11 px-4 py-2.5 text-base"}},defaultVariants:{state:"default",size:"md"}}),c=(0,s.cva)("inline-flex items-center gap-1 font-medium [&_svg]:shrink-0",{variants:{size:{sm:"text-xs [&_svg]:h-3 [&_svg]:w-3",md:"text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"text-base [&_svg]:h-4 [&_svg]:w-4"},intent:{default:"text-primary-700 dark:text-primary-300",muted:"text-primary-400 dark:text-primary-500",required:"text-primary-700 dark:text-primary-300 after:ml-0.5 after:text-danger-500 after:content-['*']"}},defaultVariants:{size:"md",intent:"default"}}),d=(0,s.cva)("rounded-lg transition-shadow",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",elevated:"bg-white shadow-md hover:shadow-lg dark:bg-primary-900",outlined:"border-2 border-primary-300 bg-transparent dark:border-primary-600",ghost:"bg-primary-50 dark:bg-primary-800/50"},size:{sm:"p-3",md:"p-5",lg:"p-7"}},defaultVariants:{intent:"default",size:"md"}}),u=(0,s.cva)("rounded-md",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",inset:"bg-primary-50 dark:bg-primary-800/50",elevated:"bg-white shadow-lg dark:bg-primary-900"},size:{sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{intent:"default",size:"md"}}),m=(0,s.cva)("w-full text-left text-sm",{variants:{intent:{default:"",striped:"[&_tbody_tr:nth-child(even)]:bg-primary-50 dark:[&_tbody_tr:nth-child(even)]:bg-primary-800/30",bordered:"[&_th]:border [&_td]:border [&_th]:border-primary-200 [&_td]:border-primary-200 dark:[&_th]:border-primary-700 dark:[&_td]:border-primary-700"}},defaultVariants:{intent:"default"}}),x=(0,s.cva)("text-sm text-primary-700 dark:text-primary-300",{variants:{intent:{default:"space-y-1",bordered:"divide-y divide-primary-200 rounded-lg border border-primary-200 dark:divide-primary-700 dark:border-primary-700 [&>li]:px-4 [&>li]:py-2",hover:"[&>li]:rounded-md [&>li]:px-3 [&>li]:py-2 [&>li]:transition-colors [&>li:hover]:bg-primary-50 dark:[&>li:hover]:bg-primary-800/50"}},defaultVariants:{intent:"default"}}),p=(0,s.cva)("divide-y",{variants:{intent:{default:"divide-primary-300 dark:divide-primary-700",bordered:"divide-primary-300 rounded-lg border border-primary-300 bg-white px-3 shadow-sm dark:divide-primary-700 dark:border-primary-700 dark:bg-primary-800/50",ghost:"divide-transparent"}},defaultVariants:{intent:"default"}}),h=(0,s.cva)("flex",{variants:{intent:{line:"border-b border-primary-200 dark:border-primary-700",pills:"gap-1 rounded-lg bg-primary-100 p-1 dark:bg-primary-800",underline:"gap-4"}},defaultVariants:{intent:"line"}}),f=(0,s.cva)("inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",{variants:{intent:{line:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:data-[active=true]:text-primary-100",pills:"rounded-md text-primary-600 hover:text-primary-900 data-[active=true]:bg-white data-[active=true]:text-primary-900 data-[active=true]:shadow-sm dark:text-primary-400 dark:hover:text-primary-100 dark:data-[active=true]:bg-primary-700 dark:data-[active=true]:text-primary-100",underline:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:data-[active=true]:text-primary-100"}},defaultVariants:{intent:"line"}}),b=(0,s.cva)("rounded-lg bg-white p-6 shadow-xl dark:bg-primary-900",{variants:{size:{sm:"w-full max-w-sm",md:"w-full max-w-lg",lg:"w-full max-w-2xl",xl:"w-full max-w-4xl",full:"h-[calc(100vh-4rem)] w-[calc(100vw-4rem)]"}},defaultVariants:{size:"md"}}),g=(0,s.cva)("absolute z-50 rounded px-2 py-1 text-xs shadow-md animate-fade-in",{variants:{intent:{default:"bg-primary-900 text-white dark:bg-primary-100 dark:text-primary-900",light:"border border-primary-200 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-800 dark:text-primary-200"}},defaultVariants:{intent:"default"}}),y=(0,s.cva)("pointer-events-auto flex items-start gap-3 rounded-lg border p-4 shadow-lg transition-all",{variants:{intent:{success:"border-success-200 bg-success-50 text-success-800 dark:border-success-800 dark:bg-success-900/80 dark:text-success-200",warning:"border-warning-200 bg-warning-50 text-warning-800 dark:border-warning-800 dark:bg-warning-900/80 dark:text-warning-200",error:"border-danger-200 bg-danger-50 text-danger-800 dark:border-danger-800 dark:bg-danger-900/80 dark:text-danger-200",info:"border-primary-200 bg-primary-50 text-primary-800 dark:border-primary-800 dark:bg-primary-900/80 dark:text-primary-200"}},defaultVariants:{intent:"info"}}),v=require("react/jsx-runtime"),w=require("react");var k=e.n(w);function j({intent:e,size:t,className:r,...a}){return(0,v.jsx)("button",{className:n(i({intent:e,size:t}),r),...a})}const N=require("lucide-react");function C(e,t){for(const r of e){if(r.value===t)return r;if(r.children){const e=C(r.children,t);if(e)return e}}}function S(e){const t=[];for(const r of e)r.children?.length||t.push(r),r.children&&t.push(...S(r.children));return t}function E({options:e,onSelect:t,depth:r=0}){const[a,s]=(0,w.useState)(null),i=(0,w.useRef)(void 0),l=()=>{i.current=setTimeout(()=>s(null),150)};return(0,w.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]),(0,v.jsx)("div",{className:n("absolute z-50 min-w-44 rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white","animate-fade-in",0===r?"mt-1 w-full":"top-0 ml-0.5"),style:r>0?{left:"100%"}:void 0,role:"listbox",children:e.map(e=>{const o=!!e.children?.length,c=a===e.value;return(0,v.jsxs)("div",{className:"relative",onMouseEnter:()=>{return t=e.value,i.current&&clearTimeout(i.current),void s(t);var t},onMouseLeave:l,children:[(0,v.jsxs)("div",{role:"option","aria-selected":!1,"aria-disabled":e.disabled,className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",e.disabled&&"pointer-events-none opacity-50"),onClick:()=>{e.disabled||o||t(e.value,e)},children:[e.icon&&(0,v.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:e.icon}),(0,v.jsx)("span",{className:"flex-1 truncate",children:e.label??e.value}),o&&(0,v.jsx)(N.ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),o&&c&&(0,v.jsx)(E,{options:e.children,onSelect:t,depth:r+1})]},e.value)})})}function L({options:e,filter:t,multiple:r,selected:a,canAdd:s,onSelect:i,onToggle:l,onAdd:o}){const c=(0,w.useMemo)(()=>S(e),[e]),d=t.toLowerCase(),u=t?c.filter(e=>(e.label??e.value).toLowerCase().includes(d)||e.value.toLowerCase().includes(d)):c;return(0,v.jsxs)("div",{className:n("absolute z-50 mt-1 w-full max-h-60 min-w-44 overflow-y-auto rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white","animate-fade-in"),role:"listbox","aria-multiselectable":r||void 0,children:[u.map(e=>{const t=r&&a.includes(e.value);return(0,v.jsxs)("div",{role:"option","aria-selected":!!r&&t,"aria-disabled":e.disabled,className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",e.disabled&&"pointer-events-none opacity-50"),onClick:()=>{e.disabled||(r?l(e.value):i(e.value,e))},children:[r&&(0,v.jsx)("span",{className:n("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",t?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:t&&(0,v.jsx)(N.Check,{className:"h-3 w-3"})}),e.icon&&(0,v.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:e.icon}),(0,v.jsx)("span",{className:"truncate",children:e.label??e.value})]},e.value)}),0===u.length&&!s&&(0,v.jsx)("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",children:"No matches"}),s&&(0,v.jsxs)("div",{className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),onClick:o,children:[(0,v.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),(0,v.jsxs)("span",{className:"truncate",children:["Add “",t.trim(),"”"]})]})]})}function M(e){const{options:t,placeholder:r="Select…",editable:a=!1,onAddItem:s,disabled:i=!1,align:l="left",className:c}=e,d=!0===e.multiple,u=d?e.selected??[]:[],[m,x]=(0,w.useState)(!1),[p,h]=(0,w.useState)(""),f=(0,w.useRef)(null),b=(0,w.useRef)(null),g=d?void 0:e.value,y=(0,w.useMemo)(()=>g?C(t,g):void 0,[t,g]);(0,w.useEffect)(()=>{if(!m)return;const e=e=>{f.current&&!f.current.contains(e.target)&&(x(!1),h(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[m]),(0,w.useEffect)(()=>{if(!m)return;const e=e=>{"Escape"===e.key&&(x(!1),h(""))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[m]);const k=(0,w.useCallback)((t,r)=>{d||e.onChange?.(t,r),x(!1),h("")},[d,e]),j=(0,w.useCallback)(t=>{if(!d)return;const r=u.includes(t)?u.filter(e=>e!==t):[...u,t];e.onSelectionChange?.(r)},[d,u,e]),M=p.toLowerCase(),T=(0,w.useMemo)(()=>!(!a||!p.trim())&&!S(t).some(e=>e.value.toLowerCase()===M||(e.label??e.value).toLowerCase()===M),[a,M,t]),z=(0,w.useCallback)(()=>{const e=p.trim();e&&(s?.(e),h(""))},[p,s]),_=(0,w.useCallback)(e=>{"Enter"===e.key&&T&&(e.preventDefault(),z())},[T,z]),D=(0,w.useCallback)(()=>{i||(x(e=>{const t=!e;return t&&a&&requestAnimationFrame(()=>b.current?.focus()),t}),h(""))},[i,a]);let A;if(d){const e=u.length;A=0===e?"":e<=2?u.map(e=>C(t,e)).map(e=>e?e.label??e.value:"").filter(Boolean).join(", "):`${e} selected`}else A=y?y.label??y.value:"";const F=d||a;return(0,v.jsxs)("div",{ref:f,className:n("relative inline-block min-w-44",c),children:[(0,v.jsxs)("div",{className:n(o({state:"default",size:"md"}),"flex cursor-pointer items-center gap-1",i&&"pointer-events-none opacity-50"),onClick:D,role:"combobox","aria-expanded":m,"aria-haspopup":"listbox",children:[a?(0,v.jsx)("input",{ref:b,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-secondary-400 dark:placeholder:text-secondary-600",value:m?p:A,placeholder:r,disabled:i,onChange:e=>{h(e.target.value),m||x(!0)},onKeyDown:_,onClick:e=>{e.stopPropagation(),m||x(!0)}}):(0,v.jsx)("span",{className:n("flex-1 truncate",!A&&"text-secondary-400 dark:text-secondary-600"),children:A||r}),y?.icon&&!a&&!d&&(0,v.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:y.icon}),d&&u.length>0&&(0,v.jsx)("span",{className:"rounded-full bg-primary-100 px-1.5 text-xs font-semibold text-primary-700 dark:bg-primary-900 dark:text-primary-300",children:u.length}),(0,v.jsx)(N.ChevronDown,{className:n("text-primary-400 h-4 w-4 shrink-0 transition-transform",m&&"rotate-180")})]}),m&&(0,v.jsx)("div",{className:n("right"===l?"right-0":"left-0","absolute w-full"),children:F?(0,v.jsx)(L,{options:t,filter:p,multiple:d,selected:u,canAdd:T,onSelect:k,onToggle:j,onAdd:z}):(0,v.jsx)(E,{options:t,onSelect:k})})]})}function T({label:e,items:t,intent:r,size:a,align:s="left",className:l,disabled:o,editable:c=!1,onAddItem:d,multiple:u=!1,selected:m=[],onSelectionChange:x,...p}){const[h,f]=(0,w.useState)(!1),[b,g]=(0,w.useState)(""),y=(0,w.useRef)(null),j=(0,w.useRef)(null),C=(0,w.useCallback)(()=>{o||f(e=>{const t=!e;return t&&c&&requestAnimationFrame(()=>j.current?.focus()),t||g(""),t})},[o,c]);(0,w.useEffect)(()=>{if(!h)return;const e=e=>{y.current&&!y.current.contains(e.target)&&(f(!1),g(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[h]),(0,w.useEffect)(()=>{if(!h)return;const e=e=>{"Escape"===e.key&&(f(!1),g(""))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[h]);const S=b.toLowerCase(),E=(0,w.useMemo)(()=>b?t.filter(e=>("string"==typeof e.label?e.label:e.key??"").toLowerCase().includes(S)):t,[t,S]),L=(0,w.useMemo)(()=>!(!c||!b.trim()||t.some(e=>("string"==typeof e.label?e.label:e.key??"").toLowerCase()===S)),[c,S,t]),M=(0,w.useCallback)(()=>{const e=b.trim();e&&(d?.(e),g(""))},[b,d]),T=(0,w.useCallback)(e=>{"Enter"===e.key&&L&&(e.preventDefault(),M())},[L,M]),z=(0,w.useCallback)(e=>{const t=m.includes(e)?m.filter(t=>t!==e):[...m,e];x?.(t)},[m,x]),_=u&&m.length>0?(0,v.jsxs)(v.Fragment,{children:[e," ",(0,v.jsx)("span",{className:"ml-1 rounded-full bg-white/20 px-1.5 text-xs font-semibold",children:m.length})]}):e;return(0,v.jsxs)("div",{ref:y,className:"relative inline-block",children:[(0,v.jsxs)("button",{type:"button",onClick:C,disabled:o,className:n(i({intent:r,size:a}),"inline-flex items-center gap-1",l),"aria-haspopup":u?"listbox":"true","aria-expanded":h?"true":"false",...p,children:[_,(0,v.jsx)(N.ChevronDown,{className:n("h-3.5 w-3.5 transition-transform",h&&"rotate-180")})]}),h&&(0,v.jsxs)("div",{className:n("absolute z-50 mt-1 min-w-44 rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white","animate-fade-in","right"===s?"right-0":"left-0"),role:u?"listbox":"menu","aria-multiselectable":u||void 0,children:[c&&(0,v.jsx)("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children:(0,v.jsx)("input",{ref:j,type:"text",value:b,onChange:e=>g(e.target.value),onKeyDown:T,placeholder:"Type to filter or add…",className:"w-full bg-transparent text-sm text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600"})}),(0,v.jsxs)("div",{className:"max-h-60 overflow-y-auto",children:[E.map((e,t)=>{const r=function(e,t){return e.key??("string"==typeof e.label?e.label:String(t))}(e,t),a=u&&m.includes(r);return(0,v.jsxs)(k().Fragment,{children:[e.divider&&(0,v.jsx)("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),(0,v.jsxs)("button",{type:"button",role:u?"option":"menuitem","aria-selected":u?a:void 0,disabled:e.disabled,className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",e.disabled&&"pointer-events-none opacity-50"),onClick:()=>{u?z(r):(e.onClick?.(),f(!1),g(""))},children:[u&&(0,v.jsx)("span",{className:n("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",a?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:a&&(0,v.jsx)(N.Check,{className:"h-3 w-3"})}),(0,v.jsx)("span",{className:"flex-1 truncate",children:e.label})]})]},r)}),0===E.length&&!L&&(0,v.jsx)("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",children:"No matches"}),L&&(0,v.jsxs)("button",{type:"button",className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),onClick:M,children:[(0,v.jsx)("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),(0,v.jsxs)("span",{className:"truncate",children:["Add “",b.trim(),"”"]})]})]})]})]})}function z({intent:e,className:t,...r}){return(0,v.jsx)("span",{className:n(l({intent:e}),t),...r})}function _({intent:e,size:t,className:r,...a}){return(0,v.jsx)("label",{className:n(c({intent:e,size:t}),r),...a})}const D={sm:{wrapper:"h-7 text-xs",prefix:"px-2 text-xs [&_svg]:h-3 [&_svg]:w-3",input:"px-2 text-xs",icon:"px-1.5 [&_svg]:h-3 [&_svg]:w-3"},md:{wrapper:"h-9 text-sm",prefix:"px-3 text-sm [&_svg]:h-4 [&_svg]:w-4",input:"px-3 py-2 text-sm",icon:"px-2 [&_svg]:h-4 [&_svg]:w-4"},lg:{wrapper:"h-11 text-base",prefix:"px-4 text-base [&_svg]:h-5 [&_svg]:w-5",input:"px-4 py-2.5 text-base",icon:"px-2.5 [&_svg]:h-5 [&_svg]:w-5"}},A={default:"border-secondary-300 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus-within:border-danger-500 focus-within:ring-2 focus-within:ring-danger-500/20"};function F({state:e="default",inputSize:t="md",className:r,prefix:a,suffix:s,action:i,...l}){if(!a&&!s&&!i)return(0,v.jsx)("input",{className:n(o({state:e,size:t}),r),...l});const c=D[t??"md"],d=A[e??"default"];return(0,v.jsxs)("div",{className:n("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",c.wrapper,d,r),children:[a&&(0,v.jsx)("span",{className:n("flex shrink-0 items-center gap-1.5 self-stretch border-r border-secondary-300 bg-secondary-50 font-medium text-secondary-600 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300",c.prefix),children:a}),(0,v.jsx)("input",{className:n("min-w-0 flex-1 bg-transparent text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600",c.input,a&&"pl-2"),...l}),s&&(0,v.jsx)("span",{className:n("pointer-events-none flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",c.icon),children:s}),i&&(0,v.jsx)("button",{type:"button",onClick:i.onClick,"aria-label":i["aria-label"]??"Action",className:n("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",c.icon),children:i.icon})]})}function P({intent:e,size:t,className:r,...a}){return(0,v.jsx)("div",{className:n(d({intent:e,size:t}),r),...a})}function I({className:e,...t}){return(0,v.jsx)("div",{className:n("mb-4 space-y-1",e),...t})}function R({className:e,...t}){return(0,v.jsx)("h3",{className:n("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function V({className:e,...t}){return(0,v.jsx)("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function $({className:e,...t}){return(0,v.jsx)("div",{className:n("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function O({className:e,...t}){return(0,v.jsx)("div",{className:n("border-primary-100 dark:border-primary-800 mt-4 flex items-center gap-2 border-t pt-4",e),...t})}function K({intent:e,media:t,mediaPosition:r="left",className:a,children:s,...i}){const l=(0,v.jsx)("div",{className:n("relative shrink-0 overflow-hidden","left"===r?"rounded-l-lg":"rounded-r-lg"),style:{width:t.width??"10rem"},children:t.src?(0,v.jsx)("img",{src:t.src,alt:t.alt??"",className:"h-full w-full object-cover",draggable:!1}):t.icon?(0,v.jsx)("div",{className:"bg-primary-100 text-primary-500 dark:bg-primary-800 dark:text-primary-400 flex h-full w-full items-center justify-center",children:t.icon}):null});return(0,v.jsxs)("div",{className:n(d({intent:e}),"flex overflow-hidden p-0","right"===r&&"flex-row-reverse",a),...i,children:[l,(0,v.jsx)("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:s})]})}function B({src:e,alt:t="",aspectRatio:r="16/9",className:a,children:s,...i}){return(0,v.jsxs)("div",{className:n("group overflow-hidden rounded-xl border transition-shadow duration-300","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white","dark:hover:shadow-primary-900/60 hover:shadow-lg",a),...i,children:[(0,v.jsxs)("div",{className:"relative overflow-hidden",style:{aspectRatio:r},children:[(0,v.jsx)("img",{src:e,alt:t,className:"h-full w-full object-cover transition-transform duration-500 ease-out group-hover:scale-110",draggable:!1}),(0,v.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100","aria-hidden":!0,children:(0,v.jsx)("div",{className:"animate-light-sweep absolute inset-0"})})]}),s]})}function X({className:e,...t}){return(0,v.jsx)("div",{className:n("space-y-2 p-4",e),...t})}function q({className:e,...t}){return(0,v.jsx)("h3",{className:n("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function H({className:e,...t}){return(0,v.jsx)("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function U({className:e,...t}){return(0,v.jsx)("div",{className:n("border-primary-100 dark:border-primary-800 flex items-center gap-2 border-t px-4 py-3",e),...t})}function G({intent:e,size:t,className:r,...a}){return(0,v.jsx)("div",{className:n(u({intent:e,size:t}),r),...a})}function Y({className:e,...t}){return(0,v.jsx)("div",{className:n("border-primary-200 text-primary-900 dark:border-primary-700 dark:text-primary-100 mb-3 flex items-center gap-1.5 border-b pb-3 text-sm font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function W({className:e,...t}){return(0,v.jsx)("div",{className:n("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function Z({intent:e,className:t,...r}){return(0,v.jsx)("div",{className:"w-full overflow-auto",children:(0,v.jsx)("table",{className:n(m({intent:e}),t),...r})})}function J({className:e,...t}){return(0,v.jsx)("thead",{className:n("bg-primary-50 text-primary-600 dark:bg-primary-800/50 dark:text-primary-400",e),...t})}function Q({className:e,...t}){return(0,v.jsx)("tbody",{className:n("[&_tr:last-child]:border-0",e),...t})}function ee({className:e,...t}){return(0,v.jsx)("tr",{className:n("border-primary-200 hover:bg-primary-50/50 dark:border-primary-700 dark:hover:bg-primary-800/30 border-b transition-colors",e),...t})}function te({className:e,...t}){return(0,v.jsx)("th",{className:n("px-4 py-3 text-left text-xs font-semibold tracking-wider uppercase",e),...t})}function re({className:e,...t}){return(0,v.jsx)("td",{className:n("text-primary-700 dark:text-primary-300 px-4 py-3",e),...t})}function ae({columns:e,data:t,sort:r,onSortChange:a,defaultSort:s=null,rowKey:i,intent:l,className:o}){const[c,d]=(0,w.useState)(s),u=r??c,m=(0,w.useCallback)(e=>{const t=u?.column===e?"asc"===u.direction?{column:e,direction:"desc"}:null:{column:e,direction:"asc"};a?a(t):d(t)},[u,a]),x=(0,w.useMemo)(()=>{if(!u)return t;const r=e.find(e=>e.key===u.column);if(!r)return t;const a=r.compareFn??((e,t)=>{const a=r.cell(e),n=r.cell(t);return null==a&&null==n?0:null==a?-1:null==n?1:"number"==typeof a&&"number"==typeof n?a-n:String(a).localeCompare(String(n))}),n=[...t].sort(a);return"desc"===u.direction?n.reverse():n},[t,u,e]);return(0,v.jsxs)(Z,{intent:l,className:o,children:[(0,v.jsx)(J,{children:(0,v.jsx)(ee,{children:e.map(e=>{const t=!1!==e.sortable,r=u?.column===e.key;return(0,v.jsx)(te,{className:n(t&&"cursor-pointer select-none",e.headerClassName),onClick:t?()=>m(e.key):void 0,"aria-sort":r?"asc"===u.direction?"ascending":"descending":void 0,children:(0,v.jsxs)("span",{className:"inline-flex items-center gap-1",children:[e.header,t&&(0,v.jsx)(ie,{active:r,direction:r?u.direction:null})]})},e.key)})})}),(0,v.jsx)(Q,{children:x.map((t,r)=>(0,v.jsx)(ee,{children:e.map(e=>(0,v.jsx)(re,{className:e.cellClassName,children:e.cell(t)},e.key))},i?i(t,r):r))})]})}function ne({value:e,onCommit:t,onCancel:r}){const[a,n]=(0,w.useState)(e),s=(0,w.useRef)(null);(0,w.useEffect)(()=>{s.current?.focus(),s.current?.select()},[]);const i=()=>t(a);return(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)("input",{ref:s,type:"text",value:a,onChange:e=>n(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i(),"Escape"===e.key&&r()},"aria-label":"Edit cell",className:"min-w-0 flex-1 rounded border border-primary-400 bg-white px-1.5 py-0.5 text-sm outline-none focus:ring-1 focus:ring-primary-400 dark:border-primary-600 dark:bg-secondary-800"}),(0,v.jsx)("button",{type:"button",onClick:i,className:"text-success-600 hover:text-success-700 dark:text-success-400","aria-label":"Confirm",children:(0,v.jsx)(N.Check,{className:"h-3.5 w-3.5"})}),(0,v.jsx)("button",{type:"button",onClick:r,className:"text-danger-500 hover:text-danger-600 dark:text-danger-400","aria-label":"Cancel",children:(0,v.jsx)(N.X,{className:"h-3.5 w-3.5"})})]})}function se({columns:e,data:t,rowKey:r,sort:a,onSortChange:s,defaultSort:i=null,selectionMode:l="none",selected:o,onSelectionChange:c,editable:d=!1,onCellEdit:u,toolbar:m=!1,onAdd:x,onDelete:p,intent:h,className:f}){const[b,g]=(0,w.useState)(i),y=a??b,k=(0,w.useCallback)(e=>{const t=y?.column===e?"asc"===y.direction?{column:e,direction:"desc"}:null:{column:e,direction:"asc"};s?s(t):g(t)},[y,s]),j=(0,w.useMemo)(()=>{if(!y)return t;const r=e.find(e=>e.key===y.column);if(!r)return t;const a=r.compareFn??((e,t)=>{const a=r.cell(e),n=r.cell(t);return null==a&&null==n?0:null==a?-1:null==n?1:"number"==typeof a&&"number"==typeof n?a-n:String(a).localeCompare(String(n))}),n=[...t].sort(a);return"desc"===y.direction?n.reverse():n},[t,y,e]),[C,S]=(0,w.useState)([]),E=o??C,L=c??S,M=(0,w.useMemo)(()=>j.map((e,t)=>r(e,t)),[j,r]),T="multiple"===l&&M.length>0&&M.every(e=>E.includes(e)),z="multiple"===l&&E.length>0&&!T,_=(0,w.useCallback)(e=>{"single"===l?L(E.includes(e)?[]:[e]):"multiple"===l&&L(E.includes(e)?E.filter(t=>t!==e):[...E,e])},[l,E,L]),D=(0,w.useCallback)(()=>{L(T?[]:M)},[T,M,L]),[A,F]=(0,w.useState)(null),P=(0,w.useCallback)((e,t,r)=>{d&&!1!==r&&F({rowKey:e,colKey:t})},[d]),I=(0,w.useCallback)((e,t,r)=>{u?.(e,t,r),F(null)},[u]),R=m;return(0,v.jsxs)("div",{className:"space-y-2",children:[R&&(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,v.jsxs)("button",{type:"button",onClick:x,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[(0,v.jsx)(N.Plus,{className:"h-3.5 w-3.5"})," Add"]}),p&&(0,v.jsxs)("button",{type:"button",onClick:()=>p(E),disabled:0===E.length,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-danger-600 transition-colors hover:bg-danger-50 disabled:opacity-40 disabled:pointer-events-none dark:border-secondary-600 dark:bg-secondary-800 dark:text-danger-400 dark:hover:bg-danger-900/20",children:[(0,v.jsx)(N.Trash2,{className:"h-3.5 w-3.5"})," Delete",E.length>0&&` (${E.length})`]}),d&&1===E.length&&(0,v.jsxs)("button",{type:"button",onClick:()=>{const t=e.find(e=>!1!==e.editable);t&&F({rowKey:E[0],colKey:t.key})},className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[(0,v.jsx)(N.Pencil,{className:"h-3.5 w-3.5"})," Edit"]}),E.length>0&&(0,v.jsxs)("span",{className:"ml-auto text-sm text-secondary-500 dark:text-secondary-400",children:[E.length," row",E.length>1?"s":""," selected"]})]}),(0,v.jsxs)(Z,{intent:h,className:f,children:[(0,v.jsx)(J,{children:(0,v.jsxs)(ee,{children:["multiple"===l&&(0,v.jsx)(te,{className:"w-10",children:(0,v.jsx)("input",{type:"checkbox",checked:T,ref:e=>{e&&(e.indeterminate=z)},onChange:D,className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select all"})}),"single"===l&&(0,v.jsx)(te,{className:"w-10"}),e.map(e=>{const t=!1!==e.sortable,r=y?.column===e.key;return(0,v.jsx)(te,{className:n(t&&"cursor-pointer select-none",e.headerClassName),onClick:t?()=>k(e.key):void 0,"aria-sort":r?"asc"===y.direction?"ascending":"descending":void 0,children:(0,v.jsxs)("span",{className:"inline-flex items-center gap-1",children:[e.header,t&&(0,v.jsx)(ie,{active:r,direction:r?y.direction:null})]})},e.key)})]})}),(0,v.jsx)(Q,{children:j.map((t,a)=>{const s=r(t,a),i=E.includes(s);return(0,v.jsxs)(ee,{className:n(i&&"bg-primary-50/60 dark:bg-primary-900/20"),onClick:()=>{"none"!==l&&_(s)},children:["multiple"===l&&(0,v.jsx)(re,{className:"w-10",children:(0,v.jsx)("input",{type:"checkbox",checked:i,onChange:()=>_(s),onClick:e=>e.stopPropagation(),className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select row"})}),"single"===l&&(0,v.jsx)(re,{className:"w-10",children:(0,v.jsx)("input",{type:"radio",checked:i,onChange:()=>_(s),onClick:e=>e.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-primary-600","aria-label":"Select row"})}),e.map(e=>{const r=A?.rowKey===s&&A?.colKey===e.key,a=e.editValue?.(t)??(()=>{const r=e.cell(t);return"string"==typeof r||"number"==typeof r?String(r):""})();return(0,v.jsx)(re,{className:n(e.cellClassName,d&&!1!==e.editable&&"cursor-text"),onDoubleClick:t=>{t.stopPropagation(),P(s,e.key,e.editable)},children:r?(0,v.jsx)(ne,{value:a,onCommit:t=>I(s,e.key,t),onCancel:()=>F(null)}):e.cell(t)},e.key)})]},s)})})]})]})}function ie({active:e,direction:t}){const r="h-3.5 w-3.5 shrink-0";return e&&t?"asc"===t?(0,v.jsx)(N.ArrowUp,{className:n(r,"opacity-70")}):(0,v.jsx)(N.ArrowDown,{className:n(r,"opacity-70")}):(0,v.jsx)(N.ArrowUpDown,{className:n(r,"opacity-30")})}function le({intent:e,className:t,...r}){return(0,v.jsx)("ul",{className:n(x({intent:e}),t),...r})}function oe({className:e,...t}){return(0,v.jsx)("li",{className:n("flex items-center gap-1.5 [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",e),...t})}const ce=(0,w.createContext)({showLines:!0,expandedKeys:null,onToggleKey:()=>{}});function de({showLines:e=!0,showRoot:t=!0,expandedKeys:r,defaultExpandedKeys:a="all",onExpandedKeysChange:s,className:i,children:l,...o}){const[c,d]=(0,w.useState)(()=>a),u=(0,w.useCallback)(e=>{if(r){const t=new Set(r);t.has(e)?t.delete(e):t.add(e),s?.(t)}else d(t=>{if("all"===t)return new Set(["__ALL_MINUS__",e]);const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[r,s]),m=r??("all"===c?null:c);return(0,v.jsx)(ce.Provider,{value:{showLines:e,expandedKeys:m,onToggleKey:u},children:t?(0,v.jsx)("ul",{className:n("text-sm",i),role:"tree",...o,children:l}):(0,v.jsx)("ul",{className:n("text-sm",i),role:"tree",...o,children:(0,v.jsx)(ue,{children:l})})})}function ue({children:e}){const t=me(e);return(0,v.jsx)(v.Fragment,{children:t.map(e=>k().isValidElement(e)&&e.props.children?e.props.children:null)})}function me(e){const t=[];return k().Children.forEach(e,e=>{k().isValidElement(e)&&e.type===k().Fragment?t.push(...me(e.props.children)):t.push(e)}),t}function xe({nodeKey:e,label:t,icon:r,defaultExpanded:a=!1,expanded:s,onToggle:i,children:l,className:o}){const{showLines:c,expandedKeys:d,onToggleKey:u}=(0,w.useContext)(ce),[m,x]=(0,w.useState)(a),p=k().Children.count(l)>0,h=e??("string"==typeof t?t:"");let f;return f=null!=s?s:null!=d&&h?d.has("__ALL_MINUS__")?!d.has(h):d.has(h):m,(0,v.jsxs)("li",{className:n("select-none",o),role:"treeitem","aria-expanded":p?f:void 0,children:[(0,v.jsxs)("div",{className:n("hover:bg-primary-50 dark:hover:bg-primary-800/50 flex items-center gap-1 rounded-md px-1 py-1",p?"cursor-pointer":"cursor-default"),onClick:p?()=>{const e=!f;i?i(e):null!=d&&h?u(h):x(e)}:void 0,children:[p?(0,v.jsx)(N.ChevronRight,{className:n("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",f&&"rotate-90")}):(0,v.jsx)("span",{className:"w-4 shrink-0"}),r&&(0,v.jsx)("span",{className:"shrink-0",children:r}),(0,v.jsx)("span",{className:"text-primary-700 dark:text-primary-300 truncate",children:t})]}),p&&(0,v.jsx)("div",{className:n("grid transition-[grid-template-rows] duration-200 ease-out",f?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:(0,v.jsx)("div",{className:"overflow-hidden",children:(0,v.jsx)("ul",{className:n("ml-4 pl-2",c&&"border-primary-200 dark:border-primary-700 border-l"),role:"group",children:l})})})]})}function pe({avatar:e,sender:t}){return e?"string"==typeof e?/^(?:https?|data|blob):/.test(e)?(0,v.jsx)("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:!1}):(0,v.jsx)("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):(0,v.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):(0,v.jsx)("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function he({msg:e,alignRight:t}){return(0,v.jsxs)("div",{className:n("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[(0,v.jsx)(pe,{avatar:e.avatar,sender:e.sender}),(0,v.jsxs)("div",{className:n("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[(0,v.jsx)("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),(0,v.jsx)("div",{className:n("rounded-xl px-3 py-2 text-sm leading-relaxed",t?"rounded-tr-sm bg-primary-500 text-white dark:bg-primary-600":"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-200 rounded-tl-sm"),children:e.content}),e.time&&(0,v.jsx)("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function fe({messages:e,mode:t="split",autoScroll:r=!0,className:a,...s}){const i=(0,w.useRef)(null);return(0,w.useEffect)(()=>{r&&i.current?.scrollIntoView({behavior:"smooth"})},[e,r]),(0,v.jsxs)("div",{className:n("flex flex-col gap-4 overflow-y-auto rounded-lg border p-4","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white",a),...s,children:[e.map(e=>{const r="split"===t&&!!e.self;return(0,v.jsx)(he,{msg:e,alignRight:r},e.id)}),(0,v.jsx)("div",{ref:i})]})}const be=require("react-dom"),ge="flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors cursor-pointer",ye="bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100 font-medium",ve="text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200",we="flex items-center justify-center rounded-md p-2 transition-colors cursor-pointer text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200";function ke({to:e,className:t,style:r,children:a}){const n="function"==typeof t?t({isActive:!1}):t;return(0,v.jsx)("a",{href:e,className:n,style:r,children:a})}const je=["expanded","icons","mini"];function Ne(e){const t=new Set;for(const r of e)if(r.children&&r.children.length>0){t.add(r.key??r.label);for(const e of Ne(r.children))t.add(e)}return t}function Ce({item:e,basePath:t,depth:r,onItemClick:a,LinkComponent:s,showLines:i,expandedKeys:l,onToggle:o}){const c=e.key??e.label,d=e.children&&e.children.length>0,[u,m]=(0,w.useState)(e.defaultOpen??!0),x=l?l.has(c):u,p=(0,w.useCallback)(()=>{l?o(c):m(e=>!e)},[l,o,c]),h=r>0?1.25*r+"rem":void 0;if(d)return(0,v.jsxs)("div",{children:[(0,v.jsxs)("button",{type:"button",onClick:p,className:n(ge,ve,"justify-between"),style:{paddingLeft:h},children:[(0,v.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),(0,v.jsx)(N.ChevronRight,{className:n("h-3.5 w-3.5 transition-transform",x&&"rotate-90")})]}),x&&(0,v.jsx)("div",{className:n("flex flex-col gap-0.5 pt-0.5",i?"ml-2.5 border-l border-primary-200 dark:border-primary-700":"ml-2"),children:e.children.map(e=>(0,v.jsx)(Ce,{item:e,basePath:t,depth:r+1,onItemClick:a,LinkComponent:s,showLines:i,expandedKeys:l,onToggle:o},e.key??e.path??e.label))})]});if(null!=e.path){const r=t+e.path;return a?(0,v.jsxs)("button",{type:"button",onClick:()=>a(e,r),className:n(ge,ve),style:{paddingLeft:h},children:[e.icon,e.label]}):(0,v.jsxs)(s,{to:r,className:({isActive:e})=>n(ge,e?ye:ve),style:{paddingLeft:h},children:[e.icon,e.label]})}return(0,v.jsxs)("span",{className:n(ge,ve,"cursor-default"),style:{paddingLeft:h},children:[e.icon,e.label]})}function Se({item:e,basePath:t,onItemClick:r,LinkComponent:a}){const[s,i]=(0,w.useState)(!1),l=(0,w.useRef)(null),o=(0,w.useRef)(void 0),[c,d]=(0,w.useState)({top:0,left:0}),u=()=>{clearTimeout(o.current),i(!0)},m=()=>{o.current=setTimeout(()=>i(!1),200)};(0,w.useLayoutEffect)(()=>{if(s&&l.current){const e=l.current.getBoundingClientRect();d({top:e.top,left:e.right+4})}},[s]);const x=e.icon||(0,v.jsx)("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return(0,v.jsxs)("div",{onMouseEnter:u,onMouseLeave:m,children:[(0,v.jsx)("button",{ref:l,type:"button",className:n(we,"w-full"),title:e.label,onClick:()=>i(e=>!e),children:x}),s&&(0,be.createPortal)((0,v.jsxs)("div",{className:"fixed z-50 min-w-44 rounded-md border border-primary-200 bg-white p-1 shadow-lg dark:border-primary-700 dark:bg-primary-900",style:{top:c.top,left:c.left},onMouseEnter:u,onMouseLeave:m,children:[(0,v.jsx)("div",{className:"px-2.5 py-1.5 text-xs font-semibold uppercase text-primary-500 dark:text-primary-400",children:e.label}),(0,v.jsx)("div",{className:"flex flex-col gap-0.5",children:e.children?.map(e=>{const s=e.key??e.path??e.label;if(null!=e.path){const l=t+e.path;return r?(0,v.jsxs)("button",{type:"button",onClick:()=>{r(e,l),i(!1)},className:n(ge,ve),children:[e.icon,e.label]},s):(0,v.jsxs)(a,{to:l,className:({isActive:e})=>n(ge,e?ye:ve),children:[e.icon,e.label]},s)}return(0,v.jsxs)("span",{className:n(ge,"cursor-default text-primary-400"),children:[e.icon,e.label]},s)})})]}),document.body)]})}function Ee({item:e,basePath:t,onItemClick:r,LinkComponent:a}){const s=e.icon||(0,v.jsx)("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});if(null!=e.path){const i=t+e.path;return r?(0,v.jsx)("button",{type:"button",onClick:()=>r(e,i),className:n(we,"w-full"),title:e.label,children:s}):(0,v.jsx)(a,{to:i,className:({isActive:e})=>n(we,"w-full",e&&"bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100"),children:(0,v.jsx)("span",{title:e.label,children:s})})}return(0,v.jsx)("span",{className:n(we,"w-full cursor-default"),title:e.label,children:s})}function Le({items:e,title:t,basePath:r="/",onItemClick:a,LinkComponent:s=ke,collapsible:i,collapseMode:l,defaultCollapseMode:o="expanded",onCollapseModeChange:c,showLines:d=!0,expandedKeys:u,defaultExpandedKeys:m="all",onExpandedKeysChange:x,className:p,...h}){const[f,b]=(0,w.useState)(o),g=l??f,y=k().useMemo(()=>Ne(e),[e]),[j,C]=(0,w.useState)(()=>"all"===m?new Set(y):new Set(m)),S=u??null,E=S??j,L=(0,w.useCallback)(e=>{const t=new Set(E);t.has(e)?t.delete(e):t.add(e),C(t),x?.(t)},[E,x]),M=(0,w.useCallback)(()=>{const e=function(e){const t=je.indexOf(e);return je[(t+1)%je.length]}(g);b(e),c?.(e)},[g,c]);return(0,v.jsxs)("nav",{className:n("flex flex-col gap-0.5","mini"===g&&"items-center",p),...h,children:[i&&(0,v.jsx)("div",{className:n("flex shrink-0 mb-1","expanded"===g?"justify-end":"justify-center"),children:(0,v.jsx)("button",{type:"button",onClick:M,className:we,"aria-label":"mini"===g?"Expand sidebar":"Collapse sidebar",title:"mini"===g?"Expand sidebar":"Collapse sidebar",children:"mini"===g?(0,v.jsx)(N.Menu,{className:"h-5 w-5"}):(0,v.jsx)(N.ChevronsLeft,{className:"h-4 w-4"})})}),"expanded"===g&&(0,v.jsxs)(v.Fragment,{children:[t&&(0,v.jsx)("h2",{className:"text-primary-500 dark:text-primary-400 mb-3 text-sm font-semibold uppercase",children:t}),e.map(e=>(0,v.jsx)(Ce,{item:e,basePath:r,depth:0,onItemClick:a,LinkComponent:s,showLines:d,expandedKeys:S,onToggle:L},e.key??e.path??e.label))]}),"icons"===g&&e.map(e=>{const t=e.key??e.path??e.label;return e.children&&e.children.length>0?(0,v.jsx)(Se,{item:e,basePath:r,onItemClick:a,LinkComponent:s},t):(0,v.jsx)(Ee,{item:e,basePath:r,onItemClick:a,LinkComponent:s},t)})]})}function Me({href:e,className:t,onClick:r,children:a}){return(0,v.jsx)("a",{href:e,className:t,onClick:r,children:a})}function Te({brand:e,onBrandClick:t,navItems:r=[],actions:a=[],linkComponent:s=Me,height:i="h-12",className:l,children:o}){return(0,v.jsxs)("header",{className:n("flex shrink-0 items-center justify-between border-b px-5","border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",i,l),children:[(0,v.jsxs)("div",{className:"flex items-center gap-6",children:[e&&(0,v.jsx)("div",{className:n("text-lg font-bold text-primary-800 dark:text-primary-100",t&&"cursor-pointer"),onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,onKeyDown:t?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t(e))}:void 0,children:e}),r.length>0&&(0,v.jsx)("nav",{className:"flex items-center gap-4 text-sm",children:r.map((e,t)=>{const r="string"==typeof e.label?e.label:t,a=e.active?"text-primary-900 font-medium dark:text-primary-100":"text-primary-500 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-200 transition-colors";return e.href?(0,v.jsx)(s,{href:e.href,className:a,onClick:e.onClick,children:e.label},r):(0,v.jsx)("button",{type:"button",className:n(a,"cursor-pointer"),onClick:e.onClick,children:e.label},r)})})]}),o&&(0,v.jsx)("div",{className:"flex items-center",children:o}),a.length>0&&(0,v.jsx)("div",{className:"flex items-center gap-1",children:a.map((e,t)=>{const r="rounded-md p-1.5 text-primary-500 hover:bg-primary-100 hover:text-primary-700 dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-200 transition-colors [&_svg]:h-5 [&_svg]:w-5";return e.href?(0,v.jsx)("a",{href:e.href,target:e.external?"_blank":void 0,rel:e.external?"noopener noreferrer":void 0,className:r,"aria-label":e["aria-label"],onClick:e.onClick,children:e.icon},e.key??t):(0,v.jsx)("button",{type:"button",className:r,"aria-label":e["aria-label"],onClick:e.onClick,children:e.icon},e.key??t)})})]})}const ze=(0,w.createContext)(null),_e=(0,w.createContext)(null);function De({type:e="single",defaultValue:t=[],value:r,onValueChange:a,intent:s,className:i,children:l,...o}){const[c,d]=(0,w.useState)(t),u=r??c,m=(0,w.useCallback)(t=>{const r=r=>r.includes(t)?r.filter(e=>e!==t):"single"===e?[t]:[...r,t];a?a(r(u)):d(r)},[e,u,a]);return(0,v.jsx)(ze.Provider,{value:{expandedItems:u,toggleItem:m},children:(0,v.jsx)("div",{className:n(p({intent:s}),i),...o,children:l})})}function Ae({value:e,className:t,children:r,...a}){const s=(0,w.useContext)(ze),i=s?.expandedItems.includes(e)??!1;return(0,v.jsx)(_e.Provider,{value:{value:e,isExpanded:i},children:(0,v.jsx)("div",{className:n("",t),...a,children:r})})}function Fe({className:e,children:t,...r}){const a=(0,w.useContext)(ze),s=(0,w.useContext)(_e);return(0,v.jsxs)("button",{className:n("text-primary-800 hover:text-primary-600 dark:text-primary-100 dark:hover:text-primary-300 flex w-full cursor-pointer items-center justify-between gap-2 py-3 text-sm font-medium transition-colors [&>svg]:shrink-0",e),onClick:()=>s&&a?.toggleItem(s.value),"aria-expanded":s?.isExpanded?"true":"false",...r,children:[(0,v.jsx)("span",{className:"flex items-center gap-1.5 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:t}),(0,v.jsx)(N.ChevronDown,{className:n("h-4 w-4 shrink-0 transition-transform duration-200",s?.isExpanded&&"rotate-180")})]})}function Pe({className:e,children:t,...r}){const a=(0,w.useContext)(_e);return(0,v.jsx)("div",{className:n("grid transition-[grid-template-rows] duration-200 ease-out",a?.isExpanded?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:(0,v.jsx)("div",{className:"overflow-hidden",children:(0,v.jsx)("div",{className:n("text-primary-500 dark:text-primary-400 pb-3 text-sm",e),...r,children:t})})})}const Ie=(0,w.createContext)(null),Re=(0,w.createContext)(!1);function Ve({defaultValue:e="",value:t,onValueChange:r,intent:a,children:n,className:s}){const[i,l]=(0,w.useState)(e),o=t??i,c=(0,w.useRef)(new Map),d=(0,w.useCallback)(e=>{r?r(e):l(e)},[r]),u=(0,w.useCallback)((e,t)=>{t?c.current.set(e,t):c.current.delete(e)},[]);return(0,v.jsx)(Ie.Provider,{value:{activeValue:o,setActiveValue:d,intent:a,registerTrigger:u},children:(0,v.jsx)("div",{className:s,children:n})})}function $e({className:e,...t}){const r=(0,w.useContext)(Ie),a=(0,w.useRef)(null),[s,i]=(0,w.useState)(null),l=(0,w.useCallback)(()=>{if(!r||!a.current)return;const e=a.current.querySelectorAll('[role="tab"][data-active="true"]')[0];if(!e)return void i(null);const t=a.current.getBoundingClientRect(),n=e.getBoundingClientRect();i({left:n.left-t.left,width:n.width})},[r]);(0,w.useLayoutEffect)(l,[r?.activeValue,l]),(0,w.useEffect)(()=>{const e=new ResizeObserver(l);return a.current&&e.observe(a.current),()=>e.disconnect()},[l]);const o=r?.intent??"line",c=s&&("line"===o||"underline"===o);return(0,v.jsxs)("div",{ref:a,className:n(h({intent:r?.intent}),"relative",e),role:"tablist",...t,children:[t.children,c&&(0,v.jsx)("span",{className:"absolute bottom-0 h-0.5 rounded-full bg-primary-600 dark:bg-primary-400 transition-all duration-300 ease-in-out",style:{left:s.left,width:s.width},"aria-hidden":!0})]})}function Oe({value:e,className:t,children:r,...a}){const s=(0,w.useContext)(Ie),i=s?.activeValue===e,l=(0,w.useCallback)(t=>s?.registerTrigger(e,t),[s,e]);return(0,v.jsx)("button",{ref:l,className:n(f({intent:s?.intent}),t),role:"tab","data-active":i,"aria-selected":i,onClick:()=>s?.setActiveValue(e),...a,children:r})}function Ke({className:e,children:t,...r}){const a=(0,w.useContext)(Ie);if(!a)return null;const s=k().Children.toArray(t).filter(e=>k().isValidElement(e)),i=Math.max(0,s.findIndex(e=>e.props.value===a.activeValue));return(0,v.jsx)("div",{className:n("overflow-hidden",e),...r,children:(0,v.jsx)(Re.Provider,{value:!0,children:(0,v.jsx)("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${100*i}%)`},children:s.map((e,t)=>(0,v.jsx)("div",{className:"w-full shrink-0","aria-hidden":t!==i,children:e},e.props.value??t))})})})}function Be({value:e,className:t,children:r,...a}){const s=(0,w.useContext)(Ie);return(0,w.useContext)(Re)?(0,v.jsx)("div",{className:n("pt-4",t),role:"tabpanel",...a,children:r}):s?.activeValue!==e?null:(0,v.jsx)("div",{className:n("pt-4",t),role:"tabpanel",...a,children:r})}const Xe=[];function qe(e){return Xe.length>0&&Xe[Xe.length-1]===e}const He=(0,w.createContext)(null);function Ue({open:e,onOpenChange:t,modal:r=!0,closeOnOutsideClick:a=!1,children:n}){const s=(0,w.useId)();return(0,w.useEffect)(()=>{if(e)return function(e){Xe.push(e)}(s),()=>function(e){const t=Xe.indexOf(e);-1!==t&&Xe.splice(t,1)}(s)},[e,s]),(0,w.useEffect)(()=>{if(!e||!r)return;const a=e=>{"Escape"===e.key&&qe(s)&&t(!1)};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,r,t,s]),(0,w.useEffect)(()=>{if(!e||!r)return;const t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=t}},[e,r]),e?(0,v.jsx)(He.Provider,{value:{id:s,onOpenChange:t,modal:r,closeOnOutsideClick:a},children:(0,be.createPortal)(n,document.body)}):null}function Ge({size:e,className:t,children:r,...a}){const s=(0,w.useContext)(He);if(!s)return null;const i=200+10*function(e){const t=Xe.indexOf(e);return-1!==t?t:Xe.length}(s.id);return s.modal?(0,v.jsx)("div",{className:"animate-fade-in fixed inset-0 flex items-center justify-center bg-black/50 p-4",style:{zIndex:i},onClick:()=>{s.closeOnOutsideClick&&qe(s.id)&&s.onOpenChange(!1)},children:(0,v.jsx)("div",{className:n(b({size:e}),"animate-scale-in",t),role:"dialog","aria-modal":"true",onClick:e=>e.stopPropagation(),...a,children:r})}):(0,v.jsx)("div",{className:n("fixed inset-0 flex items-center justify-center p-4",s.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:i},onClick:s.closeOnOutsideClick&&qe(s.id)?()=>s.onOpenChange(!1):void 0,children:(0,v.jsx)("div",{className:n(b({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",t),role:"dialog",onClick:s.closeOnOutsideClick?e=>e.stopPropagation():void 0,...a,children:r})})}function Ye({className:e,...t}){return(0,v.jsx)("div",{className:n("mb-4 space-y-1",e),...t})}function We({className:e,...t}){return(0,v.jsx)("h2",{className:n("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",e),...t})}function Ze({className:e,...t}){return(0,v.jsx)("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Je({className:e,...t}){return(0,v.jsx)("div",{className:n("mt-6 flex justify-end gap-2",e),...t})}function Qe({className:e,...t}){const r=(0,w.useContext)(He);return(0,v.jsx)("button",{className:n("text-primary-400 hover:text-primary-600 dark:hover:text-primary-200 absolute top-4 right-4 rounded-md p-1 transition-colors",e),onClick:()=>r?.onOpenChange(!1),"aria-label":"Close",...t,children:(0,v.jsx)(N.X,{className:"h-4 w-4"})})}const et={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};function tt({content:e,position:t="top",intent:r,delay:a=200,children:s,className:i}){const[l,o]=(0,w.useState)(!1),[c,d]=(0,w.useState)();return(0,v.jsxs)("span",{className:"relative inline-flex",onMouseEnter:()=>{const e=setTimeout(()=>o(!0),a);d(e)},onMouseLeave:()=>{clearTimeout(c),o(!1)},children:[s,l&&(0,v.jsx)("span",{className:n(g({intent:r}),et[t],"pointer-events-none whitespace-nowrap",i),role:"tooltip",children:e})]})}const rt=require("react-dom/client");function at({intent:e,className:t,children:r,...a}){return(0,v.jsx)("div",{className:n(y({intent:e}),t),role:"alert",...a,children:r})}function nt({className:e,...t}){return(0,v.jsx)("h5",{className:n("flex items-center gap-1.5 font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function st({className:e,...t}){return(0,v.jsx)("p",{className:n("text-sm opacity-90",e),...t})}let it=0,lt=[];const ot=new Map,ct=new Set;function dt(){return lt}function ut(){ct.forEach(e=>e())}function mt(e){const t=ot.get(e);t&&(clearTimeout(t),ot.delete(e)),lt=lt.map(t=>t.id===e?{...t,exiting:!0}:t),ut(),setTimeout(()=>{lt=lt.filter(t=>t.id!==e),ut()},200)}function xt(e){const t="alert-"+ ++it;lt=[...lt,{...e,id:t}],ut();const r=e.duration??5e3;if(r>0){const e=setTimeout(()=>{ot.delete(t),mt(t)},r);ot.set(t,e)}return t}let pt=16;function ht(e){pt=e}const ft={"top-right":"right-4 items-end","top-left":"left-4 items-start","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","top-center":"left-1/2 -translate-x-1/2 items-center","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},bt={"top-right":"animate-slide-in-right","top-left":"animate-slide-in-left","bottom-right":"animate-slide-in-right","bottom-left":"animate-slide-in-left","top-center":"animate-slide-in-top","bottom-center":"animate-slide-in-bottom"},gt={success:N.CircleCheck,warning:N.TriangleAlert,error:N.CircleX,info:N.Info};function yt({alert:e,onClose:t}){const r=e.intent??"info",a=gt[r],s=e.position??"top-right";return(0,v.jsxs)("div",{className:n(y({intent:r}),bt[s],e.exiting&&"opacity-0 transition-opacity duration-200","w-80"),role:"alert",children:[(0,v.jsx)(a,{className:"mt-0.5 h-5 w-5 shrink-0"}),(0,v.jsxs)("div",{className:"flex-1",children:[e.title&&(0,v.jsx)("p",{className:"font-semibold",children:e.title}),(0,v.jsx)("p",{className:n(e.title&&"text-sm opacity-90"),children:e.message})]}),(0,v.jsx)("button",{onClick:t,"aria-label":"Close notification",className:"shrink-0 cursor-pointer opacity-50 transition-opacity hover:opacity-100",children:(0,v.jsx)(N.X,{className:"h-4 w-4"})})]})}const vt=e=>e.startsWith("top");function wt(){const e=(0,w.useSyncExternalStore)(e=>(ct.add(e),()=>ct.delete(e)),dt),t=(0,w.useRef)(pt);if((0,w.useEffect)(()=>{t.current=pt},[]),0===e.length)return null;const r=e.reduce((e,t)=>{const r=t.position??"top-right";return(e[r]??(e[r]=[])).push(t),e},{});return(0,be.createPortal)((0,v.jsx)(v.Fragment,{children:Object.entries(r).map(([e,r])=>(0,v.jsx)("div",{style:vt(e)?{top:`${t.current}px`}:void 0,className:n("pointer-events-none fixed z-100 flex flex-col gap-2",ft[e]),children:r.map(e=>(0,v.jsx)(yt,{alert:e,onClose:()=>mt(e.id)},e.id))},e))}),document.body)}let kt=!1;function jt(){return(0,w.useEffect)(()=>{!function(){if(kt)return;kt=!0;const e=document.createElement("div");e.id="alert-toast-root",document.body.appendChild(e),(0,rt.createRoot)(e).render((0,v.jsx)(wt,{}))}()},[]),{addAlert:xt,removeAlert:mt}}const Nt="#1c1914",Ct="#130f0b",St="#2e261e",Et="#504638",Lt="#6b5d4d",Mt="url(\"data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")",Tt=[{key:"like",icon:(0,v.jsx)(N.Heart,{className:"h-5 w-5"}),activeIcon:(0,v.jsx)(N.Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:!0},{key:"dislike",icon:(0,v.jsx)(N.ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:(0,v.jsx)(N.Bookmark,{className:"h-5 w-5"}),activeIcon:(0,v.jsx)(N.Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:!0},{key:"share",icon:(0,v.jsx)(N.Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:(0,v.jsx)(N.Download,{className:"h-5 w-5"}),label:"Download"}];function zt({photos:e,layout:t="strip",actions:r=Tt,onAction:a,className:n,showGrain:s=!0,sheetTitle:i,sheetLabel:l}){const[o,c]=(0,w.useState)(null),[d,u]=(0,w.useState)(new Set),m=(0,w.useCallback)(e=>c(e),[]),x=(0,w.useCallback)(()=>c(null),[]),p=(0,w.useCallback)((t,n)=>{const s=r.find(e=>e.key===t);if(s?.toggle){const e=`${n}-${t}`;u(t=>{const r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})}a?.(t,e[n],n)},[r,a,e]),h="strip"===t?Dt:"sheet"===t?At:Ft;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(h,{photos:e,onPhotoClick:m,showGrain:s,className:n,sheetTitle:i,sheetLabel:l}),null!==o&&(0,be.createPortal)((0,v.jsx)(Pt,{photos:e,currentIndex:o,onIndexChange:c,onClose:x,actions:r,activeActions:d,onAction:p,showGrain:s}),document.body)]})}function _t({count:e=30}){return(0,v.jsx)("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Nt},children:Array.from({length:e}).map((e,t)=>(0,v.jsx)("div",{className:"rounded-xs",style:{width:12,height:8,background:St}},t))})}function Dt({photos:e,onPhotoClick:t,showGrain:r,className:a}){const s=(0,w.useRef)(null);return(0,v.jsxs)("div",{className:n("select-none rounded-lg overflow-hidden",a),style:{background:Ct},children:[(0,v.jsx)(_t,{count:Math.max(30,6*e.length)}),(0,v.jsx)("div",{ref:s,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:Nt,scrollSnapType:"x mandatory"},children:e.map((e,a)=>(0,v.jsxs)("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(a),children:[(0,v.jsxs)("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:Et,width:280,height:187},children:[(0,v.jsx)("img",{src:e.src,alt:e.alt??e.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:!1}),(0,v.jsx)("div",{className:"pointer-events-none absolute inset-0 mix-blend-multiply opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"rgba(255, 175, 60, 0.06)"}}),r&&(0,v.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:Mt,animation:"film-grain-shift 0.6s steps(5) infinite"}}),(0,v.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-30 transition-opacity duration-300 group-hover:opacity-50",style:{background:"radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%)"}})]}),(0,v.jsxs)("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:Lt},children:[String(a+1).padStart(2,"0"),a%2==0?"":"A"]})]},a))}),(0,v.jsx)(_t,{count:Math.max(30,6*e.length)})]})}function At({photos:e,onPhotoClick:t,showGrain:r,className:a,sheetTitle:s,sheetLabel:i}){return(0,v.jsxs)("div",{className:n("rounded-lg p-5",a),style:{background:Ct},children:[(0,v.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,v.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:Lt},children:s??`JAC·Film 35mm · ${e.length} exposures`}),(0,v.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:Lt},children:i??"Contact Sheet"})]}),(0,v.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((e,a)=>(0,v.jsxs)("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${50*a}ms both`},onClick:()=>t(a),children:[(0,v.jsx)("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:Lt},children:String(a+1).padStart(2,"0")}),(0,v.jsxs)("div",{className:"relative overflow-hidden rounded-[1px] border transition-all duration-300 group-hover:border-amber-600/50 group-hover:shadow-[0_0_20px_rgba(217,171,89,0.15)]",style:{borderColor:Et,aspectRatio:"3/2"},children:[(0,v.jsx)("img",{src:e.src,alt:e.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:!1}),r&&(0,v.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Mt}}),(0,v.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 translate-y-full bg-linear-to-t from-black/70 to-transparent p-2 pt-6 transition-transform duration-300 group-hover:translate-y-0",children:(0,v.jsx)("span",{className:"text-xs font-medium text-white/90",children:e.title})})]})]},a))})]})}function Ft({photos:e,onPhotoClick:t,showGrain:r,className:a}){const[s,i]=(0,w.useState)(!1),[l,o]=(0,w.useState)(null),c=Math.min(e.length,8),d=e.slice(0,c),u=e=>{const t=1e4*Math.sin(137.508*e+1);return`rotate(${(t%12-6).toFixed(1)}deg) translate(${(t/7%8-4).toFixed(1)}px, ${(t/13%6-3).toFixed(1)}px)`},m=(e,t)=>{const r=(t-1)/2,a=(7*(e-r)).toFixed(1);return`translateX(${(110*(e-r)).toFixed(0)}px) translateY(${(10*-Math.abs(e-r)+(l===e?-18:0)).toFixed(0)}px) rotate(${a}deg)`};return(0,v.jsxs)("div",{className:n("flex flex-col items-center gap-4",a),children:[(0,v.jsx)("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>i(!0),onMouseLeave:()=>{i(!1),o(null)},children:d.map((e,a)=>(0,v.jsx)("div",{className:"absolute cursor-pointer rounded-lg shadow-xl transition-all duration-500",style:{transitionTimingFunction:"cubic-bezier(0.34, 1.56, 0.64, 1)",transitionDelay:s?35*a+"ms":25*(c-a)+"ms",transform:s?m(a,d.length):u(a),zIndex:s?a+1:d.length-a,width:220,height:147},onClick:()=>t(a),onMouseEnter:()=>s&&o(a),onMouseLeave:()=>o(null),children:(0,v.jsxs)("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:s&&l===a?"rgba(217,171,89,0.5)":Et,boxShadow:s&&l===a?"0 25px 50px rgba(0,0,0,0.5), 0 0 30px rgba(217,171,89,0.1)":"0 10px 30px rgba(0,0,0,0.4)"},children:[(0,v.jsx)("img",{src:e.src,alt:e.alt??"",className:"h-full w-full object-cover",draggable:!1}),r&&(0,v.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Mt}}),(0,v.jsx)("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%)"}}),s&&l===a&&(0,v.jsx)("div",{className:"absolute inset-x-0 bottom-0 bg-linear-to-t from-black/80 to-transparent p-3 pt-8",style:{animation:"reveal-up 0.25s ease-out"},children:(0,v.jsx)("span",{className:"text-sm font-medium text-white/90",children:e.title})})]})},a))}),e.length>c&&(0,v.jsxs)("span",{className:"font-mono text-xs",style:{color:Lt},children:["+ ",e.length-c," more"]}),(0,v.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:Lt,opacity:s?0:.7},children:"Hover to explore"})]})}function Pt({photos:e,currentIndex:t,onIndexChange:r,onClose:a,actions:s,activeActions:i,onAction:l,showGrain:o}){const c=e[t],[d,u]=(0,w.useState)(1),[m,x]=(0,w.useState)({x:0,y:0}),[p,h]=(0,w.useState)(!1),[f,b]=(0,w.useState)(!1),g=(0,w.useRef)(!1),y=(0,w.useRef)({x:0,y:0}),k=(0,w.useRef)(null);(0,w.useLayoutEffect)(()=>{requestAnimationFrame(()=>b(!0))},[]),(0,w.useEffect)(()=>{const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[]),(0,w.useEffect)(()=>{const e=e=>{switch(e.key){case"Escape":a();break;case"ArrowLeft":j(-1);break;case"ArrowRight":j(1);break;case"i":case"I":h(e=>!e)}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),(0,w.useEffect)(()=>{const e=k.current;if(!e)return;const t=e=>{e.preventDefault();const t=e.deltaY<0?1.12:.89;u(e=>{const r=Math.min(8,Math.max(1,e*t));return r<=1&&x({x:0,y:0}),r})};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]);const j=(0,w.useCallback)(a=>{const n=t+a;n>=0&&n<e.length&&(r(n),u(1),x({x:0,y:0}))},[t,e.length,r]),C=(0,w.useCallback)(e=>{d<=1||(g.current=!0,y.current={x:e.clientX,y:e.clientY},e.target.setPointerCapture(e.pointerId))},[d]),S=(0,w.useCallback)(e=>{if(!g.current)return;const t=e.clientX-y.current.x,r=e.clientY-y.current.y;y.current={x:e.clientX,y:e.clientY},x(e=>({x:e.x+t/d,y:e.y+r/d}))},[d]),E=(0,w.useCallback)(()=>{g.current=!1},[]),L=(0,w.useCallback)(()=>{d>1?(u(1),x({x:0,y:0})):u(2.5)},[d]),M=c.metadata;return(0,v.jsxs)("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[(0,v.jsx)("div",{className:"absolute inset-0 bg-black/95",onClick:a}),o&&(0,v.jsx)("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:Mt,animation:"film-grain-shift 0.6s steps(5) infinite"}}),(0,v.jsxs)("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[(0,v.jsxs)("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsxs)("span",{className:"mr-2 font-mono text-xs text-white/40",children:[d.toFixed(1),"x"]}),(0,v.jsx)("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>u(e=>Math.min(8,1.3*e)),title:"Zoom in",children:(0,v.jsx)(N.ZoomIn,{className:"h-4 w-4"})}),(0,v.jsx)("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{u(e=>{const t=Math.max(1,.7*e);return t<=1&&x({x:0,y:0}),t})},title:"Zoom out",children:(0,v.jsx)(N.ZoomOut,{className:"h-4 w-4"})}),(0,v.jsx)("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:a,title:"Close",children:(0,v.jsx)(N.X,{className:"h-5 w-5"})})]})]}),(0,v.jsxs)("div",{ref:k,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:d>1?"grab":"default"},onPointerDown:C,onPointerMove:S,onPointerUp:E,onDoubleClick:L,children:[(0,v.jsx)("img",{src:c.src,alt:c.alt??c.title??"",className:"max-h-full max-w-full select-none object-contain",style:{animation:"lightbox-photo-in 0.35s cubic-bezier(0.16, 1, 0.3, 1)",transform:`scale(${d}) translate(${m.x}px, ${m.y}px)`,transition:g.current?"none":"transform 0.15s ease-out"},draggable:!1},t),t>0&&(0,v.jsx)("button",{className:"absolute left-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:e=>{e.stopPropagation(),j(-1)},children:(0,v.jsx)(N.ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&(0,v.jsx)("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:e=>{e.stopPropagation(),j(1)},children:(0,v.jsx)(N.ChevronRight,{className:"h-6 w-6"})})]}),(0,v.jsx)("div",{className:n("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",p?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:(0,v.jsxs)("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[c.title&&(0,v.jsx)("h3",{className:"mb-3 text-xl font-semibold text-white",children:c.title}),c.description&&(0,v.jsx)("p",{className:"mb-4 max-w-xl border-l-2 border-amber-500/40 pl-4 text-sm leading-relaxed text-white/60 italic",style:{animation:"reveal-up 0.4s ease-out 0.1s both"},children:c.description}),M&&(0,v.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[M.camera&&(0,v.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,v.jsx)(N.Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",M.camera,M.lens&&(0,v.jsx)("span",{className:"text-white/40",children:"·"}),M.lens&&M.lens]}),(M.aperture||M.shutter||M.iso)&&(0,v.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,v.jsx)(N.Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[M.aperture,M.shutter,M.iso&&`ISO ${M.iso}`].filter(Boolean).join(" · ")]}),M.date&&(0,v.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,v.jsx)(N.Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",M.date]}),M.location&&(0,v.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,v.jsx)(N.MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",M.location]})]})]})}),(0,v.jsx)("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:(0,v.jsxs)("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[s.map(e=>{const r=e.toggle&&(a=e.key,i.has(`${t}-${a}`));var a;return(0,v.jsx)("button",{className:n("rounded-full p-2.5 transition-all duration-200",r?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>l(e.key,t),title:e.label,children:r&&e.activeIcon?e.activeIcon:e.icon},e.key)}),(0,v.jsx)("div",{className:"mx-1 h-5 w-px bg-white/10"}),(0,v.jsx)("button",{className:n("rounded-full p-2.5 transition-all duration-200",p?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>h(e=>!e),title:"Photo info (I)",children:(0,v.jsx)(N.Info,{className:"h-5 w-5"})})]})})]})}const It="data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">\n <rect width="200" height="200" fill="#1e1b2e"/>\n <circle cx="100" cy="100" r="60" fill="none" stroke="#6366f1" stroke-width="1.5" opacity="0.3"/>\n <circle cx="100" cy="100" r="20" fill="none" stroke="#6366f1" stroke-width="1" opacity="0.4"/>\n <text x="100" y="108" text-anchor="middle" font-family="monospace" font-size="18" fill="#6366f1" opacity="0.6">♪</text>\n </svg>');function Rt(e){return!isFinite(e)||e<0?"0:00":`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,"0")}`}const Vt={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},$t={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Ot={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function Kt({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:a,theme:s,docked:i=!1,visible:l,onVisibleChange:o,onTrackChange:c,onLike:d,autoPlay:u=!0,shuffle:m=!1,loop:x=!1,accent:p="#8b5cf6",className:h}){const[f,b]=(0,w.useState)(t),[g,y]=(0,w.useState)(!1),[k,j]=(0,w.useState)(0),[C,S]=(0,w.useState)(0),[E,L]=(0,w.useState)(.8),[M,T]=(0,w.useState)(!1),[z,_]=(0,w.useState)(new Set),[D,A]=(0,w.useState)(!1),[F,P]=(0,w.useState)(l??!i),[I,R]=(0,w.useState)(!1),[V,$]=(0,w.useState)(!1),[O,K]=(0,w.useState)(m),[B,X]=(0,w.useState)(x),q=(0,w.useRef)(!1),H=(0,w.useRef)(null),U=(0,w.useRef)(null),G=(0,w.useRef)(void 0),Y=l??F,W=a??((Z=r).startsWith("bottom")?"bottom":Z.startsWith("top")?"top":"right");var Z;const J=e[f],Q=i,ee="dark"===s?"dark":"light"===s?"light":"",te="text-(--mp-text)",re="text-(--mp-text-muted)",ae="text-(--accent)",ne="border-(--mp-border)";(0,w.useEffect)(()=>{const e=H.current;e&&(e.src=J.src,e.load(),g&&e.play().catch(()=>{}))},[f,J.src]),(0,w.useEffect)(()=>{if(!u||q.current)return;const e=H.current;if(!e)return;const t=()=>{q.current=!0,y(!0),e.play().catch(()=>{})};return e.addEventListener("canplaythrough",t,{once:!0}),()=>e.removeEventListener("canplaythrough",t)},[u]),(0,w.useEffect)(()=>{const e=H.current;e&&(g?e.play().catch(()=>{}):e.pause())},[g]),(0,w.useEffect)(()=>{const e=H.current;e&&(e.volume=M?0:E)},[E,M]),(0,w.useEffect)(()=>{const e=H.current;if(!e)return;const t=()=>j(e.currentTime),r=()=>S(e.duration),a=()=>{B?(e.currentTime=0,e.play().catch(()=>{})):ie()};return e.addEventListener("timeupdate",t),e.addEventListener("loadedmetadata",r),e.addEventListener("ended",a),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("loadedmetadata",r),e.removeEventListener("ended",a)}},[f,e.length]);const se=(0,w.useCallback)(t=>{const r=(t%e.length+e.length)%e.length;b(r),j(0),c?.(r,e[r]),Y||(P(!0),o?.(!0))},[e,Y,c,o]),ie=(0,w.useCallback)(()=>{if(O){let t;do{t=Math.floor(Math.random()*e.length)}while(t===f&&e.length>1);se(t)}else se(f+1)},[se,f,O,e.length]),le=(0,w.useCallback)(()=>{if(O){let t;do{t=Math.floor(Math.random()*e.length)}while(t===f&&e.length>1);se(t)}else se(f-1)},[se,f,O,e.length]),oe=(0,w.useCallback)(()=>{const e=z.has(f);_(t=>{const r=new Set(t);return e?r.delete(f):r.add(f),r}),d?.(f,J,!e)},[f,z,d,J]),ce=(0,w.useCallback)(e=>{const t=e.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(1,(e.clientX-t.left)/t.width))*C;H.current&&(H.current.currentTime=r),j(r)},[C]),de=(0,w.useCallback)(()=>{R(!0);const e=Q?200:400;G.current=setTimeout(()=>{R(!1),P(!1),o?.(!1)},e)},[Q,o]);(0,w.useEffect)(()=>()=>{G.current&&clearTimeout(G.current)},[]);const ue=V?"fade-in 0.2s ease-out both":`mp-enter-${W} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,me=V?"fade-in 0.2s ease-in reverse both":`mp-exit-${W} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,xe=C>0?k/C*100:0;return!Q||Y||I?Y||I?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("audio",{ref:H,preload:"metadata"}),(0,v.jsx)("div",{className:n("fixed z-100",Q?$t[r]:Vt[r],ee),style:{"--accent":p,...I?{animation:me}:{animation:ue}},onMouseEnter:()=>{Q&&(G.current&&(clearTimeout(G.current),G.current=void 0),I&&R(!1),$(!0))},onMouseLeave:()=>{Q&&($(!1),de())},children:(0,v.jsxs)("div",{className:n("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl","bg-(--mp-bg)",ne,Q&&"rounded-none",r.endsWith("right")&&Q&&"rounded-l-2xl",r.endsWith("left")&&Q&&"rounded-r-2xl",h),children:[(0,v.jsxs)("div",{className:"relative",children:[(0,v.jsx)("div",{className:"absolute inset-0 overflow-hidden",children:(0,v.jsx)("img",{src:J.cover||It,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:!1})}),(0,v.jsxs)("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[(0,v.jsxs)("div",{className:"relative h-14 w-14 shrink-0",children:[(0,v.jsxs)("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:g?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[(0,v.jsx)("img",{src:J.cover||It,alt:J.album??J.title,className:"h-full w-full object-cover",draggable:!1}),(0,v.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,v.jsx)("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),g&&(0,v.jsx)("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),(0,v.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,v.jsx)("div",{className:n("truncate text-sm font-semibold",te),children:J.title}),J.artist&&(0,v.jsx)("div",{className:n("truncate text-xs",re),children:J.artist}),J.album&&(0,v.jsx)("div",{className:n("mt-0.5 truncate text-[10px] tracking-wide",re,"opacity-60"),children:J.album})]}),(0,v.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,v.jsx)("button",{className:n("rounded-full p-1.5 transition-all duration-200",z.has(f)?"text-rose-500 hover:text-rose-400":n(re,"hover:text-rose-500")),onClick:oe,title:"Like",children:(0,v.jsx)(N.Heart,{className:"h-4 w-4",fill:z.has(f)?"currentColor":"none"})}),(0,v.jsx)("button",{className:n("rounded-full p-1.5 transition-colors",re,"hover:"+te.split(" ")[0]),onClick:()=>A(e=>!e),title:"Playlist",children:(0,v.jsx)(N.ListMusic,{className:"h-4 w-4"})}),!Q&&(0,v.jsx)("button",{className:n("rounded-full p-1.5 transition-colors",re,"hover:"+te.split(" ")[0]),onClick:de,title:"Dismiss",children:(0,v.jsx)(N.X,{className:"h-3.5 w-3.5"})})]})]})]}),(0,v.jsxs)("div",{className:"px-4",children:[(0,v.jsxs)("div",{ref:U,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:ce,children:[(0,v.jsx)("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${xe}%`}}),(0,v.jsx)("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${xe}% - 6px)`}})]}),(0,v.jsxs)("div",{className:n("mt-1 flex justify-between text-[10px] font-mono",re),children:[(0,v.jsx)("span",{children:Rt(k)}),(0,v.jsx)("span",{children:Rt(C)})]})]}),(0,v.jsxs)("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[(0,v.jsx)("button",{className:n("rounded-full p-1.5 transition-colors",O?ae:re,"hover:text-(--mp-text)"),onClick:()=>K(e=>!e),title:O?"Shuffle On":"Shuffle Off",children:(0,v.jsx)(N.Shuffle,{className:"h-3.5 w-3.5"})}),(0,v.jsx)("button",{className:n("rounded-full p-1.5 transition-colors",B?ae:re,"hover:text-(--mp-text)"),onClick:()=>X(e=>!e),title:B?"Loop On":"Loop Off",children:(0,v.jsx)(N.Repeat1,{className:"h-3.5 w-3.5"})}),(0,v.jsx)("button",{className:n("rounded-full p-2 transition-colors",re,"hover:text-(--mp-text)"),onClick:le,title:"Previous",children:(0,v.jsx)(N.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),(0,v.jsx)("button",{className:n("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>y(e=>!e),title:g?"Pause":"Play",children:g?(0,v.jsx)(N.Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):(0,v.jsx)(N.Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),(0,v.jsx)("button",{className:n("rounded-full p-2 transition-colors",re,"hover:text-(--mp-text)"),onClick:ie,title:"Next",children:(0,v.jsx)(N.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),(0,v.jsxs)("div",{className:"ml-2 flex items-center gap-1.5",children:[(0,v.jsx)("button",{className:n("rounded-full p-1 transition-colors",re,"hover:text-(--mp-text)"),onClick:()=>T(e=>!e),title:M?"Unmute":"Mute",children:M||0===E?(0,v.jsx)(N.VolumeX,{className:"h-3.5 w-3.5"}):(0,v.jsx)(N.Volume2,{className:"h-3.5 w-3.5"})}),(0,v.jsx)("input",{type:"range",min:0,max:1,step:.01,value:M?0:E,onChange:e=>{L(Number(e.target.value)),M&&T(!1)},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),(0,v.jsx)("div",{className:n("overflow-hidden transition-all duration-300 ease-in-out",D?"max-h-60":"max-h-0"),children:(0,v.jsx)("div",{className:n("border-t px-2 py-2",ne),children:(0,v.jsx)("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((e,t)=>{const r=t===f;return(0,v.jsxs)("button",{className:n("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",r?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{se(t),y(!0)},children:[(0,v.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:r&&g?(0,v.jsx)("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(e=>(0,v.jsx)("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:8+4*e+"px",animation:`mp-eq-bar ${.4+.15*e}s ease-in-out infinite alternate`}},e))}):r?(0,v.jsx)(N.Disc3,{className:n("h-4 w-4",ae)}):(0,v.jsx)("span",{className:n("text-xs font-mono",re),children:t+1})}),(0,v.jsx)("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:(0,v.jsx)("img",{src:e.cover||It,alt:"",className:"h-full w-full object-cover",draggable:!1})}),(0,v.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,v.jsx)("div",{className:n("truncate text-xs font-medium",r?ae:te),children:e.title}),e.artist&&(0,v.jsx)("div",{className:n("truncate text-[10px]",re),children:e.artist})]}),z.has(t)&&(0,v.jsx)(N.Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},t)})})})})]})})]}):(0,v.jsx)("audio",{ref:H,preload:"metadata"}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("audio",{ref:H,preload:"metadata"}),(0,v.jsxs)("div",{className:n("fixed z-100 cursor-pointer transition-all duration-300",Ot[r]),style:{"--accent":p},onMouseEnter:()=>{$(!0),P(!0),o?.(!0)},children:[(0,v.jsx)("div",{className:n("h-full w-full rounded-full",g?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:g?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),g&&(0,v.jsx)("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]})}function Bt(e){if(!isFinite(e)||e<0)return"0:00";const t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=Math.floor(e%60);return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}const Xt={title:(e,t)=>e.title.localeCompare(t.title),type:(e,t)=>(e.type??"").localeCompare(t.type??""),duration:(e,t)=>(e.duration??0)-(t.duration??0)};function qt({playlist:e,initialTrack:t=0,autoPlay:r=!1,shuffle:a=!1,loop:s=!1,onTrackChange:i,onPlayChange:l,accent:o="#8b5cf6",className:c}){const[d,u]=(0,w.useState)(t),[m,x]=(0,w.useState)(!1),[p,h]=(0,w.useState)(0),[f,b]=(0,w.useState)(0),[g,y]=(0,w.useState)(0),[j,C]=(0,w.useState)(.8),[S,E]=(0,w.useState)(!1),[L,M]=(0,w.useState)(a),[T,z]=(0,w.useState)(s),[_,D]=(0,w.useState)(!1),[A,F]=(0,w.useState)("title"),[P,I]=(0,w.useState)(!0),[R,V]=(0,w.useState)(!1),[$,O]=(0,w.useState)(!1),[K,B]=(0,w.useState)(!1),[X,q]=(0,w.useState)(!0),[H,U]=(0,w.useState)(!1),[G,Y]=(0,w.useState)(null),W=(0,w.useRef)(null),Z=(0,w.useRef)(null),J=(0,w.useRef)(void 0),Q=(0,w.useRef)(!1),ee=e[d],te=k().useMemo(()=>{const t=e.map((e,t)=>({media:e,originalIndex:t}));return t.sort((e,t)=>{const r=Xt[A](e.media,t.media);return P?r:-r}),t},[e,A,P]);(0,w.useEffect)(()=>{const e=W.current;if(!e)return;U(!0),e.src=ee.src,ee.poster&&(e.poster=ee.poster),e.load();const t=()=>{U(!1),m&&e.play().catch(()=>{})};return e.addEventListener("loadeddata",t,{once:!0}),()=>e.removeEventListener("loadeddata",t)},[d,ee.src]),(0,w.useEffect)(()=>{if(!r||Q.current)return;const e=W.current;if(!e)return;const t=()=>{Q.current=!0,x(!0),e.play().catch(()=>{})};return e.addEventListener("canplaythrough",t,{once:!0}),()=>e.removeEventListener("canplaythrough",t)},[r]),(0,w.useEffect)(()=>{const e=W.current;e&&(m?e.play().catch(()=>{}):e.pause(),l?.(m))},[m]),(0,w.useEffect)(()=>{const e=W.current;e&&(e.volume=S?0:j)},[j,S]),(0,w.useEffect)(()=>{const e=W.current;if(!e)return;const t=()=>h(e.currentTime),r=()=>b(e.duration),a=()=>{e.buffered.length>0&&y(e.buffered.end(e.buffered.length-1))},n=()=>{T?(e.currentTime=0,e.play().catch(()=>{})):ne()};return e.addEventListener("timeupdate",t),e.addEventListener("loadedmetadata",r),e.addEventListener("progress",a),e.addEventListener("ended",n),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("loadedmetadata",r),e.removeEventListener("progress",a),e.removeEventListener("ended",n)}},[d,e.length,T]);const re=(0,w.useCallback)(()=>{q(!0),J.current&&clearTimeout(J.current),J.current=setTimeout(()=>{m&&q(!1)},3e3)},[m]);(0,w.useEffect)(()=>{m?re():(q(!0),J.current&&clearTimeout(J.current))},[m,re]),(0,w.useEffect)(()=>()=>{J.current&&clearTimeout(J.current)},[]);const ae=(0,w.useCallback)(t=>{const r=(t%e.length+e.length)%e.length;u(r),h(0),x(!0),i?.(r,e[r])},[e,i]),ne=(0,w.useCallback)(()=>{if(L){let t;do{t=Math.floor(Math.random()*e.length)}while(t===d&&e.length>1);ae(t)}else ae(d+1)},[ae,d,L,e.length]),se=(0,w.useCallback)(()=>{if(L){let t;do{t=Math.floor(Math.random()*e.length)}while(t===d&&e.length>1);ae(t)}else ae(d-1)},[ae,d,L,e.length]),ie=(0,w.useCallback)(e=>{const t=e.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(1,(e.clientX-t.left)/t.width))*f;W.current&&(W.current.currentTime=r),h(r)},[f]),le=(0,w.useCallback)(e=>{const t=e.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(1,(e.clientX-t.left)/t.width));Y(r*f)},[f]),oe=(0,w.useCallback)(()=>{Z.current&&(document.fullscreenElement?document.exitFullscreen():Z.current.requestFullscreen())},[]);(0,w.useEffect)(()=>{const e=()=>B(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]);const ce=(0,w.useCallback)(()=>{R?(O(!0),setTimeout(()=>{V(!1),O(!1)},500)):V(!0)},[R]),de=(0,w.useCallback)(()=>{D(e=>!e)},[]),ue=(0,w.useCallback)(()=>{const e=["title","type","duration"],t=e.indexOf(A);P?I(!1):(I(!0),F(e[(t+1)%e.length]))},[A,P]);(0,w.useEffect)(()=>{const e=e=>{if(!(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))switch(e.key){case" ":case"k":e.preventDefault(),x(e=>!e);break;case"f":e.preventDefault(),oe();break;case"t":e.preventDefault(),ce();break;case"ArrowLeft":e.preventDefault(),W.current&&(W.current.currentTime=Math.max(0,p-5));break;case"ArrowRight":e.preventDefault(),W.current&&(W.current.currentTime=Math.min(f,p+5));break;case"ArrowUp":e.preventDefault(),C(e=>Math.min(1,e+.05));break;case"ArrowDown":e.preventDefault(),C(e=>Math.max(0,e-.05));break;case"Escape":R&&ce();break;case"n":e.preventDefault(),ne();break;case"p":e.preventDefault(),se();break;case"l":e.preventDefault(),de()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[oe,ce,de,ne,se,p,f,R]);const me=f>0?p/f*100:0,xe=f>0?g/f*100:0,pe="text-(--accent)",he=(0,v.jsxs)("div",{ref:Z,className:n("group flex overflow-hidden",K?"h-full w-full":"aspect-video w-full",!K&&"rounded-xl",!K&&m&&"shadow-2xl",!K&&!m&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",c),style:{"--accent":o,background:"var(--cp-bg)"},tabIndex:0,children:[(0,v.jsxs)("div",{className:n("relative flex-1 min-w-0 h-full overflow-hidden",H&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:re,onMouseLeave:()=>{m&&q(!1)},children:[(0,v.jsx)("video",{ref:W,className:"h-full w-full object-contain",poster:ee.poster,playsInline:!0,preload:"metadata",onClick:()=>x(e=>!e)}),!m&&!H&&(0,v.jsx)("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>x(!0),children:(0,v.jsx)("div",{className:"flex h-20 w-20 items-center justify-center rounded-full backdrop-blur-md transition-transform hover:scale-110 active:scale-95",style:{background:"var(--cp-surface-hover)"},children:(0,v.jsx)(N.Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),H&&(0,v.jsx)("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:(0,v.jsxs)("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[(0,v.jsx)("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:ee.title}),ee.subtitle&&(0,v.jsx)("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:ee.subtitle})]})}),(0,v.jsx)("div",{className:n("absolute inset-x-0 top-0 z-10 bg-linear-to-b from-black/70 to-transparent px-5 pb-8 pt-4 transition-opacity duration-500",X?"opacity-100":"pointer-events-none opacity-0"),children:(0,v.jsxs)("div",{className:"flex items-center justify-between",children:[(0,v.jsxs)("div",{children:[(0,v.jsx)("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:ee.title}),ee.subtitle&&(0,v.jsx)("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:ee.subtitle})]}),ee.type&&(0,v.jsx)("span",{className:"rounded-full bg-(--accent)/70 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider backdrop-blur-sm",style:{color:"var(--cp-text-strong)"},children:ee.type})]})}),(0,v.jsxs)("div",{className:n("absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/80 via-black/40 to-transparent px-4 pb-3 pt-10 transition-all duration-500",X?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[(0,v.jsxs)("div",{className:"group/seek relative mb-3 h-1 cursor-pointer rounded-full transition-[height] duration-200 hover:h-1.5",style:{background:"var(--cp-seek-track)"},onClick:ie,onMouseMove:le,onMouseLeave:()=>Y(null),children:[(0,v.jsx)("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${xe}%`,background:"var(--cp-seek-buffer)"}}),(0,v.jsx)("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${me}%`}}),null!==G&&(0,v.jsx)("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:G/f*100+"%",background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:Bt(G)}),(0,v.jsx)("div",{className:"absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2 rounded-full border-2 border-(--accent) bg-white opacity-0 shadow-lg transition-opacity group-hover/seek:opacity-100",style:{left:`calc(${me}% - 7px)`}})]}),(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)("button",{className:"cp-btn",onClick:()=>x(e=>!e),title:m?"Pause (k)":"Play (k)",children:m?(0,v.jsx)(N.Pause,{className:"h-5 w-5",fill:"currentColor"}):(0,v.jsx)(N.Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),(0,v.jsx)("button",{className:"cp-btn",onClick:se,title:"Previous (p)",children:(0,v.jsx)(N.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),(0,v.jsx)("button",{className:"cp-btn",onClick:ne,title:"Next (n)",children:(0,v.jsx)(N.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),(0,v.jsxs)("div",{className:"group/vol ml-1 flex items-center",children:[(0,v.jsx)("button",{className:"cp-btn",onClick:()=>E(e=>!e),title:S?"Unmute":"Mute",children:S||0===j?(0,v.jsx)(N.VolumeX,{className:"h-4 w-4"}):(0,v.jsx)(N.Volume2,{className:"h-4 w-4"})}),(0,v.jsx)("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:(0,v.jsx)("input",{type:"range",min:0,max:1,step:.01,value:S?0:j,onChange:e=>{C(Number(e.target.value)),S&&E(!1)},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),(0,v.jsxs)("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[Bt(p)," / ",Bt(f)]}),(0,v.jsx)("div",{className:"flex-1"}),(0,v.jsx)("button",{className:n("cp-btn",L&&pe),onClick:()=>M(e=>!e),title:"Shuffle",children:(0,v.jsx)(N.Shuffle,{className:"h-4 w-4"})}),(0,v.jsx)("button",{className:n("cp-btn",T&&pe),onClick:()=>z(e=>!e),title:"Loop",children:(0,v.jsx)(N.Repeat1,{className:"h-4 w-4"})}),(0,v.jsx)("button",{className:n("cp-btn",_&&pe),onClick:de,title:"Playlist",children:(0,v.jsx)(N.ListVideo,{className:"h-4 w-4"})}),(0,v.jsx)("button",{className:n("cp-btn",R&&pe),onClick:ce,title:"Cinema mode (t)",children:(0,v.jsx)(N.Theater,{className:"h-4 w-4"})}),(0,v.jsx)("button",{className:"cp-btn",onClick:oe,title:"Fullscreen (f)",children:K?(0,v.jsx)(N.Minimize,{className:"h-4 w-4"}):(0,v.jsx)(N.Maximize,{className:"h-4 w-4"})})]})]})]}),(0,v.jsx)("div",{className:n("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",_?"w-72":"w-0"),children:(0,v.jsxs)("div",{className:"flex h-full w-72 flex-col backdrop-blur-xl",style:{borderLeft:"1px solid var(--cp-border)",background:"var(--cp-panel-bg)"},children:[(0,v.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[(0,v.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsxs)("button",{className:"flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors",style:{color:"var(--cp-text-muted)"},onClick:ue,title:`Sort: ${A} ${P?"↑":"↓"}`,children:[(0,v.jsx)(N.ArrowUpDown,{className:"h-3 w-3"}),A,P?" ↑":" ↓"]}),(0,v.jsx)("button",{className:"cp-btn p-1!",onClick:de,title:"Close",children:(0,v.jsx)(N.X,{className:"h-3.5 w-3.5"})})]})]}),(0,v.jsx)("div",{className:"flex-1 overflow-y-auto",children:te.map(({media:e,originalIndex:t})=>{const r=t===d;return(0,v.jsxs)("button",{className:n("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",r?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:r?void 0:{color:"var(--cp-text)"},onClick:()=>{ae(t)},children:[(0,v.jsxs)("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[e.poster?(0,v.jsx)("img",{src:e.poster,alt:"",className:"h-full w-full object-cover",draggable:!1}):(0,v.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,v.jsx)(N.Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),r&&m&&(0,v.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:(0,v.jsx)("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(e=>(0,v.jsx)("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:6+3*e+"px",animation:`mp-eq-bar ${.3+.12*e}s ease-in-out infinite alternate`}},e))})})]}),(0,v.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,v.jsx)("div",{className:"truncate text-xs font-medium",children:e.title}),(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[e.type&&(0,v.jsx)("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:e.type}),null!=e.duration&&(0,v.jsx)("span",{className:"font-mono text-[10px] opacity-40",children:Bt(e.duration)})]})]}),r&&(0,v.jsx)(N.ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},t)})})]})}),(0,v.jsx)("style",{children:"\n .cp-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 6px;\n border-radius: 9999px;\n color: var(--cp-text);\n transition: color 0.15s, background 0.15s, transform 0.15s;\n }\n .cp-btn:hover { color: var(--cp-text-strong); background: var(--cp-surface-hover); }\n .cp-btn:active { transform: scale(0.9); }\n @keyframes cp-glow-pulse {\n 0%, 100% { box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 25%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }\n 50% { box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 55%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }\n }\n "})]});return(0,v.jsx)("div",{className:n(R&&"fixed inset-0 z-100 flex items-center justify-center p-8",R&&($?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:R?e=>{e.target===e.currentTarget&&ce()}:void 0,children:(0,v.jsx)("div",{className:n(R&&"w-full",R&&!K&&"max-w-5xl"),children:he})})}function Ht(e){const t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Ut(e){return null==e?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(2)} GB`}function Gt(e){return e?("string"==typeof e?new Date(e):e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}const Yt={".png":N.Image,".jpg":N.Image,".jpeg":N.Image,".gif":N.Image,".svg":N.Image,".webp":N.Image,".ico":N.Image,".bmp":N.Image,".mp3":N.Music,".wav":N.Music,".flac":N.Music,".ogg":N.Music,".aac":N.Music,".m4a":N.Music,".mp4":N.Video,".mkv":N.Video,".avi":N.Video,".mov":N.Video,".wmv":N.Video,".webm":N.Video,".ts":N.FileCode,".tsx":N.FileCode,".js":N.FileCode,".jsx":N.FileCode,".json":N.FileCode,".html":N.FileCode,".css":N.FileCode,".scss":N.FileCode,".py":N.FileCode,".rs":N.FileCode,".go":N.FileCode,".java":N.FileCode,".c":N.FileCode,".cpp":N.FileCode,".h":N.FileCode,".sh":N.Terminal,".bat":N.Terminal,".ps1":N.Terminal,".md":N.FileText,".txt":N.FileText,".pdf":N.FileText,".doc":N.FileText,".docx":N.FileText,".rtf":N.FileText,".csv":N.FileSpreadsheet,".xls":N.FileSpreadsheet,".xlsx":N.FileSpreadsheet,".db":N.Database,".sqlite":N.Database,".sql":N.Database,".zip":N.FileArchive,".tar":N.FileArchive,".gz":N.FileArchive,".rar":N.FileArchive,".7z":N.FileArchive};function Wt(e){if("directory"===e.type)return N.Folder;const t=e.extension||Ht(e.name);return Yt[t]||N.File}function Zt(e,t,r){return Math.max(t,Math.min(r,e))}function Jt({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:a="list",initialPosition:s,initialSize:i,dockable:l=!1,dockSide:o="right",visible:c=!0,onFileOpen:d,onSelectionChange:u,onNavigate:m,onDelete:x,onClose:p,onMinimize:h,onPathSubmit:f,defaultInputMode:b="search",actions:g,resizable:y=!0,minSize:C={width:400,height:300},className:S}){const[E,L]=(0,w.useState)(a),[M,T]=(0,w.useState)(new Set),[z,_]=(0,w.useState)(null),[D,A]=(0,w.useState)(!1),[F,P]=(0,w.useState)(!1),[I,R]=(0,w.useState)(""),[V,$]=(0,w.useState)(b),[O,K]=(0,w.useState)(c),[B,X]=(0,w.useState)(!1),q=i??{width:720,height:520},[H,U]=(0,w.useState)(s??{x:Math.max(0,Math.round((window.innerWidth-q.width)/2)),y:Math.max(0,Math.round((window.innerHeight-q.height)/2))}),[G,Y]=(0,w.useState)(q),[W,Z]=(0,w.useState)(null),J=(0,w.useRef)(!1),Q=(0,w.useRef)({x:0,y:0}),ee=(0,w.useRef)(null),te=(0,w.useRef)(!1),re=(0,w.useRef)({x:0,y:0,w:0,h:0,px:0,py:0}),ae=void 0!==c?c:O,ne=(0,w.useMemo)(()=>{const t=e.filter(e=>"directory"===e.type),r=e.filter(e=>"file"===e.type);return t.sort((e,t)=>e.name.localeCompare(t.name)),r.sort((e,t)=>e.name.localeCompare(t.name)),[...t,...r]},[e]),se=(0,w.useMemo)(()=>{if("search"!==V||!I.trim())return ne;const e=I.toLowerCase();return ne.filter(t=>t.name.toLowerCase().includes(e))},[ne,I,V]),ie=null!=z?se[z]:null,le=(0,w.useCallback)((e,t)=>{T(r=>{const a=new Set(r);return t.ctrlKey||t.metaKey?a.has(e)?a.delete(e):a.add(e):(a.clear(),a.add(e)),a}),_(e)},[]);(0,w.useEffect)(()=>{if(!u)return;const e=Array.from(M).map(e=>se[e]).filter(Boolean);u(e)},[M]);const oe=(0,w.useCallback)(e=>{const t=se[e];t&&("directory"===t.type?m?.(t.path):d?.(t))},[se,d,m]),ce=(0,w.useCallback)(e=>{D||e.target.closest("button")||(J.current=!0,Q.current={x:e.clientX-H.x,y:e.clientY-H.y},e.preventDefault())},[H,D]);(0,w.useEffect)(()=>{const e=e=>{if(!J.current)return;const t=window.innerWidth-100,r=window.innerHeight-40;U({x:Zt(e.clientX-Q.current.x,0,t),y:Zt(e.clientY-Q.current.y,0,r)})},t=()=>{J.current=!1,te.current=!1,document.body.style.cursor="",document.body.style.userSelect=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[]);const de=(0,w.useCallback)((e,t)=>{D||(t.preventDefault(),t.stopPropagation(),te.current=e,re.current={x:t.clientX,y:t.clientY,w:G.width,h:G.height,px:H.x,py:H.y},document.body.style.cursor="e"===e||"w"===e?"ew-resize":"n"===e||"s"===e?"ns-resize":"nw"===e||"se"===e?"nwse-resize":"nesw-resize",document.body.style.userSelect="none")},[D,G,H]);(0,w.useEffect)(()=>{const e=e=>{if(!te.current)return;const t=te.current,r=e.clientX-re.current.x,a=e.clientY-re.current.y;let{w:n,h:s,px:i,py:l}=re.current;if(t.includes("e")&&(n=Math.max(C.width,n+r)),t.includes("w")){const e=Math.max(C.width,n-r);i+=n-e,n=e}if(t.includes("s")&&(s=Math.max(C.height,s+a)),t.includes("n")){const e=Math.max(C.height,s-a);l+=s-e,s=e}Y({width:n,height:s}),U({x:i,y:l})},t=()=>{te.current=!1,document.body.style.cursor="",document.body.style.userSelect=""};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[C]);const ue=(0,w.useCallback)(()=>{D?(W&&(U(W.pos),Y(W.size)),A(!1)):(Z({pos:H,size:G}),A(!0))},[D,H,G,W]),me=(0,w.useCallback)(()=>{F?P(!1):(D&&(A(!1),W&&(U(W.pos),Y(W.size))),P(!0),h?.())},[F,D,W,h]);(0,w.useEffect)(()=>{if(!ae||F)return;const e=e=>{if(ee.current?.contains(document.activeElement)||document.activeElement===ee.current){if("Escape"===e.key&&(_(null),T(new Set)),e.ctrlKey&&"a"===e.key){e.preventDefault();const t=new Set(se.map((e,t)=>t));T(t)}"Delete"===e.key&&M.size>0&&x&&(e.preventDefault(),X(!0))}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ae,F,se,M,x]);const xe={"--fe-accent":r};return F?(0,v.jsx)("div",{className:n("fixed z-100 cursor-pointer transition-all duration-300","right"===o?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:xe,onClick:()=>P(!1),title:`Restore ${t}`,children:(0,v.jsxs)("div",{className:"fe-dock flex items-center gap-1.5 rounded-l-lg px-2 py-3 backdrop-blur-md",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:[(0,v.jsx)(N.HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),(0,v.jsx)("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})}):ae?(0,v.jsxs)("div",{ref:ee,className:n("fe-window fixed z-100 flex flex-col overflow-hidden","rounded-xl border border-(--fe-border)","animate-[fe-window-in_0.35s_cubic-bezier(0.16,1,0.3,1)_both]",D&&"rounded-none",S),style:{...xe,left:D?0:H.x,top:D?0:H.y,width:D?"100vw":G.width,height:D?"100vh":G.height,transition:D?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[(0,v.jsxs)("div",{className:"fe-titlebar group/titlebar flex h-10 shrink-0 cursor-grab items-center justify-between px-3 select-none active:cursor-grabbing",onMouseDown:ce,onDoubleClick:ue,children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)("div",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:"color-mix(in srgb, var(--fe-accent) 25%, transparent)"},children:(0,v.jsx)(N.HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),(0,v.jsx)("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),(0,v.jsx)("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),(0,v.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,v.jsx)("button",{className:"fe-btn mr-1",onClick:()=>L(e=>"list"===e?"grid":"list"),title:"list"===E?"Grid view":"List view",children:"list"===E?(0,v.jsx)(N.LayoutGrid,{className:"h-3.5 w-3.5"}):(0,v.jsx)(N.LayoutList,{className:"h-3.5 w-3.5"})}),l&&(0,v.jsx)("button",{className:"fe-btn",onClick:me,title:"Dock to edge",children:(0,v.jsx)(N.Minus,{className:"h-3.5 w-3.5"})}),(0,v.jsx)("button",{className:"fe-btn",onClick:ue,title:D?"Restore":"Maximize",children:D?(0,v.jsx)(N.Minimize2,{className:"h-3.5 w-3.5"}):(0,v.jsx)(N.Maximize2,{className:"h-3.5 w-3.5"})}),(0,v.jsx)("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{p?.(),K(!1)},title:"Close",children:(0,v.jsx)(N.X,{className:"h-3.5 w-3.5"})})]})]}),(0,v.jsxs)("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[(0,v.jsx)("button",{className:"fe-btn p-1",onClick:()=>m?.(".."),title:"Go up",children:(0,v.jsx)(N.FolderUp,{className:"h-3.5 w-3.5"})}),(0,v.jsx)("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:"navigate"===V?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>$(e=>"search"===e?"navigate":"search"),title:"search"===V?"Switch to path navigation":"Switch to file search",children:"search"===V?(0,v.jsx)(N.Search,{className:"h-3 w-3"}):(0,v.jsx)(N.CornerRightDown,{className:"h-3 w-3"})}),(0,v.jsx)("div",{className:"relative flex-1",children:(0,v.jsx)("input",{type:"text",value:I,onChange:e=>R(e.target.value),onKeyDown:e=>{"Enter"===e.key&&I.trim()&&"navigate"===V&&(f?.(I.trim())??m?.(I.trim()))},placeholder:"search"===V?"Search files…":"Enter path and press Enter…",className:"h-6 w-full rounded border border-(--fe-input-border) bg-(--fe-input-bg) px-2 text-[11px] text-(--fe-text-strong) placeholder:text-(--fe-text-muted) outline-none transition-colors focus:border-(--fe-accent)/40 focus:bg-(--fe-input-bg)"})}),(0,v.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[se.length," item",1!==se.length?"s":"",M.size>0&&` · ${M.size} selected`]})]}),(0,v.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,v.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:e=>{e.target===e.currentTarget&&(T(new Set),_(null))},children:0===se.length?(0,v.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[(0,v.jsx)(N.Folder,{className:"mb-2 h-10 w-10"}),(0,v.jsx)("span",{className:"text-xs",children:"No files found"})]}):"list"===E?(0,v.jsx)("div",{className:"space-y-px",children:se.map((e,t)=>{const r=Wt(e),a=M.has(t),s=e.extension||Ht(e.name);return(0,v.jsxs)("div",{className:n("fe-item group/item flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-(--fe-text) transition-all duration-150 cursor-pointer",a?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:a?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:e=>le(t,e),onDoubleClick:()=>oe(t),children:[(0,v.jsx)(r,{className:n("h-4 w-4 shrink-0","directory"===e.type?"text-(--fe-accent)":"text-(--fe-text-muted)")}),(0,v.jsx)("span",{className:"flex-1 truncate text-xs font-medium",children:e.name}),s&&"file"===e.type&&(0,v.jsx)("span",{className:"shrink-0 rounded bg-(--fe-badge-bg) px-1.5 py-0.5 font-mono text-[9px] uppercase text-(--fe-text-muted)",children:s}),null!=e.size&&(0,v.jsx)("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Ut(e.size)}),e.modifiedAt&&(0,v.jsx)("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Gt(e.modifiedAt)})]},e.path+t)})}):(0,v.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:se.map((e,t)=>{const r=Wt(e),a=M.has(t),s=e.extension||Ht(e.name);return(0,v.jsxs)("div",{className:n("fe-item group/item flex cursor-pointer flex-col items-center gap-1 rounded-lg px-2 py-2.5 text-center transition-all duration-150",a?"bg-(--fe-accent)/15 text-(--fe-text-strong) ring-1 ring-(--fe-accent)/30":"text-(--fe-text) hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),onClick:e=>le(t,e),onDoubleClick:()=>oe(t),children:[(0,v.jsx)(r,{className:n("h-7 w-7","directory"===e.type?"text-(--fe-accent)":"text-(--fe-text-muted)")}),(0,v.jsx)("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:e.name}),s&&"file"===e.type&&(0,v.jsx)("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:s})]},e.path+t)})})}),(0,v.jsx)("div",{className:n("shrink-0 overflow-hidden transition-[width] duration-300 ease-out",ie?"w-56":"w-0"),children:ie&&(0,v.jsxs)("div",{className:"fe-panel flex h-full w-56 flex-col border-l border-(--fe-border) p-4",children:[(0,v.jsxs)("div",{className:"mb-3 flex flex-col items-center",children:[k().createElement(Wt(ie),{className:n("h-10 w-10 mb-2","directory"===ie.type?"text-(--fe-accent)":"text-(--fe-text-muted)")}),(0,v.jsx)("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:ie.name})]}),(0,v.jsxs)("div",{className:"space-y-2.5 text-[10px]",children:[(0,v.jsx)(Qt,{label:"Type",value:"directory"===ie.type?"Directory":ie.mimeType||ie.extension||Ht(ie.name)||"File"}),null!=ie.size&&(0,v.jsx)(Qt,{label:"Size",value:Ut(ie.size)}),(0,v.jsx)(Qt,{label:"Path",value:ie.path,mono:!0}),ie.extension&&(0,v.jsx)(Qt,{label:"Extension",value:ie.extension}),ie.modifiedAt&&(0,v.jsx)(Qt,{label:"Modified",value:Gt(ie.modifiedAt)}),ie.createdAt&&(0,v.jsx)(Qt,{label:"Created",value:Gt(ie.createdAt)})]}),(0,v.jsxs)("div",{className:"mt-auto flex flex-col gap-1.5",children:["file"===ie.type&&d&&(0,v.jsxs)("button",{className:"flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text-strong) transition-colors",style:{background:"color-mix(in srgb, var(--fe-accent) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--fe-accent) 30%, transparent)"},onClick:()=>d(ie),children:[(0,v.jsx)(N.ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),g?.map(e=>(0,v.jsxs)("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>e.onClick(ie),children:[e.icon&&k().createElement(e.icon,{className:"h-3 w-3"}),e.label]},e.key))]})]})})]}),(0,v.jsxs)("div",{className:"fe-statusbar flex h-6 shrink-0 items-center justify-between px-3 text-[9px] font-mono text-(--fe-text-muted)",children:[(0,v.jsxs)("span",{children:[se.length," items"]}),(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[M.size>0&&(0,v.jsxs)("span",{className:"text-(--fe-accent)/70",children:[M.size," selected"]}),(0,v.jsx)("span",{className:"opacity-50",children:"Ctrl+Click multi-select · Esc clear"})]})]}),y&&!D&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{className:"absolute top-0 left-2 right-2 h-1.5 cursor-ns-resize",onMouseDown:e=>de("n",e)}),(0,v.jsx)("div",{className:"absolute bottom-0 left-2 right-2 h-1.5 cursor-ns-resize",onMouseDown:e=>de("s",e)}),(0,v.jsx)("div",{className:"absolute top-2 left-0 bottom-2 w-1.5 cursor-ew-resize",onMouseDown:e=>de("w",e)}),(0,v.jsx)("div",{className:"absolute top-2 right-0 bottom-2 w-1.5 cursor-ew-resize",onMouseDown:e=>de("e",e)}),(0,v.jsx)("div",{className:"absolute top-0 left-0 h-3 w-3 cursor-nwse-resize",onMouseDown:e=>de("nw",e)}),(0,v.jsx)("div",{className:"absolute top-0 right-0 h-3 w-3 cursor-nesw-resize",onMouseDown:e=>de("ne",e)}),(0,v.jsx)("div",{className:"absolute bottom-0 left-0 h-3 w-3 cursor-nesw-resize",onMouseDown:e=>de("sw",e)}),(0,v.jsx)("div",{className:"absolute bottom-0 right-0 h-3 w-3 cursor-nwse-resize",onMouseDown:e=>de("se",e)})]}),(0,v.jsx)("style",{children:"\n .fe-window {\n background: var(--fe-bg);\n box-shadow: var(--fe-shadow);\n }\n .fe-titlebar {\n background: linear-gradient(90deg, color-mix(in srgb, var(--fe-accent) 6%, transparent), transparent 60%);\n border-bottom: 1px solid var(--fe-border);\n }\n .fe-toolbar {\n border-bottom: 1px solid var(--fe-border);\n background: var(--fe-surface);\n }\n .fe-panel {\n background: var(--fe-surface);\n }\n .fe-statusbar {\n border-top: 1px solid var(--fe-border);\n background: var(--fe-surface);\n }\n .fe-dock {\n background: var(--fe-dock-bg);\n border-left: 2px solid var(--fe-accent);\n box-shadow: var(--fe-dock-shadow);\n }\n .fe-action {\n background: var(--fe-surface-hover);\n border: 1px solid var(--fe-border);\n }\n .fe-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 5px;\n border-radius: 6px;\n color: var(--fe-btn-color);\n transition: color 0.15s, background 0.15s, transform 0.1s;\n }\n .fe-btn:hover {\n color: var(--fe-btn-hover);\n background: var(--fe-btn-hover-bg);\n }\n .fe-btn:active { transform: scale(0.9); }\n .fe-item {\n animation: fe-item-in 0.25s ease-out both;\n }\n @keyframes fe-window-in {\n from { opacity: 0; transform: scale(0.95) translateY(10px); }\n to { opacity: 1; transform: scale(1) translateY(0); }\n }\n @keyframes fe-item-in {\n from { opacity: 0; transform: translateX(-4px); }\n to { opacity: 1; transform: translateX(0); }\n }\n "}),(0,v.jsx)(Ue,{open:B,onOpenChange:X,children:(0,v.jsxs)(Ge,{size:"sm",children:[(0,v.jsxs)(Ye,{children:[(0,v.jsxs)(We,{children:[(0,v.jsx)(N.AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),(0,v.jsxs)(Ze,{children:[1===M.size?`Are you sure you want to delete "${se[Array.from(M)[0]]?.name}"?`:`Are you sure you want to delete ${M.size} selected items?`," ","This action cannot be undone."]})]}),(0,v.jsxs)(Je,{children:[(0,v.jsx)(j,{intent:"ghost",onClick:()=>X(!1),children:"Cancel"}),(0,v.jsxs)(j,{intent:"danger",onClick:()=>{const e=Array.from(M).map(e=>se[e]).filter(Boolean);x?.(e),T(new Set),_(null),X(!1)},children:[(0,v.jsx)(N.Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]}):null}function Qt({label:e,value:t,mono:r}){return(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),(0,v.jsx)("div",{className:n("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}module.exports=t})();
|