@jacshuo/onyx 1.4.1 → 2.1.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 (198) 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/CodeBlock.cjs +2 -2
  27. package/dist/DataDisplay/CodeBlock.js +2 -2
  28. package/dist/DataDisplay/List.cjs +1 -1
  29. package/dist/DataDisplay/List.js +1 -1
  30. package/dist/DataDisplay/MetricCard.cjs +1 -0
  31. package/dist/DataDisplay/MetricCard.d.cts +3 -0
  32. package/dist/DataDisplay/MetricCard.d.ts +3 -0
  33. package/dist/DataDisplay/MetricCard.js +1 -0
  34. package/dist/DataDisplay/Stat.cjs +1 -0
  35. package/dist/DataDisplay/Stat.d.cts +3 -0
  36. package/dist/DataDisplay/Stat.d.ts +3 -0
  37. package/dist/DataDisplay/Stat.js +1 -0
  38. package/dist/DataDisplay/Table.cjs +1 -1
  39. package/dist/DataDisplay/Table.js +1 -1
  40. package/dist/DataDisplay/Tree.cjs +1 -1
  41. package/dist/DataDisplay/Tree.js +1 -1
  42. package/dist/DataDisplay/index.cjs +2 -2
  43. package/dist/DataDisplay/index.d.cts +7 -1
  44. package/dist/DataDisplay/index.d.ts +7 -1
  45. package/dist/DataDisplay/index.js +2 -2
  46. package/dist/Disclosure/index.d.cts +1 -1
  47. package/dist/Disclosure/index.d.ts +1 -1
  48. package/dist/Extras/CommandPalette.cjs +1 -0
  49. package/dist/Extras/CommandPalette.css +1 -0
  50. package/dist/Extras/CommandPalette.d.cts +4 -0
  51. package/dist/Extras/CommandPalette.d.ts +4 -0
  52. package/dist/Extras/CommandPalette.js +1 -0
  53. package/dist/Extras/FileExplorer.cjs +2 -2
  54. package/dist/Extras/FileExplorer.js +2 -2
  55. package/dist/Extras/Timeline.cjs +1 -0
  56. package/dist/Extras/Timeline.css +1 -0
  57. package/dist/Extras/Timeline.d.cts +6 -0
  58. package/dist/Extras/Timeline.d.ts +6 -0
  59. package/dist/Extras/Timeline.js +1 -0
  60. package/dist/Extras/TypewriterText.cjs +1 -0
  61. package/dist/Extras/TypewriterText.css +1 -0
  62. package/dist/Extras/TypewriterText.d.cts +2 -0
  63. package/dist/Extras/TypewriterText.d.ts +2 -0
  64. package/dist/Extras/TypewriterText.js +1 -0
  65. package/dist/Extras/index.cjs +4 -4
  66. package/dist/Extras/index.css +1 -0
  67. package/dist/Extras/index.d.cts +12 -1
  68. package/dist/Extras/index.d.ts +12 -1
  69. package/dist/Extras/index.js +4 -4
  70. package/dist/Feedback/Alert.cjs +1 -1
  71. package/dist/Feedback/Alert.js +1 -1
  72. package/dist/Feedback/ProgressBar.cjs +1 -1
  73. package/dist/Feedback/ProgressBar.js +1 -1
  74. package/dist/Feedback/Skeleton.cjs +1 -0
  75. package/dist/Feedback/Skeleton.d.cts +2 -0
  76. package/dist/Feedback/Skeleton.d.ts +2 -0
  77. package/dist/Feedback/Skeleton.js +1 -0
  78. package/dist/Feedback/Spin.cjs +2 -2
  79. package/dist/Feedback/Spin.js +2 -2
  80. package/dist/Feedback/Toast.cjs +1 -0
  81. package/dist/Feedback/Toast.d.cts +11 -0
  82. package/dist/Feedback/Toast.d.ts +11 -0
  83. package/dist/Feedback/Toast.js +1 -0
  84. package/dist/Feedback/index.cjs +2 -2
  85. package/dist/Feedback/index.d.cts +12 -1
  86. package/dist/Feedback/index.d.ts +12 -1
  87. package/dist/Feedback/index.js +2 -2
  88. package/dist/Forms/Select.cjs +1 -0
  89. package/dist/Forms/Select.css +1 -0
  90. package/dist/Forms/Select.d.cts +3 -0
  91. package/dist/Forms/Select.d.ts +3 -0
  92. package/dist/Forms/Select.js +1 -0
  93. package/dist/Forms/index.d.cts +1 -1
  94. package/dist/Forms/index.d.ts +1 -1
  95. package/dist/Layout/index.d.cts +1 -1
  96. package/dist/Layout/index.d.ts +1 -1
  97. package/dist/Navigation/Breadcrumb.cjs +1 -0
  98. package/dist/Navigation/Breadcrumb.d.cts +3 -0
  99. package/dist/Navigation/Breadcrumb.d.ts +3 -0
  100. package/dist/Navigation/Breadcrumb.js +1 -0
  101. package/dist/Navigation/Header.cjs +1 -1
  102. package/dist/Navigation/Header.js +1 -1
  103. package/dist/Navigation/Pagination.cjs +1 -0
  104. package/dist/Navigation/Pagination.d.cts +2 -0
  105. package/dist/Navigation/Pagination.d.ts +2 -0
  106. package/dist/Navigation/Pagination.js +1 -0
  107. package/dist/Navigation/RibbonBar.cjs +1 -0
  108. package/dist/Navigation/RibbonBar.d.cts +6 -0
  109. package/dist/Navigation/RibbonBar.d.ts +6 -0
  110. package/dist/Navigation/RibbonBar.js +1 -0
  111. package/dist/Navigation/index.cjs +2 -2
  112. package/dist/Navigation/index.d.cts +9 -1
  113. package/dist/Navigation/index.d.ts +9 -1
  114. package/dist/Navigation/index.js +2 -2
  115. package/dist/Overlay/ContextMenu.cjs +1 -0
  116. package/dist/Overlay/ContextMenu.d.cts +3 -0
  117. package/dist/Overlay/ContextMenu.d.ts +3 -0
  118. package/dist/Overlay/ContextMenu.js +1 -0
  119. package/dist/Overlay/Drawer.cjs +1 -0
  120. package/dist/Overlay/Drawer.css +1 -0
  121. package/dist/Overlay/Drawer.d.cts +10 -0
  122. package/dist/Overlay/Drawer.d.ts +10 -0
  123. package/dist/Overlay/Drawer.js +1 -0
  124. package/dist/Overlay/index.cjs +1 -1
  125. package/dist/Overlay/index.css +1 -0
  126. package/dist/Overlay/index.d.cts +9 -1
  127. package/dist/Overlay/index.d.ts +9 -1
  128. package/dist/Overlay/index.js +1 -1
  129. package/dist/Primitives/Avatar.cjs +1 -0
  130. package/dist/Primitives/Avatar.d.cts +4 -0
  131. package/dist/Primitives/Avatar.d.ts +4 -0
  132. package/dist/Primitives/Avatar.js +1 -0
  133. package/dist/Primitives/Badge.cjs +1 -1
  134. package/dist/Primitives/Badge.js +1 -1
  135. package/dist/Primitives/Button.cjs +1 -1
  136. package/dist/Primitives/Button.js +1 -1
  137. package/dist/Primitives/Checkbox.cjs +1 -1
  138. package/dist/Primitives/Checkbox.js +1 -1
  139. package/dist/Primitives/Dropdown.cjs +1 -1
  140. package/dist/Primitives/Dropdown.js +1 -1
  141. package/dist/Primitives/DropdownButton.cjs +1 -1
  142. package/dist/Primitives/DropdownButton.js +1 -1
  143. package/dist/Primitives/Indicator.cjs +1 -1
  144. package/dist/Primitives/Indicator.js +1 -1
  145. package/dist/Primitives/Input.cjs +1 -1
  146. package/dist/Primitives/Input.js +1 -1
  147. package/dist/Primitives/Label.cjs +1 -1
  148. package/dist/Primitives/Label.js +1 -1
  149. package/dist/Primitives/Radio.cjs +1 -1
  150. package/dist/Primitives/Radio.js +1 -1
  151. package/dist/Primitives/Slider.cjs +1 -0
  152. package/dist/Primitives/Slider.css +1 -0
  153. package/dist/Primitives/Slider.d.cts +4 -0
  154. package/dist/Primitives/Slider.d.ts +4 -0
  155. package/dist/Primitives/Slider.js +1 -0
  156. package/dist/Primitives/Switch.cjs +1 -1
  157. package/dist/Primitives/Switch.js +1 -1
  158. package/dist/Primitives/Tag.cjs +1 -0
  159. package/dist/Primitives/Tag.d.cts +2 -0
  160. package/dist/Primitives/Tag.d.ts +2 -0
  161. package/dist/Primitives/Tag.js +1 -0
  162. package/dist/Primitives/index.cjs +1 -1
  163. package/dist/Primitives/index.css +1 -0
  164. package/dist/Primitives/index.d.cts +7 -1
  165. package/dist/Primitives/index.d.ts +7 -1
  166. package/dist/Primitives/index.js +1 -1
  167. package/dist/_tsup-dts-rollup.d.cts +1447 -12
  168. package/dist/_tsup-dts-rollup.d.ts +1447 -12
  169. package/dist/index.cjs +5 -5
  170. package/dist/index.css +1 -0
  171. package/dist/index.d.cts +89 -0
  172. package/dist/index.d.ts +89 -0
  173. package/dist/index.js +5 -5
  174. package/dist/styles/Chart/BarChart.css +44 -0
  175. package/dist/styles/Chart/LineChart.css +72 -0
  176. package/dist/styles/Chart/PieChart.css +56 -0
  177. package/dist/styles/Chart/ScatterChart.css +45 -0
  178. package/dist/styles/DataDisplay/MetricCard.css +1 -0
  179. package/dist/styles/DataDisplay/Stat.css +1 -0
  180. package/dist/styles/Extras/CommandPalette.css +65 -0
  181. package/dist/styles/Extras/Timeline.css +52 -0
  182. package/dist/styles/Extras/TypewriterText.css +55 -0
  183. package/dist/styles/Feedback/Skeleton.css +37 -0
  184. package/dist/styles/Feedback/Toast.css +77 -0
  185. package/dist/styles/Forms/Select.css +36 -0
  186. package/dist/styles/Navigation/RibbonBar.css +1 -0
  187. package/dist/styles/Overlay/ContextMenu.css +1 -0
  188. package/dist/styles/Overlay/Drawer.css +52 -0
  189. package/dist/styles/Primitives/Slider.css +4 -0
  190. package/dist/styles/Primitives/Tag.css +1 -0
  191. package/dist/styles/base.css +1152 -0
  192. package/dist/styles/tokens/core.css +10 -0
  193. package/dist/styles.css +1570 -3
  194. package/dist/theme.cjs +1 -1
  195. package/dist/theme.d.cts +10 -0
  196. package/dist/theme.d.ts +10 -0
  197. package/dist/theme.js +1 -1
  198. package/package.json +1 -1
@@ -3,5 +3,11 @@ export { List_alias_1 as List } from '../_tsup-dts-rollup.js';
3
3
  export { Tree_alias_1 as Tree } from '../_tsup-dts-rollup.js';
4
4
  export { Chat_alias_1 as Chat } from '../_tsup-dts-rollup.js';
5
5
  export { CodeBlock_alias_1 as CodeBlock } from '../_tsup-dts-rollup.js';
6
+ export { Stat_alias_1 as Stat } from '../_tsup-dts-rollup.js';
7
+ export { StatProps_alias_1 as StatProps } from '../_tsup-dts-rollup.js';
8
+ export { StatTrend_alias_1 as StatTrend } from '../_tsup-dts-rollup.js';
9
+ export { MetricCard_alias_1 as MetricCard } from '../_tsup-dts-rollup.js';
10
+ export { MetricCardProps_alias_1 as MetricCardProps } from '../_tsup-dts-rollup.js';
11
+ export { MetricCardTrend_alias_1 as MetricCardTrend } from '../_tsup-dts-rollup.js';
6
12
  export { DataDisplay_alias_1 as DataDisplay } from '../_tsup-dts-rollup.js';
