@jacshuo/onyx 2.2.0 → 2.4.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 (135) hide show
  1. package/dist/Chart/BarChart.cjs +1 -1
  2. package/dist/Chart/BarChart.js +1 -1
  3. package/dist/Chart/PieChart.cjs +1 -1
  4. package/dist/Chart/PieChart.js +1 -1
  5. package/dist/Chart/ScatterChart.cjs +1 -1
  6. package/dist/Chart/ScatterChart.js +1 -1
  7. package/dist/Chart/index.cjs +1 -1
  8. package/dist/Chart/index.js +1 -1
  9. package/dist/DataDisplay/VirtualList.cjs +2 -0
  10. package/dist/DataDisplay/VirtualList.css +1 -0
  11. package/dist/DataDisplay/VirtualList.d.cts +5 -0
  12. package/dist/DataDisplay/VirtualList.d.ts +5 -0
  13. package/dist/DataDisplay/VirtualList.js +2 -0
  14. package/dist/DataDisplay/index.cjs +3 -2
  15. package/dist/DataDisplay/index.css +1 -0
  16. package/dist/DataDisplay/index.d.cts +5 -0
  17. package/dist/DataDisplay/index.d.ts +5 -0
  18. package/dist/DataDisplay/index.js +3 -2
  19. package/dist/Extras/FileExplorer.cjs +2 -2
  20. package/dist/Extras/FileExplorer.js +2 -2
  21. package/dist/Extras/LoginPanel.cjs +1 -0
  22. package/dist/Extras/LoginPanel.css +1 -0
  23. package/dist/Extras/LoginPanel.d.cts +3 -0
  24. package/dist/Extras/LoginPanel.d.ts +3 -0
  25. package/dist/Extras/LoginPanel.js +1 -0
  26. package/dist/Extras/RichTextEditor.cjs +45 -0
  27. package/dist/Extras/RichTextEditor.css +1 -0
  28. package/dist/Extras/RichTextEditor.d.cts +10 -0
  29. package/dist/Extras/RichTextEditor.d.ts +10 -0
  30. package/dist/Extras/RichTextEditor.js +45 -0
  31. package/dist/Extras/TypewriterText.cjs +2 -1
  32. package/dist/Extras/TypewriterText.css +1 -1
  33. package/dist/Extras/TypewriterText.js +2 -1
  34. package/dist/Extras/index.cjs +48 -4
  35. package/dist/Extras/index.css +1 -1
  36. package/dist/Extras/index.d.cts +7 -0
  37. package/dist/Extras/index.d.ts +7 -0
  38. package/dist/Extras/index.js +48 -4
  39. package/dist/Forms/Form.cjs +1 -1
  40. package/dist/Forms/Form.js +1 -1
  41. package/dist/Forms/OTPInput.cjs +1 -0
  42. package/dist/Forms/OTPInput.css +1 -0
  43. package/dist/Forms/OTPInput.d.cts +4 -0
  44. package/dist/Forms/OTPInput.d.ts +4 -0
  45. package/dist/Forms/OTPInput.js +1 -0
  46. package/dist/Forms/Select.cjs +1 -1
  47. package/dist/Forms/Select.js +1 -1
  48. package/dist/Forms/index.cjs +1 -1
  49. package/dist/Forms/index.css +1 -0
  50. package/dist/Forms/index.d.cts +4 -0
  51. package/dist/Forms/index.d.ts +4 -0
  52. package/dist/Forms/index.js +1 -1
  53. package/dist/Layout/SplitPanel.cjs +1 -0
  54. package/dist/Layout/SplitPanel.d.cts +3 -0
  55. package/dist/Layout/SplitPanel.d.ts +3 -0
  56. package/dist/Layout/SplitPanel.js +1 -0
  57. package/dist/Layout/index.cjs +1 -1
  58. package/dist/Layout/index.d.cts +3 -0
  59. package/dist/Layout/index.d.ts +3 -0
  60. package/dist/Layout/index.js +1 -1
  61. package/dist/Navigation/Header.cjs +1 -1
  62. package/dist/Navigation/Header.js +1 -1
  63. package/dist/Navigation/RibbonBar.d.cts +3 -3
  64. package/dist/Navigation/RibbonBar.d.ts +3 -3
  65. package/dist/Navigation/index.cjs +2 -2
  66. package/dist/Navigation/index.d.cts +3 -3
  67. package/dist/Navigation/index.d.ts +3 -3
  68. package/dist/Navigation/index.js +2 -2
  69. package/dist/Primitives/Avatar.cjs +1 -1
  70. package/dist/Primitives/Avatar.js +1 -1
  71. package/dist/Primitives/Badge.cjs +1 -1
  72. package/dist/Primitives/Badge.js +1 -1
  73. package/dist/Primitives/Button.cjs +1 -1
  74. package/dist/Primitives/Button.js +1 -1
  75. package/dist/Primitives/Checkbox.cjs +1 -1
  76. package/dist/Primitives/Checkbox.js +1 -1
  77. package/dist/Primitives/Dropdown.cjs +1 -1
  78. package/dist/Primitives/Dropdown.js +1 -1
  79. package/dist/Primitives/DropdownButton.cjs +1 -1
  80. package/dist/Primitives/DropdownButton.js +1 -1
  81. package/dist/Primitives/Indicator.cjs +1 -1
  82. package/dist/Primitives/Indicator.js +1 -1
  83. package/dist/Primitives/Input.cjs +1 -1
  84. package/dist/Primitives/Input.js +1 -1
  85. package/dist/Primitives/Kbd.cjs +1 -0
  86. package/dist/Primitives/Kbd.css +0 -0
  87. package/dist/Primitives/Kbd.d.cts +6 -0
  88. package/dist/Primitives/Kbd.d.ts +6 -0
  89. package/dist/Primitives/Kbd.js +1 -0
  90. package/dist/Primitives/Label.cjs +1 -1
  91. package/dist/Primitives/Label.js +1 -1
  92. package/dist/Primitives/Radio.cjs +1 -1
  93. package/dist/Primitives/Radio.js +1 -1
  94. package/dist/Primitives/Rating.cjs +2 -0
  95. package/dist/Primitives/Rating.css +0 -0
  96. package/dist/Primitives/Rating.d.cts +4 -0
  97. package/dist/Primitives/Rating.d.ts +4 -0
  98. package/dist/Primitives/Rating.js +2 -0
  99. package/dist/Primitives/Slider.cjs +1 -1
  100. package/dist/Primitives/Slider.js +1 -1
  101. package/dist/Primitives/Switch.cjs +1 -1
  102. package/dist/Primitives/Switch.js +1 -1
  103. package/dist/Primitives/Tag.cjs +1 -1
  104. package/dist/Primitives/Tag.js +1 -1
  105. package/dist/Primitives/index.cjs +2 -1
  106. package/dist/Primitives/index.d.cts +10 -0
  107. package/dist/Primitives/index.d.ts +10 -0
  108. package/dist/Primitives/index.js +2 -1
  109. package/dist/_tsup-dts-rollup.d.cts +843 -1
  110. package/dist/_tsup-dts-rollup.d.ts +843 -1
  111. package/dist/index.cjs +49 -5
  112. package/dist/index.css +1 -1
  113. package/dist/index.d.cts +35 -0
  114. package/dist/index.d.ts +35 -0
  115. package/dist/index.js +49 -5
  116. package/dist/styles/DataDisplay/VirtualList.css +35 -0
  117. package/dist/styles/Extras/CinePlayer.css +63 -1
  118. package/dist/styles/Extras/FileExplorer.css +39 -1
  119. package/dist/styles/Extras/FilmReel.css +24 -1
  120. package/dist/styles/Extras/LoginPanel.css +16 -0
  121. package/dist/styles/Extras/MiniPlayer.css +84 -1
  122. package/dist/styles/Extras/RichTextEditor.css +908 -0
  123. package/dist/styles/Extras/TypewriterText.css +254 -0
  124. package/dist/styles/Forms/OTPInput.css +11 -0
  125. package/dist/styles/Layout/SplitPanel.css +15 -0
  126. package/dist/styles/Primitives/DropdownButton.css +26 -1
  127. package/dist/styles/Primitives/Kbd.css +1 -0
  128. package/dist/styles/Primitives/Rating.css +1 -0
  129. package/dist/styles/base.css +281 -0
  130. package/dist/styles.css +281 -0
  131. package/dist/theme.cjs +1 -1
  132. package/dist/theme.d.cts +3 -0
  133. package/dist/theme.d.ts +3 -0
  134. package/dist/theme.js +1 -1
  135. package/package.json +22 -1
