@jacshuo/onyx 1.4.1 → 2.0.0

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.
Files changed (71) hide show
  1. package/dist/Chart/BarChart.cjs +1 -0
  2. package/dist/Chart/BarChart.css +1 -0
  3. package/dist/Chart/BarChart.d.cts +2 -0
  4. package/dist/Chart/BarChart.d.ts +2 -0
  5. package/dist/Chart/BarChart.js +1 -0
  6. package/dist/Chart/LineChart.cjs +1 -0
  7. package/dist/Chart/LineChart.css +1 -0
  8. package/dist/Chart/LineChart.d.cts +2 -0
  9. package/dist/Chart/LineChart.d.ts +2 -0
  10. package/dist/Chart/LineChart.js +1 -0
  11. package/dist/Chart/PieChart.cjs +1 -0
  12. package/dist/Chart/PieChart.css +1 -0
  13. package/dist/Chart/PieChart.d.cts +2 -0
  14. package/dist/Chart/PieChart.d.ts +2 -0
  15. package/dist/Chart/PieChart.js +1 -0
  16. package/dist/Chart/ScatterChart.cjs +1 -0
  17. package/dist/Chart/ScatterChart.css +1 -0
  18. package/dist/Chart/ScatterChart.d.cts +2 -0
  19. package/dist/Chart/ScatterChart.d.ts +2 -0
  20. package/dist/Chart/ScatterChart.js +1 -0
  21. package/dist/Chart/index.cjs +1 -0
  22. package/dist/Chart/index.css +1 -0
  23. package/dist/Chart/index.d.cts +12 -0
  24. package/dist/Chart/index.d.ts +12 -0
  25. package/dist/Chart/index.js +1 -0
  26. package/dist/DataDisplay/index.d.cts +1 -1
  27. package/dist/DataDisplay/index.d.ts +1 -1
  28. package/dist/Disclosure/index.d.cts +1 -1
  29. package/dist/Disclosure/index.d.ts +1 -1
  30. package/dist/Extras/TypewriterText.cjs +1 -0
  31. package/dist/Extras/TypewriterText.css +1 -0
  32. package/dist/Extras/TypewriterText.d.cts +2 -0
  33. package/dist/Extras/TypewriterText.d.ts +2 -0
  34. package/dist/Extras/TypewriterText.js +1 -0
  35. package/dist/Extras/index.cjs +4 -4
  36. package/dist/Extras/index.css +1 -0
  37. package/dist/Extras/index.d.cts +3 -1
  38. package/dist/Extras/index.d.ts +3 -1
  39. package/dist/Extras/index.js +4 -4
  40. package/dist/Feedback/index.d.cts +1 -1
  41. package/dist/Feedback/index.d.ts +1 -1
  42. package/dist/Forms/index.d.cts +1 -1
  43. package/dist/Forms/index.d.ts +1 -1
  44. package/dist/Layout/index.d.cts +1 -1
  45. package/dist/Layout/index.d.ts +1 -1
  46. package/dist/Navigation/index.d.cts +1 -1
  47. package/dist/Navigation/index.d.ts +1 -1
  48. package/dist/Overlay/index.d.cts +1 -1
  49. package/dist/Overlay/index.d.ts +1 -1
  50. package/dist/Primitives/index.d.cts +1 -1
  51. package/dist/Primitives/index.d.ts +1 -1
  52. package/dist/_tsup-dts-rollup.d.cts +481 -11
  53. package/dist/_tsup-dts-rollup.d.ts +481 -11
  54. package/dist/index.cjs +5 -5
  55. package/dist/index.css +1 -0
  56. package/dist/index.d.cts +20 -0
  57. package/dist/index.d.ts +20 -0
  58. package/dist/index.js +5 -5
  59. package/dist/styles/Chart/BarChart.css +44 -0
  60. package/dist/styles/Chart/LineChart.css +72 -0
  61. package/dist/styles/Chart/PieChart.css +56 -0
  62. package/dist/styles/Chart/ScatterChart.css +45 -0
  63. package/dist/styles/Extras/TypewriterText.css +55 -0
  64. package/dist/styles/base.css +140 -0
  65. package/dist/styles/tokens/core.css +10 -0
  66. package/dist/styles.css +344 -0
  67. package/dist/theme.cjs +1 -1
  68. package/dist/theme.d.cts +3 -0
  69. package/dist/theme.d.ts +3 -0
  70. package/dist/theme.js +1 -1
  71. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- import rn,{createContext,useState,useCallback,useRef,useLayoutEffect,useEffect,useMemo,useId,useContext}from'react';import {createPortal}from'react-dom';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {Heart,ThumbsDown,Bookmark,Share2,Download,ZoomIn,ZoomOut,X,ChevronLeft,ChevronRight,Camera,Aperture,Calendar,MapPin,Info,ListMusic,Shuffle,Repeat1,SkipBack,Pause,Play,SkipForward,VolumeX,Volume2,Disc3,ListVideo,Theater,Minimize,Maximize,ArrowUpDown,HardDrive,LayoutGrid,LayoutList,Minus,Minimize2,Maximize2,FolderUp,Search,CornerRightDown,Folder,ArrowUp,AlertTriangle,Trash2,FileArchive,Database,FileSpreadsheet,FileText,Terminal,FileCode,Video,Music,Image,File}from'lucide-react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {cva}from'class-variance-authority';function s(...e){return twMerge(clsx(e))}var Bt="#1c1914",Xt="#130f0b",Tn="#2e261e",xt="#504638",qe="#6b5d4d",ct=`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")`,Rn=[{key:"like",icon:jsx(Heart,{className:"h-5 w-5"}),activeIcon:jsx(Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsx(ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsx(Bookmark,{className:"h-5 w-5"}),activeIcon:jsx(Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsx(Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsx(Download,{className:"h-5 w-5"}),label:"Download"}];function vt({photos:e,layout:o="strip",actions:l=Rn,onAction:g,className:w,showGrain:f=true,sheetTitle:v,sheetLabel:z}){let[F,x]=useState(null),[_,D]=useState(new Set),L=useCallback(ee=>x(ee),[]),k=useCallback(()=>x(null),[]),G=useCallback((ee,A)=>{if(l.find($=>$.key===ee)?.toggle){let $=`${A}-${ee}`;D(K=>{let j=new Set(K);return j.has($)?j.delete($):j.add($),j});}g?.(ee,e[A],A);},[l,g,e]);return jsxs(Fragment,{children:[jsx(o==="strip"?zn:o==="sheet"?Fn:An,{photos:e,onPhotoClick:L,showGrain:f,className:w,sheetTitle:v,sheetLabel:z}),F!==null&&createPortal(jsx(In,{photos:e,currentIndex:F,onIndexChange:x,onClose:k,actions:l,activeActions:_,onAction:G,showGrain:f}),document.body)]})}function jt({count:e=30}){return jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Bt},children:Array.from({length:e}).map((o,l)=>jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:Tn}},l))})}function zn({photos:e,onPhotoClick:o,showGrain:l,className:g}){let w=useRef(null);return jsxs("div",{className:s("select-none rounded-lg overflow-hidden",g),style:{background:Xt},children:[jsx(jt,{count:Math.max(30,e.length*6)}),jsx("div",{ref:w,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:Bt,scrollSnapType:"x mandatory"},children:e.map((f,v)=>jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>o(v),children:[jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:xt,width:280,height:187},children:[jsx("img",{src:f.src,alt:f.alt??f.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:false}),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)"}}),l&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:ct,animation:"film-grain-shift 0.6s steps(5) infinite"}}),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%)"}})]}),jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:qe},children:[String(v+1).padStart(2,"0"),v%2===0?"":"A"]})]},v))}),jsx(jt,{count:Math.max(30,e.length*6)})]})}function Fn({photos:e,onPhotoClick:o,showGrain:l,className:g,sheetTitle:w,sheetLabel:f}){return jsxs("div",{className:s("rounded-lg p-5",g),style:{background:Xt},children:[jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:qe},children:w??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:qe},children:f??"Contact Sheet"})]}),jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((v,z)=>jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${z*50}ms both`},onClick:()=>o(z),children:[jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:qe},children:String(z+1).padStart(2,"0")}),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:xt,aspectRatio:"3/2"},children:[jsx("img",{src:v.src,alt:v.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),l&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:ct}}),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:jsx("span",{className:"text-xs font-medium text-white/90",children:v.title})})]})]},z))})]})}function An({photos:e,onPhotoClick:o,showGrain:l,className:g}){let[w,f]=useState(false),[v,z]=useState(null),F=Math.min(e.length,8),x=e.slice(0,F),_=L=>{let k=Math.sin(L*137.508+1)*1e4,G=(k%12-6).toFixed(1),y=(k/7%8-4).toFixed(1),ee=(k/13%6-3).toFixed(1);return `rotate(${G}deg) translate(${y}px, ${ee}px)`},D=(L,k)=>{let G=(k-1)/2,y=((L-G)*7).toFixed(1),ee=((L-G)*110).toFixed(0),A=(-Math.abs(L-G)*10+(v===L?-18:0)).toFixed(0);return `translateX(${ee}px) translateY(${A}px) rotate(${y}deg)`};return jsxs("div",{className:s("flex flex-col items-center gap-4",g),children:[jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>f(true),onMouseLeave:()=>{f(false),z(null);},children:x.map((L,k)=>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:w?`${k*35}ms`:`${(F-k)*25}ms`,transform:w?D(k,x.length):_(k),zIndex:w?k+1:x.length-k,width:220,height:147},onClick:()=>o(k),onMouseEnter:()=>w&&z(k),onMouseLeave:()=>z(null),children:jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:w&&v===k?"rgba(217,171,89,0.5)":xt,boxShadow:w&&v===k?"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:[jsx("img",{src:L.src,alt:L.alt??"",className:"h-full w-full object-cover",draggable:false}),l&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:ct}}),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%)"}}),w&&v===k&&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:jsx("span",{className:"text-sm font-medium text-white/90",children:L.title})})]})},k))}),e.length>F&&jsxs("span",{className:"font-mono text-xs",style:{color:qe},children:["+ ",e.length-F," more"]}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:qe,opacity:w?0:.7},children:"Hover to explore"})]})}function In({photos:e,currentIndex:o,onIndexChange:l,onClose:g,actions:w,activeActions:f,onAction:v,showGrain:z}){let F=e[o],[x,_]=useState(1),[D,L]=useState({x:0,y:0}),[k,G]=useState(false),[y,ee]=useState(false),A=useRef(false),ne=useRef({x:0,y:0}),$=useRef(null);useLayoutEffect(()=>{requestAnimationFrame(()=>ee(true));},[]),useEffect(()=>{let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a;}},[]),useEffect(()=>{let a=O=>{switch(O.key){case "Escape":g();break;case "ArrowLeft":K(-1);break;case "ArrowRight":K(1);break;case "i":case "I":G(Y=>!Y);break}};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)}),useEffect(()=>{let a=$.current;if(!a)return;let O=Y=>{Y.preventDefault();let ie=Y.deltaY<0?1.12:.89;_(q=>{let ge=Math.min(8,Math.max(1,q*ie));return ge<=1&&L({x:0,y:0}),ge});};return a.addEventListener("wheel",O,{passive:false}),()=>a.removeEventListener("wheel",O)},[]);let K=useCallback(a=>{let O=o+a;O>=0&&O<e.length&&(l(O),_(1),L({x:0,y:0}));},[o,e.length,l]),j=useCallback(a=>{x<=1||(A.current=true,ne.current={x:a.clientX,y:a.clientY},a.target.setPointerCapture(a.pointerId));},[x]),Me=useCallback(a=>{if(!A.current)return;let O=a.clientX-ne.current.x,Y=a.clientY-ne.current.y;ne.current={x:a.clientX,y:a.clientY},L(ie=>({x:ie.x+O/x,y:ie.y+Y/x}));},[x]),u=useCallback(()=>{A.current=false;},[]),b=useCallback(()=>{x>1?(_(1),L({x:0,y:0})):_(2.5);},[x]),C=a=>f.has(`${o}-${a}`),S=F.metadata;return jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsx("div",{className:"absolute inset-0 bg-black/95",onClick:g}),z&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:ct,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxs("span",{className:"font-mono text-sm text-white/50",children:[o+1," / ",e.length]}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[x.toFixed(1),"x"]}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>_(a=>Math.min(8,a*1.3)),title:"Zoom in",children:jsx(ZoomIn,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{_(a=>{let O=Math.max(1,a*.7);return O<=1&&L({x:0,y:0}),O});},title:"Zoom out",children:jsx(ZoomOut,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:g,title:"Close",children:jsx(X,{className:"h-5 w-5"})})]})]}),jsxs("div",{ref:$,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:x>1?"grab":"default"},onPointerDown:j,onPointerMove:Me,onPointerUp:u,onDoubleClick:b,children:[jsx("img",{src:F.src,alt:F.alt??F.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(${x}) translate(${D.x}px, ${D.y}px)`,transition:A.current?"none":"transform 0.15s ease-out"},draggable:false},o),o>0&&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:a=>{a.stopPropagation(),K(-1);},children:jsx(ChevronLeft,{className:"h-6 w-6"})}),o<e.length-1&&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:a=>{a.stopPropagation(),K(1);},children:jsx(ChevronRight,{className:"h-6 w-6"})})]}),jsx("div",{className:s("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",k?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[F.title&&jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:F.title}),F.description&&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:F.description}),S&&jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[S.camera&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.camera,S.lens&&jsx("span",{className:"text-white/40",children:"\xB7"}),S.lens&&S.lens]}),(S.aperture||S.shutter||S.iso)&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[S.aperture,S.shutter,S.iso&&`ISO ${S.iso}`].filter(Boolean).join(" \xB7 ")]}),S.date&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.date]}),S.location&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",S.location]})]})]})}),jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[w.map(a=>{let O=a.toggle&&C(a.key);return jsx("button",{className:s("rounded-full p-2.5 transition-all duration-200",O?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>v(a.key,o),title:a.label,children:O&&a.activeIcon?a.activeIcon:a.icon},a.key)}),jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsx("button",{className:s("rounded-full p-2.5 transition-all duration-200",k?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>G(a=>!a),title:"Photo info (I)",children:jsx(Info,{className:"h-5 w-5"})})]})})]})}var yt="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