7
- export { default_alias_1 as default } from '../_tsup-dts-rollup.js';
13
+ export { default_alias_2 as default } from '../_tsup-dts-rollup.js';
@@ -1,2 +1,2 @@
1
- import w,{createContext,useState,useCallback,useRef,useEffect}from'react';import'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,Fragment,jsxs}from'react/jsx-runtime';function s(...e){return twMerge(clsx(e))}var I=cva("w-full text-left text-sm",{variants:{intent:{default:"",striped:"[&_tbody_tr:nth-child(even)]:bg-primary-50 dark:[&_tbody_tr:nth-child(even)]:bg-primary-800/30",bordered:"[&_th]:border [&_td]:border [&_th]:border-primary-200 [&_td]:border-primary-200 dark:[&_th]:border-primary-700 dark:[&_td]:border-primary-700"},density:{compact:"[&_th]:px-2 [&_th]:py-1 [&_td]:px-2 [&_td]:py-1",default:"",relaxed:"[&_th]:px-6 [&_th]:py-5 [&_td]:px-6 [&_td]:py-5"}},defaultVariants:{intent:"default",density:"default"}}),z=cva("text-sm text-primary-700 dark:text-primary-300",{variants:{intent:{default:"space-y-1",bordered:"divide-y divide-primary-200 rounded-lg border border-primary-200 dark:divide-primary-700 dark:border-primary-700 [&>li]:px-4 [&>li]:py-2",hover:"[&>li]:rounded-md [&>li]:px-3 [&>li]:py-2 [&>li]:transition-colors [&>li:hover]:bg-primary-50 dark:[&>li:hover]:bg-primary-800/50"}},defaultVariants:{intent:"default"}});cva("group flex w-full items-center gap-1.5 text-left [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",md:"py-1.5 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"py-2 text-base [&_svg]:h-4 [&_svg]:w-4"}},defaultVariants:{size:"md"}});cva("flex cursor-pointer items-center gap-1 rounded transition-colors [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-1 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-1.5 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}});var R=cva("overflow-x-auto rounded-lg font-mono [background:var(--color-syntax-bg)] [&_pre]:m-0 [&_pre]:p-4 [&_code]:bg-transparent",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}});function S({intent:e,density:t,className:r,...i}){return jsx("div",{className:"w-full overflow-auto",children:jsx("table",{className:s(I({intent:e,density:t}),r),...i})})}var Y=createContext({size:"md"});function _({intent:e,size:t="md",className:r,...i}){return jsx(Y.Provider,{value:{size:t},children:jsx("ul",{className:s(z({intent:e}),r),...i})})}var re=createContext({showLines:true,expandedKeys:null,onToggleKey:()=>{},size:"md"});function K({showLines:e=true,showRoot:t=true,expandedKeys:r,defaultExpandedKeys:i="all",onExpandedKeysChange:a,size:l="md",className:c,children:f,...u}){let [T,b]=useState(()=>i),x=useCallback(p=>{if(r){let m=new Set(r);m.has(p)?m.delete(p):m.add(p),a?.(m);}else b(m=>{if(m==="all")return new Set(["__ALL_MINUS__",p]);let g=new Set(m);return g.has(p)?g.delete(p):g.add(p),g});},[r,a]),C=r??(T==="all"?null:T);return jsx(re.Provider,{value:{showLines:e,expandedKeys:C,onToggleKey:x,size:l},children:t?jsx("ul",{className:s("text-sm",c),role:"tree",...u,children:f}):jsx("ul",{className:s("text-sm",c),role:"tree",...u,children:jsx(ae,{children:f})})})}function ae({children:e}){let t=j(e);return jsx(Fragment,{children:t.map(r=>w.isValidElement(r)&&r.props.children?r.props.children:null)})}function j(e){let t=[];return w.Children.forEach(e,r=>{w.isValidElement(r)&&r.type===w.Fragment?t.push(...j(r.props.children)):t.push(r);}),t}function ie({avatar:e,sender:t}){return e?typeof e=="string"?/^(?:https?|data|blob):/.test(e)?jsx("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:false}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function le({msg:e,alignRight:t}){return jsxs("div",{className:s("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsx(ie,{avatar:e.avatar,sender:e.sender}),jsxs("div",{className:s("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[jsx("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),jsx("div",{className:s("rounded-xl px-3 py-2 text-sm leading-relaxed",t?"rounded-tr-sm bg-primary-500 text-white dark:bg-primary-600":"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-200 rounded-tl-sm"),children:e.content}),e.time&&jsx("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function P({messages:e,mode:t="split",autoScroll:r=true,className:i,...a}){let l=useRef(null);return useEffect(()=>{r&&l.current?.scrollIntoView({behavior:"smooth"});},[e,r]),jsxs("div",{className:s("flex flex-col gap-4 overflow-y-auto rounded-lg border p-4","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white",i),...a,children:[e.map(c=>{let f=t==="split"&&!!c.self;return jsx(le,{msg:c,alignRight:f},c.id)}),jsx("div",{ref:l})]})}var pe={name:"onyx-css-vars",type:"dark",settings:[{settings:{foreground:"var(--color-syntax-plain)",background:"var(--color-syntax-bg)"}},{scope:["comment","punctuation.definition.comment"],settings:{foreground:"var(--color-syntax-comment)",fontStyle:"italic"}},{scope:["keyword","keyword.control","keyword.operator.new","keyword.operator.expression","storage.type","storage.modifier"],settings:{foreground:"var(--color-syntax-keyword)"}},{scope:["string","string.quoted","string.template"],settings:{foreground:"var(--color-syntax-string)"}},{scope:["entity.name.function","support.function","meta.function-call"],settings:{foreground:"var(--color-syntax-function)"}},{scope:["variable","variable.other","variable.parameter","meta.definition.variable"],settings:{foreground:"var(--color-syntax-variable)"}},{scope:["constant.numeric","constant.language"],settings:{foreground:"var(--color-syntax-number)"}},{scope:["keyword.operator","keyword.operator.assignment","keyword.operator.comparison","keyword.operator.arithmetic"],settings:{foreground:"var(--color-syntax-operator)"}},{scope:["entity.name.tag","punctuation.definition.tag","support.class.component"],settings:{foreground:"var(--color-syntax-tag)"}},{scope:["entity.other.attribute-name","meta.tag.attributes"],settings:{foreground:"var(--color-syntax-attr)"}},{scope:["punctuation","meta.brace","punctuation.definition.block","punctuation.separator","punctuation.terminator"],settings:{foreground:"var(--color-syntax-punctuation)"}},{scope:["entity.name.type","support.type","support.class","entity.other.inherited-class"],settings:{foreground:"var(--color-syntax-type)"}}]},me={typescript:()=>import('@shikijs/langs/typescript'),javascript:()=>import('@shikijs/langs/javascript'),tsx:()=>import('@shikijs/langs/tsx'),jsx:()=>import('@shikijs/langs/jsx'),html:()=>import('@shikijs/langs/html'),css:()=>import('@shikijs/langs/css'),json:()=>import('@shikijs/langs/json'),markdown:()=>import('@shikijs/langs/markdown'),python:()=>import('@shikijs/langs/python'),rust:()=>import('@shikijs/langs/rust'),go:()=>import('@shikijs/langs/go'),java:()=>import('@shikijs/langs/java'),c:()=>import('@shikijs/langs/c'),cpp:()=>import('@shikijs/langs/cpp'),csharp:()=>import('@shikijs/langs/csharp'),vue:()=>import('@shikijs/langs/vue'),xml:()=>import('@shikijs/langs/xml'),yaml:()=>import('@shikijs/langs/yaml'),sql:()=>import('@shikijs/langs/sql'),bash:()=>import('@shikijs/langs/bash'),shell:()=>import('@shikijs/langs/shell')},V=null,U=new Set;function ue(){return V||(V=Promise.all([import('shiki/core'),import('shiki/engine/javascript')]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>e({themes:[pe],langs:[],engine:t()}))),V}async function ye(e,t,r){let i=await ue();if(t&&!U.has(t)){let l=me[t];if(l)try{let c=await l();await i.loadLanguage(c.default??c),U.add(t);}catch{t="text";}else t="text";}let a=i.codeToHtml(e,{lang:t||"text",theme:"onyx-css-vars"});if(a=a.replace(/(<pre [^>]*style=")/,"$1line-height:1.7;tab-size:2;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;"),r){let l=0;a=a.replace(/<span class="line">/g,()=>(l++,`<span class="line"><span class="line-number" data-line="${l}"></span>`));}return a}function M({code:e,language:t="text",lineNumbers:r=false,editable:i=false,onCodeChange:a,size:l,className:c,...f}){let[u,T]=useState(""),b=useRef(null),N=useRef(null),x=useRef(null);useEffect(()=>{let n=false;return ye(e,t,i?false:r).then(o=>{n||T(o);}),()=>{n=true;}},[e,t,r,i]);let C=useCallback(()=>{let n=N.current,o=x.current?.querySelector("pre"),h=b.current?.querySelector("[data-gutter]");n&&o&&(o.scrollTop=n.scrollTop,o.scrollLeft=n.scrollLeft),n&&h&&(h.scrollTop=n.scrollTop);},[]),p=useCallback(n=>{a?.(n.target.value);},[a]),m=useCallback(n=>{if(n.key==="Tab"){n.preventDefault();let o=n.currentTarget,h=o.selectionStart,$=o.selectionEnd,G=o.value.substring(0,h)+" "+o.value.substring($);a?.(G),requestAnimationFrame(()=>{o.selectionStart=o.selectionEnd=h+2;});}},[a]),g=r&&"[&_.line-number]:inline-block [&_.line-number]:w-8 [&_.line-number]:mr-4 [&_.line-number]:text-right [&_.line-number]:text-secondary-400 [&_.line-number]:select-none [&_.line-number]:before:content-[attr(data-line)]",D="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",A=1.7,O=e.split(`
2
- `).length;return i?jsxs("div",{ref:b,className:s(R({size:l}),"flex border border-primary-200 dark:border-primary-700",c),style:{background:"var(--color-syntax-bg)"},...f,children:[r&&jsx("div",{"data-gutter":true,"aria-hidden":true,className:"shrink-0 select-none overflow-hidden py-4 pl-3 pr-1 text-right text-secondary-400",style:{fontFamily:D,lineHeight:A,width:"3rem"},children:Array.from({length:O},(n,o)=>jsx("div",{children:o+1},o))}),jsxs("div",{className:"relative min-w-0 flex-1",children:[jsx("textarea",{ref:N,value:e,onChange:p,onScroll:C,onKeyDown:m,spellCheck:false,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",className:"relative z-2 m-0 block h-full w-full resize-none overflow-auto whitespace-pre border-none bg-transparent p-4 text-transparent caret-primary-600 outline-none dark:caret-primary-400",style:{fontFamily:D,lineHeight:A,tabSize:2,minHeight:"6rem"}}),jsx("div",{ref:x,"aria-hidden":true,className:"pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre]:h-full [&_pre]:overflow-hidden [&_pre]:p-4 [&_code]:bg-transparent",dangerouslySetInnerHTML:u?{__html:u}:void 0})]})]}):jsx("div",{ref:b,className:s(R({size:l}),"border border-primary-200 dark:border-primary-700",g,c),style:{background:"var(--color-syntax-bg)"},...f,children:jsx("div",{ref:x,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:u?{__html:u}:void 0,children:u?void 0:jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children:jsx("code",{children:e})})})})}var fe={Table:S,List:_,Tree:K,Chat:P,CodeBlock:M},Tt=fe;export{P as Chat,M as CodeBlock,fe as DataDisplay,_ as List,S as Table,K as Tree,Tt as default};
1
+ import L,{createContext,useState,useCallback,useRef,useEffect}from'react';import {Minus,TrendingDown,TrendingUp}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,Fragment,jsxs}from'react/jsx-runtime';function i(...e){return twMerge(clsx(e))}var q=cva("w-full text-left text-sm",{variants:{intent:{default:"",striped:"[&_tbody_tr:nth-child(even)]:bg-primary-50 dark:[&_tbody_tr:nth-child(even)]:bg-primary-800/30",bordered:"[&_th]:border [&_td]:border [&_th]:border-primary-200 [&_td]:border-primary-200 dark:[&_th]:border-primary-700 dark:[&_td]:border-primary-700"},density:{compact:"[&_th]:px-2 [&_th]:py-1 [&_td]:px-2 [&_td]:py-1",default:"",relaxed:"[&_th]:px-6 [&_th]:py-5 [&_td]:px-6 [&_td]:py-5"}},defaultVariants:{intent:"default",density:"default"}}),O=cva("text-sm text-primary-700 dark:text-primary-300",{variants:{intent:{default:"space-y-1",bordered:"divide-y divide-primary-200 rounded-lg border border-primary-200 dark:divide-primary-700 dark:border-primary-700 [&>li]:px-4 [&>li]:py-2",hover:"[&>li]:rounded-md [&>li]:px-3 [&>li]:py-2 [&>li]:transition-colors [&>li:hover]:bg-primary-50 dark:[&>li:hover]:bg-primary-800/50"}},defaultVariants:{intent:"default"}});cva("group flex w-full items-center gap-1.5 text-left [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",md:"py-1.5 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"py-2 text-base [&_svg]:h-4 [&_svg]:w-4"}},defaultVariants:{size:"md"}});cva("flex cursor-pointer items-center gap-1 rounded transition-colors [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-1 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-1.5 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}});var $=cva("relative rounded-xl border bg-white p-5 shadow-sm transition-shadow hover:shadow-md dark:bg-primary-900",{variants:{intent:{primary:"border-primary-200 dark:border-primary-700",success:"border-success-200 dark:border-success-800",danger:"border-danger-200 dark:border-danger-800",warning:"border-warning-200 dark:border-warning-800"},size:{sm:"p-4",md:"p-5",lg:"p-6"}},defaultVariants:{intent:"primary",size:"md"}}),G=cva("relative overflow-hidden rounded-xl border bg-white p-5 shadow-sm transition-all duration-300 hover:shadow-lg dark:bg-primary-900",{variants:{intent:{primary:"border-primary-200 dark:border-primary-700",success:"border-success-200 dark:border-success-800",danger:"border-danger-200 dark:border-danger-800",warning:"border-warning-200 dark:border-warning-800"},size:{sm:"p-4",md:"p-5",lg:"p-6"}},defaultVariants:{intent:"primary",size:"md"}}),V=cva("overflow-x-auto rounded-lg font-mono [background:var(--color-syntax-bg)] [&_pre]:m-0 [&_pre]:p-4 [&_code]:bg-transparent",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}});function P({intent:e,density:t,className:r,...s}){return jsx("div",{className:"w-full overflow-auto",children:jsx("table",{className:i(q({intent:e,density:t}),r),...s})})}var le=createContext({size:"md"});function M({intent:e,size:t="md",className:r,...s}){return jsx(le.Provider,{value:{size:t},children:jsx("ul",{className:i(O({intent:e}),r),...s})})}var me=createContext({showLines:true,expandedKeys:null,onToggleKey:()=>{},size:"md"});function H({showLines:e=true,showRoot:t=true,expandedKeys:r,defaultExpandedKeys:s="all",onExpandedKeysChange:a,size:n="md",className:l,children:c,...o}){let [y,g]=useState(()=>s),d=useCallback(u=>{if(r){let f=new Set(r);f.has(u)?f.delete(u):f.add(u),a?.(f);}else g(f=>{if(f==="all")return new Set(["__ALL_MINUS__",u]);let h=new Set(f);return h.has(u)?h.delete(u):h.add(u),h});},[r,a]),T=r??(y==="all"?null:y);return jsx(me.Provider,{value:{showLines:e,expandedKeys:T,onToggleKey:d,size:n},children:t?jsx("ul",{className:i("text-sm",l),role:"tree",...o,children:c}):jsx("ul",{className:i("text-sm",l),role:"tree",...o,children:jsx(ue,{children:c})})})}function ue({children:e}){let t=J(e);return jsx(Fragment,{children:t.map(r=>L.isValidElement(r)&&r.props.children?r.props.children:null)})}function J(e){let t=[];return L.Children.forEach(e,r=>{L.isValidElement(r)&&r.type===L.Fragment?t.push(...J(r.props.children)):t.push(r);}),t}function be({avatar:e,sender:t}){return e?typeof e=="string"?/^(?:https?|data|blob):/.test(e)?jsx("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:false}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function xe({msg:e,alignRight:t}){return jsxs("div",{className:i("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsx(be,{avatar:e.avatar,sender:e.sender}),jsxs("div",{className:i("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[jsx("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),jsx("div",{className:i("rounded-xl px-3 py-2 text-sm leading-relaxed",t?"rounded-tr-sm bg-primary-500 text-white dark:bg-primary-600":"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-200 rounded-tl-sm"),children:e.content}),e.time&&jsx("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function D({messages:e,mode:t="split",autoScroll:r=true,className:s,...a}){let n=useRef(null);return useEffect(()=>{r&&n.current?.scrollIntoView({behavior:"smooth"});},[e,r]),jsxs("div",{className:i("flex flex-col gap-4 overflow-y-auto rounded-lg border p-4","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white",s),...a,children:[e.map(l=>{let c=t==="split"&&!!l.self;return jsx(xe,{msg:l,alignRight:c},l.id)}),jsx("div",{ref:n})]})}var ke={name:"onyx-css-vars",type:"dark",settings:[{settings:{foreground:"var(--color-syntax-plain)",background:"var(--color-syntax-bg)"}},{scope:["comment","punctuation.definition.comment"],settings:{foreground:"var(--color-syntax-comment)",fontStyle:"italic"}},{scope:["keyword","keyword.control","keyword.operator.new","keyword.operator.expression","storage.type","storage.modifier"],settings:{foreground:"var(--color-syntax-keyword)"}},{scope:["string","string.quoted","string.template"],settings:{foreground:"var(--color-syntax-string)"}},{scope:["entity.name.function","support.function","meta.function-call"],settings:{foreground:"var(--color-syntax-function)"}},{scope:["variable","variable.other","variable.parameter","meta.definition.variable"],settings:{foreground:"var(--color-syntax-variable)"}},{scope:["constant.numeric","constant.language"],settings:{foreground:"var(--color-syntax-number)"}},{scope:["keyword.operator","keyword.operator.assignment","keyword.operator.comparison","keyword.operator.arithmetic"],settings:{foreground:"var(--color-syntax-operator)"}},{scope:["entity.name.tag","punctuation.definition.tag","support.class.component"],settings:{foreground:"var(--color-syntax-tag)"}},{scope:["entity.other.attribute-name","meta.tag.attributes"],settings:{foreground:"var(--color-syntax-attr)"}},{scope:["punctuation","meta.brace","punctuation.definition.block","punctuation.separator","punctuation.terminator"],settings:{foreground:"var(--color-syntax-punctuation)"}},{scope:["entity.name.type","support.type","support.class","entity.other.inherited-class"],settings:{foreground:"var(--color-syntax-type)"}}]},we={typescript:()=>import('@shikijs/langs/typescript'),javascript:()=>import('@shikijs/langs/javascript'),tsx:()=>import('@shikijs/langs/tsx'),jsx:()=>import('@shikijs/langs/jsx'),html:()=>import('@shikijs/langs/html'),css:()=>import('@shikijs/langs/css'),json:()=>import('@shikijs/langs/json'),markdown:()=>import('@shikijs/langs/markdown'),python:()=>import('@shikijs/langs/python'),rust:()=>import('@shikijs/langs/rust'),go:()=>import('@shikijs/langs/go'),java:()=>import('@shikijs/langs/java'),c:()=>import('@shikijs/langs/c'),cpp:()=>import('@shikijs/langs/cpp'),csharp:()=>import('@shikijs/langs/csharp'),vue:()=>import('@shikijs/langs/vue'),xml:()=>import('@shikijs/langs/xml'),yaml:()=>import('@shikijs/langs/yaml'),sql:()=>import('@shikijs/langs/sql'),bash:()=>import('@shikijs/langs/bash'),shell:()=>import('@shikijs/langs/shell')},z=null,W=new Set;function Te(){return z||(z=Promise.all([import('shiki/core'),import('shiki/engine/javascript')]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>e({themes:[ke],langs:[],engine:t()}))),z}async function Ne(e,t,r){let s=await Te();if(t&&!W.has(t)){let n=we[t];if(n)try{let l=await n();await s.loadLanguage(l.default??l),W.add(t);}catch{t="text";}else t="text";}let a=s.codeToHtml(e,{lang:t||"text",theme:"onyx-css-vars"});if(a=a.replace(/(<pre [^>]*style=")/,"$1line-height:1.7;tab-size:2;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;"),r){let n=0;a=a.replace(/<span class="line">/g,()=>(n++,`<span class="line"><span class="line-number" data-line="${n}"></span>`));}return a}function B({code:e,language:t="text",lineNumbers:r=false,editable:s=false,onCodeChange:a,size:n,className:l,...c}){let[o,y]=useState(""),g=useRef(null),b=useRef(null),d=useRef(null);useEffect(()=>{let p=false;return Ne(e,t,s?false:r).then(m=>{p||y(m);}),()=>{p=true;}},[e,t,r,s]);let T=useCallback(()=>{let p=b.current,m=d.current?.querySelector("pre"),R=g.current?.querySelector("[data-gutter]");p&&m&&(m.scrollTop=p.scrollTop,m.scrollLeft=p.scrollLeft),p&&R&&(R.scrollTop=p.scrollTop);},[]),u=useCallback(p=>{a?.(p.target.value);},[a]),f=useCallback(p=>{if(p.key==="Tab"){p.preventDefault();let m=p.currentTarget,R=m.selectionStart,re=m.selectionEnd,ae=m.value.substring(0,R)+" "+m.value.substring(re);a?.(ae),requestAnimationFrame(()=>{m.selectionStart=m.selectionEnd=R+2;});}},[a]),h=r&&"[&_.line-number]:inline-block [&_.line-number]:w-8 [&_.line-number]:mr-4 [&_.line-number]:text-right [&_.line-number]:text-secondary-400 [&_.line-number]:select-none [&_.line-number]:before:content-[attr(data-line)]",K="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",U=1.7,te=e.split(`
2
+ `).length;return s?jsxs("div",{ref:g,className:i(V({size:n}),"flex border border-primary-200 dark:border-primary-700",l),style:{background:"var(--color-syntax-bg)"},...c,children:[r&&jsx("div",{"data-gutter":true,"aria-hidden":true,className:"shrink-0 select-none overflow-hidden py-4 pl-3 pr-1 text-right text-secondary-400",style:{fontFamily:K,lineHeight:U,width:"3rem"},children:Array.from({length:te},(p,m)=>jsx("div",{children:m+1},m))}),jsxs("div",{className:"relative min-w-0 flex-1",children:[jsx("textarea",{ref:b,value:e,onChange:u,onScroll:T,onKeyDown:f,spellCheck:false,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",className:"relative z-2 m-0 block h-full w-full resize-none overflow-auto whitespace-pre border-none bg-transparent p-4 text-transparent caret-primary-600 outline-none dark:caret-primary-400",style:{fontFamily:K,lineHeight:U,tabSize:2,minHeight:"6rem"}}),jsx("div",{ref:d,"aria-hidden":true,className:"pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre]:h-full [&_pre]:overflow-hidden [&_pre]:p-4 [&_code]:bg-transparent",dangerouslySetInnerHTML:o?{__html:o}:void 0})]})]}):jsx("div",{ref:g,className:i(V({size:n}),"border border-primary-200 dark:border-primary-700",h,l),style:{background:"var(--color-syntax-bg)"},...c,children:jsx("div",{ref:d,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:o?{__html:o}:void 0,children:o?void 0:jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children:jsx("code",{children:e})})})})}var _e={up:TrendingUp,down:TrendingDown,neutral:Minus},Ke={up:"text-success-600 dark:text-success-400",down:"text-danger-600 dark:text-danger-400",neutral:"text-secondary-500 dark:text-secondary-400"};function F({title:e,value:t,prefix:r,suffix:s,icon:a,trend:n,trendValue:l,description:c,intent:o,size:y,className:g}){let b=n?_e[n]:null,d=n?Ke[n]:"";return jsx("div",{className:i($({intent:o,size:y}),g),children:jsxs("div",{className:"flex items-start justify-between gap-3",children:[jsxs("div",{className:"min-w-0 flex-1",children:[jsx("p",{className:"truncate text-xs font-medium tracking-wider uppercase text-secondary-500 dark:text-secondary-400",children:e}),jsxs("p",{className:"mt-1 flex items-baseline gap-1 text-2xl font-bold text-primary-900 dark:text-primary-50",children:[r&&jsx("span",{className:"text-base font-semibold text-secondary-500 dark:text-secondary-400",children:r}),jsx("span",{children:t}),s&&jsx("span",{className:"text-base font-semibold text-secondary-500 dark:text-secondary-400",children:s})]}),(n||c)&&jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n&&b&&jsxs("span",{className:i("flex items-center gap-0.5 text-xs font-semibold",d),children:[jsx(b,{className:"h-3.5 w-3.5"}),l]}),c&&jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:c})]})]}),a&&jsx("div",{className:i("flex h-10 w-10 shrink-0 items-center justify-center rounded-xl [&_svg]:h-5 [&_svg]:w-5",o==="success"&&"bg-success-100 text-success-600 dark:bg-success-900/30 dark:text-success-400",o==="danger"&&"bg-danger-100 text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",o==="warning"&&"bg-warning-100 text-warning-600 dark:bg-warning-900/30 dark:text-warning-400",(!o||o==="primary")&&"bg-primary-100 text-primary-600 dark:bg-primary-800 dark:text-primary-400"),children:a})]})})}function Ee(e){return 1-Math.pow(1-e,4)}function De(e,t,r,s,a){let[n,l]=useState(()=>a?a(t):t.toFixed(s)),c=useRef(null),o=useRef(null);return useEffect(()=>{c.current!==null&&cancelAnimationFrame(c.current),o.current=null;let y=g=>{o.current===null&&(o.current=g);let b=g-o.current,d=Math.min(b/r,1),T=Ee(d),u=t+(e-t)*T;l(a?a(u):u.toFixed(s)),d<1&&(c.current=requestAnimationFrame(y));};return c.current=requestAnimationFrame(y),()=>{c.current!==null&&cancelAnimationFrame(c.current);}},[e,t,r,s,a]),n}var Ae={up:TrendingUp,down:TrendingDown,neutral:Minus},Ie={up:"text-success-600 dark:text-success-400",down:"text-danger-600 dark:text-danger-400",neutral:"text-secondary-500 dark:text-secondary-400"},ee={primary:"bg-primary-100 text-primary-600 dark:bg-primary-800/60 dark:text-primary-300",success:"bg-success-100 text-success-600 dark:bg-success-900/30 dark:text-success-400",danger:"bg-danger-100 text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",warning:"bg-warning-100 text-warning-600 dark:bg-warning-900/30 dark:text-warning-400"};function j({title:e,value:t,decimals:r=0,prefix:s,suffix:a,icon:n,trend:l,trendValue:c,description:o,animateDuration:y=1200,formatter:g,from:b=0,intent:d,size:T,className:u}){let f=De(t,b,y,r,g),h=l?Ae[l]:null,K=l?Ie[l]:"";return jsxs("div",{className:i(G({intent:d,size:T}),u),children:[jsx("div",{className:i("pointer-events-none absolute inset-x-0 top-0 h-0.5 rounded-t-xl",d==="success"&&"bg-gradient-to-r from-success-400 to-success-600",d==="danger"&&"bg-gradient-to-r from-danger-400 to-danger-600",d==="warning"&&"bg-gradient-to-r from-warning-400 to-warning-600",(!d||d==="primary")&&"bg-gradient-to-r from-primary-400 to-primary-600")}),jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxs("div",{className:"min-w-0 flex-1",children:[jsx("p",{className:"text-xs font-semibold tracking-widest uppercase text-secondary-500 dark:text-secondary-400",children:e}),jsxs("p",{className:"mt-2 flex items-baseline gap-1",children:[s&&jsx("span",{className:"text-lg font-semibold text-secondary-400 dark:text-secondary-500",children:s}),jsx("span",{className:"font-mono text-3xl font-bold tabular-nums text-primary-900 dark:text-primary-50",children:f}),a&&jsx("span",{className:"text-lg font-semibold text-secondary-400 dark:text-secondary-500",children:a})]})]}),n&&jsx("div",{className:i("flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl [&_svg]:h-6 [&_svg]:w-6",ee[d??"primary"]??ee.primary),children:n})]}),(l||o)&&jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-primary-100 pt-3 dark:border-primary-700/50",children:[l&&h&&jsxs("span",{className:i("flex items-center gap-0.5 text-xs font-bold",K),children:[jsx(h,{className:"h-3.5 w-3.5"}),c]}),o&&jsx("span",{className:"text-xs text-secondary-500 dark:text-secondary-400",children:o})]})]})}var ze={Table:P,List:M,Tree:H,Chat:D,CodeBlock:B,Stat:F,MetricCard:j},or=ze;export{D as Chat,B as CodeBlock,ze as DataDisplay,M as List,j as MetricCard,F as Stat,P as Table,H as Tree,or as default};
@@ -1,4 +1,4 @@
1
1
  export { Accordion_alias_1 as Accordion } from '../_tsup-dts-rollup.cjs';
2
2
  export { Tabs_alias_1 as Tabs } from '../_tsup-dts-rollup.cjs';
3
3
  export { Disclosure_alias_1 as Disclosure } from '../_tsup-dts-rollup.cjs';
4
- export { default_alias_2 as default } from '../_tsup-dts-rollup.cjs';
4
+ export { default_alias_3 as default } from '../_tsup-dts-rollup.cjs';
@@ -1,4 +1,4 @@
1
1
  export { Accordion_alias_1 as Accordion } from '../_tsup-dts-rollup.js';
2
2
  export { Tabs_alias_1 as Tabs } from '../_tsup-dts-rollup.js';
3
3
  export { Disclosure_alias_1 as Disclosure } from '../_tsup-dts-rollup.js';
4
- export { default_alias_2 as default } from '../_tsup-dts-rollup.js';
4
+ export { default_alias_3 as default } from '../_tsup-dts-rollup.js';
@@ -0,0 +1 @@
1
+ 'use strict';var react=require('react'),reactDom=require('react-dom'),lucideReact=require('lucide-react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function x(...r){return tailwindMerge.twMerge(clsx.clsx(r))}function k(r){return r.toLowerCase().replace(/\s+/g," ").trim()}function H(r,t){if(!t)return true;let a=k(t);return k(r.label).includes(a)||(r.description?k(r.description).includes(a):false)||(r.keywords?r.keywords.some(d=>k(d).includes(a)):false)}function q(r){let t=new Map;for(let a of r){let d=a.group??"";t.has(d)||t.set(d,[]),t.get(d).push(a);}return Array.from(t.entries()).map(([a,d])=>({label:a,items:d}))}function P(r,t,a,d){let[p,b]=react.useState(""),[u,c]=react.useState(0);react.useEffect(()=>{t&&(b(""),c(0));},[t]);let o=react.useMemo(()=>r.filter(e=>!e.disabled&&H(e,p)),[r,p]),v=react.useMemo(()=>q(o),[o]);react.useEffect(()=>{c(e=>Math.min(e,Math.max(0,o.length-1)));},[o.length]);let y=react.useCallback(()=>{let e=o[u];e&&(e.onSelect(),a(false));},[o,u,a]),h=react.useCallback(e=>{switch(e.key){case "ArrowDown":e.preventDefault(),c(n=>(n+1)%Math.max(1,o.length));break;case "ArrowUp":e.preventDefault(),c(n=>(n-1+Math.max(1,o.length))%Math.max(1,o.length));break;case "Enter":e.preventDefault(),y();break;case "Escape":e.preventDefault(),a(false);break}},[o.length,y,a]);return react.useEffect(()=>{if(!d)return;function e(n){(n.metaKey||n.ctrlKey)&&n.key==="k"&&(n.preventDefault(),a(!t));}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d,t,a]),{query:p,setQuery:b,groups:v,filtered:o,activeIndex:u,setActiveIndex:c,handleKeyDown:h}}function V({open:r,onOpenChange:t,commands:a,placeholder:d="Type a command or search\u2026",hotkey:p=true,maxItems:b=8,className:u}){let c=react.useRef(null),o=react.useRef(null),{query:v,setQuery:y,groups:h,filtered:e,activeIndex:n,setActiveIndex:D,handleKeyDown:A}=P(a,r,t,p);if(react.useEffect(()=>{if(r){let l=setTimeout(()=>c.current?.focus(),40);return ()=>clearTimeout(l)}},[r]),react.useEffect(()=>{o.current?.querySelector("[data-active='true']")?.scrollIntoView({block:"nearest"});},[n]),!r)return null;let K=0;return reactDom.createPortal(jsxRuntime.jsx("div",{className:"cmd-backdrop fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:()=>t(false),role:"presentation",children:jsxRuntime.jsxs("div",{className:x("cmd-panel relative flex w-full max-w-lg flex-col overflow-hidden rounded-xl","border border-primary-200 bg-white shadow-2xl","dark:border-primary-700 dark:bg-primary-900",u),onClick:l=>l.stopPropagation(),onKeyDown:A,role:"dialog","aria-label":"Command palette","aria-modal":"true",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3 border-b border-primary-100 px-4 dark:border-primary-700",children:[jsxRuntime.jsx(lucideReact.Search,{className:"h-4 w-4 shrink-0 text-secondary-400","aria-hidden":"true"}),jsxRuntime.jsx("input",{ref:c,value:v,onChange:l=>y(l.target.value),placeholder:d,className:"flex-1 bg-transparent py-3.5 text-sm text-primary-900 outline-none placeholder:text-secondary-400 dark:text-primary-50","aria-label":"Search commands","aria-controls":"cmd-results","aria-autocomplete":"list","aria-activedescendant":e[n]?`cmd-item-${e[n].id}`:void 0,spellCheck:false,autoComplete:"off"}),jsxRuntime.jsx("kbd",{className:"hidden shrink-0 rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-400 dark:border-primary-600 sm:block",children:"esc"})]}),jsxRuntime.jsx("div",{id:"cmd-results",ref:o,className:"overflow-y-auto py-2",style:{maxHeight:`${b*2.75}rem`},role:"listbox","aria-label":"Commands",children:e.length===0?jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-sm text-secondary-400",children:[jsxRuntime.jsx(lucideReact.Command,{className:"h-8 w-8 opacity-30"}),jsxRuntime.jsx("span",{children:"No commands found"})]}):h.map(l=>jsxRuntime.jsxs("div",{className:"mb-1 last:mb-0",children:[l.label&&jsxRuntime.jsx("p",{className:"px-4 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-secondary-400 dark:text-secondary-500",children:l.label}),l.items.map(i=>{let w=K++,f=w===n;return jsxRuntime.jsxs("button",{id:`cmd-item-${i.id}`,"data-active":f,role:"option","aria-selected":f,className:x("cmd-item group flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm",f?"bg-primary-100 text-primary-900 dark:bg-primary-800 dark:text-primary-50":"text-primary-700 hover:bg-primary-50 dark:text-primary-300 dark:hover:bg-primary-800/50"),onMouseEnter:()=>D(w),onClick:()=>{i.onSelect(),t(false);},children:[i.icon&&jsxRuntime.jsx("span",{className:x("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-xs",f?"border-primary-300 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-700 dark:text-primary-200":"border-primary-200 bg-primary-50 text-primary-500 dark:border-primary-700 dark:bg-primary-800 dark:text-primary-400"),children:i.icon}),jsxRuntime.jsxs("span",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"block truncate font-medium",children:i.label}),i.description&&jsxRuntime.jsx("span",{className:"block truncate text-xs text-secondary-400 dark:text-secondary-500",children:i.description})]}),i.shortcut&&jsxRuntime.jsx("span",{className:"flex shrink-0 items-center gap-0.5",children:i.shortcut.map((S,L)=>jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-500 dark:border-primary-700 dark:text-secondary-400",children:S},L))})]},i.id)})]},l.label||"_default"))}),e.length>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between border-t border-primary-100 px-4 py-2 dark:border-primary-700",children:[jsxRuntime.jsxs("span",{className:"text-xs text-secondary-400",children:[e.length," result",e.length!==1?"s":""]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-3 text-xs text-secondary-400",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2191"}),jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2193"}),"Navigate"]}),jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u21B5"}),"Select"]})]})]})]})}),document.body)}exports.CommandPalette=V;
@@ -0,0 +1 @@
1
+ .cmd-backdrop{background:#0006;backdrop-filter:blur(2px);animation:cmd-backdrop-in .12s ease-out both}@keyframes cmd-backdrop-in{0%{opacity:0}to{opacity:1}}.cmd-panel{animation:cmd-panel-in .18s cubic-bezier(.16,1,.3,1) both}@keyframes cmd-panel-in{0%{opacity:0;transform:scale(.96) translateY(-10px)}to{opacity:1;transform:scale(1) translateY(0)}}.cmd-item{cursor:default;user-select:none;transition:background-color 80ms ease,color 80ms ease}#cmd-results{scrollbar-width:thin;scrollbar-color:var(--color-primary-300) transparent}#cmd-results::-webkit-scrollbar{width:4px}#cmd-results::-webkit-scrollbar-track{background:transparent}#cmd-results::-webkit-scrollbar-thumb{background:var(--color-primary-300);border-radius:2px}.dark #cmd-results::-webkit-scrollbar-thumb{background:var(--color-primary-700)}
@@ -0,0 +1,4 @@
1
+ export { CommandPalette_alias_3 as CommandPalette } from '../_tsup-dts-rollup.cjs';
2
+ export { CommandPaletteProps_alias_2 as CommandPaletteProps } from '../_tsup-dts-rollup.cjs';
3
+ export { CommandItem_alias_2 as CommandItem } from '../_tsup-dts-rollup.cjs';
4
+ export { CommandGroup_alias_2 as CommandGroup } from '../_tsup-dts-rollup.cjs';
@@ -0,0 +1,4 @@
1
+ export { CommandPalette_alias_3 as CommandPalette } from '../_tsup-dts-rollup.js';
2
+ export { CommandPaletteProps_alias_2 as CommandPaletteProps } from '../_tsup-dts-rollup.js';
3
+ export { CommandItem_alias_2 as CommandItem } from '../_tsup-dts-rollup.js';
4
+ export { CommandGroup_alias_2 as CommandGroup } from '../_tsup-dts-rollup.js';
@@ -0,0 +1 @@
1
+ import {useRef,useEffect,useState,useMemo,useCallback}from'react';import {createPortal}from'react-dom';import {Search,Command}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsx,jsxs}from'react/jsx-runtime';function x(...r){return twMerge(clsx(r))}function k(r){return r.toLowerCase().replace(/\s+/g," ").trim()}function H(r,t){if(!t)return true;let a=k(t);return k(r.label).includes(a)||(r.description?k(r.description).includes(a):false)||(r.keywords?r.keywords.some(d=>k(d).includes(a)):false)}function q(r){let t=new Map;for(let a of r){let d=a.group??"";t.has(d)||t.set(d,[]),t.get(d).push(a);}return Array.from(t.entries()).map(([a,d])=>({label:a,items:d}))}function P(r,t,a,d){let[p,b]=useState(""),[u,c]=useState(0);useEffect(()=>{t&&(b(""),c(0));},[t]);let o=useMemo(()=>r.filter(e=>!e.disabled&&H(e,p)),[r,p]),v=useMemo(()=>q(o),[o]);useEffect(()=>{c(e=>Math.min(e,Math.max(0,o.length-1)));},[o.length]);let y=useCallback(()=>{let e=o[u];e&&(e.onSelect(),a(false));},[o,u,a]),h=useCallback(e=>{switch(e.key){case "ArrowDown":e.preventDefault(),c(n=>(n+1)%Math.max(1,o.length));break;case "ArrowUp":e.preventDefault(),c(n=>(n-1+Math.max(1,o.length))%Math.max(1,o.length));break;case "Enter":e.preventDefault(),y();break;case "Escape":e.preventDefault(),a(false);break}},[o.length,y,a]);return useEffect(()=>{if(!d)return;function e(n){(n.metaKey||n.ctrlKey)&&n.key==="k"&&(n.preventDefault(),a(!t));}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d,t,a]),{query:p,setQuery:b,groups:v,filtered:o,activeIndex:u,setActiveIndex:c,handleKeyDown:h}}function V({open:r,onOpenChange:t,commands:a,placeholder:d="Type a command or search\u2026",hotkey:p=true,maxItems:b=8,className:u}){let c=useRef(null),o=useRef(null),{query:v,setQuery:y,groups:h,filtered:e,activeIndex:n,setActiveIndex:D,handleKeyDown:A}=P(a,r,t,p);if(useEffect(()=>{if(r){let l=setTimeout(()=>c.current?.focus(),40);return ()=>clearTimeout(l)}},[r]),useEffect(()=>{o.current?.querySelector("[data-active='true']")?.scrollIntoView({block:"nearest"});},[n]),!r)return null;let K=0;return createPortal(jsx("div",{className:"cmd-backdrop fixed inset-0 z-50 flex items-start justify-center pt-[15vh]",onClick:()=>t(false),role:"presentation",children:jsxs("div",{className:x("cmd-panel relative flex w-full max-w-lg flex-col overflow-hidden rounded-xl","border border-primary-200 bg-white shadow-2xl","dark:border-primary-700 dark:bg-primary-900",u),onClick:l=>l.stopPropagation(),onKeyDown:A,role:"dialog","aria-label":"Command palette","aria-modal":"true",children:[jsxs("div",{className:"flex items-center gap-3 border-b border-primary-100 px-4 dark:border-primary-700",children:[jsx(Search,{className:"h-4 w-4 shrink-0 text-secondary-400","aria-hidden":"true"}),jsx("input",{ref:c,value:v,onChange:l=>y(l.target.value),placeholder:d,className:"flex-1 bg-transparent py-3.5 text-sm text-primary-900 outline-none placeholder:text-secondary-400 dark:text-primary-50","aria-label":"Search commands","aria-controls":"cmd-results","aria-autocomplete":"list","aria-activedescendant":e[n]?`cmd-item-${e[n].id}`:void 0,spellCheck:false,autoComplete:"off"}),jsx("kbd",{className:"hidden shrink-0 rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-400 dark:border-primary-600 sm:block",children:"esc"})]}),jsx("div",{id:"cmd-results",ref:o,className:"overflow-y-auto py-2",style:{maxHeight:`${b*2.75}rem`},role:"listbox","aria-label":"Commands",children:e.length===0?jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-sm text-secondary-400",children:[jsx(Command,{className:"h-8 w-8 opacity-30"}),jsx("span",{children:"No commands found"})]}):h.map(l=>jsxs("div",{className:"mb-1 last:mb-0",children:[l.label&&jsx("p",{className:"px-4 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-secondary-400 dark:text-secondary-500",children:l.label}),l.items.map(i=>{let w=K++,f=w===n;return jsxs("button",{id:`cmd-item-${i.id}`,"data-active":f,role:"option","aria-selected":f,className:x("cmd-item group flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm",f?"bg-primary-100 text-primary-900 dark:bg-primary-800 dark:text-primary-50":"text-primary-700 hover:bg-primary-50 dark:text-primary-300 dark:hover:bg-primary-800/50"),onMouseEnter:()=>D(w),onClick:()=>{i.onSelect(),t(false);},children:[i.icon&&jsx("span",{className:x("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-xs",f?"border-primary-300 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-700 dark:text-primary-200":"border-primary-200 bg-primary-50 text-primary-500 dark:border-primary-700 dark:bg-primary-800 dark:text-primary-400"),children:i.icon}),jsxs("span",{className:"min-w-0 flex-1",children:[jsx("span",{className:"block truncate font-medium",children:i.label}),i.description&&jsx("span",{className:"block truncate text-xs text-secondary-400 dark:text-secondary-500",children:i.description})]}),i.shortcut&&jsx("span",{className:"flex shrink-0 items-center gap-0.5",children:i.shortcut.map((S,L)=>jsx("kbd",{className:"rounded border border-primary-200 px-1.5 py-0.5 text-xs text-secondary-500 dark:border-primary-700 dark:text-secondary-400",children:S},L))})]},i.id)})]},l.label||"_default"))}),e.length>0&&jsxs("div",{className:"flex items-center justify-between border-t border-primary-100 px-4 py-2 dark:border-primary-700",children:[jsxs("span",{className:"text-xs text-secondary-400",children:[e.length," result",e.length!==1?"s":""]}),jsxs("span",{className:"flex items-center gap-3 text-xs text-secondary-400",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2191"}),jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u2193"}),"Navigate"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("kbd",{className:"rounded border border-primary-200 px-1 dark:border-primary-700",children:"\u21B5"}),"Select"]})]})]})]})}),document.body)}export{V as CommandPalette};
@@ -1,4 +1,4 @@
1
- 'use strict';var Qe=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),reactDom=require('react-dom'),lucideReact=require('lucide-react'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Qe__default=/*#__PURE__*/_interopDefault(Qe);function u(...t){return tailwindMerge.twMerge(clsx.clsx(t))}var ke=classVarianceAuthority.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"}});classVarianceAuthority.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 C=[];function St(t){C.push(t);}function Lt(t){let o=C.indexOf(t);o!==-1&&C.splice(o,1);}function ze(t){return C.length>0&&C[C.length-1]===t}function Vt(t){let o=C.indexOf(t);return o!==-1?o:C.length}var Xe=Qe.createContext(null);function Ye({open:t,onOpenChange:o,modal:p=true,closeOnOutsideClick:y=false,children:v}){let c=Qe.useId();return Qe.useEffect(()=>{if(t)return St(c),()=>Lt(c)},[t,c]),Qe.useEffect(()=>{if(!t||!p)return;let L=A=>{A.key==="Escape"&&ze(c)&&o(false);};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[t,p,o,c]),Qe.useEffect(()=>{if(!t||!p)return;let L=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=L;}},[t,p]),t?jsxRuntime.jsx(Xe.Provider,{value:{id:c,onOpenChange:o,modal:p,closeOnOutsideClick:y},children:reactDom.createPortal(v,document.body)}):null}function Ke({size:t,position:o="center",className:p,children:y,...v}){let c=Qe.useContext(Xe);if(!c)return null;let A=200+Vt(c.id)*10,J=()=>{c.closeOnOutsideClick&&ze(c.id)&&c.onOpenChange(false);},V=o==="bottom";return c.modal?jsxRuntime.jsx("div",{className:u("animate-fade-in fixed inset-0 bg-black/50",V?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:A},onClick:J,children:jsxRuntime.jsx("div",{className:u(ke({size:t}),V?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",p),role:"dialog","aria-modal":"true",onClick:O=>O.stopPropagation(),...v,children:y})}):jsxRuntime.jsx("div",{className:u("fixed inset-0 flex items-center justify-center p-4",c.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:A},onClick:c.closeOnOutsideClick&&ze(c.id)?()=>c.onOpenChange(false):void 0,children:jsxRuntime.jsx("div",{className:u(ke({size:t}),"animate-scale-in pointer-events-auto shadow-2xl",p),role:"dialog",onClick:c.closeOnOutsideClick?O=>O.stopPropagation():void 0,...v,children:y})})}function $e({className:t,...o}){return jsxRuntime.jsx("div",{className:u("mb-4 space-y-1",t),...o})}function We({className:t,...o}){return jsxRuntime.jsx("h2",{className:u("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",t),...o})}function qe({className:t,...o}){return jsxRuntime.jsx("p",{className:u("text-primary-500 dark:text-primary-400 text-sm",t),...o})}function Ge({className:t,...o}){return jsxRuntime.jsx("div",{className:u("mt-6 flex justify-end gap-2",t),...o})}var Ue=classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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 Me({intent:t,size:o,className:p,...y}){return jsxRuntime.jsx("button",{className:u(Ue({intent:t,size:o}),p),...y})}function de(t){let o=t.lastIndexOf(".");return o>0?t.slice(o).toLowerCase():""}function tt(t){return t==null?"\u2014":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function Te(t){return t?(typeof t=="string"?new Date(t):t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var $t={".png":lucideReact.Image,".jpg":lucideReact.Image,".jpeg":lucideReact.Image,".gif":lucideReact.Image,".svg":lucideReact.Image,".webp":lucideReact.Image,".ico":lucideReact.Image,".bmp":lucideReact.Image,".mp3":lucideReact.Music,".wav":lucideReact.Music,".flac":lucideReact.Music,".ogg":lucideReact.Music,".aac":lucideReact.Music,".m4a":lucideReact.Music,".mp4":lucideReact.Video,".mkv":lucideReact.Video,".avi":lucideReact.Video,".mov":lucideReact.Video,".wmv":lucideReact.Video,".webm":lucideReact.Video,".ts":lucideReact.FileCode,".tsx":lucideReact.FileCode,".js":lucideReact.FileCode,".jsx":lucideReact.FileCode,".json":lucideReact.FileCode,".html":lucideReact.FileCode,".css":lucideReact.FileCode,".scss":lucideReact.FileCode,".py":lucideReact.FileCode,".rs":lucideReact.FileCode,".go":lucideReact.FileCode,".java":lucideReact.FileCode,".c":lucideReact.FileCode,".cpp":lucideReact.FileCode,".h":lucideReact.FileCode,".sh":lucideReact.Terminal,".bat":lucideReact.Terminal,".ps1":lucideReact.Terminal,".md":lucideReact.FileText,".txt":lucideReact.FileText,".pdf":lucideReact.FileText,".doc":lucideReact.FileText,".docx":lucideReact.FileText,".rtf":lucideReact.FileText,".csv":lucideReact.FileSpreadsheet,".xls":lucideReact.FileSpreadsheet,".xlsx":lucideReact.FileSpreadsheet,".db":lucideReact.Database,".sqlite":lucideReact.Database,".sql":lucideReact.Database,".zip":lucideReact.FileArchive,".tar":lucideReact.FileArchive,".gz":lucideReact.FileArchive,".rar":lucideReact.FileArchive,".7z":lucideReact.FileArchive};function Se(t){if(t.type==="directory")return lucideReact.Folder;let o=t.extension||de(t.name);return $t[o]||lucideReact.File}function U(t,o,p){return Math.max(o,Math.min(p,t))}function rt(t){return t<480?"xs":t<640?"sm":t<1024?"md":"lg"}function nt(t,o){if(t<480)return {size:{width:t-16,height:o-48},pos:{x:8,y:24}};if(t<640){let v=t-24,c=Math.min(o-64,540);return {size:{width:v,height:c},pos:{x:12,y:32}}}if(t<1024){let v=Math.min(640,t-32),c=Math.min(480,o-64);return {size:{width:v,height:c},pos:{x:Math.max(0,Math.round((t-v)/2)),y:Math.max(0,Math.round((o-c)/2))}}}let p=720,y=520;return {size:{width:p,height:y},pos:{x:Math.max(0,Math.round((t-p)/2)),y:Math.max(0,Math.round((o-y)/2))}}}function Lr({files:t,title:o="File Explorer",accent:p="#8b5cf6",defaultView:y="list",initialPosition:v,initialSize:c,dockable:L=false,dockSide:A="right",visible:J=true,onFileOpen:V,onSelectionChange:O,onNavigate:ie,onDelete:ue,onClose:at,onMinimize:Le,onPathSubmit:Ve,defaultInputMode:st="search",actions:it,resizable:ct=true,minSize:Z={width:400,height:300},className:lt}){let[me,dt]=Qe.useState(y),[b,P]=Qe.useState(new Set),[Fe,ee]=Qe.useState(null),[l,pe]=Qe.useState(false),[te,fe]=Qe.useState(false),[F,ut]=Qe.useState(""),[R,mt]=Qe.useState(st),[pt,ft]=Qe.useState(J),[gt,ce]=Qe.useState(false),[B,bt]=Qe.useState({w:window.innerWidth,h:window.innerHeight}),Re=nt(window.innerWidth,window.innerHeight),[f,j]=Qe.useState(v??Re.pos),[k,le]=Qe.useState(c??Re.size),[z,xt]=Qe.useState(null),re=Qe.useRef(false),X=Qe.useRef({x:0,y:0}),ge=Qe.useRef(null),_=Qe.useRef(false),ne=Qe.useRef({x:0,y:0,w:0,h:0,px:0,py:0}),oe=Qe.useRef(false),_e=Qe.useRef(l);Qe.useEffect(()=>{_e.current=l;},[l]);let be=J!==void 0?J:pt,xe=Qe.useMemo(()=>{let e=t.filter(a=>a.type==="directory"),n=t.filter(a=>a.type==="file");return e.sort((a,s)=>a.name.localeCompare(s.name)),n.sort((a,s)=>a.name.localeCompare(s.name)),[...e,...n]},[t]),x=Qe.useMemo(()=>{if(R!=="search"||!F.trim())return xe;let e=F.toLowerCase();return xe.filter(n=>n.name.toLowerCase().includes(e))},[xe,F,R]),m=Fe!=null?x[Fe]:null;Qe.useEffect(()=>{let e=rt(window.innerWidth),n=()=>{let a=window.innerWidth,s=window.innerHeight;if(bt({w:a,h:s}),_e.current)return;let d=rt(a);if(d!==e&&!oe.current&&!c){let w=nt(a,s);le(w.size),j(w.pos);}e=d;};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[c]);let Ie=Qe.useCallback((e,n)=>{P(a=>{let s=new Set(a);return n.ctrlKey||n.metaKey?s.has(e)?s.delete(e):s.add(e):(s.clear(),s.add(e)),s}),ee(e);},[]);Qe.useEffect(()=>{if(!O)return;let e=Array.from(b).map(n=>x[n]).filter(Boolean);O(e);},[b]);let He=Qe.useCallback(e=>{let n=x[e];n&&(n.type==="directory"?ie?.(n.path):V?.(n));},[x,V,ie]),ht=Qe.useCallback(e=>{l||e.target.closest("button")||(oe.current=true,re.current=true,X.current={x:e.clientX-f.x,y:e.clientY-f.y},e.preventDefault());},[f,l]),wt=Qe.useCallback(e=>{if(l||e.target.closest("button"))return;oe.current=true;let n=e.touches[0];re.current=true,X.current={x:n.clientX-f.x,y:n.clientY-f.y};},[f,l]);Qe.useEffect(()=>{let e=s=>{if(!re.current)return;let d=window.innerWidth-100,w=window.innerHeight-40;j({x:U(s.clientX-X.current.x,0,d),y:U(s.clientY-X.current.y,0,w)});},n=s=>{if(!re.current)return;s.preventDefault();let d=s.touches[0],w=window.innerWidth-100,I=window.innerHeight-40;j({x:U(d.clientX-X.current.x,0,w),y:U(d.clientY-X.current.y,0,I)});},a=()=>{re.current=false,_.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",a),window.addEventListener("touchmove",n,{passive:false}),window.addEventListener("touchend",a),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",a),window.removeEventListener("touchmove",n),window.removeEventListener("touchend",a);}},[]);let M=Qe.useCallback((e,n)=>{l||(n.preventDefault(),n.stopPropagation(),oe.current=true,_.current=e,ne.current={x:n.clientX,y:n.clientY,w:k.width,h:k.height,px:f.x,py:f.y},document.body.style.cursor=e==="e"||e==="w"?"ew-resize":e==="n"||e==="s"?"ns-resize":e==="nw"||e==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[l,k,f]),D=Qe.useCallback((e,n)=>{if(l)return;n.preventDefault(),n.stopPropagation(),oe.current=true;let a=n.touches[0];_.current=e,ne.current={x:a.clientX,y:a.clientY,w:k.width,h:k.height,px:f.x,py:f.y},document.body.style.userSelect="none";},[l,k,f]);Qe.useEffect(()=>{let e=(d,w)=>{let I=_.current;if(!I)return;let Pe=d-ne.current.x,Be=w-ne.current.y,{w:Y,h:K,px:ye,py:ve}=ne.current;if(I.includes("e")&&(Y=Math.max(Z.width,Y+Pe)),I.includes("w")){let ae=Math.max(Z.width,Y-Pe);ye=ye+(Y-ae),Y=ae;}if(I.includes("s")&&(K=Math.max(Z.height,K+Be)),I.includes("n")){let ae=Math.max(Z.height,K-Be);ve=ve+(K-ae),K=ae;}le({width:Y,height:K}),j({x:ye,y:ve});},n=d=>{_.current&&e(d.clientX,d.clientY);},a=d=>{_.current&&(d.preventDefault(),e(d.touches[0].clientX,d.touches[0].clientY));},s=()=>{_.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",n),window.addEventListener("mouseup",s),window.addEventListener("touchmove",a,{passive:false}),window.addEventListener("touchend",s),()=>{window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",s),window.removeEventListener("touchmove",a),window.removeEventListener("touchend",s);}},[Z]);let Ae=Qe.useCallback(()=>{l?(z&&(j(z.pos),le(z.size)),pe(false)):(xt({pos:f,size:k}),pe(true));},[l,f,k,z]),yt=Qe.useCallback(()=>{te?fe(false):(l&&(pe(false),z&&(j(z.pos),le(z.size))),fe(true),Le?.());},[te,l,z,Le]);Qe.useEffect(()=>{if(!be||te)return;let e=n=>{if(!(!ge.current?.contains(document.activeElement)&&document.activeElement!==ge.current)){if(n.key==="Escape"&&(ee(null),P(new Set)),n.ctrlKey&&n.key==="a"){n.preventDefault();let a=new Set(x.map((s,d)=>d));P(a);}n.key==="Delete"&&b.size>0&&ue&&(n.preventDefault(),ce(true));}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[be,te,x,b,ue]);let Oe={"--fe-accent":p};if(te)return jsxRuntime.jsx("div",{className:u("fixed z-100 cursor-pointer transition-all duration-300",A==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:Oe,onClick:()=>fe(false),title:`Restore ${o}`,children:jsxRuntime.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:[jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:o})]})});if(!be)return null;let he=l?B.w:Math.min(k.width,B.w-8),vt=l?B.h:Math.min(k.height,B.h-8),kt=l?0:U(f.x,0,Math.max(0,B.w-he)),Nt=l?0:U(f.y,0,Math.max(0,B.h-40)),we=he<500;return jsxRuntime.jsxs("div",{ref:ge,className:u("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]",l&&"rounded-none",lt),style:{...Oe,left:kt,top:Nt,width:he,height:vt,transition:l?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[jsxRuntime.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:ht,onTouchStart:wt,onDoubleClick:Ae,children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:o}),jsxRuntime.jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:"fe-btn mr-1",onClick:()=>dt(e=>e==="list"?"grid":"list"),title:me==="list"?"Grid view":"List view",children:me==="list"?jsxRuntime.jsx(lucideReact.LayoutGrid,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.LayoutList,{className:"h-3.5 w-3.5"})}),L&&jsxRuntime.jsx("button",{className:"fe-btn",onClick:yt,title:"Dock to edge",children:jsxRuntime.jsx(lucideReact.Minus,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn",onClick:Ae,title:l?"Restore":"Maximize",children:l?jsxRuntime.jsx(lucideReact.Minimize2,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Maximize2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{at?.(),ft(false);},title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsxRuntime.jsx("button",{className:"fe-btn p-1",onClick:()=>ie?.(".."),title:"Go up",children:jsxRuntime.jsx(lucideReact.FolderUp,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:R==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>mt(e=>e==="search"?"navigate":"search"),title:R==="search"?"Switch to path navigation":"Switch to file search",children:R==="search"?jsxRuntime.jsx(lucideReact.Search,{className:"h-3 w-3"}):jsxRuntime.jsx(lucideReact.CornerRightDown,{className:"h-3 w-3"})}),jsxRuntime.jsx("div",{className:"relative flex-1",children:jsxRuntime.jsx("input",{type:"text",value:F,onChange:e=>ut(e.target.value),onKeyDown:e=>{e.key==="Enter"&&F.trim()&&R==="navigate"&&(Ve?Ve(F.trim()):ie?.(F.trim()));},placeholder:R==="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)"})}),jsxRuntime.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[x.length," item",x.length!==1?"s":"",b.size>0&&` \xB7 ${b.size} selected`]})]}),jsxRuntime.jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:e=>{e.target===e.currentTarget&&(P(new Set),ee(null));},children:x.length===0?jsxRuntime.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsxRuntime.jsx(lucideReact.Folder,{className:"mb-2 h-10 w-10"}),jsxRuntime.jsx("span",{className:"text-xs",children:"No files found"})]}):me==="list"?jsxRuntime.jsx("div",{className:"space-y-px",children:x.map((e,n)=>{let a=Se(e),s=b.has(n),d=e.extension||de(e.name);return jsxRuntime.jsxs("div",{className:u("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",s?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:s?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:w=>Ie(n,w),onDoubleClick:()=>He(n),children:[jsxRuntime.jsx(a,{className:u("h-4 w-4 shrink-0",e.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:e.name}),d&&e.type==="file"&&jsxRuntime.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:d}),e.size!=null&&jsxRuntime.jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:tt(e.size)}),e.modifiedAt&&jsxRuntime.jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Te(e.modifiedAt)})]},e.path+n)})}):jsxRuntime.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:x.map((e,n)=>{let a=Se(e),s=b.has(n),d=e.extension||de(e.name);return jsxRuntime.jsxs("div",{className:u("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",s?"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:w=>Ie(n,w),onDoubleClick:()=>He(n),children:[jsxRuntime.jsx(a,{className:u("h-7 w-7",e.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:e.name}),d&&e.type==="file"&&jsxRuntime.jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:d})]},e.path+n)})})}),jsxRuntime.jsx("div",{className:u("overflow-hidden transition-[width,opacity] duration-300 ease-out",we?u("absolute right-0 top-0 bottom-0 z-10",m?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):u("shrink-0",m?"w-56":"w-0")),children:m&&jsxRuntime.jsxs("div",{className:u("flex h-full flex-col p-4",we?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[we&&jsxRuntime.jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{ee(null),P(new Set);},title:"Close panel",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsxs("div",{className:"mb-3 flex flex-col items-center",children:[Qe__default.default.createElement(Se(m),{className:u("h-10 w-10 mb-2",m.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:m.name})]}),jsxRuntime.jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsxRuntime.jsx(Q,{label:"Type",value:m.type==="directory"?"Directory":m.mimeType||m.extension||de(m.name)||"File"}),m.size!=null&&jsxRuntime.jsx(Q,{label:"Size",value:tt(m.size)}),jsxRuntime.jsx(Q,{label:"Path",value:m.path,mono:true}),m.extension&&jsxRuntime.jsx(Q,{label:"Extension",value:m.extension}),m.modifiedAt&&jsxRuntime.jsx(Q,{label:"Modified",value:Te(m.modifiedAt)}),m.createdAt&&jsxRuntime.jsx(Q,{label:"Created",value:Te(m.createdAt)})]}),jsxRuntime.jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[m.type==="file"&&V&&jsxRuntime.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:()=>V(m),children:[jsxRuntime.jsx(lucideReact.ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),it?.map(e=>jsxRuntime.jsxs("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>e.onClick(m),children:[e.icon&&Qe__default.default.createElement(e.icon,{className:"h-3 w-3"}),e.label]},e.key))]})]})})]}),jsxRuntime.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:[jsxRuntime.jsxs("span",{children:[x.length," items"]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[b.size>0&&jsxRuntime.jsxs("span",{className:"text-(--fe-accent)/70",children:[b.size," selected"]}),jsxRuntime.jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),ct&&!l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:e=>M("n",e),onTouchStart:e=>D("n",e)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:e=>M("s",e),onTouchStart:e=>D("s",e)}),jsxRuntime.jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:e=>M("w",e),onTouchStart:e=>D("w",e)}),jsxRuntime.jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:e=>M("e",e),onTouchStart:e=>D("e",e)}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:e=>M("nw",e),onTouchStart:e=>D("nw",e)}),jsxRuntime.jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:e=>M("ne",e),onTouchStart:e=>D("ne",e)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:e=>M("sw",e),onTouchStart:e=>D("sw",e)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:e=>M("se",e),onTouchStart:e=>D("se",e)})]}),jsxRuntime.jsx("style",{children:`
1
+ 'use strict';var Qe=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),reactDom=require('react-dom'),lucideReact=require('lucide-react'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Qe__default=/*#__PURE__*/_interopDefault(Qe);function u(...t){return tailwindMerge.twMerge(clsx.clsx(t))}var ke=classVarianceAuthority.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"}});classVarianceAuthority.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 E=[];function Tt(t){E.push(t);}function St(t){let a=E.indexOf(t);a!==-1&&E.splice(a,1);}function Ne(t){return E.length>0&&E[E.length-1]===t}function Lt(t){let a=E.indexOf(t);return a!==-1?a:E.length}var Xe=Qe.createContext(null);function Ye({open:t,onOpenChange:a,modal:p=true,closeOnOutsideClick:v=false,children:k}){let d=Qe.useId();return Qe.useEffect(()=>{if(t)return Tt(d),()=>St(d)},[t,d]),Qe.useEffect(()=>{if(!t||!p)return;let S=A=>{A.key==="Escape"&&Ne(d)&&a(false);};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[t,p,a,d]),Qe.useEffect(()=>{if(!t||!p)return;let S=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=S;}},[t,p]),t?jsxRuntime.jsx(Xe.Provider,{value:{id:d,onOpenChange:a,modal:p,closeOnOutsideClick:v},children:reactDom.createPortal(k,document.body)}):null}function Ke({size:t,position:a="center",className:p,children:v,...k}){let d=Qe.useContext(Xe);if(!d)return null;let A=200+Lt(d.id)*10,J=()=>{d.closeOnOutsideClick&&Ne(d.id)&&d.onOpenChange(false);},L=a==="bottom";return d.modal?jsxRuntime.jsx("div",{className:u("animate-fade-in fixed inset-0 bg-black/50",L?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:A},onClick:J,children:jsxRuntime.jsx("div",{className:u(ke({size:t}),L?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",p),role:"dialog","aria-modal":"true",onClick:O=>O.stopPropagation(),...k,children:v})}):jsxRuntime.jsx("div",{className:u("fixed inset-0 flex items-center justify-center p-4",d.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:A},onClick:d.closeOnOutsideClick&&Ne(d.id)?()=>d.onOpenChange(false):void 0,children:jsxRuntime.jsx("div",{className:u(ke({size:t}),"animate-scale-in pointer-events-auto shadow-2xl",p),role:"dialog",onClick:d.closeOnOutsideClick?O=>O.stopPropagation():void 0,...k,children:v})})}function $e({className:t,...a}){return jsxRuntime.jsx("div",{className:u("mb-4 space-y-1",t),...a})}function We({className:t,...a}){return jsxRuntime.jsx("h2",{className:u("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",t),...a})}function qe({className:t,...a}){return jsxRuntime.jsx("p",{className:u("text-primary-500 dark:text-primary-400 text-sm",t),...a})}function Ge({className:t,...a}){return jsxRuntime.jsx("div",{className:u("mt-6 flex justify-end gap-2",t),...a})}var Ue=classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.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"}});classVarianceAuthority.cva("bg-primary-200 text-primary-700 dark:bg-primary-700 dark:text-primary-200",{variants:{size:{xs:"h-6 w-6 text-[10px]",sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-12 w-12 text-base",xl:"h-16 w-16 text-lg"},shape:{circular:"rounded-full",rounded:"rounded-lg",square:"rounded-none"}},defaultVariants:{size:"md",shape:"circular"}});classVarianceAuthority.cva("relative flex w-full touch-none select-none items-center",{variants:{intent:{primary:"[&_.slider-fill]:bg-primary-500 [&_.slider-thumb]:border-primary-500",secondary:"[&_.slider-fill]:bg-secondary-500 [&_.slider-thumb]:border-secondary-500",success:"[&_.slider-fill]:bg-success-500 [&_.slider-thumb]:border-success-500",danger:"[&_.slider-fill]:bg-danger-500 [&_.slider-thumb]:border-danger-500",warning:"[&_.slider-fill]:bg-warning-500 [&_.slider-thumb]:border-warning-500"},size:{sm:"h-4",md:"h-5",lg:"h-6"}},defaultVariants:{intent:"primary",size:"md"}});classVarianceAuthority.cva("inline-flex items-center gap-1 rounded-full font-medium select-none transition-colors [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-100 text-primary-700 dark:bg-primary-800 dark:text-primary-200",secondary:"bg-secondary-100 text-secondary-700 dark:bg-secondary-800 dark:text-secondary-200",success:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",danger:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",warning:"bg-warning-100 text-warning-700 dark:bg-warning-900/40 dark:text-warning-300",info:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"},size:{sm:"h-5 px-2 text-[0.6875rem] gap-0.5",md:"h-6 px-2.5 text-xs gap-1",lg:"h-7 px-3 text-sm gap-1"},variant:{solid:"",outline:"bg-transparent border",soft:""}},compoundVariants:[{intent:"primary",variant:"outline",class:"border-primary-300 text-primary-700 dark:border-primary-600 dark:text-primary-300"},{intent:"secondary",variant:"outline",class:"border-secondary-300 text-secondary-700 dark:border-secondary-600 dark:text-secondary-300"},{intent:"success",variant:"outline",class:"border-success-400 text-success-700 dark:border-success-600 dark:text-success-300"},{intent:"danger",variant:"outline",class:"border-danger-400 text-danger-700 dark:border-danger-600 dark:text-danger-300"},{intent:"warning",variant:"outline",class:"border-warning-400 text-warning-700 dark:border-warning-600 dark:text-warning-300"},{intent:"info",variant:"outline",class:"border-blue-400 text-blue-700 dark:border-blue-600 dark:text-blue-300"}],defaultVariants:{intent:"primary",size:"md",variant:"solid"}});classVarianceAuthority.cva("relative w-full cursor-pointer rounded-md border bg-white text-sm transition-colors dark:bg-primary-900",{variants:{intent:{default:"border-primary-300 text-primary-900 hover:border-primary-400 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-primary-600 dark:text-primary-100 dark:hover:border-primary-500 dark:focus-within:border-primary-400",danger:"border-danger-500 text-primary-900 focus-within:ring-2 focus-within:ring-danger-500/20 dark:border-danger-500 dark:text-primary-100"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 text-sm",lg:"h-11 px-4 text-base"}},defaultVariants:{intent:"default",size:"md"}});function Me({intent:t,size:a,className:p,...v}){return jsxRuntime.jsx("button",{className:u(Ue({intent:t,size:a}),p),...v})}function le(t){let a=t.lastIndexOf(".");return a>0?t.slice(a).toLowerCase():""}function tt(t){return t==null?"\u2014":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function Ve(t){return t?(typeof t=="string"?new Date(t):t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var $t={".png":lucideReact.Image,".jpg":lucideReact.Image,".jpeg":lucideReact.Image,".gif":lucideReact.Image,".svg":lucideReact.Image,".webp":lucideReact.Image,".ico":lucideReact.Image,".bmp":lucideReact.Image,".mp3":lucideReact.Music,".wav":lucideReact.Music,".flac":lucideReact.Music,".ogg":lucideReact.Music,".aac":lucideReact.Music,".m4a":lucideReact.Music,".mp4":lucideReact.Video,".mkv":lucideReact.Video,".avi":lucideReact.Video,".mov":lucideReact.Video,".wmv":lucideReact.Video,".webm":lucideReact.Video,".ts":lucideReact.FileCode,".tsx":lucideReact.FileCode,".js":lucideReact.FileCode,".jsx":lucideReact.FileCode,".json":lucideReact.FileCode,".html":lucideReact.FileCode,".css":lucideReact.FileCode,".scss":lucideReact.FileCode,".py":lucideReact.FileCode,".rs":lucideReact.FileCode,".go":lucideReact.FileCode,".java":lucideReact.FileCode,".c":lucideReact.FileCode,".cpp":lucideReact.FileCode,".h":lucideReact.FileCode,".sh":lucideReact.Terminal,".bat":lucideReact.Terminal,".ps1":lucideReact.Terminal,".md":lucideReact.FileText,".txt":lucideReact.FileText,".pdf":lucideReact.FileText,".doc":lucideReact.FileText,".docx":lucideReact.FileText,".rtf":lucideReact.FileText,".csv":lucideReact.FileSpreadsheet,".xls":lucideReact.FileSpreadsheet,".xlsx":lucideReact.FileSpreadsheet,".db":lucideReact.Database,".sqlite":lucideReact.Database,".sql":lucideReact.Database,".zip":lucideReact.FileArchive,".tar":lucideReact.FileArchive,".gz":lucideReact.FileArchive,".rar":lucideReact.FileArchive,".7z":lucideReact.FileArchive};function Te(t){if(t.type==="directory")return lucideReact.Folder;let a=t.extension||le(t.name);return $t[a]||lucideReact.File}function U(t,a,p){return Math.max(a,Math.min(p,t))}function rt(t){return t<480?"xs":t<640?"sm":t<1024?"md":"lg"}function nt(t,a){if(t<480)return {size:{width:t-16,height:a-48},pos:{x:8,y:24}};if(t<640){let k=t-24,d=Math.min(a-64,540);return {size:{width:k,height:d},pos:{x:12,y:32}}}if(t<1024){let k=Math.min(640,t-32),d=Math.min(480,a-64);return {size:{width:k,height:d},pos:{x:Math.max(0,Math.round((t-k)/2)),y:Math.max(0,Math.round((a-d)/2))}}}let p=720,v=520;return {size:{width:p,height:v},pos:{x:Math.max(0,Math.round((t-p)/2)),y:Math.max(0,Math.round((a-v)/2))}}}function Rr({files:t,title:a="File Explorer",accent:p="#8b5cf6",defaultView:v="list",initialPosition:k,initialSize:d,dockable:S=false,dockSide:A="right",visible:J=true,onFileOpen:L,onSelectionChange:O,onNavigate:ie,onDelete:ue,onClose:st,onMinimize:Se,onPathSubmit:Le,defaultInputMode:ot="search",actions:it,resizable:dt=true,minSize:Z={width:400,height:300},className:ct}){let[me,lt]=Qe.useState(v),[b,P]=Qe.useState(new Set),[_e,ee]=Qe.useState(null),[c,pe]=Qe.useState(false),[te,ge]=Qe.useState(false),[_,ut]=Qe.useState(""),[F,mt]=Qe.useState(ot),[pt,gt]=Qe.useState(J),[ft,de]=Qe.useState(false),[B,bt]=Qe.useState({w:window.innerWidth,h:window.innerHeight}),Fe=nt(window.innerWidth,window.innerHeight),[g,j]=Qe.useState(k??Fe.pos),[z,ce]=Qe.useState(d??Fe.size),[M,xt]=Qe.useState(null),re=Qe.useRef(false),X=Qe.useRef({x:0,y:0}),fe=Qe.useRef(null),R=Qe.useRef(false),ne=Qe.useRef({x:0,y:0,w:0,h:0,px:0,py:0}),ae=Qe.useRef(false),Re=Qe.useRef(c);Qe.useEffect(()=>{Re.current=c;},[c]);let be=J!==void 0?J:pt,xe=Qe.useMemo(()=>{let e=t.filter(s=>s.type==="directory"),n=t.filter(s=>s.type==="file");return e.sort((s,o)=>s.name.localeCompare(o.name)),n.sort((s,o)=>s.name.localeCompare(o.name)),[...e,...n]},[t]),x=Qe.useMemo(()=>{if(F!=="search"||!_.trim())return xe;let e=_.toLowerCase();return xe.filter(n=>n.name.toLowerCase().includes(e))},[xe,_,F]),m=_e!=null?x[_e]:null;Qe.useEffect(()=>{let e=rt(window.innerWidth),n=()=>{let s=window.innerWidth,o=window.innerHeight;if(bt({w:s,h:o}),Re.current)return;let l=rt(s);if(l!==e&&!ae.current&&!d){let y=nt(s,o);ce(y.size),j(y.pos);}e=l;};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[d]);let Ie=Qe.useCallback((e,n)=>{P(s=>{let o=new Set(s);return n.ctrlKey||n.metaKey?o.has(e)?o.delete(e):o.add(e):(o.clear(),o.add(e)),o}),ee(e);},[]);Qe.useEffect(()=>{if(!O)return;let e=Array.from(b).map(n=>x[n]).filter(Boolean);O(e);},[b]);let He=Qe.useCallback(e=>{let n=x[e];n&&(n.type==="directory"?ie?.(n.path):L?.(n));},[x,L,ie]),ht=Qe.useCallback(e=>{c||e.target.closest("button")||(ae.current=true,re.current=true,X.current={x:e.clientX-g.x,y:e.clientY-g.y},e.preventDefault());},[g,c]),yt=Qe.useCallback(e=>{if(c||e.target.closest("button"))return;ae.current=true;let n=e.touches[0];re.current=true,X.current={x:n.clientX-g.x,y:n.clientY-g.y};},[g,c]);Qe.useEffect(()=>{let e=o=>{if(!re.current)return;let l=window.innerWidth-100,y=window.innerHeight-40;j({x:U(o.clientX-X.current.x,0,l),y:U(o.clientY-X.current.y,0,y)});},n=o=>{if(!re.current)return;o.preventDefault();let l=o.touches[0],y=window.innerWidth-100,I=window.innerHeight-40;j({x:U(l.clientX-X.current.x,0,y),y:U(l.clientY-X.current.y,0,I)});},s=()=>{re.current=false,R.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",s),window.addEventListener("touchmove",n,{passive:false}),window.addEventListener("touchend",s),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",s),window.removeEventListener("touchmove",n),window.removeEventListener("touchend",s);}},[]);let D=Qe.useCallback((e,n)=>{c||(n.preventDefault(),n.stopPropagation(),ae.current=true,R.current=e,ne.current={x:n.clientX,y:n.clientY,w:z.width,h:z.height,px:g.x,py:g.y},document.body.style.cursor=e==="e"||e==="w"?"ew-resize":e==="n"||e==="s"?"ns-resize":e==="nw"||e==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[c,z,g]),C=Qe.useCallback((e,n)=>{if(c)return;n.preventDefault(),n.stopPropagation(),ae.current=true;let s=n.touches[0];R.current=e,ne.current={x:s.clientX,y:s.clientY,w:z.width,h:z.height,px:g.x,py:g.y},document.body.style.userSelect="none";},[c,z,g]);Qe.useEffect(()=>{let e=(l,y)=>{let I=R.current;if(!I)return;let Pe=l-ne.current.x,Be=y-ne.current.y,{w:Y,h:K,px:we,py:ve}=ne.current;if(I.includes("e")&&(Y=Math.max(Z.width,Y+Pe)),I.includes("w")){let se=Math.max(Z.width,Y-Pe);we=we+(Y-se),Y=se;}if(I.includes("s")&&(K=Math.max(Z.height,K+Be)),I.includes("n")){let se=Math.max(Z.height,K-Be);ve=ve+(K-se),K=se;}ce({width:Y,height:K}),j({x:we,y:ve});},n=l=>{R.current&&e(l.clientX,l.clientY);},s=l=>{R.current&&(l.preventDefault(),e(l.touches[0].clientX,l.touches[0].clientY));},o=()=>{R.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",n),window.addEventListener("mouseup",o),window.addEventListener("touchmove",s,{passive:false}),window.addEventListener("touchend",o),()=>{window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",o),window.removeEventListener("touchmove",s),window.removeEventListener("touchend",o);}},[Z]);let Ae=Qe.useCallback(()=>{c?(M&&(j(M.pos),ce(M.size)),pe(false)):(xt({pos:g,size:z}),pe(true));},[c,g,z,M]),wt=Qe.useCallback(()=>{te?ge(false):(c&&(pe(false),M&&(j(M.pos),ce(M.size))),ge(true),Se?.());},[te,c,M,Se]);Qe.useEffect(()=>{if(!be||te)return;let e=n=>{if(!(!fe.current?.contains(document.activeElement)&&document.activeElement!==fe.current)){if(n.key==="Escape"&&(ee(null),P(new Set)),n.ctrlKey&&n.key==="a"){n.preventDefault();let s=new Set(x.map((o,l)=>l));P(s);}n.key==="Delete"&&b.size>0&&ue&&(n.preventDefault(),de(true));}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[be,te,x,b,ue]);let Oe={"--fe-accent":p};if(te)return jsxRuntime.jsx("div",{className:u("fixed z-100 cursor-pointer transition-all duration-300",A==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:Oe,onClick:()=>ge(false),title:`Restore ${a}`,children:jsxRuntime.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:[jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:a})]})});if(!be)return null;let he=c?B.w:Math.min(z.width,B.w-8),vt=c?B.h:Math.min(z.height,B.h-8),kt=c?0:U(g.x,0,Math.max(0,B.w-he)),zt=c?0:U(g.y,0,Math.max(0,B.h-40)),ye=he<500;return jsxRuntime.jsxs("div",{ref:fe,className:u("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]",c&&"rounded-none",ct),style:{...Oe,left:kt,top:zt,width:he,height:vt,transition:c?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[jsxRuntime.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:ht,onTouchStart:yt,onDoubleClick:Ae,children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.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:jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:a}),jsxRuntime.jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:"fe-btn mr-1",onClick:()=>lt(e=>e==="list"?"grid":"list"),title:me==="list"?"Grid view":"List view",children:me==="list"?jsxRuntime.jsx(lucideReact.LayoutGrid,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.LayoutList,{className:"h-3.5 w-3.5"})}),S&&jsxRuntime.jsx("button",{className:"fe-btn",onClick:wt,title:"Dock to edge",children:jsxRuntime.jsx(lucideReact.Minus,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn",onClick:Ae,title:c?"Restore":"Maximize",children:c?jsxRuntime.jsx(lucideReact.Minimize2,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Maximize2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{st?.(),gt(false);},title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsxRuntime.jsx("button",{className:"fe-btn p-1",onClick:()=>ie?.(".."),title:"Go up",children:jsxRuntime.jsx(lucideReact.FolderUp,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:F==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>mt(e=>e==="search"?"navigate":"search"),title:F==="search"?"Switch to path navigation":"Switch to file search",children:F==="search"?jsxRuntime.jsx(lucideReact.Search,{className:"h-3 w-3"}):jsxRuntime.jsx(lucideReact.CornerRightDown,{className:"h-3 w-3"})}),jsxRuntime.jsx("div",{className:"relative flex-1",children:jsxRuntime.jsx("input",{type:"text",value:_,onChange:e=>ut(e.target.value),onKeyDown:e=>{e.key==="Enter"&&_.trim()&&F==="navigate"&&(Le?Le(_.trim()):ie?.(_.trim()));},placeholder:F==="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)"})}),jsxRuntime.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[x.length," item",x.length!==1?"s":"",b.size>0&&` \xB7 ${b.size} selected`]})]}),jsxRuntime.jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:e=>{e.target===e.currentTarget&&(P(new Set),ee(null));},children:x.length===0?jsxRuntime.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsxRuntime.jsx(lucideReact.Folder,{className:"mb-2 h-10 w-10"}),jsxRuntime.jsx("span",{className:"text-xs",children:"No files found"})]}):me==="list"?jsxRuntime.jsx("div",{className:"space-y-px",children:x.map((e,n)=>{let s=Te(e),o=b.has(n),l=e.extension||le(e.name);return jsxRuntime.jsxs("div",{className:u("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:y=>Ie(n,y),onDoubleClick:()=>He(n),children:[jsxRuntime.jsx(s,{className:u("h-4 w-4 shrink-0",e.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:e.name}),l&&e.type==="file"&&jsxRuntime.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:l}),e.size!=null&&jsxRuntime.jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:tt(e.size)}),e.modifiedAt&&jsxRuntime.jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Ve(e.modifiedAt)})]},e.path+n)})}):jsxRuntime.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:x.map((e,n)=>{let s=Te(e),o=b.has(n),l=e.extension||le(e.name);return jsxRuntime.jsxs("div",{className:u("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:y=>Ie(n,y),onDoubleClick:()=>He(n),children:[jsxRuntime.jsx(s,{className:u("h-7 w-7",e.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:e.name}),l&&e.type==="file"&&jsxRuntime.jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:l})]},e.path+n)})})}),jsxRuntime.jsx("div",{className:u("overflow-hidden transition-[width,opacity] duration-300 ease-out",ye?u("absolute right-0 top-0 bottom-0 z-10",m?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):u("shrink-0",m?"w-56":"w-0")),children:m&&jsxRuntime.jsxs("div",{className:u("flex h-full flex-col p-4",ye?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[ye&&jsxRuntime.jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{ee(null),P(new Set);},title:"Close panel",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsxs("div",{className:"mb-3 flex flex-col items-center",children:[Qe__default.default.createElement(Te(m),{className:u("h-10 w-10 mb-2",m.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:m.name})]}),jsxRuntime.jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsxRuntime.jsx(Q,{label:"Type",value:m.type==="directory"?"Directory":m.mimeType||m.extension||le(m.name)||"File"}),m.size!=null&&jsxRuntime.jsx(Q,{label:"Size",value:tt(m.size)}),jsxRuntime.jsx(Q,{label:"Path",value:m.path,mono:true}),m.extension&&jsxRuntime.jsx(Q,{label:"Extension",value:m.extension}),m.modifiedAt&&jsxRuntime.jsx(Q,{label:"Modified",value:Ve(m.modifiedAt)}),m.createdAt&&jsxRuntime.jsx(Q,{label:"Created",value:Ve(m.createdAt)})]}),jsxRuntime.jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[m.type==="file"&&L&&jsxRuntime.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:()=>L(m),children:[jsxRuntime.jsx(lucideReact.ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),it?.map(e=>jsxRuntime.jsxs("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>e.onClick(m),children:[e.icon&&Qe__default.default.createElement(e.icon,{className:"h-3 w-3"}),e.label]},e.key))]})]})})]}),jsxRuntime.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:[jsxRuntime.jsxs("span",{children:[x.length," items"]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[b.size>0&&jsxRuntime.jsxs("span",{className:"text-(--fe-accent)/70",children:[b.size," selected"]}),jsxRuntime.jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),dt&&!c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:e=>D("n",e),onTouchStart:e=>C("n",e)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:e=>D("s",e),onTouchStart:e=>C("s",e)}),jsxRuntime.jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:e=>D("w",e),onTouchStart:e=>C("w",e)}),jsxRuntime.jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:e=>D("e",e),onTouchStart:e=>C("e",e)}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:e=>D("nw",e),onTouchStart:e=>C("nw",e)}),jsxRuntime.jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:e=>D("ne",e),onTouchStart:e=>C("ne",e)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:e=>D("sw",e),onTouchStart:e=>C("sw",e)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:e=>D("se",e),onTouchStart:e=>C("se",e)})]}),jsxRuntime.jsx("style",{children:`
2
2
  .fe-window {
3
3
  background: var(--fe-bg);
4
4
  box-shadow: var(--fe-shadow);
@@ -59,4 +59,4 @@
59
59
  from { opacity: 0; transform: translateX(-4px); }
60
60
  to { opacity: 1; transform: translateX(0); }
61
61
  }
62
- `}),jsxRuntime.jsx(Ye,{open:gt,onOpenChange:ce,children:jsxRuntime.jsxs(Ke,{size:"sm",children:[jsxRuntime.jsxs($e,{children:[jsxRuntime.jsxs(We,{children:[jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxRuntime.jsxs(qe,{children:[b.size===1?`Are you sure you want to delete "${x[Array.from(b)[0]]?.name}"?`:`Are you sure you want to delete ${b.size} selected items?`," ","This action cannot be undone."]})]}),jsxRuntime.jsxs(Ge,{children:[jsxRuntime.jsx(Me,{intent:"ghost",onClick:()=>ce(false),children:"Cancel"}),jsxRuntime.jsxs(Me,{intent:"danger",onClick:()=>{let e=Array.from(b).map(n=>x[n]).filter(Boolean);ue?.(e),P(new Set),ee(null),ce(false);},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function Q({label:t,value:o,mono:p}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:t}),jsxRuntime.jsx("div",{className:u("text-(--fe-text) break-all leading-snug",p&&"font-mono text-[9px]"),children:o})]})}exports.FileExplorer=Lr;
62
+ `}),jsxRuntime.jsx(Ye,{open:ft,onOpenChange:de,children:jsxRuntime.jsxs(Ke,{size:"sm",children:[jsxRuntime.jsxs($e,{children:[jsxRuntime.jsxs(We,{children:[jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxRuntime.jsxs(qe,{children:[b.size===1?`Are you sure you want to delete "${x[Array.from(b)[0]]?.name}"?`:`Are you sure you want to delete ${b.size} selected items?`," ","This action cannot be undone."]})]}),jsxRuntime.jsxs(Ge,{children:[jsxRuntime.jsx(Me,{intent:"ghost",onClick:()=>de(false),children:"Cancel"}),jsxRuntime.jsxs(Me,{intent:"danger",onClick:()=>{let e=Array.from(b).map(n=>x[n]).filter(Boolean);ue?.(e),P(new Set),ee(null),de(false);},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function Q({label:t,value:a,mono:p}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:t}),jsxRuntime.jsx("div",{className:u("text-(--fe-text) break-all leading-snug",p&&"font-mono text-[9px]"),children:a})]})}exports.FileExplorer=Rr;
@@ -1,4 +1,4 @@
1
- import Qe,{createContext,useState,useRef,useEffect,useMemo,useCallback,useId,useContext}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {createPortal}from'react-dom';import {HardDrive,LayoutGrid,LayoutList,Minus,Minimize2,Maximize2,X,FolderUp,Search,CornerRightDown,Folder,ArrowUp,AlertTriangle,Trash2,FileArchive,Database,FileSpreadsheet,FileText,Terminal,FileCode,Video,Music,Image,File}from'lucide-react';import {cva}from'class-variance-authority';import {jsx,jsxs,Fragment}from'react/jsx-runtime';function u(...t){return twMerge(clsx(t))}var ke=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 C=[];function St(t){C.push(t);}function Lt(t){let o=C.indexOf(t);o!==-1&&C.splice(o,1);}function ze(t){return C.length>0&&C[C.length-1]===t}function Vt(t){let o=C.indexOf(t);return o!==-1?o:C.length}var Xe=createContext(null);function Ye({open:t,onOpenChange:o,modal:p=true,closeOnOutsideClick:y=false,children:v}){let c=useId();return useEffect(()=>{if(t)return St(c),()=>Lt(c)},[t,c]),useEffect(()=>{if(!t||!p)return;let L=A=>{A.key==="Escape"&&ze(c)&&o(false);};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[t,p,o,c]),useEffect(()=>{if(!t||!p)return;let L=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=L;}},[t,p]),t?jsx(Xe.Provider,{value:{id:c,onOpenChange:o,modal:p,closeOnOutsideClick:y},children:createPortal(v,document.body)}):null}function Ke({size:t,position:o="center",className:p,children:y,...v}){let c=useContext(Xe);if(!c)return null;let A=200+Vt(c.id)*10,J=()=>{c.closeOnOutsideClick&&ze(c.id)&&c.onOpenChange(false);},V=o==="bottom";return c.modal?jsx("div",{className:u("animate-fade-in fixed inset-0 bg-black/50",V?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:A},onClick:J,children:jsx("div",{className:u(ke({size:t}),V?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",p),role:"dialog","aria-modal":"true",onClick:O=>O.stopPropagation(),...v,children:y})}):jsx("div",{className:u("fixed inset-0 flex items-center justify-center p-4",c.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:A},onClick:c.closeOnOutsideClick&&ze(c.id)?()=>c.onOpenChange(false):void 0,children:jsx("div",{className:u(ke({size:t}),"animate-scale-in pointer-events-auto shadow-2xl",p),role:"dialog",onClick:c.closeOnOutsideClick?O=>O.stopPropagation():void 0,...v,children:y})})}function $e({className:t,...o}){return jsx("div",{className:u("mb-4 space-y-1",t),...o})}function We({className:t,...o}){return jsx("h2",{className:u("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",t),...o})}function qe({className:t,...o}){return jsx("p",{className:u("text-primary-500 dark:text-primary-400 text-sm",t),...o})}function Ge({className:t,...o}){return jsx("div",{className:u("mt-6 flex justify-end gap-2",t),...o})}var Ue=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 Me({intent:t,size:o,className:p,...y}){return jsx("button",{className:u(Ue({intent:t,size:o}),p),...y})}function de(t){let o=t.lastIndexOf(".");return o>0?t.slice(o).toLowerCase():""}function tt(t){return t==null?"\u2014":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function Te(t){return t?(typeof t=="string"?new Date(t):t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var $t={".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 Se(t){if(t.type==="directory")return Folder;let o=t.extension||de(t.name);return $t[o]||File}function U(t,o,p){return Math.max(o,Math.min(p,t))}function rt(t){return t<480?"xs":t<640?"sm":t<1024?"md":"lg"}function nt(t,o){if(t<480)return {size:{width:t-16,height:o-48},pos:{x:8,y:24}};if(t<640){let v=t-24,c=Math.min(o-64,540);return {size:{width:v,height:c},pos:{x:12,y:32}}}if(t<1024){let v=Math.min(640,t-32),c=Math.min(480,o-64);return {size:{width:v,height:c},pos:{x:Math.max(0,Math.round((t-v)/2)),y:Math.max(0,Math.round((o-c)/2))}}}let p=720,y=520;return {size:{width:p,height:y},pos:{x:Math.max(0,Math.round((t-p)/2)),y:Math.max(0,Math.round((o-y)/2))}}}function Lr({files:t,title:o="File Explorer",accent:p="#8b5cf6",defaultView:y="list",initialPosition:v,initialSize:c,dockable:L=false,dockSide:A="right",visible:J=true,onFileOpen:V,onSelectionChange:O,onNavigate:ie,onDelete:ue,onClose:at,onMinimize:Le,onPathSubmit:Ve,defaultInputMode:st="search",actions:it,resizable:ct=true,minSize:Z={width:400,height:300},className:lt}){let[me,dt]=useState(y),[b,P]=useState(new Set),[Fe,ee]=useState(null),[l,pe]=useState(false),[te,fe]=useState(false),[F,ut]=useState(""),[R,mt]=useState(st),[pt,ft]=useState(J),[gt,ce]=useState(false),[B,bt]=useState({w:window.innerWidth,h:window.innerHeight}),Re=nt(window.innerWidth,window.innerHeight),[f,j]=useState(v??Re.pos),[k,le]=useState(c??Re.size),[z,xt]=useState(null),re=useRef(false),X$1=useRef({x:0,y:0}),ge=useRef(null),_=useRef(false),ne=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),oe=useRef(false),_e=useRef(l);useEffect(()=>{_e.current=l;},[l]);let be=J!==void 0?J:pt,xe=useMemo(()=>{let e=t.filter(a=>a.type==="directory"),n=t.filter(a=>a.type==="file");return e.sort((a,s)=>a.name.localeCompare(s.name)),n.sort((a,s)=>a.name.localeCompare(s.name)),[...e,...n]},[t]),x=useMemo(()=>{if(R!=="search"||!F.trim())return xe;let e=F.toLowerCase();return xe.filter(n=>n.name.toLowerCase().includes(e))},[xe,F,R]),m=Fe!=null?x[Fe]:null;useEffect(()=>{let e=rt(window.innerWidth),n=()=>{let a=window.innerWidth,s=window.innerHeight;if(bt({w:a,h:s}),_e.current)return;let d=rt(a);if(d!==e&&!oe.current&&!c){let w=nt(a,s);le(w.size),j(w.pos);}e=d;};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[c]);let Ie=useCallback((e,n)=>{P(a=>{let s=new Set(a);return n.ctrlKey||n.metaKey?s.has(e)?s.delete(e):s.add(e):(s.clear(),s.add(e)),s}),ee(e);},[]);useEffect(()=>{if(!O)return;let e=Array.from(b).map(n=>x[n]).filter(Boolean);O(e);},[b]);let He=useCallback(e=>{let n=x[e];n&&(n.type==="directory"?ie?.(n.path):V?.(n));},[x,V,ie]),ht=useCallback(e=>{l||e.target.closest("button")||(oe.current=true,re.current=true,X$1.current={x:e.clientX-f.x,y:e.clientY-f.y},e.preventDefault());},[f,l]),wt=useCallback(e=>{if(l||e.target.closest("button"))return;oe.current=true;let n=e.touches[0];re.current=true,X$1.current={x:n.clientX-f.x,y:n.clientY-f.y};},[f,l]);useEffect(()=>{let e=s=>{if(!re.current)return;let d=window.innerWidth-100,w=window.innerHeight-40;j({x:U(s.clientX-X$1.current.x,0,d),y:U(s.clientY-X$1.current.y,0,w)});},n=s=>{if(!re.current)return;s.preventDefault();let d=s.touches[0],w=window.innerWidth-100,I=window.innerHeight-40;j({x:U(d.clientX-X$1.current.x,0,w),y:U(d.clientY-X$1.current.y,0,I)});},a=()=>{re.current=false,_.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",a),window.addEventListener("touchmove",n,{passive:false}),window.addEventListener("touchend",a),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",a),window.removeEventListener("touchmove",n),window.removeEventListener("touchend",a);}},[]);let M=useCallback((e,n)=>{l||(n.preventDefault(),n.stopPropagation(),oe.current=true,_.current=e,ne.current={x:n.clientX,y:n.clientY,w:k.width,h:k.height,px:f.x,py:f.y},document.body.style.cursor=e==="e"||e==="w"?"ew-resize":e==="n"||e==="s"?"ns-resize":e==="nw"||e==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[l,k,f]),D=useCallback((e,n)=>{if(l)return;n.preventDefault(),n.stopPropagation(),oe.current=true;let a=n.touches[0];_.current=e,ne.current={x:a.clientX,y:a.clientY,w:k.width,h:k.height,px:f.x,py:f.y},document.body.style.userSelect="none";},[l,k,f]);useEffect(()=>{let e=(d,w)=>{let I=_.current;if(!I)return;let Pe=d-ne.current.x,Be=w-ne.current.y,{w:Y,h:K,px:ye,py:ve}=ne.current;if(I.includes("e")&&(Y=Math.max(Z.width,Y+Pe)),I.includes("w")){let ae=Math.max(Z.width,Y-Pe);ye=ye+(Y-ae),Y=ae;}if(I.includes("s")&&(K=Math.max(Z.height,K+Be)),I.includes("n")){let ae=Math.max(Z.height,K-Be);ve=ve+(K-ae),K=ae;}le({width:Y,height:K}),j({x:ye,y:ve});},n=d=>{_.current&&e(d.clientX,d.clientY);},a=d=>{_.current&&(d.preventDefault(),e(d.touches[0].clientX,d.touches[0].clientY));},s=()=>{_.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",n),window.addEventListener("mouseup",s),window.addEventListener("touchmove",a,{passive:false}),window.addEventListener("touchend",s),()=>{window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",s),window.removeEventListener("touchmove",a),window.removeEventListener("touchend",s);}},[Z]);let Ae=useCallback(()=>{l?(z&&(j(z.pos),le(z.size)),pe(false)):(xt({pos:f,size:k}),pe(true));},[l,f,k,z]),yt=useCallback(()=>{te?fe(false):(l&&(pe(false),z&&(j(z.pos),le(z.size))),fe(true),Le?.());},[te,l,z,Le]);useEffect(()=>{if(!be||te)return;let e=n=>{if(!(!ge.current?.contains(document.activeElement)&&document.activeElement!==ge.current)){if(n.key==="Escape"&&(ee(null),P(new Set)),n.ctrlKey&&n.key==="a"){n.preventDefault();let a=new Set(x.map((s,d)=>d));P(a);}n.key==="Delete"&&b.size>0&&ue&&(n.preventDefault(),ce(true));}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[be,te,x,b,ue]);let Oe={"--fe-accent":p};if(te)return jsx("div",{className:u("fixed z-100 cursor-pointer transition-all duration-300",A==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:Oe,onClick:()=>fe(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(!be)return null;let he=l?B.w:Math.min(k.width,B.w-8),vt=l?B.h:Math.min(k.height,B.h-8),kt=l?0:U(f.x,0,Math.max(0,B.w-he)),Nt=l?0:U(f.y,0,Math.max(0,B.h-40)),we=he<500;return jsxs("div",{ref:ge,className:u("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]",l&&"rounded-none",lt),style:{...Oe,left:kt,top:Nt,width:he,height:vt,transition:l?"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:ht,onTouchStart:wt,onDoubleClick:Ae,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:()=>dt(e=>e==="list"?"grid":"list"),title:me==="list"?"Grid view":"List view",children:me==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),L&&jsx("button",{className:"fe-btn",onClick:yt,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:Ae,title:l?"Restore":"Maximize",children:l?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:()=>{at?.(),ft(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:()=>ie?.(".."),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:R==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>mt(e=>e==="search"?"navigate":"search"),title:R==="search"?"Switch to path navigation":"Switch to file search",children:R==="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:F,onChange:e=>ut(e.target.value),onKeyDown:e=>{e.key==="Enter"&&F.trim()&&R==="navigate"&&(Ve?Ve(F.trim()):ie?.(F.trim()));},placeholder:R==="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:[x.length," item",x.length!==1?"s":"",b.size>0&&` \xB7 ${b.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:e=>{e.target===e.currentTarget&&(P(new Set),ee(null));},children:x.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"})]}):me==="list"?jsx("div",{className:"space-y-px",children:x.map((e,n)=>{let a=Se(e),s=b.has(n),d=e.extension||de(e.name);return jsxs("div",{className:u("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",s?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:s?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:w=>Ie(n,w),onDoubleClick:()=>He(n),children:[jsx(a,{className:u("h-4 w-4 shrink-0",e.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:e.name}),d&&e.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:d}),e.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:tt(e.size)}),e.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Te(e.modifiedAt)})]},e.path+n)})}):jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:x.map((e,n)=>{let a=Se(e),s=b.has(n),d=e.extension||de(e.name);return jsxs("div",{className:u("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",s?"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:w=>Ie(n,w),onDoubleClick:()=>He(n),children:[jsx(a,{className:u("h-7 w-7",e.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:e.name}),d&&e.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:d})]},e.path+n)})})}),jsx("div",{className:u("overflow-hidden transition-[width,opacity] duration-300 ease-out",we?u("absolute right-0 top-0 bottom-0 z-10",m?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):u("shrink-0",m?"w-56":"w-0")),children:m&&jsxs("div",{className:u("flex h-full flex-col p-4",we?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[we&&jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{ee(null),P(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:[Qe.createElement(Se(m),{className:u("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(Q,{label:"Type",value:m.type==="directory"?"Directory":m.mimeType||m.extension||de(m.name)||"File"}),m.size!=null&&jsx(Q,{label:"Size",value:tt(m.size)}),jsx(Q,{label:"Path",value:m.path,mono:true}),m.extension&&jsx(Q,{label:"Extension",value:m.extension}),m.modifiedAt&&jsx(Q,{label:"Modified",value:Te(m.modifiedAt)}),m.createdAt&&jsx(Q,{label:"Created",value:Te(m.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[m.type==="file"&&V&&jsxs("button",{className:"flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text-strong) transition-colors",style:{background:"color-mix(in srgb, var(--fe-accent) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--fe-accent) 30%, transparent)"},onClick:()=>V(m),children:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),it?.map(e=>jsxs("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>e.onClick(m),children:[e.icon&&Qe.createElement(e.icon,{className:"h-3 w-3"}),e.label]},e.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:[x.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[b.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[b.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),ct&&!l&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:e=>M("n",e),onTouchStart:e=>D("n",e)}),jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:e=>M("s",e),onTouchStart:e=>D("s",e)}),jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:e=>M("w",e),onTouchStart:e=>D("w",e)}),jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:e=>M("e",e),onTouchStart:e=>D("e",e)}),jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:e=>M("nw",e),onTouchStart:e=>D("nw",e)}),jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:e=>M("ne",e),onTouchStart:e=>D("ne",e)}),jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:e=>M("sw",e),onTouchStart:e=>D("sw",e)}),jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:e=>M("se",e),onTouchStart:e=>D("se",e)})]}),jsx("style",{children:`
1
+ import Qe,{createContext,useState,useRef,useEffect,useMemo,useCallback,useId,useContext}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {createPortal}from'react-dom';import {HardDrive,LayoutGrid,LayoutList,Minus,Minimize2,Maximize2,X,FolderUp,Search,CornerRightDown,Folder,ArrowUp,AlertTriangle,Trash2,FileArchive,Database,FileSpreadsheet,FileText,Terminal,FileCode,Video,Music,Image,File}from'lucide-react';import {cva}from'class-variance-authority';import {jsx,jsxs,Fragment}from'react/jsx-runtime';function u(...t){return twMerge(clsx(t))}var ke=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 E=[];function Tt(t){E.push(t);}function St(t){let a=E.indexOf(t);a!==-1&&E.splice(a,1);}function Ne(t){return E.length>0&&E[E.length-1]===t}function Lt(t){let a=E.indexOf(t);return a!==-1?a:E.length}var Xe=createContext(null);function Ye({open:t,onOpenChange:a,modal:p=true,closeOnOutsideClick:v=false,children:k}){let d=useId();return useEffect(()=>{if(t)return Tt(d),()=>St(d)},[t,d]),useEffect(()=>{if(!t||!p)return;let S=A=>{A.key==="Escape"&&Ne(d)&&a(false);};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[t,p,a,d]),useEffect(()=>{if(!t||!p)return;let S=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=S;}},[t,p]),t?jsx(Xe.Provider,{value:{id:d,onOpenChange:a,modal:p,closeOnOutsideClick:v},children:createPortal(k,document.body)}):null}function Ke({size:t,position:a="center",className:p,children:v,...k}){let d=useContext(Xe);if(!d)return null;let A=200+Lt(d.id)*10,J=()=>{d.closeOnOutsideClick&&Ne(d.id)&&d.onOpenChange(false);},L=a==="bottom";return d.modal?jsx("div",{className:u("animate-fade-in fixed inset-0 bg-black/50",L?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:A},onClick:J,children:jsx("div",{className:u(ke({size:t}),L?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",p),role:"dialog","aria-modal":"true",onClick:O=>O.stopPropagation(),...k,children:v})}):jsx("div",{className:u("fixed inset-0 flex items-center justify-center p-4",d.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:A},onClick:d.closeOnOutsideClick&&Ne(d.id)?()=>d.onOpenChange(false):void 0,children:jsx("div",{className:u(ke({size:t}),"animate-scale-in pointer-events-auto shadow-2xl",p),role:"dialog",onClick:d.closeOnOutsideClick?O=>O.stopPropagation():void 0,...k,children:v})})}function $e({className:t,...a}){return jsx("div",{className:u("mb-4 space-y-1",t),...a})}function We({className:t,...a}){return jsx("h2",{className:u("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",t),...a})}function qe({className:t,...a}){return jsx("p",{className:u("text-primary-500 dark:text-primary-400 text-sm",t),...a})}function Ge({className:t,...a}){return jsx("div",{className:u("mt-6 flex justify-end gap-2",t),...a})}var Ue=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"}});cva("bg-primary-200 text-primary-700 dark:bg-primary-700 dark:text-primary-200",{variants:{size:{xs:"h-6 w-6 text-[10px]",sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-12 w-12 text-base",xl:"h-16 w-16 text-lg"},shape:{circular:"rounded-full",rounded:"rounded-lg",square:"rounded-none"}},defaultVariants:{size:"md",shape:"circular"}});cva("relative flex w-full touch-none select-none items-center",{variants:{intent:{primary:"[&_.slider-fill]:bg-primary-500 [&_.slider-thumb]:border-primary-500",secondary:"[&_.slider-fill]:bg-secondary-500 [&_.slider-thumb]:border-secondary-500",success:"[&_.slider-fill]:bg-success-500 [&_.slider-thumb]:border-success-500",danger:"[&_.slider-fill]:bg-danger-500 [&_.slider-thumb]:border-danger-500",warning:"[&_.slider-fill]:bg-warning-500 [&_.slider-thumb]:border-warning-500"},size:{sm:"h-4",md:"h-5",lg:"h-6"}},defaultVariants:{intent:"primary",size:"md"}});cva("inline-flex items-center gap-1 rounded-full font-medium select-none transition-colors [&_svg]:shrink-0",{variants:{intent:{primary:"bg-primary-100 text-primary-700 dark:bg-primary-800 dark:text-primary-200",secondary:"bg-secondary-100 text-secondary-700 dark:bg-secondary-800 dark:text-secondary-200",success:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",danger:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",warning:"bg-warning-100 text-warning-700 dark:bg-warning-900/40 dark:text-warning-300",info:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"},size:{sm:"h-5 px-2 text-[0.6875rem] gap-0.5",md:"h-6 px-2.5 text-xs gap-1",lg:"h-7 px-3 text-sm gap-1"},variant:{solid:"",outline:"bg-transparent border",soft:""}},compoundVariants:[{intent:"primary",variant:"outline",class:"border-primary-300 text-primary-700 dark:border-primary-600 dark:text-primary-300"},{intent:"secondary",variant:"outline",class:"border-secondary-300 text-secondary-700 dark:border-secondary-600 dark:text-secondary-300"},{intent:"success",variant:"outline",class:"border-success-400 text-success-700 dark:border-success-600 dark:text-success-300"},{intent:"danger",variant:"outline",class:"border-danger-400 text-danger-700 dark:border-danger-600 dark:text-danger-300"},{intent:"warning",variant:"outline",class:"border-warning-400 text-warning-700 dark:border-warning-600 dark:text-warning-300"},{intent:"info",variant:"outline",class:"border-blue-400 text-blue-700 dark:border-blue-600 dark:text-blue-300"}],defaultVariants:{intent:"primary",size:"md",variant:"solid"}});cva("relative w-full cursor-pointer rounded-md border bg-white text-sm transition-colors dark:bg-primary-900",{variants:{intent:{default:"border-primary-300 text-primary-900 hover:border-primary-400 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-primary-600 dark:text-primary-100 dark:hover:border-primary-500 dark:focus-within:border-primary-400",danger:"border-danger-500 text-primary-900 focus-within:ring-2 focus-within:ring-danger-500/20 dark:border-danger-500 dark:text-primary-100"},size:{sm:"h-7 px-2 text-xs",md:"h-9 px-3 text-sm",lg:"h-11 px-4 text-base"}},defaultVariants:{intent:"default",size:"md"}});function Me({intent:t,size:a,className:p,...v}){return jsx("button",{className:u(Ue({intent:t,size:a}),p),...v})}function le(t){let a=t.lastIndexOf(".");return a>0?t.slice(a).toLowerCase():""}function tt(t){return t==null?"\u2014":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function Ve(t){return t?(typeof t=="string"?new Date(t):t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var $t={".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 Te(t){if(t.type==="directory")return Folder;let a=t.extension||le(t.name);return $t[a]||File}function U(t,a,p){return Math.max(a,Math.min(p,t))}function rt(t){return t<480?"xs":t<640?"sm":t<1024?"md":"lg"}function nt(t,a){if(t<480)return {size:{width:t-16,height:a-48},pos:{x:8,y:24}};if(t<640){let k=t-24,d=Math.min(a-64,540);return {size:{width:k,height:d},pos:{x:12,y:32}}}if(t<1024){let k=Math.min(640,t-32),d=Math.min(480,a-64);return {size:{width:k,height:d},pos:{x:Math.max(0,Math.round((t-k)/2)),y:Math.max(0,Math.round((a-d)/2))}}}let p=720,v=520;return {size:{width:p,height:v},pos:{x:Math.max(0,Math.round((t-p)/2)),y:Math.max(0,Math.round((a-v)/2))}}}function Rr({files:t,title:a="File Explorer",accent:p="#8b5cf6",defaultView:v="list",initialPosition:k,initialSize:d,dockable:S=false,dockSide:A="right",visible:J=true,onFileOpen:L,onSelectionChange:O,onNavigate:ie,onDelete:ue,onClose:st,onMinimize:Se,onPathSubmit:Le,defaultInputMode:ot="search",actions:it,resizable:dt=true,minSize:Z={width:400,height:300},className:ct}){let[me,lt]=useState(v),[b,P]=useState(new Set),[_e,ee]=useState(null),[c,pe]=useState(false),[te,ge]=useState(false),[_,ut]=useState(""),[F,mt]=useState(ot),[pt,gt]=useState(J),[ft,de]=useState(false),[B,bt]=useState({w:window.innerWidth,h:window.innerHeight}),Fe=nt(window.innerWidth,window.innerHeight),[g,j]=useState(k??Fe.pos),[z,ce]=useState(d??Fe.size),[M,xt]=useState(null),re=useRef(false),X$1=useRef({x:0,y:0}),fe=useRef(null),R=useRef(false),ne=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),ae=useRef(false),Re=useRef(c);useEffect(()=>{Re.current=c;},[c]);let be=J!==void 0?J:pt,xe=useMemo(()=>{let e=t.filter(s=>s.type==="directory"),n=t.filter(s=>s.type==="file");return e.sort((s,o)=>s.name.localeCompare(o.name)),n.sort((s,o)=>s.name.localeCompare(o.name)),[...e,...n]},[t]),x=useMemo(()=>{if(F!=="search"||!_.trim())return xe;let e=_.toLowerCase();return xe.filter(n=>n.name.toLowerCase().includes(e))},[xe,_,F]),m=_e!=null?x[_e]:null;useEffect(()=>{let e=rt(window.innerWidth),n=()=>{let s=window.innerWidth,o=window.innerHeight;if(bt({w:s,h:o}),Re.current)return;let l=rt(s);if(l!==e&&!ae.current&&!d){let y=nt(s,o);ce(y.size),j(y.pos);}e=l;};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[d]);let Ie=useCallback((e,n)=>{P(s=>{let o=new Set(s);return n.ctrlKey||n.metaKey?o.has(e)?o.delete(e):o.add(e):(o.clear(),o.add(e)),o}),ee(e);},[]);useEffect(()=>{if(!O)return;let e=Array.from(b).map(n=>x[n]).filter(Boolean);O(e);},[b]);let He=useCallback(e=>{let n=x[e];n&&(n.type==="directory"?ie?.(n.path):L?.(n));},[x,L,ie]),ht=useCallback(e=>{c||e.target.closest("button")||(ae.current=true,re.current=true,X$1.current={x:e.clientX-g.x,y:e.clientY-g.y},e.preventDefault());},[g,c]),yt=useCallback(e=>{if(c||e.target.closest("button"))return;ae.current=true;let n=e.touches[0];re.current=true,X$1.current={x:n.clientX-g.x,y:n.clientY-g.y};},[g,c]);useEffect(()=>{let e=o=>{if(!re.current)return;let l=window.innerWidth-100,y=window.innerHeight-40;j({x:U(o.clientX-X$1.current.x,0,l),y:U(o.clientY-X$1.current.y,0,y)});},n=o=>{if(!re.current)return;o.preventDefault();let l=o.touches[0],y=window.innerWidth-100,I=window.innerHeight-40;j({x:U(l.clientX-X$1.current.x,0,y),y:U(l.clientY-X$1.current.y,0,I)});},s=()=>{re.current=false,R.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",e),window.addEventListener("mouseup",s),window.addEventListener("touchmove",n,{passive:false}),window.addEventListener("touchend",s),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",s),window.removeEventListener("touchmove",n),window.removeEventListener("touchend",s);}},[]);let D=useCallback((e,n)=>{c||(n.preventDefault(),n.stopPropagation(),ae.current=true,R.current=e,ne.current={x:n.clientX,y:n.clientY,w:z.width,h:z.height,px:g.x,py:g.y},document.body.style.cursor=e==="e"||e==="w"?"ew-resize":e==="n"||e==="s"?"ns-resize":e==="nw"||e==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[c,z,g]),C=useCallback((e,n)=>{if(c)return;n.preventDefault(),n.stopPropagation(),ae.current=true;let s=n.touches[0];R.current=e,ne.current={x:s.clientX,y:s.clientY,w:z.width,h:z.height,px:g.x,py:g.y},document.body.style.userSelect="none";},[c,z,g]);useEffect(()=>{let e=(l,y)=>{let I=R.current;if(!I)return;let Pe=l-ne.current.x,Be=y-ne.current.y,{w:Y,h:K,px:we,py:ve}=ne.current;if(I.includes("e")&&(Y=Math.max(Z.width,Y+Pe)),I.includes("w")){let se=Math.max(Z.width,Y-Pe);we=we+(Y-se),Y=se;}if(I.includes("s")&&(K=Math.max(Z.height,K+Be)),I.includes("n")){let se=Math.max(Z.height,K-Be);ve=ve+(K-se),K=se;}ce({width:Y,height:K}),j({x:we,y:ve});},n=l=>{R.current&&e(l.clientX,l.clientY);},s=l=>{R.current&&(l.preventDefault(),e(l.touches[0].clientX,l.touches[0].clientY));},o=()=>{R.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",n),window.addEventListener("mouseup",o),window.addEventListener("touchmove",s,{passive:false}),window.addEventListener("touchend",o),()=>{window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",o),window.removeEventListener("touchmove",s),window.removeEventListener("touchend",o);}},[Z]);let Ae=useCallback(()=>{c?(M&&(j(M.pos),ce(M.size)),pe(false)):(xt({pos:g,size:z}),pe(true));},[c,g,z,M]),wt=useCallback(()=>{te?ge(false):(c&&(pe(false),M&&(j(M.pos),ce(M.size))),ge(true),Se?.());},[te,c,M,Se]);useEffect(()=>{if(!be||te)return;let e=n=>{if(!(!fe.current?.contains(document.activeElement)&&document.activeElement!==fe.current)){if(n.key==="Escape"&&(ee(null),P(new Set)),n.ctrlKey&&n.key==="a"){n.preventDefault();let s=new Set(x.map((o,l)=>l));P(s);}n.key==="Delete"&&b.size>0&&ue&&(n.preventDefault(),de(true));}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[be,te,x,b,ue]);let Oe={"--fe-accent":p};if(te)return jsx("div",{className:u("fixed z-100 cursor-pointer transition-all duration-300",A==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:Oe,onClick:()=>ge(false),title:`Restore ${a}`,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:a})]})});if(!be)return null;let he=c?B.w:Math.min(z.width,B.w-8),vt=c?B.h:Math.min(z.height,B.h-8),kt=c?0:U(g.x,0,Math.max(0,B.w-he)),zt=c?0:U(g.y,0,Math.max(0,B.h-40)),ye=he<500;return jsxs("div",{ref:fe,className:u("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]",c&&"rounded-none",ct),style:{...Oe,left:kt,top:zt,width:he,height:vt,transition:c?"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:ht,onTouchStart:yt,onDoubleClick:Ae,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:a}),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:()=>lt(e=>e==="list"?"grid":"list"),title:me==="list"?"Grid view":"List view",children:me==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),S&&jsx("button",{className:"fe-btn",onClick:wt,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:Ae,title:c?"Restore":"Maximize",children:c?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:()=>{st?.(),gt(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:()=>ie?.(".."),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:F==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>mt(e=>e==="search"?"navigate":"search"),title:F==="search"?"Switch to path navigation":"Switch to file search",children:F==="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:_,onChange:e=>ut(e.target.value),onKeyDown:e=>{e.key==="Enter"&&_.trim()&&F==="navigate"&&(Le?Le(_.trim()):ie?.(_.trim()));},placeholder:F==="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:[x.length," item",x.length!==1?"s":"",b.size>0&&` \xB7 ${b.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:e=>{e.target===e.currentTarget&&(P(new Set),ee(null));},children:x.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"})]}):me==="list"?jsx("div",{className:"space-y-px",children:x.map((e,n)=>{let s=Te(e),o=b.has(n),l=e.extension||le(e.name);return jsxs("div",{className:u("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:y=>Ie(n,y),onDoubleClick:()=>He(n),children:[jsx(s,{className:u("h-4 w-4 shrink-0",e.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:e.name}),l&&e.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:l}),e.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:tt(e.size)}),e.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Ve(e.modifiedAt)})]},e.path+n)})}):jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:x.map((e,n)=>{let s=Te(e),o=b.has(n),l=e.extension||le(e.name);return jsxs("div",{className:u("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:y=>Ie(n,y),onDoubleClick:()=>He(n),children:[jsx(s,{className:u("h-7 w-7",e.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:e.name}),l&&e.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:l})]},e.path+n)})})}),jsx("div",{className:u("overflow-hidden transition-[width,opacity] duration-300 ease-out",ye?u("absolute right-0 top-0 bottom-0 z-10",m?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):u("shrink-0",m?"w-56":"w-0")),children:m&&jsxs("div",{className:u("flex h-full flex-col p-4",ye?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[ye&&jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{ee(null),P(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:[Qe.createElement(Te(m),{className:u("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(Q,{label:"Type",value:m.type==="directory"?"Directory":m.mimeType||m.extension||le(m.name)||"File"}),m.size!=null&&jsx(Q,{label:"Size",value:tt(m.size)}),jsx(Q,{label:"Path",value:m.path,mono:true}),m.extension&&jsx(Q,{label:"Extension",value:m.extension}),m.modifiedAt&&jsx(Q,{label:"Modified",value:Ve(m.modifiedAt)}),m.createdAt&&jsx(Q,{label:"Created",value:Ve(m.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[m.type==="file"&&L&&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:()=>L(m),children:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),it?.map(e=>jsxs("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>e.onClick(m),children:[e.icon&&Qe.createElement(e.icon,{className:"h-3 w-3"}),e.label]},e.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:[x.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[b.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[b.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),dt&&!c&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:e=>D("n",e),onTouchStart:e=>C("n",e)}),jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:e=>D("s",e),onTouchStart:e=>C("s",e)}),jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:e=>D("w",e),onTouchStart:e=>C("w",e)}),jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:e=>D("e",e),onTouchStart:e=>C("e",e)}),jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:e=>D("nw",e),onTouchStart:e=>C("nw",e)}),jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:e=>D("ne",e),onTouchStart:e=>C("ne",e)}),jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:e=>D("sw",e),onTouchStart:e=>C("sw",e)}),jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:e=>D("se",e),onTouchStart:e=>C("se",e)})]}),jsx("style",{children:`
2
2
  .fe-window {
3
3
  background: var(--fe-bg);
4
4
  box-shadow: var(--fe-shadow);
@@ -59,4 +59,4 @@ import Qe,{createContext,useState,useRef,useEffect,useMemo,useCallback,useId,use
59
59
  from { opacity: 0; transform: translateX(-4px); }
60
60
  to { opacity: 1; transform: translateX(0); }
61
61
  }
62
- `}),jsx(Ye,{open:gt,onOpenChange:ce,children:jsxs(Ke,{size:"sm",children:[jsxs($e,{children:[jsxs(We,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxs(qe,{children:[b.size===1?`Are you sure you want to delete "${x[Array.from(b)[0]]?.name}"?`:`Are you sure you want to delete ${b.size} selected items?`," ","This action cannot be undone."]})]}),jsxs(Ge,{children:[jsx(Me,{intent:"ghost",onClick:()=>ce(false),children:"Cancel"}),jsxs(Me,{intent:"danger",onClick:()=>{let e=Array.from(b).map(n=>x[n]).filter(Boolean);ue?.(e),P(new Set),ee(null),ce(false);},children:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function Q({label:t,value:o,mono:p}){return jsxs("div",{children:[jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:t}),jsx("div",{className:u("text-(--fe-text) break-all leading-snug",p&&"font-mono text-[9px]"),children:o})]})}export{Lr as FileExplorer};
62
+ `}),jsx(Ye,{open:ft,onOpenChange:de,children:jsxs(Ke,{size:"sm",children:[jsxs($e,{children:[jsxs(We,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxs(qe,{children:[b.size===1?`Are you sure you want to delete "${x[Array.from(b)[0]]?.name}"?`:`Are you sure you want to delete ${b.size} selected items?`," ","This action cannot be undone."]})]}),jsxs(Ge,{children:[jsx(Me,{intent:"ghost",onClick:()=>de(false),children:"Cancel"}),jsxs(Me,{intent:"danger",onClick:()=>{let e=Array.from(b).map(n=>x[n]).filter(Boolean);ue?.(e),P(new Set),ee(null),de(false);},children:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function Q({label:t,value:a,mono:p}){return jsxs("div",{children:[jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:t}),jsx("div",{className:u("text-(--fe-text) break-all leading-snug",p&&"font-mono text-[9px]"),children:a})]})}export{Rr as FileExplorer};
@@ -0,0 +1 @@
1
+ 'use strict';var react=require('react'),lucideReact=require('lucide-react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime');function c(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var N={complete:"bg-success-500 border-success-500 text-white dark:bg-success-600 dark:border-success-600",active:"bg-primary-500 border-primary-500 text-white dark:bg-primary-400 dark:border-primary-400",error:"bg-danger-500 border-danger-500 text-white dark:bg-danger-600 dark:border-danger-600",pending:"bg-white border-primary-300 text-secondary-400 dark:bg-primary-800 dark:border-primary-600"},_={complete:"shadow-[0_0_0_4px_theme(colors.success.100)] dark:shadow-[0_0_0_4px_theme(colors.success.900/30)]",active:"shadow-[0_0_0_4px_theme(colors.primary.100)] dark:shadow-[0_0_0_4px_theme(colors.primary.800/50)] animate-pulse",error:"shadow-[0_0_0_4px_theme(colors.danger.100)] dark:shadow-[0_0_0_4px_theme(colors.danger.900/30)]",pending:""};function T({status:e,icon:l}){return l?jsxRuntime.jsx(jsxRuntime.Fragment,{children:l}):e==="complete"?jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"}):e==="error"?jsxRuntime.jsx(lucideReact.AlertCircle,{className:"h-3 w-3"}):e==="active"?jsxRuntime.jsx(lucideReact.Dot,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Clock,{className:"h-3 w-3"})}function S({images:e,title:l}){let t=e.slice(0,4),g=e.length>4?e.length-4:0,m=(o,a,d)=>jsxRuntime.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:c("relative block overflow-hidden",d),onClick:u=>u.stopPropagation(),children:[jsxRuntime.jsx("img",{src:o,alt:`${l} ${a+1}`,className:"h-full w-full object-cover transition-transform duration-300 hover:scale-105"}),a===t.length-1&&g>0&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/60",children:jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white",children:["+",g]})})]},a);return t.length===0?null:t.length===1?jsxRuntime.jsx("div",{className:"mt-2.5 h-36 overflow-hidden rounded-xl",children:m(t[0],0,"h-full")}):t.length===2?jsxRuntime.jsx("div",{className:"mt-2.5 grid h-28 grid-cols-2 gap-0.5 overflow-hidden rounded-xl",children:t.map((o,a)=>m(o,a))}):t.length===3?jsxRuntime.jsxs("div",{className:"mt-2.5 grid h-36 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:[m(t[0],0,"row-span-2"),m(t[1],1),m(t[2],2)]}):jsxRuntime.jsx("div",{className:"mt-2.5 grid h-44 grid-cols-2 grid-rows-2 gap-0.5 overflow-hidden rounded-xl",children:t.map((o,a)=>m(o,a))})}function C({actions:e}){let l=e.filter(a=>a.variant!=="primary"),t=e.filter(a=>a.variant==="primary"),g="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 text-xs font-medium text-secondary-500 transition-colors hover:bg-secondary-100/80 hover:text-secondary-700 dark:text-secondary-400 dark:hover:bg-primary-800/60 dark:hover:text-secondary-200",m="inline-flex items-center gap-1.5 rounded-lg border border-primary-200/70 bg-primary-50/80 px-3 py-1 text-xs font-semibold text-primary-700 transition-colors hover:bg-primary-100 dark:border-primary-600/60 dark:bg-primary-800/60 dark:text-primary-300 dark:hover:bg-primary-700/60",o=(a,d,u)=>a.href?jsxRuntime.jsxs("a",{href:a.href,target:"_blank",rel:"noopener noreferrer",className:u,onClick:v=>v.stopPropagation(),children:[a.icon,a.label]},d):jsxRuntime.jsxs("button",{type:"button",onClick:a.onClick,className:u,children:[a.icon,a.label]},d);return jsxRuntime.jsxs("div",{className:"mt-3 flex items-center gap-1 border-t border-primary-100/50 pt-2.5 dark:border-primary-700/40",children:[l.map((a,d)=>o(a,d,g)),t.length>0&&jsxRuntime.jsx("span",{className:"flex-1"}),t.map((a,d)=>o(a,d,m))]})}function A({item:e,isActive:l,animated:t,visible:g,orientation:m}){let o=e.status??"pending",a={complete:"bg-gradient-to-br from-white to-success-50/40 dark:from-primary-900 dark:to-success-900/10",active:"bg-gradient-to-br from-white to-primary-50/60 dark:from-primary-900 dark:to-primary-800/40",error:"bg-gradient-to-br from-white to-danger-50/40 dark:from-primary-900 dark:to-danger-900/10",pending:"bg-white dark:bg-primary-900"}[o],d={complete:"border-success-200/70 dark:border-success-800/50",active:"border-primary-300/80 dark:border-primary-600/70",error:"border-danger-200/70 dark:border-danger-800/50",pending:"border-primary-200/60 dark:border-primary-700/50"}[o],u=l?"shadow-lg shadow-primary-300/30 dark:shadow-primary-500/20":o==="complete"?"shadow-md shadow-success-300/20 dark:shadow-success-400/10":o==="error"?"shadow-md shadow-danger-300/20 dark:shadow-danger-400/10":"shadow-sm shadow-primary-100/50 dark:shadow-black/20",v=o==="complete"?"conic-gradient(from 30deg, transparent 0%, var(--tl-glow-complete-1) 18%, var(--tl-glow-complete-2) 30%, var(--tl-holo-cyan) 44%, transparent 60%)":o==="error"?"conic-gradient(from 150deg, transparent 0%, var(--tl-glow-error-1) 18%, var(--tl-glow-error-2) 32%, var(--tl-glow-error-3) 44%, transparent 58%)":null,f={complete:"bg-success-100 text-success-700 dark:bg-success-900/40 dark:text-success-300",active:"bg-primary-100 text-primary-700 dark:bg-primary-800/60 dark:text-primary-300",error:"bg-danger-100 text-danger-700 dark:bg-danger-900/40 dark:text-danger-300",pending:"bg-secondary-100 text-secondary-600 dark:bg-primary-800/50 dark:text-secondary-400"}[o];return jsxRuntime.jsxs("div",{className:c("relative isolate",t&&"transition-all duration-700",t?g?"opacity-100 translate-y-0":m==="vertical"?"opacity-0 translate-y-6":"opacity-0 translate-x-6":"",m==="horizontal"?"w-56 shrink-0":"flex-1",e.className),children:[!l&&v&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute animate-[tl-glow-pulse_5s_ease-in-out_infinite]",style:{inset:"-6px",borderRadius:"1.5rem",zIndex:-1,background:v,filter:"blur(14px)",opacity:.22},"aria-hidden":true}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute",style:{inset:"-7px",borderRadius:"1.5rem",zIndex:-1,background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, var(--tl-holo-base) 0%, var(--tl-holo-indigo) 18%, var(--tl-holo-violet) 30%, var(--tl-holo-cyan) 45%, var(--tl-holo-mid) 62%, var(--tl-holo-base) 100%)",filter:"blur(10px)",animation:"tl-breathe 2.8s ease-in-out infinite, tl-holo-spin 9s linear infinite"},"aria-hidden":true}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute",style:{inset:"-1.5px",borderRadius:"1.0625rem",zIndex:-1,padding:"1.5px",background:"conic-gradient(from var(--tl-angle, 0deg) at 50% 50%, transparent 0deg, var(--tl-holo-indigo) 55deg, var(--tl-holo-violet) 85deg, var(--tl-holo-cyan) 115deg, transparent 175deg, transparent 360deg)",WebkitMask:"linear-gradient(white 0 0) content-box, linear-gradient(white 0 0)",WebkitMaskComposite:"xor",maskComposite:"exclude",animation:"tl-holo-spin 5s linear infinite"},"aria-hidden":true})]}),jsxRuntime.jsx("div",{className:c("relative overflow-hidden rounded-2xl border backdrop-blur-[2px]",l?"border-transparent":c("border",d),a,u),children:e.imagePosition==="left"&&e.image?jsxRuntime.jsxs("div",{className:"flex min-h-[8rem]",children:[jsxRuntime.jsx("a",{href:e.image,target:"_blank",rel:"noopener noreferrer",className:"w-28 shrink-0 overflow-hidden",onClick:i=>i.stopPropagation(),"aria-label":e.title,children:jsxRuntime.jsx("img",{src:e.image,alt:e.title,className:"h-full w-full object-cover transition-transform duration-500 hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[e.date&&jsxRuntime.jsx("span",{className:c("mb-2 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",f),children:e.date}),jsxRuntime.jsx("h3",{className:c("text-sm font-semibold leading-snug",l?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsxRuntime.jsx(S,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsxRuntime.jsx(C,{actions:e.actions})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e.image&&jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("img",{src:e.image,alt:e.title,className:"h-32 w-full object-cover transition-transform duration-500 hover:scale-105"})}),e.svg&&!e.image&&jsxRuntime.jsx("div",{className:"flex items-center justify-center bg-primary-50/60 p-4 dark:bg-primary-800/40",children:e.svg}),jsxRuntime.jsxs("div",{className:c("p-4",(e.image||e.svg)&&"pt-3"),children:[e.date&&jsxRuntime.jsx("span",{className:c("mb-2.5 inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[0.65rem] font-semibold tracking-wide",f),children:e.date}),jsxRuntime.jsx("h3",{className:c("text-sm font-semibold leading-snug",l?"text-primary-900 dark:text-white":"text-primary-800 dark:text-primary-100"),children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"mt-1 text-xs leading-relaxed text-secondary-500 dark:text-secondary-400",children:e.description}),e.images&&e.images.length>0&&jsxRuntime.jsx(S,{images:e.images,title:e.title}),e.actions&&e.actions.length>0&&jsxRuntime.jsx(C,{actions:e.actions})]})]})})]})}function q({items:e,orientation:l="vertical",activeIndex:t,animated:g=true,lineStyle:m="solid",className:o}){let a=react.useRef(null),d=react.useRef([]),[u,v]=react.useState(new Set);react.useEffect(()=>{if(!g){v(new Set(e.map((i,p)=>p)));return}let n=new IntersectionObserver(i=>{v(p=>{let h=new Set(p);return i.forEach(b=>{let y=Number(b.target.dataset.idx);b.isIntersecting&&h.add(y);}),h});},{threshold:.15});return d.current.forEach(i=>i&&n.observe(i)),()=>n.disconnect()},[e,g]),react.useEffect(()=>{if(t==null)return;let n=d.current[t];n&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[t]);let f=m==="dashed"?"border-dashed":"";return l==="vertical"?jsxRuntime.jsxs("div",{ref:a,className:c("relative",o),children:[jsxRuntime.jsx("div",{className:"absolute left-5 top-0 h-full w-px bg-primary-200 dark:bg-primary-700"}),jsxRuntime.jsx("div",{className:"space-y-6",children:e.map((n,i)=>{let p=n.status??"pending",h=i===t;return jsxRuntime.jsxs("div",{ref:b=>{d.current[i]=b;},"data-idx":i,className:"relative flex gap-4",children:[jsxRuntime.jsx("div",{className:"relative z-10 flex shrink-0 flex-col items-center",children:jsxRuntime.jsx("div",{className:c("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 [&_svg]:shrink-0",N[p],h&&_[p]),children:jsxRuntime.jsx(T,{status:p,icon:n.icon})})}),jsxRuntime.jsx(A,{item:n,isActive:h,animated:g,visible:u.has(i),orientation:"vertical"})]},n.id??i)})})]}):jsxRuntime.jsx("div",{ref:a,className:c("relative overflow-x-auto pb-4",o),children:jsxRuntime.jsx("div",{className:"flex min-w-max gap-6 px-4",children:e.map((n,i)=>{let p=n.status??"pending",h=i===t,b=i===e.length-1;return jsxRuntime.jsxs("div",{ref:y=>{d.current[i]=y;},"data-idx":i,className:"relative flex flex-col items-center gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:c("flex h-10 w-10 items-center justify-center rounded-full border-2 transition-all duration-300 z-10 [&_svg]:shrink-0",N[p],h&&_[p]),children:jsxRuntime.jsx(T,{status:p,icon:n.icon})}),!b&&jsxRuntime.jsx("div",{className:c("h-px w-28 border-t-2",f,p==="complete"?"border-success-400":"border-primary-200 dark:border-primary-700")})]}),jsxRuntime.jsx(A,{item:n,isActive:h,animated:g,visible:u.has(i),orientation:"horizontal"})]},n.id??i)})})})}exports.Timeline=q;