@@ -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 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:`
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 _t(t){E.push(t);}function Tt(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 St(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 _t(d),()=>Tt(d)},[t,d]),useEffect(()=>{if(!t||!p)return;let T=A=>{A.key==="Escape"&&Ne(d)&&a(false);};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[t,p,a,d]),useEffect(()=>{if(!t||!p)return;let T=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=T;}},[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+St(d.id)*10,J=()=>{d.closeOnOutsideClick&&Ne(d.id)&&d.onOpenChange(false);},S=a==="bottom";return d.modal?jsx("div",{className:u("animate-fade-in fixed inset-0 bg-black/50",S?"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}),S?"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("inline-flex items-center",{variants:{size:{sm:"gap-0.5 [&_.rating-icon]:h-4 [&_.rating-icon]:w-4",md:"gap-1 [&_.rating-icon]:h-6 [&_.rating-icon]:w-6",lg:"gap-1.5 [&_.rating-icon]:h-8 [&_.rating-icon]:w-8"}},defaultVariants:{size:"md"}});cva("inline-flex items-center justify-center rounded font-mono font-medium select-none",{variants:{size:{xs:"h-4 min-w-4 px-1 text-[0.6rem]",sm:"h-5 min-w-5 px-1.5 text-xs",md:"h-6 min-w-6 px-2 text-sm",lg:"h-8 min-w-8 px-2.5 text-base"},variant:{default:"border border-secondary-300 bg-secondary-100 text-secondary-700 shadow-[0_2px_0_0_var(--color-secondary-300)] dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:shadow-[0_2px_0_0_var(--color-secondary-600)]",outline:"border border-secondary-400 bg-transparent text-secondary-700 dark:border-secondary-500 dark:text-secondary-300",ghost:"text-secondary-600 dark:text-secondary-400"}},defaultVariants:{size:"sm",variant:"default"}});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 _e(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 Hr({files:t,title:a="File Explorer",accent:p="#8b5cf6",defaultView:v="list",initialPosition:k,initialSize:d,dockable:T=false,dockSide:A="right",visible:J=true,onFileOpen:S,onSelectionChange:O,onNavigate:ie,onDelete:ue,onClose:st,onMinimize:Te,onPathSubmit:Se,defaultInputMode:ot="search",actions:it,resizable:dt=true,minSize:Z={width:400,height:300},className:ct}){let[me,lt]=useState(v),[x,P]=useState(new Set),[Le,ee]=useState(null),[c,pe]=useState(false),[te,ge]=useState(false),[L,ut]=useState(""),[F,mt]=useState(ot),[pt,gt]=useState(J),[ft,de]=useState(false),[B,xt]=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,bt]=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 xe=J!==void 0?J:pt,be=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]),b=useMemo(()=>{if(F!=="search"||!L.trim())return be;let e=L.toLowerCase();return be.filter(n=>n.name.toLowerCase().includes(e))},[be,L,F]),m=Le!=null?b[Le]:null;useEffect(()=>{let e=rt(window.innerWidth),n=()=>{let s=window.innerWidth,o=window.innerHeight;if(xt({w:s,h:o}),Re.current)return;let l=rt(s);if(l!==e&&!ae.current&&!d){let w=nt(s,o);ce(w.size),j(w.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(x).map(n=>b[n]).filter(Boolean);O(e);},[x]);let He=useCallback(e=>{let n=b[e];n&&(n.type==="directory"?ie?.(n.path):S?.(n));},[b,S,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,w=window.innerHeight-40;j({x:U(o.clientX-X$1.current.x,0,l),y:U(o.clientY-X$1.current.y,0,w)});},n=o=>{if(!re.current)return;o.preventDefault();let l=o.touches[0],w=window.innerWidth-100,I=window.innerHeight-40;j({x:U(l.clientX-X$1.current.x,0,w),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,w)=>{let I=R.current;if(!I)return;let Pe=l-ne.current.x,Be=w-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)):(bt({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),Te?.());},[te,c,M,Te]);useEffect(()=>{if(!xe||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(b.map((o,l)=>l));P(s);}n.key==="Delete"&&x.size>0&&ue&&(n.preventDefault(),de(true));}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[xe,te,b,x,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(!xe)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"})}),T&&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:L,onChange:e=>ut(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L.trim()&&F==="navigate"&&(Se?Se(L.trim()):ie?.(L.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:[b.length," item",b.length!==1?"s":"",x.size>0&&` \xB7 ${x.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:b.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:b.map((e,n)=>{let s=_e(e),o=x.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:w=>Ie(n,w),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:b.map((e,n)=>{let s=_e(e),o=x.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:w=>Ie(n,w),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(_e(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"&&S&&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:()=>S(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:[b.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[x.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[x.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: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};
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:[x.size===1?`Are you sure you want to delete "${b[Array.from(x)[0]]?.name}"?`:`Are you sure you want to delete ${x.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(x).map(n=>b[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{Hr as FileExplorer};
@@ -0,0 +1 @@
1
+ 'use strict';var le=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var le__default=/*#__PURE__*/_interopDefault(le);function o(...a){return tailwindMerge.twMerge(clsx.clsx(a))}var re=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"}});var te=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"}}),ae=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"}}),ne=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("inline-flex items-center",{variants:{size:{sm:"gap-0.5 [&_.rating-icon]:h-4 [&_.rating-icon]:w-4",md:"gap-1 [&_.rating-icon]:h-6 [&_.rating-icon]:w-6",lg:"gap-1.5 [&_.rating-icon]:h-8 [&_.rating-icon]:w-8"}},defaultVariants:{size:"md"}});var se=classVarianceAuthority.cva("inline-flex items-center justify-center rounded font-mono font-medium select-none",{variants:{size:{xs:"h-4 min-w-4 px-1 text-[0.6rem]",sm:"h-5 min-w-5 px-1.5 text-xs",md:"h-6 min-w-6 px-2 text-sm",lg:"h-8 min-w-8 px-2.5 text-base"},variant:{default:"border border-secondary-300 bg-secondary-100 text-secondary-700 shadow-[0_2px_0_0_var(--color-secondary-300)] dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:shadow-[0_2px_0_0_var(--color-secondary-600)]",outline:"border border-secondary-400 bg-transparent text-secondary-700 dark:border-secondary-500 dark:text-secondary-300",ghost:"text-secondary-600 dark:text-secondary-400"}},defaultVariants:{size:"sm",variant:"default"}});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 q({intent:a,size:l,className:p,...i}){return jsxRuntime.jsx("button",{className:o(re({intent:a,size:l}),p),...i})}var xe={sm:{wrapper:"h-7 text-xs",prefix:"px-2 text-xs [&_svg]:h-3 [&_svg]:w-3",input:"px-2 text-xs",icon:"px-1.5 [&_svg]:h-3 [&_svg]:w-3"},md:{wrapper:"h-9 text-sm",prefix:"px-3 text-sm [&_svg]:h-4 [&_svg]:w-4",input:"px-3 py-2 text-sm",icon:"px-2 [&_svg]:h-4 [&_svg]:w-4"},lg:{wrapper:"h-11 text-base",prefix:"px-4 text-base [&_svg]:h-5 [&_svg]:w-5",input:"px-4 py-2.5 text-base",icon:"px-2.5 [&_svg]:h-5 [&_svg]:w-5"}},ke={default:"border-secondary-300 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus-within:border-danger-500 focus-within:ring-2 focus-within:ring-danger-500/20"};function T({state:a="default",inputSize:l="md",className:p,prefix:i,suffix:y,action:g,...h}){if(!i&&!y&&!g)return jsxRuntime.jsx("input",{className:o(te({state:a,size:l}),p),...h});let k=xe[l??"md"],C=ke[a??"default"];return jsxRuntime.jsxs("div",{className:o("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",k.wrapper,C,p),children:[i&&jsxRuntime.jsx("span",{className:o("flex shrink-0 items-center gap-1.5 self-stretch border-r border-secondary-300 bg-secondary-50 font-medium text-secondary-600 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300",k.prefix),children:i}),jsxRuntime.jsx("input",{className:o("min-w-0 flex-1 bg-transparent text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600",k.input,i&&"pl-2"),...h}),y&&jsxRuntime.jsx("span",{className:o("flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",k.icon),children:y}),g&&jsxRuntime.jsx("button",{type:"button",onClick:g.onClick,"aria-label":g["aria-label"]??"Action",className:o("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",k.icon),children:g.icon})]})}function M({intent:a,size:l,className:p,...i}){return jsxRuntime.jsx("label",{className:o(ae({intent:a,size:l}),p),...i})}var Pe={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function oe({checked:a,defaultChecked:l=false,indeterminate:p=false,onCheckedChange:i,intent:y,size:g,label:h,id:k,className:C,disabled:V,...v}){let m=le.useId(),x=k??m,S=g??"md",[R,F]=le.useState(l),E=a??R,u=le.useCallback(w=>{let b=w.target.checked;a===void 0&&F(b),i?.(b);},[a,i]),d=E||p;return jsxRuntime.jsxs("label",{htmlFor:x,className:o("inline-flex cursor-pointer items-center gap-2 select-none",V&&"pointer-events-none opacity-50",C),children:[jsxRuntime.jsx("input",{...v,id:x,type:"checkbox",className:"sr-only",checked:E,disabled:V,onChange:u}),jsxRuntime.jsx("span",{className:o(ne({intent:y,size:g,checked:d?"on":"off"})),children:jsxRuntime.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:o("text-white transition-all duration-200",Pe[S],d?"scale-100 opacity-100":"scale-0 opacity-0"),children:p?jsxRuntime.jsx("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}):jsxRuntime.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),h&&jsxRuntime.jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:h})]})}var ie=classVarianceAuthority.cva("w-full rounded-md font-mono text-center transition-all focus:outline-none focus:ring-2 disabled:pointer-events-none disabled:opacity-50",{variants:{size:{sm:"h-9 w-9 text-sm",md:"h-12 w-12 text-base",lg:"h-14 w-14 text-lg"},variant:{outline:"border border-secondary-300 bg-transparent focus:border-primary-500 focus:ring-primary-500/20 dark:border-secondary-600 dark:bg-transparent dark:focus:border-primary-400",filled:"border border-transparent bg-secondary-100 focus:border-primary-500 focus:ring-primary-500/20 dark:bg-secondary-800 dark:focus:border-primary-400",underline:"rounded-none border-0 border-b-2 border-secondary-300 bg-transparent px-0 focus:border-primary-500 focus:ring-0 dark:border-secondary-600 dark:focus:border-primary-400"},invalid:{true:"border-danger-400 focus:border-danger-500 focus:ring-danger-500/20",false:""}},defaultVariants:{size:"md",variant:"outline",invalid:false}});classVarianceAuthority.cva("w-full",{variants:{intent:{default:"",card:"rounded-(--form-radius) border border-primary-200 bg-white p-6 shadow-sm dark:border-primary-700 dark:bg-primary-900",inset:"rounded-(--form-radius) bg-primary-50 p-6 dark:bg-primary-800/50"},size:{sm:"",md:"",lg:""}},defaultVariants:{intent:"default",size:"md"}});classVarianceAuthority.cva("flex w-full",{variants:{layout:{stacked:"flex-col gap-1.5",inline:"flex-row items-start gap-(--form-item-gap-md)"},size:{sm:"",md:"",lg:""}},defaultVariants:{layout:"stacked",size:"md"}});classVarianceAuthority.cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});function Q({length:a=6,value:l,defaultValue:p="",onChange:i,onComplete:y,size:g="md",variant:h="outline",disabled:k=false,readOnly:C=false,autoFocus:V=false,alphanumeric:v=false,mask:m=false,invalid:x=false,className:S}){let R=l!==void 0,[F,E]=le.useState(()=>{let r=(p??"").slice(0,a);return Array.from({length:a},(t,n)=>r[n]??"")}),u=R?Array.from({length:a},(r,t)=>(l??"")[t]??""):F,d=le.useRef([]),w=le.useRef([]);le.useEffect(()=>{V&&d.current[0]&&d.current[0].focus();},[V]);let b=le.useCallback(r=>{R||E(r);let t=r.join("");i?.(t),r.every(n=>n!=="")&&r.length===a&&y?.(t);},[R,i,y,a]),j=r=>{let t=d.current[r];t&&(t.classList.remove("otp-pop"),clearTimeout(w.current[r]),t.offsetWidth,t.classList.add("otp-pop"),w.current[r]=window.setTimeout(()=>t.classList.remove("otp-pop"),200));},O=le.useCallback((r,t)=>{let n=v?/[a-zA-Z0-9]/g:/[0-9]/g,I=t.match(n)??[];if(I.length===0)return;let P=I[I.length-1],_=[...u];_[r]=P,b(_),j(r),r<a-1&&d.current[r+1]?.focus();},[u,a,v,b]),Z=le.useCallback((r,t)=>{if(t.key==="Backspace"){if(t.preventDefault(),u[r]){let n=[...u];n[r]="",b(n);}else if(r>0){d.current[r-1]?.focus();let n=[...u];n[r-1]="",b(n);}}else if(t.key==="ArrowLeft")t.preventDefault(),r>0&&d.current[r-1]?.focus();else if(t.key==="ArrowRight")t.preventDefault(),r<a-1&&d.current[r+1]?.focus();else if(t.key==="Delete"){t.preventDefault();let n=[...u];n[r]="",b(n);}},[u,a,b]),A=le.useCallback((r,t)=>{t.preventDefault();let n=t.clipboardData.getData("text"),I=v?/[a-zA-Z0-9]/g:/[0-9]/g,P=n.match(I)??[],_=[...u],L=r;for(let N=0;N<P.length&&r+N<a;N++)_[r+N]=P[N],L=r+N;b(_);let B=_.findIndex((N,J)=>J>L&&N===""),$=B!==-1?B:Math.min(L+1,a-1);d.current[$]?.focus();},[u,a,v,b]),Y=le.useCallback(r=>{r.target.select();},[]);return jsxRuntime.jsx("div",{role:"group","aria-label":"OTP Input",className:o("inline-flex gap-2",S),children:Array.from({length:a},(r,t)=>jsxRuntime.jsx("input",{ref:n=>{d.current[t]=n;},type:m?"password":"text",inputMode:v?"text":"numeric",pattern:v?"[a-zA-Z0-9]":"[0-9]",maxLength:2,value:u[t],disabled:k,readOnly:C,autoComplete:"one-time-code","aria-label":`Digit ${t+1} of ${a}`,className:o(ie({size:g,variant:h,invalid:x||void 0}),"text-secondary-900 dark:text-secondary-100"),onChange:n=>O(t,n.target.value),onKeyDown:n=>Z(t,n),onPaste:n=>A(t,n),onFocus:Y},t))})}function X({size:a="sm",variant:l="default",className:p,children:i,...y}){return jsxRuntime.jsx("kbd",{className:o(se({size:a,variant:l}),p),...y,children:i})}function ee({separator:a="+",className:l,children:p}){let i=le__default.default.Children.toArray(p);return jsxRuntime.jsx("span",{className:o("inline-flex items-center gap-1",l),children:i.map((y,g)=>jsxRuntime.jsxs(le__default.default.Fragment,{children:[y,g<i.length-1&&jsxRuntime.jsx("span",{className:"select-none text-xs text-secondary-400 dark:text-secondary-500","aria-hidden":true,children:a})]},g))})}var Ie={login:"Welcome back",register:"Create account",otp:"Verify your identity",forgot:"Reset password"},Le={login:"Sign in to your account to continue",register:"Fill in the details to get started",otp:"Enter the 6-digit code sent to your email",forgot:"We'll send a reset link to your email"};function Te({mode:a,onModeChange:l,onLogin:p,onRegister:i,onOTPComplete:y,onForgotPassword:g,logo:h,title:k,subtitle:C,socialLogins:V,showRememberMe:v=true,isLoading:m=false,error:x,className:S,style:R}){let[F,E]=le.useState("login"),u=a!==void 0,d=u?a:F,w=le.useCallback(s=>{u||E(s),l?.(s);},[u,l]),[b,j]=le.useState(""),[O,Z]=le.useState(""),[A,Y]=le.useState(false),[r,t]=le.useState(""),[n,I]=le.useState(""),[P,_]=le.useState(""),[L,B]=le.useState(""),$=le.useCallback(async s=>{s.preventDefault(),await p?.(b,O,A);},[b,O,A,p]),N=le.useCallback(async s=>{s.preventDefault(),await i?.(r,n,P);},[r,n,P,i]),J=le.useCallback(async s=>{s.preventDefault(),await g?.(L);},[L,g]),me=k??Ie[d],ge=C??Le[d];return jsxRuntime.jsxs("div",{className:o("w-full max-w-sm rounded-2xl border border-primary-200 bg-white/90 p-8 shadow-xl backdrop-blur-md","dark:border-primary-700 dark:bg-primary-900/90",S),style:R,children:[h&&jsxRuntime.jsx("div",{className:"mb-6 flex justify-center",children:h}),jsxRuntime.jsxs("div",{className:"mb-6 text-center",children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-primary-900 dark:text-primary-50",children:me}),jsxRuntime.jsx("p",{className:"mt-1 text-sm text-secondary-500 dark:text-secondary-400",children:ge})]}),V&&V.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"mb-4 flex flex-col gap-2",children:V.map((s,ue)=>jsxRuntime.jsxs("button",{type:"button",onClick:s.onClick,disabled:m,className:o("flex w-full items-center justify-center gap-2 rounded-lg border border-secondary-300 px-4 py-2 text-sm font-medium","text-secondary-700 transition-colors hover:bg-secondary-50","dark:border-secondary-600 dark:text-secondary-300 dark:hover:bg-secondary-800","disabled:opacity-50 disabled:cursor-not-allowed","[&_svg]:h-4 [&_svg]:w-4"),children:[s.icon,s.label]},ue))}),jsxRuntime.jsxs("div",{className:"relative mb-4 flex items-center",children:[jsxRuntime.jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"}),jsxRuntime.jsx("span",{className:"mx-3 text-xs text-secondary-400 dark:text-secondary-500",children:"or continue with"}),jsxRuntime.jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"})]})]}),jsxRuntime.jsxs("div",{className:"login-panel-slide-enter",children:[d==="login"&&jsxRuntime.jsxs("form",{onSubmit:$,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(M,{htmlFor:"lp-email",children:"Email"}),jsxRuntime.jsx(T,{id:"lp-email",type:"email",placeholder:"you@example.com",value:b,onChange:s=>j(s.target.value),disabled:m,required:true})]}),jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(M,{htmlFor:"lp-password",children:"Password"}),jsxRuntime.jsx(T,{id:"lp-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:O,onChange:s=>Z(s.target.value),disabled:m,required:true})]}),v&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(oe,{checked:A,onCheckedChange:s=>Y(!!s),label:"Remember me",disabled:m}),jsxRuntime.jsx("button",{type:"button",className:"text-xs text-primary-500 hover:underline dark:text-primary-400",onClick:()=>w("forgot"),children:"Forgot password?"})]}),x&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:x}),jsxRuntime.jsx(q,{type:"submit",className:"w-full",disabled:m,children:m?jsxRuntime.jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Sign in"," ",jsxRuntime.jsx(ee,{className:"ml-1 opacity-60",children:jsxRuntime.jsx(X,{size:"xs",children:"\u23CE"})})]})}),jsxRuntime.jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Don't have an account?"," ",jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>w("register"),children:"Register"})]})]}),d==="register"&&jsxRuntime.jsxs("form",{onSubmit:N,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(M,{htmlFor:"lp-name",children:"Full name"}),jsxRuntime.jsx(T,{id:"lp-name",type:"text",placeholder:"Jane Doe",value:r,onChange:s=>t(s.target.value),disabled:m,required:true})]}),jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(M,{htmlFor:"lp-reg-email",children:"Email"}),jsxRuntime.jsx(T,{id:"lp-reg-email",type:"email",placeholder:"you@example.com",value:n,onChange:s=>I(s.target.value),disabled:m,required:true})]}),jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(M,{htmlFor:"lp-reg-password",children:"Password"}),jsxRuntime.jsx(T,{id:"lp-reg-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:P,onChange:s=>_(s.target.value),disabled:m,required:true})]}),x&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:x}),jsxRuntime.jsx(q,{type:"submit",className:"w-full",disabled:m,children:m?jsxRuntime.jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Create account"}),jsxRuntime.jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Already have an account?"," ",jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>w("login"),children:"Sign in"})]})]}),d==="otp"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsx("div",{className:"flex justify-center",children:jsxRuntime.jsx(Q,{length:6,size:"md",onComplete:async s=>{await y?.(s);},autoFocus:true})}),x&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-center text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:x}),jsxRuntime.jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>w("login"),children:"\u2190 Back to login"})})]}),d==="forgot"&&jsxRuntime.jsxs("form",{onSubmit:J,className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-1.5",children:[jsxRuntime.jsx(M,{htmlFor:"lp-forgot-email",children:"Email address"}),jsxRuntime.jsx(T,{id:"lp-forgot-email",type:"email",placeholder:"you@example.com",value:L,onChange:s=>B(s.target.value),disabled:m,required:true})]}),x&&jsxRuntime.jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:x}),jsxRuntime.jsx(q,{type:"submit",className:"w-full",disabled:m,children:m?jsxRuntime.jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Send reset link"}),jsxRuntime.jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsxRuntime.jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>w("login"),children:"\u2190 Back to login"})})]})]},d)]})}exports.LoginPanel=Te;
@@ -0,0 +1 @@
1
+ @keyframes otp-pop{0%{transform:scale(1)}40%{transform:scale(1.12)}to{transform:scale(1)}}.otp-pop{animation:otp-pop .18s ease-out forwards}.login-panel-slide-enter{animation:login-slide-in .22s ease-out forwards}@keyframes login-slide-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@@ -0,0 +1,3 @@
1
+ export { LoginPanel_alias_3 as LoginPanel } from '../_tsup-dts-rollup.cjs';
2
+ export { LoginPanelProps_alias_3 as LoginPanelProps } from '../_tsup-dts-rollup.cjs';
3
+ export { LoginPanelMode_alias_3 as LoginPanelMode } from '../_tsup-dts-rollup.cjs';
@@ -0,0 +1,3 @@
1
+ export { LoginPanel_alias_3 as LoginPanel } from '../_tsup-dts-rollup.js';
2
+ export { LoginPanelProps_alias_3 as LoginPanelProps } from '../_tsup-dts-rollup.js';
3
+ export { LoginPanelMode_alias_3 as LoginPanelMode } from '../_tsup-dts-rollup.js';
@@ -0,0 +1 @@
1
+ import le,{useState,useCallback,useId,useRef,useEffect}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsxs,jsx,Fragment}from'react/jsx-runtime';function o(...a){return twMerge(clsx(a))}var re=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"}});var te=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"}}),ae=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"}}),ne=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("inline-flex items-center",{variants:{size:{sm:"gap-0.5 [&_.rating-icon]:h-4 [&_.rating-icon]:w-4",md:"gap-1 [&_.rating-icon]:h-6 [&_.rating-icon]:w-6",lg:"gap-1.5 [&_.rating-icon]:h-8 [&_.rating-icon]:w-8"}},defaultVariants:{size:"md"}});var se=cva("inline-flex items-center justify-center rounded font-mono font-medium select-none",{variants:{size:{xs:"h-4 min-w-4 px-1 text-[0.6rem]",sm:"h-5 min-w-5 px-1.5 text-xs",md:"h-6 min-w-6 px-2 text-sm",lg:"h-8 min-w-8 px-2.5 text-base"},variant:{default:"border border-secondary-300 bg-secondary-100 text-secondary-700 shadow-[0_2px_0_0_var(--color-secondary-300)] dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:shadow-[0_2px_0_0_var(--color-secondary-600)]",outline:"border border-secondary-400 bg-transparent text-secondary-700 dark:border-secondary-500 dark:text-secondary-300",ghost:"text-secondary-600 dark:text-secondary-400"}},defaultVariants:{size:"sm",variant:"default"}});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 q({intent:a,size:l,className:p,...i}){return jsx("button",{className:o(re({intent:a,size:l}),p),...i})}var xe={sm:{wrapper:"h-7 text-xs",prefix:"px-2 text-xs [&_svg]:h-3 [&_svg]:w-3",input:"px-2 text-xs",icon:"px-1.5 [&_svg]:h-3 [&_svg]:w-3"},md:{wrapper:"h-9 text-sm",prefix:"px-3 text-sm [&_svg]:h-4 [&_svg]:w-4",input:"px-3 py-2 text-sm",icon:"px-2 [&_svg]:h-4 [&_svg]:w-4"},lg:{wrapper:"h-11 text-base",prefix:"px-4 text-base [&_svg]:h-5 [&_svg]:w-5",input:"px-4 py-2.5 text-base",icon:"px-2.5 [&_svg]:h-5 [&_svg]:w-5"}},ke={default:"border-secondary-300 focus-within:border-primary-500 focus-within:ring-2 focus-within:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus-within:border-danger-500 focus-within:ring-2 focus-within:ring-danger-500/20"};function T({state:a="default",inputSize:l="md",className:p,prefix:i,suffix:y,action:g,...h}){if(!i&&!y&&!g)return jsx("input",{className:o(te({state:a,size:l}),p),...h});let k=xe[l??"md"],C=ke[a??"default"];return jsxs("div",{className:o("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",k.wrapper,C,p),children:[i&&jsx("span",{className:o("flex shrink-0 items-center gap-1.5 self-stretch border-r border-secondary-300 bg-secondary-50 font-medium text-secondary-600 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300",k.prefix),children:i}),jsx("input",{className:o("min-w-0 flex-1 bg-transparent text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600",k.input,i&&"pl-2"),...h}),y&&jsx("span",{className:o("flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",k.icon),children:y}),g&&jsx("button",{type:"button",onClick:g.onClick,"aria-label":g["aria-label"]??"Action",className:o("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",k.icon),children:g.icon})]})}function M({intent:a,size:l,className:p,...i}){return jsx("label",{className:o(ae({intent:a,size:l}),p),...i})}var Pe={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function oe({checked:a,defaultChecked:l=false,indeterminate:p=false,onCheckedChange:i,intent:y,size:g,label:h,id:k,className:C,disabled:V,...v}){let m=useId(),x=k??m,S=g??"md",[R,F]=useState(l),E=a??R,u=useCallback(w=>{let b=w.target.checked;a===void 0&&F(b),i?.(b);},[a,i]),d=E||p;return jsxs("label",{htmlFor:x,className:o("inline-flex cursor-pointer items-center gap-2 select-none",V&&"pointer-events-none opacity-50",C),children:[jsx("input",{...v,id:x,type:"checkbox",className:"sr-only",checked:E,disabled:V,onChange:u}),jsx("span",{className:o(ne({intent:y,size:g,checked:d?"on":"off"})),children:jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:o("text-white transition-all duration-200",Pe[S],d?"scale-100 opacity-100":"scale-0 opacity-0"),children:p?jsx("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}):jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),h&&jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:h})]})}var ie=cva("w-full rounded-md font-mono text-center transition-all focus:outline-none focus:ring-2 disabled:pointer-events-none disabled:opacity-50",{variants:{size:{sm:"h-9 w-9 text-sm",md:"h-12 w-12 text-base",lg:"h-14 w-14 text-lg"},variant:{outline:"border border-secondary-300 bg-transparent focus:border-primary-500 focus:ring-primary-500/20 dark:border-secondary-600 dark:bg-transparent dark:focus:border-primary-400",filled:"border border-transparent bg-secondary-100 focus:border-primary-500 focus:ring-primary-500/20 dark:bg-secondary-800 dark:focus:border-primary-400",underline:"rounded-none border-0 border-b-2 border-secondary-300 bg-transparent px-0 focus:border-primary-500 focus:ring-0 dark:border-secondary-600 dark:focus:border-primary-400"},invalid:{true:"border-danger-400 focus:border-danger-500 focus:ring-danger-500/20",false:""}},defaultVariants:{size:"md",variant:"outline",invalid:false}});cva("w-full",{variants:{intent:{default:"",card:"rounded-(--form-radius) border border-primary-200 bg-white p-6 shadow-sm dark:border-primary-700 dark:bg-primary-900",inset:"rounded-(--form-radius) bg-primary-50 p-6 dark:bg-primary-800/50"},size:{sm:"",md:"",lg:""}},defaultVariants:{intent:"default",size:"md"}});cva("flex w-full",{variants:{layout:{stacked:"flex-col gap-1.5",inline:"flex-row items-start gap-(--form-item-gap-md)"},size:{sm:"",md:"",lg:""}},defaultVariants:{layout:"stacked",size:"md"}});cva("mt-1 flex items-center gap-1 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5 [&_svg]:shrink-0",{variants:{status:{error:"text-danger-600 dark:text-danger-400",warning:"text-warning-600 dark:text-warning-400",success:"text-success-600 dark:text-success-400",hint:"text-primary-400 dark:text-primary-500"}},defaultVariants:{status:"hint"}});function Q({length:a=6,value:l,defaultValue:p="",onChange:i,onComplete:y,size:g="md",variant:h="outline",disabled:k=false,readOnly:C=false,autoFocus:V=false,alphanumeric:v=false,mask:m=false,invalid:x=false,className:S}){let R=l!==void 0,[F,E]=useState(()=>{let r=(p??"").slice(0,a);return Array.from({length:a},(t,n)=>r[n]??"")}),u=R?Array.from({length:a},(r,t)=>(l??"")[t]??""):F,d=useRef([]),w=useRef([]);useEffect(()=>{V&&d.current[0]&&d.current[0].focus();},[V]);let b=useCallback(r=>{R||E(r);let t=r.join("");i?.(t),r.every(n=>n!=="")&&r.length===a&&y?.(t);},[R,i,y,a]),j=r=>{let t=d.current[r];t&&(t.classList.remove("otp-pop"),clearTimeout(w.current[r]),t.offsetWidth,t.classList.add("otp-pop"),w.current[r]=window.setTimeout(()=>t.classList.remove("otp-pop"),200));},O=useCallback((r,t)=>{let n=v?/[a-zA-Z0-9]/g:/[0-9]/g,I=t.match(n)??[];if(I.length===0)return;let P=I[I.length-1],_=[...u];_[r]=P,b(_),j(r),r<a-1&&d.current[r+1]?.focus();},[u,a,v,b]),Z=useCallback((r,t)=>{if(t.key==="Backspace"){if(t.preventDefault(),u[r]){let n=[...u];n[r]="",b(n);}else if(r>0){d.current[r-1]?.focus();let n=[...u];n[r-1]="",b(n);}}else if(t.key==="ArrowLeft")t.preventDefault(),r>0&&d.current[r-1]?.focus();else if(t.key==="ArrowRight")t.preventDefault(),r<a-1&&d.current[r+1]?.focus();else if(t.key==="Delete"){t.preventDefault();let n=[...u];n[r]="",b(n);}},[u,a,b]),A=useCallback((r,t)=>{t.preventDefault();let n=t.clipboardData.getData("text"),I=v?/[a-zA-Z0-9]/g:/[0-9]/g,P=n.match(I)??[],_=[...u],L=r;for(let N=0;N<P.length&&r+N<a;N++)_[r+N]=P[N],L=r+N;b(_);let B=_.findIndex((N,J)=>J>L&&N===""),$=B!==-1?B:Math.min(L+1,a-1);d.current[$]?.focus();},[u,a,v,b]),Y=useCallback(r=>{r.target.select();},[]);return jsx("div",{role:"group","aria-label":"OTP Input",className:o("inline-flex gap-2",S),children:Array.from({length:a},(r,t)=>jsx("input",{ref:n=>{d.current[t]=n;},type:m?"password":"text",inputMode:v?"text":"numeric",pattern:v?"[a-zA-Z0-9]":"[0-9]",maxLength:2,value:u[t],disabled:k,readOnly:C,autoComplete:"one-time-code","aria-label":`Digit ${t+1} of ${a}`,className:o(ie({size:g,variant:h,invalid:x||void 0}),"text-secondary-900 dark:text-secondary-100"),onChange:n=>O(t,n.target.value),onKeyDown:n=>Z(t,n),onPaste:n=>A(t,n),onFocus:Y},t))})}function X({size:a="sm",variant:l="default",className:p,children:i,...y}){return jsx("kbd",{className:o(se({size:a,variant:l}),p),...y,children:i})}function ee({separator:a="+",className:l,children:p}){let i=le.Children.toArray(p);return jsx("span",{className:o("inline-flex items-center gap-1",l),children:i.map((y,g)=>jsxs(le.Fragment,{children:[y,g<i.length-1&&jsx("span",{className:"select-none text-xs text-secondary-400 dark:text-secondary-500","aria-hidden":true,children:a})]},g))})}var Ie={login:"Welcome back",register:"Create account",otp:"Verify your identity",forgot:"Reset password"},Le={login:"Sign in to your account to continue",register:"Fill in the details to get started",otp:"Enter the 6-digit code sent to your email",forgot:"We'll send a reset link to your email"};function Te({mode:a,onModeChange:l,onLogin:p,onRegister:i,onOTPComplete:y,onForgotPassword:g,logo:h,title:k,subtitle:C,socialLogins:V,showRememberMe:v=true,isLoading:m=false,error:x,className:S,style:R}){let[F,E]=useState("login"),u=a!==void 0,d=u?a:F,w=useCallback(s=>{u||E(s),l?.(s);},[u,l]),[b,j]=useState(""),[O,Z]=useState(""),[A,Y]=useState(false),[r,t]=useState(""),[n,I]=useState(""),[P,_]=useState(""),[L,B]=useState(""),$=useCallback(async s=>{s.preventDefault(),await p?.(b,O,A);},[b,O,A,p]),N=useCallback(async s=>{s.preventDefault(),await i?.(r,n,P);},[r,n,P,i]),J=useCallback(async s=>{s.preventDefault(),await g?.(L);},[L,g]),me=k??Ie[d],ge=C??Le[d];return jsxs("div",{className:o("w-full max-w-sm rounded-2xl border border-primary-200 bg-white/90 p-8 shadow-xl backdrop-blur-md","dark:border-primary-700 dark:bg-primary-900/90",S),style:R,children:[h&&jsx("div",{className:"mb-6 flex justify-center",children:h}),jsxs("div",{className:"mb-6 text-center",children:[jsx("h2",{className:"text-xl font-bold text-primary-900 dark:text-primary-50",children:me}),jsx("p",{className:"mt-1 text-sm text-secondary-500 dark:text-secondary-400",children:ge})]}),V&&V.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"mb-4 flex flex-col gap-2",children:V.map((s,ue)=>jsxs("button",{type:"button",onClick:s.onClick,disabled:m,className:o("flex w-full items-center justify-center gap-2 rounded-lg border border-secondary-300 px-4 py-2 text-sm font-medium","text-secondary-700 transition-colors hover:bg-secondary-50","dark:border-secondary-600 dark:text-secondary-300 dark:hover:bg-secondary-800","disabled:opacity-50 disabled:cursor-not-allowed","[&_svg]:h-4 [&_svg]:w-4"),children:[s.icon,s.label]},ue))}),jsxs("div",{className:"relative mb-4 flex items-center",children:[jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"}),jsx("span",{className:"mx-3 text-xs text-secondary-400 dark:text-secondary-500",children:"or continue with"}),jsx("div",{className:"flex-1 border-t border-secondary-200 dark:border-secondary-700"})]})]}),jsxs("div",{className:"login-panel-slide-enter",children:[d==="login"&&jsxs("form",{onSubmit:$,className:"space-y-4",children:[jsxs("div",{className:"space-y-1.5",children:[jsx(M,{htmlFor:"lp-email",children:"Email"}),jsx(T,{id:"lp-email",type:"email",placeholder:"you@example.com",value:b,onChange:s=>j(s.target.value),disabled:m,required:true})]}),jsxs("div",{className:"space-y-1.5",children:[jsx(M,{htmlFor:"lp-password",children:"Password"}),jsx(T,{id:"lp-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:O,onChange:s=>Z(s.target.value),disabled:m,required:true})]}),v&&jsxs("div",{className:"flex items-center justify-between",children:[jsx(oe,{checked:A,onCheckedChange:s=>Y(!!s),label:"Remember me",disabled:m}),jsx("button",{type:"button",className:"text-xs text-primary-500 hover:underline dark:text-primary-400",onClick:()=>w("forgot"),children:"Forgot password?"})]}),x&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:x}),jsx(q,{type:"submit",className:"w-full",disabled:m,children:m?jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):jsxs(Fragment,{children:["Sign in"," ",jsx(ee,{className:"ml-1 opacity-60",children:jsx(X,{size:"xs",children:"\u23CE"})})]})}),jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Don't have an account?"," ",jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>w("register"),children:"Register"})]})]}),d==="register"&&jsxs("form",{onSubmit:N,className:"space-y-4",children:[jsxs("div",{className:"space-y-1.5",children:[jsx(M,{htmlFor:"lp-name",children:"Full name"}),jsx(T,{id:"lp-name",type:"text",placeholder:"Jane Doe",value:r,onChange:s=>t(s.target.value),disabled:m,required:true})]}),jsxs("div",{className:"space-y-1.5",children:[jsx(M,{htmlFor:"lp-reg-email",children:"Email"}),jsx(T,{id:"lp-reg-email",type:"email",placeholder:"you@example.com",value:n,onChange:s=>I(s.target.value),disabled:m,required:true})]}),jsxs("div",{className:"space-y-1.5",children:[jsx(M,{htmlFor:"lp-reg-password",children:"Password"}),jsx(T,{id:"lp-reg-password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:P,onChange:s=>_(s.target.value),disabled:m,required:true})]}),x&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:x}),jsx(q,{type:"submit",className:"w-full",disabled:m,children:m?jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Create account"}),jsxs("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:["Already have an account?"," ",jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>w("login"),children:"Sign in"})]})]}),d==="otp"&&jsxs("div",{className:"space-y-6",children:[jsx("div",{className:"flex justify-center",children:jsx(Q,{length:6,size:"md",onComplete:async s=>{await y?.(s);},autoFocus:true})}),x&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-center text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:x}),jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>w("login"),children:"\u2190 Back to login"})})]}),d==="forgot"&&jsxs("form",{onSubmit:J,className:"space-y-4",children:[jsxs("div",{className:"space-y-1.5",children:[jsx(M,{htmlFor:"lp-forgot-email",children:"Email address"}),jsx(T,{id:"lp-forgot-email",type:"email",placeholder:"you@example.com",value:L,onChange:s=>B(s.target.value),disabled:m,required:true})]}),x&&jsx("p",{className:"rounded-md bg-danger-50 p-2.5 text-sm text-danger-600 dark:bg-danger-900/30 dark:text-danger-400",children:x}),jsx(q,{type:"submit",className:"w-full",disabled:m,children:m?jsx("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):"Send reset link"}),jsx("p",{className:"text-center text-sm text-secondary-500 dark:text-secondary-400",children:jsx("button",{type:"button",className:"font-medium text-primary-500 hover:underline dark:text-primary-400",onClick:()=>w("login"),children:"\u2190 Back to login"})})]})]},d)]})}export{Te as LoginPanel};