1
+ import ln,{createContext,useState,useCallback,useRef,useLayoutEffect,useEffect,useMemo,useId,useContext}from'react';import {createPortal}from'react-dom';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {Heart,ThumbsDown,Bookmark,Share2,Download,ZoomIn,ZoomOut,X,ChevronLeft,ChevronRight,Camera,Aperture,Calendar,MapPin,Info,ListMusic,Shuffle,Repeat1,SkipBack,Pause,Play,SkipForward,VolumeX,Volume2,Disc3,ListVideo,Theater,Minimize,Maximize,ArrowUpDown,HardDrive,LayoutGrid,LayoutList,Minus,Minimize2,Maximize2,FolderUp,Search,CornerRightDown,Folder,ArrowUp,AlertTriangle,Trash2,FileArchive,Database,FileSpreadsheet,FileText,Terminal,FileCode,Video,Music,Image,File}from'lucide-react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {cva}from'class-variance-authority';function s(...e){return twMerge(clsx(e))}var Wt="#1c1914",Gt="#130f0b",In="#2e261e",kt="#504638",qe="#6b5d4d",ct=`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")`,Hn=[{key:"like",icon:jsx(Heart,{className:"h-5 w-5"}),activeIcon:jsx(Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsx(ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsx(Bookmark,{className:"h-5 w-5"}),activeIcon:jsx(Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsx(Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsx(Download,{className:"h-5 w-5"}),label:"Download"}];function Nt({photos:e,layout:n="strip",actions:i=Hn,onAction:g,className:k,showGrain:m=true,sheetTitle:h,sheetLabel:D}){let[S,x]=useState(null),[j,T]=useState(new Set),N=useCallback(B=>x(B),[]),w=useCallback(()=>x(null),[]),_=useCallback((B,z)=>{if(i.find(A=>A.key===B)?.toggle){let A=`${z}-${B}`;T(X=>{let I=new Set(X);return I.has(A)?I.delete(A):I.add(A),I});}g?.(B,e[z],z);},[i,g,e]);return jsxs(Fragment,{children:[jsx(n==="strip"?On:n==="sheet"?_n:Vn,{photos:e,onPhotoClick:N,showGrain:m,className:k,sheetTitle:h,sheetLabel:D}),S!==null&&createPortal(jsx($n,{photos:e,currentIndex:S,onIndexChange:x,onClose:w,actions:i,activeActions:j,onAction:_,showGrain:m}),document.body)]})}function Yt({count:e=30}){return jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Wt},children:Array.from({length:e}).map((n,i)=>jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:In}},i))})}function On({photos:e,onPhotoClick:n,showGrain:i,className:g}){let k=useRef(null);return jsxs("div",{className:s("select-none rounded-lg overflow-hidden",g),style:{background:Gt},children:[jsx(Yt,{count:Math.max(30,e.length*6)}),jsx("div",{ref:k,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:Wt,scrollSnapType:"x mandatory"},children:e.map((m,h)=>jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>n(h),children:[jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:kt,width:280,height:187},children:[jsx("img",{src:m.src,alt:m.alt??m.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:false}),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)"}}),i&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:ct,animation:"film-grain-shift 0.6s steps(5) infinite"}}),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%)"}})]}),jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:qe},children:[String(h+1).padStart(2,"0"),h%2===0?"":"A"]})]},h))}),jsx(Yt,{count:Math.max(30,e.length*6)})]})}function _n({photos:e,onPhotoClick:n,showGrain:i,className:g,sheetTitle:k,sheetLabel:m}){return jsxs("div",{className:s("rounded-lg p-5",g),style:{background:Gt},children:[jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:qe},children:k??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:qe},children:m??"Contact Sheet"})]}),jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((h,D)=>jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${D*50}ms both`},onClick:()=>n(D),children:[jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:qe},children:String(D+1).padStart(2,"0")}),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:kt,aspectRatio:"3/2"},children:[jsx("img",{src:h.src,alt:h.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),i&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:ct}}),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:jsx("span",{className:"text-xs font-medium text-white/90",children:h.title})})]})]},D))})]})}function Vn({photos:e,onPhotoClick:n,showGrain:i,className:g}){let[k,m]=useState(false),[h,D]=useState(null),S=Math.min(e.length,8),x=e.slice(0,S),j=N=>{let w=Math.sin(N*137.508+1)*1e4,_=(w%12-6).toFixed(1),y=(w/7%8-4).toFixed(1),B=(w/13%6-3).toFixed(1);return `rotate(${_}deg) translate(${y}px, ${B}px)`},T=(N,w)=>{let _=(w-1)/2,y=((N-_)*7).toFixed(1),B=((N-_)*110).toFixed(0),z=(-Math.abs(N-_)*10+(h===N?-18:0)).toFixed(0);return `translateX(${B}px) translateY(${z}px) rotate(${y}deg)`};return jsxs("div",{className:s("flex flex-col items-center gap-4",g),children:[jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>m(true),onMouseLeave:()=>{m(false),D(null);},children:x.map((N,w)=>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:k?`${w*35}ms`:`${(S-w)*25}ms`,transform:k?T(w,x.length):j(w),zIndex:k?w+1:x.length-w,width:220,height:147},onClick:()=>n(w),onMouseEnter:()=>k&&D(w),onMouseLeave:()=>D(null),children:jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:k&&h===w?"rgba(217,171,89,0.5)":kt,boxShadow:k&&h===w?"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:[jsx("img",{src:N.src,alt:N.alt??"",className:"h-full w-full object-cover",draggable:false}),i&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:ct}}),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%)"}}),k&&h===w&&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:jsx("span",{className:"text-sm font-medium text-white/90",children:N.title})})]})},w))}),e.length>S&&jsxs("span",{className:"font-mono text-xs",style:{color:qe},children:["+ ",e.length-S," more"]}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:qe,opacity:k?0:.7},children:"Hover to explore"})]})}function $n({photos:e,currentIndex:n,onIndexChange:i,onClose:g,actions:k,activeActions:m,onAction:h,showGrain:D}){let S=e[n],[x,j]=useState(1),[T,N]=useState({x:0,y:0}),[w,_]=useState(false),[y,B]=useState(false),z=useRef(false),G=useRef({x:0,y:0}),A=useRef(null);useLayoutEffect(()=>{requestAnimationFrame(()=>B(true));},[]),useEffect(()=>{let o=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=o;}},[]),useEffect(()=>{let o=L=>{switch(L.key){case "Escape":g();break;case "ArrowLeft":X$1(-1);break;case "ArrowRight":X$1(1);break;case "i":case "I":_(K=>!K);break}};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)}),useEffect(()=>{let o=A.current;if(!o)return;let L=K=>{K.preventDefault();let ne=K.deltaY<0?1.12:.89;j(U=>{let be=Math.min(8,Math.max(1,U*ne));return be<=1&&N({x:0,y:0}),be});};return o.addEventListener("wheel",L,{passive:false}),()=>o.removeEventListener("wheel",L)},[]);let X$1=useCallback(o=>{let L=n+o;L>=0&&L<e.length&&(i(L),j(1),N({x:0,y:0}));},[n,e.length,i]),I=useCallback(o=>{x<=1||(z.current=true,G.current={x:o.clientX,y:o.clientY},o.target.setPointerCapture(o.pointerId));},[x]),ge=useCallback(o=>{if(!z.current)return;let L=o.clientX-G.current.x,K=o.clientY-G.current.y;G.current={x:o.clientX,y:o.clientY},N(ne=>({x:ne.x+L/x,y:ne.y+K/x}));},[x]),d=useCallback(()=>{z.current=false;},[]),b=useCallback(()=>{x>1?(j(1),N({x:0,y:0})):j(2.5);},[x]),E=o=>m.has(`${n}-${o}`),C=S.metadata;return jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsx("div",{className:"absolute inset-0 bg-black/95",onClick:g}),D&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:ct,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxs("span",{className:"font-mono text-sm text-white/50",children:[n+1," / ",e.length]}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[x.toFixed(1),"x"]}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>j(o=>Math.min(8,o*1.3)),title:"Zoom in",children:jsx(ZoomIn,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{j(o=>{let L=Math.max(1,o*.7);return L<=1&&N({x:0,y:0}),L});},title:"Zoom out",children:jsx(ZoomOut,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:g,title:"Close",children:jsx(X,{className:"h-5 w-5"})})]})]}),jsxs("div",{ref:A,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:x>1?"grab":"default"},onPointerDown:I,onPointerMove:ge,onPointerUp:d,onDoubleClick:b,children:[jsx("img",{src:S.src,alt:S.alt??S.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(${x}) translate(${T.x}px, ${T.y}px)`,transition:z.current?"none":"transform 0.15s ease-out"},draggable:false},n),n>0&&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:o=>{o.stopPropagation(),X$1(-1);},children:jsx(ChevronLeft,{className:"h-6 w-6"})}),n<e.length-1&&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:o=>{o.stopPropagation(),X$1(1);},children:jsx(ChevronRight,{className:"h-6 w-6"})})]}),jsx("div",{className:s("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",w?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[S.title&&jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:S.title}),S.description&&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:S.description}),C&&jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[C.camera&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",C.camera,C.lens&&jsx("span",{className:"text-white/40",children:"\xB7"}),C.lens&&C.lens]}),(C.aperture||C.shutter||C.iso)&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[C.aperture,C.shutter,C.iso&&`ISO ${C.iso}`].filter(Boolean).join(" \xB7 ")]}),C.date&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",C.date]}),C.location&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",C.location]})]})]})}),jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[k.map(o=>{let L=o.toggle&&E(o.key);return jsx("button",{className:s("rounded-full p-2.5 transition-all duration-200",L?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>h(o.key,n),title:o.label,children:L&&o.activeIcon?o.activeIcon:o.icon},o.key)}),jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsx("button",{className:s("rounded-full p-2.5 transition-all duration-200",w?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>_(o=>!o),title:"Photo info (I)",children:jsx(Info,{className:"h-5 w-5"})})]})})]})}var Ct="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
2
2
  <rect width="200" height="200" fill="#1e1b2e"/>
3
3
  <circle cx="100" cy="100" r="60" fill="none" stroke="#6366f1" stroke-width="1.5" opacity="0.3"/>
4
4
  <circle cx="100" cy="100" r="20" fill="none" stroke="#6366f1" stroke-width="1" opacity="0.4"/>
5
5
  <text x="100" y="108" text-anchor="middle" font-family="monospace" font-size="18" fill="#6366f1" opacity="0.6">\u266A</text>
6
- </svg>`);function Yt(e){if(!isFinite(e)||e<0)return "0:00";let o=Math.floor(e/60),l=Math.floor(e%60);return `${o}:${l.toString().padStart(2,"0")}`}function Gn(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var qn={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Zn={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Qn={"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 wt({playlist:e,initialTrack:o=0,position:l="bottom-right",entrance:g,theme:w,docked:f=false,visible:v,onVisibleChange:z,onTrackChange:F,onLike:x,autoPlay:_=true,shuffle:D=false,loop:L=false,accent:k="#8b5cf6",className:G}){let [y,ee]=useState(o),[A,ne]=useState(false),[$,K]=useState(0),[j,Me]=useState(0),[u,b]=useState(.8),[C,S]=useState(false),[a,O]=useState(new Set),[Y,ie]=useState(false),[q,ge]=useState(v??!f),[I,be]=useState(false),[$e,Re]=useState(false),[ce,ze]=useState(D),[me,Fe]=useState(L),De=useRef(false),P=useRef(null),ve=useRef(null),Q=useRef(void 0),W=useRef(null),J=useRef(null),pe=v??q,ke=g??Gn(l),M=e[y],U=f,de=w==="dark"?"dark":w==="light"?"light":"",ye="bg-(--mp-bg)",Ne="text-(--mp-text)",te="text-(--mp-text-muted)",Ee="text-(--accent)",Z="border-(--mp-border)";useEffect(()=>{let r=P.current;r&&(r.src=M.src,r.load(),A&&r.play().catch(()=>{}));},[y,M.src]),useEffect(()=>{if(!_||De.current)return;let r=P.current;if(!r)return;let E=()=>{De.current=true,ne(true),r.play().catch(()=>{});};return r.addEventListener("canplaythrough",E,{once:true}),()=>r.removeEventListener("canplaythrough",E)},[_]),useEffect(()=>{let r=P.current;r&&(A?r.play().catch(()=>{}):r.pause());},[A]),useEffect(()=>{let r=P.current;r&&(r.muted=C,J.current?J.current.gain.value=C?0:u:r.volume=u);},[u,C]),useEffect(()=>{let r=P.current;if(!r)return;let E=()=>K(r.currentTime),re=()=>Me(r.duration),Ce=()=>{me?(r.currentTime=0,r.play().catch(()=>{})):Le();};return r.addEventListener("timeupdate",E),r.addEventListener("loadedmetadata",re),r.addEventListener("ended",Ce),()=>{r.removeEventListener("timeupdate",E),r.removeEventListener("loadedmetadata",re),r.removeEventListener("ended",Ce);}},[y,e.length]);let N=useCallback(r=>{let E=(r%e.length+e.length)%e.length;ee(E),K(0),F?.(E,e[E]),pe||(ge(true),z?.(true));},[e,pe,F,z]),Le=useCallback(()=>{if(ce){let r;do r=Math.floor(Math.random()*e.length);while(r===y&&e.length>1);N(r);}else N(y+1);},[N,y,ce,e.length]),Ye=useCallback(()=>{if(ce){let r;do r=Math.floor(Math.random()*e.length);while(r===y&&e.length>1);N(r);}else N(y-1);},[N,y,ce,e.length]),We=useCallback(()=>{let r=a.has(y);O(E=>{let re=new Set(E);return r?re.delete(y):re.add(y),re}),x?.(y,M,!r);},[y,a,x,M]),at=useCallback(r=>{let E=r.currentTarget.getBoundingClientRect(),Ce=Math.max(0,Math.min(1,(r.clientX-E.left)/E.width))*j;P.current&&(P.current.currentTime=Ce),K(Ce);},[j]),le=useCallback(()=>{be(true);let r=U?200:400;Q.current=setTimeout(()=>{be(false),ge(false),z?.(false);},r);},[U,z]);useEffect(()=>()=>{Q.current&&clearTimeout(Q.current);},[]),useEffect(()=>()=>{W.current?.close();},[]);function fe(){if(W.current||!P.current){W.current?.resume();return}try{let r=window.AudioContext??window.webkitAudioContext;if(!r)return;let E=new r,re=E.createGain();re.gain.value=C?0:u,E.createMediaElementSource(P.current).connect(re).connect(E.destination),W.current=E,J.current=re,E.resume();}catch{}}let n=$e?"fade-in 0.2s ease-out both":`mp-enter-${ke} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,h=$e?"fade-in 0.2s ease-in reverse both":`mp-exit-${ke} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,V=j>0?$/j*100:0;return U&&!pe&&!I?jsxs(Fragment,{children:[jsx("audio",{ref:P,preload:"metadata",crossOrigin:"anonymous"}),jsxs("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",Qn[l]),style:{"--accent":k},onMouseEnter:()=>{Re(true),ge(true),z?.(true);},children:[jsx("div",{className:s("h-full w-full rounded-full",A?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:A?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),A&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!pe&&!I?jsx("audio",{ref:P,preload:"metadata",crossOrigin:"anonymous"}):jsxs(Fragment,{children:[jsx("audio",{ref:P,preload:"metadata",crossOrigin:"anonymous"}),jsx("div",{className:s("fixed z-100",U?Zn[l]:qn[l],de),style:{"--accent":k,...I?{animation:h}:{animation:n}},onMouseEnter:()=>{U&&(Q.current&&(clearTimeout(Q.current),Q.current=void 0),I&&be(false),Re(true));},onMouseLeave:()=>{U&&(Re(false),le());},children:jsxs("div",{className:s("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",ye,Z,U&&"rounded-none",l.endsWith("right")&&U&&"rounded-l-2xl",l.endsWith("left")&&U&&"rounded-r-2xl",G),children:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:M.cover||yt,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:A?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:M.cover||yt,alt:M.album??M.title,className:"h-full w-full object-cover",draggable:false}),jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),A&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:s("truncate text-sm font-semibold",Ne),children:M.title}),M.artist&&jsx("div",{className:s("truncate text-xs",te),children:M.artist}),M.album&&jsx("div",{className:s("mt-0.5 truncate text-[10px] tracking-wide",te,"opacity-60"),children:M.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsx("button",{className:s("rounded-full p-1.5 transition-all duration-200",a.has(y)?"text-rose-500 hover:text-rose-400":s(te,"hover:text-rose-500")),onClick:We,title:"Like",children:jsx(Heart,{className:"h-4 w-4",fill:a.has(y)?"currentColor":"none"})}),jsx("button",{className:s("rounded-full p-1.5 transition-colors",te,"hover:"+Ne.split(" ")[0]),onClick:()=>ie(r=>!r),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!U&&jsx("button",{className:s("rounded-full p-1.5 transition-colors",te,"hover:"+Ne.split(" ")[0]),onClick:le,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:ve,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:at,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${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(${V}% - 6px)`}})]}),jsxs("div",{className:s("mt-1 flex justify-between text-[10px] font-mono",te),children:[jsx("span",{children:Yt($)}),jsx("span",{children:Yt(j)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsx("button",{className:s("rounded-full p-1.5 transition-colors",ce?Ee:te,"hover:text-(--mp-text)"),onClick:()=>ze(r=>!r),title:ce?"Shuffle On":"Shuffle Off",children:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),jsx("button",{className:s("rounded-full p-1.5 transition-colors",me?Ee:te,"hover:text-(--mp-text)"),onClick:()=>Fe(r=>!r),title:me?"Loop On":"Loop Off",children:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:s("rounded-full p-2 transition-colors",te,"hover:text-(--mp-text)"),onClick:Ye,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:s("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:()=>{fe(),ne(r=>!r);},title:A?"Pause":"Play",children:A?jsx(Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsx(Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:s("rounded-full p-2 transition-colors",te,"hover:text-(--mp-text)"),onClick:Le,title:"Next",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsx("button",{className:s("rounded-full p-1 transition-colors",te,"hover:text-(--mp-text)"),onClick:()=>{fe();let r=!C;S(r),J.current&&(J.current.gain.value=r?0:u);},title:C?"Unmute":"Mute",children:C||u===0?jsx(VolumeX,{className:"h-3.5 w-3.5"}):jsx(Volume2,{className:"h-3.5 w-3.5"})}),jsx("input",{type:"range",min:0,max:1,step:.01,value:C?0:u,onChange:r=>{fe();let E=Number(r.target.value);b(E),C&&S(false),J.current&&(J.current.gain.value=E);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsx("div",{className:s("overflow-hidden transition-all duration-300 ease-in-out",Y?"max-h-60":"max-h-0"),children:jsx("div",{className:s("border-t px-2 py-2",Z),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((r,E)=>{let re=E===y;return jsxs("button",{className:s("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",re?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{N(E),ne(true);},children:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:re&&A?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(Ce=>jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+Ce*4}px`,animation:`mp-eq-bar ${.4+Ce*.15}s ease-in-out infinite alternate`}},Ce))}):re?jsx(Disc3,{className:s("h-4 w-4",Ee)}):jsx("span",{className:s("text-xs font-mono",te),children:E+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:r.cover||yt,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:s("truncate text-xs font-medium",re?Ee:Ne),children:r.title}),r.artist&&jsx("div",{className:s("truncate text-[10px]",te),children:r.artist})]}),a.has(E)&&jsx(Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},E)})})})})]})})]})}function ut(e){if(!isFinite(e)||e<0)return "0:00";let o=Math.floor(e/3600),l=Math.floor(e%3600/60),g=Math.floor(e%60);return o>0?`${o}:${l.toString().padStart(2,"0")}:${g.toString().padStart(2,"0")}`:`${l}:${g.toString().padStart(2,"0")}`}var fr={title:(e,o)=>e.title.localeCompare(o.title),type:(e,o)=>(e.type??"").localeCompare(o.type??""),duration:(e,o)=>(e.duration??0)-(o.duration??0)};function Nt({playlist:e,initialTrack:o=0,autoPlay:l=false,shuffle:g=false,loop:w=false,onTrackChange:f,onPlayChange:v,accent:z="#8b5cf6",className:F}){let[x,_]=useState(o),[D,L]=useState(false),[k,G]=useState(0),[y,ee]=useState(0),[A,ne]=useState(0),[$,K]=useState(.8),[j,Me]=useState(false),[u,b]=useState(g),[C,S]=useState(w),[a,O]=useState(false),[Y,ie]=useState("title"),[q,ge]=useState(true),[I,be]=useState(false),[$e,Re]=useState(false),[ce,ze]=useState(false),[me,Fe]=useState(true),[De,P]=useState(false),[ve,Q]=useState(null),W=useRef(null),J=useRef(null),pe=useRef(void 0),ke=useRef(false),M=e[x],Ke=rn.useMemo(()=>{let n=e.map((h,V)=>({media:h,originalIndex:V}));return n.sort((h,V)=>{let r=fr[Y](h.media,V.media);return q?r:-r}),n},[e,Y,q]);useEffect(()=>{let n=W.current;if(!n)return;P(true),n.src=M.src,M.poster&&(n.poster=M.poster),n.load();let h=()=>{P(false),D&&n.play().catch(()=>{});};return n.addEventListener("loadeddata",h,{once:true}),()=>n.removeEventListener("loadeddata",h)},[x,M.src]),useEffect(()=>{if(!l||ke.current)return;let n=W.current;if(!n)return;let h=()=>{ke.current=true,L(true),n.play().catch(()=>{});};return n.addEventListener("canplaythrough",h,{once:true}),()=>n.removeEventListener("canplaythrough",h)},[l]),useEffect(()=>{let n=W.current;n&&(D?n.play().catch(()=>{}):n.pause(),v?.(D));},[D]),useEffect(()=>{let n=W.current;n&&(n.volume=j?0:$);},[$,j]),useEffect(()=>{let n=W.current;if(!n)return;let h=()=>G(n.currentTime),V=()=>ee(n.duration),r=()=>{n.buffered.length>0&&ne(n.buffered.end(n.buffered.length-1));},E=()=>{C?(n.currentTime=0,n.play().catch(()=>{})):ye();};return n.addEventListener("timeupdate",h),n.addEventListener("loadedmetadata",V),n.addEventListener("progress",r),n.addEventListener("ended",E),()=>{n.removeEventListener("timeupdate",h),n.removeEventListener("loadedmetadata",V),n.removeEventListener("progress",r),n.removeEventListener("ended",E);}},[x,e.length,C]);let U=useCallback(()=>{Fe(true),pe.current&&clearTimeout(pe.current),pe.current=setTimeout(()=>{D&&Fe(false);},3e3);},[D]);useEffect(()=>{D?U():(Fe(true),pe.current&&clearTimeout(pe.current));},[D,U]),useEffect(()=>()=>{pe.current&&clearTimeout(pe.current);},[]);let de=useCallback(n=>{let h=(n%e.length+e.length)%e.length;_(h),G(0),L(true),f?.(h,e[h]);},[e,f]),ye=useCallback(()=>{if(u){let n;do n=Math.floor(Math.random()*e.length);while(n===x&&e.length>1);de(n);}else de(x+1);},[de,x,u,e.length]),Ne=useCallback(()=>{if(u){let n;do n=Math.floor(Math.random()*e.length);while(n===x&&e.length>1);de(n);}else de(x-1);},[de,x,u,e.length]),te=useCallback(n=>{let h=n.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(1,(n.clientX-h.left)/h.width))*y;W.current&&(W.current.currentTime=r),G(r);},[y]),Ee=useCallback(n=>{let h=n.currentTarget.getBoundingClientRect(),V=Math.max(0,Math.min(1,(n.clientX-h.left)/h.width));Q(V*y);},[y]),Z=useCallback(()=>{J.current&&(document.fullscreenElement?document.exitFullscreen():J.current.requestFullscreen());},[]);useEffect(()=>{let n=()=>ze(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",n),()=>document.removeEventListener("fullscreenchange",n)},[]);let N=useCallback(()=>{I?(Re(true),setTimeout(()=>{be(false),Re(false);},500)):be(true);},[I]),Le=useCallback(()=>{O(n=>!n);},[]),Ye=useCallback(()=>{let n=["title","type","duration"],h=n.indexOf(Y);q?ge(false):(ge(true),ie(n[(h+1)%n.length]));},[Y,q]);useEffect(()=>{let n=h=>{if(!(h.target instanceof HTMLInputElement||h.target instanceof HTMLTextAreaElement))switch(h.key){case " ":case "k":h.preventDefault(),L(V=>!V);break;case "f":h.preventDefault(),Z();break;case "t":h.preventDefault(),N();break;case "ArrowLeft":h.preventDefault(),W.current&&(W.current.currentTime=Math.max(0,k-5));break;case "ArrowRight":h.preventDefault(),W.current&&(W.current.currentTime=Math.min(y,k+5));break;case "ArrowUp":h.preventDefault(),K(V=>Math.min(1,V+.05));break;case "ArrowDown":h.preventDefault(),K(V=>Math.max(0,V-.05));break;case "Escape":I&&N();break;case "n":h.preventDefault(),ye();break;case "p":h.preventDefault(),Ne();break;case "l":h.preventDefault(),Le();break}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[Z,N,Le,ye,Ne,k,y,I]);let We=y>0?k/y*100:0,at=y>0?A/y*100:0,le="text-(--accent)",fe=jsxs("div",{ref:J,className:s("group flex overflow-hidden",ce?"h-full w-full":"aspect-video w-full",!ce&&"rounded-xl",!ce&&D&&"shadow-2xl",!ce&&!D&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",F),style:{"--accent":z,background:"var(--cp-bg)"},tabIndex:0,children:[jsxs("div",{className:s("relative flex-1 min-w-0 h-full overflow-hidden",De&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:U,onMouseLeave:()=>{D&&Fe(false);},children:[jsx("video",{ref:W,className:"h-full w-full object-contain",poster:M.poster,playsInline:true,preload:"metadata",onClick:()=>L(n=>!n)}),!D&&!De&&jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>L(true),children: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:jsx(Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),De&&!me&&jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:M.title}),M.subtitle&&jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:M.subtitle})]})}),jsx("div",{className:s("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",me?"opacity-100":"pointer-events-none opacity-0"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:M.title}),M.subtitle&&jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:M.subtitle})]}),M.type&&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:M.type})]})}),jsxs("div",{className:s("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",me?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[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:te,onMouseMove:Ee,onMouseLeave:()=>Q(null),children:[jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${at}%`,background:"var(--cp-seek-buffer)"}}),jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${We}%`}}),ve!==null&&jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${ve/y*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:ut(ve)}),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(${We}% - 7px)`}})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{className:"cp-btn",onClick:()=>L(n=>!n),title:D?"Pause (k)":"Play (k)",children:D?jsx(Pause,{className:"h-5 w-5",fill:"currentColor"}):jsx(Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:Ne,title:"Previous (p)",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:ye,title:"Next (n)",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsx("button",{className:"cp-btn",onClick:()=>Me(n=>!n),title:j?"Unmute":"Mute",children:j||$===0?jsx(VolumeX,{className:"h-4 w-4"}):jsx(Volume2,{className:"h-4 w-4"})}),jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsx("input",{type:"range",min:0,max:1,step:.01,value:j?0:$,onChange:n=>{K(Number(n.target.value)),j&&Me(false);},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),jsxs("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[ut(k)," / ",ut(y)]}),jsx("div",{className:"flex-1"}),jsx("button",{className:s("cp-btn",u&&le),onClick:()=>b(n=>!n),title:"Shuffle",children:jsx(Shuffle,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",C&&le),onClick:()=>S(n=>!n),title:"Loop",children:jsx(Repeat1,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",a&&le),onClick:Le,title:"Playlist",children:jsx(ListVideo,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",I&&le),onClick:N,title:"Cinema mode (t)",children:jsx(Theater,{className:"h-4 w-4"})}),jsx("button",{className:"cp-btn",onClick:Z,title:"Fullscreen (f)",children:ce?jsx(Minimize,{className:"h-4 w-4"}):jsx(Maximize,{className:"h-4 w-4"})})]})]})]}),jsx("div",{className:s("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",a?"w-72":"w-0"),children: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:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxs("div",{className:"flex items-center gap-1",children:[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:Ye,title:`Sort: ${Y} ${q?"\u2191":"\u2193"}`,children:[jsx(ArrowUpDown,{className:"h-3 w-3"}),Y,q?" \u2191":" \u2193"]}),jsx("button",{className:"cp-btn p-1!",onClick:Le,title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:Ke.map(({media:n,originalIndex:h})=>{let V=h===x;return jsxs("button",{className:s("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",V?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:V?void 0:{color:"var(--cp-text)"},onClick:()=>{de(h);},children:[jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[n.poster?jsx("img",{src:n.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsx(Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),V&&D&&jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(r=>jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+r*3}px`,animation:`mp-eq-bar ${.3+r*.12}s ease-in-out infinite alternate`}},r))})})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:"truncate text-xs font-medium",children:n.title}),jsxs("div",{className:"flex items-center gap-2",children:[n.type&&jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:n.type}),n.duration!=null&&jsx("span",{className:"font-mono text-[10px] opacity-40",children:ut(n.duration)})]})]}),V&&jsx(ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},h)})})]})}),jsx("style",{children:`
6
+ </svg>`);function qt(e){if(!isFinite(e)||e<0)return "0:00";let n=Math.floor(e/60),i=Math.floor(e%60);return `${n}:${i.toString().padStart(2,"0")}`}function er(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var tr={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},nr={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},rr={"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 Mt({playlist:e,initialTrack:n=0,position:i="bottom-right",entrance:g,theme:k,docked:m=false,visible:h,onVisibleChange:D,onTrackChange:S,onLike:x,autoPlay:j=true,shuffle:T=false,loop:N=false,accent:w="#8b5cf6",className:_}){let [y,B]=useState(n),[z,G]=useState(false),[A,X$1]=useState(0),[I,ge]=useState(0),[d,b]=useState(.8),[E,C]=useState(false),[o,L]=useState(new Set),[K,ne]=useState(false),[U,be]=useState(h??!m),[V,he]=useState(false),[$e,Se]=useState(false),[ce,ze]=useState(T),[me,Fe]=useState(N),Pe=useRef(false),F=useRef(null),ye=useRef(null),ee=useRef(void 0),Z=useRef(null),te=useRef(null),pe=h??U,Ne=g??er(i),P=e[y],Q=m,de=k==="dark"?"dark":k==="light"?"light":"",we="bg-(--mp-bg)",Ce="text-(--mp-text)",re="text-(--mp-text-muted)",Ee="text-(--accent)",J="border-(--mp-border)";useEffect(()=>{let a=F.current;a&&(a.src=P.src,a.load(),z&&a.play().catch(()=>{}));},[y,P.src]),useEffect(()=>{if(!j||Pe.current)return;let a=F.current;if(!a)return;let R=()=>{Pe.current=true,G(true),a.play().catch(()=>{});};return a.addEventListener("canplaythrough",R,{once:true}),()=>a.removeEventListener("canplaythrough",R)},[j]),useEffect(()=>{let a=F.current;a&&(z?a.play().catch(()=>{}):a.pause());},[z]),useEffect(()=>{let a=F.current;a&&(a.muted=E,te.current?te.current.gain.value=E?0:d:a.volume=d);},[d,E]),useEffect(()=>{let a=F.current;if(!a)return;let R=()=>X$1(a.currentTime),oe=()=>ge(a.duration),Me=()=>{me?(a.currentTime=0,a.play().catch(()=>{})):Te();};return a.addEventListener("timeupdate",R),a.addEventListener("loadedmetadata",oe),a.addEventListener("ended",Me),()=>{a.removeEventListener("timeupdate",R),a.removeEventListener("loadedmetadata",oe),a.removeEventListener("ended",Me);}},[y,e.length]);let M=useCallback(a=>{let R=(a%e.length+e.length)%e.length;B(R),X$1(0),S?.(R,e[R]),pe||(be(true),D?.(true));},[e,pe,S,D]),Te=useCallback(()=>{if(ce){let a;do a=Math.floor(Math.random()*e.length);while(a===y&&e.length>1);M(a);}else M(y+1);},[M,y,ce,e.length]),Ye=useCallback(()=>{if(ce){let a;do a=Math.floor(Math.random()*e.length);while(a===y&&e.length>1);M(a);}else M(y-1);},[M,y,ce,e.length]),We=useCallback(()=>{let a=o.has(y);L(R=>{let oe=new Set(R);return a?oe.delete(y):oe.add(y),oe}),x?.(y,P,!a);},[y,o,x,P]),at=useCallback(a=>{let R=a.currentTarget.getBoundingClientRect(),Me=Math.max(0,Math.min(1,(a.clientX-R.left)/R.width))*I;F.current&&(F.current.currentTime=Me),X$1(Me);},[I]),le=useCallback(()=>{he(true);let a=Q?200:400;ee.current=setTimeout(()=>{he(false),be(false),D?.(false);},a);},[Q,D]);useEffect(()=>()=>{ee.current&&clearTimeout(ee.current);},[]),useEffect(()=>()=>{Z.current?.close();},[]);function fe(){if(Z.current||!F.current){Z.current?.resume();return}try{let a=window.AudioContext??window.webkitAudioContext;if(!a)return;let R=new a,oe=R.createGain();oe.gain.value=E?0:d,R.createMediaElementSource(F.current).connect(oe).connect(R.destination),Z.current=R,te.current=oe,R.resume();}catch{}}let r=$e?"fade-in 0.2s ease-out both":`mp-enter-${Ne} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,v=$e?"fade-in 0.2s ease-in reverse both":`mp-exit-${Ne} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,Y=I>0?A/I*100:0;return Q&&!pe&&!V?jsxs(Fragment,{children:[jsx("audio",{ref:F,preload:"metadata",crossOrigin:"anonymous"}),jsxs("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",rr[i]),style:{"--accent":w},onMouseEnter:()=>{Se(true),be(true),D?.(true);},children:[jsx("div",{className:s("h-full w-full rounded-full",z?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:z?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),z&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!pe&&!V?jsx("audio",{ref:F,preload:"metadata",crossOrigin:"anonymous"}):jsxs(Fragment,{children:[jsx("audio",{ref:F,preload:"metadata",crossOrigin:"anonymous"}),jsx("div",{className:s("fixed z-100",Q?nr[i]:tr[i],de),style:{"--accent":w,...V?{animation:v}:{animation:r}},onMouseEnter:()=>{Q&&(ee.current&&(clearTimeout(ee.current),ee.current=void 0),V&&he(false),Se(true));},onMouseLeave:()=>{Q&&(Se(false),le());},children:jsxs("div",{className:s("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",we,J,Q&&"rounded-none",i.endsWith("right")&&Q&&"rounded-l-2xl",i.endsWith("left")&&Q&&"rounded-r-2xl",_),children:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:P.cover||Ct,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:z?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:P.cover||Ct,alt:P.album??P.title,className:"h-full w-full object-cover",draggable:false}),jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),z&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:s("truncate text-sm font-semibold",Ce),children:P.title}),P.artist&&jsx("div",{className:s("truncate text-xs",re),children:P.artist}),P.album&&jsx("div",{className:s("mt-0.5 truncate text-[10px] tracking-wide",re,"opacity-60"),children:P.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsx("button",{className:s("rounded-full p-1.5 transition-all duration-200",o.has(y)?"text-rose-500 hover:text-rose-400":s(re,"hover:text-rose-500")),onClick:We,title:"Like",children:jsx(Heart,{className:"h-4 w-4",fill:o.has(y)?"currentColor":"none"})}),jsx("button",{className:s("rounded-full p-1.5 transition-colors",re,"hover:"+Ce.split(" ")[0]),onClick:()=>ne(a=>!a),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!Q&&jsx("button",{className:s("rounded-full p-1.5 transition-colors",re,"hover:"+Ce.split(" ")[0]),onClick:le,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:ye,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:at,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${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(${Y}% - 6px)`}})]}),jsxs("div",{className:s("mt-1 flex justify-between text-[10px] font-mono",re),children:[jsx("span",{children:qt(A)}),jsx("span",{children:qt(I)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsx("button",{className:s("rounded-full p-1.5 transition-colors",ce?Ee:re,"hover:text-(--mp-text)"),onClick:()=>ze(a=>!a),title:ce?"Shuffle On":"Shuffle Off",children:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),jsx("button",{className:s("rounded-full p-1.5 transition-colors",me?Ee:re,"hover:text-(--mp-text)"),onClick:()=>Fe(a=>!a),title:me?"Loop On":"Loop Off",children:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:s("rounded-full p-2 transition-colors",re,"hover:text-(--mp-text)"),onClick:Ye,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:s("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:()=>{fe(),G(a=>!a);},title:z?"Pause":"Play",children:z?jsx(Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsx(Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:s("rounded-full p-2 transition-colors",re,"hover:text-(--mp-text)"),onClick:Te,title:"Next",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsx("button",{className:s("rounded-full p-1 transition-colors",re,"hover:text-(--mp-text)"),onClick:()=>{fe();let a=!E;C(a),te.current&&(te.current.gain.value=a?0:d);},title:E?"Unmute":"Mute",children:E||d===0?jsx(VolumeX,{className:"h-3.5 w-3.5"}):jsx(Volume2,{className:"h-3.5 w-3.5"})}),jsx("input",{type:"range",min:0,max:1,step:.01,value:E?0:d,onChange:a=>{fe();let R=Number(a.target.value);b(R),E&&C(false),te.current&&(te.current.gain.value=R);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsx("div",{className:s("overflow-hidden transition-all duration-300 ease-in-out",K?"max-h-60":"max-h-0"),children:jsx("div",{className:s("border-t px-2 py-2",J),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((a,R)=>{let oe=R===y;return jsxs("button",{className:s("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",oe?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{M(R),G(true);},children:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:oe&&z?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(Me=>jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+Me*4}px`,animation:`mp-eq-bar ${.4+Me*.15}s ease-in-out infinite alternate`}},Me))}):oe?jsx(Disc3,{className:s("h-4 w-4",Ee)}):jsx("span",{className:s("text-xs font-mono",re),children:R+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:a.cover||Ct,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:s("truncate text-xs font-medium",oe?Ee:Ce),children:a.title}),a.artist&&jsx("div",{className:s("truncate text-[10px]",re),children:a.artist})]}),o.has(R)&&jsx(Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},R)})})})})]})})]})}function ut(e){if(!isFinite(e)||e<0)return "0:00";let n=Math.floor(e/3600),i=Math.floor(e%3600/60),g=Math.floor(e%60);return n>0?`${n}:${i.toString().padStart(2,"0")}:${g.toString().padStart(2,"0")}`:`${i}:${g.toString().padStart(2,"0")}`}var vr={title:(e,n)=>e.title.localeCompare(n.title),type:(e,n)=>(e.type??"").localeCompare(n.type??""),duration:(e,n)=>(e.duration??0)-(n.duration??0)};function Tt({playlist:e,initialTrack:n=0,autoPlay:i=false,shuffle:g=false,loop:k=false,onTrackChange:m,onPlayChange:h,accent:D="#8b5cf6",className:S}){let[x,j]=useState(n),[T,N]=useState(false),[w,_]=useState(0),[y,B]=useState(0),[z,G]=useState(0),[A,X$1]=useState(.8),[I,ge]=useState(false),[d,b]=useState(g),[E,C]=useState(k),[o,L]=useState(false),[K,ne]=useState("title"),[U,be]=useState(true),[V,he]=useState(false),[$e,Se]=useState(false),[ce,ze]=useState(false),[me,Fe]=useState(true),[Pe,F]=useState(false),[ye,ee]=useState(null),Z=useRef(null),te=useRef(null),pe=useRef(void 0),Ne=useRef(false),P=e[x],Ke=ln.useMemo(()=>{let r=e.map((v,Y)=>({media:v,originalIndex:Y}));return r.sort((v,Y)=>{let a=vr[K](v.media,Y.media);return U?a:-a}),r},[e,K,U]);useEffect(()=>{let r=Z.current;if(!r)return;F(true),r.src=P.src,P.poster&&(r.poster=P.poster),r.load();let v=()=>{F(false),T&&r.play().catch(()=>{});};return r.addEventListener("loadeddata",v,{once:true}),()=>r.removeEventListener("loadeddata",v)},[x,P.src]),useEffect(()=>{if(!i||Ne.current)return;let r=Z.current;if(!r)return;let v=()=>{Ne.current=true,N(true),r.play().catch(()=>{});};return r.addEventListener("canplaythrough",v,{once:true}),()=>r.removeEventListener("canplaythrough",v)},[i]),useEffect(()=>{let r=Z.current;r&&(T?r.play().catch(()=>{}):r.pause(),h?.(T));},[T]),useEffect(()=>{let r=Z.current;r&&(r.volume=I?0:A);},[A,I]),useEffect(()=>{let r=Z.current;if(!r)return;let v=()=>_(r.currentTime),Y=()=>B(r.duration),a=()=>{r.buffered.length>0&&G(r.buffered.end(r.buffered.length-1));},R=()=>{E?(r.currentTime=0,r.play().catch(()=>{})):we();};return r.addEventListener("timeupdate",v),r.addEventListener("loadedmetadata",Y),r.addEventListener("progress",a),r.addEventListener("ended",R),()=>{r.removeEventListener("timeupdate",v),r.removeEventListener("loadedmetadata",Y),r.removeEventListener("progress",a),r.removeEventListener("ended",R);}},[x,e.length,E]);let Q=useCallback(()=>{Fe(true),pe.current&&clearTimeout(pe.current),pe.current=setTimeout(()=>{T&&Fe(false);},3e3);},[T]);useEffect(()=>{T?Q():(Fe(true),pe.current&&clearTimeout(pe.current));},[T,Q]),useEffect(()=>()=>{pe.current&&clearTimeout(pe.current);},[]);let de=useCallback(r=>{let v=(r%e.length+e.length)%e.length;j(v),_(0),N(true),m?.(v,e[v]);},[e,m]),we=useCallback(()=>{if(d){let r;do r=Math.floor(Math.random()*e.length);while(r===x&&e.length>1);de(r);}else de(x+1);},[de,x,d,e.length]),Ce=useCallback(()=>{if(d){let r;do r=Math.floor(Math.random()*e.length);while(r===x&&e.length>1);de(r);}else de(x-1);},[de,x,d,e.length]),re=useCallback(r=>{let v=r.currentTarget.getBoundingClientRect(),a=Math.max(0,Math.min(1,(r.clientX-v.left)/v.width))*y;Z.current&&(Z.current.currentTime=a),_(a);},[y]),Ee=useCallback(r=>{let v=r.currentTarget.getBoundingClientRect(),Y=Math.max(0,Math.min(1,(r.clientX-v.left)/v.width));ee(Y*y);},[y]),J=useCallback(()=>{te.current&&(document.fullscreenElement?document.exitFullscreen():te.current.requestFullscreen());},[]);useEffect(()=>{let r=()=>ze(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",r),()=>document.removeEventListener("fullscreenchange",r)},[]);let M=useCallback(()=>{V?(Se(true),setTimeout(()=>{he(false),Se(false);},500)):he(true);},[V]),Te=useCallback(()=>{L(r=>!r);},[]),Ye=useCallback(()=>{let r=["title","type","duration"],v=r.indexOf(K);U?be(false):(be(true),ne(r[(v+1)%r.length]));},[K,U]);useEffect(()=>{let r=v=>{if(!(v.target instanceof HTMLInputElement||v.target instanceof HTMLTextAreaElement))switch(v.key){case " ":case "k":v.preventDefault(),N(Y=>!Y);break;case "f":v.preventDefault(),J();break;case "t":v.preventDefault(),M();break;case "ArrowLeft":v.preventDefault(),Z.current&&(Z.current.currentTime=Math.max(0,w-5));break;case "ArrowRight":v.preventDefault(),Z.current&&(Z.current.currentTime=Math.min(y,w+5));break;case "ArrowUp":v.preventDefault(),X$1(Y=>Math.min(1,Y+.05));break;case "ArrowDown":v.preventDefault(),X$1(Y=>Math.max(0,Y-.05));break;case "Escape":V&&M();break;case "n":v.preventDefault(),we();break;case "p":v.preventDefault(),Ce();break;case "l":v.preventDefault(),Te();break}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[J,M,Te,we,Ce,w,y,V]);let We=y>0?w/y*100:0,at=y>0?z/y*100:0,le="text-(--accent)",fe=jsxs("div",{ref:te,className:s("group flex overflow-hidden",ce?"h-full w-full":"aspect-video w-full",!ce&&"rounded-xl",!ce&&T&&"shadow-2xl",!ce&&!T&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",S),style:{"--accent":D,background:"var(--cp-bg)"},tabIndex:0,children:[jsxs("div",{className:s("relative flex-1 min-w-0 h-full overflow-hidden",Pe&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:Q,onMouseLeave:()=>{T&&Fe(false);},children:[jsx("video",{ref:Z,className:"h-full w-full object-contain",poster:P.poster,playsInline:true,preload:"metadata",onClick:()=>N(r=>!r)}),!T&&!Pe&&jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>N(true),children: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:jsx(Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),Pe&&!me&&jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:P.title}),P.subtitle&&jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:P.subtitle})]})}),jsx("div",{className:s("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",me?"opacity-100":"pointer-events-none opacity-0"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:P.title}),P.subtitle&&jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:P.subtitle})]}),P.type&&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:P.type})]})}),jsxs("div",{className:s("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",me?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[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:re,onMouseMove:Ee,onMouseLeave:()=>ee(null),children:[jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${at}%`,background:"var(--cp-seek-buffer)"}}),jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${We}%`}}),ye!==null&&jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${ye/y*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:ut(ye)}),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(${We}% - 7px)`}})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{className:"cp-btn",onClick:()=>N(r=>!r),title:T?"Pause (k)":"Play (k)",children:T?jsx(Pause,{className:"h-5 w-5",fill:"currentColor"}):jsx(Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:Ce,title:"Previous (p)",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:we,title:"Next (n)",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsx("button",{className:"cp-btn",onClick:()=>ge(r=>!r),title:I?"Unmute":"Mute",children:I||A===0?jsx(VolumeX,{className:"h-4 w-4"}):jsx(Volume2,{className:"h-4 w-4"})}),jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsx("input",{type:"range",min:0,max:1,step:.01,value:I?0:A,onChange:r=>{X$1(Number(r.target.value)),I&&ge(false);},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),jsxs("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[ut(w)," / ",ut(y)]}),jsx("div",{className:"flex-1"}),jsx("button",{className:s("cp-btn",d&&le),onClick:()=>b(r=>!r),title:"Shuffle",children:jsx(Shuffle,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",E&&le),onClick:()=>C(r=>!r),title:"Loop",children:jsx(Repeat1,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",o&&le),onClick:Te,title:"Playlist",children:jsx(ListVideo,{className:"h-4 w-4"})}),jsx("button",{className:s("cp-btn",V&&le),onClick:M,title:"Cinema mode (t)",children:jsx(Theater,{className:"h-4 w-4"})}),jsx("button",{className:"cp-btn",onClick:J,title:"Fullscreen (f)",children:ce?jsx(Minimize,{className:"h-4 w-4"}):jsx(Maximize,{className:"h-4 w-4"})})]})]})]}),jsx("div",{className:s("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",o?"w-72":"w-0"),children: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:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxs("div",{className:"flex items-center gap-1",children:[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:Ye,title:`Sort: ${K} ${U?"\u2191":"\u2193"}`,children:[jsx(ArrowUpDown,{className:"h-3 w-3"}),K,U?" \u2191":" \u2193"]}),jsx("button",{className:"cp-btn p-1!",onClick:Te,title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:Ke.map(({media:r,originalIndex:v})=>{let Y=v===x;return jsxs("button",{className:s("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",Y?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:Y?void 0:{color:"var(--cp-text)"},onClick:()=>{de(v);},children:[jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[r.poster?jsx("img",{src:r.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsx(Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),Y&&T&&jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(a=>jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+a*3}px`,animation:`mp-eq-bar ${.3+a*.12}s ease-in-out infinite alternate`}},a))})})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:"truncate text-xs font-medium",children:r.title}),jsxs("div",{className:"flex items-center gap-2",children:[r.type&&jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:r.type}),r.duration!=null&&jsx("span",{className:"font-mono text-[10px] opacity-40",children:ut(r.duration)})]})]}),Y&&jsx(ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},v)})})]})}),jsx("style",{children:`
7
7
  .cp-btn {
8
8
  display: flex;
9
9
  align-items: center;
@@ -19,7 +19,7 @@ import rn,{createContext,useState,useCallback,useRef,useLayoutEffect,useEffect,u
19
19
  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); }
20
20
  50% { box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 55%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }
21
21
  }
22
- `})]});return jsx("div",{className:s(I&&"fixed inset-0 z-100 flex items-center justify-center p-8",I&&($e?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:I?n=>{n.target===n.currentTarget&&N();}:void 0,children:jsx("div",{className:s(I&&"w-full",I&&!ce&&"max-w-5xl"),children:fe})})}var Ct=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"}});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"}});var He=[];function vr(e){He.push(e);}function yr(e){let o=He.indexOf(e);o!==-1&&He.splice(o,1);}function Et(e){return He.length>0&&He[He.length-1]===e}function wr(e){let o=He.indexOf(e);return o!==-1?o:He.length}var Gt=createContext(null);function qt({open:e,onOpenChange:o,modal:l=true,closeOnOutsideClick:g=false,children:w}){let f=useId();return useEffect(()=>{if(e)return vr(f),()=>yr(f)},[e,f]),useEffect(()=>{if(!e||!l)return;let v=z=>{z.key==="Escape"&&Et(f)&&o(false);};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,l,o,f]),useEffect(()=>{if(!e||!l)return;let v=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=v;}},[e,l]),e?jsx(Gt.Provider,{value:{id:f,onOpenChange:o,modal:l,closeOnOutsideClick:g},children:createPortal(w,document.body)}):null}function Zt({size:e,position:o="center",className:l,children:g,...w}){let f=useContext(Gt);if(!f)return null;let z=200+wr(f.id)*10,F=()=>{f.closeOnOutsideClick&&Et(f.id)&&f.onOpenChange(false);},x=o==="bottom";return f.modal?jsx("div",{className:s("animate-fade-in fixed inset-0 bg-black/50",x?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:z},onClick:F,children:jsx("div",{className:s(Ct({size:e}),x?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",l),role:"dialog","aria-modal":"true",onClick:_=>_.stopPropagation(),...w,children:g})}):jsx("div",{className:s("fixed inset-0 flex items-center justify-center p-4",f.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:z},onClick:f.closeOnOutsideClick&&Et(f.id)?()=>f.onOpenChange(false):void 0,children:jsx("div",{className:s(Ct({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",l),role:"dialog",onClick:f.closeOnOutsideClick?_=>_.stopPropagation():void 0,...w,children:g})})}function Qt({className:e,...o}){return jsx("div",{className:s("mb-4 space-y-1",e),...o})}function Jt({className:e,...o}){return jsx("h2",{className:s("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),...o})}function en({className:e,...o}){return jsx("p",{className:s("text-primary-500 dark:text-primary-400 text-sm",e),...o})}function tn({className:e,...o}){return jsx("div",{className:s("mt-6 flex justify-end gap-2",e),...o})}var nn=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"}});cva("inline-flex items-center gap-1 rounded border font-semibold [&_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"},size:{sm:"px-1.5 py-0 text-[0.625rem] [&_svg]:h-2.5 [&_svg]:w-2.5",md:"px-2.5 py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",lg:"px-3 py-1 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5"}},defaultVariants:{intent:"primary",size:"md"}});cva("absolute flex items-center justify-center rounded-full font-bold leading-none ring-2 ring-white select-none pointer-events-none z-10 dark:ring-primary-900",{variants:{intent:{danger:"bg-danger-500 text-white",success:"bg-success-500 text-white",warning:"bg-warning-500 text-white",info:"bg-primary-500 text-white",primary:"bg-secondary-500 text-white"},size:{sm:"text-[0.5rem]",md:"text-[0.625rem]",lg:"text-xs"},dot:{true:"",false:""},placement:{"top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2"}},compoundVariants:[{dot:true,size:"sm",class:"h-1.5 w-1.5 min-w-0 ring-1"},{dot:true,size:"md",class:"h-2 w-2 min-w-0"},{dot:true,size:"lg",class:"h-2.5 w-2.5 min-w-0"},{dot:false,size:"sm",class:"h-4 min-w-4 px-1"},{dot:false,size:"md",class:"h-5 min-w-5 px-1.5"},{dot:false,size:"lg",class:"h-6 min-w-6 px-2"}],defaultVariants:{intent:"danger",size:"md",dot:false,placement:"top-right"}});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"}});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"}});cva("relative inline-flex shrink-0 items-center justify-center rounded border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4 rounded-[3px]",md:"h-5 w-5 rounded",lg:"h-6 w-6 rounded-[5px]"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}});cva("relative inline-flex shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}});cva("",{variants:{intent:{primary:"",secondary:"",danger:"",warning:"",success:""},size:{sm:"",md:"",lg:""},checked:{on:"",off:"bg-primary-300 dark:bg-primary-800"}},compoundVariants:[{intent:"primary",checked:"on",class:"bg-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"bg-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"bg-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"bg-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"bg-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}});function Lt({intent:e,size:o,className:l,...g}){return jsx("button",{className:s(nn({intent:e,size:o}),l),...g})}function mt(e){let o=e.lastIndexOf(".");return o>0?e.slice(o).toLowerCase():""}function ln(e){return e==null?"\u2014":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Tt(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var Ar={".png":Image,".jpg":Image,".jpeg":Image,".gif":Image,".svg":Image,".webp":Image,".ico":Image,".bmp":Image,".mp3":Music,".wav":Music,".flac":Music,".ogg":Music,".aac":Music,".m4a":Music,".mp4":Video,".mkv":Video,".avi":Video,".mov":Video,".wmv":Video,".webm":Video,".ts":FileCode,".tsx":FileCode,".js":FileCode,".jsx":FileCode,".json":FileCode,".html":FileCode,".css":FileCode,".scss":FileCode,".py":FileCode,".rs":FileCode,".go":FileCode,".java":FileCode,".c":FileCode,".cpp":FileCode,".h":FileCode,".sh":Terminal,".bat":Terminal,".ps1":Terminal,".md":FileText,".txt":FileText,".pdf":FileText,".doc":FileText,".docx":FileText,".rtf":FileText,".csv":FileSpreadsheet,".xls":FileSpreadsheet,".xlsx":FileSpreadsheet,".db":Database,".sqlite":Database,".sql":Database,".zip":FileArchive,".tar":FileArchive,".gz":FileArchive,".rar":FileArchive,".7z":FileArchive};function Rt(e){if(e.type==="directory")return Folder;let o=e.extension||mt(e.name);return Ar[o]||File}function rt(e,o,l){return Math.max(o,Math.min(l,e))}function cn(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function dn(e,o){if(e<480)return {size:{width:e-16,height:o-48},pos:{x:8,y:24}};if(e<640){let w=e-24,f=Math.min(o-64,540);return {size:{width:w,height:f},pos:{x:12,y:32}}}if(e<1024){let w=Math.min(640,e-32),f=Math.min(480,o-64);return {size:{width:w,height:f},pos:{x:Math.max(0,Math.round((e-w)/2)),y:Math.max(0,Math.round((o-f)/2))}}}let l=720,g=520;return {size:{width:l,height:g},pos:{x:Math.max(0,Math.round((e-l)/2)),y:Math.max(0,Math.round((o-g)/2))}}}function zt({files:e,title:o="File Explorer",accent:l="#8b5cf6",defaultView:g="list",initialPosition:w,initialSize:f,dockable:v=false,dockSide:z="right",visible:F=true,onFileOpen:x,onSelectionChange:_,onNavigate:D,onDelete:L,onClose:k,onMinimize:G,onPathSubmit:y,defaultInputMode:ee="search",actions:A,resizable:ne=true,minSize:$={width:400,height:300},className:K}){let[j,Me]=useState(g),[u,b]=useState(new Set),[C,S]=useState(null),[a,O]=useState(false),[Y,ie]=useState(false),[q,ge]=useState(""),[I,be]=useState(ee),[$e,Re]=useState(F),[ce,ze]=useState(false),[me,Fe]=useState({w:window.innerWidth,h:window.innerHeight}),De=dn(window.innerWidth,window.innerHeight),[P,ve]=useState(w??De.pos),[Q,W]=useState(f??De.size),[J,pe]=useState(null),ke=useRef(false),M=useRef({x:0,y:0}),Ke=useRef(null),U=useRef(false),de=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),ye=useRef(false),Ne=useRef(a);useEffect(()=>{Ne.current=a;},[a]);let te=F!==void 0?F:$e,Ee=useMemo(()=>{let t=e.filter(T=>T.type==="directory"),m=e.filter(T=>T.type==="file");return t.sort((T,R)=>T.name.localeCompare(R.name)),m.sort((T,R)=>T.name.localeCompare(R.name)),[...t,...m]},[e]),Z=useMemo(()=>{if(I!=="search"||!q.trim())return Ee;let t=q.toLowerCase();return Ee.filter(m=>m.name.toLowerCase().includes(t))},[Ee,q,I]),N=C!=null?Z[C]:null;useEffect(()=>{let t=cn(window.innerWidth),m=()=>{let T=window.innerWidth,R=window.innerHeight;if(Fe({w:T,h:R}),Ne.current)return;let X=cn(T);if(X!==t&&!ye.current&&!f){let we=dn(T,R);W(we.size),ve(we.pos);}t=X;};return window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[f]);let Le=useCallback((t,m)=>{b(T=>{let R=new Set(T);return m.ctrlKey||m.metaKey?R.has(t)?R.delete(t):R.add(t):(R.clear(),R.add(t)),R}),S(t);},[]);useEffect(()=>{if(!_)return;let t=Array.from(u).map(m=>Z[m]).filter(Boolean);_(t);},[u]);let Ye=useCallback(t=>{let m=Z[t];m&&(m.type==="directory"?D?.(m.path):x?.(m));},[Z,x,D]),We=useCallback(t=>{a||t.target.closest("button")||(ye.current=true,ke.current=true,M.current={x:t.clientX-P.x,y:t.clientY-P.y},t.preventDefault());},[P,a]),at=useCallback(t=>{if(a||t.target.closest("button"))return;ye.current=true;let m=t.touches[0];ke.current=true,M.current={x:m.clientX-P.x,y:m.clientY-P.y};},[P,a]);useEffect(()=>{let t=R=>{if(!ke.current)return;let X=window.innerWidth-100,we=window.innerHeight-40;ve({x:rt(R.clientX-M.current.x,0,X),y:rt(R.clientY-M.current.y,0,we)});},m=R=>{if(!ke.current)return;R.preventDefault();let X=R.touches[0],we=window.innerWidth-100,je=window.innerHeight-40;ve({x:rt(X.clientX-M.current.x,0,we),y:rt(X.clientY-M.current.y,0,je)});},T=()=>{ke.current=false,U.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",T),window.addEventListener("touchmove",m,{passive:false}),window.addEventListener("touchend",T),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",T),window.removeEventListener("touchmove",m),window.removeEventListener("touchend",T);}},[]);let le=useCallback((t,m)=>{a||(m.preventDefault(),m.stopPropagation(),ye.current=true,U.current=t,de.current={x:m.clientX,y:m.clientY,w:Q.width,h:Q.height,px:P.x,py:P.y},document.body.style.cursor=t==="e"||t==="w"?"ew-resize":t==="n"||t==="s"?"ns-resize":t==="nw"||t==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[a,Q,P]),fe=useCallback((t,m)=>{if(a)return;m.preventDefault(),m.stopPropagation(),ye.current=true;let T=m.touches[0];U.current=t,de.current={x:T.clientX,y:T.clientY,w:Q.width,h:Q.height,px:P.x,py:P.y},document.body.style.userSelect="none";},[a,Q,P]);useEffect(()=>{let t=(X,we)=>{let je=U.current;if(!je)return;let Ot=X-de.current.x,_t=we-de.current.y,{w:Ue,h:Ge,px:gt,py:bt}=de.current;if(je.includes("e")&&(Ue=Math.max($.width,Ue+Ot)),je.includes("w")){let st=Math.max($.width,Ue-Ot);gt=gt+(Ue-st),Ue=st;}if(je.includes("s")&&(Ge=Math.max($.height,Ge+_t)),je.includes("n")){let st=Math.max($.height,Ge-_t);bt=bt+(Ge-st),Ge=st;}W({width:Ue,height:Ge}),ve({x:gt,y:bt});},m=X=>{U.current&&t(X.clientX,X.clientY);},T=X=>{U.current&&(X.preventDefault(),t(X.touches[0].clientX,X.touches[0].clientY));},R=()=>{U.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",m),window.addEventListener("mouseup",R),window.addEventListener("touchmove",T,{passive:false}),window.addEventListener("touchend",R),()=>{window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",R),window.removeEventListener("touchmove",T),window.removeEventListener("touchend",R);}},[$]);let n=useCallback(()=>{a?(J&&(ve(J.pos),W(J.size)),O(false)):(pe({pos:P,size:Q}),O(true));},[a,P,Q,J]),h=useCallback(()=>{Y?ie(false):(a&&(O(false),J&&(ve(J.pos),W(J.size))),ie(true),G?.());},[Y,a,J,G]);useEffect(()=>{if(!te||Y)return;let t=m=>{if(!(!Ke.current?.contains(document.activeElement)&&document.activeElement!==Ke.current)){if(m.key==="Escape"&&(S(null),b(new Set)),m.ctrlKey&&m.key==="a"){m.preventDefault();let T=new Set(Z.map((R,X)=>X));b(T);}m.key==="Delete"&&u.size>0&&L&&(m.preventDefault(),ze(true));}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[te,Y,Z,u,L]);let V={"--fe-accent":l};if(Y)return jsx("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",z==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:V,onClick:()=>ie(false),title:`Restore ${o}`,children: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:[jsx(HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:o})]})});if(!te)return null;let r=a?me.w:Math.min(Q.width,me.w-8),E=a?me.h:Math.min(Q.height,me.h-8),re=a?0:rt(P.x,0,Math.max(0,me.w-r)),Ce=a?0:rt(P.y,0,Math.max(0,me.h-40)),ft=r<500;return jsxs("div",{ref:Ke,className:s("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]",a&&"rounded-none",K),style:{...V,left:re,top:Ce,width:r,height:E,transition:a?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[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:We,onTouchStart:at,onDoubleClick:n,children:[jsxs("div",{className:"flex items-center gap-2",children:[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:jsx(HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:o}),jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{className:"fe-btn mr-1",onClick:()=>Me(t=>t==="list"?"grid":"list"),title:j==="list"?"Grid view":"List view",children:j==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),v&&jsx("button",{className:"fe-btn",onClick:h,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:n,title:a?"Restore":"Maximize",children:a?jsx(Minimize2,{className:"h-3.5 w-3.5"}):jsx(Maximize2,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{k?.(),Re(false);},title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsx("button",{className:"fe-btn p-1",onClick:()=>D?.(".."),title:"Go up",children:jsx(FolderUp,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:I==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>be(t=>t==="search"?"navigate":"search"),title:I==="search"?"Switch to path navigation":"Switch to file search",children:I==="search"?jsx(Search,{className:"h-3 w-3"}):jsx(CornerRightDown,{className:"h-3 w-3"})}),jsx("div",{className:"relative flex-1",children:jsx("input",{type:"text",value:q,onChange:t=>ge(t.target.value),onKeyDown:t=>{t.key==="Enter"&&q.trim()&&I==="navigate"&&(y?y(q.trim()):D?.(q.trim()));},placeholder:I==="search"?"Search files\u2026":"Enter path and press Enter\u2026",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)"})}),jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[Z.length," item",Z.length!==1?"s":"",u.size>0&&` \xB7 ${u.size} selected`]})]}),jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:t=>{t.target===t.currentTarget&&(b(new Set),S(null));},children:Z.length===0?jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsx(Folder,{className:"mb-2 h-10 w-10"}),jsx("span",{className:"text-xs",children:"No files found"})]}):j==="list"?jsx("div",{className:"space-y-px",children:Z.map((t,m)=>{let T=Rt(t),R=u.has(m),X=t.extension||mt(t.name);return jsxs("div",{className:s("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",R?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:R?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:we=>Le(m,we),onDoubleClick:()=>Ye(m),children:[jsx(T,{className:s("h-4 w-4 shrink-0",t.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:t.name}),X&&t.type==="file"&&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:X}),t.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:ln(t.size)}),t.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Tt(t.modifiedAt)})]},t.path+m)})}):jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:Z.map((t,m)=>{let T=Rt(t),R=u.has(m),X=t.extension||mt(t.name);return jsxs("div",{className:s("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",R?"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:we=>Le(m,we),onDoubleClick:()=>Ye(m),children:[jsx(T,{className:s("h-7 w-7",t.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:t.name}),X&&t.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:X})]},t.path+m)})})}),jsx("div",{className:s("overflow-hidden transition-[width,opacity] duration-300 ease-out",ft?s("absolute right-0 top-0 bottom-0 z-10",N?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):s("shrink-0",N?"w-56":"w-0")),children:N&&jsxs("div",{className:s("flex h-full flex-col p-4",ft?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[ft&&jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{S(null),b(new Set);},title:"Close panel",children:jsx(X,{className:"h-3.5 w-3.5"})}),jsxs("div",{className:"mb-3 flex flex-col items-center",children:[rn.createElement(Rt(N),{className:s("h-10 w-10 mb-2",N.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:N.name})]}),jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsx(ot,{label:"Type",value:N.type==="directory"?"Directory":N.mimeType||N.extension||mt(N.name)||"File"}),N.size!=null&&jsx(ot,{label:"Size",value:ln(N.size)}),jsx(ot,{label:"Path",value:N.path,mono:true}),N.extension&&jsx(ot,{label:"Extension",value:N.extension}),N.modifiedAt&&jsx(ot,{label:"Modified",value:Tt(N.modifiedAt)}),N.createdAt&&jsx(ot,{label:"Created",value:Tt(N.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[N.type==="file"&&x&&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:()=>x(N),children:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),A?.map(t=>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:()=>t.onClick(N),children:[t.icon&&rn.createElement(t.icon,{className:"h-3 w-3"}),t.label]},t.key))]})]})})]}),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:[jsxs("span",{children:[Z.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[u.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[u.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),ne&&!a&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:t=>le("n",t),onTouchStart:t=>fe("n",t)}),jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:t=>le("s",t),onTouchStart:t=>fe("s",t)}),jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:t=>le("w",t),onTouchStart:t=>fe("w",t)}),jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:t=>le("e",t),onTouchStart:t=>fe("e",t)}),jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:t=>le("nw",t),onTouchStart:t=>fe("nw",t)}),jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:t=>le("ne",t),onTouchStart:t=>fe("ne",t)}),jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:t=>le("sw",t),onTouchStart:t=>fe("sw",t)}),jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:t=>le("se",t),onTouchStart:t=>fe("se",t)})]}),jsx("style",{children:`
22
+ `})]});return jsx("div",{className:s(V&&"fixed inset-0 z-100 flex items-center justify-center p-8",V&&($e?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:V?r=>{r.target===r.currentTarget&&M();}:void 0,children:jsx("div",{className:s(V&&"w-full",V&&!ce&&"max-w-5xl"),children:fe})})}var Lt=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"}});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"}});var He=[];function Cr(e){He.push(e);}function Mr(e){let n=He.indexOf(e);n!==-1&&He.splice(n,1);}function Rt(e){return He.length>0&&He[He.length-1]===e}function Er(e){let n=He.indexOf(e);return n!==-1?n:He.length}var Jt=createContext(null);function en({open:e,onOpenChange:n,modal:i=true,closeOnOutsideClick:g=false,children:k}){let m=useId();return useEffect(()=>{if(e)return Cr(m),()=>Mr(m)},[e,m]),useEffect(()=>{if(!e||!i)return;let h=D=>{D.key==="Escape"&&Rt(m)&&n(false);};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,i,n,m]),useEffect(()=>{if(!e||!i)return;let h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=h;}},[e,i]),e?jsx(Jt.Provider,{value:{id:m,onOpenChange:n,modal:i,closeOnOutsideClick:g},children:createPortal(k,document.body)}):null}function tn({size:e,position:n="center",className:i,children:g,...k}){let m=useContext(Jt);if(!m)return null;let D=200+Er(m.id)*10,S=()=>{m.closeOnOutsideClick&&Rt(m.id)&&m.onOpenChange(false);},x=n==="bottom";return m.modal?jsx("div",{className:s("animate-fade-in fixed inset-0 bg-black/50",x?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:D},onClick:S,children:jsx("div",{className:s(Lt({size:e}),x?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",i),role:"dialog","aria-modal":"true",onClick:j=>j.stopPropagation(),...k,children:g})}):jsx("div",{className:s("fixed inset-0 flex items-center justify-center p-4",m.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:D},onClick:m.closeOnOutsideClick&&Rt(m.id)?()=>m.onOpenChange(false):void 0,children:jsx("div",{className:s(Lt({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",i),role:"dialog",onClick:m.closeOnOutsideClick?j=>j.stopPropagation():void 0,...k,children:g})})}function nn({className:e,...n}){return jsx("div",{className:s("mb-4 space-y-1",e),...n})}function rn({className:e,...n}){return jsx("h2",{className:s("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),...n})}function on({className:e,...n}){return jsx("p",{className:s("text-primary-500 dark:text-primary-400 text-sm",e),...n})}function an({className:e,...n}){return jsx("div",{className:s("mt-6 flex justify-end gap-2",e),...n})}var sn=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"}});cva("inline-flex items-center gap-1 rounded border font-semibold [&_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"},size:{sm:"px-1.5 py-0 text-[0.625rem] [&_svg]:h-2.5 [&_svg]:w-2.5",md:"px-2.5 py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",lg:"px-3 py-1 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5"}},defaultVariants:{intent:"primary",size:"md"}});cva("absolute flex items-center justify-center rounded-full font-bold leading-none ring-2 ring-white select-none pointer-events-none z-10 dark:ring-primary-900",{variants:{intent:{danger:"bg-danger-500 text-white",success:"bg-success-500 text-white",warning:"bg-warning-500 text-white",info:"bg-primary-500 text-white",primary:"bg-secondary-500 text-white"},size:{sm:"text-[0.5rem]",md:"text-[0.625rem]",lg:"text-xs"},dot:{true:"",false:""},placement:{"top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2"}},compoundVariants:[{dot:true,size:"sm",class:"h-1.5 w-1.5 min-w-0 ring-1"},{dot:true,size:"md",class:"h-2 w-2 min-w-0"},{dot:true,size:"lg",class:"h-2.5 w-2.5 min-w-0"},{dot:false,size:"sm",class:"h-4 min-w-4 px-1"},{dot:false,size:"md",class:"h-5 min-w-5 px-1.5"},{dot:false,size:"lg",class:"h-6 min-w-6 px-2"}],defaultVariants:{intent:"danger",size:"md",dot:false,placement:"top-right"}});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"}});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"}});cva("relative inline-flex shrink-0 items-center justify-center rounded border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4 rounded-[3px]",md:"h-5 w-5 rounded",lg:"h-6 w-6 rounded-[5px]"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}});cva("relative inline-flex shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",{variants:{intent:{primary:"border-primary-300 dark:border-primary-600 focus-visible:ring-primary-500/40",secondary:"border-secondary-300 dark:border-secondary-600 focus-visible:ring-secondary-500/40",danger:"border-danger-300 dark:border-danger-600 focus-visible:ring-danger-500/40",warning:"border-warning-300 dark:border-warning-600 focus-visible:ring-warning-500/40",success:"border-success-300 dark:border-success-600 focus-visible:ring-success-500/40"},size:{sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},checked:{on:"",off:"bg-white dark:bg-primary-900"}},compoundVariants:[{intent:"primary",checked:"on",class:"border-primary-500 bg-primary-500 dark:border-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"border-secondary-500 bg-secondary-500 dark:border-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"border-danger-500 bg-danger-500 dark:border-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"border-warning-500 bg-warning-500 dark:border-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"border-success-500 bg-success-500 dark:border-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}});cva("",{variants:{intent:{primary:"",secondary:"",danger:"",warning:"",success:""},size:{sm:"",md:"",lg:""},checked:{on:"",off:"bg-primary-300 dark:bg-primary-800"}},compoundVariants:[{intent:"primary",checked:"on",class:"bg-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"bg-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"bg-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"bg-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"bg-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}});function Dt({intent:e,size:n,className:i,...g}){return jsx("button",{className:s(sn({intent:e,size:n}),i),...g})}function mt(e){let n=e.lastIndexOf(".");return n>0?e.slice(n).toLowerCase():""}function mn(e){return e==null?"\u2014":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function At(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var Vr={".png":Image,".jpg":Image,".jpeg":Image,".gif":Image,".svg":Image,".webp":Image,".ico":Image,".bmp":Image,".mp3":Music,".wav":Music,".flac":Music,".ogg":Music,".aac":Music,".m4a":Music,".mp4":Video,".mkv":Video,".avi":Video,".mov":Video,".wmv":Video,".webm":Video,".ts":FileCode,".tsx":FileCode,".js":FileCode,".jsx":FileCode,".json":FileCode,".html":FileCode,".css":FileCode,".scss":FileCode,".py":FileCode,".rs":FileCode,".go":FileCode,".java":FileCode,".c":FileCode,".cpp":FileCode,".h":FileCode,".sh":Terminal,".bat":Terminal,".ps1":Terminal,".md":FileText,".txt":FileText,".pdf":FileText,".doc":FileText,".docx":FileText,".rtf":FileText,".csv":FileSpreadsheet,".xls":FileSpreadsheet,".xlsx":FileSpreadsheet,".db":Database,".sqlite":Database,".sql":Database,".zip":FileArchive,".tar":FileArchive,".gz":FileArchive,".rar":FileArchive,".7z":FileArchive};function It(e){if(e.type==="directory")return Folder;let n=e.extension||mt(e.name);return Vr[n]||File}function rt(e,n,i){return Math.max(n,Math.min(i,e))}function pn(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function fn(e,n){if(e<480)return {size:{width:e-16,height:n-48},pos:{x:8,y:24}};if(e<640){let k=e-24,m=Math.min(n-64,540);return {size:{width:k,height:m},pos:{x:12,y:32}}}if(e<1024){let k=Math.min(640,e-32),m=Math.min(480,n-64);return {size:{width:k,height:m},pos:{x:Math.max(0,Math.round((e-k)/2)),y:Math.max(0,Math.round((n-m)/2))}}}let i=720,g=520;return {size:{width:i,height:g},pos:{x:Math.max(0,Math.round((e-i)/2)),y:Math.max(0,Math.round((n-g)/2))}}}function Ht({files:e,title:n="File Explorer",accent:i="#8b5cf6",defaultView:g="list",initialPosition:k,initialSize:m,dockable:h=false,dockSide:D="right",visible:S=true,onFileOpen:x,onSelectionChange:j,onNavigate:T,onDelete:N,onClose:w,onMinimize:_,onPathSubmit:y,defaultInputMode:B="search",actions:z,resizable:G=true,minSize:A={width:400,height:300},className:X$1}){let[I,ge]=useState(g),[d,b]=useState(new Set),[E,C]=useState(null),[o,L]=useState(false),[K,ne]=useState(false),[U,be]=useState(""),[V,he]=useState(B),[$e,Se]=useState(S),[ce,ze]=useState(false),[me,Fe]=useState({w:window.innerWidth,h:window.innerHeight}),Pe=fn(window.innerWidth,window.innerHeight),[F,ye]=useState(k??Pe.pos),[ee,Z]=useState(m??Pe.size),[te,pe]=useState(null),Ne=useRef(false),P=useRef({x:0,y:0}),Ke=useRef(null),Q=useRef(false),de=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),we=useRef(false),Ce=useRef(o);useEffect(()=>{Ce.current=o;},[o]);let re=S!==void 0?S:$e,Ee=useMemo(()=>{let t=e.filter(H=>H.type==="directory"),p=e.filter(H=>H.type==="file");return t.sort((H,O)=>H.name.localeCompare(O.name)),p.sort((H,O)=>H.name.localeCompare(O.name)),[...t,...p]},[e]),J=useMemo(()=>{if(V!=="search"||!U.trim())return Ee;let t=U.toLowerCase();return Ee.filter(p=>p.name.toLowerCase().includes(t))},[Ee,U,V]),M=E!=null?J[E]:null;useEffect(()=>{let t=pn(window.innerWidth),p=()=>{let H=window.innerWidth,O=window.innerHeight;if(Fe({w:H,h:O}),Ce.current)return;let q=pn(H);if(q!==t&&!we.current&&!m){let ke=fn(H,O);Z(ke.size),ye(ke.pos);}t=q;};return window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[m]);let Te=useCallback((t,p)=>{b(H=>{let O=new Set(H);return p.ctrlKey||p.metaKey?O.has(t)?O.delete(t):O.add(t):(O.clear(),O.add(t)),O}),C(t);},[]);useEffect(()=>{if(!j)return;let t=Array.from(d).map(p=>J[p]).filter(Boolean);j(t);},[d]);let Ye=useCallback(t=>{let p=J[t];p&&(p.type==="directory"?T?.(p.path):x?.(p));},[J,x,T]),We=useCallback(t=>{o||t.target.closest("button")||(we.current=true,Ne.current=true,P.current={x:t.clientX-F.x,y:t.clientY-F.y},t.preventDefault());},[F,o]),at=useCallback(t=>{if(o||t.target.closest("button"))return;we.current=true;let p=t.touches[0];Ne.current=true,P.current={x:p.clientX-F.x,y:p.clientY-F.y};},[F,o]);useEffect(()=>{let t=O=>{if(!Ne.current)return;let q=window.innerWidth-100,ke=window.innerHeight-40;ye({x:rt(O.clientX-P.current.x,0,q),y:rt(O.clientY-P.current.y,0,ke)});},p=O=>{if(!Ne.current)return;O.preventDefault();let q=O.touches[0],ke=window.innerWidth-100,je=window.innerHeight-40;ye({x:rt(q.clientX-P.current.x,0,ke),y:rt(q.clientY-P.current.y,0,je)});},H=()=>{Ne.current=false,Q.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",H),window.addEventListener("touchmove",p,{passive:false}),window.addEventListener("touchend",H),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",H),window.removeEventListener("touchmove",p),window.removeEventListener("touchend",H);}},[]);let le=useCallback((t,p)=>{o||(p.preventDefault(),p.stopPropagation(),we.current=true,Q.current=t,de.current={x:p.clientX,y:p.clientY,w:ee.width,h:ee.height,px:F.x,py:F.y},document.body.style.cursor=t==="e"||t==="w"?"ew-resize":t==="n"||t==="s"?"ns-resize":t==="nw"||t==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[o,ee,F]),fe=useCallback((t,p)=>{if(o)return;p.preventDefault(),p.stopPropagation(),we.current=true;let H=p.touches[0];Q.current=t,de.current={x:H.clientX,y:H.clientY,w:ee.width,h:ee.height,px:F.x,py:F.y},document.body.style.userSelect="none";},[o,ee,F]);useEffect(()=>{let t=(q,ke)=>{let je=Q.current;if(!je)return;let jt=q-de.current.x,Bt=ke-de.current.y,{w:Ge,h:Ue,px:vt,py:yt}=de.current;if(je.includes("e")&&(Ge=Math.max(A.width,Ge+jt)),je.includes("w")){let st=Math.max(A.width,Ge-jt);vt=vt+(Ge-st),Ge=st;}if(je.includes("s")&&(Ue=Math.max(A.height,Ue+Bt)),je.includes("n")){let st=Math.max(A.height,Ue-Bt);yt=yt+(Ue-st),Ue=st;}Z({width:Ge,height:Ue}),ye({x:vt,y:yt});},p=q=>{Q.current&&t(q.clientX,q.clientY);},H=q=>{Q.current&&(q.preventDefault(),t(q.touches[0].clientX,q.touches[0].clientY));},O=()=>{Q.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",p),window.addEventListener("mouseup",O),window.addEventListener("touchmove",H,{passive:false}),window.addEventListener("touchend",O),()=>{window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",O),window.removeEventListener("touchmove",H),window.removeEventListener("touchend",O);}},[A]);let r=useCallback(()=>{o?(te&&(ye(te.pos),Z(te.size)),L(false)):(pe({pos:F,size:ee}),L(true));},[o,F,ee,te]),v=useCallback(()=>{K?ne(false):(o&&(L(false),te&&(ye(te.pos),Z(te.size))),ne(true),_?.());},[K,o,te,_]);useEffect(()=>{if(!re||K)return;let t=p=>{if(!(!Ke.current?.contains(document.activeElement)&&document.activeElement!==Ke.current)){if(p.key==="Escape"&&(C(null),b(new Set)),p.ctrlKey&&p.key==="a"){p.preventDefault();let H=new Set(J.map((O,q)=>q));b(H);}p.key==="Delete"&&d.size>0&&N&&(p.preventDefault(),ze(true));}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[re,K,J,d,N]);let Y={"--fe-accent":i};if(K)return jsx("div",{className:s("fixed z-100 cursor-pointer transition-all duration-300",D==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:Y,onClick:()=>ne(false),title:`Restore ${n}`,children: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:[jsx(HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:n})]})});if(!re)return null;let a=o?me.w:Math.min(ee.width,me.w-8),R=o?me.h:Math.min(ee.height,me.h-8),oe=o?0:rt(F.x,0,Math.max(0,me.w-a)),Me=o?0:rt(F.y,0,Math.max(0,me.h-40)),xt=a<500;return jsxs("div",{ref:Ke,className:s("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]",o&&"rounded-none",X$1),style:{...Y,left:oe,top:Me,width:a,height:R,transition:o?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[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:We,onTouchStart:at,onDoubleClick:r,children:[jsxs("div",{className:"flex items-center gap-2",children:[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:jsx(HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:n}),jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{className:"fe-btn mr-1",onClick:()=>ge(t=>t==="list"?"grid":"list"),title:I==="list"?"Grid view":"List view",children:I==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),h&&jsx("button",{className:"fe-btn",onClick:v,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:r,title:o?"Restore":"Maximize",children:o?jsx(Minimize2,{className:"h-3.5 w-3.5"}):jsx(Maximize2,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{w?.(),Se(false);},title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsx("button",{className:"fe-btn p-1",onClick:()=>T?.(".."),title:"Go up",children:jsx(FolderUp,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:V==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>he(t=>t==="search"?"navigate":"search"),title:V==="search"?"Switch to path navigation":"Switch to file search",children:V==="search"?jsx(Search,{className:"h-3 w-3"}):jsx(CornerRightDown,{className:"h-3 w-3"})}),jsx("div",{className:"relative flex-1",children:jsx("input",{type:"text",value:U,onChange:t=>be(t.target.value),onKeyDown:t=>{t.key==="Enter"&&U.trim()&&V==="navigate"&&(y?y(U.trim()):T?.(U.trim()));},placeholder:V==="search"?"Search files\u2026":"Enter path and press Enter\u2026",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)"})}),jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[J.length," item",J.length!==1?"s":"",d.size>0&&` \xB7 ${d.size} selected`]})]}),jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:t=>{t.target===t.currentTarget&&(b(new Set),C(null));},children:J.length===0?jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsx(Folder,{className:"mb-2 h-10 w-10"}),jsx("span",{className:"text-xs",children:"No files found"})]}):I==="list"?jsx("div",{className:"space-y-px",children:J.map((t,p)=>{let H=It(t),O=d.has(p),q=t.extension||mt(t.name);return jsxs("div",{className:s("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",O?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:O?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:ke=>Te(p,ke),onDoubleClick:()=>Ye(p),children:[jsx(H,{className:s("h-4 w-4 shrink-0",t.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:t.name}),q&&t.type==="file"&&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:q}),t.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:mn(t.size)}),t.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:At(t.modifiedAt)})]},t.path+p)})}):jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:J.map((t,p)=>{let H=It(t),O=d.has(p),q=t.extension||mt(t.name);return jsxs("div",{className:s("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",O?"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:ke=>Te(p,ke),onDoubleClick:()=>Ye(p),children:[jsx(H,{className:s("h-7 w-7",t.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:t.name}),q&&t.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:q})]},t.path+p)})})}),jsx("div",{className:s("overflow-hidden transition-[width,opacity] duration-300 ease-out",xt?s("absolute right-0 top-0 bottom-0 z-10",M?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):s("shrink-0",M?"w-56":"w-0")),children:M&&jsxs("div",{className:s("flex h-full flex-col p-4",xt?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[xt&&jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{C(null),b(new Set);},title:"Close panel",children:jsx(X,{className:"h-3.5 w-3.5"})}),jsxs("div",{className:"mb-3 flex flex-col items-center",children:[ln.createElement(It(M),{className:s("h-10 w-10 mb-2",M.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:M.name})]}),jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsx(ot,{label:"Type",value:M.type==="directory"?"Directory":M.mimeType||M.extension||mt(M.name)||"File"}),M.size!=null&&jsx(ot,{label:"Size",value:mn(M.size)}),jsx(ot,{label:"Path",value:M.path,mono:true}),M.extension&&jsx(ot,{label:"Extension",value:M.extension}),M.modifiedAt&&jsx(ot,{label:"Modified",value:At(M.modifiedAt)}),M.createdAt&&jsx(ot,{label:"Created",value:At(M.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[M.type==="file"&&x&&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:()=>x(M),children:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),z?.map(t=>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:()=>t.onClick(M),children:[t.icon&&ln.createElement(t.icon,{className:"h-3 w-3"}),t.label]},t.key))]})]})})]}),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:[jsxs("span",{children:[J.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[d.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[d.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),G&&!o&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:t=>le("n",t),onTouchStart:t=>fe("n",t)}),jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:t=>le("s",t),onTouchStart:t=>fe("s",t)}),jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:t=>le("w",t),onTouchStart:t=>fe("w",t)}),jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:t=>le("e",t),onTouchStart:t=>fe("e",t)}),jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:t=>le("nw",t),onTouchStart:t=>fe("nw",t)}),jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:t=>le("ne",t),onTouchStart:t=>fe("ne",t)}),jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:t=>le("sw",t),onTouchStart:t=>fe("sw",t)}),jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:t=>le("se",t),onTouchStart:t=>fe("se",t)})]}),jsx("style",{children:`
23
23
  .fe-window {
24
24
  background: var(--fe-bg);
25
25
  box-shadow: var(--fe-shadow);
@@ -80,4 +80,4 @@ import rn,{createContext,useState,useCallback,useRef,useLayoutEffect,useEffect,u
80
80
  from { opacity: 0; transform: translateX(-4px); }
81
81
  to { opacity: 1; transform: translateX(0); }
82
82
  }
83
- `}),jsx(qt,{open:ce,onOpenChange:ze,children:jsxs(Zt,{size:"sm",children:[jsxs(Qt,{children:[jsxs(Jt,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxs(en,{children:[u.size===1?`Are you sure you want to delete "${Z[Array.from(u)[0]]?.name}"?`:`Are you sure you want to delete ${u.size} selected items?`," ","This action cannot be undone."]})]}),jsxs(tn,{children:[jsx(Lt,{intent:"ghost",onClick:()=>ze(false),children:"Cancel"}),jsxs(Lt,{intent:"danger",onClick:()=>{let t=Array.from(u).map(m=>Z[m]).filter(Boolean);L?.(t),b(new Set),S(null),ze(false);},children:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function ot({label:e,value:o,mono:l}){return jsxs("div",{children:[jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsx("div",{className:s("text-(--fe-text) break-all leading-snug",l&&"font-mono text-[9px]"),children:o})]})}function Or(e,o){let l=o.getBoundingClientRect(),g=Math.max(l.width,l.height)*1.2,w=e.clientX-l.left,f=e.clientY-l.top,v=document.createElement("span");v.className="masonry-ripple",v.style.width=`${g}px`,v.style.height=`${g}px`,v.style.left=`${w}px`,v.style.top=`${f}px`,o.appendChild(v),v.addEventListener("animationend",()=>v.remove());}function Ht({columns:e,columnWidth:o=240,gap:l=16,items:g,onItemClick:w,className:f,style:v,children:z,...F}){let x=useRef(null),_=useRef([]),[D,L]=useState(()=>e??1),[k,G]=useState([]),[y,ee]=useState(0),A=g?g.map((u,b)=>({key:u.key??b,node:u.content})):rn.Children.toArray(z).map((u,b)=>({key:u.key??b,node:u})),ne=A.length,$=useCallback(u=>e??Math.max(1,Math.floor((u+l)/(o+l))),[e,o,l]),K=useCallback(()=>{let u=x.current;if(!u)return;let b=u.clientWidth,C=$(b);L(C);let S=(b-(C-1)*l)/C,a=new Array(C).fill(0),O=[];for(let ie=0;ie<ne;ie++){let q=_.current[ie],ge=q?q.offsetHeight:0,I=0;for(let be=1;be<C;be++)a[be]<a[I]&&(I=be);O.push({top:a[I],left:I*(S+l),width:S}),a[I]+=ge+l;}let Y=Math.max(0,...a)-(ne?l:0);G(O),ee(Y);},[ne,$,l]);useEffect(()=>{let u=x.current;if(!u)return;let b=new ResizeObserver(()=>K());return b.observe(u),()=>b.disconnect()},[K]),useEffect(()=>{let u=requestAnimationFrame(K);return ()=>cancelAnimationFrame(u)},[K]),useEffect(()=>{let u=new ResizeObserver(()=>K());return _.current.forEach(b=>{b&&u.observe(b);}),()=>u.disconnect()},[ne,D,K]);let j=useCallback((u,b)=>{let C=u.currentTarget;Or(u,C),w?.(g?.[b],b);},[w,g]),Me=u=>{if(!g)return false;let b=g[u];return !!(b.title||b.description||b.actions)};return jsx("div",{ref:x,className:s("relative",f),style:{...v,height:y},...F,children:A.map((u,b)=>jsxs("div",{ref:C=>{_.current[b]=C;},className:"masonry-item",role:"button",tabIndex:0,onClick:C=>j(C,b),onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),w?.(g?.[b],b));},style:{position:"absolute",top:k[b]?.top??0,left:k[b]?.left??0,width:k[b]?.width??"100%"},children:[u.node,Me(b)&&jsxs("div",{className:"masonry-item-overlay",children:[g[b].title&&jsx("p",{className:"masonry-item-overlay-title",children:g[b].title}),g[b].description&&jsx("p",{className:"masonry-item-overlay-desc",children:g[b].description}),g[b].actions&&jsx("div",{className:"masonry-item-overlay-actions",children:g[b].actions})]})]},u.key))})}var _r={FilmReel:vt,MiniPlayer:wt,CinePlayer:Nt,FileExplorer:zt,Masonry:Ht},ra=_r;export{Nt as CinePlayer,_r as Extras,zt as FileExplorer,vt as FilmReel,Ht as Masonry,wt as MiniPlayer,ra as default};
83
+ `}),jsx(en,{open:ce,onOpenChange:ze,children:jsxs(tn,{size:"sm",children:[jsxs(nn,{children:[jsxs(rn,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxs(on,{children:[d.size===1?`Are you sure you want to delete "${J[Array.from(d)[0]]?.name}"?`:`Are you sure you want to delete ${d.size} selected items?`," ","This action cannot be undone."]})]}),jsxs(an,{children:[jsx(Dt,{intent:"ghost",onClick:()=>ze(false),children:"Cancel"}),jsxs(Dt,{intent:"danger",onClick:()=>{let t=Array.from(d).map(p=>J[p]).filter(Boolean);N?.(t),b(new Set),C(null),ze(false);},children:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function ot({label:e,value:n,mono:i}){return jsxs("div",{children:[jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsx("div",{className:s("text-(--fe-text) break-all leading-snug",i&&"font-mono text-[9px]"),children:n})]})}function Br(e,n){let i=n.getBoundingClientRect(),g=Math.max(i.width,i.height)*1.2,k=e.clientX-i.left,m=e.clientY-i.top,h=document.createElement("span");h.className="masonry-ripple",h.style.width=`${g}px`,h.style.height=`${g}px`,h.style.left=`${k}px`,h.style.top=`${m}px`,n.appendChild(h),h.addEventListener("animationend",()=>h.remove());}function $t({columns:e,columnWidth:n=240,gap:i=16,items:g,onItemClick:k,className:m,style:h,children:D,...S}){let x=useRef(null),j=useRef([]),[T,N]=useState(()=>e??1),[w,_]=useState([]),[y,B]=useState(0),z=g?g.map((d,b)=>({key:d.key??b,node:d.content})):ln.Children.toArray(D).map((d,b)=>({key:d.key??b,node:d})),G=z.length,A=useCallback(d=>e??Math.max(1,Math.floor((d+i)/(n+i))),[e,n,i]),X=useCallback(()=>{let d=x.current;if(!d)return;let b=d.clientWidth,E=A(b);N(E);let C=(b-(E-1)*i)/E,o=new Array(E).fill(0),L=[];for(let ne=0;ne<G;ne++){let U=j.current[ne],be=U?U.offsetHeight:0,V=0;for(let he=1;he<E;he++)o[he]<o[V]&&(V=he);L.push({top:o[V],left:V*(C+i),width:C}),o[V]+=be+i;}let K=Math.max(0,...o)-(G?i:0);_(L),B(K);},[G,A,i]);useEffect(()=>{let d=x.current;if(!d)return;let b=new ResizeObserver(()=>X());return b.observe(d),()=>b.disconnect()},[X]),useEffect(()=>{let d=requestAnimationFrame(X);return ()=>cancelAnimationFrame(d)},[X]),useEffect(()=>{let d=new ResizeObserver(()=>X());return j.current.forEach(b=>{b&&d.observe(b);}),()=>d.disconnect()},[G,T,X]);let I=useCallback((d,b)=>{let E=d.currentTarget;Br(d,E),k?.(g?.[b],b);},[k,g]),ge=d=>{if(!g)return false;let b=g[d];return !!(b.title||b.description||b.actions)};return jsx("div",{ref:x,className:s("relative",m),style:{...h,height:y},...S,children:z.map((d,b)=>jsxs("div",{ref:E=>{j.current[b]=E;},className:"masonry-item",role:"button",tabIndex:0,onClick:E=>I(E,b),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),k?.(g?.[b],b));},style:{position:"absolute",top:w[b]?.top??0,left:w[b]?.left??0,width:w[b]?.width??"100%"},children:[d.node,ge(b)&&jsxs("div",{className:"masonry-item-overlay",children:[g[b].title&&jsx("p",{className:"masonry-item-overlay-title",children:g[b].title}),g[b].description&&jsx("p",{className:"masonry-item-overlay-desc",children:g[b].description}),g[b].actions&&jsx("div",{className:"masonry-item-overlay-actions",children:g[b].actions})]})]},d.key))})}function ht({text:e="",mode:n="typewriter",speed:i=40,cursor:g=true,cursorChar:k="\u258B",thinking:m=false,streaming:h=false,delay:D=0,onComplete:S,as:x="span",className:j}){let[T,N]=useState(n==="instant"?e:""),[w,_]=useState(false),[y,B]=useState(n==="instant"),[z,G]=useState(false),A=useRef(0),X=useRef(S);X.current=S;let I=useRef(e);I.current=e,useEffect(()=>{if(n!=="typewriter")return;if(N(""),B(false),G(false),_(false),!e){B(true);return}let C=Math.max(10,1e3/i),o=0,L,K=()=>{_(true),L=setInterval(()=>{let U=I.current;o++,N(U.slice(0,o)),o>=U.length&&(clearInterval(L),_(false),B(true),X.current?.());},C);},ne;return D>0?ne=setTimeout(K,D):K(),()=>{clearTimeout(ne),clearInterval(L);}},[e,n]),useEffect(()=>{if(n!=="stream")return;if(e.length===0){A.current=0,N(""),_(false),B(false),G(false);return}if(e.length<=A.current)return;let C=Math.max(10,1e3/i),o=A.current;_(true),B(false),G(false);let L=setInterval(()=>{o++,A.current=o,N(I.current.slice(0,o)),o>=I.current.length&&(clearInterval(L),_(false),X.current?.());},C);return ()=>clearInterval(L)},[e,n]),useEffect(()=>{n==="instant"&&(N(e),_(false),B(true));},[e,n]);let ge=useRef(h);useEffect(()=>{let C=ge.current;if(ge.current=h,C&&!h&&!w&&n==="stream"){G(true);let o=setTimeout(()=>{G(false),B(true);},650);return ()=>clearTimeout(o)}},[h,w,n]);let d=g&&(m||w||z||n==="stream"&&h&&!y||n==="typewriter"&&!y),b=m?"tw-cursor--blink":w?"tw-cursor--solid":z?"tw-cursor--out":"tw-cursor--blink";return jsxs(x,{className:s(j),children:[m&&!T&&jsx("span",{"aria-hidden":"true",children:"\u200B"}),T,d&&jsx("span",{className:s("tw-cursor",b),"aria-hidden":"true",children:k})]})}var Kr={FilmReel:Nt,MiniPlayer:Mt,CinePlayer:Tt,FileExplorer:Ht,Masonry:$t,TypewriterText:ht},va=Kr;export{Tt as CinePlayer,Kr as Extras,Ht as FileExplorer,Nt as FilmReel,$t as Masonry,Mt as MiniPlayer,ht as TypewriterText,va as default};
@@ -2,4 +2,4 @@ export { Alert_alias_1 as Alert } from '../_tsup-dts-rollup.cjs';
2
2
  export { ProgressBar_alias_1 as ProgressBar } from '../_tsup-dts-rollup.cjs';
3
3
  export { Spin_alias_1 as Spin } from '../_tsup-dts-rollup.cjs';
4
4
  export { Feedback_alias_1 as Feedback } from '../_tsup-dts-rollup.cjs';
5
- export { default_alias_4 as default } from '../_tsup-dts-rollup.cjs';
5
+ export { default_alias_5 as default } from '../_tsup-dts-rollup.cjs';
@@ -2,4 +2,4 @@ export { Alert_alias_1 as Alert } from '../_tsup-dts-rollup.js';
2
2
  export { ProgressBar_alias_1 as ProgressBar } from '../_tsup-dts-rollup.js';
3
3
  export { Spin_alias_1 as Spin } from '../_tsup-dts-rollup.js';
4
4
  export { Feedback_alias_1 as Feedback } from '../_tsup-dts-rollup.js';
5
- export { default_alias_4 as default } from '../_tsup-dts-rollup.js';
5
+ export { default_alias_5 as default } from '../_tsup-dts-rollup.js';
@@ -1,3 +1,3 @@
1
1
  export { Form_alias_1 as Form } from '../_tsup-dts-rollup.cjs';
2
2
  export { Forms_alias_1 as Forms } from '../_tsup-dts-rollup.cjs';
3
- export { default_alias_5 as default } from '../_tsup-dts-rollup.cjs';
3
+ export { default_alias_6 as default } from '../_tsup-dts-rollup.cjs';
@@ -1,3 +1,3 @@
1
1
  export { Form_alias_1 as Form } from '../_tsup-dts-rollup.js';
2
2
  export { Forms_alias_1 as Forms } from '../_tsup-dts-rollup.js';
3
- export { default_alias_5 as default } from '../_tsup-dts-rollup.js';
3
+ export { default_alias_6 as default } from '../_tsup-dts-rollup.js';
@@ -2,4 +2,4 @@ export { Card_alias_1 as Card } from '../_tsup-dts-rollup.cjs';
2
2
  export { ImageCard_alias_1 as ImageCard } from '../_tsup-dts-rollup.cjs';
3
3
  export { Panel_alias_1 as Panel } from '../_tsup-dts-rollup.cjs';
4
4
  export { Layout_alias_1 as Layout } from '../_tsup-dts-rollup.cjs';
5
- export { default_alias_6 as default } from '../_tsup-dts-rollup.cjs';
5
+ export { default_alias_7 as default } from '../_tsup-dts-rollup.cjs';
@@ -2,4 +2,4 @@ export { Card_alias_1 as Card } from '../_tsup-dts-rollup.js';
2
2
  export { ImageCard_alias_1 as ImageCard } from '../_tsup-dts-rollup.js';
3
3
  export { Panel_alias_1 as Panel } from '../_tsup-dts-rollup.js';
4
4
  export { Layout_alias_1 as Layout } from '../_tsup-dts-rollup.js';
5
- export { default_alias_6 as default } from '../_tsup-dts-rollup.js';
5
+ export { default_alias_7 as default } from '../_tsup-dts-rollup.js';
@@ -2,4 +2,4 @@ export { SideNav_alias_1 as SideNav } from '../_tsup-dts-rollup.cjs';
2
2
  export { Header_alias_1 as Header } from '../_tsup-dts-rollup.cjs';
3
3
  export { NavLink_alias_1 as NavLink } from '../_tsup-dts-rollup.cjs';
4
4
  export { Navigation_alias_1 as Navigation } from '../_tsup-dts-rollup.cjs';
5
- export { default_alias_7 as default } from '../_tsup-dts-rollup.cjs';
5
+ export { default_alias_8 as default } from '../_tsup-dts-rollup.cjs';
@@ -2,4 +2,4 @@ export { SideNav_alias_1 as SideNav } from '../_tsup-dts-rollup.js';
2
2
  export { Header_alias_1 as Header } from '../_tsup-dts-rollup.js';
3
3
  export { NavLink_alias_1 as NavLink } from '../_tsup-dts-rollup.js';
4
4
  export { Navigation_alias_1 as Navigation } from '../_tsup-dts-rollup.js';
5
- export { default_alias_7 as default } from '../_tsup-dts-rollup.js';
5
+ export { default_alias_8 as default } from '../_tsup-dts-rollup.js';
@@ -1,4 +1,4 @@
1
1
  export { Dialog_alias_1 as Dialog } from '../_tsup-dts-rollup.cjs';
2
2
  export { Tooltip_alias_1 as Tooltip } from '../_tsup-dts-rollup.cjs';
3
3
  export { Overlay_alias_1 as Overlay } from '../_tsup-dts-rollup.cjs';
4
- export { default_alias_8 as default } from '../_tsup-dts-rollup.cjs';
4
+ export { default_alias_9 as default } from '../_tsup-dts-rollup.cjs';
@@ -1,4 +1,4 @@
1
1
  export { Dialog_alias_1 as Dialog } from '../_tsup-dts-rollup.js';
2
2
  export { Tooltip_alias_1 as Tooltip } from '../_tsup-dts-rollup.js';
3
3
  export { Overlay_alias_1 as Overlay } from '../_tsup-dts-rollup.js';
4
- export { default_alias_8 as default } from '../_tsup-dts-rollup.js';
4
+ export { default_alias_9 as default } from '../_tsup-dts-rollup.js';
@@ -11,4 +11,4 @@ export { Checkbox_alias_1 as Checkbox } from '../_tsup-dts-rollup.cjs';
11
11
  export { Radio_alias_1 as Radio } from '../_tsup-dts-rollup.cjs';
12
12
  export { RadioGroup_alias_1 as RadioGroup } from '../_tsup-dts-rollup.cjs';
13
13
  export { Primitives_alias_1 as Primitives } from '../_tsup-dts-rollup.cjs';
14
- export { default_alias_9 as default } from '../_tsup-dts-rollup.cjs';
14
+ export { default_alias_10 as default } from '../_tsup-dts-rollup.cjs';
@@ -11,4 +11,4 @@ export { Checkbox_alias_1 as Checkbox } from '../_tsup-dts-rollup.js';
11
11
  export { Radio_alias_1 as Radio } from '../_tsup-dts-rollup.js';
12
12
  export { RadioGroup_alias_1 as RadioGroup } from '../_tsup-dts-rollup.js';
13
13
  export { Primitives_alias_1 as Primitives } from '../_tsup-dts-rollup.js';
14
- export { default_alias_9 as default } from '../_tsup-dts-rollup.js';
14
+ export { default_alias_10 as default } from '../_tsup-dts-rollup.js';