@jacshuo/onyx 1.4.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/Chart/BarChart.cjs +1 -0
  2. package/dist/Chart/BarChart.css +1 -0
  3. package/dist/Chart/BarChart.d.cts +2 -0
  4. package/dist/Chart/BarChart.d.ts +2 -0
  5. package/dist/Chart/BarChart.js +1 -0
  6. package/dist/Chart/LineChart.cjs +1 -0
  7. package/dist/Chart/LineChart.css +1 -0
  8. package/dist/Chart/LineChart.d.cts +2 -0
  9. package/dist/Chart/LineChart.d.ts +2 -0
  10. package/dist/Chart/LineChart.js +1 -0
  11. package/dist/Chart/PieChart.cjs +1 -0
  12. package/dist/Chart/PieChart.css +1 -0
  13. package/dist/Chart/PieChart.d.cts +2 -0
  14. package/dist/Chart/PieChart.d.ts +2 -0
  15. package/dist/Chart/PieChart.js +1 -0
  16. package/dist/Chart/ScatterChart.cjs +1 -0
  17. package/dist/Chart/ScatterChart.css +1 -0
  18. package/dist/Chart/ScatterChart.d.cts +2 -0
  19. package/dist/Chart/ScatterChart.d.ts +2 -0
  20. package/dist/Chart/ScatterChart.js +1 -0
  21. package/dist/Chart/index.cjs +1 -0
  22. package/dist/Chart/index.css +1 -0
  23. package/dist/Chart/index.d.cts +12 -0
  24. package/dist/Chart/index.d.ts +12 -0
  25. package/dist/Chart/index.js +1 -0
  26. package/dist/DataDisplay/index.d.cts +1 -1
  27. package/dist/DataDisplay/index.d.ts +1 -1
  28. package/dist/Disclosure/index.d.cts +1 -1
  29. package/dist/Disclosure/index.d.ts +1 -1
  30. package/dist/Extras/CinePlayer.cjs +1 -1
  31. package/dist/Extras/CinePlayer.js +1 -1
  32. package/dist/Extras/FileExplorer.cjs +9 -2
  33. package/dist/Extras/FileExplorer.js +9 -2
  34. package/dist/Extras/MiniPlayer.cjs +2 -2
  35. package/dist/Extras/MiniPlayer.js +2 -2
  36. package/dist/Extras/TypewriterText.cjs +1 -0
  37. package/dist/Extras/TypewriterText.css +1 -0
  38. package/dist/Extras/TypewriterText.d.cts +2 -0
  39. package/dist/Extras/TypewriterText.d.ts +2 -0
  40. package/dist/Extras/TypewriterText.js +1 -0
  41. package/dist/Extras/index.cjs +11 -4
  42. package/dist/Extras/index.css +1 -0
  43. package/dist/Extras/index.d.cts +3 -1
  44. package/dist/Extras/index.d.ts +3 -1
  45. package/dist/Extras/index.js +11 -4
  46. package/dist/Feedback/index.d.cts +1 -1
  47. package/dist/Feedback/index.d.ts +1 -1
  48. package/dist/Forms/Form.cjs +1 -1
  49. package/dist/Forms/Form.js +1 -1
  50. package/dist/Forms/index.cjs +1 -1
  51. package/dist/Forms/index.d.cts +1 -1
  52. package/dist/Forms/index.d.ts +1 -1
  53. package/dist/Forms/index.js +1 -1
  54. package/dist/Layout/index.d.cts +1 -1
  55. package/dist/Layout/index.d.ts +1 -1
  56. package/dist/Navigation/index.d.cts +1 -1
  57. package/dist/Navigation/index.d.ts +1 -1
  58. package/dist/Overlay/index.d.cts +1 -1
  59. package/dist/Overlay/index.d.ts +1 -1
  60. package/dist/Primitives/index.d.cts +1 -1
  61. package/dist/Primitives/index.d.ts +1 -1
  62. package/dist/_tsup-dts-rollup.d.cts +481 -11
  63. package/dist/_tsup-dts-rollup.d.ts +481 -11
  64. package/dist/index.cjs +12 -5
  65. package/dist/index.css +1 -0
  66. package/dist/index.d.cts +20 -0
  67. package/dist/index.d.ts +20 -0
  68. package/dist/index.js +12 -5
  69. package/dist/styles/Chart/BarChart.css +44 -0
  70. package/dist/styles/Chart/LineChart.css +72 -0
  71. package/dist/styles/Chart/PieChart.css +56 -0
  72. package/dist/styles/Chart/ScatterChart.css +45 -0
  73. package/dist/styles/Extras/TypewriterText.css +55 -0
  74. package/dist/styles/base.css +149 -18
  75. package/dist/styles/tokens/core.css +10 -0
  76. package/dist/styles.css +353 -18
  77. package/dist/theme.cjs +1 -1
  78. package/dist/theme.d.cts +3 -0
  79. package/dist/theme.d.ts +3 -0
  80. package/dist/theme.js +1 -1
  81. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),zt=require('react'),lucideReact=require('lucide-react'),reactDom=require('react-dom'),client=require('react-dom/client');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var zt__default=/*#__PURE__*/_interopDefault(zt);function n(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var ct=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"}}),Zt=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"}}),Qt=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"}}),dt=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"}}),Jt=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"}}),er=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"}}),tr=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"}}),rr=classVarianceAuthority.cva("",{variants:{intent:{primary:"",secondary:"",danger:"",warning:"",success:""},size:{sm:"",md:"",lg:""},checked:{on:"",off:"bg-primary-300 dark:bg-primary-800"}},compoundVariants:[{intent:"primary",checked:"on",class:"bg-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"bg-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"bg-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"bg-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"bg-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}});function pt({intent:e,size:t,className:r,...a}){return jsxRuntime.jsx("button",{className:n(ct({intent:e,size:t}),r),...a})}function $r(e,t){for(let r of e){if(r.value===t)return r;if(r.children){let a=$r(r.children,t);if(a)return a}}}function jr(e){let t=[];for(let r of e)r.children?.length||t.push(r),r.children&&t.push(...jr(r.children));return t}var sr=40,jo=200,Gr=150,Pa=120;function or(e,t,r,a){if(!a)return {};if(r){let o=(t-1-e)*sr;return {animation:`dropdown-item-out ${Gr}ms ease-in both ${o}ms`}}let s=e*sr;return {animation:`dropdown-item-in ${jo}ms ease-out both ${s}ms`}}function Ma(e,t,r){if(!r)return {};if(t){let a=Math.max(e-1,0)*sr+Gr;return {animation:`dropdown-container-out ${Pa}ms ease-in both ${a}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function La({options:e,onSelect:t,animated:r=true,closing:a=false,depth:s=0}){let[o,l]=zt.useState(null),p=zt.useRef(void 0),x=c=>{p.current&&clearTimeout(p.current),l(c);},u=()=>{p.current=setTimeout(()=>l(null),150);};return zt.useEffect(()=>()=>{p.current&&clearTimeout(p.current);},[]),jsxRuntime.jsx("div",{className:n("absolute z-50 min-w-44 rounded-md border py-1 shadow-lg overflow-hidden","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",s===0?"mt-1 w-full":"top-0 ml-0.5"),style:{...s>0?{left:"100%"}:{},...Ma(e.length,a,r)},role:"listbox",children:e.map((c,w)=>{let b=!!c.children?.length,m=o===c.value;return jsxRuntime.jsxs("div",{className:"relative",style:or(w,e.length,a,r),onMouseEnter:()=>x(c.value),onMouseLeave:u,children:[jsxRuntime.jsxs("div",{role:"option","aria-selected":false,"aria-disabled":c.disabled,className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",c.disabled&&"pointer-events-none opacity-50"),onClick:()=>{c.disabled||b||t(c.value,c);},children:[c.icon&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1 truncate",children:c.label??c.value}),b&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),b&&m&&jsxRuntime.jsx(La,{options:c.children,onSelect:t,animated:r,depth:s+1})]},c.value)})})}function Go({options:e,filter:t,multiple:r,selected:a,canAdd:s,animated:o=true,closing:l=false,onSelect:p,onToggle:x,onAdd:u}){let c=zt.useMemo(()=>jr(e),[e]),w=t.toLowerCase(),b=t?c.filter(d=>(d.label??d.value).toLowerCase().includes(w)||d.value.toLowerCase().includes(w)):c,m=b.length===0&&!s||s?1:0,v=b.length+m;return jsxRuntime.jsxs("div",{className:n("absolute z-50 mt-1 w-full max-h-60 min-w-44 overflow-y-auto rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white"),role:"listbox","aria-multiselectable":r||void 0,style:Ma(v,l,o),children:[b.map((d,f)=>{let k=r&&a.includes(d.value);return jsxRuntime.jsxs("div",{role:"option","aria-selected":r?k:false,"aria-disabled":d.disabled,className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",d.disabled&&"pointer-events-none opacity-50"),style:or(f,v,l,o),onClick:()=>{d.disabled||(r?x(d.value):p(d.value,d));},children:[r&&jsxRuntime.jsx("span",{className:n("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",k?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:k&&jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"})}),d.icon&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:d.icon}),jsxRuntime.jsx("span",{className:"truncate",children:d.label??d.value})]},d.value)}),b.length===0&&!s&&jsxRuntime.jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:or(0,1,l,o),children:"No matches"}),s&&jsxRuntime.jsxs("div",{className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:or(b.length,v,l,o),onClick:u,children:[jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxRuntime.jsxs("span",{className:"truncate",children:["Add \u201C",t.trim(),"\u201D"]})]})]})}function Xr(e){let{options:t,placeholder:r="Select\u2026",editable:a=false,onAddItem:s,disabled:o=false,align:l="left",className:p,size:x="md",animated:u=true}=e,c=e.multiple===true,[w,b]=zt.useState(c?void 0:e.defaultValue),[m,v]=zt.useState(c?e.defaultSelected??[]:[]),d=c?e.selected??m:[],[f,k]=zt.useState(false),[g,L]=zt.useState(false),[N,T]=zt.useState(""),$=zt.useRef(null),C=zt.useRef(null),P=zt.useRef(void 0),A=zt.useCallback(()=>{if(!u||!f){k(false),T("");return}L(true);let R=(Math.max(t.length,1)-1)*sr+Gr+Pa+20;P.current=setTimeout(()=>{k(false),L(false),T("");},R);},[u,f,t.length]);zt.useEffect(()=>()=>{P.current&&clearTimeout(P.current);},[]);let V=c?void 0:e.value??w,y=zt.useMemo(()=>V?$r(t,V):void 0,[t,V]);zt.useEffect(()=>{if(!f)return;let _=R=>{$.current&&!$.current.contains(R.target)&&A();};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[f,A]),zt.useEffect(()=>{if(!f)return;let _=R=>{R.key==="Escape"&&A();};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[f,A]);let K=zt.useCallback((_,R)=>{c||(e.value===void 0&&b(_),e.onChange?.(_,R)),P.current&&clearTimeout(P.current),k(false),L(false),T("");},[c,e]),W=zt.useCallback(_=>{if(!c)return;let R=e.selected??m,q=R.includes(_)?R.filter(G=>G!==_):[...R,_];e.selected===void 0&&v(q),e.onSelectionChange?.(q);},[c,m,e]),ae=N.toLowerCase(),U=zt.useMemo(()=>!a||!N.trim()?false:!jr(t).some(R=>R.value.toLowerCase()===ae||(R.label??R.value).toLowerCase()===ae),[a,ae,t]),pe=zt.useCallback(()=>{let _=N.trim();_&&(s?.(_),T(""));},[N,s]),j=zt.useCallback(_=>{_.key==="Enter"&&U&&(_.preventDefault(),pe());},[U,pe]),Y=zt.useCallback(()=>{o||(f?A():(P.current&&clearTimeout(P.current),L(false),k(true),T(""),a&&requestAnimationFrame(()=>C.current?.focus())));},[o,f,A,a]),F;if(c){let _=d.length;_===0?F="":_<=2?F=d.map(R=>$r(t,R)).map(R=>R?R.label??R.value:"").filter(Boolean).join(", "):F=`${_} selected`;}else F=y?y.label??y.value:"";let oe=c||a;return jsxRuntime.jsxs("div",{ref:$,className:n("relative inline-block min-w-44",p),children:[jsxRuntime.jsxs("div",{className:n(dt({state:"default",size:x}),"flex cursor-pointer items-center gap-1",o&&"pointer-events-none opacity-50"),onClick:Y,role:"combobox","aria-expanded":f,"aria-haspopup":"listbox",children:[a?jsxRuntime.jsx("input",{ref:C,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-secondary-400 dark:placeholder:text-secondary-600",value:f?N:F,placeholder:r,disabled:o,onChange:_=>{T(_.target.value),f||k(true);},onKeyDown:j,onClick:_=>{_.stopPropagation(),f||k(true);}}):jsxRuntime.jsx("span",{className:n("flex-1 truncate",!F&&"text-secondary-400 dark:text-secondary-600"),children:F||r}),y?.icon&&!a&&!c&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:y.icon}),c&&d.length>0&&jsxRuntime.jsx("span",{className:"rounded-full bg-primary-100 px-1.5 text-xs font-semibold text-primary-700 dark:bg-primary-900 dark:text-primary-300",children:d.length}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:n("text-primary-400 h-4 w-4 shrink-0 transition-transform",f&&"rotate-180")})]}),f&&jsxRuntime.jsx("div",{className:n(l==="right"?"right-0":"left-0","absolute w-full"),children:oe?jsxRuntime.jsx(Go,{options:t,filter:N,multiple:c,selected:d,canAdd:U,animated:u,closing:g,onSelect:K,onToggle:W,onAdd:pe}):jsxRuntime.jsx(La,{options:t,onSelect:K,animated:u,closing:g})})]})}function Wo(e,t){return e.key??(typeof e.label=="string"?e.label:String(t))}var ir=40,Yo=200,Zr=150,Sa=120;function Yr(e,t,r,a){if(!a)return {};if(r){let o=(t-1-e)*ir;return {animation:`dropdown-item-out ${Zr}ms ease-in both ${o}ms`}}let s=e*ir;return {animation:`dropdown-item-in ${Yo}ms ease-out both ${s}ms`}}function Zo(e,t,r){if(!r)return {};if(t){let a=Math.max(e-1,0)*ir+Zr;return {animation:`dropdown-container-out ${Sa}ms ease-in both ${a}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function ft({label:e,items:t,intent:r,size:a,align:s="left",className:o,disabled:l,editable:p=false,onAddItem:x,multiple:u=false,selected:c=[],onSelectionChange:w,animated:b=true,chevron:m=true,...v}){let[d,f]=zt.useState(false),[k,g]=zt.useState(false),[L,N]=zt.useState(""),T=zt.useRef(null),$=zt.useRef(null),C=zt.useRef(void 0);zt.useEffect(()=>()=>{C.current&&clearTimeout(C.current);},[]);let P=zt.useCallback(()=>{if(!b||!d){f(false),N("");return}g(true);let oe=(Math.max(t.length,1)-1)*ir+Zr+Sa+20;C.current=setTimeout(()=>{f(false),g(false),N("");},oe);},[b,d,t.length]),A=zt.useCallback(()=>{l||(d?P():(C.current&&clearTimeout(C.current),g(false),f(true),N(""),p&&requestAnimationFrame(()=>$.current?.focus())));},[l,d,P,p]);zt.useEffect(()=>{if(!d)return;let F=oe=>{T.current&&!T.current.contains(oe.target)&&P();};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[d,P]),zt.useEffect(()=>{if(!d)return;let F=oe=>{oe.key==="Escape"&&P();};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[d,P]);let V=L.toLowerCase(),y=zt.useMemo(()=>L?t.filter(F=>(typeof F.label=="string"?F.label:F.key??"").toLowerCase().includes(V)):t,[t,V]),K=zt.useMemo(()=>!p||!L.trim()?false:!t.some(F=>(typeof F.label=="string"?F.label:F.key??"").toLowerCase()===V),[p,V,t]),W=zt.useCallback(()=>{let F=L.trim();F&&(x?.(F),N(""));},[L,x]),ae=zt.useCallback(F=>{F.key==="Enter"&&K&&(F.preventDefault(),W());},[K,W]),U=zt.useCallback(F=>{let oe=c.includes(F)?c.filter(_=>_!==F):[...c,F];w?.(oe);},[c,w]),pe=u&&c.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e," ",jsxRuntime.jsx("span",{className:"ml-1 rounded-full bg-white/20 px-1.5 text-xs font-semibold",children:c.length})]}):e,j=y.length===0&&!K||K?1:0,Y=y.length+j;return jsxRuntime.jsxs("div",{ref:T,className:"relative inline-block",children:[jsxRuntime.jsxs("button",{type:"button",onClick:A,disabled:l,className:n(ct({intent:r,size:a}),"inline-flex items-center gap-1",o),"aria-haspopup":u?"listbox":"true","aria-expanded":d?"true":"false",...v,children:[pe,m&&jsxRuntime.jsx(lucideReact.ChevronDown,{className:n("h-3.5 w-3.5 transition-transform",d&&"rotate-180")})]}),d&&jsxRuntime.jsxs("div",{className:n("absolute z-50 mt-1 min-w-44 rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",s==="right"?"right-0":"left-0"),style:Zo(Y,k,b),role:u?"listbox":"menu","aria-multiselectable":u||void 0,children:[p&&jsxRuntime.jsx("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children:jsxRuntime.jsx("input",{ref:$,type:"text",value:L,onChange:F=>N(F.target.value),onKeyDown:ae,placeholder:"Type to filter or add\u2026",className:"w-full bg-transparent text-sm text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600"})}),jsxRuntime.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[y.map((F,oe)=>{let _=Wo(F,oe),R=u&&c.includes(_);return jsxRuntime.jsxs(zt__default.default.Fragment,{children:[F.divider&&jsxRuntime.jsx("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),jsxRuntime.jsxs("button",{type:"button",role:u?"option":"menuitem","aria-selected":u?R:void 0,disabled:F.disabled,className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",F.disabled&&"pointer-events-none opacity-50"),style:Yr(oe,Y,k,b),onClick:()=>{u?U(_):(F.onClick?.(),C.current&&clearTimeout(C.current),f(false),g(false),N(""));},children:[u&&jsxRuntime.jsx("span",{className:n("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",R?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:R&&jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"})}),jsxRuntime.jsx("span",{className:"flex-1 truncate",children:F.label})]})]},_)}),y.length===0&&!K&&jsxRuntime.jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:Yr(0,1,k,b),children:"No matches"}),K&&jsxRuntime.jsxs("button",{type:"button",className:n("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:Yr(y.length,Y,k,b),onClick:W,children:[jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxRuntime.jsxs("span",{className:"truncate",children:["Add \u201C",L.trim(),"\u201D"]})]})]})]})]})}function Qr({intent:e,size:t,className:r,...a}){return jsxRuntime.jsx("span",{className:n(Zt({intent:e,size:t}),r),...a})}var es={danger:"bg-danger-500",success:"bg-success-500",warning:"bg-warning-500",info:"bg-primary-500",primary:"bg-secondary-500"};function Jr({children:e,show:t=true,content:r,dot:a,intent:s="danger",size:o="md",placement:l="top-right",pulse:p=false,className:x}){let u=a??r==null,c=u?null:typeof r=="number"?r>99?"99+":String(r):r;return jsxRuntime.jsxs("div",{className:"relative inline-flex",children:[e,t&&jsxRuntime.jsxs("span",{className:n(Qt({intent:s,size:o,dot:u,placement:l}),x),role:typeof r=="number"?"status":void 0,"aria-label":typeof r=="number"?String(r):void 0,children:[p&&jsxRuntime.jsx("span",{className:n("absolute inset-0 rounded-full animate-ping opacity-60",es[s??"danger"]),"aria-hidden":"true"}),c]})]})}function en({intent:e,size:t,className:r,...a}){return jsxRuntime.jsx("label",{className:n(Jt({intent:e,size:t}),r),...a})}var ns={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"}},as={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 tn({state:e="default",inputSize:t="md",className:r,prefix:a,suffix:s,action:o,...l}){if(!a&&!s&&!o)return jsxRuntime.jsx("input",{className:n(dt({state:e,size:t}),r),...l});let p=ns[t??"md"],x=as[e??"default"];return jsxRuntime.jsxs("div",{className:n("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",p.wrapper,x,r),children:[a&&jsxRuntime.jsx("span",{className:n("flex shrink-0 items-center gap-1.5 self-stretch border-r border-secondary-300 bg-secondary-50 font-medium text-secondary-600 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300",p.prefix),children:a}),jsxRuntime.jsx("input",{className:n("min-w-0 flex-1 bg-transparent text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600",p.input,a&&"pl-2"),...l}),s&&jsxRuntime.jsx("span",{className:n("pointer-events-none flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",p.icon),children:s}),o&&jsxRuntime.jsx("button",{type:"button",onClick:o.onClick,"aria-label":o["aria-label"]??"Action",className:n("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",p.icon),children:o.icon})]})}var cs={sm:"px-2 py-1.5 text-xs min-h-[60px]",md:"px-3 py-2 text-sm min-h-[80px]",lg:"px-4 py-2.5 text-base min-h-[100px]"},ds={default:"border-secondary-400 focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus:border-danger-500 focus:ring-2 focus:ring-danger-500/20"};function ps(e){if(!e)return 0;let t="\u2E80-\u2EFF\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF",r=new RegExp(`[${t}]`),a=0,s="",o=()=>{let l=s.trim();l&&(a+=l.split(/\s+/).length),s="";};for(let l of e)r.test(l)?(o(),a+=1):s+=l;return o(),a}function rn({state:e="default",size:t="md",showWordCount:r=false,maxWords:a,className:s,value:o,defaultValue:l,onChange:p,disabled:x,...u}){let[c,w]=zt.useState(()=>l??""),b=o!==void 0?String(o):c,m=zt.useCallback(f=>{o===void 0&&w(f.target.value),p?.(f);},[o,p]),v=zt.useMemo(()=>ps(b),[b]),d=a!=null&&v>a;return jsxRuntime.jsxs("div",{className:n("inline-flex w-full flex-col",s),children:[jsxRuntime.jsx("textarea",{value:b,onChange:m,disabled:x,className:n("w-full resize-y rounded-md border bg-white text-secondary-900 transition-colors placeholder:text-secondary-400 focus:outline-none dark:bg-secondary-900 dark:text-secondary-100 dark:placeholder:text-secondary-600",cs[t],ds[d?"error":e],x&&"pointer-events-none opacity-50"),...u}),(r||a!=null)&&jsxRuntime.jsx("span",{className:n("mt-1 self-end text-xs",d?"text-danger-500 dark:text-danger-400":"text-secondary-400 dark:text-secondary-500"),children:a!=null?`${v} / ${a} words`:`${v} words`})]})}var bs={sm:{trackFixed:"h-5 w-9",trackH:"h-5 min-w-9",thumb:"h-3.5 w-3.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-16px)]",pad:"pl-[6px] pr-[18px]",contentLeft:"left-[6px]",contentRight:"right-[6px]",icon:"text-[10px] [&_svg]:h-3 [&_svg]:w-3"},md:{trackFixed:"h-6 w-11",trackH:"h-6 min-w-11",thumb:"h-4.5 w-4.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-20px)]",pad:"pl-[7px] pr-[23px]",contentLeft:"left-[7px]",contentRight:"right-[7px]",icon:"text-xs [&_svg]:h-3.5 [&_svg]:w-3.5"},lg:{trackFixed:"h-7 w-14",trackH:"h-7 min-w-14",thumb:"h-5.5 w-5.5",thumbTop:"top-[3px]",thumbOff:"left-[3px]",thumbOn:"left-[calc(100%-25px)]",pad:"pl-[8px] pr-[28px]",contentLeft:"left-[8px]",contentRight:"right-[8px]",icon:"text-sm [&_svg]:h-4 [&_svg]:w-4"}},xs={primary:"text-primary-100",secondary:"text-secondary-100",danger:"text-danger-100",warning:"text-warning-100",success:"text-success-100"};function nn({checked:e,defaultChecked:t=false,onCheckedChange:r,checkedContent:a,uncheckedContent:s,intent:o,size:l,label:p,id:x,className:u,disabled:c,...w}){let b=zt.useId(),m=x??b,v=l??"md",d=o??"primary",f=bs[v],k=a!=null||s!=null,[g,L]=zt.useState(t),N=e??g,T=zt.useCallback($=>{let C=$.target.checked;e===void 0&&L(C),r?.(C);},[e,r]);return jsxRuntime.jsxs("label",{htmlFor:m,className:n("inline-flex cursor-pointer items-center gap-2",c&&"pointer-events-none opacity-50",u),children:[jsxRuntime.jsx("input",{...w,id:m,type:"checkbox",role:"switch",className:"sr-only",checked:N,disabled:c,onChange:T,"aria-checked":N}),jsxRuntime.jsxs("span",{className:n("relative inline-flex shrink-0 items-center rounded-full transition-colors duration-200",k?f.trackH:f.trackFixed,rr({intent:o,size:l,checked:N?"on":"off"})),children:[k?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:n("pointer-events-none invisible inline-grid",f.icon),children:[jsxRuntime.jsx("span",{className:n("[grid-area:1/1] whitespace-nowrap",f.pad),children:a}),jsxRuntime.jsx("span",{className:n("[grid-area:1/1] whitespace-nowrap",f.pad),children:s})]}),jsxRuntime.jsx("span",{className:n("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",f.contentLeft,f.icon,xs[d],N?"opacity-100":"opacity-0"),children:a}),jsxRuntime.jsx("span",{className:n("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",f.contentRight,f.icon,"text-primary-400 dark:text-primary-500",N?"opacity-0":"opacity-100"),children:s})]}):null,jsxRuntime.jsx("span",{className:n("pointer-events-none absolute rounded-full bg-white shadow-sm transition-[left] duration-200 ease-in-out",f.thumb,f.thumbTop,N?f.thumbOn:f.thumbOff)})]}),p&&jsxRuntime.jsx("span",{className:"select-none text-sm text-primary-700 dark:text-primary-300",children:p})]})}var ks={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function an({checked:e,defaultChecked:t=false,indeterminate:r=false,onCheckedChange:a,intent:s,size:o,label:l,id:p,className:x,disabled:u,...c}){let w=zt.useId(),b=p??w,m=o??"md",[v,d]=zt.useState(t),f=e??v,k=zt.useCallback(L=>{let N=L.target.checked;e===void 0&&d(N),a?.(N);},[e,a]),g=f||r;return jsxRuntime.jsxs("label",{htmlFor:b,className:n("inline-flex cursor-pointer items-center gap-2 select-none",u&&"pointer-events-none opacity-50",x),children:[jsxRuntime.jsx("input",{...c,id:b,type:"checkbox",className:"sr-only",checked:f,disabled:u,onChange:k}),jsxRuntime.jsx("span",{className:n(er({intent:s,size:o,checked:g?"on":"off"})),children:jsxRuntime.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:n("text-white transition-all duration-200",ks[m],g?"scale-100 opacity-100":"scale-0 opacity-0"),children:r?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"})})}),l&&jsxRuntime.jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:l})]})}var Ha=zt.createContext(null);function on({name:e,value:t,defaultValue:r,onValueChange:a,intent:s,size:o,disabled:l,orientation:p="vertical",className:x,children:u}){let c=zt.useId(),w=e??c,[b,m]=zt.useState(r),v=t??b,d=zt.useCallback(f=>{t===void 0&&m(f),a?.(f);},[t,a]);return jsxRuntime.jsx(Ha.Provider,{value:{name:w,value:v,onChange:d,intent:s,size:o,disabled:l},children:jsxRuntime.jsx("div",{role:"radiogroup",className:n("flex gap-2",p==="vertical"?"flex-col":"flex-row flex-wrap",x),children:u})})}var Ps={sm:"h-1.5 w-1.5",md:"h-2 w-2",lg:"h-2.5 w-2.5"};function sn({value:e,intent:t,size:r,label:a,id:s,className:o,disabled:l,...p}){let x=zt.useId(),u=s??x,c=zt.useContext(Ha),w=t??c?.intent,b=r??c?.size,m=b??"md",v=l??c?.disabled,d=p.name??c?.name,f=c?c.value===e:void 0,k=zt.useCallback(g=>{g.target.checked&&c?.onChange(e);},[c,e]);return jsxRuntime.jsxs("label",{htmlFor:u,className:n("inline-flex cursor-pointer items-center gap-2 select-none",v&&"pointer-events-none opacity-50",o),children:[jsxRuntime.jsx("input",{...p,id:u,type:"radio",name:d,value:e,className:"sr-only",checked:f,disabled:v,onChange:k}),jsxRuntime.jsx("span",{className:n(tr({intent:w,size:b,checked:f?"on":"off"})),children:jsxRuntime.jsx("span",{className:n("rounded-full bg-white transition-all duration-200",Ps[m],f?"scale-100 opacity-100":"scale-0 opacity-0")})}),a&&jsxRuntime.jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:a})]})}var Ls={Button:pt,Dropdown:Xr,DropdownButton:ft,Badge:Qr,Indicator:Jr,Label:en,Input:tn,TextBox:rn,Switch:nn,Checkbox:an,Radio:sn,RadioGroup:on},ln=Ls;var Dt=classVarianceAuthority.cva("rounded-lg transition-shadow",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",elevated:"bg-white shadow-md hover:shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25 dark:hover:shadow-primary-200/30",outlined:"border-2 border-primary-300 bg-transparent dark:border-primary-600",ghost:"bg-primary-50 dark:bg-primary-800/50"},size:{sm:"p-3",md:"p-5",lg:"p-7"}},defaultVariants:{intent:"default",size:"md"}}),cr=classVarianceAuthority.cva("rounded-md",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",inset:"bg-primary-50 dark:bg-primary-800/50",elevated:"bg-white shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25"},size:{sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{intent:"default",size:"md"}});function cn({intent:e,size:t,className:r,...a}){return jsxRuntime.jsx("div",{className:n(Dt({intent:e,size:t}),r),...a})}function Es({className:e,...t}){return jsxRuntime.jsx("div",{className:n("mb-4 space-y-1",e),...t})}function Ss({className:e,...t}){return jsxRuntime.jsx("h3",{className:n("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function Vs({className:e,...t}){return jsxRuntime.jsx("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Ds({className:e,...t}){return jsxRuntime.jsx("div",{className:n("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function Is({className:e,...t}){return jsxRuntime.jsx("div",{className:n("border-primary-100 dark:border-primary-800 mt-4 flex items-center gap-2 border-t pt-4",e),...t})}function As({intent:e,media:t,mediaPosition:r="left",stackOnMobile:a=false,className:s,children:o,...l}){let p=jsxRuntime.jsx("div",{className:n("relative shrink-0 overflow-hidden",a?"h-48 w-full rounded-t-lg sm:h-auto sm:w-auto":"",!a&&(r==="left"?"rounded-l-lg":"rounded-r-lg")),style:a?void 0:{width:t.width??"10rem"},children:t.src?jsxRuntime.jsx("img",{src:t.src,alt:t.alt??"",className:"h-full w-full object-cover",draggable:false}):t.icon?jsxRuntime.jsx("div",{className:"bg-primary-100 text-primary-500 dark:bg-primary-800 dark:text-primary-400 flex h-full w-full items-center justify-center",children:t.icon}):null});return jsxRuntime.jsxs("div",{className:n(Dt({intent:e}),"flex overflow-hidden p-0",a?"flex-col sm:flex-row":"",!a&&r==="right"&&"flex-row-reverse",!a&&r==="left"&&"flex-row",s),...l,children:[p,jsxRuntime.jsx("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:o})]})}function dn({src:e,alt:t="",aspectRatio:r="16/9",className:a,children:s,...o}){return jsxRuntime.jsxs("div",{className:n("group overflow-hidden rounded-xl border transition-shadow duration-300","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white","dark:hover:shadow-primary-900/60 hover:shadow-lg",a),...o,children:[jsxRuntime.jsxs("div",{className:"relative overflow-hidden",style:{aspectRatio:r},children:[jsxRuntime.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover transition-transform duration-500 ease-out group-hover:scale-110",draggable:false}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100","aria-hidden":true,children:jsxRuntime.jsx("div",{className:"animate-light-sweep absolute inset-0"})})]}),s]})}function Fs({className:e,...t}){return jsxRuntime.jsx("div",{className:n("space-y-2 p-4",e),...t})}function _s({className:e,...t}){return jsxRuntime.jsx("h3",{className:n("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function zs({className:e,...t}){return jsxRuntime.jsx("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Os({className:e,...t}){return jsxRuntime.jsx("div",{className:n("border-primary-100 dark:border-primary-800 flex items-center gap-2 border-t px-4 py-3",e),...t})}function pn({intent:e,size:t,className:r,...a}){return jsxRuntime.jsx("div",{className:n(cr({intent:e,size:t}),r),...a})}function Bs({className:e,...t}){return jsxRuntime.jsx("div",{className:n("border-primary-200 text-primary-900 dark:border-primary-700 dark:text-primary-100 mb-3 flex items-center gap-1.5 border-b pb-3 text-sm font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function Ks({className:e,...t}){return jsxRuntime.jsx("div",{className:n("text-primary-700 dark:text-primary-300 text-sm",e),...t})}var $s={Card:cn,ImageCard:dn,Panel:pn},un=$s;var dr=classVarianceAuthority.cva("w-full text-left text-sm",{variants:{intent:{default:"",striped:"[&_tbody_tr:nth-child(even)]:bg-primary-50 dark:[&_tbody_tr:nth-child(even)]:bg-primary-800/30",bordered:"[&_th]:border [&_td]:border [&_th]:border-primary-200 [&_td]:border-primary-200 dark:[&_th]:border-primary-700 dark:[&_td]:border-primary-700"},density:{compact:"[&_th]:px-2 [&_th]:py-1 [&_td]:px-2 [&_td]:py-1",default:"",relaxed:"[&_th]:px-6 [&_th]:py-5 [&_td]:px-6 [&_td]:py-5"}},defaultVariants:{intent:"default",density:"default"}}),pr=classVarianceAuthority.cva("text-sm text-primary-700 dark:text-primary-300",{variants:{intent:{default:"space-y-1",bordered:"divide-y divide-primary-200 rounded-lg border border-primary-200 dark:divide-primary-700 dark:border-primary-700 [&>li]:px-4 [&>li]:py-2",hover:"[&>li]:rounded-md [&>li]:px-3 [&>li]:py-2 [&>li]:transition-colors [&>li:hover]:bg-primary-50 dark:[&>li:hover]:bg-primary-800/50"}},defaultVariants:{intent:"default"}}),mr=classVarianceAuthority.cva("group flex w-full items-center gap-1.5 text-left [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",md:"py-1.5 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"py-2 text-base [&_svg]:h-4 [&_svg]:w-4"}},defaultVariants:{size:"md"}}),ur=classVarianceAuthority.cva("flex cursor-pointer items-center gap-1 rounded transition-colors [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-1 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-1.5 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),At=classVarianceAuthority.cva("overflow-x-auto rounded-lg font-mono [background:var(--color-syntax-bg)] [&_pre]:m-0 [&_pre]:p-4 [&_code]:bg-transparent",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}});function _t({intent:e,density:t,className:r,...a}){return jsxRuntime.jsx("div",{className:"w-full overflow-auto",children:jsxRuntime.jsx("table",{className:n(dr({intent:e,density:t}),r),...a})})}function gn({className:e,...t}){return jsxRuntime.jsx("thead",{className:n("bg-primary-50 text-primary-600 dark:bg-primary-800/50 dark:text-primary-400",e),...t})}function bn({className:e,...t}){return jsxRuntime.jsx("tbody",{className:n("[&_tr:last-child]:border-0",e),...t})}function Ft({className:e,...t}){return jsxRuntime.jsx("tr",{className:n("border-primary-200 hover:bg-primary-50/50 dark:border-primary-700 dark:hover:bg-primary-800/30 border-b transition-colors",e),...t})}function rt({className:e,...t}){return jsxRuntime.jsx("th",{className:n("px-4 py-3 text-left text-xs font-semibold tracking-wider uppercase",e),...t})}function nt({className:e,...t}){return jsxRuntime.jsx("td",{className:n("text-primary-700 dark:text-primary-300 px-4 py-3",e),...t})}function xn({icon:e,text:t="No data",className:r}){return jsxRuntime.jsxs("div",{className:n("flex flex-col items-center justify-center gap-3 py-16 text-primary-400 dark:text-primary-500",r),children:[e??jsxRuntime.jsx(lucideReact.Inbox,{className:"h-12 w-12 stroke-[1.2]"}),jsxRuntime.jsx("span",{className:"text-sm",children:t})]})}var za={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"};function ti({columns:e,data:t,sort:r,onSortChange:a,defaultSort:s=null,rowKey:o,rowActions:l,intent:p,density:x,className:u,empty:c}){let[w,b]=zt.useState(s),m=r??w,v=zt.useCallback(f=>{let k=m?.column===f?m.direction==="asc"?{column:f,direction:"desc"}:null:{column:f,direction:"asc"};a?a(k):b(k);},[m,a]),d=zt.useMemo(()=>{if(!m)return t;let f=e.find(L=>L.key===m.column);if(!f)return t;let k=f.compareFn??((L,N)=>{let T=f.cell(L),$=f.cell(N);return T==null&&$==null?0:T==null?-1:$==null?1:typeof T=="number"&&typeof $=="number"?T-$:String(T).localeCompare(String($))}),g=[...t].sort(k);return m.direction==="desc"?g.reverse():g},[t,m,e]);return jsxRuntime.jsxs(_t,{intent:p,density:x,className:u,children:[jsxRuntime.jsx(gn,{children:jsxRuntime.jsxs(Ft,{children:[e.map(f=>{let k=f.sortable!==false,g=m?.column===f.key;return jsxRuntime.jsx(rt,{className:n(k&&"cursor-pointer select-none",f.headerClassName,f.hideBelow&&za[f.hideBelow]),onClick:k?()=>v(f.key):void 0,"aria-sort":g?m.direction==="asc"?"ascending":"descending":void 0,children:jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1",children:[f.header,k&&jsxRuntime.jsx(Oa,{active:g,direction:g?m.direction:null})]})},f.key)}),l&&jsxRuntime.jsx(rt,{className:"w-20 text-right",children:"Actions"})]})}),jsxRuntime.jsx(bn,{children:d.length===0?jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:e.length+(l?1:0),children:jsxRuntime.jsx(xn,{...c})})}):d.map((f,k)=>jsxRuntime.jsxs(Ft,{children:[e.map(g=>jsxRuntime.jsx(nt,{className:n(g.cellClassName,g.hideBelow&&za[g.hideBelow]),children:g.cell(f)},g.key)),l&&jsxRuntime.jsx(nt,{className:"text-right",children:jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1",children:l(f)})})]},o?o(f,k):k))})]})}function ri({value:e,onCommit:t,onCancel:r}){let[a,s]=zt.useState(e),o=zt.useRef(null);zt.useEffect(()=>{o.current?.focus(),o.current?.select();},[]);let l=()=>t(a);return jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("input",{ref:o,type:"text",value:a,onChange:p=>s(p.target.value),onKeyDown:p=>{p.key==="Enter"&&l(),p.key==="Escape"&&r();},"aria-label":"Edit cell",className:"min-w-0 flex-1 rounded border border-primary-400 bg-white px-1.5 py-0.5 text-sm outline-none focus:ring-1 focus:ring-primary-400 dark:border-primary-600 dark:bg-secondary-800"}),jsxRuntime.jsx("button",{type:"button",onClick:l,className:"text-success-600 hover:text-success-700 dark:text-success-400","aria-label":"Confirm",children:jsxRuntime.jsx(lucideReact.Check,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:r,className:"text-danger-500 hover:text-danger-600 dark:text-danger-400","aria-label":"Cancel",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})}function ni({columns:e,data:t,rowKey:r,sort:a,onSortChange:s,defaultSort:o=null,selectionMode:l="none",selected:p,onSelectionChange:x,editable:u=false,onCellEdit:c,toolbar:w=false,onAdd:b,onDelete:m,rowActions:v,intent:d,density:f,className:k,empty:g}){let[L,N]=zt.useState(o),T=a??L,$=zt.useCallback(R=>{let q=T?.column===R?T.direction==="asc"?{column:R,direction:"desc"}:null:{column:R,direction:"asc"};s?s(q):N(q);},[T,s]),C=zt.useMemo(()=>{if(!T)return t;let R=e.find(H=>H.key===T.column);if(!R)return t;let q=R.compareFn??((H,E)=>{let se=R.cell(H),Q=R.cell(E);return se==null&&Q==null?0:se==null?-1:Q==null?1:typeof se=="number"&&typeof Q=="number"?se-Q:String(se).localeCompare(String(Q))}),G=[...t].sort(q);return T.direction==="desc"?G.reverse():G},[t,T,e]),[P,A]=zt.useState([]),V=p??P,y=x??A,K=zt.useMemo(()=>C.map((R,q)=>r(R,q)),[C,r]),W=l==="multiple"&&K.length>0&&K.every(R=>V.includes(R)),ae=l==="multiple"&&V.length>0&&!W,U=zt.useCallback(R=>{l==="single"?y(V.includes(R)?[]:[R]):l==="multiple"&&y(V.includes(R)?V.filter(q=>q!==R):[...V,R]);},[l,V,y]),pe=zt.useCallback(()=>{y(W?[]:K);},[W,K,y]),[j,Y]=zt.useState(null),F=zt.useCallback((R,q,G)=>{u&&G!==false&&Y({rowKey:R,colKey:q});},[u]),oe=zt.useCallback((R,q,G)=>{c?.(R,q,G),Y(null);},[c]);return jsxRuntime.jsxs("div",{className:"space-y-2",children:[w&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[b&&jsxRuntime.jsxs("button",{type:"button",onClick:b,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"h-3.5 w-3.5"})," Add"]}),m&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>m(V),disabled:V.length===0,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-danger-600 transition-colors hover:bg-danger-50 disabled:opacity-40 disabled:pointer-events-none dark:border-secondary-600 dark:bg-secondary-800 dark:text-danger-400 dark:hover:bg-danger-900/20",children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-3.5 w-3.5"})," Delete",V.length>0&&` (${V.length})`]}),u&&V.length===1&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let R=e.find(q=>q.editable!==false);R&&Y({rowKey:V[0],colKey:R.key});},className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsxRuntime.jsx(lucideReact.Pencil,{className:"h-3.5 w-3.5"})," Edit"]}),V.length>0&&jsxRuntime.jsxs("span",{className:"ml-auto text-sm text-secondary-500 dark:text-secondary-400",children:[V.length," row",V.length>1?"s":""," selected"]})]}),jsxRuntime.jsxs(_t,{intent:d,density:f,className:k,children:[jsxRuntime.jsx(gn,{children:jsxRuntime.jsxs(Ft,{children:[l==="multiple"&&jsxRuntime.jsx(rt,{className:"w-10",children:jsxRuntime.jsx("input",{type:"checkbox",checked:W,ref:R=>{R&&(R.indeterminate=ae);},onChange:pe,className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select all"})}),l==="single"&&jsxRuntime.jsx(rt,{className:"w-10"}),e.map(R=>{let q=R.sortable!==false,G=T?.column===R.key;return jsxRuntime.jsx(rt,{className:n(q&&"cursor-pointer select-none",R.headerClassName),onClick:q?()=>$(R.key):void 0,"aria-sort":G?T.direction==="asc"?"ascending":"descending":void 0,children:jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1",children:[R.header,q&&jsxRuntime.jsx(Oa,{active:G,direction:G?T.direction:null})]})},R.key)}),v&&jsxRuntime.jsx(rt,{className:"w-20 text-right",children:"Actions"})]})}),jsxRuntime.jsx(bn,{children:C.length===0?jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:e.length+(l!=="none"?1:0)+(v?1:0),children:jsxRuntime.jsx(xn,{...g})})}):C.map((R,q)=>{let G=r(R,q),H=V.includes(G);return jsxRuntime.jsxs(Ft,{className:n(H&&"bg-primary-50/60 dark:bg-primary-900/20"),onClick:()=>{l!=="none"&&U(G);},children:[l==="multiple"&&jsxRuntime.jsx(nt,{className:"w-10",children:jsxRuntime.jsx("input",{type:"checkbox",checked:H,onChange:()=>U(G),onClick:E=>E.stopPropagation(),className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select row"})}),l==="single"&&jsxRuntime.jsx(nt,{className:"w-10",children:jsxRuntime.jsx("input",{type:"radio",checked:H,onChange:()=>U(G),onClick:E=>E.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-primary-600","aria-label":"Select row"})}),e.map(E=>{let se=j?.rowKey===G&&j?.colKey===E.key,Q=E.editValue?.(R)??(()=>{let ie=E.cell(R);return typeof ie=="string"||typeof ie=="number"?String(ie):""})();return jsxRuntime.jsx(nt,{className:n(E.cellClassName,u&&E.editable!==false&&"cursor-text"),onDoubleClick:ie=>{ie.stopPropagation(),F(G,E.key,E.editable);},children:se?jsxRuntime.jsx(ri,{value:Q,onCommit:ie=>oe(G,E.key,ie),onCancel:()=>Y(null)}):E.cell(R)},E.key)}),v&&jsxRuntime.jsx(nt,{className:"text-right",onClick:E=>E.stopPropagation(),children:jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1",children:v(R)})})]},G)})})]})]})}function Oa({active:e,direction:t}){let r="h-3.5 w-3.5 shrink-0";return !e||!t?jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:n(r,"opacity-30")}):t==="asc"?jsxRuntime.jsx(lucideReact.ArrowUp,{className:n(r,"opacity-70")}):jsxRuntime.jsx(lucideReact.ArrowDown,{className:n(r,"opacity-70")})}var Ba=zt.createContext({size:"md"});function yn({intent:e,size:t="md",className:r,...a}){return jsxRuntime.jsx(Ba.Provider,{value:{size:t},children:jsxRuntime.jsx("ul",{className:n(pr({intent:e}),r),...a})})}function si({actions:e,className:t,children:r,...a}){let{size:s}=zt.useContext(Ba);return jsxRuntime.jsxs("li",{className:n(mr({size:s}),t),...a,children:[jsxRuntime.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:r}),e&&jsxRuntime.jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",children:e})]})}var ja=zt.createContext({showLines:true,expandedKeys:null,onToggleKey:()=>{},size:"md"});function hn({showLines:e=true,showRoot:t=true,expandedKeys:r,defaultExpandedKeys:a="all",onExpandedKeysChange:s,size:o="md",className:l,children:p,...x}){let [u,c]=zt.useState(()=>a),b=zt.useCallback(v=>{if(r){let d=new Set(r);d.has(v)?d.delete(v):d.add(v),s?.(d);}else c(d=>{if(d==="all")return new Set(["__ALL_MINUS__",v]);let f=new Set(d);return f.has(v)?f.delete(v):f.add(v),f});},[r,s]),m=r??(u==="all"?null:u);return jsxRuntime.jsx(ja.Provider,{value:{showLines:e,expandedKeys:m,onToggleKey:b,size:o},children:t?jsxRuntime.jsx("ul",{className:n("text-sm",l),role:"tree",...x,children:p}):jsxRuntime.jsx("ul",{className:n("text-sm",l),role:"tree",...x,children:jsxRuntime.jsx(mi,{children:p})})})}function mi({children:e}){let t=Ga(e);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:t.map(r=>zt__default.default.isValidElement(r)&&r.props.children?r.props.children:null)})}function Ga(e){let t=[];return zt__default.default.Children.forEach(e,r=>{zt__default.default.isValidElement(r)&&r.type===zt__default.default.Fragment?t.push(...Ga(r.props.children)):t.push(r);}),t}function ui({nodeKey:e,label:t,icon:r,actions:a,defaultExpanded:s=false,expanded:o,onToggle:l,children:p,className:x}){let{showLines:u,expandedKeys:c,onToggleKey:w,size:b}=zt.useContext(ja),[m,v]=zt.useState(s),d=zt__default.default.Children.count(p)>0,f=e??(typeof t=="string"?t:""),k;o!=null?k=o:c!=null&&f?c.has("__ALL_MINUS__")?k=!c.has(f):k=c.has(f):k=m;let g=()=>{let L=!k;l?l(L):c!=null&&f?w(f):v(L);};return jsxRuntime.jsxs("li",{className:n("select-none",x),role:"treeitem","aria-expanded":d?k:void 0,children:[jsxRuntime.jsxs("div",{className:n("group hover:bg-primary-50 dark:hover:bg-primary-800/50 rounded-md px-1",ur({size:b}),d?"cursor-pointer":"cursor-default"),onClick:d?g:void 0,children:[d?jsxRuntime.jsx(lucideReact.ChevronRight,{className:n("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",k&&"rotate-90")}):jsxRuntime.jsx("span",{className:"w-4 shrink-0"}),r&&jsxRuntime.jsx("span",{className:"shrink-0",children:r}),jsxRuntime.jsx("span",{className:"text-primary-700 dark:text-primary-300 min-w-0 flex-1 truncate",children:t}),a&&jsxRuntime.jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",onClick:L=>L.stopPropagation(),children:a})]}),d&&jsxRuntime.jsx("div",{className:n("grid transition-[grid-template-rows] duration-200 ease-out",k?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("ul",{className:n("ml-4 pl-2",u&&"border-primary-200 dark:border-primary-700 border-l"),role:"group",children:p})})})]})}function xi({avatar:e,sender:t}){return e?typeof e=="string"?/^(?:https?|data|blob):/.test(e)?jsxRuntime.jsx("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:false}):jsxRuntime.jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):jsxRuntime.jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function yi({msg:e,alignRight:t}){return jsxRuntime.jsxs("div",{className:n("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsxRuntime.jsx(xi,{avatar:e.avatar,sender:e.sender}),jsxRuntime.jsxs("div",{className:n("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[jsxRuntime.jsx("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),jsxRuntime.jsx("div",{className:n("rounded-xl px-3 py-2 text-sm leading-relaxed",t?"rounded-tr-sm bg-primary-500 text-white dark:bg-primary-600":"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-200 rounded-tl-sm"),children:e.content}),e.time&&jsxRuntime.jsx("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function wn({messages:e,mode:t="split",autoScroll:r=true,className:a,...s}){let o=zt.useRef(null);return zt.useEffect(()=>{r&&o.current?.scrollIntoView({behavior:"smooth"});},[e,r]),jsxRuntime.jsxs("div",{className:n("flex flex-col gap-4 overflow-y-auto rounded-lg border p-4","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white",a),...s,children:[e.map(l=>{let p=t==="split"&&!!l.self;return jsxRuntime.jsx(yi,{msg:l,alignRight:p},l.id)}),jsxRuntime.jsx("div",{ref:o})]})}var wi={name:"onyx-css-vars",type:"dark",settings:[{settings:{foreground:"var(--color-syntax-plain)",background:"var(--color-syntax-bg)"}},{scope:["comment","punctuation.definition.comment"],settings:{foreground:"var(--color-syntax-comment)",fontStyle:"italic"}},{scope:["keyword","keyword.control","keyword.operator.new","keyword.operator.expression","storage.type","storage.modifier"],settings:{foreground:"var(--color-syntax-keyword)"}},{scope:["string","string.quoted","string.template"],settings:{foreground:"var(--color-syntax-string)"}},{scope:["entity.name.function","support.function","meta.function-call"],settings:{foreground:"var(--color-syntax-function)"}},{scope:["variable","variable.other","variable.parameter","meta.definition.variable"],settings:{foreground:"var(--color-syntax-variable)"}},{scope:["constant.numeric","constant.language"],settings:{foreground:"var(--color-syntax-number)"}},{scope:["keyword.operator","keyword.operator.assignment","keyword.operator.comparison","keyword.operator.arithmetic"],settings:{foreground:"var(--color-syntax-operator)"}},{scope:["entity.name.tag","punctuation.definition.tag","support.class.component"],settings:{foreground:"var(--color-syntax-tag)"}},{scope:["entity.other.attribute-name","meta.tag.attributes"],settings:{foreground:"var(--color-syntax-attr)"}},{scope:["punctuation","meta.brace","punctuation.definition.block","punctuation.separator","punctuation.terminator"],settings:{foreground:"var(--color-syntax-punctuation)"}},{scope:["entity.name.type","support.type","support.class","entity.other.inherited-class"],settings:{foreground:"var(--color-syntax-type)"}}]},ki={typescript:()=>import('@shikijs/langs/typescript'),javascript:()=>import('@shikijs/langs/javascript'),tsx:()=>import('@shikijs/langs/tsx'),jsx:()=>import('@shikijs/langs/jsx'),html:()=>import('@shikijs/langs/html'),css:()=>import('@shikijs/langs/css'),json:()=>import('@shikijs/langs/json'),markdown:()=>import('@shikijs/langs/markdown'),python:()=>import('@shikijs/langs/python'),rust:()=>import('@shikijs/langs/rust'),go:()=>import('@shikijs/langs/go'),java:()=>import('@shikijs/langs/java'),c:()=>import('@shikijs/langs/c'),cpp:()=>import('@shikijs/langs/cpp'),csharp:()=>import('@shikijs/langs/csharp'),vue:()=>import('@shikijs/langs/vue'),xml:()=>import('@shikijs/langs/xml'),yaml:()=>import('@shikijs/langs/yaml'),sql:()=>import('@shikijs/langs/sql'),bash:()=>import('@shikijs/langs/bash'),shell:()=>import('@shikijs/langs/shell')},Cn=null,Xa=new Set;function Ni(){return Cn||(Cn=Promise.all([import('shiki/core'),import('shiki/engine/javascript')]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>e({themes:[wi],langs:[],engine:t()}))),Cn}async function Ci(e,t,r){let a=await Ni();if(t&&!Xa.has(t)){let o=ki[t];if(o)try{let l=await o();await a.loadLanguage(l.default??l),Xa.add(t);}catch{t="text";}else t="text";}let s=a.codeToHtml(e,{lang:t||"text",theme:"onyx-css-vars"});if(s=s.replace(/(<pre [^>]*style=")/,"$1line-height:1.7;tab-size:2;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;"),r){let o=0;s=s.replace(/<span class="line">/g,()=>(o++,`<span class="line"><span class="line-number" data-line="${o}"></span>`));}return s}function Tn({code:e,language:t="text",lineNumbers:r=false,editable:a=false,onCodeChange:s,size:o,className:l,...p}){let[x,u]=zt.useState(""),c=zt.useRef(null),w=zt.useRef(null),b=zt.useRef(null);zt.useEffect(()=>{let N=false;return Ci(e,t,a?false:r).then(T=>{N||u(T);}),()=>{N=true;}},[e,t,r,a]);let m=zt.useCallback(()=>{let N=w.current,T=b.current?.querySelector("pre"),$=c.current?.querySelector("[data-gutter]");N&&T&&(T.scrollTop=N.scrollTop,T.scrollLeft=N.scrollLeft),N&&$&&($.scrollTop=N.scrollTop);},[]),v=zt.useCallback(N=>{s?.(N.target.value);},[s]),d=zt.useCallback(N=>{if(N.key==="Tab"){N.preventDefault();let T=N.currentTarget,$=T.selectionStart,C=T.selectionEnd,P=T.value.substring(0,$)+" "+T.value.substring(C);s?.(P),requestAnimationFrame(()=>{T.selectionStart=T.selectionEnd=$+2;});}},[s]),f=r&&"[&_.line-number]:inline-block [&_.line-number]:w-8 [&_.line-number]:mr-4 [&_.line-number]:text-right [&_.line-number]:text-secondary-400 [&_.line-number]:select-none [&_.line-number]:before:content-[attr(data-line)]",k="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",g=1.7,L=e.split(`
2
- `).length;return a?jsxRuntime.jsxs("div",{ref:c,className:n(At({size:o}),"flex border border-primary-200 dark:border-primary-700",l),style:{background:"var(--color-syntax-bg)"},...p,children:[r&&jsxRuntime.jsx("div",{"data-gutter":true,"aria-hidden":true,className:"shrink-0 select-none overflow-hidden py-4 pl-3 pr-1 text-right text-secondary-400",style:{fontFamily:k,lineHeight:g,width:"3rem"},children:Array.from({length:L},(N,T)=>jsxRuntime.jsx("div",{children:T+1},T))}),jsxRuntime.jsxs("div",{className:"relative min-w-0 flex-1",children:[jsxRuntime.jsx("textarea",{ref:w,value:e,onChange:v,onScroll:m,onKeyDown:d,spellCheck:false,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",className:"relative z-2 m-0 block h-full w-full resize-none overflow-auto whitespace-pre border-none bg-transparent p-4 text-transparent caret-primary-600 outline-none dark:caret-primary-400",style:{fontFamily:k,lineHeight:g,tabSize:2,minHeight:"6rem"}}),jsxRuntime.jsx("div",{ref:b,"aria-hidden":true,className:"pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre]:h-full [&_pre]:overflow-hidden [&_pre]:p-4 [&_code]:bg-transparent",dangerouslySetInnerHTML:x?{__html:x}:void 0})]})]}):jsxRuntime.jsx("div",{ref:c,className:n(At({size:o}),"border border-primary-200 dark:border-primary-700",f,l),style:{background:"var(--color-syntax-bg)"},...p,children:jsxRuntime.jsx("div",{ref:b,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:x?{__html:x}:void 0,children:x?void 0:jsxRuntime.jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children:jsxRuntime.jsx("code",{children:e})})})})}var Ti={Table:_t,List:yn,Tree:hn,Chat:wn,CodeBlock:Tn},Rn=Ti;var st="flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors cursor-pointer",Wa="bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100 font-medium",yt="text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200",ht="flex items-center justify-center rounded-md p-2 transition-colors cursor-pointer text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200";function Di({to:e,className:t,style:r,children:a}){let s=typeof t=="function"?t({isActive:false}):t;return jsxRuntime.jsx("a",{href:e,className:s,style:r,children:a})}var Pn=["expanded","icons","mini"];function Ii(e){let t=Pn.indexOf(e);return Pn[(t+1)%Pn.length]}function Ya(e){let t=new Set;for(let r of e)if(r.children&&r.children.length>0){t.add(r.key??r.label);for(let a of Ya(r.children))t.add(a);}return t}function Za({item:e,basePath:t,depth:r,onItemClick:a,LinkComponent:s,showLines:o,expandedKeys:l,onToggle:p}){let x=e.key??e.label,u=e.children&&e.children.length>0,[c,w]=zt.useState(e.defaultOpen??true),b=l?l.has(x):c,m=zt.useCallback(()=>{l?p(x):w(d=>!d);},[l,p,x]),v=r>0?`${r*1.25}rem`:void 0;if(u)return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:m,className:n(st,yt,"justify-between"),style:{paddingLeft:v},children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:n("h-3.5 w-3.5 transition-transform",b&&"rotate-90")})]}),b&&jsxRuntime.jsx("div",{className:n("flex flex-col gap-0.5 pt-0.5",o?"ml-2.5 border-l border-primary-200 dark:border-primary-700":"ml-2"),children:e.children.map(d=>jsxRuntime.jsx(Za,{item:d,basePath:t,depth:r+1,onItemClick:a,LinkComponent:s,showLines:o,expandedKeys:l,onToggle:p},d.key??d.path??d.label))})]});if(e.path!=null){let d=t+e.path;return a?jsxRuntime.jsxs("button",{type:"button",onClick:()=>a(e,d),className:n(st,yt),style:{paddingLeft:v},children:[e.icon,e.label]}):jsxRuntime.jsxs(s,{to:d,className:({isActive:f})=>n(st,f?Wa:yt),style:{paddingLeft:v},children:[e.icon,e.label]})}return jsxRuntime.jsxs("span",{className:n(st,yt,"cursor-default"),style:{paddingLeft:v},children:[e.icon,e.label]})}function Ai({item:e,basePath:t,onItemClick:r,LinkComponent:a}){let[s,o]=zt.useState(false),l=zt.useRef(null),p=zt.useRef(void 0),[x,u]=zt.useState({top:0,left:0}),c=()=>{clearTimeout(p.current),o(true);},w=()=>{p.current=setTimeout(()=>o(false),200);};zt.useLayoutEffect(()=>{if(s&&l.current){let m=l.current.getBoundingClientRect();u({top:m.top,left:m.right+4});}},[s]);let b=e.icon||jsxRuntime.jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return jsxRuntime.jsxs("div",{onMouseEnter:c,onMouseLeave:w,children:[jsxRuntime.jsx("button",{ref:l,type:"button",className:n(ht,"w-full"),title:e.label,onClick:()=>o(m=>!m),children:b}),s&&reactDom.createPortal(jsxRuntime.jsxs("div",{className:"fixed z-50 min-w-44 rounded-md border border-primary-200 bg-white p-1 shadow-lg dark:border-primary-700 dark:bg-primary-900",style:{top:x.top,left:x.left},onMouseEnter:c,onMouseLeave:w,children:[jsxRuntime.jsx("div",{className:"px-2.5 py-1.5 text-xs font-semibold uppercase text-primary-500 dark:text-primary-400",children:e.label}),jsxRuntime.jsx("div",{className:"flex flex-col gap-0.5",children:e.children?.map(m=>{let v=m.key??m.path??m.label;if(m.path!=null){let d=t+m.path;return r?jsxRuntime.jsxs("button",{type:"button",onClick:()=>{r(m,d),o(false);},className:n(st,yt),children:[m.icon,m.label]},v):jsxRuntime.jsxs(a,{to:d,className:({isActive:f})=>n(st,f?Wa:yt),children:[m.icon,m.label]},v)}return jsxRuntime.jsxs("span",{className:n(st,"cursor-default text-primary-400"),children:[m.icon,m.label]},v)})})]}),document.body)]})}function Hi({item:e,basePath:t,onItemClick:r,LinkComponent:a}){let s=e.icon||jsxRuntime.jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});if(e.path!=null){let o=t+e.path;return r?jsxRuntime.jsx("button",{type:"button",onClick:()=>r(e,o),className:n(ht,"w-full"),title:e.label,children:s}):jsxRuntime.jsx(a,{to:o,className:({isActive:l})=>n(ht,"w-full",l&&"bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100"),children:jsxRuntime.jsx("span",{title:e.label,children:s})})}return jsxRuntime.jsx("span",{className:n(ht,"w-full cursor-default"),title:e.label,children:s})}function Ln({items:e,title:t,basePath:r="/",onItemClick:a,LinkComponent:s=Di,collapsible:o,collapseMode:l,defaultCollapseMode:p="expanded",onCollapseModeChange:x,showLines:u=true,expandedKeys:c,defaultExpandedKeys:w="all",onExpandedKeysChange:b,className:m,responsive:v=true,mobileBreakpoint:d=768,mobileTopOffset:f=48,...k}){let[g,L]=zt.useState(p),N=l??g,T=zt__default.default.useMemo(()=>Ya(e),[e]),[$,C]=zt.useState(()=>w==="all"?new Set(T):new Set(w)),P=c??null,A=P??$,V=zt.useCallback(H=>{let E=new Set(A);E.has(H)?E.delete(H):E.add(H),C(E),b?.(E);},[A,b]),y=zt.useCallback(()=>{let H=Ii(N);L(H),x?.(H);},[N,x]),[K,W]=zt.useState(()=>v&&typeof window<"u"&&window.innerWidth<d),[ae,U]=zt.useState(false);zt.useEffect(()=>{if(!v||typeof window>"u"||!window.matchMedia)return;let H=window.matchMedia(`(max-width: ${d-1}px)`),E=se=>{W(se.matches),se.matches||U(false);};return H.addEventListener("change",E),()=>H.removeEventListener("change",E)},[v,d]);let pe=zt.useCallback(H=>{H.target.closest("a")&&U(false);},[]),j=zt.useRef(null),Y=zt.useRef({startX:0,startY:0,dragging:false}),oe=zt.useCallback(H=>{let E=H.touches[0];Y.current={startX:E.clientX,startY:E.clientY,dragging:true};},[]),_=zt.useCallback(H=>{if(!Y.current.dragging||!j.current)return;let E=H.touches[0],se=E.clientX-Y.current.startX,Q=E.clientY-Y.current.startY;se>=0||Math.abs(Q)>Math.abs(se)||(j.current.style.transform=`translateX(${Math.max(se,-224)}px)`,j.current.style.transition="none");},[]),R=zt.useCallback(H=>{if(!Y.current.dragging||!j.current)return;Y.current.dragging=false;let E=H.changedTouches[0],se=E.clientX-Y.current.startX,Q=E.clientY-Y.current.startY;j.current.style.transition="",j.current.style.transform="",se<-60&&Math.abs(se)>Math.abs(Q)&&U(false);},[]),q=zt.useMemo(()=>!K||!a?a:(H,E)=>{U(false),a(H,E);},[K,a]),G=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o&&!K&&jsxRuntime.jsx("div",{className:n("flex shrink-0 mb-1",N==="expanded"?"justify-end":"justify-center"),children:jsxRuntime.jsx("button",{type:"button",onClick:y,className:ht,"aria-label":N==="mini"?"Expand sidebar":"Collapse sidebar",title:N==="mini"?"Expand sidebar":"Collapse sidebar",children:N==="mini"?jsxRuntime.jsx(lucideReact.Menu,{className:"h-5 w-5"}):jsxRuntime.jsx(lucideReact.ChevronsLeft,{className:"h-4 w-4"})})}),(K||N==="expanded")&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t&&jsxRuntime.jsx("h2",{className:"text-primary-500 dark:text-primary-400 mb-3 text-sm font-semibold uppercase",children:t}),e.map(H=>jsxRuntime.jsx(Za,{item:H,basePath:r,depth:0,onItemClick:q,LinkComponent:s,showLines:u,expandedKeys:P,onToggle:V},H.key??H.path??H.label))]}),!K&&N==="icons"&&e.map(H=>{let E=H.key??H.path??H.label;return H.children&&H.children.length>0?jsxRuntime.jsx(Ai,{item:H,basePath:r,onItemClick:q,LinkComponent:s},E):jsxRuntime.jsx(Hi,{item:H,basePath:r,onItemClick:q,LinkComponent:s},E)})]});return v&&K?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ae&&reactDom.createPortal(jsxRuntime.jsx("div",{className:"fixed inset-0 z-40 bg-black/50",style:{top:f},onClick:()=>U(false)}),document.body),reactDom.createPortal(jsxRuntime.jsxs("aside",{ref:j,className:n("fixed bottom-0 left-0 z-50 flex flex-col w-56 border-r border-primary-200 dark:border-primary-700 bg-white dark:bg-primary-900 shadow-xl transition-transform duration-200",ae?"translate-x-0":"-translate-x-full"),style:{top:f},onClick:pe,onTouchStart:oe,onTouchMove:_,onTouchEnd:R,children:[jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:[jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-500 dark:text-primary-400",children:"Navigation"}),jsxRuntime.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),U(false);},className:n(ht,"h-7 w-7 p-1"),"aria-label":"Close navigation",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overscroll-y-contain p-3",children:jsxRuntime.jsx("nav",{className:"flex flex-col gap-0.5",children:G})})]}),document.body),!ae&&reactDom.createPortal(jsxRuntime.jsx("button",{type:"button",className:"fixed left-0 z-50 flex h-14 w-5 items-center justify-center rounded-r-xl bg-primary-800/80 text-white shadow-md backdrop-blur-sm transition-colors hover:bg-primary-700/90 dark:bg-primary-200/80 dark:text-primary-900 dark:hover:bg-primary-300/90",style:{top:`calc(50% + ${f/2}px)`,transform:"translateY(-50%)"},onClick:()=>U(true),"aria-label":"Open navigation",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-3.5 w-3.5"})}),document.body)]}):jsxRuntime.jsx("nav",{className:n("flex flex-col gap-0.5",N==="mini"&&"items-center",m),...k,children:G})}function zi({href:e,className:t,onClick:r,children:a}){return jsxRuntime.jsx("a",{href:e,className:t,onClick:r,children:a})}function En({brand:e,onBrandClick:t,navItems:r=[],actions:a=[],linkComponent:s=zi,height:o="h-12",mobileMenu:l=false,navMenuIcon:p,actionsMenuIcon:x,className:u,children:c}){let w=l&&r.length>0,b=l&&a.length>0,m="md:hidden rounded-md px-1.5 py-1.5 text-primary-500 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-200 [&_svg]:h-5 [&_svg]:w-5",v=g=>g?"text-primary-900 font-medium dark:text-primary-100":"text-primary-500 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-200 transition-colors",d="rounded-md p-1.5 text-primary-500 hover:bg-primary-100 hover:text-primary-700 dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-200 transition-colors [&_svg]:h-5 [&_svg]:w-5",f=r.map((g,L)=>({key:typeof g.label=="string"?g.label:String(L),label:g.active?jsxRuntime.jsx("span",{className:"font-semibold text-primary-900 dark:text-primary-100",children:g.label}):g.label,onClick:()=>{g.onClick?g.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):g.href&&(window.location.href=g.href);}})),k=a.map((g,L)=>({key:g.key??String(L),label:jsxRuntime.jsxs("span",{className:"flex items-center gap-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:[g.icon,jsxRuntime.jsx("span",{children:g.ariaLabel})]}),onClick:()=>{g.onClick?g.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):g.href&&(g.external?window.open(g.href,"_blank","noopener,noreferrer"):window.location.href=g.href);}}));return jsxRuntime.jsxs("header",{className:n("flex shrink-0 items-center justify-between border-b px-5","border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",o,u),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 md:gap-6",children:[e&&jsxRuntime.jsx("div",{className:n("text-lg font-bold text-primary-800 dark:text-primary-100",t&&"cursor-pointer"),onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,onKeyDown:t?g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),t(g));}:void 0,children:e}),w&&jsxRuntime.jsx(ft,{intent:"ghost",size:"sm",className:m,label:p??jsxRuntime.jsx(lucideReact.PanelLeft,{className:"h-5 w-5"}),items:f,align:"left",chevron:false,"aria-label":"Open navigation"}),r.length>0&&jsxRuntime.jsx("nav",{className:n("flex items-center gap-4 text-sm",l?"hidden md:flex":"flex"),children:r.map((g,L)=>{let N=typeof g.label=="string"?g.label:L,T=v(g.active);return g.href?jsxRuntime.jsx(s,{href:g.href,className:T,onClick:g.onClick,children:g.label},N):jsxRuntime.jsx("button",{type:"button",className:n(T,"cursor-pointer"),onClick:g.onClick,children:g.label},N)})})]}),c&&jsxRuntime.jsx("div",{className:"flex items-center",children:c}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[a.length>0&&jsxRuntime.jsx("div",{className:n("flex items-center gap-1",l?"hidden md:flex":"flex"),children:a.map((g,L)=>g.href?jsxRuntime.jsx("a",{href:g.href,target:g.external?"_blank":void 0,rel:g.external?"noopener noreferrer":void 0,className:d,"aria-label":g.ariaLabel,onClick:g.onClick,children:g.icon},g.key??L):jsxRuntime.jsx("button",{type:"button",className:d,"aria-label":g.ariaLabel,onClick:g.onClick,children:g.icon},g.key??L))}),b&&jsxRuntime.jsx(ft,{intent:"ghost",size:"sm",className:m,label:x??jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"h-5 w-5"}),items:k,align:"right",chevron:false,"aria-label":"Open menu"})]})]})}var yr=classVarianceAuthority.cva("inline-flex items-center gap-1 underline-offset-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/20 [&_svg]:shrink-0",{variants:{intent:{default:"text-primary-600 hover:text-primary-800 active:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:active:text-primary-100",secondary:"text-secondary-500 hover:text-secondary-700 active:text-secondary-800 dark:text-secondary-400 dark:hover:text-secondary-200 dark:active:text-secondary-100",muted:"text-primary-400 hover:text-primary-600 dark:text-primary-500 dark:hover:text-primary-300"},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"},underline:{always:"underline",hover:"hover:underline",none:"no-underline"}},defaultVariants:{intent:"default",size:"md",underline:"none"}});function Bi(e,t){return !!(t==="_blank"||e&&/^https?:\/\//.test(e))}var Ki=e=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,...e,children:[jsxRuntime.jsx("path",{d:"M15 3h6v6"}),jsxRuntime.jsx("path",{d:"M10 14 21 3"}),jsxRuntime.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]});function Sn({intent:e,size:t,underline:r,external:a,className:s,children:o,href:l,target:p,rel:x,...u}){let c=a??Bi(l,p);return jsxRuntime.jsxs("a",{href:l,target:c&&!p?"_blank":p,rel:c&&!x?"noopener noreferrer":x,className:n(yr({intent:e,size:t,underline:r}),s),...u,children:[o,c&&jsxRuntime.jsx(Ki,{})]})}var $i={SideNav:Ln,Header:En,NavLink:Sn},Vn=$i;var vr=classVarianceAuthority.cva("flex w-full items-center justify-between font-medium transition-all [&_svg]:shrink-0",{variants:{size:{sm:"py-2 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-3 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-4 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),wr=classVarianceAuthority.cva("",{variants:{size:{sm:"pb-2 text-xs",md:"pb-3 text-sm",lg:"pb-4 text-base"}},defaultVariants:{size:"md"}}),kr=classVarianceAuthority.cva("divide-y",{variants:{intent:{default:"divide-primary-300 dark:divide-primary-700",bordered:"divide-primary-300 rounded-lg border border-primary-300 bg-white px-3 shadow-sm dark:divide-primary-700 dark:border-primary-700 dark:bg-primary-800/50",ghost:"divide-transparent"}},defaultVariants:{intent:"default"}}),Nr=classVarianceAuthority.cva("flex",{variants:{intent:{line:"border-b border-primary-200 dark:border-primary-700",pills:"gap-1 rounded-lg bg-primary-100 p-1 dark:bg-primary-800",underline:"gap-4"}},defaultVariants:{intent:"line"}}),Cr=classVarianceAuthority.cva("inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",{variants:{intent:{line:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:data-[active=true]:text-primary-100",pills:"rounded-md text-primary-600 hover:text-primary-900 data-[active=true]:bg-white data-[active=true]:text-primary-900 data-[active=true]:shadow-sm dark:text-primary-400 dark:hover:text-primary-100 dark:data-[active=true]:bg-primary-700 dark:data-[active=true]:text-primary-100",underline:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:data-[active=true]:text-primary-100"}},defaultVariants:{intent:"line"}});var Tr=zt.createContext(null),Dn=zt.createContext(null);function In({type:e="single",defaultValue:t=[],value:r,onValueChange:a,intent:s,size:o,className:l,children:p,...x}){let[u,c]=zt.useState(t),w=r??u,b=zt.useCallback(m=>{let v=d=>d.includes(m)?d.filter(f=>f!==m):e==="single"?[m]:[...d,m];a?a(v(w)):c(v);},[e,w,a]);return jsxRuntime.jsx(Tr.Provider,{value:{expandedItems:w,toggleItem:b,size:o},children:jsxRuntime.jsx("div",{className:n(kr({intent:s}),l),...x,children:p})})}function Ui({value:e,className:t,children:r,...a}){let o=zt.useContext(Tr)?.expandedItems.includes(e)??false;return jsxRuntime.jsx(Dn.Provider,{value:{value:e,isExpanded:o},children:jsxRuntime.jsx("div",{className:n("",t),...a,children:r})})}function qi({className:e,children:t,...r}){let a=zt.useContext(Tr),s=zt.useContext(Dn);return jsxRuntime.jsxs("button",{className:n("text-primary-800 hover:text-primary-600 dark:text-primary-100 dark:hover:text-primary-300 cursor-pointer gap-2 font-medium transition-colors",vr({size:a?.size}),e),onClick:()=>s&&a?.toggleItem(s.value),"aria-expanded":s?.isExpanded?"true":"false",...r,children:[jsxRuntime.jsx("span",{className:"flex items-center gap-1.5 [&_svg]:shrink-0",children:t}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:n("shrink-0 transition-transform duration-200",s?.isExpanded&&"rotate-180")})]})}function Wi({className:e,children:t,...r}){let a=zt.useContext(Tr),s=zt.useContext(Dn);return jsxRuntime.jsx("div",{className:n("grid transition-[grid-template-rows] duration-200 ease-out",s?.isExpanded?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("div",{className:n("text-primary-500 dark:text-primary-400",wr({size:a?.size}),e),...r,children:t})})})}var $t=zt.createContext(null),ao=zt.createContext(false);function An({defaultValue:e="",value:t,onValueChange:r,intent:a,children:s,className:o}){let[l,p]=zt.useState(e),x=t??l,u=zt.useRef(new Map),c=zt.useCallback(b=>{r?r(b):p(b);},[r]),w=zt.useCallback((b,m)=>{m?u.current.set(b,m):u.current.delete(b);},[]);return jsxRuntime.jsx($t.Provider,{value:{activeValue:x,setActiveValue:c,intent:a,registerTrigger:w},children:jsxRuntime.jsx("div",{className:o,children:s})})}function Ji({className:e,scrollable:t,...r}){let a=zt.useContext($t),s=zt.useRef(null),[o,l]=zt.useState(null),p=zt.useCallback(()=>{if(!a||!s.current)return;let w=s.current.querySelectorAll('[role="tab"][data-active="true"]')[0];if(!w){l(null);return}let b=s.current.getBoundingClientRect(),m=w.getBoundingClientRect();l({left:m.left-b.left,width:m.width});},[a]);zt.useLayoutEffect(p,[a?.activeValue,p]),zt.useEffect(()=>{let c=new ResizeObserver(p);return s.current&&c.observe(s.current),()=>c.disconnect()},[p]);let x=a?.intent??"line",u=o&&(x==="line"||x==="underline");return jsxRuntime.jsxs("div",{ref:s,className:n(Nr({intent:a?.intent}),"relative",t&&"overflow-x-auto",e),role:"tablist",...r,children:[r.children,u&&jsxRuntime.jsx("span",{className:"absolute bottom-0 h-0.5 rounded-full bg-primary-600 dark:bg-primary-400 transition-all duration-300 ease-in-out",style:{left:o.left,width:o.width},"aria-hidden":true})]})}function el({value:e,className:t,children:r,...a}){let s=zt.useContext($t),o=s?.activeValue===e,l=zt.useCallback(p=>s?.registerTrigger(e,p),[s,e]);return jsxRuntime.jsx("button",{ref:l,className:n(Cr({intent:s?.intent}),t),role:"tab","data-active":o,"aria-selected":o,onClick:()=>s?.setActiveValue(e),...a,children:r})}function tl({className:e,children:t,...r}){let a=zt.useContext($t);if(!a)return null;let s=zt__default.default.Children.toArray(t).filter(l=>zt__default.default.isValidElement(l)),o=Math.max(0,s.findIndex(l=>l.props.value===a.activeValue));return jsxRuntime.jsx("div",{className:n("overflow-hidden",e),...r,children:jsxRuntime.jsx(ao.Provider,{value:true,children:jsxRuntime.jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${o*100}%)`},children:s.map((l,p)=>jsxRuntime.jsx("div",{className:"w-full shrink-0","aria-hidden":p!==o,children:l},l.props.value??p))})})})}function rl({value:e,className:t,children:r,...a}){let s=zt.useContext($t);return zt.useContext(ao)?jsxRuntime.jsx("div",{className:n("pt-4",t),role:"tabpanel",...a,children:r}):s?.activeValue!==e?null:jsxRuntime.jsx("div",{className:n("pt-4",t),role:"tabpanel",...a,children:r})}var al={Accordion:In,Tabs:An},Hn=al;var jt=classVarianceAuthority.cva("rounded-lg bg-white p-6 shadow-xl dark:bg-primary-900",{variants:{size:{sm:"w-full max-w-sm",md:"w-full max-w-lg",lg:"w-full max-w-2xl",xl:"w-full max-w-4xl",full:"h-[calc(100vh-4rem)] w-[calc(100vw-4rem)]"}},defaultVariants:{size:"md"}}),Pr=classVarianceAuthority.cva("absolute z-50 rounded px-2 py-1 text-xs shadow-md animate-fade-in",{variants:{intent:{default:"bg-primary-900 text-white dark:bg-primary-100 dark:text-primary-900",light:"border border-primary-200 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-800 dark:text-primary-200"}},defaultVariants:{intent:"default"}});var qe=[];function cl(e){qe.push(e);}function dl(e){let t=qe.indexOf(e);t!==-1&&qe.splice(t,1);}function _n(e){return qe.length>0&&qe[qe.length-1]===e}function pl(e){let t=qe.indexOf(e);return t!==-1?t:qe.length}var zn=zt.createContext(null);function Gt({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:a=false,children:s}){let o=zt.useId();return zt.useEffect(()=>{if(e)return cl(o),()=>dl(o)},[e,o]),zt.useEffect(()=>{if(!e||!r)return;let l=p=>{p.key==="Escape"&&_n(o)&&t(false);};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,r,t,o]),zt.useEffect(()=>{if(!e||!r)return;let l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l;}},[e,r]),e?jsxRuntime.jsx(zn.Provider,{value:{id:o,onOpenChange:t,modal:r,closeOnOutsideClick:a},children:reactDom.createPortal(s,document.body)}):null}function On({size:e,position:t="center",className:r,children:a,...s}){let o=zt.useContext(zn);if(!o)return null;let p=200+pl(o.id)*10,x=()=>{o.closeOnOutsideClick&&_n(o.id)&&o.onOpenChange(false);},u=t==="bottom";return o.modal?jsxRuntime.jsx("div",{className:n("animate-fade-in fixed inset-0 bg-black/50",u?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:p},onClick:x,children:jsxRuntime.jsx("div",{className:n(jt({size:e}),u?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",r),role:"dialog","aria-modal":"true",onClick:c=>c.stopPropagation(),...s,children:a})}):jsxRuntime.jsx("div",{className:n("fixed inset-0 flex items-center justify-center p-4",o.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:p},onClick:o.closeOnOutsideClick&&_n(o.id)?()=>o.onOpenChange(false):void 0,children:jsxRuntime.jsx("div",{className:n(jt({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",r),role:"dialog",onClick:o.closeOnOutsideClick?c=>c.stopPropagation():void 0,...s,children:a})})}function Bn({className:e,...t}){return jsxRuntime.jsx("div",{className:n("mb-4 space-y-1",e),...t})}function Kn({className:e,...t}){return jsxRuntime.jsx("h2",{className:n("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",e),...t})}function $n({className:e,...t}){return jsxRuntime.jsx("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function jn({className:e,...t}){return jsxRuntime.jsx("div",{className:n("mt-6 flex justify-end gap-2",e),...t})}function ml({className:e,...t}){let r=zt.useContext(zn);return jsxRuntime.jsx("button",{className:n("text-primary-400 hover:text-primary-600 dark:hover:text-primary-200 absolute top-4 right-4 rounded-md p-1 transition-colors",e),onClick:()=>r?.onOpenChange(false),"aria-label":"Close",...t,children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})}var ul={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};function Gn({content:e,position:t="top",intent:r,delay:a=200,maxWidth:s,children:o,className:l}){let[p,x]=zt.useState(false),[u,c]=zt.useState();return jsxRuntime.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>{let m=setTimeout(()=>x(true),a);c(m);},onMouseLeave:()=>{clearTimeout(u),x(false);},children:[o,p&&jsxRuntime.jsx("span",{className:n(Pr({intent:r}),ul[t],"pointer-events-none",s?"whitespace-normal":"whitespace-nowrap",l),style:s!==void 0?{maxWidth:s}:void 0,role:"tooltip",children:e})]})}var bl={Dialog:Gt,Tooltip:Gn},Xn=bl;var Mr=classVarianceAuthority.cva("relative w-full overflow-hidden rounded-full bg-primary-200 dark:bg-primary-700",{variants:{size:{xs:"h-1",sm:"h-2",md:"h-3",lg:"h-4"},intent:{primary:"[&_.progress-fill]:bg-primary-500",success:"[&_.progress-fill]:bg-success-500",warning:"[&_.progress-fill]:bg-warning-500",danger:"[&_.progress-fill]:bg-danger-500"},edge:{none:"rounded-full",top:"fixed top-0 left-0 right-0 z-50 rounded-none",bottom:"fixed bottom-0 left-0 right-0 z-50 rounded-none"}},defaultVariants:{size:"md",intent:"primary",edge:"none"}}),vt=classVarianceAuthority.cva("text-primary-500 dark:text-primary-400",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),Xt=classVarianceAuthority.cva("pointer-events-auto flex items-start gap-3 rounded-lg border p-4 shadow-lg transition-all",{variants:{intent:{success:"border-success-200 bg-success-50 text-success-800 dark:border-success-800 dark:bg-success-900/80 dark:text-success-200",warning:"border-warning-200 bg-warning-50 text-warning-800 dark:border-warning-800 dark:bg-warning-900/80 dark:text-warning-200",error:"border-danger-200 bg-danger-50 text-danger-800 dark:border-danger-800 dark:bg-danger-900/80 dark:text-danger-200",info:"border-primary-200 bg-primary-50 text-primary-800 dark:border-primary-800 dark:bg-primary-900/80 dark:text-primary-200"}},defaultVariants:{intent:"info"}});function Zn({intent:e,className:t,children:r,...a}){return jsxRuntime.jsx("div",{className:n(Xt({intent:e}),t),role:"alert",...a,children:r})}function Rl({className:e,...t}){return jsxRuntime.jsx("h5",{className:n("flex items-center gap-1.5 font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function Pl({className:e,...t}){return jsxRuntime.jsx("span",{className:n("mt-0.5 shrink-0 [&_svg]:h-5 [&_svg]:w-5",e),...t})}function Ml({className:e,...t}){return jsxRuntime.jsx("div",{className:n("flex-1 min-w-0 space-y-1",e),...t})}function Ll({className:e,...t}){return jsxRuntime.jsx("p",{className:n("text-sm opacity-90",e),...t})}var El=0,it=[],Lr=new Map,qn=new Set;function Sl(){return it}function Wn(){qn.forEach(e=>e());}function Qn(e){let t=Lr.get(e);t&&(clearTimeout(t),Lr.delete(e)),it=it.map(r=>r.id===e?{...r,exiting:true}:r),Wn(),setTimeout(()=>{it=it.filter(r=>r.id!==e),Wn();},200);}function Vl(e){let t=`alert-${++El}`;it=[...it,{...e,id:t}],Wn();let r=e.duration??5e3;if(r>0){let a=setTimeout(()=>{Lr.delete(t),Qn(t);},r);Lr.set(t,a);}return t}var Yn=16;function Dl(e){Yn=e;}var Il={"top-right":"right-4 items-end","top-left":"left-4 items-start","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","top-center":"left-1/2 -translate-x-1/2 items-center","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},Al={"top-right":"animate-slide-in-right","top-left":"animate-slide-in-left","bottom-right":"animate-slide-in-right","bottom-left":"animate-slide-in-left","top-center":"animate-slide-in-top","bottom-center":"animate-slide-in-bottom"},Hl={success:lucideReact.CircleCheck,warning:lucideReact.TriangleAlert,error:lucideReact.CircleX,info:lucideReact.Info};function Fl({alert:e,onClose:t}){let r=e.intent??"info",a=Hl[r],s=e.position??"top-right";return jsxRuntime.jsxs("div",{className:n(Xt({intent:r}),Al[s],e.exiting&&"opacity-0 transition-opacity duration-200","w-80 max-w-[calc(100vw-2rem)]"),role:"alert",children:[jsxRuntime.jsx(a,{className:"mt-0.5 h-5 w-5 shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[e.title&&jsxRuntime.jsx("p",{className:"font-semibold",children:e.title}),jsxRuntime.jsx("p",{className:n(e.title&&"text-sm opacity-90"),children:e.message})]}),jsxRuntime.jsx("button",{onClick:t,"aria-label":"Close notification",className:"shrink-0 cursor-pointer opacity-50 transition-opacity hover:opacity-100",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]})}var _l=e=>e.startsWith("top");function zl(){let e=zt.useSyncExternalStore(a=>(qn.add(a),()=>qn.delete(a)),Sl),t=zt.useRef(Yn);if(zt.useEffect(()=>{t.current=Yn;},[]),e.length===0)return null;let r=e.reduce((a,s)=>{let o=s.position??"top-right";return (a[o]??(a[o]=[])).push(s),a},{});return reactDom.createPortal(jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.entries(r).map(([a,s])=>jsxRuntime.jsx("div",{style:_l(a)?{top:`${t.current}px`}:void 0,className:n("pointer-events-none fixed z-100 flex flex-col gap-2",Il[a]),children:s.map(o=>jsxRuntime.jsx(Fl,{alert:o,onClose:()=>Qn(o.id)},o.id))},a))}),document.body)}var lo=false;function Ol(){if(lo)return;lo=true;let e=document.createElement("div");e.id="alert-toast-root",document.body.appendChild(e),client.createRoot(e).render(jsxRuntime.jsx(zl,{}));}function Bl(){return zt.useEffect(()=>{Ol();},[]),{addAlert:Vl,removeAlert:Qn}}function ea({value:e=0,size:t,intent:r,edge:a,showLabel:s=false,indeterminate:o=false,animated:l=false,duration:p=500,className:x,...u}){let c=Math.max(0,Math.min(100,e)),[w,b]=zt.useState(0),m=zt.useRef(0);zt.useEffect(()=>{if(!o)return m.current=requestAnimationFrame(()=>{b(c);}),()=>{m.current&&cancelAnimationFrame(m.current);}},[c,o]);let v=s&&!o&&t!=="xs"&&t!=="sm",d=jsxRuntime.jsx("div",{role:"progressbar","aria-valuenow":o?void 0:c,"aria-valuemin":0,"aria-valuemax":100,className:n(Mr({size:t,intent:r,edge:a}),x),...u,children:o?jsxRuntime.jsx("div",{className:"progress-fill absolute top-0 h-full rounded-full animate-progress-indeterminate"}):jsxRuntime.jsx("div",{className:n("progress-fill h-full rounded-full transition-[width] ease-out",l&&"animate-progress-shine"),style:{width:`${w}%`,transitionDuration:`${p}ms`},children:v&&jsxRuntime.jsxs("span",{className:"flex h-full items-center justify-end pr-2 text-[10px] font-semibold text-white",children:[Math.round(c),"%"]})})});return a==="top"||a==="bottom"?reactDom.createPortal(d,document.body):d}function Er({size:e}){let t=e==="sm"?20:e==="lg"?40:28;return jsxRuntime.jsx("svg",{className:"animate-spin-rotate",width:t,height:t,viewBox:"0 0 50 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{className:"animate-spin-dash stroke-current",cx:"25",cy:"25",r:"20",fill:"none",strokeWidth:"4",strokeLinecap:"round",strokeDasharray:"90 150",strokeDashoffset:"0"})})}function ra({spinning:e=true,tip:t,size:r,className:a,children:s,...o}){return s?jsxRuntime.jsxs("div",{className:n("relative w-fit",a),...o,children:[jsxRuntime.jsx("div",{className:n("transition-all duration-200",e&&"pointer-events-none select-none blur-[1px]"),children:s}),e&&jsxRuntime.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsxRuntime.jsx(Er,{size:r}),t&&jsxRuntime.jsx("span",{className:n(vt({size:r}),"select-none"),children:t})]})]}):e?jsxRuntime.jsxs("div",{className:n("inline-flex flex-col items-center gap-2",a),...o,children:[jsxRuntime.jsx(Er,{size:r}),t&&jsxRuntime.jsx("span",{className:n(vt({size:r}),"select-none"),children:t})]}):null}var Yl=0,qt=[],ta=new Set;function Zl(){return qt}function go(){ta.forEach(e=>e());}function Ql(e,t){let r=++Yl;return qt=[...qt,{id:r,target:e,tip:t}],go(),()=>Jl(r)}function Jl(e){qt=qt.filter(t=>t.id!==e),go();}function ec(){return Ql}var uo=false;function tc(){if(uo||typeof document>"u")return;uo=true;let e=document.createElement("div");e.id="jac-spin-portal",document.body.appendChild(e),import('react-dom/client').then(({createRoot:t})=>{t(e).render(jsxRuntime.jsx(oc,{}));});}var Sr=new Map;function rc(e){let t=Sr.get(e);if(t){t.count++;return}let r=getComputedStyle(e),a=e.style.position;r.position==="static"&&(e.style.position="relative"),Sr.set(e,{count:1,original:a});}function nc(e){let t=Sr.get(e);t&&(t.count--,t.count<=0&&(e.style.position=t.original,Sr.delete(e)));}function ac({entry:e}){return zt.useEffect(()=>{let t=e.target;if(!fo(t))return rc(t),()=>nc(t)},[e.target]),fo(e.target)?reactDom.createPortal(jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-primary-900/40 dark:bg-primary-900/60",children:[jsxRuntime.jsx(Er,{size:"lg"}),e.tip&&jsxRuntime.jsx("span",{className:"select-none text-sm text-primary-100",children:e.tip})]}),document.body):reactDom.createPortal(jsxRuntime.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsxRuntime.jsx(Er,{size:"md"}),e.tip&&jsxRuntime.jsx("span",{className:n(vt({size:"md"}),"select-none"),children:e.tip})]}),e.target)}function oc(){let e=zt.useSyncExternalStore(t=>(ta.add(t),()=>ta.delete(t)),()=>Zl());return e.length===0?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.map(t=>jsxRuntime.jsx(ac,{entry:t},t.id))})}function fo(e){return e===document.documentElement||e===document.body}typeof document<"u"&&tc();var ic={Alert:Zn,ProgressBar:ea,Spin:ra},na=ic;var ho="#1c1914",vo="#130f0b",Nc="#2e261e",oa="#504638",wt="#6b5d4d",Dr=`url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,Cc=[{key:"like",icon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsxRuntime.jsx(lucideReact.ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsxRuntime.jsx(lucideReact.Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsxRuntime.jsx(lucideReact.Download,{className:"h-5 w-5"}),label:"Download"}];function sa({photos:e,layout:t="strip",actions:r=Cc,onAction:a,className:s,showGrain:o=true,sheetTitle:l,sheetLabel:p}){let[x,u]=zt.useState(null),[c,w]=zt.useState(new Set),b=zt.useCallback(f=>u(f),[]),m=zt.useCallback(()=>u(null),[]),v=zt.useCallback((f,k)=>{if(r.find(L=>L.key===f)?.toggle){let L=`${k}-${f}`;w(N=>{let T=new Set(N);return T.has(L)?T.delete(L):T.add(L),T});}a?.(f,e[k],k);},[r,a,e]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(t==="strip"?Tc:t==="sheet"?Rc:Pc,{photos:e,onPhotoClick:b,showGrain:o,className:s,sheetTitle:l,sheetLabel:p}),x!==null&&reactDom.createPortal(jsxRuntime.jsx(Mc,{photos:e,currentIndex:x,onIndexChange:u,onClose:m,actions:r,activeActions:c,onAction:v,showGrain:o}),document.body)]})}function yo({count:e=30}){return jsxRuntime.jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:ho},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:Nc}},r))})}function Tc({photos:e,onPhotoClick:t,showGrain:r,className:a}){let s=zt.useRef(null);return jsxRuntime.jsxs("div",{className:n("select-none rounded-lg overflow-hidden",a),style:{background:vo},children:[jsxRuntime.jsx(yo,{count:Math.max(30,e.length*6)}),jsxRuntime.jsx("div",{ref:s,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:ho,scrollSnapType:"x mandatory"},children:e.map((o,l)=>jsxRuntime.jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(l),children:[jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:oa,width:280,height:187},children:[jsxRuntime.jsx("img",{src:o.src,alt:o.alt??o.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:false}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 mix-blend-multiply opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"rgba(255, 175, 60, 0.06)"}}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:Dr,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 transition-opacity duration-300 group-hover:opacity-50",style:{background:"radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%)"}})]}),jsxRuntime.jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:wt},children:[String(l+1).padStart(2,"0"),l%2===0?"":"A"]})]},l))}),jsxRuntime.jsx(yo,{count:Math.max(30,e.length*6)})]})}function Rc({photos:e,onPhotoClick:t,showGrain:r,className:a,sheetTitle:s,sheetLabel:o}){return jsxRuntime.jsxs("div",{className:n("rounded-lg p-5",a),style:{background:vo},children:[jsxRuntime.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:wt},children:s??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:wt},children:o??"Contact Sheet"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((l,p)=>jsxRuntime.jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${p*50}ms both`},onClick:()=>t(p),children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:wt},children:String(p+1).padStart(2,"0")}),jsxRuntime.jsxs("div",{className:"relative overflow-hidden rounded-[1px] border transition-all duration-300 group-hover:border-amber-600/50 group-hover:shadow-[0_0_20px_rgba(217,171,89,0.15)]",style:{borderColor:oa,aspectRatio:"3/2"},children:[jsxRuntime.jsx("img",{src:l.src,alt:l.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Dr}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 translate-y-full bg-linear-to-t from-black/70 to-transparent p-2 pt-6 transition-transform duration-300 group-hover:translate-y-0",children:jsxRuntime.jsx("span",{className:"text-xs font-medium text-white/90",children:l.title})})]})]},p))})]})}function Pc({photos:e,onPhotoClick:t,showGrain:r,className:a}){let[s,o]=zt.useState(false),[l,p]=zt.useState(null),x=Math.min(e.length,8),u=e.slice(0,x),c=b=>{let m=Math.sin(b*137.508+1)*1e4,v=(m%12-6).toFixed(1),d=(m/7%8-4).toFixed(1),f=(m/13%6-3).toFixed(1);return `rotate(${v}deg) translate(${d}px, ${f}px)`},w=(b,m)=>{let v=(m-1)/2,d=((b-v)*7).toFixed(1),f=((b-v)*110).toFixed(0),k=(-Math.abs(b-v)*10+(l===b?-18:0)).toFixed(0);return `translateX(${f}px) translateY(${k}px) rotate(${d}deg)`};return jsxRuntime.jsxs("div",{className:n("flex flex-col items-center gap-4",a),children:[jsxRuntime.jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>o(true),onMouseLeave:()=>{o(false),p(null);},children:u.map((b,m)=>jsxRuntime.jsx("div",{className:"absolute cursor-pointer rounded-lg shadow-xl transition-all duration-500",style:{transitionTimingFunction:"cubic-bezier(0.34, 1.56, 0.64, 1)",transitionDelay:s?`${m*35}ms`:`${(x-m)*25}ms`,transform:s?w(m,u.length):c(m),zIndex:s?m+1:u.length-m,width:220,height:147},onClick:()=>t(m),onMouseEnter:()=>s&&p(m),onMouseLeave:()=>p(null),children:jsxRuntime.jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:s&&l===m?"rgba(217,171,89,0.5)":oa,boxShadow:s&&l===m?"0 25px 50px rgba(0,0,0,0.5), 0 0 30px rgba(217,171,89,0.1)":"0 10px 30px rgba(0,0,0,0.4)"},children:[jsxRuntime.jsx("img",{src:b.src,alt:b.alt??"",className:"h-full w-full object-cover",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Dr}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%)"}}),s&&l===m&&jsxRuntime.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-linear-to-t from-black/80 to-transparent p-3 pt-8",style:{animation:"reveal-up 0.25s ease-out"},children:jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90",children:b.title})})]})},m))}),e.length>x&&jsxRuntime.jsxs("span",{className:"font-mono text-xs",style:{color:wt},children:["+ ",e.length-x," more"]}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:wt,opacity:s?0:.7},children:"Hover to explore"})]})}function Mc({photos:e,currentIndex:t,onIndexChange:r,onClose:a,actions:s,activeActions:o,onAction:l,showGrain:p}){let x=e[t],[u,c]=zt.useState(1),[w,b]=zt.useState({x:0,y:0}),[m,v]=zt.useState(false),[d,f]=zt.useState(false),k=zt.useRef(false),g=zt.useRef({x:0,y:0}),L=zt.useRef(null);zt.useLayoutEffect(()=>{requestAnimationFrame(()=>f(true));},[]),zt.useEffect(()=>{let y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=y;}},[]),zt.useEffect(()=>{let y=K=>{switch(K.key){case "Escape":a();break;case "ArrowLeft":N(-1);break;case "ArrowRight":N(1);break;case "i":case "I":v(W=>!W);break}};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)}),zt.useEffect(()=>{let y=L.current;if(!y)return;let K=W=>{W.preventDefault();let ae=W.deltaY<0?1.12:.89;c(U=>{let pe=Math.min(8,Math.max(1,U*ae));return pe<=1&&b({x:0,y:0}),pe});};return y.addEventListener("wheel",K,{passive:false}),()=>y.removeEventListener("wheel",K)},[]);let N=zt.useCallback(y=>{let K=t+y;K>=0&&K<e.length&&(r(K),c(1),b({x:0,y:0}));},[t,e.length,r]),T=zt.useCallback(y=>{u<=1||(k.current=true,g.current={x:y.clientX,y:y.clientY},y.target.setPointerCapture(y.pointerId));},[u]),$=zt.useCallback(y=>{if(!k.current)return;let K=y.clientX-g.current.x,W=y.clientY-g.current.y;g.current={x:y.clientX,y:y.clientY},b(ae=>({x:ae.x+K/u,y:ae.y+W/u}));},[u]),C=zt.useCallback(()=>{k.current=false;},[]),P=zt.useCallback(()=>{u>1?(c(1),b({x:0,y:0})):c(2.5);},[u]),A=y=>o.has(`${t}-${y}`),V=x.metadata;return jsxRuntime.jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/95",onClick:a}),p&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:Dr,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxRuntime.jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxRuntime.jsxs("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[u.toFixed(1),"x"]}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>c(y=>Math.min(8,y*1.3)),title:"Zoom in",children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{c(y=>{let K=Math.max(1,y*.7);return K<=1&&b({x:0,y:0}),K});},title:"Zoom out",children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:a,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-5 w-5"})})]})]}),jsxRuntime.jsxs("div",{ref:L,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:u>1?"grab":"default"},onPointerDown:T,onPointerMove:$,onPointerUp:C,onDoubleClick:P,children:[jsxRuntime.jsx("img",{src:x.src,alt:x.alt??x.title??"",className:"max-h-full max-w-full select-none object-contain",style:{animation:"lightbox-photo-in 0.35s cubic-bezier(0.16, 1, 0.3, 1)",transform:`scale(${u}) translate(${w.x}px, ${w.y}px)`,transition:k.current?"none":"transform 0.15s ease-out"},draggable:false},t),t>0&&jsxRuntime.jsx("button",{className:"absolute left-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:y=>{y.stopPropagation(),N(-1);},children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&jsxRuntime.jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:y=>{y.stopPropagation(),N(1);},children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-6 w-6"})})]}),jsxRuntime.jsx("div",{className:n("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",m?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:jsxRuntime.jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[x.title&&jsxRuntime.jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:x.title}),x.description&&jsxRuntime.jsx("p",{className:"mb-4 max-w-xl border-l-2 border-amber-500/40 pl-4 text-sm leading-relaxed text-white/60 italic",style:{animation:"reveal-up 0.4s ease-out 0.1s both"},children:x.description}),V&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[V.camera&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",V.camera,V.lens&&jsxRuntime.jsx("span",{className:"text-white/40",children:"\xB7"}),V.lens&&V.lens]}),(V.aperture||V.shutter||V.iso)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[V.aperture,V.shutter,V.iso&&`ISO ${V.iso}`].filter(Boolean).join(" \xB7 ")]}),V.date&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",V.date]}),V.location&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",V.location]})]})]})}),jsxRuntime.jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[s.map(y=>{let K=y.toggle&&A(y.key);return jsxRuntime.jsx("button",{className:n("rounded-full p-2.5 transition-all duration-200",K?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>l(y.key,t),title:y.label,children:K&&y.activeIcon?y.activeIcon:y.icon},y.key)}),jsxRuntime.jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsxRuntime.jsx("button",{className:n("rounded-full p-2.5 transition-all duration-200",m?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>v(y=>!y),title:"Photo info (I)",children:jsxRuntime.jsx(lucideReact.Info,{className:"h-5 w-5"})})]})})]})}var ia="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),Nr=require('react'),lucideReact=require('lucide-react'),reactDom=require('react-dom'),client=require('react-dom/client');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Nr__default=/*#__PURE__*/_interopDefault(Nr);function i(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var Xt=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"}}),Ir=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"}}),Hr=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"}}),jt=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"}}),Fr=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"}}),Ar=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"}}),zr=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"}}),Br=classVarianceAuthority.cva("",{variants:{intent:{primary:"",secondary:"",danger:"",warning:"",success:""},size:{sm:"",md:"",lg:""},checked:{on:"",off:"bg-primary-300 dark:bg-primary-800"}},compoundVariants:[{intent:"primary",checked:"on",class:"bg-primary-500 dark:bg-primary-500"},{intent:"secondary",checked:"on",class:"bg-secondary-500 dark:bg-secondary-500"},{intent:"danger",checked:"on",class:"bg-danger-500 dark:bg-danger-500"},{intent:"warning",checked:"on",class:"bg-warning-500 dark:bg-warning-500"},{intent:"success",checked:"on",class:"bg-success-500 dark:bg-success-500"}],defaultVariants:{intent:"primary",size:"md",checked:"off"}});function Yt({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("button",{className:i(Xt({intent:e,size:t}),r),...n})}function Bn(e,t){for(let r of e){if(r.value===t)return r;if(r.children){let n=Bn(r.children,t);if(n)return n}}}function _n(e){let t=[];for(let r of e)r.children?.length||t.push(r),r.children&&t.push(..._n(r.children));return t}var Kr=40,Vs=200,$n=150,Oa=120;function Or(e,t,r,n){if(!n)return {};if(r){let a=(t-1-e)*Kr;return {animation:`dropdown-item-out ${$n}ms ease-in both ${a}ms`}}let o=e*Kr;return {animation:`dropdown-item-in ${Vs}ms ease-out both ${o}ms`}}function Ka(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Kr+$n;return {animation:`dropdown-container-out ${Oa}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function Wa({options:e,onSelect:t,animated:r=true,closing:n=false,depth:o=0}){let[a,s]=Nr.useState(null),p=Nr.useRef(void 0),b=c=>{p.current&&clearTimeout(p.current),s(c);},u=()=>{p.current=setTimeout(()=>s(null),150);};return Nr.useEffect(()=>()=>{p.current&&clearTimeout(p.current);},[]),jsxRuntime.jsx("div",{className:i("absolute z-50 min-w-44 rounded-md border py-1 shadow-lg overflow-hidden","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",o===0?"mt-1 w-full":"top-0 ml-0.5"),style:{...o>0?{left:"100%"}:{},...Ka(e.length,n,r)},role:"listbox",children:e.map((c,T)=>{let x=!!c.children?.length,m=a===c.value;return jsxRuntime.jsxs("div",{className:"relative",style:Or(T,e.length,n,r),onMouseEnter:()=>b(c.value),onMouseLeave:u,children:[jsxRuntime.jsxs("div",{role:"option","aria-selected":false,"aria-disabled":c.disabled,className:i("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",c.disabled&&"pointer-events-none opacity-50"),onClick:()=>{c.disabled||x||t(c.value,c);},children:[c.icon&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:c.icon}),jsxRuntime.jsx("span",{className:"flex-1 truncate",children:c.label??c.value}),x&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),x&&m&&jsxRuntime.jsx(Wa,{options:c.children,onSelect:t,animated:r,depth:o+1})]},c.value)})})}function Ds({options:e,filter:t,multiple:r,selected:n,canAdd:o,animated:a=true,closing:s=false,onSelect:p,onToggle:b,onAdd:u}){let c=Nr.useMemo(()=>_n(e),[e]),T=t.toLowerCase(),x=t?c.filter(d=>(d.label??d.value).toLowerCase().includes(T)||d.value.toLowerCase().includes(T)):c,m=x.length===0&&!o||o?1:0,g=x.length+m;return jsxRuntime.jsxs("div",{className:i("absolute z-50 mt-1 w-full max-h-60 min-w-44 overflow-y-auto rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white"),role:"listbox","aria-multiselectable":r||void 0,style:Ka(g,s,a),children:[x.map((d,f)=>{let w=r&&n.includes(d.value);return jsxRuntime.jsxs("div",{role:"option","aria-selected":r?w:false,"aria-disabled":d.disabled,className:i("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",d.disabled&&"pointer-events-none opacity-50"),style:Or(f,g,s,a),onClick:()=>{d.disabled||(r?b(d.value):p(d.value,d));},children:[r&&jsxRuntime.jsx("span",{className:i("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",w?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:w&&jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"})}),d.icon&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:d.icon}),jsxRuntime.jsx("span",{className:"truncate",children:d.label??d.value})]},d.value)}),x.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:Or(0,1,s,a),children:"No matches"}),o&&jsxRuntime.jsxs("div",{className:i("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:Or(x.length,g,s,a),onClick:u,children:[jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxRuntime.jsxs("span",{className:"truncate",children:["Add \u201C",t.trim(),"\u201D"]})]})]})}function On(e){let{options:t,placeholder:r="Select\u2026",editable:n=false,onAddItem:o,disabled:a=false,align:s="left",className:p,size:b="md",animated:u=true}=e,c=e.multiple===true,[T,x]=Nr.useState(c?void 0:e.defaultValue),[m,g]=Nr.useState(c?e.defaultSelected??[]:[]),d=c?e.selected??m:[],[f,w]=Nr.useState(false),[h,P]=Nr.useState(false),[k,N]=Nr.useState(""),F=Nr.useRef(null),R=Nr.useRef(null),E=Nr.useRef(void 0),A=Nr.useCallback(()=>{if(!u||!f){w(false),N("");return}P(true);let V=(Math.max(t.length,1)-1)*Kr+$n+Oa+20;E.current=setTimeout(()=>{w(false),P(false),N("");},V);},[u,f,t.length]);Nr.useEffect(()=>()=>{E.current&&clearTimeout(E.current);},[]);let H=c?void 0:e.value??T,y=Nr.useMemo(()=>H?Bn(t,H):void 0,[t,H]);Nr.useEffect(()=>{if(!f)return;let Y=V=>{F.current&&!F.current.contains(V.target)&&A();};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[f,A]),Nr.useEffect(()=>{if(!f)return;let Y=V=>{V.key==="Escape"&&A();};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[f,A]);let O=Nr.useCallback((Y,V)=>{c||(e.value===void 0&&x(Y),e.onChange?.(Y,V)),E.current&&clearTimeout(E.current),w(false),P(false),N("");},[c,e]),v=Nr.useCallback(Y=>{if(!c)return;let V=e.selected??m,G=V.includes(Y)?V.filter(me=>me!==Y):[...V,Y];e.selected===void 0&&g(G),e.onSelectionChange?.(G);},[c,m,e]),ne=k.toLowerCase(),C=Nr.useMemo(()=>!n||!k.trim()?false:!_n(t).some(V=>V.value.toLowerCase()===ne||(V.label??V.value).toLowerCase()===ne),[n,ne,t]),re=Nr.useCallback(()=>{let Y=k.trim();Y&&(o?.(Y),N(""));},[k,o]),_=Nr.useCallback(Y=>{Y.key==="Enter"&&C&&(Y.preventDefault(),re());},[C,re]),de=Nr.useCallback(()=>{a||(f?A():(E.current&&clearTimeout(E.current),P(false),w(true),N(""),n&&requestAnimationFrame(()=>R.current?.focus())));},[a,f,A,n]),j;if(c){let Y=d.length;Y===0?j="":Y<=2?j=d.map(V=>Bn(t,V)).map(V=>V?V.label??V.value:"").filter(Boolean).join(", "):j=`${Y} selected`;}else j=y?y.label??y.value:"";let pe=c||n;return jsxRuntime.jsxs("div",{ref:F,className:i("relative inline-block min-w-44",p),children:[jsxRuntime.jsxs("div",{className:i(jt({state:"default",size:b}),"flex cursor-pointer items-center gap-1",a&&"pointer-events-none opacity-50"),onClick:de,role:"combobox","aria-expanded":f,"aria-haspopup":"listbox",children:[n?jsxRuntime.jsx("input",{ref:R,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-secondary-400 dark:placeholder:text-secondary-600",value:f?k:j,placeholder:r,disabled:a,onChange:Y=>{N(Y.target.value),f||w(true);},onKeyDown:_,onClick:Y=>{Y.stopPropagation(),f||w(true);}}):jsxRuntime.jsx("span",{className:i("flex-1 truncate",!j&&"text-secondary-400 dark:text-secondary-600"),children:j||r}),y?.icon&&!n&&!c&&jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:y.icon}),c&&d.length>0&&jsxRuntime.jsx("span",{className:"rounded-full bg-primary-100 px-1.5 text-xs font-semibold text-primary-700 dark:bg-primary-900 dark:text-primary-300",children:d.length}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:i("text-primary-400 h-4 w-4 shrink-0 transition-transform",f&&"rotate-180")})]}),f&&jsxRuntime.jsx("div",{className:i(s==="right"?"right-0":"left-0","absolute w-full"),children:pe?jsxRuntime.jsx(Ds,{options:t,filter:k,multiple:c,selected:d,canAdd:C,animated:u,closing:h,onSelect:O,onToggle:v,onAdd:re}):jsxRuntime.jsx(Wa,{options:t,onSelect:O,animated:u,closing:h})})]})}function As(e,t){return e.key??(typeof e.label=="string"?e.label:String(t))}var Wr=40,zs=200,Yn=150,ja=120;function jn(e,t,r,n){if(!n)return {};if(r){let a=(t-1-e)*Wr;return {animation:`dropdown-item-out ${Yn}ms ease-in both ${a}ms`}}let o=e*Wr;return {animation:`dropdown-item-in ${zs}ms ease-out both ${o}ms`}}function Bs(e,t,r){if(!r)return {};if(t){let n=Math.max(e-1,0)*Wr+Yn;return {animation:`dropdown-container-out ${ja}ms ease-in both ${n}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function qt({label:e,items:t,intent:r,size:n,align:o="left",className:a,disabled:s,editable:p=false,onAddItem:b,multiple:u=false,selected:c=[],onSelectionChange:T,animated:x=true,chevron:m=true,...g}){let[d,f]=Nr.useState(false),[w,h]=Nr.useState(false),[P,k]=Nr.useState(""),N=Nr.useRef(null),F=Nr.useRef(null),R=Nr.useRef(void 0);Nr.useEffect(()=>()=>{R.current&&clearTimeout(R.current);},[]);let E=Nr.useCallback(()=>{if(!x||!d){f(false),k("");return}h(true);let pe=(Math.max(t.length,1)-1)*Wr+Yn+ja+20;R.current=setTimeout(()=>{f(false),h(false),k("");},pe);},[x,d,t.length]),A=Nr.useCallback(()=>{s||(d?E():(R.current&&clearTimeout(R.current),h(false),f(true),k(""),p&&requestAnimationFrame(()=>F.current?.focus())));},[s,d,E,p]);Nr.useEffect(()=>{if(!d)return;let j=pe=>{N.current&&!N.current.contains(pe.target)&&E();};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[d,E]),Nr.useEffect(()=>{if(!d)return;let j=pe=>{pe.key==="Escape"&&E();};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[d,E]);let H=P.toLowerCase(),y=Nr.useMemo(()=>P?t.filter(j=>(typeof j.label=="string"?j.label:j.key??"").toLowerCase().includes(H)):t,[t,H]),O=Nr.useMemo(()=>!p||!P.trim()?false:!t.some(j=>(typeof j.label=="string"?j.label:j.key??"").toLowerCase()===H),[p,H,t]),v=Nr.useCallback(()=>{let j=P.trim();j&&(b?.(j),k(""));},[P,b]),ne=Nr.useCallback(j=>{j.key==="Enter"&&O&&(j.preventDefault(),v());},[O,v]),C=Nr.useCallback(j=>{let pe=c.includes(j)?c.filter(Y=>Y!==j):[...c,j];T?.(pe);},[c,T]),re=u&&c.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e," ",jsxRuntime.jsx("span",{className:"ml-1 rounded-full bg-white/20 px-1.5 text-xs font-semibold",children:c.length})]}):e,_=y.length===0&&!O||O?1:0,de=y.length+_;return jsxRuntime.jsxs("div",{ref:N,className:"relative inline-block",children:[jsxRuntime.jsxs("button",{type:"button",onClick:A,disabled:s,className:i(Xt({intent:r,size:n}),"inline-flex items-center gap-1",a),"aria-haspopup":u?"listbox":"true","aria-expanded":d?"true":"false",...g,children:[re,m&&jsxRuntime.jsx(lucideReact.ChevronDown,{className:i("h-3.5 w-3.5 transition-transform",d&&"rotate-180")})]}),d&&jsxRuntime.jsxs("div",{className:i("absolute z-50 mt-1 min-w-44 rounded-md border py-1 shadow-lg","border-primary-200 dark:border-primary-700 dark:bg-primary-800 bg-white",o==="right"?"right-0":"left-0"),style:Bs(de,w,x),role:u?"listbox":"menu","aria-multiselectable":u||void 0,children:[p&&jsxRuntime.jsx("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children:jsxRuntime.jsx("input",{ref:F,type:"text",value:P,onChange:j=>k(j.target.value),onKeyDown:ne,placeholder:"Type to filter or add\u2026",className:"w-full bg-transparent text-sm text-secondary-900 placeholder:text-secondary-400 focus:outline-none dark:text-secondary-100 dark:placeholder:text-secondary-600"})}),jsxRuntime.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[y.map((j,pe)=>{let Y=As(j,pe),V=u&&c.includes(Y);return jsxRuntime.jsxs(Nr__default.default.Fragment,{children:[j.divider&&jsxRuntime.jsx("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),jsxRuntime.jsxs("button",{type:"button",role:u?"option":"menuitem","aria-selected":u?V:void 0,disabled:j.disabled,className:i("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-700 hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-700/50",j.disabled&&"pointer-events-none opacity-50"),style:jn(pe,de,w,x),onClick:()=>{u?C(Y):(j.onClick?.(),R.current&&clearTimeout(R.current),f(false),h(false),k(""));},children:[u&&jsxRuntime.jsx("span",{className:i("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",V?"border-primary-600 bg-primary-600 text-white dark:border-primary-500 dark:bg-primary-500":"border-secondary-300 bg-white dark:border-secondary-600 dark:bg-secondary-800"),children:V&&jsxRuntime.jsx(lucideReact.Check,{className:"h-3 w-3"})}),jsxRuntime.jsx("span",{className:"flex-1 truncate",children:j.label})]})]},Y)}),y.length===0&&!O&&jsxRuntime.jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:jn(0,1,w,x),children:"No matches"}),O&&jsxRuntime.jsxs("button",{type:"button",className:i("flex w-full cursor-pointer items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors","text-primary-600 hover:bg-primary-50 dark:text-primary-400 dark:hover:bg-primary-900/30"),style:jn(y.length,de,w,x),onClick:v,children:[jsxRuntime.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxRuntime.jsxs("span",{className:"truncate",children:["Add \u201C",P.trim(),"\u201D"]})]})]})]})]})}function Gn({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("span",{className:i(Ir({intent:e,size:t}),r),...n})}var Os={danger:"bg-danger-500",success:"bg-success-500",warning:"bg-warning-500",info:"bg-primary-500",primary:"bg-secondary-500"};function Un({children:e,show:t=true,content:r,dot:n,intent:o="danger",size:a="md",placement:s="top-right",pulse:p=false,className:b}){let u=n??r==null,c=u?null:typeof r=="number"?r>99?"99+":String(r):r;return jsxRuntime.jsxs("div",{className:"relative inline-flex",children:[e,t&&jsxRuntime.jsxs("span",{className:i(Hr({intent:o,size:a,dot:u,placement:s}),b),role:typeof r=="number"?"status":void 0,"aria-label":typeof r=="number"?String(r):void 0,children:[p&&jsxRuntime.jsx("span",{className:i("absolute inset-0 rounded-full animate-ping opacity-60",Os[o??"danger"]),"aria-hidden":"true"}),c]})]})}function qn({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("label",{className:i(Fr({intent:e,size:t}),r),...n})}var Xs={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"}},js={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 Zn({state:e="default",inputSize:t="md",className:r,prefix:n,suffix:o,action:a,...s}){if(!n&&!o&&!a)return jsxRuntime.jsx("input",{className:i(jt({state:e,size:t}),r),...s});let p=Xs[t??"md"],b=js[e??"default"];return jsxRuntime.jsxs("div",{className:i("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",p.wrapper,b,r),children:[n&&jsxRuntime.jsx("span",{className:i("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",p.prefix),children:n}),jsxRuntime.jsx("input",{className:i("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",p.input,n&&"pl-2"),...s}),o&&jsxRuntime.jsx("span",{className:i("pointer-events-none flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",p.icon),children:o}),a&&jsxRuntime.jsx("button",{type:"button",onClick:a.onClick,"aria-label":a["aria-label"]??"Action",className:i("flex shrink-0 items-center text-secondary-500 transition-colors hover:text-primary-600 dark:text-secondary-400 dark:hover:text-primary-400",p.icon),children:a.icon})]})}var Zs={sm:"px-2 py-1.5 text-xs min-h-[60px]",md:"px-3 py-2 text-sm min-h-[80px]",lg:"px-4 py-2.5 text-base min-h-[100px]"},Js={default:"border-secondary-400 focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 dark:border-secondary-600",error:"border-danger-400 focus:border-danger-500 focus:ring-2 focus:ring-danger-500/20"};function Qs(e){if(!e)return 0;let t="\u2E80-\u2EFF\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF",r=new RegExp(`[${t}]`),n=0,o="",a=()=>{let s=o.trim();s&&(n+=s.split(/\s+/).length),o="";};for(let s of e)r.test(s)?(a(),n+=1):o+=s;return a(),n}function Jn({state:e="default",size:t="md",showWordCount:r=false,maxWords:n,className:o,value:a,defaultValue:s,onChange:p,disabled:b,...u}){let[c,T]=Nr.useState(()=>s??""),x=a!==void 0?String(a):c,m=Nr.useCallback(f=>{a===void 0&&T(f.target.value),p?.(f);},[a,p]),g=Nr.useMemo(()=>Qs(x),[x]),d=n!=null&&g>n;return jsxRuntime.jsxs("div",{className:i("inline-flex w-full flex-col",o),children:[jsxRuntime.jsx("textarea",{value:x,onChange:m,disabled:b,className:i("w-full resize-y rounded-md border bg-white text-secondary-900 transition-colors placeholder:text-secondary-400 focus:outline-none dark:bg-secondary-900 dark:text-secondary-100 dark:placeholder:text-secondary-600",Zs[t],Js[d?"error":e],b&&"pointer-events-none opacity-50"),...u}),(r||n!=null)&&jsxRuntime.jsx("span",{className:i("mt-1 self-end text-xs",d?"text-danger-500 dark:text-danger-400":"text-secondary-400 dark:text-secondary-500"),children:n!=null?`${g} / ${n} words`:`${g} words`})]})}var ol={sm:{trackFixed:"h-5 w-9",trackH:"h-5 min-w-9",thumb:"h-3.5 w-3.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-16px)]",pad:"pl-[6px] pr-[18px]",contentLeft:"left-[6px]",contentRight:"right-[6px]",icon:"text-[10px] [&_svg]:h-3 [&_svg]:w-3"},md:{trackFixed:"h-6 w-11",trackH:"h-6 min-w-11",thumb:"h-4.5 w-4.5",thumbTop:"top-[3px]",thumbOff:"left-[2px]",thumbOn:"left-[calc(100%-20px)]",pad:"pl-[7px] pr-[23px]",contentLeft:"left-[7px]",contentRight:"right-[7px]",icon:"text-xs [&_svg]:h-3.5 [&_svg]:w-3.5"},lg:{trackFixed:"h-7 w-14",trackH:"h-7 min-w-14",thumb:"h-5.5 w-5.5",thumbTop:"top-[3px]",thumbOff:"left-[3px]",thumbOn:"left-[calc(100%-25px)]",pad:"pl-[8px] pr-[28px]",contentLeft:"left-[8px]",contentRight:"right-[8px]",icon:"text-sm [&_svg]:h-4 [&_svg]:w-4"}},al={primary:"text-primary-100",secondary:"text-secondary-100",danger:"text-danger-100",warning:"text-warning-100",success:"text-success-100"};function Qn({checked:e,defaultChecked:t=false,onCheckedChange:r,checkedContent:n,uncheckedContent:o,intent:a,size:s,label:p,id:b,className:u,disabled:c,...T}){let x=Nr.useId(),m=b??x,g=s??"md",d=a??"primary",f=ol[g],w=n!=null||o!=null,[h,P]=Nr.useState(t),k=e??h,N=Nr.useCallback(F=>{let R=F.target.checked;e===void 0&&P(R),r?.(R);},[e,r]);return jsxRuntime.jsxs("label",{htmlFor:m,className:i("inline-flex cursor-pointer items-center gap-2",c&&"pointer-events-none opacity-50",u),children:[jsxRuntime.jsx("input",{...T,id:m,type:"checkbox",role:"switch",className:"sr-only",checked:k,disabled:c,onChange:N,"aria-checked":k}),jsxRuntime.jsxs("span",{className:i("relative inline-flex shrink-0 items-center rounded-full transition-colors duration-200",w?f.trackH:f.trackFixed,Br({intent:a,size:s,checked:k?"on":"off"})),children:[w?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{className:i("pointer-events-none invisible inline-grid",f.icon),children:[jsxRuntime.jsx("span",{className:i("[grid-area:1/1] whitespace-nowrap",f.pad),children:n}),jsxRuntime.jsx("span",{className:i("[grid-area:1/1] whitespace-nowrap",f.pad),children:o})]}),jsxRuntime.jsx("span",{className:i("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",f.contentLeft,f.icon,al[d],k?"opacity-100":"opacity-0"),children:n}),jsxRuntime.jsx("span",{className:i("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",f.contentRight,f.icon,"text-primary-400 dark:text-primary-500",k?"opacity-0":"opacity-100"),children:o})]}):null,jsxRuntime.jsx("span",{className:i("pointer-events-none absolute rounded-full bg-white shadow-sm transition-[left] duration-200 ease-in-out",f.thumb,f.thumbTop,k?f.thumbOn:f.thumbOff)})]}),p&&jsxRuntime.jsx("span",{className:"select-none text-sm text-primary-700 dark:text-primary-300",children:p})]})}var dl={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function eo({checked:e,defaultChecked:t=false,indeterminate:r=false,onCheckedChange:n,intent:o,size:a,label:s,id:p,className:b,disabled:u,...c}){let T=Nr.useId(),x=p??T,m=a??"md",[g,d]=Nr.useState(t),f=e??g,w=Nr.useCallback(P=>{let k=P.target.checked;e===void 0&&d(k),n?.(k);},[e,n]),h=f||r;return jsxRuntime.jsxs("label",{htmlFor:x,className:i("inline-flex cursor-pointer items-center gap-2 select-none",u&&"pointer-events-none opacity-50",b),children:[jsxRuntime.jsx("input",{...c,id:x,type:"checkbox",className:"sr-only",checked:f,disabled:u,onChange:w}),jsxRuntime.jsx("span",{className:i(Ar({intent:o,size:a,checked:h?"on":"off"})),children:jsxRuntime.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:i("text-white transition-all duration-200",dl[m],h?"scale-100 opacity-100":"scale-0 opacity-0"),children:r?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"})})}),s&&jsxRuntime.jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:s})]})}var Za=Nr.createContext(null);function to({name:e,value:t,defaultValue:r,onValueChange:n,intent:o,size:a,disabled:s,orientation:p="vertical",className:b,children:u}){let c=Nr.useId(),T=e??c,[x,m]=Nr.useState(r),g=t??x,d=Nr.useCallback(f=>{t===void 0&&m(f),n?.(f);},[t,n]);return jsxRuntime.jsx(Za.Provider,{value:{name:T,value:g,onChange:d,intent:o,size:a,disabled:s},children:jsxRuntime.jsx("div",{role:"radiogroup",className:i("flex gap-2",p==="vertical"?"flex-col":"flex-row flex-wrap",b),children:u})})}var gl={sm:"h-1.5 w-1.5",md:"h-2 w-2",lg:"h-2.5 w-2.5"};function ro({value:e,intent:t,size:r,label:n,id:o,className:a,disabled:s,...p}){let b=Nr.useId(),u=o??b,c=Nr.useContext(Za),T=t??c?.intent,x=r??c?.size,m=x??"md",g=s??c?.disabled,d=p.name??c?.name,f=c?c.value===e:void 0,w=Nr.useCallback(h=>{h.target.checked&&c?.onChange(e);},[c,e]);return jsxRuntime.jsxs("label",{htmlFor:u,className:i("inline-flex cursor-pointer items-center gap-2 select-none",g&&"pointer-events-none opacity-50",a),children:[jsxRuntime.jsx("input",{...p,id:u,type:"radio",name:d,value:e,className:"sr-only",checked:f,disabled:g,onChange:w}),jsxRuntime.jsx("span",{className:i(zr({intent:T,size:x,checked:f?"on":"off"})),children:jsxRuntime.jsx("span",{className:i("rounded-full bg-white transition-all duration-200",gl[m],f?"scale-100 opacity-100":"scale-0 opacity-0")})}),n&&jsxRuntime.jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:n})]})}var bl={Button:Yt,Dropdown:On,DropdownButton:qt,Badge:Gn,Indicator:Un,Label:qn,Input:Zn,TextBox:Jn,Switch:Qn,Checkbox:eo,Radio:ro,RadioGroup:to},no=bl;var br=classVarianceAuthority.cva("rounded-lg transition-shadow",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",elevated:"bg-white shadow-md hover:shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25 dark:hover:shadow-primary-200/30",outlined:"border-2 border-primary-300 bg-transparent dark:border-primary-600",ghost:"bg-primary-50 dark:bg-primary-800/50"},size:{sm:"p-3",md:"p-5",lg:"p-7"}},defaultVariants:{intent:"default",size:"md"}}),jr=classVarianceAuthority.cva("rounded-md",{variants:{intent:{default:"border border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",inset:"bg-primary-50 dark:bg-primary-800/50",elevated:"bg-white shadow-lg dark:bg-primary-800 dark:shadow-primary-300/25"},size:{sm:"p-3",md:"p-4",lg:"p-6"}},defaultVariants:{intent:"default",size:"md"}});function oo({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("div",{className:i(br({intent:e,size:t}),r),...n})}function xl({className:e,...t}){return jsxRuntime.jsx("div",{className:i("mb-4 space-y-1",e),...t})}function yl({className:e,...t}){return jsxRuntime.jsx("h3",{className:i("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function vl({className:e,...t}){return jsxRuntime.jsx("p",{className:i("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function wl({className:e,...t}){return jsxRuntime.jsx("div",{className:i("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function kl({className:e,...t}){return jsxRuntime.jsx("div",{className:i("border-primary-100 dark:border-primary-800 mt-4 flex items-center gap-2 border-t pt-4",e),...t})}function Nl({intent:e,media:t,mediaPosition:r="left",stackOnMobile:n=false,className:o,children:a,...s}){let p=jsxRuntime.jsx("div",{className:i("relative shrink-0 overflow-hidden",n?"h-48 w-full rounded-t-lg sm:h-auto sm:w-auto":"",!n&&(r==="left"?"rounded-l-lg":"rounded-r-lg")),style:n?void 0:{width:t.width??"10rem"},children:t.src?jsxRuntime.jsx("img",{src:t.src,alt:t.alt??"",className:"h-full w-full object-cover",draggable:false}):t.icon?jsxRuntime.jsx("div",{className:"bg-primary-100 text-primary-500 dark:bg-primary-800 dark:text-primary-400 flex h-full w-full items-center justify-center",children:t.icon}):null});return jsxRuntime.jsxs("div",{className:i(br({intent:e}),"flex overflow-hidden p-0",n?"flex-col sm:flex-row":"",!n&&r==="right"&&"flex-row-reverse",!n&&r==="left"&&"flex-row",o),...s,children:[p,jsxRuntime.jsx("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:a})]})}function ao({src:e,alt:t="",aspectRatio:r="16/9",className:n,children:o,...a}){return jsxRuntime.jsxs("div",{className:i("group overflow-hidden rounded-xl border transition-shadow duration-300","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white","dark:hover:shadow-primary-900/60 hover:shadow-lg",n),...a,children:[jsxRuntime.jsxs("div",{className:"relative overflow-hidden",style:{aspectRatio:r},children:[jsxRuntime.jsx("img",{src:e,alt:t,className:"h-full w-full object-cover transition-transform duration-500 ease-out group-hover:scale-110",draggable:false}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100","aria-hidden":true,children:jsxRuntime.jsx("div",{className:"animate-light-sweep absolute inset-0"})})]}),o]})}function Tl({className:e,...t}){return jsxRuntime.jsx("div",{className:i("space-y-2 p-4",e),...t})}function Rl({className:e,...t}){return jsxRuntime.jsx("h3",{className:i("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function Ml({className:e,...t}){return jsxRuntime.jsx("p",{className:i("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Sl({className:e,...t}){return jsxRuntime.jsx("div",{className:i("border-primary-100 dark:border-primary-800 flex items-center gap-2 border-t px-4 py-3",e),...t})}function io({intent:e,size:t,className:r,...n}){return jsxRuntime.jsx("div",{className:i(jr({intent:e,size:t}),r),...n})}function Ll({className:e,...t}){return jsxRuntime.jsx("div",{className:i("border-primary-200 text-primary-900 dark:border-primary-700 dark:text-primary-100 mb-3 flex items-center gap-1.5 border-b pb-3 text-sm font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function El({className:e,...t}){return jsxRuntime.jsx("div",{className:i("text-primary-700 dark:text-primary-300 text-sm",e),...t})}var Pl={Card:oo,ImageCard:ao,Panel:io},lo=Pl;var Yr=classVarianceAuthority.cva("w-full text-left text-sm",{variants:{intent:{default:"",striped:"[&_tbody_tr:nth-child(even)]:bg-primary-50 dark:[&_tbody_tr:nth-child(even)]:bg-primary-800/30",bordered:"[&_th]:border [&_td]:border [&_th]:border-primary-200 [&_td]:border-primary-200 dark:[&_th]:border-primary-700 dark:[&_td]:border-primary-700"},density:{compact:"[&_th]:px-2 [&_th]:py-1 [&_td]:px-2 [&_td]:py-1",default:"",relaxed:"[&_th]:px-6 [&_th]:py-5 [&_td]:px-6 [&_td]:py-5"}},defaultVariants:{intent:"default",density:"default"}}),Gr=classVarianceAuthority.cva("text-sm text-primary-700 dark:text-primary-300",{variants:{intent:{default:"space-y-1",bordered:"divide-y divide-primary-200 rounded-lg border border-primary-200 dark:divide-primary-700 dark:border-primary-700 [&>li]:px-4 [&>li]:py-2",hover:"[&>li]:rounded-md [&>li]:px-3 [&>li]:py-2 [&>li]:transition-colors [&>li:hover]:bg-primary-50 dark:[&>li:hover]:bg-primary-800/50"}},defaultVariants:{intent:"default"}}),Ur=classVarianceAuthority.cva("group flex w-full items-center gap-1.5 text-left [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3 [&_svg]:w-3",md:"py-1.5 text-sm [&_svg]:h-3.5 [&_svg]:w-3.5",lg:"py-2 text-base [&_svg]:h-4 [&_svg]:w-4"}},defaultVariants:{size:"md"}}),qr=classVarianceAuthority.cva("flex cursor-pointer items-center gap-1 rounded transition-colors [&_svg]:shrink-0",{variants:{size:{sm:"py-0.5 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-1 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-1.5 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),yr=classVarianceAuthority.cva("overflow-x-auto rounded-lg font-mono [background:var(--color-syntax-bg)] [&_pre]:m-0 [&_pre]:p-4 [&_code]:bg-transparent",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}});function kr({intent:e,density:t,className:r,...n}){return jsxRuntime.jsx("div",{className:"w-full overflow-auto",children:jsxRuntime.jsx("table",{className:i(Yr({intent:e,density:t}),r),...n})})}function mo({className:e,...t}){return jsxRuntime.jsx("thead",{className:i("bg-primary-50 text-primary-600 dark:bg-primary-800/50 dark:text-primary-400",e),...t})}function po({className:e,...t}){return jsxRuntime.jsx("tbody",{className:i("[&_tr:last-child]:border-0",e),...t})}function wr({className:e,...t}){return jsxRuntime.jsx("tr",{className:i("border-primary-200 hover:bg-primary-50/50 dark:border-primary-700 dark:hover:bg-primary-800/30 border-b transition-colors",e),...t})}function It({className:e,...t}){return jsxRuntime.jsx("th",{className:i("px-4 py-3 text-left text-xs font-semibold tracking-wider uppercase",e),...t})}function Ht({className:e,...t}){return jsxRuntime.jsx("td",{className:i("text-primary-700 dark:text-primary-300 px-4 py-3",e),...t})}function uo({icon:e,text:t="No data",className:r}){return jsxRuntime.jsxs("div",{className:i("flex flex-col items-center justify-center gap-3 py-16 text-primary-400 dark:text-primary-500",r),children:[e??jsxRuntime.jsx(lucideReact.Inbox,{className:"h-12 w-12 stroke-[1.2]"}),jsxRuntime.jsx("span",{className:"text-sm",children:t})]})}var ei={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"};function Kl({columns:e,data:t,sort:r,onSortChange:n,defaultSort:o=null,rowKey:a,rowActions:s,intent:p,density:b,className:u,empty:c}){let[T,x]=Nr.useState(o),m=r??T,g=Nr.useCallback(f=>{let w=m?.column===f?m.direction==="asc"?{column:f,direction:"desc"}:null:{column:f,direction:"asc"};n?n(w):x(w);},[m,n]),d=Nr.useMemo(()=>{if(!m)return t;let f=e.find(P=>P.key===m.column);if(!f)return t;let w=f.compareFn??((P,k)=>{let N=f.cell(P),F=f.cell(k);return N==null&&F==null?0:N==null?-1:F==null?1:typeof N=="number"&&typeof F=="number"?N-F:String(N).localeCompare(String(F))}),h=[...t].sort(w);return m.direction==="desc"?h.reverse():h},[t,m,e]);return jsxRuntime.jsxs(kr,{intent:p,density:b,className:u,children:[jsxRuntime.jsx(mo,{children:jsxRuntime.jsxs(wr,{children:[e.map(f=>{let w=f.sortable!==false,h=m?.column===f.key;return jsxRuntime.jsx(It,{className:i(w&&"cursor-pointer select-none",f.headerClassName,f.hideBelow&&ei[f.hideBelow]),onClick:w?()=>g(f.key):void 0,"aria-sort":h?m.direction==="asc"?"ascending":"descending":void 0,children:jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1",children:[f.header,w&&jsxRuntime.jsx(ti,{active:h,direction:h?m.direction:null})]})},f.key)}),s&&jsxRuntime.jsx(It,{className:"w-20 text-right",children:"Actions"})]})}),jsxRuntime.jsx(po,{children:d.length===0?jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:e.length+(s?1:0),children:jsxRuntime.jsx(uo,{...c})})}):d.map((f,w)=>jsxRuntime.jsxs(wr,{children:[e.map(h=>jsxRuntime.jsx(Ht,{className:i(h.cellClassName,h.hideBelow&&ei[h.hideBelow]),children:h.cell(f)},h.key)),s&&jsxRuntime.jsx(Ht,{className:"text-right",children:jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1",children:s(f)})})]},a?a(f,w):w))})]})}function Wl({value:e,onCommit:t,onCancel:r}){let[n,o]=Nr.useState(e),a=Nr.useRef(null);Nr.useEffect(()=>{a.current?.focus(),a.current?.select();},[]);let s=()=>t(n);return jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("input",{ref:a,type:"text",value:n,onChange:p=>o(p.target.value),onKeyDown:p=>{p.key==="Enter"&&s(),p.key==="Escape"&&r();},"aria-label":"Edit cell",className:"min-w-0 flex-1 rounded border border-primary-400 bg-white px-1.5 py-0.5 text-sm outline-none focus:ring-1 focus:ring-primary-400 dark:border-primary-600 dark:bg-secondary-800"}),jsxRuntime.jsx("button",{type:"button",onClick:s,className:"text-success-600 hover:text-success-700 dark:text-success-400","aria-label":"Confirm",children:jsxRuntime.jsx(lucideReact.Check,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{type:"button",onClick:r,className:"text-danger-500 hover:text-danger-600 dark:text-danger-400","aria-label":"Cancel",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})}function Xl({columns:e,data:t,rowKey:r,sort:n,onSortChange:o,defaultSort:a=null,selectionMode:s="none",selected:p,onSelectionChange:b,editable:u=false,onCellEdit:c,toolbar:T=false,onAdd:x,onDelete:m,rowActions:g,intent:d,density:f,className:w,empty:h}){let[P,k]=Nr.useState(a),N=n??P,F=Nr.useCallback(V=>{let G=N?.column===V?N.direction==="asc"?{column:V,direction:"desc"}:null:{column:V,direction:"asc"};o?o(G):k(G);},[N,o]),R=Nr.useMemo(()=>{if(!N)return t;let V=e.find(W=>W.key===N.column);if(!V)return t;let G=V.compareFn??((W,l)=>{let D=V.cell(W),X=V.cell(l);return D==null&&X==null?0:D==null?-1:X==null?1:typeof D=="number"&&typeof X=="number"?D-X:String(D).localeCompare(String(X))}),me=[...t].sort(G);return N.direction==="desc"?me.reverse():me},[t,N,e]),[E,A]=Nr.useState([]),H=p??E,y=b??A,O=Nr.useMemo(()=>R.map((V,G)=>r(V,G)),[R,r]),v=s==="multiple"&&O.length>0&&O.every(V=>H.includes(V)),ne=s==="multiple"&&H.length>0&&!v,C=Nr.useCallback(V=>{s==="single"?y(H.includes(V)?[]:[V]):s==="multiple"&&y(H.includes(V)?H.filter(G=>G!==V):[...H,V]);},[s,H,y]),re=Nr.useCallback(()=>{y(v?[]:O);},[v,O,y]),[_,de]=Nr.useState(null),j=Nr.useCallback((V,G,me)=>{u&&me!==false&&de({rowKey:V,colKey:G});},[u]),pe=Nr.useCallback((V,G,me)=>{c?.(V,G,me),de(null);},[c]);return jsxRuntime.jsxs("div",{className:"space-y-2",children:[T&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[x&&jsxRuntime.jsxs("button",{type:"button",onClick:x,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"h-3.5 w-3.5"})," Add"]}),m&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>m(H),disabled:H.length===0,className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-danger-600 transition-colors hover:bg-danger-50 disabled:opacity-40 disabled:pointer-events-none dark:border-secondary-600 dark:bg-secondary-800 dark:text-danger-400 dark:hover:bg-danger-900/20",children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-3.5 w-3.5"})," Delete",H.length>0&&` (${H.length})`]}),u&&H.length===1&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>{let V=e.find(G=>G.editable!==false);V&&de({rowKey:H[0],colKey:V.key});},className:"inline-flex items-center gap-1.5 rounded-md border border-secondary-300 bg-white px-3 py-1.5 text-sm font-medium text-secondary-700 transition-colors hover:bg-secondary-50 dark:border-secondary-600 dark:bg-secondary-800 dark:text-secondary-300 dark:hover:bg-secondary-700",children:[jsxRuntime.jsx(lucideReact.Pencil,{className:"h-3.5 w-3.5"})," Edit"]}),H.length>0&&jsxRuntime.jsxs("span",{className:"ml-auto text-sm text-secondary-500 dark:text-secondary-400",children:[H.length," row",H.length>1?"s":""," selected"]})]}),jsxRuntime.jsxs(kr,{intent:d,density:f,className:w,children:[jsxRuntime.jsx(mo,{children:jsxRuntime.jsxs(wr,{children:[s==="multiple"&&jsxRuntime.jsx(It,{className:"w-10",children:jsxRuntime.jsx("input",{type:"checkbox",checked:v,ref:V=>{V&&(V.indeterminate=ne);},onChange:re,className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select all"})}),s==="single"&&jsxRuntime.jsx(It,{className:"w-10"}),e.map(V=>{let G=V.sortable!==false,me=N?.column===V.key;return jsxRuntime.jsx(It,{className:i(G&&"cursor-pointer select-none",V.headerClassName),onClick:G?()=>F(V.key):void 0,"aria-sort":me?N.direction==="asc"?"ascending":"descending":void 0,children:jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-1",children:[V.header,G&&jsxRuntime.jsx(ti,{active:me,direction:me?N.direction:null})]})},V.key)}),g&&jsxRuntime.jsx(It,{className:"w-20 text-right",children:"Actions"})]})}),jsxRuntime.jsx(po,{children:R.length===0?jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:e.length+(s!=="none"?1:0)+(g?1:0),children:jsxRuntime.jsx(uo,{...h})})}):R.map((V,G)=>{let me=r(V,G),W=H.includes(me);return jsxRuntime.jsxs(wr,{className:i(W&&"bg-primary-50/60 dark:bg-primary-900/20"),onClick:()=>{s!=="none"&&C(me);},children:[s==="multiple"&&jsxRuntime.jsx(Ht,{className:"w-10",children:jsxRuntime.jsx("input",{type:"checkbox",checked:W,onChange:()=>C(me),onClick:l=>l.stopPropagation(),className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select row"})}),s==="single"&&jsxRuntime.jsx(Ht,{className:"w-10",children:jsxRuntime.jsx("input",{type:"radio",checked:W,onChange:()=>C(me),onClick:l=>l.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-primary-600","aria-label":"Select row"})}),e.map(l=>{let D=_?.rowKey===me&&_?.colKey===l.key,X=l.editValue?.(V)??(()=>{let $=l.cell(V);return typeof $=="string"||typeof $=="number"?String($):""})();return jsxRuntime.jsx(Ht,{className:i(l.cellClassName,u&&l.editable!==false&&"cursor-text"),onDoubleClick:$=>{$.stopPropagation(),j(me,l.key,l.editable);},children:D?jsxRuntime.jsx(Wl,{value:X,onCommit:$=>pe(me,l.key,$),onCancel:()=>de(null)}):l.cell(V)},l.key)}),g&&jsxRuntime.jsx(Ht,{className:"text-right",onClick:l=>l.stopPropagation(),children:jsxRuntime.jsx("span",{className:"inline-flex items-center gap-1",children:g(V)})})]},me)})})]})]})}function ti({active:e,direction:t}){let r="h-3.5 w-3.5 shrink-0";return !e||!t?jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:i(r,"opacity-30")}):t==="asc"?jsxRuntime.jsx(lucideReact.ArrowUp,{className:i(r,"opacity-70")}):jsxRuntime.jsx(lucideReact.ArrowDown,{className:i(r,"opacity-70")})}var ri=Nr.createContext({size:"md"});function fo({intent:e,size:t="md",className:r,...n}){return jsxRuntime.jsx(ri.Provider,{value:{size:t},children:jsxRuntime.jsx("ul",{className:i(Gr({intent:e}),r),...n})})}function Gl({actions:e,className:t,children:r,...n}){let{size:o}=Nr.useContext(ri);return jsxRuntime.jsxs("li",{className:i(Ur({size:o}),t),...n,children:[jsxRuntime.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:r}),e&&jsxRuntime.jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",children:e})]})}var ai=Nr.createContext({showLines:true,expandedKeys:null,onToggleKey:()=>{},size:"md"});function go({showLines:e=true,showRoot:t=true,expandedKeys:r,defaultExpandedKeys:n="all",onExpandedKeysChange:o,size:a="md",className:s,children:p,...b}){let [u,c]=Nr.useState(()=>n),x=Nr.useCallback(g=>{if(r){let d=new Set(r);d.has(g)?d.delete(g):d.add(g),o?.(d);}else c(d=>{if(d==="all")return new Set(["__ALL_MINUS__",g]);let f=new Set(d);return f.has(g)?f.delete(g):f.add(g),f});},[r,o]),m=r??(u==="all"?null:u);return jsxRuntime.jsx(ai.Provider,{value:{showLines:e,expandedKeys:m,onToggleKey:x,size:a},children:t?jsxRuntime.jsx("ul",{className:i("text-sm",s),role:"tree",...b,children:p}):jsxRuntime.jsx("ul",{className:i("text-sm",s),role:"tree",...b,children:jsxRuntime.jsx(ec,{children:p})})})}function ec({children:e}){let t=ii(e);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:t.map(r=>Nr__default.default.isValidElement(r)&&r.props.children?r.props.children:null)})}function ii(e){let t=[];return Nr__default.default.Children.forEach(e,r=>{Nr__default.default.isValidElement(r)&&r.type===Nr__default.default.Fragment?t.push(...ii(r.props.children)):t.push(r);}),t}function tc({nodeKey:e,label:t,icon:r,actions:n,defaultExpanded:o=false,expanded:a,onToggle:s,children:p,className:b}){let{showLines:u,expandedKeys:c,onToggleKey:T,size:x}=Nr.useContext(ai),[m,g]=Nr.useState(o),d=Nr__default.default.Children.count(p)>0,f=e??(typeof t=="string"?t:""),w;a!=null?w=a:c!=null&&f?c.has("__ALL_MINUS__")?w=!c.has(f):w=c.has(f):w=m;let h=()=>{let P=!w;s?s(P):c!=null&&f?T(f):g(P);};return jsxRuntime.jsxs("li",{className:i("select-none",b),role:"treeitem","aria-expanded":d?w:void 0,children:[jsxRuntime.jsxs("div",{className:i("group hover:bg-primary-50 dark:hover:bg-primary-800/50 rounded-md px-1",qr({size:x}),d?"cursor-pointer":"cursor-default"),onClick:d?h:void 0,children:[d?jsxRuntime.jsx(lucideReact.ChevronRight,{className:i("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",w&&"rotate-90")}):jsxRuntime.jsx("span",{className:"w-4 shrink-0"}),r&&jsxRuntime.jsx("span",{className:"shrink-0",children:r}),jsxRuntime.jsx("span",{className:"text-primary-700 dark:text-primary-300 min-w-0 flex-1 truncate",children:t}),n&&jsxRuntime.jsx("span",{className:"ml-auto flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100 [@media(hover:none)]:[&>button]:min-h-(--row-action-touch-min) [@media(hover:none)]:[&>button]:min-w-(--row-action-touch-min) [@media(hover:none)]:[&>button]:flex [@media(hover:none)]:[&>button]:items-center [@media(hover:none)]:[&>button]:justify-center",onClick:P=>P.stopPropagation(),children:n})]}),d&&jsxRuntime.jsx("div",{className:i("grid transition-[grid-template-rows] duration-200 ease-out",w?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("ul",{className:i("ml-4 pl-2",u&&"border-primary-200 dark:border-primary-700 border-l"),role:"group",children:p})})})]})}function ac({avatar:e,sender:t}){return e?typeof e=="string"?/^(?:https?|data|blob):/.test(e)?jsxRuntime.jsx("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:false}):jsxRuntime.jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):jsxRuntime.jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function ic({msg:e,alignRight:t}){return jsxRuntime.jsxs("div",{className:i("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsxRuntime.jsx(ac,{avatar:e.avatar,sender:e.sender}),jsxRuntime.jsxs("div",{className:i("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[jsxRuntime.jsx("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),jsxRuntime.jsx("div",{className:i("rounded-xl px-3 py-2 text-sm leading-relaxed",t?"rounded-tr-sm bg-primary-500 text-white dark:bg-primary-600":"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-200 rounded-tl-sm"),children:e.content}),e.time&&jsxRuntime.jsx("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function bo({messages:e,mode:t="split",autoScroll:r=true,className:n,...o}){let a=Nr.useRef(null);return Nr.useEffect(()=>{r&&a.current?.scrollIntoView({behavior:"smooth"});},[e,r]),jsxRuntime.jsxs("div",{className:i("flex flex-col gap-4 overflow-y-auto rounded-lg border p-4","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white",n),...o,children:[e.map(s=>{let p=t==="split"&&!!s.self;return jsxRuntime.jsx(ic,{msg:s,alignRight:p},s.id)}),jsxRuntime.jsx("div",{ref:a})]})}var cc={name:"onyx-css-vars",type:"dark",settings:[{settings:{foreground:"var(--color-syntax-plain)",background:"var(--color-syntax-bg)"}},{scope:["comment","punctuation.definition.comment"],settings:{foreground:"var(--color-syntax-comment)",fontStyle:"italic"}},{scope:["keyword","keyword.control","keyword.operator.new","keyword.operator.expression","storage.type","storage.modifier"],settings:{foreground:"var(--color-syntax-keyword)"}},{scope:["string","string.quoted","string.template"],settings:{foreground:"var(--color-syntax-string)"}},{scope:["entity.name.function","support.function","meta.function-call"],settings:{foreground:"var(--color-syntax-function)"}},{scope:["variable","variable.other","variable.parameter","meta.definition.variable"],settings:{foreground:"var(--color-syntax-variable)"}},{scope:["constant.numeric","constant.language"],settings:{foreground:"var(--color-syntax-number)"}},{scope:["keyword.operator","keyword.operator.assignment","keyword.operator.comparison","keyword.operator.arithmetic"],settings:{foreground:"var(--color-syntax-operator)"}},{scope:["entity.name.tag","punctuation.definition.tag","support.class.component"],settings:{foreground:"var(--color-syntax-tag)"}},{scope:["entity.other.attribute-name","meta.tag.attributes"],settings:{foreground:"var(--color-syntax-attr)"}},{scope:["punctuation","meta.brace","punctuation.definition.block","punctuation.separator","punctuation.terminator"],settings:{foreground:"var(--color-syntax-punctuation)"}},{scope:["entity.name.type","support.type","support.class","entity.other.inherited-class"],settings:{foreground:"var(--color-syntax-type)"}}]},dc={typescript:()=>import('@shikijs/langs/typescript'),javascript:()=>import('@shikijs/langs/javascript'),tsx:()=>import('@shikijs/langs/tsx'),jsx:()=>import('@shikijs/langs/jsx'),html:()=>import('@shikijs/langs/html'),css:()=>import('@shikijs/langs/css'),json:()=>import('@shikijs/langs/json'),markdown:()=>import('@shikijs/langs/markdown'),python:()=>import('@shikijs/langs/python'),rust:()=>import('@shikijs/langs/rust'),go:()=>import('@shikijs/langs/go'),java:()=>import('@shikijs/langs/java'),c:()=>import('@shikijs/langs/c'),cpp:()=>import('@shikijs/langs/cpp'),csharp:()=>import('@shikijs/langs/csharp'),vue:()=>import('@shikijs/langs/vue'),xml:()=>import('@shikijs/langs/xml'),yaml:()=>import('@shikijs/langs/yaml'),sql:()=>import('@shikijs/langs/sql'),bash:()=>import('@shikijs/langs/bash'),shell:()=>import('@shikijs/langs/shell')},vo=null,si=new Set;function mc(){return vo||(vo=Promise.all([import('shiki/core'),import('shiki/engine/javascript')]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>e({themes:[cc],langs:[],engine:t()}))),vo}async function pc(e,t,r){let n=await mc();if(t&&!si.has(t)){let a=dc[t];if(a)try{let s=await a();await n.loadLanguage(s.default??s),si.add(t);}catch{t="text";}else t="text";}let o=n.codeToHtml(e,{lang:t||"text",theme:"onyx-css-vars"});if(o=o.replace(/(<pre [^>]*style=")/,"$1line-height:1.7;tab-size:2;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;"),r){let a=0;o=o.replace(/<span class="line">/g,()=>(a++,`<span class="line"><span class="line-number" data-line="${a}"></span>`));}return o}function wo({code:e,language:t="text",lineNumbers:r=false,editable:n=false,onCodeChange:o,size:a,className:s,...p}){let[b,u]=Nr.useState(""),c=Nr.useRef(null),T=Nr.useRef(null),x=Nr.useRef(null);Nr.useEffect(()=>{let k=false;return pc(e,t,n?false:r).then(N=>{k||u(N);}),()=>{k=true;}},[e,t,r,n]);let m=Nr.useCallback(()=>{let k=T.current,N=x.current?.querySelector("pre"),F=c.current?.querySelector("[data-gutter]");k&&N&&(N.scrollTop=k.scrollTop,N.scrollLeft=k.scrollLeft),k&&F&&(F.scrollTop=k.scrollTop);},[]),g=Nr.useCallback(k=>{o?.(k.target.value);},[o]),d=Nr.useCallback(k=>{if(k.key==="Tab"){k.preventDefault();let N=k.currentTarget,F=N.selectionStart,R=N.selectionEnd,E=N.value.substring(0,F)+" "+N.value.substring(R);o?.(E),requestAnimationFrame(()=>{N.selectionStart=N.selectionEnd=F+2;});}},[o]),f=r&&"[&_.line-number]:inline-block [&_.line-number]:w-8 [&_.line-number]:mr-4 [&_.line-number]:text-right [&_.line-number]:text-secondary-400 [&_.line-number]:select-none [&_.line-number]:before:content-[attr(data-line)]",w="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",h=1.7,P=e.split(`
2
+ `).length;return n?jsxRuntime.jsxs("div",{ref:c,className:i(yr({size:a}),"flex border border-primary-200 dark:border-primary-700",s),style:{background:"var(--color-syntax-bg)"},...p,children:[r&&jsxRuntime.jsx("div",{"data-gutter":true,"aria-hidden":true,className:"shrink-0 select-none overflow-hidden py-4 pl-3 pr-1 text-right text-secondary-400",style:{fontFamily:w,lineHeight:h,width:"3rem"},children:Array.from({length:P},(k,N)=>jsxRuntime.jsx("div",{children:N+1},N))}),jsxRuntime.jsxs("div",{className:"relative min-w-0 flex-1",children:[jsxRuntime.jsx("textarea",{ref:T,value:e,onChange:g,onScroll:m,onKeyDown:d,spellCheck:false,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",className:"relative z-2 m-0 block h-full w-full resize-none overflow-auto whitespace-pre border-none bg-transparent p-4 text-transparent caret-primary-600 outline-none dark:caret-primary-400",style:{fontFamily:w,lineHeight:h,tabSize:2,minHeight:"6rem"}}),jsxRuntime.jsx("div",{ref:x,"aria-hidden":true,className:"pointer-events-none absolute inset-0 z-1 overflow-hidden [&_pre]:m-0 [&_pre]:h-full [&_pre]:overflow-hidden [&_pre]:p-4 [&_code]:bg-transparent",dangerouslySetInnerHTML:b?{__html:b}:void 0})]})]}):jsxRuntime.jsx("div",{ref:c,className:i(yr({size:a}),"border border-primary-200 dark:border-primary-700",f,s),style:{background:"var(--color-syntax-bg)"},...p,children:jsxRuntime.jsx("div",{ref:x,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:b?{__html:b}:void 0,children:b?void 0:jsxRuntime.jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children:jsxRuntime.jsx("code",{children:e})})})})}var uc={Table:kr,List:fo,Tree:go,Chat:bo,CodeBlock:wo},ko=uc;var zt="flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors cursor-pointer",di="bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100 font-medium",er="text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200",tr="flex items-center justify-center rounded-md p-2 transition-colors cursor-pointer text-primary-600 dark:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-800/50 hover:text-primary-900 dark:hover:text-primary-200";function wc({to:e,className:t,style:r,children:n}){let o=typeof t=="function"?t({isActive:false}):t;return jsxRuntime.jsx("a",{href:e,className:o,style:r,children:n})}var No=["expanded","icons","mini"];function kc(e){let t=No.indexOf(e);return No[(t+1)%No.length]}function mi(e){let t=new Set;for(let r of e)if(r.children&&r.children.length>0){t.add(r.key??r.label);for(let n of mi(r.children))t.add(n);}return t}function pi({item:e,basePath:t,depth:r,onItemClick:n,LinkComponent:o,showLines:a,expandedKeys:s,onToggle:p}){let b=e.key??e.label,u=e.children&&e.children.length>0,[c,T]=Nr.useState(e.defaultOpen??true),x=s?s.has(b):c,m=Nr.useCallback(()=>{s?p(b):T(d=>!d);},[s,p,b]),g=r>0?`${r*1.25}rem`:void 0;if(u)return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{type:"button",onClick:m,className:i(zt,er,"justify-between"),style:{paddingLeft:g},children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),jsxRuntime.jsx(lucideReact.ChevronRight,{className:i("h-3.5 w-3.5 transition-transform",x&&"rotate-90")})]}),x&&jsxRuntime.jsx("div",{className:i("flex flex-col gap-0.5 pt-0.5",a?"ml-2.5 border-l border-primary-200 dark:border-primary-700":"ml-2"),children:e.children.map(d=>jsxRuntime.jsx(pi,{item:d,basePath:t,depth:r+1,onItemClick:n,LinkComponent:o,showLines:a,expandedKeys:s,onToggle:p},d.key??d.path??d.label))})]});if(e.path!=null){let d=t+e.path;return n?jsxRuntime.jsxs("button",{type:"button",onClick:()=>n(e,d),className:i(zt,er),style:{paddingLeft:g},children:[e.icon,e.label]}):jsxRuntime.jsxs(o,{to:d,className:({isActive:f})=>i(zt,f?di:er),style:{paddingLeft:g},children:[e.icon,e.label]})}return jsxRuntime.jsxs("span",{className:i(zt,er,"cursor-default"),style:{paddingLeft:g},children:[e.icon,e.label]})}function Nc({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let[o,a]=Nr.useState(false),s=Nr.useRef(null),p=Nr.useRef(void 0),[b,u]=Nr.useState({top:0,left:0}),c=()=>{clearTimeout(p.current),a(true);},T=()=>{p.current=setTimeout(()=>a(false),200);};Nr.useLayoutEffect(()=>{if(o&&s.current){let m=s.current.getBoundingClientRect();u({top:m.top,left:m.right+4});}},[o]);let x=e.icon||jsxRuntime.jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return jsxRuntime.jsxs("div",{onMouseEnter:c,onMouseLeave:T,children:[jsxRuntime.jsx("button",{ref:s,type:"button",className:i(tr,"w-full"),title:e.label,onClick:()=>a(m=>!m),children:x}),o&&reactDom.createPortal(jsxRuntime.jsxs("div",{className:"fixed z-50 min-w-44 rounded-md border border-primary-200 bg-white p-1 shadow-lg dark:border-primary-700 dark:bg-primary-900",style:{top:b.top,left:b.left},onMouseEnter:c,onMouseLeave:T,children:[jsxRuntime.jsx("div",{className:"px-2.5 py-1.5 text-xs font-semibold uppercase text-primary-500 dark:text-primary-400",children:e.label}),jsxRuntime.jsx("div",{className:"flex flex-col gap-0.5",children:e.children?.map(m=>{let g=m.key??m.path??m.label;if(m.path!=null){let d=t+m.path;return r?jsxRuntime.jsxs("button",{type:"button",onClick:()=>{r(m,d),a(false);},className:i(zt,er),children:[m.icon,m.label]},g):jsxRuntime.jsxs(n,{to:d,className:({isActive:f})=>i(zt,f?di:er),children:[m.icon,m.label]},g)}return jsxRuntime.jsxs("span",{className:i(zt,"cursor-default text-primary-400"),children:[m.icon,m.label]},g)})})]}),document.body)]})}function Cc({item:e,basePath:t,onItemClick:r,LinkComponent:n}){let o=e.icon||jsxRuntime.jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});if(e.path!=null){let a=t+e.path;return r?jsxRuntime.jsx("button",{type:"button",onClick:()=>r(e,a),className:i(tr,"w-full"),title:e.label,children:o}):jsxRuntime.jsx(n,{to:a,className:({isActive:s})=>i(tr,"w-full",s&&"bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100"),children:jsxRuntime.jsx("span",{title:e.label,children:o})})}return jsxRuntime.jsx("span",{className:i(tr,"w-full cursor-default"),title:e.label,children:o})}function To({items:e,title:t,basePath:r="/",onItemClick:n,LinkComponent:o=wc,collapsible:a,collapseMode:s,defaultCollapseMode:p="expanded",onCollapseModeChange:b,showLines:u=true,expandedKeys:c,defaultExpandedKeys:T="all",onExpandedKeysChange:x,className:m,responsive:g=true,mobileBreakpoint:d=768,mobileTopOffset:f=48,...w}){let[h,P]=Nr.useState(p),k=s??h,N=Nr__default.default.useMemo(()=>mi(e),[e]),[F,R]=Nr.useState(()=>T==="all"?new Set(N):new Set(T)),E=c??null,A=E??F,H=Nr.useCallback(W=>{let l=new Set(A);l.has(W)?l.delete(W):l.add(W),R(l),x?.(l);},[A,x]),y=Nr.useCallback(()=>{let W=kc(k);P(W),b?.(W);},[k,b]),[O,v]=Nr.useState(()=>g&&typeof window<"u"&&window.innerWidth<d),[ne,C]=Nr.useState(false);Nr.useEffect(()=>{if(!g||typeof window>"u"||!window.matchMedia)return;let W=window.matchMedia(`(max-width: ${d-1}px)`),l=D=>{v(D.matches),D.matches||C(false);};return W.addEventListener("change",l),()=>W.removeEventListener("change",l)},[g,d]);let re=Nr.useCallback(W=>{W.target.closest("a")&&C(false);},[]),_=Nr.useRef(null),de=Nr.useRef({startX:0,startY:0,dragging:false}),pe=Nr.useCallback(W=>{let l=W.touches[0];de.current={startX:l.clientX,startY:l.clientY,dragging:true};},[]),Y=Nr.useCallback(W=>{if(!de.current.dragging||!_.current)return;let l=W.touches[0],D=l.clientX-de.current.startX,X=l.clientY-de.current.startY;D>=0||Math.abs(X)>Math.abs(D)||(_.current.style.transform=`translateX(${Math.max(D,-224)}px)`,_.current.style.transition="none");},[]),V=Nr.useCallback(W=>{if(!de.current.dragging||!_.current)return;de.current.dragging=false;let l=W.changedTouches[0],D=l.clientX-de.current.startX,X=l.clientY-de.current.startY;_.current.style.transition="",_.current.style.transform="",D<-60&&Math.abs(D)>Math.abs(X)&&C(false);},[]),G=Nr.useMemo(()=>!O||!n?n:(W,l)=>{C(false),n(W,l);},[O,n]),me=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[a&&!O&&jsxRuntime.jsx("div",{className:i("flex shrink-0 mb-1",k==="expanded"?"justify-end":"justify-center"),children:jsxRuntime.jsx("button",{type:"button",onClick:y,className:tr,"aria-label":k==="mini"?"Expand sidebar":"Collapse sidebar",title:k==="mini"?"Expand sidebar":"Collapse sidebar",children:k==="mini"?jsxRuntime.jsx(lucideReact.Menu,{className:"h-5 w-5"}):jsxRuntime.jsx(lucideReact.ChevronsLeft,{className:"h-4 w-4"})})}),(O||k==="expanded")&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t&&jsxRuntime.jsx("h2",{className:"text-primary-500 dark:text-primary-400 mb-3 text-sm font-semibold uppercase",children:t}),e.map(W=>jsxRuntime.jsx(pi,{item:W,basePath:r,depth:0,onItemClick:G,LinkComponent:o,showLines:u,expandedKeys:E,onToggle:H},W.key??W.path??W.label))]}),!O&&k==="icons"&&e.map(W=>{let l=W.key??W.path??W.label;return W.children&&W.children.length>0?jsxRuntime.jsx(Nc,{item:W,basePath:r,onItemClick:G,LinkComponent:o},l):jsxRuntime.jsx(Cc,{item:W,basePath:r,onItemClick:G,LinkComponent:o},l)})]});return g&&O?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ne&&reactDom.createPortal(jsxRuntime.jsx("div",{className:"fixed inset-0 z-40 bg-black/50",style:{top:f},onClick:()=>C(false)}),document.body),reactDom.createPortal(jsxRuntime.jsxs("aside",{ref:_,className:i("fixed bottom-0 left-0 z-50 flex flex-col w-56 border-r border-primary-200 dark:border-primary-700 bg-white dark:bg-primary-900 shadow-xl transition-transform duration-200",ne?"translate-x-0":"-translate-x-full"),style:{top:f},onClick:re,onTouchStart:pe,onTouchMove:Y,onTouchEnd:V,children:[jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:[jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-500 dark:text-primary-400",children:"Navigation"}),jsxRuntime.jsx("button",{type:"button",onClick:W=>{W.stopPropagation(),C(false);},className:i(tr,"h-7 w-7 p-1"),"aria-label":"Close navigation",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overscroll-y-contain p-3",children:jsxRuntime.jsx("nav",{className:"flex flex-col gap-0.5",children:me})})]}),document.body),!ne&&reactDom.createPortal(jsxRuntime.jsx("button",{type:"button",className:"fixed left-0 z-50 flex h-14 w-5 items-center justify-center rounded-r-xl bg-primary-800/80 text-white shadow-md backdrop-blur-sm transition-colors hover:bg-primary-700/90 dark:bg-primary-200/80 dark:text-primary-900 dark:hover:bg-primary-300/90",style:{top:`calc(50% + ${f/2}px)`,transform:"translateY(-50%)"},onClick:()=>C(true),"aria-label":"Open navigation",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-3.5 w-3.5"})}),document.body)]}):jsxRuntime.jsx("nav",{className:i("flex flex-col gap-0.5",k==="mini"&&"items-center",m),...w,children:me})}function Mc({href:e,className:t,onClick:r,children:n}){return jsxRuntime.jsx("a",{href:e,className:t,onClick:r,children:n})}function Ro({brand:e,onBrandClick:t,navItems:r=[],actions:n=[],linkComponent:o=Mc,height:a="h-12",mobileMenu:s=false,navMenuIcon:p,actionsMenuIcon:b,className:u,children:c}){let T=s&&r.length>0,x=s&&n.length>0,m="md:hidden rounded-md px-1.5 py-1.5 text-primary-500 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-200 [&_svg]:h-5 [&_svg]:w-5",g=h=>h?"text-primary-900 font-medium dark:text-primary-100":"text-primary-500 hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-200 transition-colors",d="rounded-md p-1.5 text-primary-500 hover:bg-primary-100 hover:text-primary-700 dark:text-primary-400 dark:hover:bg-primary-800 dark:hover:text-primary-200 transition-colors [&_svg]:h-5 [&_svg]:w-5",f=r.map((h,P)=>({key:typeof h.label=="string"?h.label:String(P),label:h.active?jsxRuntime.jsx("span",{className:"font-semibold text-primary-900 dark:text-primary-100",children:h.label}):h.label,onClick:()=>{h.onClick?h.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):h.href&&(window.location.href=h.href);}})),w=n.map((h,P)=>({key:h.key??String(P),label:jsxRuntime.jsxs("span",{className:"flex items-center gap-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:[h.icon,jsxRuntime.jsx("span",{children:h.ariaLabel})]}),onClick:()=>{h.onClick?h.onClick({preventDefault:()=>{},stopPropagation:()=>{}}):h.href&&(h.external?window.open(h.href,"_blank","noopener,noreferrer"):window.location.href=h.href);}}));return jsxRuntime.jsxs("header",{className:i("flex shrink-0 items-center justify-between border-b px-5","border-primary-200 bg-white dark:border-primary-700 dark:bg-primary-900",a,u),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 md:gap-6",children:[e&&jsxRuntime.jsx("div",{className:i("text-lg font-bold text-primary-800 dark:text-primary-100",t&&"cursor-pointer"),onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,onKeyDown:t?h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),t(h));}:void 0,children:e}),T&&jsxRuntime.jsx(qt,{intent:"ghost",size:"sm",className:m,label:p??jsxRuntime.jsx(lucideReact.PanelLeft,{className:"h-5 w-5"}),items:f,align:"left",chevron:false,"aria-label":"Open navigation"}),r.length>0&&jsxRuntime.jsx("nav",{className:i("flex items-center gap-4 text-sm",s?"hidden md:flex":"flex"),children:r.map((h,P)=>{let k=typeof h.label=="string"?h.label:P,N=g(h.active);return h.href?jsxRuntime.jsx(o,{href:h.href,className:N,onClick:h.onClick,children:h.label},k):jsxRuntime.jsx("button",{type:"button",className:i(N,"cursor-pointer"),onClick:h.onClick,children:h.label},k)})})]}),c&&jsxRuntime.jsx("div",{className:"flex items-center",children:c}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[n.length>0&&jsxRuntime.jsx("div",{className:i("flex items-center gap-1",s?"hidden md:flex":"flex"),children:n.map((h,P)=>h.href?jsxRuntime.jsx("a",{href:h.href,target:h.external?"_blank":void 0,rel:h.external?"noopener noreferrer":void 0,className:d,"aria-label":h.ariaLabel,onClick:h.onClick,children:h.icon},h.key??P):jsxRuntime.jsx("button",{type:"button",className:d,"aria-label":h.ariaLabel,onClick:h.onClick,children:h.icon},h.key??P))}),x&&jsxRuntime.jsx(qt,{intent:"ghost",size:"sm",className:m,label:b??jsxRuntime.jsx(lucideReact.MoreHorizontal,{className:"h-5 w-5"}),items:w,align:"right",chevron:false,"aria-label":"Open menu"})]})]})}var tn=classVarianceAuthority.cva("inline-flex items-center gap-1 underline-offset-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/20 [&_svg]:shrink-0",{variants:{intent:{default:"text-primary-600 hover:text-primary-800 active:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:active:text-primary-100",secondary:"text-secondary-500 hover:text-secondary-700 active:text-secondary-800 dark:text-secondary-400 dark:hover:text-secondary-200 dark:active:text-secondary-100",muted:"text-primary-400 hover:text-primary-600 dark:text-primary-500 dark:hover:text-primary-300"},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"},underline:{always:"underline",hover:"hover:underline",none:"no-underline"}},defaultVariants:{intent:"default",size:"md",underline:"none"}});function Lc(e,t){return !!(t==="_blank"||e&&/^https?:\/\//.test(e))}var Ec=e=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,...e,children:[jsxRuntime.jsx("path",{d:"M15 3h6v6"}),jsxRuntime.jsx("path",{d:"M10 14 21 3"}),jsxRuntime.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]});function Mo({intent:e,size:t,underline:r,external:n,className:o,children:a,href:s,target:p,rel:b,...u}){let c=n??Lc(s,p);return jsxRuntime.jsxs("a",{href:s,target:c&&!p?"_blank":p,rel:c&&!b?"noopener noreferrer":b,className:i(tn({intent:e,size:t,underline:r}),o),...u,children:[a,c&&jsxRuntime.jsx(Ec,{})]})}var Pc={SideNav:To,Header:Ro,NavLink:Mo},So=Pc;var nn=classVarianceAuthority.cva("flex w-full items-center justify-between font-medium transition-all [&_svg]:shrink-0",{variants:{size:{sm:"py-2 text-xs [&_svg]:h-3.5 [&_svg]:w-3.5",md:"py-3 text-sm [&_svg]:h-4 [&_svg]:w-4",lg:"py-4 text-base [&_svg]:h-5 [&_svg]:w-5"}},defaultVariants:{size:"md"}}),on=classVarianceAuthority.cva("",{variants:{size:{sm:"pb-2 text-xs",md:"pb-3 text-sm",lg:"pb-4 text-base"}},defaultVariants:{size:"md"}}),an=classVarianceAuthority.cva("divide-y",{variants:{intent:{default:"divide-primary-300 dark:divide-primary-700",bordered:"divide-primary-300 rounded-lg border border-primary-300 bg-white px-3 shadow-sm dark:divide-primary-700 dark:border-primary-700 dark:bg-primary-800/50",ghost:"divide-transparent"}},defaultVariants:{intent:"default"}}),sn=classVarianceAuthority.cva("flex",{variants:{intent:{line:"border-b border-primary-200 dark:border-primary-700",pills:"gap-1 rounded-lg bg-primary-100 p-1 dark:bg-primary-800",underline:"gap-4"}},defaultVariants:{intent:"line"}}),ln=classVarianceAuthority.cva("inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",{variants:{intent:{line:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:hover:text-primary-200 dark:data-[active=true]:text-primary-100",pills:"rounded-md text-primary-600 hover:text-primary-900 data-[active=true]:bg-white data-[active=true]:text-primary-900 data-[active=true]:shadow-sm dark:text-primary-400 dark:hover:text-primary-100 dark:data-[active=true]:bg-primary-700 dark:data-[active=true]:text-primary-100",underline:"text-primary-500 hover:text-primary-700 data-[active=true]:text-primary-900 dark:text-primary-400 dark:data-[active=true]:text-primary-100"}},defaultVariants:{intent:"line"}});var cn=Nr.createContext(null),Lo=Nr.createContext(null);function Eo({type:e="single",defaultValue:t=[],value:r,onValueChange:n,intent:o,size:a,className:s,children:p,...b}){let[u,c]=Nr.useState(t),T=r??u,x=Nr.useCallback(m=>{let g=d=>d.includes(m)?d.filter(f=>f!==m):e==="single"?[m]:[...d,m];n?n(g(T)):c(g);},[e,T,n]);return jsxRuntime.jsx(cn.Provider,{value:{expandedItems:T,toggleItem:x,size:a},children:jsxRuntime.jsx("div",{className:i(an({intent:o}),s),...b,children:p})})}function Hc({value:e,className:t,children:r,...n}){let a=Nr.useContext(cn)?.expandedItems.includes(e)??false;return jsxRuntime.jsx(Lo.Provider,{value:{value:e,isExpanded:a},children:jsxRuntime.jsx("div",{className:i("",t),...n,children:r})})}function Fc({className:e,children:t,...r}){let n=Nr.useContext(cn),o=Nr.useContext(Lo);return jsxRuntime.jsxs("button",{className:i("text-primary-800 hover:text-primary-600 dark:text-primary-100 dark:hover:text-primary-300 cursor-pointer gap-2 font-medium transition-colors",nn({size:n?.size}),e),onClick:()=>o&&n?.toggleItem(o.value),"aria-expanded":o?.isExpanded?"true":"false",...r,children:[jsxRuntime.jsx("span",{className:"flex items-center gap-1.5 [&_svg]:shrink-0",children:t}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:i("shrink-0 transition-transform duration-200",o?.isExpanded&&"rotate-180")})]})}function Ac({className:e,children:t,...r}){let n=Nr.useContext(cn),o=Nr.useContext(Lo);return jsxRuntime.jsx("div",{className:i("grid transition-[grid-template-rows] duration-200 ease-out",o?.isExpanded?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsxRuntime.jsx("div",{className:"overflow-hidden",children:jsxRuntime.jsx("div",{className:i("text-primary-500 dark:text-primary-400",on({size:n?.size}),e),...r,children:t})})})}var Mr=Nr.createContext(null),yi=Nr.createContext(false);function Po({defaultValue:e="",value:t,onValueChange:r,intent:n,children:o,className:a}){let[s,p]=Nr.useState(e),b=t??s,u=Nr.useRef(new Map),c=Nr.useCallback(x=>{r?r(x):p(x);},[r]),T=Nr.useCallback((x,m)=>{m?u.current.set(x,m):u.current.delete(x);},[]);return jsxRuntime.jsx(Mr.Provider,{value:{activeValue:b,setActiveValue:c,intent:n,registerTrigger:T},children:jsxRuntime.jsx("div",{className:a,children:o})})}function $c({className:e,scrollable:t,...r}){let n=Nr.useContext(Mr),o=Nr.useRef(null),[a,s]=Nr.useState(null),p=Nr.useCallback(()=>{if(!n||!o.current)return;let T=o.current.querySelectorAll('[role="tab"][data-active="true"]')[0];if(!T){s(null);return}let x=o.current.getBoundingClientRect(),m=T.getBoundingClientRect();s({left:m.left-x.left,width:m.width});},[n]);Nr.useLayoutEffect(p,[n?.activeValue,p]),Nr.useEffect(()=>{let c=new ResizeObserver(p);return o.current&&c.observe(o.current),()=>c.disconnect()},[p]);let b=n?.intent??"line",u=a&&(b==="line"||b==="underline");return jsxRuntime.jsxs("div",{ref:o,className:i(sn({intent:n?.intent}),"relative",t&&"overflow-x-auto",e),role:"tablist",...r,children:[r.children,u&&jsxRuntime.jsx("span",{className:"absolute bottom-0 h-0.5 rounded-full bg-primary-600 dark:bg-primary-400 transition-all duration-300 ease-in-out",style:{left:a.left,width:a.width},"aria-hidden":true})]})}function Oc({value:e,className:t,children:r,...n}){let o=Nr.useContext(Mr),a=o?.activeValue===e,s=Nr.useCallback(p=>o?.registerTrigger(e,p),[o,e]);return jsxRuntime.jsx("button",{ref:s,className:i(ln({intent:o?.intent}),t),role:"tab","data-active":a,"aria-selected":a,onClick:()=>o?.setActiveValue(e),...n,children:r})}function Kc({className:e,children:t,...r}){let n=Nr.useContext(Mr);if(!n)return null;let o=Nr__default.default.Children.toArray(t).filter(s=>Nr__default.default.isValidElement(s)),a=Math.max(0,o.findIndex(s=>s.props.value===n.activeValue));return jsxRuntime.jsx("div",{className:i("overflow-hidden",e),...r,children:jsxRuntime.jsx(yi.Provider,{value:true,children:jsxRuntime.jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${a*100}%)`},children:o.map((s,p)=>jsxRuntime.jsx("div",{className:"w-full shrink-0","aria-hidden":p!==a,children:s},s.props.value??p))})})})}function Wc({value:e,className:t,children:r,...n}){let o=Nr.useContext(Mr);return Nr.useContext(yi)?jsxRuntime.jsx("div",{className:i("pt-4",t),role:"tabpanel",...n,children:r}):o?.activeValue!==e?null:jsxRuntime.jsx("div",{className:i("pt-4",t),role:"tabpanel",...n,children:r})}var jc={Accordion:Eo,Tabs:Po},Vo=jc;var Sr=classVarianceAuthority.cva("rounded-lg bg-white p-6 shadow-xl dark:bg-primary-900",{variants:{size:{sm:"w-full max-w-sm",md:"w-full max-w-lg",lg:"w-full max-w-2xl",xl:"w-full max-w-4xl",full:"h-[calc(100vh-4rem)] w-[calc(100vw-4rem)]"}},defaultVariants:{size:"md"}}),mn=classVarianceAuthority.cva("absolute z-50 rounded px-2 py-1 text-xs shadow-md animate-fade-in",{variants:{intent:{default:"bg-primary-900 text-white dark:bg-primary-100 dark:text-primary-900",light:"border border-primary-200 bg-white text-primary-700 dark:border-primary-600 dark:bg-primary-800 dark:text-primary-200"}},defaultVariants:{intent:"default"}});var wt=[];function Zc(e){wt.push(e);}function Jc(e){let t=wt.indexOf(e);t!==-1&&wt.splice(t,1);}function Io(e){return wt.length>0&&wt[wt.length-1]===e}function Qc(e){let t=wt.indexOf(e);return t!==-1?t:wt.length}var Ho=Nr.createContext(null);function Lr({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:n=false,children:o}){let a=Nr.useId();return Nr.useEffect(()=>{if(e)return Zc(a),()=>Jc(a)},[e,a]),Nr.useEffect(()=>{if(!e||!r)return;let s=p=>{p.key==="Escape"&&Io(a)&&t(false);};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,r,t,a]),Nr.useEffect(()=>{if(!e||!r)return;let s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s;}},[e,r]),e?jsxRuntime.jsx(Ho.Provider,{value:{id:a,onOpenChange:t,modal:r,closeOnOutsideClick:n},children:reactDom.createPortal(o,document.body)}):null}function Fo({size:e,position:t="center",className:r,children:n,...o}){let a=Nr.useContext(Ho);if(!a)return null;let p=200+Qc(a.id)*10,b=()=>{a.closeOnOutsideClick&&Io(a.id)&&a.onOpenChange(false);},u=t==="bottom";return a.modal?jsxRuntime.jsx("div",{className:i("animate-fade-in fixed inset-0 bg-black/50",u?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:p},onClick:b,children:jsxRuntime.jsx("div",{className:i(Sr({size:e}),u?"animate-slide-in-bottom w-full rounded-b-none rounded-t-(--dialog-sheet-radius) max-h-[85vh] overflow-y-auto":"animate-scale-in",r),role:"dialog","aria-modal":"true",onClick:c=>c.stopPropagation(),...o,children:n})}):jsxRuntime.jsx("div",{className:i("fixed inset-0 flex items-center justify-center p-4",a.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:p},onClick:a.closeOnOutsideClick&&Io(a.id)?()=>a.onOpenChange(false):void 0,children:jsxRuntime.jsx("div",{className:i(Sr({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",r),role:"dialog",onClick:a.closeOnOutsideClick?c=>c.stopPropagation():void 0,...o,children:n})})}function Ao({className:e,...t}){return jsxRuntime.jsx("div",{className:i("mb-4 space-y-1",e),...t})}function zo({className:e,...t}){return jsxRuntime.jsx("h2",{className:i("text-primary-900 dark:text-primary-100 flex items-center gap-1.5 text-lg font-semibold [&_svg]:h-5 [&_svg]:w-5 [&_svg]:shrink-0",e),...t})}function Bo({className:e,...t}){return jsxRuntime.jsx("p",{className:i("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function _o({className:e,...t}){return jsxRuntime.jsx("div",{className:i("mt-6 flex justify-end gap-2",e),...t})}function ed({className:e,...t}){let r=Nr.useContext(Ho);return jsxRuntime.jsx("button",{className:i("text-primary-400 hover:text-primary-600 dark:hover:text-primary-200 absolute top-4 right-4 rounded-md p-1 transition-colors",e),onClick:()=>r?.onOpenChange(false),"aria-label":"Close",...t,children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})}var td={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"};function $o({content:e,position:t="top",intent:r,delay:n=200,maxWidth:o,children:a,className:s}){let[p,b]=Nr.useState(false),[u,c]=Nr.useState();return jsxRuntime.jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>{let m=setTimeout(()=>b(true),n);c(m);},onMouseLeave:()=>{clearTimeout(u),b(false);},children:[a,p&&jsxRuntime.jsx("span",{className:i(mn({intent:r}),td[t],"pointer-events-none",o?"whitespace-normal":"whitespace-nowrap",s),style:o!==void 0?{maxWidth:o}:void 0,role:"tooltip",children:e})]})}var od={Dialog:Lr,Tooltip:$o},Oo=od;var pn=classVarianceAuthority.cva("relative w-full overflow-hidden rounded-full bg-primary-200 dark:bg-primary-700",{variants:{size:{xs:"h-1",sm:"h-2",md:"h-3",lg:"h-4"},intent:{primary:"[&_.progress-fill]:bg-primary-500",success:"[&_.progress-fill]:bg-success-500",warning:"[&_.progress-fill]:bg-warning-500",danger:"[&_.progress-fill]:bg-danger-500"},edge:{none:"rounded-full",top:"fixed top-0 left-0 right-0 z-50 rounded-none",bottom:"fixed bottom-0 left-0 right-0 z-50 rounded-none"}},defaultVariants:{size:"md",intent:"primary",edge:"none"}}),rr=classVarianceAuthority.cva("text-primary-500 dark:text-primary-400",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),Er=classVarianceAuthority.cva("pointer-events-auto flex items-start gap-3 rounded-lg border p-4 shadow-lg transition-all",{variants:{intent:{success:"border-success-200 bg-success-50 text-success-800 dark:border-success-800 dark:bg-success-900/80 dark:text-success-200",warning:"border-warning-200 bg-warning-50 text-warning-800 dark:border-warning-800 dark:bg-warning-900/80 dark:text-warning-200",error:"border-danger-200 bg-danger-50 text-danger-800 dark:border-danger-800 dark:bg-danger-900/80 dark:text-danger-200",info:"border-primary-200 bg-primary-50 text-primary-800 dark:border-primary-800 dark:bg-primary-900/80 dark:text-primary-200"}},defaultVariants:{intent:"info"}});function Yo({intent:e,className:t,children:r,...n}){return jsxRuntime.jsx("div",{className:i(Er({intent:e}),t),role:"alert",...n,children:r})}function fd({className:e,...t}){return jsxRuntime.jsx("h5",{className:i("flex items-center gap-1.5 font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function gd({className:e,...t}){return jsxRuntime.jsx("span",{className:i("mt-0.5 shrink-0 [&_svg]:h-5 [&_svg]:w-5",e),...t})}function hd({className:e,...t}){return jsxRuntime.jsx("div",{className:i("flex-1 min-w-0 space-y-1",e),...t})}function bd({className:e,...t}){return jsxRuntime.jsx("p",{className:i("text-sm opacity-90",e),...t})}var xd=0,Bt=[],un=new Map,Wo=new Set;function yd(){return Bt}function Xo(){Wo.forEach(e=>e());}function Go(e){let t=un.get(e);t&&(clearTimeout(t),un.delete(e)),Bt=Bt.map(r=>r.id===e?{...r,exiting:true}:r),Xo(),setTimeout(()=>{Bt=Bt.filter(r=>r.id!==e),Xo();},200);}function vd(e){let t=`alert-${++xd}`;Bt=[...Bt,{...e,id:t}],Xo();let r=e.duration??5e3;if(r>0){let n=setTimeout(()=>{un.delete(t),Go(t);},r);un.set(t,n);}return t}var jo=16;function wd(e){jo=e;}var kd={"top-right":"right-4 items-end","top-left":"left-4 items-start","bottom-right":"bottom-4 right-4 items-end","bottom-left":"bottom-4 left-4 items-start","top-center":"left-1/2 -translate-x-1/2 items-center","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center"},Nd={"top-right":"animate-slide-in-right","top-left":"animate-slide-in-left","bottom-right":"animate-slide-in-right","bottom-left":"animate-slide-in-left","top-center":"animate-slide-in-top","bottom-center":"animate-slide-in-bottom"},Cd={success:lucideReact.CircleCheck,warning:lucideReact.TriangleAlert,error:lucideReact.CircleX,info:lucideReact.Info};function Td({alert:e,onClose:t}){let r=e.intent??"info",n=Cd[r],o=e.position??"top-right";return jsxRuntime.jsxs("div",{className:i(Er({intent:r}),Nd[o],e.exiting&&"opacity-0 transition-opacity duration-200","w-80 max-w-[calc(100vw-2rem)]"),role:"alert",children:[jsxRuntime.jsx(n,{className:"mt-0.5 h-5 w-5 shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1",children:[e.title&&jsxRuntime.jsx("p",{className:"font-semibold",children:e.title}),jsxRuntime.jsx("p",{className:i(e.title&&"text-sm opacity-90"),children:e.message})]}),jsxRuntime.jsx("button",{onClick:t,"aria-label":"Close notification",className:"shrink-0 cursor-pointer opacity-50 transition-opacity hover:opacity-100",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]})}var Rd=e=>e.startsWith("top");function Md(){let e=Nr.useSyncExternalStore(n=>(Wo.add(n),()=>Wo.delete(n)),yd),t=Nr.useRef(jo);if(Nr.useEffect(()=>{t.current=jo;},[]),e.length===0)return null;let r=e.reduce((n,o)=>{let a=o.position??"top-right";return (n[a]??(n[a]=[])).push(o),n},{});return reactDom.createPortal(jsxRuntime.jsx(jsxRuntime.Fragment,{children:Object.entries(r).map(([n,o])=>jsxRuntime.jsx("div",{style:Rd(n)?{top:`${t.current}px`}:void 0,className:i("pointer-events-none fixed z-100 flex flex-col gap-2",kd[n]),children:o.map(a=>jsxRuntime.jsx(Td,{alert:a,onClose:()=>Go(a.id)},a.id))},n))}),document.body)}var Ni=false;function Sd(){if(Ni)return;Ni=true;let e=document.createElement("div");e.id="alert-toast-root",document.body.appendChild(e),client.createRoot(e).render(jsxRuntime.jsx(Md,{}));}function Ld(){return Nr.useEffect(()=>{Sd();},[]),{addAlert:vd,removeAlert:Go}}function qo({value:e=0,size:t,intent:r,edge:n,showLabel:o=false,indeterminate:a=false,animated:s=false,duration:p=500,className:b,...u}){let c=Math.max(0,Math.min(100,e)),[T,x]=Nr.useState(0),m=Nr.useRef(0);Nr.useEffect(()=>{if(!a)return m.current=requestAnimationFrame(()=>{x(c);}),()=>{m.current&&cancelAnimationFrame(m.current);}},[c,a]);let g=o&&!a&&t!=="xs"&&t!=="sm",d=jsxRuntime.jsx("div",{role:"progressbar","aria-valuenow":a?void 0:c,"aria-valuemin":0,"aria-valuemax":100,className:i(pn({size:t,intent:r,edge:n}),b),...u,children:a?jsxRuntime.jsx("div",{className:"progress-fill absolute top-0 h-full rounded-full animate-progress-indeterminate"}):jsxRuntime.jsx("div",{className:i("progress-fill h-full rounded-full transition-[width] ease-out",s&&"animate-progress-shine"),style:{width:`${T}%`,transitionDuration:`${p}ms`},children:g&&jsxRuntime.jsxs("span",{className:"flex h-full items-center justify-end pr-2 text-[10px] font-semibold text-white",children:[Math.round(c),"%"]})})});return n==="top"||n==="bottom"?reactDom.createPortal(d,document.body):d}function fn({size:e}){let t=e==="sm"?20:e==="lg"?40:28;return jsxRuntime.jsx("svg",{className:"animate-spin-rotate",width:t,height:t,viewBox:"0 0 50 50",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{className:"animate-spin-dash stroke-current",cx:"25",cy:"25",r:"20",fill:"none",strokeWidth:"4",strokeLinecap:"round",strokeDasharray:"90 150",strokeDashoffset:"0"})})}function Jo({spinning:e=true,tip:t,size:r,className:n,children:o,...a}){return o?jsxRuntime.jsxs("div",{className:i("relative w-fit",n),...a,children:[jsxRuntime.jsx("div",{className:i("transition-all duration-200",e&&"pointer-events-none select-none blur-[1px]"),children:o}),e&&jsxRuntime.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsxRuntime.jsx(fn,{size:r}),t&&jsxRuntime.jsx("span",{className:i(rr({size:r}),"select-none"),children:t})]})]}):e?jsxRuntime.jsxs("div",{className:i("inline-flex flex-col items-center gap-2",n),...a,children:[jsxRuntime.jsx(fn,{size:r}),t&&jsxRuntime.jsx("span",{className:i(rr({size:r}),"select-none"),children:t})]}):null}var zd=0,Vr=[],Zo=new Set;function Bd(){return Vr}function Li(){Zo.forEach(e=>e());}function _d(e,t){let r=++zd;return Vr=[...Vr,{id:r,target:e,tip:t}],Li(),()=>$d(r)}function $d(e){Vr=Vr.filter(t=>t.id!==e),Li();}function Od(){return _d}var Mi=false;function Kd(){if(Mi||typeof document>"u")return;Mi=true;let e=document.createElement("div");e.id="jac-spin-portal",document.body.appendChild(e),import('react-dom/client').then(({createRoot:t})=>{t(e).render(jsxRuntime.jsx(Yd,{}));});}var gn=new Map;function Wd(e){let t=gn.get(e);if(t){t.count++;return}let r=getComputedStyle(e),n=e.style.position;r.position==="static"&&(e.style.position="relative"),gn.set(e,{count:1,original:n});}function Xd(e){let t=gn.get(e);t&&(t.count--,t.count<=0&&(e.style.position=t.original,gn.delete(e)));}function jd({entry:e}){return Nr.useEffect(()=>{let t=e.target;if(!Si(t))return Wd(t),()=>Xd(t)},[e.target]),Si(e.target)?reactDom.createPortal(jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center gap-3 bg-primary-900/40 dark:bg-primary-900/60",children:[jsxRuntime.jsx(fn,{size:"lg"}),e.tip&&jsxRuntime.jsx("span",{className:"select-none text-sm text-primary-100",children:e.tip})]}),document.body):reactDom.createPortal(jsxRuntime.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[inherit] bg-primary-50/60 dark:bg-primary-900/60",children:[jsxRuntime.jsx(fn,{size:"md"}),e.tip&&jsxRuntime.jsx("span",{className:i(rr({size:"md"}),"select-none"),children:e.tip})]}),e.target)}function Yd(){let e=Nr.useSyncExternalStore(t=>(Zo.add(t),()=>Zo.delete(t)),()=>Bd());return e.length===0?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.map(t=>jsxRuntime.jsx(jd,{entry:t},t.id))})}function Si(e){return e===document.documentElement||e===document.body}typeof document<"u"&&Kd();var Ud={Alert:Yo,ProgressBar:qo,Spin:Jo},Qo=Ud;var Di="#1c1914",Ii="#130f0b",mm="#2e261e",ta="#504638",nr="#6b5d4d",bn=`url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,pm=[{key:"like",icon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsxRuntime.jsx(lucideReact.ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5"}),activeIcon:jsxRuntime.jsx(lucideReact.Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsxRuntime.jsx(lucideReact.Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsxRuntime.jsx(lucideReact.Download,{className:"h-5 w-5"}),label:"Download"}];function ra({photos:e,layout:t="strip",actions:r=pm,onAction:n,className:o,showGrain:a=true,sheetTitle:s,sheetLabel:p}){let[b,u]=Nr.useState(null),[c,T]=Nr.useState(new Set),x=Nr.useCallback(f=>u(f),[]),m=Nr.useCallback(()=>u(null),[]),g=Nr.useCallback((f,w)=>{if(r.find(P=>P.key===f)?.toggle){let P=`${w}-${f}`;T(k=>{let N=new Set(k);return N.has(P)?N.delete(P):N.add(P),N});}n?.(f,e[w],w);},[r,n,e]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(t==="strip"?um:t==="sheet"?fm:gm,{photos:e,onPhotoClick:x,showGrain:a,className:o,sheetTitle:s,sheetLabel:p}),b!==null&&reactDom.createPortal(jsxRuntime.jsx(hm,{photos:e,currentIndex:b,onIndexChange:u,onClose:m,actions:r,activeActions:c,onAction:g,showGrain:a}),document.body)]})}function Vi({count:e=30}){return jsxRuntime.jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Di},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:mm}},r))})}function um({photos:e,onPhotoClick:t,showGrain:r,className:n}){let o=Nr.useRef(null);return jsxRuntime.jsxs("div",{className:i("select-none rounded-lg overflow-hidden",n),style:{background:Ii},children:[jsxRuntime.jsx(Vi,{count:Math.max(30,e.length*6)}),jsxRuntime.jsx("div",{ref:o,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:Di,scrollSnapType:"x mandatory"},children:e.map((a,s)=>jsxRuntime.jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(s),children:[jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:ta,width:280,height:187},children:[jsxRuntime.jsx("img",{src:a.src,alt:a.alt??a.title??"",className:"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110",draggable:false}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 mix-blend-multiply opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"rgba(255, 175, 60, 0.06)"}}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:bn,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 transition-opacity duration-300 group-hover:opacity-50",style:{background:"radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%)"}})]}),jsxRuntime.jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:nr},children:[String(s+1).padStart(2,"0"),s%2===0?"":"A"]})]},s))}),jsxRuntime.jsx(Vi,{count:Math.max(30,e.length*6)})]})}function fm({photos:e,onPhotoClick:t,showGrain:r,className:n,sheetTitle:o,sheetLabel:a}){return jsxRuntime.jsxs("div",{className:i("rounded-lg p-5",n),style:{background:Ii},children:[jsxRuntime.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:nr},children:o??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:nr},children:a??"Contact Sheet"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((s,p)=>jsxRuntime.jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${p*50}ms both`},onClick:()=>t(p),children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:nr},children:String(p+1).padStart(2,"0")}),jsxRuntime.jsxs("div",{className:"relative overflow-hidden rounded-[1px] border transition-all duration-300 group-hover:border-amber-600/50 group-hover:shadow-[0_0_20px_rgba(217,171,89,0.15)]",style:{borderColor:ta,aspectRatio:"3/2"},children:[jsxRuntime.jsx("img",{src:s.src,alt:s.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:bn}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 translate-y-full bg-linear-to-t from-black/70 to-transparent p-2 pt-6 transition-transform duration-300 group-hover:translate-y-0",children:jsxRuntime.jsx("span",{className:"text-xs font-medium text-white/90",children:s.title})})]})]},p))})]})}function gm({photos:e,onPhotoClick:t,showGrain:r,className:n}){let[o,a]=Nr.useState(false),[s,p]=Nr.useState(null),b=Math.min(e.length,8),u=e.slice(0,b),c=x=>{let m=Math.sin(x*137.508+1)*1e4,g=(m%12-6).toFixed(1),d=(m/7%8-4).toFixed(1),f=(m/13%6-3).toFixed(1);return `rotate(${g}deg) translate(${d}px, ${f}px)`},T=(x,m)=>{let g=(m-1)/2,d=((x-g)*7).toFixed(1),f=((x-g)*110).toFixed(0),w=(-Math.abs(x-g)*10+(s===x?-18:0)).toFixed(0);return `translateX(${f}px) translateY(${w}px) rotate(${d}deg)`};return jsxRuntime.jsxs("div",{className:i("flex flex-col items-center gap-4",n),children:[jsxRuntime.jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>a(true),onMouseLeave:()=>{a(false),p(null);},children:u.map((x,m)=>jsxRuntime.jsx("div",{className:"absolute cursor-pointer rounded-lg shadow-xl transition-all duration-500",style:{transitionTimingFunction:"cubic-bezier(0.34, 1.56, 0.64, 1)",transitionDelay:o?`${m*35}ms`:`${(b-m)*25}ms`,transform:o?T(m,u.length):c(m),zIndex:o?m+1:u.length-m,width:220,height:147},onClick:()=>t(m),onMouseEnter:()=>o&&p(m),onMouseLeave:()=>p(null),children:jsxRuntime.jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:o&&s===m?"rgba(217,171,89,0.5)":ta,boxShadow:o&&s===m?"0 25px 50px rgba(0,0,0,0.5), 0 0 30px rgba(217,171,89,0.1)":"0 10px 30px rgba(0,0,0,0.4)"},children:[jsxRuntime.jsx("img",{src:x.src,alt:x.alt??"",className:"h-full w-full object-cover",draggable:false}),r&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:bn}}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%)"}}),o&&s===m&&jsxRuntime.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-linear-to-t from-black/80 to-transparent p-3 pt-8",style:{animation:"reveal-up 0.25s ease-out"},children:jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90",children:x.title})})]})},m))}),e.length>b&&jsxRuntime.jsxs("span",{className:"font-mono text-xs",style:{color:nr},children:["+ ",e.length-b," more"]}),jsxRuntime.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:nr,opacity:o?0:.7},children:"Hover to explore"})]})}function hm({photos:e,currentIndex:t,onIndexChange:r,onClose:n,actions:o,activeActions:a,onAction:s,showGrain:p}){let b=e[t],[u,c]=Nr.useState(1),[T,x]=Nr.useState({x:0,y:0}),[m,g]=Nr.useState(false),[d,f]=Nr.useState(false),w=Nr.useRef(false),h=Nr.useRef({x:0,y:0}),P=Nr.useRef(null);Nr.useLayoutEffect(()=>{requestAnimationFrame(()=>f(true));},[]),Nr.useEffect(()=>{let y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=y;}},[]),Nr.useEffect(()=>{let y=O=>{switch(O.key){case "Escape":n();break;case "ArrowLeft":k(-1);break;case "ArrowRight":k(1);break;case "i":case "I":g(v=>!v);break}};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)}),Nr.useEffect(()=>{let y=P.current;if(!y)return;let O=v=>{v.preventDefault();let ne=v.deltaY<0?1.12:.89;c(C=>{let re=Math.min(8,Math.max(1,C*ne));return re<=1&&x({x:0,y:0}),re});};return y.addEventListener("wheel",O,{passive:false}),()=>y.removeEventListener("wheel",O)},[]);let k=Nr.useCallback(y=>{let O=t+y;O>=0&&O<e.length&&(r(O),c(1),x({x:0,y:0}));},[t,e.length,r]),N=Nr.useCallback(y=>{u<=1||(w.current=true,h.current={x:y.clientX,y:y.clientY},y.target.setPointerCapture(y.pointerId));},[u]),F=Nr.useCallback(y=>{if(!w.current)return;let O=y.clientX-h.current.x,v=y.clientY-h.current.y;h.current={x:y.clientX,y:y.clientY},x(ne=>({x:ne.x+O/u,y:ne.y+v/u}));},[u]),R=Nr.useCallback(()=>{w.current=false;},[]),E=Nr.useCallback(()=>{u>1?(c(1),x({x:0,y:0})):c(2.5);},[u]),A=y=>a.has(`${t}-${y}`),H=b.metadata;return jsxRuntime.jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/95",onClick:n}),p&&jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:bn,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxRuntime.jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxRuntime.jsxs("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[u.toFixed(1),"x"]}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>c(y=>Math.min(8,y*1.3)),title:"Zoom in",children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{c(y=>{let O=Math.max(1,y*.7);return O<=1&&x({x:0,y:0}),O});},title:"Zoom out",children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:n,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-5 w-5"})})]})]}),jsxRuntime.jsxs("div",{ref:P,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:u>1?"grab":"default"},onPointerDown:N,onPointerMove:F,onPointerUp:R,onDoubleClick:E,children:[jsxRuntime.jsx("img",{src:b.src,alt:b.alt??b.title??"",className:"max-h-full max-w-full select-none object-contain",style:{animation:"lightbox-photo-in 0.35s cubic-bezier(0.16, 1, 0.3, 1)",transform:`scale(${u}) translate(${T.x}px, ${T.y}px)`,transition:w.current?"none":"transform 0.15s ease-out"},draggable:false},t),t>0&&jsxRuntime.jsx("button",{className:"absolute left-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:y=>{y.stopPropagation(),k(-1);},children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&jsxRuntime.jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:y=>{y.stopPropagation(),k(1);},children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-6 w-6"})})]}),jsxRuntime.jsx("div",{className:i("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",m?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:jsxRuntime.jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[b.title&&jsxRuntime.jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:b.title}),b.description&&jsxRuntime.jsx("p",{className:"mb-4 max-w-xl border-l-2 border-amber-500/40 pl-4 text-sm leading-relaxed text-white/60 italic",style:{animation:"reveal-up 0.4s ease-out 0.1s both"},children:b.description}),H&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[H.camera&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",H.camera,H.lens&&jsxRuntime.jsx("span",{className:"text-white/40",children:"\xB7"}),H.lens&&H.lens]}),(H.aperture||H.shutter||H.iso)&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Aperture,{className:"h-3.5 w-3.5 text-amber-400/80"}),[H.aperture,H.shutter,H.iso&&`ISO ${H.iso}`].filter(Boolean).join(" \xB7 ")]}),H.date&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",H.date]}),H.location&&jsxRuntime.jsxs("span",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(lucideReact.MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",H.location]})]})]})}),jsxRuntime.jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[o.map(y=>{let O=y.toggle&&A(y.key);return jsxRuntime.jsx("button",{className:i("rounded-full p-2.5 transition-all duration-200",O?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>s(y.key,t),title:y.label,children:O&&y.activeIcon?y.activeIcon:y.icon},y.key)}),jsxRuntime.jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsxRuntime.jsx("button",{className:i("rounded-full p-2.5 transition-all duration-200",m?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>g(y=>!y),title:"Photo info (I)",children:jsxRuntime.jsx(lucideReact.Info,{className:"h-5 w-5"})})]})})]})}var na="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
3
3
  <rect width="200" height="200" fill="#1e1b2e"/>
4
4
  <circle cx="100" cy="100" r="60" fill="none" stroke="#6366f1" stroke-width="1.5" opacity="0.3"/>
5
5
  <circle cx="100" cy="100" r="20" fill="none" stroke="#6366f1" stroke-width="1" opacity="0.4"/>
6
6
  <text x="100" y="108" text-anchor="middle" font-family="monospace" font-size="18" fill="#6366f1" opacity="0.6">\u266A</text>
7
- </svg>`);function ko(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/60),r=Math.floor(e%60);return `${t}:${r.toString().padStart(2,"0")}`}function Bc(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var Kc={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},$c={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},jc={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function la({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:a,theme:s,docked:o=false,visible:l,onVisibleChange:p,onTrackChange:x,onLike:u,autoPlay:c=true,shuffle:w=false,loop:b=false,accent:m="#8b5cf6",className:v}){let [d,f]=zt.useState(t),[k,g]=zt.useState(false),[L,N]=zt.useState(0),[T,$]=zt.useState(0),[C,P]=zt.useState(.8),[A,V]=zt.useState(false),[y,K]=zt.useState(new Set),[W,ae]=zt.useState(false),[U,pe]=zt.useState(l??!o),[j,Y]=zt.useState(false),[F,oe]=zt.useState(false),[_,R]=zt.useState(w),[q,G]=zt.useState(b),H=zt.useRef(false),E=zt.useRef(null),se=zt.useRef(null),Q=zt.useRef(void 0),ie=l??U,Ee=a??Bc(r),ce=e[d],J=o,Ke=s==="dark"?"dark":s==="light"?"light":"",He="bg-(--mp-bg)",be="text-(--mp-text)",Z="text-(--mp-text-muted)",ee="text-(--accent)",Je="border-(--mp-border)";zt.useEffect(()=>{let i=E.current;i&&(i.src=ce.src,i.load(),k&&i.play().catch(()=>{}));},[d,ce.src]),zt.useEffect(()=>{if(!c||H.current)return;let i=E.current;if(!i)return;let M=()=>{H.current=true,g(true),i.play().catch(()=>{});};return i.addEventListener("canplaythrough",M,{once:true}),()=>i.removeEventListener("canplaythrough",M)},[c]),zt.useEffect(()=>{let i=E.current;i&&(k?i.play().catch(()=>{}):i.pause());},[k]),zt.useEffect(()=>{let i=E.current;i&&(i.volume=A?0:C);},[C,A]),zt.useEffect(()=>{let i=E.current;if(!i)return;let M=()=>N(i.currentTime),X=()=>$(i.duration),re=()=>{q?(i.currentTime=0,i.play().catch(()=>{})):$e();};return i.addEventListener("timeupdate",M),i.addEventListener("loadedmetadata",X),i.addEventListener("ended",re),()=>{i.removeEventListener("timeupdate",M),i.removeEventListener("loadedmetadata",X),i.removeEventListener("ended",re);}},[d,e.length]);let Pe=zt.useCallback(i=>{let M=(i%e.length+e.length)%e.length;f(M),N(0),x?.(M,e[M]),ie||(pe(true),p?.(true));},[e,ie,x,p]),$e=zt.useCallback(()=>{if(_){let i;do i=Math.floor(Math.random()*e.length);while(i===d&&e.length>1);Pe(i);}else Pe(d+1);},[Pe,d,_,e.length]),xe=zt.useCallback(()=>{if(_){let i;do i=Math.floor(Math.random()*e.length);while(i===d&&e.length>1);Pe(i);}else Pe(d-1);},[Pe,d,_,e.length]),Fe=zt.useCallback(()=>{let i=y.has(d);K(M=>{let X=new Set(M);return i?X.delete(d):X.add(d),X}),u?.(d,ce,!i);},[d,y,u,ce]),Lt=zt.useCallback(i=>{let M=i.currentTarget.getBoundingClientRect(),re=Math.max(0,Math.min(1,(i.clientX-M.left)/M.width))*T;E.current&&(E.current.currentTime=re),N(re);},[T]),je=zt.useCallback(()=>{Y(true);let i=J?200:400;Q.current=setTimeout(()=>{Y(false),pe(false),p?.(false);},i);},[J,p]);zt.useEffect(()=>()=>{Q.current&&clearTimeout(Q.current);},[]);let h=F?"fade-in 0.2s ease-out both":`mp-enter-${Ee} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,O=F?"fade-in 0.2s ease-in reverse both":`mp-exit-${Ee} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,le=T>0?L/T*100:0;return J&&!ie&&!j?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:E,preload:"metadata"}),jsxRuntime.jsxs("div",{className:n("fixed z-100 cursor-pointer transition-all duration-300",jc[r]),style:{"--accent":m},onMouseEnter:()=>{oe(true),pe(true),p?.(true);},children:[jsxRuntime.jsx("div",{className:n("h-full w-full rounded-full",k?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:k?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),k&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!ie&&!j?jsxRuntime.jsx("audio",{ref:E,preload:"metadata"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:E,preload:"metadata"}),jsxRuntime.jsx("div",{className:n("fixed z-100",J?$c[r]:Kc[r],Ke),style:{"--accent":m,...j?{animation:O}:{animation:h}},onMouseEnter:()=>{J&&(Q.current&&(clearTimeout(Q.current),Q.current=void 0),j&&Y(false),oe(true));},onMouseLeave:()=>{J&&(oe(false),je());},children:jsxRuntime.jsxs("div",{className:n("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",He,Je,J&&"rounded-none",r.endsWith("right")&&J&&"rounded-l-2xl",r.endsWith("left")&&J&&"rounded-r-2xl",v),children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsxRuntime.jsx("img",{src:ce.cover||ia,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxRuntime.jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxRuntime.jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxRuntime.jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:k?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsxRuntime.jsx("img",{src:ce.cover||ia,alt:ce.album??ce.title,className:"h-full w-full object-cover",draggable:false}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),k&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:n("truncate text-sm font-semibold",be),children:ce.title}),ce.artist&&jsxRuntime.jsx("div",{className:n("truncate text-xs",Z),children:ce.artist}),ce.album&&jsxRuntime.jsx("div",{className:n("mt-0.5 truncate text-[10px] tracking-wide",Z,"opacity-60"),children:ce.album})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:n("rounded-full p-1.5 transition-all duration-200",y.has(d)?"text-rose-500 hover:text-rose-400":n(Z,"hover:text-rose-500")),onClick:Fe,title:"Like",children:jsxRuntime.jsx(lucideReact.Heart,{className:"h-4 w-4",fill:y.has(d)?"currentColor":"none"})}),jsxRuntime.jsx("button",{className:n("rounded-full p-1.5 transition-colors",Z,"hover:"+be.split(" ")[0]),onClick:()=>ae(i=>!i),title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListMusic,{className:"h-4 w-4"})}),!J&&jsxRuntime.jsx("button",{className:n("rounded-full p-1.5 transition-colors",Z,"hover:"+be.split(" ")[0]),onClick:je,title:"Dismiss",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxRuntime.jsxs("div",{className:"px-4",children:[jsxRuntime.jsxs("div",{ref:se,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:Lt,children:[jsxRuntime.jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${le}%`}}),jsxRuntime.jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${le}% - 6px)`}})]}),jsxRuntime.jsxs("div",{className:n("mt-1 flex justify-between text-[10px] font-mono",Z),children:[jsxRuntime.jsx("span",{children:ko(L)}),jsxRuntime.jsx("span",{children:ko(T)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsxRuntime.jsx("button",{className:n("rounded-full p-1.5 transition-colors",_?ee:Z,"hover:text-(--mp-text)"),onClick:()=>R(i=>!i),title:_?"Shuffle On":"Shuffle Off",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:n("rounded-full p-1.5 transition-colors",q?ee:Z,"hover:text-(--mp-text)"),onClick:()=>G(i=>!i),title:q?"Loop On":"Loop Off",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:n("rounded-full p-2 transition-colors",Z,"hover:text-(--mp-text)"),onClick:xe,title:"Previous",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:n("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>g(i=>!i),title:k?"Pause":"Play",children:k?jsxRuntime.jsx(lucideReact.Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:n("rounded-full p-2 transition-colors",Z,"hover:text-(--mp-text)"),onClick:$e,title:"Next",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsxRuntime.jsx("button",{className:n("rounded-full p-1 transition-colors",Z,"hover:text-(--mp-text)"),onClick:()=>V(i=>!i),title:A?"Unmute":"Mute",children:A||C===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:A?0:C,onChange:i=>{P(Number(i.target.value)),A&&V(false);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsxRuntime.jsx("div",{className:n("overflow-hidden transition-all duration-300 ease-in-out",W?"max-h-60":"max-h-0"),children:jsxRuntime.jsx("div",{className:n("border-t px-2 py-2",Je),children:jsxRuntime.jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((i,M)=>{let X=M===d;return jsxRuntime.jsxs("button",{className:n("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",X?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{Pe(M),g(true);},children:[jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:X&&k?jsxRuntime.jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(re=>jsxRuntime.jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+re*4}px`,animation:`mp-eq-bar ${.4+re*.15}s ease-in-out infinite alternate`}},re))}):X?jsxRuntime.jsx(lucideReact.Disc3,{className:n("h-4 w-4",ee)}):jsxRuntime.jsx("span",{className:n("text-xs font-mono",Z),children:M+1})}),jsxRuntime.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsxRuntime.jsx("img",{src:i.cover||ia,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:n("truncate text-xs font-medium",X?ee:be),children:i.title}),i.artist&&jsxRuntime.jsx("div",{className:n("truncate text-[10px]",Z),children:i.artist})]}),y.has(M)&&jsxRuntime.jsx(lucideReact.Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},M)})})})})]})})]})}function Hr(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=Math.floor(e%60);return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}var sd={title:(e,t)=>e.title.localeCompare(t.title),type:(e,t)=>(e.type??"").localeCompare(t.type??""),duration:(e,t)=>(e.duration??0)-(t.duration??0)};function da({playlist:e,initialTrack:t=0,autoPlay:r=false,shuffle:a=false,loop:s=false,onTrackChange:o,onPlayChange:l,accent:p="#8b5cf6",className:x}){let[u,c]=zt.useState(t),[w,b]=zt.useState(false),[m,v]=zt.useState(0),[d,f]=zt.useState(0),[k,g]=zt.useState(0),[L,N]=zt.useState(.8),[T,$]=zt.useState(false),[C,P]=zt.useState(a),[A,V]=zt.useState(s),[y,K]=zt.useState(false),[W,ae]=zt.useState("title"),[U,pe]=zt.useState(true),[j,Y]=zt.useState(false),[F,oe]=zt.useState(false),[_,R]=zt.useState(false),[q,G]=zt.useState(true),[H,E]=zt.useState(false),[se,Q]=zt.useState(null),ie=zt.useRef(null),Ee=zt.useRef(null),ce=zt.useRef(void 0),Qe=zt.useRef(false),J=e[u],Ke=zt__default.default.useMemo(()=>{let i=e.map((M,X)=>({media:M,originalIndex:X}));return i.sort((M,X)=>{let re=sd[W](M.media,X.media);return U?re:-re}),i},[e,W,U]);zt.useEffect(()=>{let i=ie.current;if(!i)return;E(true),i.src=J.src,J.poster&&(i.poster=J.poster),i.load();let M=()=>{E(false),w&&i.play().catch(()=>{});};return i.addEventListener("loadeddata",M,{once:true}),()=>i.removeEventListener("loadeddata",M)},[u,J.src]),zt.useEffect(()=>{if(!r||Qe.current)return;let i=ie.current;if(!i)return;let M=()=>{Qe.current=true,b(true),i.play().catch(()=>{});};return i.addEventListener("canplaythrough",M,{once:true}),()=>i.removeEventListener("canplaythrough",M)},[r]),zt.useEffect(()=>{let i=ie.current;i&&(w?i.play().catch(()=>{}):i.pause(),l?.(w));},[w]),zt.useEffect(()=>{let i=ie.current;i&&(i.volume=T?0:L);},[L,T]),zt.useEffect(()=>{let i=ie.current;if(!i)return;let M=()=>v(i.currentTime),X=()=>f(i.duration),re=()=>{i.buffered.length>0&&g(i.buffered.end(i.buffered.length-1));},_e=()=>{A?(i.currentTime=0,i.play().catch(()=>{})):Z();};return i.addEventListener("timeupdate",M),i.addEventListener("loadedmetadata",X),i.addEventListener("progress",re),i.addEventListener("ended",_e),()=>{i.removeEventListener("timeupdate",M),i.removeEventListener("loadedmetadata",X),i.removeEventListener("progress",re),i.removeEventListener("ended",_e);}},[u,e.length,A]);let He=zt.useCallback(()=>{G(true),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>{w&&G(false);},3e3);},[w]);zt.useEffect(()=>{w?He():(G(true),ce.current&&clearTimeout(ce.current));},[w,He]),zt.useEffect(()=>()=>{ce.current&&clearTimeout(ce.current);},[]);let be=zt.useCallback(i=>{let M=(i%e.length+e.length)%e.length;c(M),v(0),b(true),o?.(M,e[M]);},[e,o]),Z=zt.useCallback(()=>{if(C){let i;do i=Math.floor(Math.random()*e.length);while(i===u&&e.length>1);be(i);}else be(u+1);},[be,u,C,e.length]),ee=zt.useCallback(()=>{if(C){let i;do i=Math.floor(Math.random()*e.length);while(i===u&&e.length>1);be(i);}else be(u-1);},[be,u,C,e.length]),Je=zt.useCallback(i=>{let M=i.currentTarget.getBoundingClientRect(),re=Math.max(0,Math.min(1,(i.clientX-M.left)/M.width))*d;ie.current&&(ie.current.currentTime=re),v(re);},[d]),Pe=zt.useCallback(i=>{let M=i.currentTarget.getBoundingClientRect(),X=Math.max(0,Math.min(1,(i.clientX-M.left)/M.width));Q(X*d);},[d]),$e=zt.useCallback(()=>{Ee.current&&(document.fullscreenElement?document.exitFullscreen():Ee.current.requestFullscreen());},[]);zt.useEffect(()=>{let i=()=>R(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",i),()=>document.removeEventListener("fullscreenchange",i)},[]);let xe=zt.useCallback(()=>{j?(oe(true),setTimeout(()=>{Y(false),oe(false);},500)):Y(true);},[j]),Fe=zt.useCallback(()=>{K(i=>!i);},[]),Lt=zt.useCallback(()=>{let i=["title","type","duration"],M=i.indexOf(W);U?pe(false):(pe(true),ae(i[(M+1)%i.length]));},[W,U]);zt.useEffect(()=>{let i=M=>{if(!(M.target instanceof HTMLInputElement||M.target instanceof HTMLTextAreaElement))switch(M.key){case " ":case "k":M.preventDefault(),b(X=>!X);break;case "f":M.preventDefault(),$e();break;case "t":M.preventDefault(),xe();break;case "ArrowLeft":M.preventDefault(),ie.current&&(ie.current.currentTime=Math.max(0,m-5));break;case "ArrowRight":M.preventDefault(),ie.current&&(ie.current.currentTime=Math.min(d,m+5));break;case "ArrowUp":M.preventDefault(),N(X=>Math.min(1,X+.05));break;case "ArrowDown":M.preventDefault(),N(X=>Math.max(0,X-.05));break;case "Escape":j&&xe();break;case "n":M.preventDefault(),Z();break;case "p":M.preventDefault(),ee();break;case "l":M.preventDefault(),Fe();break}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[$e,xe,Fe,Z,ee,m,d,j]);let je=d>0?m/d*100:0,h=d>0?k/d*100:0,O="text-(--accent)",le=jsxRuntime.jsxs("div",{ref:Ee,className:n("group flex overflow-hidden",_?"h-full w-full":"aspect-video w-full",!_&&"rounded-xl",!_&&w&&"shadow-2xl",!_&&!w&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",x),style:{"--accent":p,background:"var(--cp-bg)"},tabIndex:0,children:[jsxRuntime.jsxs("div",{className:n("relative flex-1 min-w-0 h-full overflow-hidden",H&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:He,onMouseLeave:()=>{w&&G(false);},children:[jsxRuntime.jsx("video",{ref:ie,className:"h-full w-full object-contain",poster:J.poster,playsInline:true,preload:"metadata",onClick:()=>b(i=>!i)}),!w&&!H&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>b(true),children:jsxRuntime.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full backdrop-blur-md transition-transform hover:scale-110 active:scale-95",style:{background:"var(--cp-surface-hover)"},children:jsxRuntime.jsx(lucideReact.Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),H&&jsxRuntime.jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxRuntime.jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsxRuntime.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:J.title}),J.subtitle&&jsxRuntime.jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:J.subtitle})]})}),jsxRuntime.jsx("div",{className:n("absolute inset-x-0 top-0 z-10 bg-linear-to-b from-black/70 to-transparent px-5 pb-8 pt-4 transition-opacity duration-500",q?"opacity-100":"pointer-events-none opacity-0"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:J.title}),J.subtitle&&jsxRuntime.jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:J.subtitle})]}),J.type&&jsxRuntime.jsx("span",{className:"rounded-full bg-(--accent)/70 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider backdrop-blur-sm",style:{color:"var(--cp-text-strong)"},children:J.type})]})}),jsxRuntime.jsxs("div",{className:n("absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/80 via-black/40 to-transparent px-4 pb-3 pt-10 transition-all duration-500",q?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[jsxRuntime.jsxs("div",{className:"group/seek relative mb-3 h-1 cursor-pointer rounded-full transition-[height] duration-200 hover:h-1.5",style:{background:"var(--cp-seek-track)"},onClick:Je,onMouseMove:Pe,onMouseLeave:()=>Q(null),children:[jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${h}%`,background:"var(--cp-seek-buffer)"}}),jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${je}%`}}),se!==null&&jsxRuntime.jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${se/d*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:Hr(se)}),jsxRuntime.jsx("div",{className:"absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2 rounded-full border-2 border-(--accent) bg-white opacity-0 shadow-lg transition-opacity group-hover/seek:opacity-100",style:{left:`calc(${je}% - 7px)`}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>b(i=>!i),title:w?"Pause (k)":"Play (k)",children:w?jsxRuntime.jsx(lucideReact.Pause,{className:"h-5 w-5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:ee,title:"Previous (p)",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:Z,title:"Next (n)",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>$(i=>!i),title:T?"Unmute":"Mute",children:T||L===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-4 w-4"})}),jsxRuntime.jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:T?0:L,onChange:i=>{N(Number(i.target.value)),T&&$(false);},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),jsxRuntime.jsxs("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[Hr(m)," / ",Hr(d)]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:n("cp-btn",C&&O),onClick:()=>P(i=>!i),title:"Shuffle",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:n("cp-btn",A&&O),onClick:()=>V(i=>!i),title:"Loop",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:n("cp-btn",y&&O),onClick:Fe,title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListVideo,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:n("cp-btn",j&&O),onClick:xe,title:"Cinema mode (t)",children:jsxRuntime.jsx(lucideReact.Theater,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:$e,title:"Fullscreen (f)",children:_?jsxRuntime.jsx(lucideReact.Minimize,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Maximize,{className:"h-4 w-4"})})]})]})]}),jsxRuntime.jsx("div",{className:n("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",y?"w-72":"w-0"),children:jsxRuntime.jsxs("div",{className:"flex h-full w-72 flex-col backdrop-blur-xl",style:{borderLeft:"1px solid var(--cp-border)",background:"var(--cp-panel-bg)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("button",{className:"flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors",style:{color:"var(--cp-text-muted)"},onClick:Lt,title:`Sort: ${W} ${U?"\u2191":"\u2193"}`,children:[jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"h-3 w-3"}),W,U?" \u2191":" \u2193"]}),jsxRuntime.jsx("button",{className:"cp-btn p-1!",onClick:Fe,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:Ke.map(({media:i,originalIndex:M})=>{let X=M===u;return jsxRuntime.jsxs("button",{className:n("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",X?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:X?void 0:{color:"var(--cp-text)"},onClick:()=>{be(M);},children:[jsxRuntime.jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[i.poster?jsxRuntime.jsx("img",{src:i.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsxRuntime.jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsxRuntime.jsx(lucideReact.Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),X&&w&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsxRuntime.jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(re=>jsxRuntime.jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+re*3}px`,animation:`mp-eq-bar ${.3+re*.12}s ease-in-out infinite alternate`}},re))})})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:"truncate text-xs font-medium",children:i.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[i.type&&jsxRuntime.jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:i.type}),i.duration!=null&&jsxRuntime.jsx("span",{className:"font-mono text-[10px] opacity-40",children:Hr(i.duration)})]})]}),X&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},M)})})]})}),jsxRuntime.jsx("style",{children:`
7
+ </svg>`);function Fi(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/60),r=Math.floor(e%60);return `${t}:${r.toString().padStart(2,"0")}`}function Lm(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var Em={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},Pm={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},Vm={"bottom-right":"bottom-8 right-0 w-1.5 h-16 rounded-l-full","bottom-left":"bottom-8 left-0 w-1.5 h-16 rounded-r-full","top-right":"top-8 right-0 w-1.5 h-16 rounded-l-full","top-left":"top-8 left-0 w-1.5 h-16 rounded-r-full"};function oa({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:n,theme:o,docked:a=false,visible:s,onVisibleChange:p,onTrackChange:b,onLike:u,autoPlay:c=true,shuffle:T=false,loop:x=false,accent:m="#8b5cf6",className:g}){let [d,f]=Nr.useState(t),[w,h]=Nr.useState(false),[P,k]=Nr.useState(0),[N,F]=Nr.useState(0),[R,E]=Nr.useState(.8),[A,H]=Nr.useState(false),[y,O]=Nr.useState(new Set),[v,ne]=Nr.useState(false),[C,re]=Nr.useState(s??!a),[_,de]=Nr.useState(false),[j,pe]=Nr.useState(false),[Y,V]=Nr.useState(T),[G,me]=Nr.useState(x),W=Nr.useRef(false),l=Nr.useRef(null),D=Nr.useRef(null),X=Nr.useRef(void 0),$=Nr.useRef(null),se=Nr.useRef(null),ue=s??C,Te=n??Lm(r),S=e[d],oe=a,he=o==="dark"?"dark":o==="light"?"light":"",fe="bg-(--mp-bg)",Re="text-(--mp-text)",ye="text-(--mp-text-muted)",z="text-(--accent)",J="border-(--mp-border)";Nr.useEffect(()=>{let I=l.current;I&&(I.src=S.src,I.load(),w&&I.play().catch(()=>{}));},[d,S.src]),Nr.useEffect(()=>{if(!c||W.current)return;let I=l.current;if(!I)return;let ge=()=>{W.current=true,h(true),I.play().catch(()=>{});};return I.addEventListener("canplaythrough",ge,{once:true}),()=>I.removeEventListener("canplaythrough",ge)},[c]),Nr.useEffect(()=>{let I=l.current;I&&(w?I.play().catch(()=>{}):I.pause());},[w]),Nr.useEffect(()=>{let I=l.current;I&&(I.muted=A,se.current?se.current.gain.value=A?0:R:I.volume=R);},[R,A]),Nr.useEffect(()=>{let I=l.current;if(!I)return;let ge=()=>k(I.currentTime),Fe=()=>F(I.duration),tt=()=>{G?(I.currentTime=0,I.play().catch(()=>{})):q();};return I.addEventListener("timeupdate",ge),I.addEventListener("loadedmetadata",Fe),I.addEventListener("ended",tt),()=>{I.removeEventListener("timeupdate",ge),I.removeEventListener("loadedmetadata",Fe),I.removeEventListener("ended",tt);}},[d,e.length]);let B=Nr.useCallback(I=>{let ge=(I%e.length+e.length)%e.length;f(ge),k(0),b?.(ge,e[ge]),ue||(re(true),p?.(true));},[e,ue,b,p]),q=Nr.useCallback(()=>{if(Y){let I;do I=Math.floor(Math.random()*e.length);while(I===d&&e.length>1);B(I);}else B(d+1);},[B,d,Y,e.length]),be=Nr.useCallback(()=>{if(Y){let I;do I=Math.floor(Math.random()*e.length);while(I===d&&e.length>1);B(I);}else B(d-1);},[B,d,Y,e.length]),De=Nr.useCallback(()=>{let I=y.has(d);O(ge=>{let Fe=new Set(ge);return I?Fe.delete(d):Fe.add(d),Fe}),u?.(d,S,!I);},[d,y,u,S]),He=Nr.useCallback(I=>{let ge=I.currentTarget.getBoundingClientRect(),tt=Math.max(0,Math.min(1,(I.clientX-ge.left)/ge.width))*N;l.current&&(l.current.currentTime=tt),k(tt);},[N]),K=Nr.useCallback(()=>{de(true);let I=oe?200:400;X.current=setTimeout(()=>{de(false),re(false),p?.(false);},I);},[oe,p]);Nr.useEffect(()=>()=>{X.current&&clearTimeout(X.current);},[]),Nr.useEffect(()=>()=>{$.current?.close();},[]);function xe(){if($.current||!l.current){$.current?.resume();return}try{let I=window.AudioContext??window.webkitAudioContext;if(!I)return;let ge=new I,Fe=ge.createGain();Fe.gain.value=A?0:R,ge.createMediaElementSource(l.current).connect(Fe).connect(ge.destination),$.current=ge,se.current=Fe,ge.resume();}catch{}}let L=j?"fade-in 0.2s ease-out both":`mp-enter-${Te} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,Z=j?"fade-in 0.2s ease-in reverse both":`mp-exit-${Te} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,ee=N>0?P/N*100:0;return oe&&!ue&&!_?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:l,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsxs("div",{className:i("fixed z-100 cursor-pointer transition-all duration-300",Vm[r]),style:{"--accent":m},onMouseEnter:()=>{pe(true),re(true),p?.(true);},children:[jsxRuntime.jsx("div",{className:i("h-full w-full rounded-full",w?"bg-(--accent)":"bg-(--mp-dock-strip)"),style:w?{animation:"mp-progress-glow 2s ease-in-out infinite",boxShadow:"0 0 12px color-mix(in srgb, var(--accent) 50%, transparent)"}:void 0}),w&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!ue&&!_?jsxRuntime.jsx("audio",{ref:l,preload:"metadata",crossOrigin:"anonymous"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("audio",{ref:l,preload:"metadata",crossOrigin:"anonymous"}),jsxRuntime.jsx("div",{className:i("fixed z-100",oe?Pm[r]:Em[r],he),style:{"--accent":m,..._?{animation:Z}:{animation:L}},onMouseEnter:()=>{oe&&(X.current&&(clearTimeout(X.current),X.current=void 0),_&&de(false),pe(true));},onMouseLeave:()=>{oe&&(pe(false),K());},children:jsxRuntime.jsxs("div",{className:i("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",fe,J,oe&&"rounded-none",r.endsWith("right")&&oe&&"rounded-l-2xl",r.endsWith("left")&&oe&&"rounded-r-2xl",g),children:[jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsxRuntime.jsx("img",{src:S.cover||na,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxRuntime.jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxRuntime.jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxRuntime.jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:w?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsxRuntime.jsx("img",{src:S.cover||na,alt:S.album??S.title,className:"h-full w-full object-cover",draggable:false}),jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),w&&jsxRuntime.jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:i("truncate text-sm font-semibold",Re),children:S.title}),S.artist&&jsxRuntime.jsx("div",{className:i("truncate text-xs",ye),children:S.artist}),S.album&&jsxRuntime.jsx("div",{className:i("mt-0.5 truncate text-[10px] tracking-wide",ye,"opacity-60"),children:S.album})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:i("rounded-full p-1.5 transition-all duration-200",y.has(d)?"text-rose-500 hover:text-rose-400":i(ye,"hover:text-rose-500")),onClick:De,title:"Like",children:jsxRuntime.jsx(lucideReact.Heart,{className:"h-4 w-4",fill:y.has(d)?"currentColor":"none"})}),jsxRuntime.jsx("button",{className:i("rounded-full p-1.5 transition-colors",ye,"hover:"+Re.split(" ")[0]),onClick:()=>ne(I=>!I),title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListMusic,{className:"h-4 w-4"})}),!oe&&jsxRuntime.jsx("button",{className:i("rounded-full p-1.5 transition-colors",ye,"hover:"+Re.split(" ")[0]),onClick:K,title:"Dismiss",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxRuntime.jsxs("div",{className:"px-4",children:[jsxRuntime.jsxs("div",{ref:D,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:He,children:[jsxRuntime.jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${ee}%`}}),jsxRuntime.jsx("div",{className:"absolute top-1/2 h-3 w-3 -translate-y-1/2 rounded-full bg-(--accent) opacity-0 shadow-md transition-opacity group-hover:opacity-100",style:{left:`calc(${ee}% - 6px)`}})]}),jsxRuntime.jsxs("div",{className:i("mt-1 flex justify-between text-[10px] font-mono",ye),children:[jsxRuntime.jsx("span",{children:Fi(P)}),jsxRuntime.jsx("span",{children:Fi(N)})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsxRuntime.jsx("button",{className:i("rounded-full p-1.5 transition-colors",Y?z:ye,"hover:text-(--mp-text)"),onClick:()=>V(I=>!I),title:Y?"Shuffle On":"Shuffle Off",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:i("rounded-full p-1.5 transition-colors",G?z:ye,"hover:text-(--mp-text)"),onClick:()=>me(I=>!I),title:G?"Loop On":"Loop Off",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:i("rounded-full p-2 transition-colors",ye,"hover:text-(--mp-text)"),onClick:be,title:"Previous",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:i("flex h-10 w-10 items-center justify-center rounded-full transition-all duration-200","bg-(--accent) text-white shadow-lg active:scale-95"),style:{boxShadow:"0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent)"},onClick:()=>{xe(),h(I=>!I);},title:w?"Pause":"Play",children:w?jsxRuntime.jsx(lucideReact.Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:i("rounded-full p-2 transition-colors",ye,"hover:text-(--mp-text)"),onClick:q,title:"Next",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsxRuntime.jsx("button",{className:i("rounded-full p-1 transition-colors",ye,"hover:text-(--mp-text)"),onClick:()=>{xe();let I=!A;H(I),se.current&&(se.current.gain.value=I?0:R);},title:A?"Unmute":"Mute",children:A||R===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:A?0:R,onChange:I=>{xe();let ge=Number(I.target.value);E(ge),A&&H(false),se.current&&(se.current.gain.value=ge);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsxRuntime.jsx("div",{className:i("overflow-hidden transition-all duration-300 ease-in-out",v?"max-h-60":"max-h-0"),children:jsxRuntime.jsx("div",{className:i("border-t px-2 py-2",J),children:jsxRuntime.jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((I,ge)=>{let Fe=ge===d;return jsxRuntime.jsxs("button",{className:i("flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-all duration-200",Fe?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{B(ge),h(true);},children:[jsxRuntime.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:Fe&&w?jsxRuntime.jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(tt=>jsxRuntime.jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+tt*4}px`,animation:`mp-eq-bar ${.4+tt*.15}s ease-in-out infinite alternate`}},tt))}):Fe?jsxRuntime.jsx(lucideReact.Disc3,{className:i("h-4 w-4",z)}):jsxRuntime.jsx("span",{className:i("text-xs font-mono",ye),children:ge+1})}),jsxRuntime.jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsxRuntime.jsx("img",{src:I.cover||na,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:i("truncate text-xs font-medium",Fe?z:Re),children:I.title}),I.artist&&jsxRuntime.jsx("div",{className:i("truncate text-[10px]",ye),children:I.artist})]}),y.has(ge)&&jsxRuntime.jsx(lucideReact.Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},ge)})})})})]})})]})}function yn(e){if(!isFinite(e)||e<0)return "0:00";let t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60);return t>0?`${t}:${r.toString().padStart(2,"0")}:${n.toString().padStart(2,"0")}`:`${r}:${n.toString().padStart(2,"0")}`}var Gm={title:(e,t)=>e.title.localeCompare(t.title),type:(e,t)=>(e.type??"").localeCompare(t.type??""),duration:(e,t)=>(e.duration??0)-(t.duration??0)};function ia({playlist:e,initialTrack:t=0,autoPlay:r=false,shuffle:n=false,loop:o=false,onTrackChange:a,onPlayChange:s,accent:p="#8b5cf6",className:b}){let[u,c]=Nr.useState(t),[T,x]=Nr.useState(false),[m,g]=Nr.useState(0),[d,f]=Nr.useState(0),[w,h]=Nr.useState(0),[P,k]=Nr.useState(.8),[N,F]=Nr.useState(false),[R,E]=Nr.useState(n),[A,H]=Nr.useState(o),[y,O]=Nr.useState(false),[v,ne]=Nr.useState("title"),[C,re]=Nr.useState(true),[_,de]=Nr.useState(false),[j,pe]=Nr.useState(false),[Y,V]=Nr.useState(false),[G,me]=Nr.useState(true),[W,l]=Nr.useState(false),[D,X]=Nr.useState(null),$=Nr.useRef(null),se=Nr.useRef(null),ue=Nr.useRef(void 0),Te=Nr.useRef(false),S=e[u],ce=Nr__default.default.useMemo(()=>{let L=e.map((Z,ee)=>({media:Z,originalIndex:ee}));return L.sort((Z,ee)=>{let I=Gm[v](Z.media,ee.media);return C?I:-I}),L},[e,v,C]);Nr.useEffect(()=>{let L=$.current;if(!L)return;l(true),L.src=S.src,S.poster&&(L.poster=S.poster),L.load();let Z=()=>{l(false),T&&L.play().catch(()=>{});};return L.addEventListener("loadeddata",Z,{once:true}),()=>L.removeEventListener("loadeddata",Z)},[u,S.src]),Nr.useEffect(()=>{if(!r||Te.current)return;let L=$.current;if(!L)return;let Z=()=>{Te.current=true,x(true),L.play().catch(()=>{});};return L.addEventListener("canplaythrough",Z,{once:true}),()=>L.removeEventListener("canplaythrough",Z)},[r]),Nr.useEffect(()=>{let L=$.current;L&&(T?L.play().catch(()=>{}):L.pause(),s?.(T));},[T]),Nr.useEffect(()=>{let L=$.current;L&&(L.volume=N?0:P);},[P,N]),Nr.useEffect(()=>{let L=$.current;if(!L)return;let Z=()=>g(L.currentTime),ee=()=>f(L.duration),I=()=>{L.buffered.length>0&&h(L.buffered.end(L.buffered.length-1));},ge=()=>{A?(L.currentTime=0,L.play().catch(()=>{})):fe();};return L.addEventListener("timeupdate",Z),L.addEventListener("loadedmetadata",ee),L.addEventListener("progress",I),L.addEventListener("ended",ge),()=>{L.removeEventListener("timeupdate",Z),L.removeEventListener("loadedmetadata",ee),L.removeEventListener("progress",I),L.removeEventListener("ended",ge);}},[u,e.length,A]);let oe=Nr.useCallback(()=>{me(true),ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>{T&&me(false);},3e3);},[T]);Nr.useEffect(()=>{T?oe():(me(true),ue.current&&clearTimeout(ue.current));},[T,oe]),Nr.useEffect(()=>()=>{ue.current&&clearTimeout(ue.current);},[]);let he=Nr.useCallback(L=>{let Z=(L%e.length+e.length)%e.length;c(Z),g(0),x(true),a?.(Z,e[Z]);},[e,a]),fe=Nr.useCallback(()=>{if(R){let L;do L=Math.floor(Math.random()*e.length);while(L===u&&e.length>1);he(L);}else he(u+1);},[he,u,R,e.length]),Re=Nr.useCallback(()=>{if(R){let L;do L=Math.floor(Math.random()*e.length);while(L===u&&e.length>1);he(L);}else he(u-1);},[he,u,R,e.length]),ye=Nr.useCallback(L=>{let Z=L.currentTarget.getBoundingClientRect(),I=Math.max(0,Math.min(1,(L.clientX-Z.left)/Z.width))*d;$.current&&($.current.currentTime=I),g(I);},[d]),z=Nr.useCallback(L=>{let Z=L.currentTarget.getBoundingClientRect(),ee=Math.max(0,Math.min(1,(L.clientX-Z.left)/Z.width));X(ee*d);},[d]),J=Nr.useCallback(()=>{se.current&&(document.fullscreenElement?document.exitFullscreen():se.current.requestFullscreen());},[]);Nr.useEffect(()=>{let L=()=>V(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",L),()=>document.removeEventListener("fullscreenchange",L)},[]);let B=Nr.useCallback(()=>{_?(pe(true),setTimeout(()=>{de(false),pe(false);},500)):de(true);},[_]),q=Nr.useCallback(()=>{O(L=>!L);},[]),be=Nr.useCallback(()=>{let L=["title","type","duration"],Z=L.indexOf(v);C?re(false):(re(true),ne(L[(Z+1)%L.length]));},[v,C]);Nr.useEffect(()=>{let L=Z=>{if(!(Z.target instanceof HTMLInputElement||Z.target instanceof HTMLTextAreaElement))switch(Z.key){case " ":case "k":Z.preventDefault(),x(ee=>!ee);break;case "f":Z.preventDefault(),J();break;case "t":Z.preventDefault(),B();break;case "ArrowLeft":Z.preventDefault(),$.current&&($.current.currentTime=Math.max(0,m-5));break;case "ArrowRight":Z.preventDefault(),$.current&&($.current.currentTime=Math.min(d,m+5));break;case "ArrowUp":Z.preventDefault(),k(ee=>Math.min(1,ee+.05));break;case "ArrowDown":Z.preventDefault(),k(ee=>Math.max(0,ee-.05));break;case "Escape":_&&B();break;case "n":Z.preventDefault(),fe();break;case "p":Z.preventDefault(),Re();break;case "l":Z.preventDefault(),q();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[J,B,q,fe,Re,m,d,_]);let De=d>0?m/d*100:0,He=d>0?w/d*100:0,K="text-(--accent)",xe=jsxRuntime.jsxs("div",{ref:se,className:i("group flex overflow-hidden",Y?"h-full w-full":"aspect-video w-full",!Y&&"rounded-xl",!Y&&T&&"shadow-2xl",!Y&&!T&&"animate-[cp-glow-pulse_4s_ease-in-out_infinite] will-change-[box-shadow]",b),style:{"--accent":p,background:"var(--cp-bg)"},tabIndex:0,children:[jsxRuntime.jsxs("div",{className:i("relative flex-1 min-w-0 h-full overflow-hidden",W&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:oe,onMouseLeave:()=>{T&&me(false);},children:[jsxRuntime.jsx("video",{ref:$,className:"h-full w-full object-contain",poster:S.poster,playsInline:true,preload:"metadata",onClick:()=>x(L=>!L)}),!T&&!W&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>x(true),children:jsxRuntime.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full backdrop-blur-md transition-transform hover:scale-110 active:scale-95",style:{background:"var(--cp-surface-hover)"},children:jsxRuntime.jsx(lucideReact.Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),W&&!G&&jsxRuntime.jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxRuntime.jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsxRuntime.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:S.title}),S.subtitle&&jsxRuntime.jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:S.subtitle})]})}),jsxRuntime.jsx("div",{className:i("absolute inset-x-0 top-0 z-10 bg-linear-to-b from-black/70 to-transparent px-5 pb-8 pt-4 transition-opacity duration-500",G?"opacity-100":"pointer-events-none opacity-0"),children:jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:S.title}),S.subtitle&&jsxRuntime.jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:S.subtitle})]}),S.type&&jsxRuntime.jsx("span",{className:"rounded-full bg-(--accent)/70 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider backdrop-blur-sm",style:{color:"var(--cp-text-strong)"},children:S.type})]})}),jsxRuntime.jsxs("div",{className:i("absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/80 via-black/40 to-transparent px-4 pb-3 pt-10 transition-all duration-500",G?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[jsxRuntime.jsxs("div",{className:"group/seek relative mb-3 h-1 cursor-pointer rounded-full transition-[height] duration-200 hover:h-1.5",style:{background:"var(--cp-seek-track)"},onClick:ye,onMouseMove:z,onMouseLeave:()=>X(null),children:[jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${He}%`,background:"var(--cp-seek-buffer)"}}),jsxRuntime.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${De}%`}}),D!==null&&jsxRuntime.jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${D/d*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:yn(D)}),jsxRuntime.jsx("div",{className:"absolute top-1/2 h-3.5 w-3.5 -translate-y-1/2 rounded-full border-2 border-(--accent) bg-white opacity-0 shadow-lg transition-opacity group-hover/seek:opacity-100",style:{left:`calc(${De}% - 7px)`}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>x(L=>!L),title:T?"Pause (k)":"Play (k)",children:T?jsxRuntime.jsx(lucideReact.Pause,{className:"h-5 w-5",fill:"currentColor"}):jsxRuntime.jsx(lucideReact.Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:Re,title:"Previous (p)",children:jsxRuntime.jsx(lucideReact.SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:fe,title:"Next (n)",children:jsxRuntime.jsx(lucideReact.SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxRuntime.jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsxRuntime.jsx("button",{className:"cp-btn",onClick:()=>F(L=>!L),title:N?"Unmute":"Mute",children:N||P===0?jsxRuntime.jsx(lucideReact.VolumeX,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Volume2,{className:"h-4 w-4"})}),jsxRuntime.jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsxRuntime.jsx("input",{type:"range",min:0,max:1,step:.01,value:N?0:P,onChange:L=>{k(Number(L.target.value)),N&&F(false);},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),jsxRuntime.jsxs("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[yn(m)," / ",yn(d)]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{className:i("cp-btn",R&&K),onClick:()=>E(L=>!L),title:"Shuffle",children:jsxRuntime.jsx(lucideReact.Shuffle,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:i("cp-btn",A&&K),onClick:()=>H(L=>!L),title:"Loop",children:jsxRuntime.jsx(lucideReact.Repeat1,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:i("cp-btn",y&&K),onClick:q,title:"Playlist",children:jsxRuntime.jsx(lucideReact.ListVideo,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:i("cp-btn",_&&K),onClick:B,title:"Cinema mode (t)",children:jsxRuntime.jsx(lucideReact.Theater,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{className:"cp-btn",onClick:J,title:"Fullscreen (f)",children:Y?jsxRuntime.jsx(lucideReact.Minimize,{className:"h-4 w-4"}):jsxRuntime.jsx(lucideReact.Maximize,{className:"h-4 w-4"})})]})]})]}),jsxRuntime.jsx("div",{className:i("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",y?"w-72":"w-0"),children:jsxRuntime.jsxs("div",{className:"flex h-full w-72 flex-col backdrop-blur-xl",style:{borderLeft:"1px solid var(--cp-border)",background:"var(--cp-panel-bg)"},children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsxRuntime.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("button",{className:"flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors",style:{color:"var(--cp-text-muted)"},onClick:be,title:`Sort: ${v} ${C?"\u2191":"\u2193"}`,children:[jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"h-3 w-3"}),v,C?" \u2191":" \u2193"]}),jsxRuntime.jsx("button",{className:"cp-btn p-1!",onClick:q,title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto",children:ce.map(({media:L,originalIndex:Z})=>{let ee=Z===u;return jsxRuntime.jsxs("button",{className:i("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",ee?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:ee?void 0:{color:"var(--cp-text)"},onClick:()=>{he(Z);},children:[jsxRuntime.jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[L.poster?jsxRuntime.jsx("img",{src:L.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsxRuntime.jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsxRuntime.jsx(lucideReact.Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),ee&&T&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsxRuntime.jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(I=>jsxRuntime.jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+I*3}px`,animation:`mp-eq-bar ${.3+I*.12}s ease-in-out infinite alternate`}},I))})})]}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsx("div",{className:"truncate text-xs font-medium",children:L.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[L.type&&jsxRuntime.jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:L.type}),L.duration!=null&&jsxRuntime.jsx("span",{className:"font-mono text-[10px] opacity-40",children:yn(L.duration)})]})]}),ee&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},Z)})})]})}),jsxRuntime.jsx("style",{children:`
8
8
  .cp-btn {
9
9
  display: flex;
10
10
  align-items: center;
@@ -20,7 +20,7 @@
20
20
  0%, 100% { box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 25%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }
21
21
  50% { box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 55%, transparent), 0 25px 50px -12px rgba(0,0,0,0.25); }
22
22
  }
23
- `})]});return jsxRuntime.jsx("div",{className:n(j&&"fixed inset-0 z-100 flex items-center justify-center p-8",j&&(F?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:j?i=>{i.target===i.currentTarget&&xe();}:void 0,children:jsxRuntime.jsx("div",{className:n(j&&"w-full",j&&!_&&"max-w-5xl"),children:le})})}function _r(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Po(e){return e==null?"\u2014":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function fa(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var vd={".png":lucideReact.Image,".jpg":lucideReact.Image,".jpeg":lucideReact.Image,".gif":lucideReact.Image,".svg":lucideReact.Image,".webp":lucideReact.Image,".ico":lucideReact.Image,".bmp":lucideReact.Image,".mp3":lucideReact.Music,".wav":lucideReact.Music,".flac":lucideReact.Music,".ogg":lucideReact.Music,".aac":lucideReact.Music,".m4a":lucideReact.Music,".mp4":lucideReact.Video,".mkv":lucideReact.Video,".avi":lucideReact.Video,".mov":lucideReact.Video,".wmv":lucideReact.Video,".webm":lucideReact.Video,".ts":lucideReact.FileCode,".tsx":lucideReact.FileCode,".js":lucideReact.FileCode,".jsx":lucideReact.FileCode,".json":lucideReact.FileCode,".html":lucideReact.FileCode,".css":lucideReact.FileCode,".scss":lucideReact.FileCode,".py":lucideReact.FileCode,".rs":lucideReact.FileCode,".go":lucideReact.FileCode,".java":lucideReact.FileCode,".c":lucideReact.FileCode,".cpp":lucideReact.FileCode,".h":lucideReact.FileCode,".sh":lucideReact.Terminal,".bat":lucideReact.Terminal,".ps1":lucideReact.Terminal,".md":lucideReact.FileText,".txt":lucideReact.FileText,".pdf":lucideReact.FileText,".doc":lucideReact.FileText,".docx":lucideReact.FileText,".rtf":lucideReact.FileText,".csv":lucideReact.FileSpreadsheet,".xls":lucideReact.FileSpreadsheet,".xlsx":lucideReact.FileSpreadsheet,".db":lucideReact.Database,".sqlite":lucideReact.Database,".sql":lucideReact.Database,".zip":lucideReact.FileArchive,".tar":lucideReact.FileArchive,".gz":lucideReact.FileArchive,".rar":lucideReact.FileArchive,".7z":lucideReact.FileArchive};function ga(e){if(e.type==="directory")return lucideReact.Folder;let t=e.extension||_r(e.name);return vd[t]||lucideReact.File}function Mo(e,t,r){return Math.max(t,Math.min(r,e))}function ba({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:a="list",initialPosition:s,initialSize:o,dockable:l=false,dockSide:p="right",visible:x=true,onFileOpen:u,onSelectionChange:c,onNavigate:w,onDelete:b,onClose:m,onMinimize:v,onPathSubmit:d,defaultInputMode:f="search",actions:k,resizable:g=true,minSize:L={width:400,height:300},className:N}){let[T,$]=zt.useState(a),[C,P]=zt.useState(new Set),[A,V]=zt.useState(null),[y,K]=zt.useState(false),[W,ae]=zt.useState(false),[U,pe]=zt.useState(""),[j,Y]=zt.useState(f),[F,oe]=zt.useState(x),[_,R]=zt.useState(false),q=o??{width:720,height:520},[G,H]=zt.useState(s??{x:Math.max(0,Math.round((window.innerWidth-q.width)/2)),y:Math.max(0,Math.round((window.innerHeight-q.height)/2))}),[E,se]=zt.useState(q),[Q,ie]=zt.useState(null),Ee=zt.useRef(false),ce=zt.useRef({x:0,y:0}),Qe=zt.useRef(null),J=zt.useRef(false),Ke=zt.useRef({x:0,y:0,w:0,h:0,px:0,py:0}),He=x!==void 0?x:F,be=zt.useMemo(()=>{let h=e.filter(le=>le.type==="directory"),O=e.filter(le=>le.type==="file");return h.sort((le,i)=>le.name.localeCompare(i.name)),O.sort((le,i)=>le.name.localeCompare(i.name)),[...h,...O]},[e]),Z=zt.useMemo(()=>{if(j!=="search"||!U.trim())return be;let h=U.toLowerCase();return be.filter(O=>O.name.toLowerCase().includes(h))},[be,U,j]),ee=A!=null?Z[A]:null,Je=zt.useCallback((h,O)=>{P(le=>{let i=new Set(le);return O.ctrlKey||O.metaKey?i.has(h)?i.delete(h):i.add(h):(i.clear(),i.add(h)),i}),V(h);},[]);zt.useEffect(()=>{if(!c)return;let h=Array.from(C).map(O=>Z[O]).filter(Boolean);c(h);},[C]);let Pe=zt.useCallback(h=>{let O=Z[h];O&&(O.type==="directory"?w?.(O.path):u?.(O));},[Z,u,w]),$e=zt.useCallback(h=>{y||h.target.closest("button")||(Ee.current=true,ce.current={x:h.clientX-G.x,y:h.clientY-G.y},h.preventDefault());},[G,y]);zt.useEffect(()=>{let h=le=>{if(!Ee.current)return;let i=window.innerWidth-100,M=window.innerHeight-40;H({x:Mo(le.clientX-ce.current.x,0,i),y:Mo(le.clientY-ce.current.y,0,M)});},O=()=>{Ee.current=false,J.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",h),window.addEventListener("mouseup",O),()=>{window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",O);}},[]);let xe=zt.useCallback((h,O)=>{y||(O.preventDefault(),O.stopPropagation(),J.current=h,Ke.current={x:O.clientX,y:O.clientY,w:E.width,h:E.height,px:G.x,py:G.y},document.body.style.cursor=h==="e"||h==="w"?"ew-resize":h==="n"||h==="s"?"ns-resize":h==="nw"||h==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[y,E,G]);zt.useEffect(()=>{let h=le=>{if(!J.current)return;let i=J.current,M=le.clientX-Ke.current.x,X=le.clientY-Ke.current.y,{w:re,h:_e,px:Or,py:Br}=Ke.current;if(i.includes("e")&&(re=Math.max(L.width,re+M)),i.includes("w")){let Et=Math.max(L.width,re-M);Or=Or+(re-Et),re=Et;}if(i.includes("s")&&(_e=Math.max(L.height,_e+X)),i.includes("n")){let Et=Math.max(L.height,_e-X);Br=Br+(_e-Et),_e=Et;}se({width:re,height:_e}),H({x:Or,y:Br});},O=()=>{J.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",h),window.addEventListener("mouseup",O),()=>{window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",O);}},[L]);let Fe=zt.useCallback(()=>{y?(Q&&(H(Q.pos),se(Q.size)),K(false)):(ie({pos:G,size:E}),K(true));},[y,G,E,Q]),Lt=zt.useCallback(()=>{W?ae(false):(y&&(K(false),Q&&(H(Q.pos),se(Q.size))),ae(true),v?.());},[W,y,Q,v]);zt.useEffect(()=>{if(!He||W)return;let h=O=>{if(!(!Qe.current?.contains(document.activeElement)&&document.activeElement!==Qe.current)){if(O.key==="Escape"&&(V(null),P(new Set)),O.ctrlKey&&O.key==="a"){O.preventDefault();let le=new Set(Z.map((i,M)=>M));P(le);}O.key==="Delete"&&C.size>0&&b&&(O.preventDefault(),R(true));}};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[He,W,Z,C,b]);let je={"--fe-accent":r};return W?jsxRuntime.jsx("div",{className:n("fixed z-100 cursor-pointer transition-all duration-300",p==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:je,onClick:()=>ae(false),title:`Restore ${t}`,children:jsxRuntime.jsxs("div",{className:"fe-dock flex items-center gap-1.5 rounded-l-lg px-2 py-3 backdrop-blur-md",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:[jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})}):He?jsxRuntime.jsxs("div",{ref:Qe,className:n("fe-window fixed z-100 flex flex-col overflow-hidden","rounded-xl border border-(--fe-border)","animate-[fe-window-in_0.35s_cubic-bezier(0.16,1,0.3,1)_both]",y&&"rounded-none",N),style:{...je,left:y?0:G.x,top:y?0:G.y,width:y?"100vw":E.width,height:y?"100vh":E.height,transition:y?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[jsxRuntime.jsxs("div",{className:"fe-titlebar group/titlebar flex h-10 shrink-0 cursor-grab items-center justify-between px-3 select-none active:cursor-grabbing",onMouseDown:$e,onDoubleClick:Fe,children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:"color-mix(in srgb, var(--fe-accent) 25%, transparent)"},children:jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),jsxRuntime.jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:"fe-btn mr-1",onClick:()=>$(h=>h==="list"?"grid":"list"),title:T==="list"?"Grid view":"List view",children:T==="list"?jsxRuntime.jsx(lucideReact.LayoutGrid,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.LayoutList,{className:"h-3.5 w-3.5"})}),l&&jsxRuntime.jsx("button",{className:"fe-btn",onClick:Lt,title:"Dock to edge",children:jsxRuntime.jsx(lucideReact.Minus,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn",onClick:Fe,title:y?"Restore":"Maximize",children:y?jsxRuntime.jsx(lucideReact.Minimize2,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Maximize2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{m?.(),oe(false);},title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsxRuntime.jsx("button",{className:"fe-btn p-1",onClick:()=>w?.(".."),title:"Go up",children:jsxRuntime.jsx(lucideReact.FolderUp,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:j==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>Y(h=>h==="search"?"navigate":"search"),title:j==="search"?"Switch to path navigation":"Switch to file search",children:j==="search"?jsxRuntime.jsx(lucideReact.Search,{className:"h-3 w-3"}):jsxRuntime.jsx(lucideReact.CornerRightDown,{className:"h-3 w-3"})}),jsxRuntime.jsx("div",{className:"relative flex-1",children:jsxRuntime.jsx("input",{type:"text",value:U,onChange:h=>pe(h.target.value),onKeyDown:h=>{h.key==="Enter"&&U.trim()&&j==="navigate"&&(d?d(U.trim()):w?.(U.trim()));},placeholder:j==="search"?"Search files\u2026":"Enter path and press Enter\u2026",className:"h-6 w-full rounded border border-(--fe-input-border) bg-(--fe-input-bg) px-2 text-[11px] text-(--fe-text-strong) placeholder:text-(--fe-text-muted) outline-none transition-colors focus:border-(--fe-accent)/40 focus:bg-(--fe-input-bg)"})}),jsxRuntime.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[Z.length," item",Z.length!==1?"s":"",C.size>0&&` \xB7 ${C.size} selected`]})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 min-h-0",children:[jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:h=>{h.target===h.currentTarget&&(P(new Set),V(null));},children:Z.length===0?jsxRuntime.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsxRuntime.jsx(lucideReact.Folder,{className:"mb-2 h-10 w-10"}),jsxRuntime.jsx("span",{className:"text-xs",children:"No files found"})]}):T==="list"?jsxRuntime.jsx("div",{className:"space-y-px",children:Z.map((h,O)=>{let le=ga(h),i=C.has(O),M=h.extension||_r(h.name);return jsxRuntime.jsxs("div",{className:n("fe-item group/item flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-(--fe-text) transition-all duration-150 cursor-pointer",i?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:i?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:X=>Je(O,X),onDoubleClick:()=>Pe(O),children:[jsxRuntime.jsx(le,{className:n("h-4 w-4 shrink-0",h.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:h.name}),M&&h.type==="file"&&jsxRuntime.jsx("span",{className:"shrink-0 rounded bg-(--fe-badge-bg) px-1.5 py-0.5 font-mono text-[9px] uppercase text-(--fe-text-muted)",children:M}),h.size!=null&&jsxRuntime.jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Po(h.size)}),h.modifiedAt&&jsxRuntime.jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:fa(h.modifiedAt)})]},h.path+O)})}):jsxRuntime.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:Z.map((h,O)=>{let le=ga(h),i=C.has(O),M=h.extension||_r(h.name);return jsxRuntime.jsxs("div",{className:n("fe-item group/item flex cursor-pointer flex-col items-center gap-1 rounded-lg px-2 py-2.5 text-center transition-all duration-150",i?"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:X=>Je(O,X),onDoubleClick:()=>Pe(O),children:[jsxRuntime.jsx(le,{className:n("h-7 w-7",h.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:h.name}),M&&h.type==="file"&&jsxRuntime.jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:M})]},h.path+O)})})}),jsxRuntime.jsx("div",{className:n("shrink-0 overflow-hidden transition-[width] duration-300 ease-out",ee?"w-56":"w-0"),children:ee&&jsxRuntime.jsxs("div",{className:"fe-panel flex h-full w-56 flex-col border-l border-(--fe-border) p-4",children:[jsxRuntime.jsxs("div",{className:"mb-3 flex flex-col items-center",children:[zt__default.default.createElement(ga(ee),{className:n("h-10 w-10 mb-2",ee.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:ee.name})]}),jsxRuntime.jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsxRuntime.jsx(Mt,{label:"Type",value:ee.type==="directory"?"Directory":ee.mimeType||ee.extension||_r(ee.name)||"File"}),ee.size!=null&&jsxRuntime.jsx(Mt,{label:"Size",value:Po(ee.size)}),jsxRuntime.jsx(Mt,{label:"Path",value:ee.path,mono:true}),ee.extension&&jsxRuntime.jsx(Mt,{label:"Extension",value:ee.extension}),ee.modifiedAt&&jsxRuntime.jsx(Mt,{label:"Modified",value:fa(ee.modifiedAt)}),ee.createdAt&&jsxRuntime.jsx(Mt,{label:"Created",value:fa(ee.createdAt)})]}),jsxRuntime.jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[ee.type==="file"&&u&&jsxRuntime.jsxs("button",{className:"flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text-strong) transition-colors",style:{background:"color-mix(in srgb, var(--fe-accent) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--fe-accent) 30%, transparent)"},onClick:()=>u(ee),children:[jsxRuntime.jsx(lucideReact.ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),k?.map(h=>jsxRuntime.jsxs("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>h.onClick(ee),children:[h.icon&&zt__default.default.createElement(h.icon,{className:"h-3 w-3"}),h.label]},h.key))]})]})})]}),jsxRuntime.jsxs("div",{className:"fe-statusbar flex h-6 shrink-0 items-center justify-between px-3 text-[9px] font-mono text-(--fe-text-muted)",children:[jsxRuntime.jsxs("span",{children:[Z.length," items"]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[C.size>0&&jsxRuntime.jsxs("span",{className:"text-(--fe-accent)/70",children:[C.size," selected"]}),jsxRuntime.jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),g&&!y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"absolute top-0 left-2 right-2 h-1.5 cursor-ns-resize",onMouseDown:h=>xe("n",h)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-2 right-2 h-1.5 cursor-ns-resize",onMouseDown:h=>xe("s",h)}),jsxRuntime.jsx("div",{className:"absolute top-2 left-0 bottom-2 w-1.5 cursor-ew-resize",onMouseDown:h=>xe("w",h)}),jsxRuntime.jsx("div",{className:"absolute top-2 right-0 bottom-2 w-1.5 cursor-ew-resize",onMouseDown:h=>xe("e",h)}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-3 w-3 cursor-nwse-resize",onMouseDown:h=>xe("nw",h)}),jsxRuntime.jsx("div",{className:"absolute top-0 right-0 h-3 w-3 cursor-nesw-resize",onMouseDown:h=>xe("ne",h)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-3 w-3 cursor-nesw-resize",onMouseDown:h=>xe("sw",h)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 right-0 h-3 w-3 cursor-nwse-resize",onMouseDown:h=>xe("se",h)})]}),jsxRuntime.jsx("style",{children:`
23
+ `})]});return jsxRuntime.jsx("div",{className:i(_&&"fixed inset-0 z-100 flex items-center justify-center p-8",_&&(j?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:_?L=>{L.target===L.currentTarget&&B();}:void 0,children:jsxRuntime.jsx("div",{className:i(_&&"w-full",_&&!Y&&"max-w-5xl"),children:xe})})}function vn(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function Oi(e){return e==null?"\u2014":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function da(e){return e?(typeof e=="string"?new Date(e):e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"\u2014"}var sp={".png":lucideReact.Image,".jpg":lucideReact.Image,".jpeg":lucideReact.Image,".gif":lucideReact.Image,".svg":lucideReact.Image,".webp":lucideReact.Image,".ico":lucideReact.Image,".bmp":lucideReact.Image,".mp3":lucideReact.Music,".wav":lucideReact.Music,".flac":lucideReact.Music,".ogg":lucideReact.Music,".aac":lucideReact.Music,".m4a":lucideReact.Music,".mp4":lucideReact.Video,".mkv":lucideReact.Video,".avi":lucideReact.Video,".mov":lucideReact.Video,".wmv":lucideReact.Video,".webm":lucideReact.Video,".ts":lucideReact.FileCode,".tsx":lucideReact.FileCode,".js":lucideReact.FileCode,".jsx":lucideReact.FileCode,".json":lucideReact.FileCode,".html":lucideReact.FileCode,".css":lucideReact.FileCode,".scss":lucideReact.FileCode,".py":lucideReact.FileCode,".rs":lucideReact.FileCode,".go":lucideReact.FileCode,".java":lucideReact.FileCode,".c":lucideReact.FileCode,".cpp":lucideReact.FileCode,".h":lucideReact.FileCode,".sh":lucideReact.Terminal,".bat":lucideReact.Terminal,".ps1":lucideReact.Terminal,".md":lucideReact.FileText,".txt":lucideReact.FileText,".pdf":lucideReact.FileText,".doc":lucideReact.FileText,".docx":lucideReact.FileText,".rtf":lucideReact.FileText,".csv":lucideReact.FileSpreadsheet,".xls":lucideReact.FileSpreadsheet,".xlsx":lucideReact.FileSpreadsheet,".db":lucideReact.Database,".sqlite":lucideReact.Database,".sql":lucideReact.Database,".zip":lucideReact.FileArchive,".tar":lucideReact.FileArchive,".gz":lucideReact.FileArchive,".rar":lucideReact.FileArchive,".7z":lucideReact.FileArchive};function ma(e){if(e.type==="directory")return lucideReact.Folder;let t=e.extension||vn(e.name);return sp[t]||lucideReact.File}function dr(e,t,r){return Math.max(t,Math.min(r,e))}function Ki(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function Wi(e,t){if(e<480)return {size:{width:e-16,height:t-48},pos:{x:8,y:24}};if(e<640){let o=e-24,a=Math.min(t-64,540);return {size:{width:o,height:a},pos:{x:12,y:32}}}if(e<1024){let o=Math.min(640,e-32),a=Math.min(480,t-64);return {size:{width:o,height:a},pos:{x:Math.max(0,Math.round((e-o)/2)),y:Math.max(0,Math.round((t-a)/2))}}}let r=720,n=520;return {size:{width:r,height:n},pos:{x:Math.max(0,Math.round((e-r)/2)),y:Math.max(0,Math.round((t-n)/2))}}}function pa({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:n="list",initialPosition:o,initialSize:a,dockable:s=false,dockSide:p="right",visible:b=true,onFileOpen:u,onSelectionChange:c,onNavigate:T,onDelete:x,onClose:m,onMinimize:g,onPathSubmit:d,defaultInputMode:f="search",actions:w,resizable:h=true,minSize:P={width:400,height:300},className:k}){let[N,F]=Nr.useState(n),[R,E]=Nr.useState(new Set),[A,H]=Nr.useState(null),[y,O]=Nr.useState(false),[v,ne]=Nr.useState(false),[C,re]=Nr.useState(""),[_,de]=Nr.useState(f),[j,pe]=Nr.useState(b),[Y,V]=Nr.useState(false),[G,me]=Nr.useState({w:window.innerWidth,h:window.innerHeight}),W=Wi(window.innerWidth,window.innerHeight),[l,D]=Nr.useState(o??W.pos),[X,$]=Nr.useState(a??W.size),[se,ue]=Nr.useState(null),Te=Nr.useRef(false),S=Nr.useRef({x:0,y:0}),ce=Nr.useRef(null),oe=Nr.useRef(false),he=Nr.useRef({x:0,y:0,w:0,h:0,px:0,py:0}),fe=Nr.useRef(false),Re=Nr.useRef(y);Nr.useEffect(()=>{Re.current=y;},[y]);let ye=b!==void 0?b:j,z=Nr.useMemo(()=>{let M=e.filter(we=>we.type==="directory"),ae=e.filter(we=>we.type==="file");return M.sort((we,ke)=>we.name.localeCompare(ke.name)),ae.sort((we,ke)=>we.name.localeCompare(ke.name)),[...M,...ae]},[e]),J=Nr.useMemo(()=>{if(_!=="search"||!C.trim())return z;let M=C.toLowerCase();return z.filter(ae=>ae.name.toLowerCase().includes(M))},[z,C,_]),B=A!=null?J[A]:null;Nr.useEffect(()=>{let M=Ki(window.innerWidth),ae=()=>{let we=window.innerWidth,ke=window.innerHeight;if(me({w:we,h:ke}),Re.current)return;let Ee=Ki(we);if(Ee!==M&&!fe.current&&!a){let Je=Wi(we,ke);$(Je.size),D(Je.pos);}M=Ee;};return window.addEventListener("resize",ae),()=>window.removeEventListener("resize",ae)},[a]);let q=Nr.useCallback((M,ae)=>{E(we=>{let ke=new Set(we);return ae.ctrlKey||ae.metaKey?ke.has(M)?ke.delete(M):ke.add(M):(ke.clear(),ke.add(M)),ke}),H(M);},[]);Nr.useEffect(()=>{if(!c)return;let M=Array.from(R).map(ae=>J[ae]).filter(Boolean);c(M);},[R]);let be=Nr.useCallback(M=>{let ae=J[M];ae&&(ae.type==="directory"?T?.(ae.path):u?.(ae));},[J,u,T]),De=Nr.useCallback(M=>{y||M.target.closest("button")||(fe.current=true,Te.current=true,S.current={x:M.clientX-l.x,y:M.clientY-l.y},M.preventDefault());},[l,y]),He=Nr.useCallback(M=>{if(y||M.target.closest("button"))return;fe.current=true;let ae=M.touches[0];Te.current=true,S.current={x:ae.clientX-l.x,y:ae.clientY-l.y};},[l,y]);Nr.useEffect(()=>{let M=ke=>{if(!Te.current)return;let Ee=window.innerWidth-100,Je=window.innerHeight-40;D({x:dr(ke.clientX-S.current.x,0,Ee),y:dr(ke.clientY-S.current.y,0,Je)});},ae=ke=>{if(!Te.current)return;ke.preventDefault();let Ee=ke.touches[0],Je=window.innerWidth-100,Pt=window.innerHeight-40;D({x:dr(Ee.clientX-S.current.x,0,Je),y:dr(Ee.clientY-S.current.y,0,Pt)});},we=()=>{Te.current=false,oe.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",M),window.addEventListener("mouseup",we),window.addEventListener("touchmove",ae,{passive:false}),window.addEventListener("touchend",we),()=>{window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",we),window.removeEventListener("touchmove",ae),window.removeEventListener("touchend",we);}},[]);let K=Nr.useCallback((M,ae)=>{y||(ae.preventDefault(),ae.stopPropagation(),fe.current=true,oe.current=M,he.current={x:ae.clientX,y:ae.clientY,w:X.width,h:X.height,px:l.x,py:l.y},document.body.style.cursor=M==="e"||M==="w"?"ew-resize":M==="n"||M==="s"?"ns-resize":M==="nw"||M==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[y,X,l]),xe=Nr.useCallback((M,ae)=>{if(y)return;ae.preventDefault(),ae.stopPropagation(),fe.current=true;let we=ae.touches[0];oe.current=M,he.current={x:we.clientX,y:we.clientY,w:X.width,h:X.height,px:l.x,py:l.y},document.body.style.userSelect="none";},[y,X,l]);Nr.useEffect(()=>{let M=(Ee,Je)=>{let Pt=oe.current;if(!Pt)return;let _a=Ee-he.current.x,$a=Je-he.current.y,{w:Kt,h:Wt,px:Fn,py:An}=he.current;if(Pt.includes("e")&&(Kt=Math.max(P.width,Kt+_a)),Pt.includes("w")){let fr=Math.max(P.width,Kt-_a);Fn=Fn+(Kt-fr),Kt=fr;}if(Pt.includes("s")&&(Wt=Math.max(P.height,Wt+$a)),Pt.includes("n")){let fr=Math.max(P.height,Wt-$a);An=An+(Wt-fr),Wt=fr;}$({width:Kt,height:Wt}),D({x:Fn,y:An});},ae=Ee=>{oe.current&&M(Ee.clientX,Ee.clientY);},we=Ee=>{oe.current&&(Ee.preventDefault(),M(Ee.touches[0].clientX,Ee.touches[0].clientY));},ke=()=>{oe.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",ae),window.addEventListener("mouseup",ke),window.addEventListener("touchmove",we,{passive:false}),window.addEventListener("touchend",ke),()=>{window.removeEventListener("mousemove",ae),window.removeEventListener("mouseup",ke),window.removeEventListener("touchmove",we),window.removeEventListener("touchend",ke);}},[P]);let L=Nr.useCallback(()=>{y?(se&&(D(se.pos),$(se.size)),O(false)):(ue({pos:l,size:X}),O(true));},[y,l,X,se]),Z=Nr.useCallback(()=>{v?ne(false):(y&&(O(false),se&&(D(se.pos),$(se.size))),ne(true),g?.());},[v,y,se,g]);Nr.useEffect(()=>{if(!ye||v)return;let M=ae=>{if(!(!ce.current?.contains(document.activeElement)&&document.activeElement!==ce.current)){if(ae.key==="Escape"&&(H(null),E(new Set)),ae.ctrlKey&&ae.key==="a"){ae.preventDefault();let we=new Set(J.map((ke,Ee)=>Ee));E(we);}ae.key==="Delete"&&R.size>0&&x&&(ae.preventDefault(),V(true));}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[ye,v,J,R,x]);let ee={"--fe-accent":r};if(v)return jsxRuntime.jsx("div",{className:i("fixed z-100 cursor-pointer transition-all duration-300",p==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:ee,onClick:()=>ne(false),title:`Restore ${t}`,children:jsxRuntime.jsxs("div",{className:"fe-dock flex items-center gap-1.5 rounded-l-lg px-2 py-3 backdrop-blur-md",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:[jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})});if(!ye)return null;let I=y?G.w:Math.min(X.width,G.w-8),ge=y?G.h:Math.min(X.height,G.h-8),Fe=y?0:dr(l.x,0,Math.max(0,G.w-I)),tt=y?0:dr(l.y,0,Math.max(0,G.h-40)),Hn=I<500;return jsxRuntime.jsxs("div",{ref:ce,className:i("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]",y&&"rounded-none",k),style:{...ee,left:Fe,top:tt,width:I,height:ge,transition:y?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[jsxRuntime.jsxs("div",{className:"fe-titlebar group/titlebar flex h-10 shrink-0 cursor-grab items-center justify-between px-3 select-none active:cursor-grabbing",onMouseDown:De,onTouchStart:He,onDoubleClick:L,children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:"color-mix(in srgb, var(--fe-accent) 25%, transparent)"},children:jsxRuntime.jsx(lucideReact.HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsxRuntime.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),jsxRuntime.jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-0.5",children:[jsxRuntime.jsx("button",{className:"fe-btn mr-1",onClick:()=>F(M=>M==="list"?"grid":"list"),title:N==="list"?"Grid view":"List view",children:N==="list"?jsxRuntime.jsx(lucideReact.LayoutGrid,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.LayoutList,{className:"h-3.5 w-3.5"})}),s&&jsxRuntime.jsx("button",{className:"fe-btn",onClick:Z,title:"Dock to edge",children:jsxRuntime.jsx(lucideReact.Minus,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn",onClick:L,title:y?"Restore":"Maximize",children:y?jsxRuntime.jsx(lucideReact.Minimize2,{className:"h-3.5 w-3.5"}):jsxRuntime.jsx(lucideReact.Maximize2,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{m?.(),pe(false);},title:"Close",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})})]})]}),jsxRuntime.jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsxRuntime.jsx("button",{className:"fe-btn p-1",onClick:()=>T?.(".."),title:"Go up",children:jsxRuntime.jsx(lucideReact.FolderUp,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:_==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>de(M=>M==="search"?"navigate":"search"),title:_==="search"?"Switch to path navigation":"Switch to file search",children:_==="search"?jsxRuntime.jsx(lucideReact.Search,{className:"h-3 w-3"}):jsxRuntime.jsx(lucideReact.CornerRightDown,{className:"h-3 w-3"})}),jsxRuntime.jsx("div",{className:"relative flex-1",children:jsxRuntime.jsx("input",{type:"text",value:C,onChange:M=>re(M.target.value),onKeyDown:M=>{M.key==="Enter"&&C.trim()&&_==="navigate"&&(d?d(C.trim()):T?.(C.trim()));},placeholder:_==="search"?"Search files\u2026":"Enter path and press Enter\u2026",className:"h-6 w-full rounded border border-(--fe-input-border) bg-(--fe-input-bg) px-2 text-[11px] text-(--fe-text-strong) placeholder:text-(--fe-text-muted) outline-none transition-colors focus:border-(--fe-accent)/40 focus:bg-(--fe-input-bg)"})}),jsxRuntime.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[J.length," item",J.length!==1?"s":"",R.size>0&&` \xB7 ${R.size} selected`]})]}),jsxRuntime.jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:M=>{M.target===M.currentTarget&&(E(new Set),H(null));},children:J.length===0?jsxRuntime.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsxRuntime.jsx(lucideReact.Folder,{className:"mb-2 h-10 w-10"}),jsxRuntime.jsx("span",{className:"text-xs",children:"No files found"})]}):N==="list"?jsxRuntime.jsx("div",{className:"space-y-px",children:J.map((M,ae)=>{let we=ma(M),ke=R.has(ae),Ee=M.extension||vn(M.name);return jsxRuntime.jsxs("div",{className:i("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",ke?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:ke?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:Je=>q(ae,Je),onDoubleClick:()=>be(ae),children:[jsxRuntime.jsx(we,{className:i("h-4 w-4 shrink-0",M.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"flex-1 truncate text-xs font-medium",children:M.name}),Ee&&M.type==="file"&&jsxRuntime.jsx("span",{className:"shrink-0 rounded bg-(--fe-badge-bg) px-1.5 py-0.5 font-mono text-[9px] uppercase text-(--fe-text-muted)",children:Ee}),M.size!=null&&jsxRuntime.jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Oi(M.size)}),M.modifiedAt&&jsxRuntime.jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:da(M.modifiedAt)})]},M.path+ae)})}):jsxRuntime.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:J.map((M,ae)=>{let we=ma(M),ke=R.has(ae),Ee=M.extension||vn(M.name);return jsxRuntime.jsxs("div",{className:i("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",ke?"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:Je=>q(ae,Je),onDoubleClick:()=>be(ae),children:[jsxRuntime.jsx(we,{className:i("h-7 w-7",M.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:M.name}),Ee&&M.type==="file"&&jsxRuntime.jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:Ee})]},M.path+ae)})})}),jsxRuntime.jsx("div",{className:i("overflow-hidden transition-[width,opacity] duration-300 ease-out",Hn?i("absolute right-0 top-0 bottom-0 z-10",B?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):i("shrink-0",B?"w-56":"w-0")),children:B&&jsxRuntime.jsxs("div",{className:i("flex h-full flex-col p-4",Hn?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[Hn&&jsxRuntime.jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{H(null),E(new Set);},title:"Close panel",children:jsxRuntime.jsx(lucideReact.X,{className:"h-3.5 w-3.5"})}),jsxRuntime.jsxs("div",{className:"mb-3 flex flex-col items-center",children:[Nr__default.default.createElement(ma(B),{className:i("h-10 w-10 mb-2",B.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsxRuntime.jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:B.name})]}),jsxRuntime.jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsxRuntime.jsx(mr,{label:"Type",value:B.type==="directory"?"Directory":B.mimeType||B.extension||vn(B.name)||"File"}),B.size!=null&&jsxRuntime.jsx(mr,{label:"Size",value:Oi(B.size)}),jsxRuntime.jsx(mr,{label:"Path",value:B.path,mono:true}),B.extension&&jsxRuntime.jsx(mr,{label:"Extension",value:B.extension}),B.modifiedAt&&jsxRuntime.jsx(mr,{label:"Modified",value:da(B.modifiedAt)}),B.createdAt&&jsxRuntime.jsx(mr,{label:"Created",value:da(B.createdAt)})]}),jsxRuntime.jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[B.type==="file"&&u&&jsxRuntime.jsxs("button",{className:"flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text-strong) transition-colors",style:{background:"color-mix(in srgb, var(--fe-accent) 20%, transparent)",border:"1px solid color-mix(in srgb, var(--fe-accent) 30%, transparent)"},onClick:()=>u(B),children:[jsxRuntime.jsx(lucideReact.ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),w?.map(M=>jsxRuntime.jsxs("button",{className:"fe-action flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-[10px] font-semibold uppercase tracking-wider text-(--fe-text) transition-colors hover:text-(--fe-text-strong)",onClick:()=>M.onClick(B),children:[M.icon&&Nr__default.default.createElement(M.icon,{className:"h-3 w-3"}),M.label]},M.key))]})]})})]}),jsxRuntime.jsxs("div",{className:"fe-statusbar flex h-6 shrink-0 items-center justify-between px-3 text-[9px] font-mono text-(--fe-text-muted)",children:[jsxRuntime.jsxs("span",{children:[J.length," items"]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[R.size>0&&jsxRuntime.jsxs("span",{className:"text-(--fe-accent)/70",children:[R.size," selected"]}),jsxRuntime.jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),h&&!y&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:M=>K("n",M),onTouchStart:M=>xe("n",M)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:M=>K("s",M),onTouchStart:M=>xe("s",M)}),jsxRuntime.jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:M=>K("w",M),onTouchStart:M=>xe("w",M)}),jsxRuntime.jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:M=>K("e",M),onTouchStart:M=>xe("e",M)}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:M=>K("nw",M),onTouchStart:M=>xe("nw",M)}),jsxRuntime.jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:M=>K("ne",M),onTouchStart:M=>xe("ne",M)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:M=>K("sw",M),onTouchStart:M=>xe("sw",M)}),jsxRuntime.jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:M=>K("se",M),onTouchStart:M=>xe("se",M)})]}),jsxRuntime.jsx("style",{children:`
24
24
  .fe-window {
25
25
  background: var(--fe-bg);
26
26
  box-shadow: var(--fe-shadow);
@@ -36,6 +36,13 @@
36
36
  .fe-panel {
37
37
  background: var(--fe-surface);
38
38
  }
39
+ .fe-panel-narrow {
40
+ background: color-mix(in srgb, var(--fe-bg) 82%, transparent);
41
+ backdrop-filter: blur(20px) saturate(160%);
42
+ -webkit-backdrop-filter: blur(20px) saturate(160%);
43
+ border-left: 1px solid color-mix(in srgb, var(--fe-border) 80%, transparent);
44
+ box-shadow: -6px 0 32px rgba(0,0,0,0.35), inset 1px 0 0 color-mix(in srgb, var(--fe-accent) 10%, transparent);
45
+ }
39
46
  .fe-statusbar {
40
47
  border-top: 1px solid var(--fe-border);
41
48
  background: var(--fe-surface);
@@ -74,4 +81,4 @@
74
81
  from { opacity: 0; transform: translateX(-4px); }
75
82
  to { opacity: 1; transform: translateX(0); }
76
83
  }
77
- `}),jsxRuntime.jsx(Gt,{open:_,onOpenChange:R,children:jsxRuntime.jsxs(On,{size:"sm",children:[jsxRuntime.jsxs(Bn,{children:[jsxRuntime.jsxs(Kn,{children:[jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxRuntime.jsxs($n,{children:[C.size===1?`Are you sure you want to delete "${Z[Array.from(C)[0]]?.name}"?`:`Are you sure you want to delete ${C.size} selected items?`," ","This action cannot be undone."]})]}),jsxRuntime.jsxs(jn,{children:[jsxRuntime.jsx(pt,{intent:"ghost",onClick:()=>R(false),children:"Cancel"}),jsxRuntime.jsxs(pt,{intent:"danger",onClick:()=>{let h=Array.from(C).map(O=>Z[O]).filter(Boolean);b?.(h),P(new Set),V(null),R(false);},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]}):null}function Mt({label:e,value:t,mono:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsxRuntime.jsx("div",{className:n("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}function Nd(e,t){let r=t.getBoundingClientRect(),a=Math.max(r.width,r.height)*1.2,s=e.clientX-r.left,o=e.clientY-r.top,l=document.createElement("span");l.className="masonry-ripple",l.style.width=`${a}px`,l.style.height=`${a}px`,l.style.left=`${s}px`,l.style.top=`${o}px`,t.appendChild(l),l.addEventListener("animationend",()=>l.remove());}function va({columns:e,columnWidth:t=240,gap:r=16,items:a,onItemClick:s,className:o,style:l,children:p,...x}){let u=zt.useRef(null),c=zt.useRef([]),[w,b]=zt.useState(()=>e??1),[m,v]=zt.useState([]),[d,f]=zt.useState(0),k=a?a.map((C,P)=>({key:C.key??P,node:C.content})):zt__default.default.Children.toArray(p).map((C,P)=>({key:C.key??P,node:C})),g=k.length,L=zt.useCallback(C=>e??Math.max(1,Math.floor((C+r)/(t+r))),[e,t,r]),N=zt.useCallback(()=>{let C=u.current;if(!C)return;let P=C.clientWidth,A=L(P);b(A);let V=(P-(A-1)*r)/A,y=new Array(A).fill(0),K=[];for(let ae=0;ae<g;ae++){let U=c.current[ae],pe=U?U.offsetHeight:0,j=0;for(let Y=1;Y<A;Y++)y[Y]<y[j]&&(j=Y);K.push({top:y[j],left:j*(V+r),width:V}),y[j]+=pe+r;}let W=Math.max(0,...y)-(g?r:0);v(K),f(W);},[g,L,r]);zt.useEffect(()=>{let C=u.current;if(!C)return;let P=new ResizeObserver(()=>N());return P.observe(C),()=>P.disconnect()},[N]),zt.useEffect(()=>{let C=requestAnimationFrame(N);return ()=>cancelAnimationFrame(C)},[N]),zt.useEffect(()=>{let C=new ResizeObserver(()=>N());return c.current.forEach(P=>{P&&C.observe(P);}),()=>C.disconnect()},[g,w,N]);let T=zt.useCallback((C,P)=>{let A=C.currentTarget;Nd(C,A),s?.(a?.[P],P);},[s,a]),$=C=>{if(!a)return false;let P=a[C];return !!(P.title||P.description||P.actions)};return jsxRuntime.jsx("div",{ref:u,className:n("relative",o),style:{...l,height:d},...x,children:k.map((C,P)=>jsxRuntime.jsxs("div",{ref:A=>{c.current[P]=A;},className:"masonry-item",role:"button",tabIndex:0,onClick:A=>T(A,P),onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),s?.(a?.[P],P));},style:{position:"absolute",top:m[P]?.top??0,left:m[P]?.left??0,width:m[P]?.width??"100%"},children:[C.node,$(P)&&jsxRuntime.jsxs("div",{className:"masonry-item-overlay",children:[a[P].title&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-title",children:a[P].title}),a[P].description&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-desc",children:a[P].description}),a[P].actions&&jsxRuntime.jsx("div",{className:"masonry-item-overlay-actions",children:a[P].actions})]})]},C.key))})}var Cd={FilmReel:sa,MiniPlayer:la,CinePlayer:da,FileExplorer:ba,Masonry:va},wa=Cd;var Vo=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"}});var Do=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"}});var Ca=zt.createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),Sd={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},Fo={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function Ta({children:e,className:t,intent:r,size:a="md",layout:s="stacked",title:o,description:l,footer:p,onValues:x,onSubmit:u,...c}){let w=Sd[a??"md"],[b,m]=zt.useState({}),v=zt.useCallback(d=>{if(u?.(d),x){let f=Object.fromEntries(new FormData(d.currentTarget).entries()),k=x(f,d),g=L=>{if(!L)return;let N={};for(let[T,{result:$,reason:C}]of Object.entries(L))C&&(N[T]={status:$?"success":"error",message:C});m(N);};k instanceof Promise?k.then(g).catch(()=>{}):g(k);}},[u,x]);return jsxRuntime.jsx(Ca.Provider,{value:{layout:s??"stacked",size:a??"md",labelWidth:w,bulkErrors:b},children:jsxRuntime.jsxs("form",{className:n(Vo({intent:r,size:a}),"flex flex-col",t),onSubmit:v,...c,children:[(o||l)&&jsxRuntime.jsxs("div",{className:"mb-(--form-header-mb)",children:[o&&jsxRuntime.jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:o}),l&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:l})]}),jsxRuntime.jsx("div",{className:n("flex flex-col",Fo[a??"md"]),children:e}),p&&jsxRuntime.jsx("div",{className:"mt-(--form-footer-pt) flex flex-wrap items-center justify-end gap-(--form-footer-gap) border-t border-primary-200 pt-(--form-footer-pt) dark:border-primary-700",children:p})]})})}var Vd={error:jsxRuntime.jsx(lucideReact.AlertCircle,{}),warning:jsxRuntime.jsx(lucideReact.AlertTriangle,{}),success:jsxRuntime.jsx(lucideReact.CheckCircle,{}),hint:jsxRuntime.jsx(lucideReact.Info,{})};function Dd({label:e,layout:t,required:r,hint:a,validation:s,name:o,onValidate:l,className:p,children:x}){let u=zt.useContext(Ca),c=zt.useId(),[w,b]=zt.useState(void 0),m=o?u.bulkErrors[o]:void 0,v=s??w??m,f=(t??u.layout)==="inline",k=zt.useCallback($=>{let C=$!=null&&typeof $=="object"&&"target"in $?$.target.value:$;if(o&&u.bulkErrors[o]&&(u.bulkErrors[o]=void 0),!l){b(void 0);return}let{result:P,reason:A}=l(C);b(A?{status:P?"success":"error",message:A}:void 0);},[l,o,u.bulkErrors]),g=v?`${c}-validation`:a?`${c}-hint`:void 0,L=zt__default.default.Children.map(x,($,C)=>{if(C!==0||!zt__default.default.isValidElement($))return $;let P=$,A={};if(P.props.id||(A.id=c),g&&!P.props["aria-describedby"]&&(A["aria-describedby"]=g),v?.status==="error"&&!P.props["aria-invalid"]&&(A["aria-invalid"]=true),o&&!P.props.name&&(A.name=o),l){let V=P.props.onChange;A.onChange=y=>{V?.(y),k(y);};}return Object.keys(A).length?zt__default.default.cloneElement(P,A):$}),N=e!=null&&jsxRuntime.jsx("label",{htmlFor:c,className:n("shrink-0 text-sm font-medium","text-primary-700 dark:text-primary-300",r&&"after:ml-0.5 after:text-danger-500 after:content-['*']",f&&"pt-1.75"),style:f?{width:u.labelWidth,minWidth:u.labelWidth}:void 0,children:e}),T=s?`${c}-validation`:a?`${c}-hint`:void 0;return jsxRuntime.jsxs("div",{className:n("flex w-full flex-col gap-1.5",f&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",p),children:[N,jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[L,v&&jsxRuntime.jsxs("p",{id:`${c}-validation`,className:n(Do({status:v.status})),role:v.status==="error"?"alert":void 0,children:[Vd[v.status],jsxRuntime.jsx("span",{children:v.message})]}),a&&jsxRuntime.jsx("p",{id:T===`${c}-hint`?T:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:a})]})]})}function Id({title:e,description:t,className:r,children:a}){let{size:s}=zt.useContext(Ca);return jsxRuntime.jsxs("fieldset",{className:n("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",Fo[s],r),children:[(e||t)&&jsxRuntime.jsxs("legend",{className:"px-1.5 pb-1",children:[e&&jsxRuntime.jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:e}),t&&jsxRuntime.jsx("span",{className:"ml-2 text-xs text-primary-400 dark:text-primary-500",children:t})]}),a]})}var Ad={Form:Ta},Ra=Ad;var Hd={Primitives:ln,Layout:un,DataDisplay:Rn,Navigation:Vn,Disclosure:Hn,Overlay:Xn,Feedback:na,Extras:wa,Forms:Ra},J0=Hd;exports.Accordion=In;exports.AccordionContent=Wi;exports.AccordionItem=Ui;exports.AccordionTrigger=qi;exports.Alert=Zn;exports.AlertContent=Ml;exports.AlertDescription=Ll;exports.AlertIcon=Pl;exports.AlertTitle=Rl;exports.Badge=Qr;exports.Button=pt;exports.Card=cn;exports.CardContent=Ds;exports.CardDescription=Vs;exports.CardFooter=Is;exports.CardHeader=Es;exports.CardTitle=Ss;exports.Chat=wn;exports.Checkbox=an;exports.CinePlayer=da;exports.CodeBlock=Tn;exports.DataDisplay=Rn;exports.DataTable=ni;exports.Dialog=Gt;exports.DialogClose=ml;exports.DialogContent=On;exports.DialogDescription=$n;exports.DialogFooter=jn;exports.DialogHeader=Bn;exports.DialogTitle=Kn;exports.Disclosure=Hn;exports.Dropdown=Xr;exports.DropdownButton=ft;exports.Extras=wa;exports.Feedback=na;exports.FileExplorer=ba;exports.FilmReel=sa;exports.Form=Ta;exports.FormItem=Dd;exports.FormSection=Id;exports.Forms=Ra;exports.Header=En;exports.HorizontalCard=As;exports.ImageCard=dn;exports.ImageCardActions=Os;exports.ImageCardBody=Fs;exports.ImageCardDescription=zs;exports.ImageCardTitle=_s;exports.Indicator=Jr;exports.Input=tn;exports.Label=en;exports.Layout=un;exports.List=yn;exports.ListItem=si;exports.Masonry=va;exports.MiniPlayer=la;exports.NavLink=Sn;exports.Navigation=Vn;exports.Overlay=Xn;exports.Panel=pn;exports.PanelContent=Ks;exports.PanelHeader=Bs;exports.Primitives=ln;exports.ProgressBar=ea;exports.Radio=sn;exports.RadioGroup=on;exports.SideNav=Ln;exports.SortableTable=ti;exports.Spin=ra;exports.Switch=nn;exports.TabContent=rl;exports.TabList=Ji;exports.TabPanels=tl;exports.TabTrigger=el;exports.Table=_t;exports.TableBody=bn;exports.TableCell=nt;exports.TableEmpty=xn;exports.TableHead=rt;exports.TableHeader=gn;exports.TableRow=Ft;exports.Tabs=An;exports.TextBox=rn;exports.Tooltip=Gn;exports.Tree=hn;exports.TreeItem=ui;exports.accordionContentVariants=wr;exports.accordionTriggerVariants=vr;exports.accordionVariants=kr;exports.alertVariants=Xt;exports.badgeVariants=Zt;exports.buttonVariants=ct;exports.cardVariants=Dt;exports.checkboxVariants=er;exports.cn=n;exports.codeBlockVariants=At;exports.configureAlertTopOffset=Dl;exports.default=J0;exports.dialogContentVariants=jt;exports.indicatorVariants=Qt;exports.inputVariants=dt;exports.labelVariants=Jt;exports.listItemVariants=mr;exports.listVariants=pr;exports.navLinkVariants=yr;exports.panelVariants=cr;exports.progressBarVariants=Mr;exports.radioVariants=tr;exports.spinVariants=vt;exports.switchTrackVariants=rr;exports.tabListVariants=Nr;exports.tabTriggerVariants=Cr;exports.tableVariants=dr;exports.tooltipVariants=Pr;exports.treeItemVariants=ur;exports.useAlert=Bl;exports.useSpin=ec;
84
+ `}),jsxRuntime.jsx(Lr,{open:Y,onOpenChange:V,children:jsxRuntime.jsxs(Fo,{size:"sm",children:[jsxRuntime.jsxs(Ao,{children:[jsxRuntime.jsxs(zo,{children:[jsxRuntime.jsx(lucideReact.AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxRuntime.jsxs(Bo,{children:[R.size===1?`Are you sure you want to delete "${J[Array.from(R)[0]]?.name}"?`:`Are you sure you want to delete ${R.size} selected items?`," ","This action cannot be undone."]})]}),jsxRuntime.jsxs(_o,{children:[jsxRuntime.jsx(Yt,{intent:"ghost",onClick:()=>V(false),children:"Cancel"}),jsxRuntime.jsxs(Yt,{intent:"danger",onClick:()=>{let M=Array.from(R).map(ae=>J[ae]).filter(Boolean);x?.(M),E(new Set),H(null),V(false);},children:[jsxRuntime.jsx(lucideReact.Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function mr({label:e,value:t,mono:r}){return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsxRuntime.jsx("div",{className:i("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}function dp(e,t){let r=t.getBoundingClientRect(),n=Math.max(r.width,r.height)*1.2,o=e.clientX-r.left,a=e.clientY-r.top,s=document.createElement("span");s.className="masonry-ripple",s.style.width=`${n}px`,s.style.height=`${n}px`,s.style.left=`${o}px`,s.style.top=`${a}px`,t.appendChild(s),s.addEventListener("animationend",()=>s.remove());}function ha({columns:e,columnWidth:t=240,gap:r=16,items:n,onItemClick:o,className:a,style:s,children:p,...b}){let u=Nr.useRef(null),c=Nr.useRef([]),[T,x]=Nr.useState(()=>e??1),[m,g]=Nr.useState([]),[d,f]=Nr.useState(0),w=n?n.map((R,E)=>({key:R.key??E,node:R.content})):Nr__default.default.Children.toArray(p).map((R,E)=>({key:R.key??E,node:R})),h=w.length,P=Nr.useCallback(R=>e??Math.max(1,Math.floor((R+r)/(t+r))),[e,t,r]),k=Nr.useCallback(()=>{let R=u.current;if(!R)return;let E=R.clientWidth,A=P(E);x(A);let H=(E-(A-1)*r)/A,y=new Array(A).fill(0),O=[];for(let ne=0;ne<h;ne++){let C=c.current[ne],re=C?C.offsetHeight:0,_=0;for(let de=1;de<A;de++)y[de]<y[_]&&(_=de);O.push({top:y[_],left:_*(H+r),width:H}),y[_]+=re+r;}let v=Math.max(0,...y)-(h?r:0);g(O),f(v);},[h,P,r]);Nr.useEffect(()=>{let R=u.current;if(!R)return;let E=new ResizeObserver(()=>k());return E.observe(R),()=>E.disconnect()},[k]),Nr.useEffect(()=>{let R=requestAnimationFrame(k);return ()=>cancelAnimationFrame(R)},[k]),Nr.useEffect(()=>{let R=new ResizeObserver(()=>k());return c.current.forEach(E=>{E&&R.observe(E);}),()=>R.disconnect()},[h,T,k]);let N=Nr.useCallback((R,E)=>{let A=R.currentTarget;dp(R,A),o?.(n?.[E],E);},[o,n]),F=R=>{if(!n)return false;let E=n[R];return !!(E.title||E.description||E.actions)};return jsxRuntime.jsx("div",{ref:u,className:i("relative",a),style:{...s,height:d},...b,children:w.map((R,E)=>jsxRuntime.jsxs("div",{ref:A=>{c.current[E]=A;},className:"masonry-item",role:"button",tabIndex:0,onClick:A=>N(A,E),onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),o?.(n?.[E],E));},style:{position:"absolute",top:m[E]?.top??0,left:m[E]?.left??0,width:m[E]?.width??"100%"},children:[R.node,F(E)&&jsxRuntime.jsxs("div",{className:"masonry-item-overlay",children:[n[E].title&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-title",children:n[E].title}),n[E].description&&jsxRuntime.jsx("p",{className:"masonry-item-overlay-desc",children:n[E].description}),n[E].actions&&jsxRuntime.jsx("div",{className:"masonry-item-overlay-actions",children:n[E].actions})]})]},R.key))})}function Tn({text:e="",mode:t="typewriter",speed:r=40,cursor:n=true,cursorChar:o="\u258B",thinking:a=false,streaming:s=false,delay:p=0,onComplete:b,as:u="span",className:c}){let[T,x]=Nr.useState(t==="instant"?e:""),[m,g]=Nr.useState(false),[d,f]=Nr.useState(t==="instant"),[w,h]=Nr.useState(false),P=Nr.useRef(0),k=Nr.useRef(b);k.current=b;let N=Nr.useRef(e);N.current=e,Nr.useEffect(()=>{if(t!=="typewriter")return;if(x(""),f(false),h(false),g(false),!e){f(true);return}let H=Math.max(10,1e3/r),y=0,O,v=()=>{g(true),O=setInterval(()=>{let C=N.current;y++,x(C.slice(0,y)),y>=C.length&&(clearInterval(O),g(false),f(true),k.current?.());},H);},ne;return p>0?ne=setTimeout(v,p):v(),()=>{clearTimeout(ne),clearInterval(O);}},[e,t]),Nr.useEffect(()=>{if(t!=="stream")return;if(e.length===0){P.current=0,x(""),g(false),f(false),h(false);return}if(e.length<=P.current)return;let H=Math.max(10,1e3/r),y=P.current;g(true),f(false),h(false);let O=setInterval(()=>{y++,P.current=y,x(N.current.slice(0,y)),y>=N.current.length&&(clearInterval(O),g(false),k.current?.());},H);return ()=>clearInterval(O)},[e,t]),Nr.useEffect(()=>{t==="instant"&&(x(e),g(false),f(true));},[e,t]);let F=Nr.useRef(s);Nr.useEffect(()=>{let H=F.current;if(F.current=s,H&&!s&&!m&&t==="stream"){h(true);let y=setTimeout(()=>{h(false),f(true);},650);return ()=>clearTimeout(y)}},[s,m,t]);let R=n&&(a||m||w||t==="stream"&&s&&!d||t==="typewriter"&&!d),E=a?"tw-cursor--blink":m?"tw-cursor--solid":w?"tw-cursor--out":"tw-cursor--blink";return jsxRuntime.jsxs(u,{className:i(c),children:[a&&!T&&jsxRuntime.jsx("span",{"aria-hidden":"true",children:"\u200B"}),T,R&&jsxRuntime.jsx("span",{className:i("tw-cursor",E),"aria-hidden":"true",children:o})]})}var pp={FilmReel:ra,MiniPlayer:oa,CinePlayer:ia,FileExplorer:pa,Masonry:ha,TypewriterText:Tn},ba=pp;var Ui=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"}});var qi=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"}});var va=Nr.createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),yp={sm:"var(--form-label-w-sm, 5rem)",md:"var(--form-label-w-md, 7rem)",lg:"var(--form-label-w-lg, 9rem)"},es={sm:"gap-(--form-row-gap-sm)",md:"gap-(--form-row-gap-md)",lg:"gap-(--form-row-gap-lg)"};function wa({children:e,className:t,intent:r,size:n="md",layout:o="stacked",title:a,description:s,footer:p,onValues:b,onSubmit:u,...c}){let T=yp[n??"md"],[x,m]=Nr.useState({}),g=Nr.useCallback(d=>{if(d.preventDefault(),u?.(d),b){let f=Object.fromEntries(new FormData(d.currentTarget).entries()),w=b(f,d),h=P=>{if(!P)return;let k={};for(let[N,{result:F,reason:R}]of Object.entries(P))R&&(k[N]={status:F?"success":"error",message:R});m(k);};w instanceof Promise?w.then(h).catch(()=>{}):h(w);}},[u,b]);return jsxRuntime.jsx(va.Provider,{value:{layout:o??"stacked",size:n??"md",labelWidth:T,bulkErrors:x},children:jsxRuntime.jsxs("form",{className:i(Ui({intent:r,size:n}),"flex flex-col",t),onSubmit:g,...c,children:[(a||s)&&jsxRuntime.jsxs("div",{className:"mb-(--form-header-mb)",children:[a&&jsxRuntime.jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:a}),s&&jsxRuntime.jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:s})]}),jsxRuntime.jsx("div",{className:i("flex flex-col",es[n??"md"]),children:e}),p&&jsxRuntime.jsx("div",{className:"mt-(--form-footer-pt) flex flex-wrap items-center justify-end gap-(--form-footer-gap) border-t border-primary-200 pt-(--form-footer-pt) dark:border-primary-700",children:p})]})})}var vp={error:jsxRuntime.jsx(lucideReact.AlertCircle,{}),warning:jsxRuntime.jsx(lucideReact.AlertTriangle,{}),success:jsxRuntime.jsx(lucideReact.CheckCircle,{}),hint:jsxRuntime.jsx(lucideReact.Info,{})};function wp({label:e,layout:t,required:r,hint:n,validation:o,name:a,onValidate:s,className:p,children:b}){let u=Nr.useContext(va),c=Nr.useId(),[T,x]=Nr.useState(void 0),m=a?u.bulkErrors[a]:void 0,g=o??T??m,f=(t??u.layout)==="inline",w=Nr.useCallback(F=>{let R=F!=null&&typeof F=="object"&&"target"in F?F.target.value:F;if(a&&u.bulkErrors[a]&&(u.bulkErrors[a]=void 0),!s){x(void 0);return}let{result:E,reason:A}=s(R);x(A?{status:E?"success":"error",message:A}:void 0);},[s,a,u.bulkErrors]),h=g?`${c}-validation`:n?`${c}-hint`:void 0,P=Nr__default.default.Children.map(b,(F,R)=>{if(R!==0||!Nr__default.default.isValidElement(F))return F;let E=F,A={};if(E.props.id||(A.id=c),h&&!E.props["aria-describedby"]&&(A["aria-describedby"]=h),g?.status==="error"&&!E.props["aria-invalid"]&&(A["aria-invalid"]=true),a&&!E.props.name&&(A.name=a),s){let H=E.props.onChange;A.onChange=y=>{H?.(y),w(y);};}return Object.keys(A).length?Nr__default.default.cloneElement(E,A):F}),k=e!=null&&jsxRuntime.jsx("label",{htmlFor:c,className:i("shrink-0 text-sm font-medium","text-primary-700 dark:text-primary-300",r&&"after:ml-0.5 after:text-danger-500 after:content-['*']",f&&"pt-1.75"),style:f?{width:u.labelWidth,minWidth:u.labelWidth}:void 0,children:e}),N=o?`${c}-validation`:n?`${c}-hint`:void 0;return jsxRuntime.jsxs("div",{className:i("flex w-full flex-col gap-1.5",f&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",p),children:[k,jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[P,g&&jsxRuntime.jsxs("p",{id:`${c}-validation`,className:i(qi({status:g.status})),role:g.status==="error"?"alert":void 0,children:[vp[g.status],jsxRuntime.jsx("span",{children:g.message})]}),n&&jsxRuntime.jsx("p",{id:N===`${c}-hint`?N:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:n})]})]})}function kp({title:e,description:t,className:r,children:n}){let{size:o}=Nr.useContext(va);return jsxRuntime.jsxs("fieldset",{className:i("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",es[o],r),children:[(e||t)&&jsxRuntime.jsxs("legend",{className:"px-1.5 pb-1",children:[e&&jsxRuntime.jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:e}),t&&jsxRuntime.jsx("span",{className:"ml-2 text-xs text-primary-400 dark:text-primary-500",children:t})]}),n]})}var Np={Form:wa},ka=Np;var dt=classVarianceAuthority.cva("relative w-full font-sans select-none",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),mt=classVarianceAuthority.cva("flex flex-wrap gap-3 items-center justify-center",{variants:{position:{top:"mb-3",bottom:"mt-3",left:"flex-col mr-4",right:"flex-col ml-4"}},defaultVariants:{position:"bottom"}}),pt=classVarianceAuthority.cva("absolute z-50 pointer-events-none px-3 py-2 rounded-lg text-xs shadow-lg border transition-opacity duration-150 bg-primary-900 text-primary-50 border-primary-700 dark:bg-primary-950 dark:border-primary-800");function Rt(e){let[t,r]=Nr.useState(()=>new Set(e)),n=Nr.useCallback(s=>{r(p=>{let b=new Set(p);return b.has(s)?b.delete(s):b.add(s),b});},[]),o=Nr.useCallback(s=>t.has(s),[t]),a=Nr.useCallback(()=>{r(new Set(e));},[e]);return {visible:t,toggle:n,isVisible:o,showAll:a}}function Mt(e){let t=["var(--color-chart-1)","var(--color-chart-2)","var(--color-chart-3)","var(--color-chart-4)","var(--color-chart-5)","var(--color-chart-6)","var(--color-chart-7)","var(--color-chart-8)"];return Array.from({length:e},(r,n)=>t[n%t.length])}function St(e,t,r=.1){if(e===t)return [e-1,t+1];let o=(t-e)*r;return [Math.floor(e-o),Math.ceil(t+o)]}function pr(e,t,r){if(r<=1)return [e];let n=(t-e)/(r-1);return Array.from({length:r},(o,a)=>+(e+a*n).toFixed(10))}function Pe(e,t){return t?t(e):typeof e=="number"?Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}K`:Number.isInteger(e)?e.toString():e.toFixed(2):String(e)}function Qe(e,t,r,n){let o=(n-90)*Math.PI/180;return {x:e+r*Math.cos(o),y:t+r*Math.sin(o)}}function Lt(e,t,r){return {top:20,right:r?65:20,bottom:e?52:36,left:t?65:52}}function Et(e,t,r){let n=Math.max(e,120);return {width:n,height:t,margins:r,plotLeft:r.left,plotTop:r.top,plotRight:n-r.right,plotBottom:t-r.bottom,plotWidth:Math.max(n-r.left-r.right,10),plotHeight:Math.max(t-r.top-r.bottom,10)}}function ts(e,t){let r=new Set,n=[];for(let o of e)if(t.has(o.id))for(let a of o.data){let s=String(a.x);r.has(s)||(r.add(s),n.push(s));}return n}function Ta(e,t,r){let n=1/0,o=-1/0;for(let p of e)if(t.has(p.id))for(let b of p.data)b.y<n&&(n=b.y),b.y>o&&(o=b.y);if(!isFinite(n))return [0,1];let[a,s]=St(n,o);return [r?.min??a,r?.max??s]}function Rn(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:s=>o+(s-r)/(n-r)*(a-o)}function Mn(e,t){let r=e.length;if(r===0)return ()=>(t[0]+t[1])/2;let n=(t[1]-t[0])/r;return o=>{let a=e.indexOf(o);return a<0?(t[0]+t[1])/2:t[0]+a*n+n/2}}function rs(e,t,r){return e.map(n=>`${t(n.x).toFixed(2)},${r(n.y).toFixed(2)}`).join(" ")}function Ra(e,t,r){if(e.length===0)return "";let n=e.map(s=>({x:t(s.x),y:r(s.y)}));if(n.length===1)return `M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)}`;let o=.5,a=`M ${n[0].x.toFixed(2)} ${n[0].y.toFixed(2)}`;for(let s=0;s<n.length-1;s++){let p=s===0?{x:2*n[0].x-n[1].x,y:2*n[0].y-n[1].y}:n[s-1],b=n[s],u=n[s+1],c=s+2<n.length?n[s+2]:{x:2*n[n.length-1].x-n[n.length-2].x,y:2*n[n.length-1].y-n[n.length-2].y},T=b.x+(u.x-p.x)*o/3,x=b.y+(u.y-p.y)*o/3,m=u.x-(c.x-b.x)*o/3,g=u.y-(c.y-b.y)*o/3;a+=` C ${T.toFixed(2)} ${x.toFixed(2)}, ${m.toFixed(2)} ${g.toFixed(2)}, ${u.x.toFixed(2)} ${u.y.toFixed(2)}`;}return a}function ns(e,t,r,n,o){if(e.length===0)return "";let a=n?Ra(e,t,r):`M ${e.map(b=>`${t(b.x).toFixed(2)},${r(b.y).toFixed(2)}`).join(" L ")}`,s=t(e[e.length-1].x).toFixed(2),p=t(e[0].x).toFixed(2);return `${a} L ${s},${o.toFixed(2)} L ${p},${o.toFixed(2)} Z`}function Sn(e,t=5){return pr(e[0],e[1],t)}function Ma(e,t,r){if(t.length===0)return -1;let n=1/0,o=0;for(let a=0;a<t.length;a++){let s=Math.abs(r(t[a])-e);s<n&&(n=s,o=a);}return o}function Sa(e,t){return e.data.find(r=>String(r.x)===t)?.y}function os(e){for(let t of e)for(let r of t.data)if(typeof r.x=="string")return true;return false}function Ln({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:mt({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:i("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-5 rounded-sm shrink-0",style:{background:n.color}}),n.label]},n.id))})}function Pa({series:e,xAxis:t,yAxis:r,y2Axis:n,y2Series:o=[],smooth:a=false,showDots:s=true,area:p=false,strokeWidth:b=2,title:u,height:c=300,className:T,legend:x=true,legendPosition:m="bottom",animateOnMount:g=true,emptyText:d="No data to display"}){let f=Nr.useRef(null),w=Nr.useRef(null),[h,P]=Nr.useState(600),[k,N]=Nr.useState(null),[F,R]=Nr.useState(null);Nr.useEffect(()=>{let S=w.current;if(!S)return;let ce=S.getBoundingClientRect().width;ce>0&&P(ce);let oe=new ResizeObserver(he=>{let fe=he[0]?.contentRect.width;fe&&fe>0&&P(fe);});return oe.observe(S),()=>oe.disconnect()},[]);let E=Nr.useMemo(()=>e.map(S=>S.id),[e]),{visible:A,toggle:H,isVisible:y}=Rt(E),O=Nr.useMemo(()=>Mt(e.length),[e.length]),v=Nr.useMemo(()=>new Map(e.map((S,ce)=>[S.id,S.color??O[ce]])),[e,O]),ne=Nr.useMemo(()=>Lt(!!t?.label,!!r?.label,!!n),[t?.label,r?.label,n]),C=Nr.useMemo(()=>Et(h,c,ne),[h,c,ne]),re=Nr.useMemo(()=>os(e),[e]),_=Nr.useMemo(()=>re?ts(e,A):[],[e,A,re]),de=Nr.useMemo(()=>{if(re){let fe=Mn(_,[C.plotLeft,C.plotRight]);return Re=>fe(Re)}let S=e.flatMap(fe=>fe.data.map(Re=>Re.x));if(S.length===0)return ()=>C.plotLeft;let ce=Math.min(...S),oe=Math.max(...S),he=Rn([ce,oe],[C.plotLeft,C.plotRight]);return fe=>he(fe)},[e,re,_,C]),j=Nr.useMemo(()=>Ta(e,A,r),[e,A,r]),pe=Nr.useMemo(()=>Rn(j,[C.plotBottom,C.plotTop]),[j,C]),Y=Nr.useMemo(()=>Sn(j,r?.tickCount??5),[j,r?.tickCount]),V=Nr.useMemo(()=>{if(!n)return null;let S=e.filter(ce=>o.includes(ce.id));return Ta(S,A,n)},[n,e,o,A]),G=Nr.useMemo(()=>V?Rn(V,[C.plotBottom,C.plotTop]):null,[V,C]),me=Nr.useMemo(()=>V?Sn(V,n?.tickCount??5):[],[V,n?.tickCount]),W=Nr.useMemo(()=>{if(re)return _;let S=e.flatMap(he=>he.data.map(fe=>Number(fe.x)));if(S.length===0)return [];let ce=Math.min(...S),oe=Math.max(...S);return Sn([ce,oe],t?.tickCount??6)},[re,_,e,t?.tickCount]),l=Nr.useCallback(S=>{let ce=S.currentTarget.closest("svg");if(!ce)return;let oe=ce.getBoundingClientRect(),he=S.clientX-oe.left,fe=f.current?.getBoundingClientRect();if(!fe)return;let Re="",ye=he;if(re&&_.length>0){let q=Mn(_,[C.plotLeft,C.plotRight]),be=Ma(he,_,q);Re=_[be]??"",ye=q(Re);}else if(!re){let q=W;Re=Pe((he-C.plotLeft)/C.plotWidth*(q[q.length-1]-q[0])+q[0],t?.format),ye=he;}let z=e.filter(q=>y(q.id)).map(q=>{o.includes(q.id)&&G!=null?G:pe;let He;if(re)He=Sa(q,Re);else {let K=he,xe=1/0,L;for(let Z of q.data){let ee=de(Z.x),I=Math.abs(ee-K);I<xe&&(xe=I,L=Z.y);}He=L;}return {name:q.name,value:He!==void 0?Pe(He,r?.format):"\u2014",color:v.get(q.id)??"var(--color-chart-1)"}});ye>=C.plotLeft&&ye<=C.plotRight&&R(ye);let J=S.clientX-fe.left+12,B=S.clientY-fe.top-10;N({x:J,y:B,label:Re,items:z});},[re,_,C,e,y,o,G,pe,de,W,t?.format,r?.format,v]),D=Nr.useCallback(()=>{N(null),R(null);},[]),X=Nr.useCallback(S=>{S.preventDefault();let ce=S.touches[0];if(!ce)return;let oe=S.currentTarget.closest("svg");if(!oe)return;let he=oe.getBoundingClientRect(),fe=f.current?.getBoundingClientRect();if(!fe)return;let Re=ce.clientX-he.left,ye=Re,z="";if(re&&_.length>0){let B=Mn(_,[C.plotLeft,C.plotRight]),q=Ma(Re,_,B);z=_[q]??"",ye=B(z);}ye>=C.plotLeft&&ye<=C.plotRight&&R(ye);let J=e.filter(B=>y(B.id)).map(B=>({name:B.name,value:re&&z?Pe(Sa(B,z)??0,r?.format):"\u2014",color:v.get(B.id)??"var(--color-chart-1)"}));N({x:ce.clientX-fe.left+12,y:ce.clientY-fe.top-10,label:z,items:J});},[re,_,C,e,y,r?.format,v]),$=Nr.useMemo(()=>e.map((S,ce)=>({id:S.id,label:S.name,color:S.color??O[ce],visible:y(S.id)})),[e,O,y]),se=e.some(S=>S.data.length>0),ue=jsxRuntime.jsxs("svg",{role:"img","aria-label":u??"Line chart",width:C.width,height:C.height,viewBox:`0 0 ${C.width} ${C.height}`,shapeRendering:"geometricPrecision",children:[r?.gridLines!==false&&Y.map(S=>{let ce=pe(S);return jsxRuntime.jsx("line",{x1:C.plotLeft,x2:C.plotRight,y1:ce,y2:ce,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},S)}),p&&e.map(S=>{if(!y(S.id)||S.data.length===0)return null;let oe=o.includes(S.id)&&G!=null?G:pe,he=v.get(S.id)??"var(--color-chart-1)",fe=ns(S.data,de,oe,a,C.plotBottom);return jsxRuntime.jsx("path",{d:fe,fill:he,fillOpacity:.15,stroke:"none",className:g?"chart-area-animate":""},`area-${S.id}`)}),e.map(S=>{if(!y(S.id)||S.data.length===0)return null;let oe=o.includes(S.id)&&G!=null?G:pe,he=v.get(S.id)??"var(--color-chart-1)";return a?jsxRuntime.jsx("path",{d:Ra(S.data,de,oe),fill:"none",stroke:he,strokeWidth:b,strokeLinecap:"round",strokeLinejoin:"round",className:g?"chart-line-animate":""},S.id):jsxRuntime.jsx("polyline",{points:rs(S.data,de,oe),fill:"none",stroke:he,strokeWidth:b,strokeLinecap:"round",strokeLinejoin:"round",className:g?"chart-line-animate":""},S.id)}),s&&e.map(S=>{if(!y(S.id))return null;let oe=o.includes(S.id)&&G!=null?G:pe,he=v.get(S.id)??"var(--color-chart-1)";return S.data.map((fe,Re)=>jsxRuntime.jsx("circle",{cx:de(fe.x),cy:oe(fe.y),r:3,fill:he,stroke:"white",strokeWidth:1.5,className:i("chart-dot",g?"chart-dot-animate":"")},`${S.id}-${Re}`))}),F!=null&&jsxRuntime.jsx("line",{className:"chart-crosshair",x1:F,x2:F,y1:C.plotTop,y2:C.plotBottom,stroke:"currentColor",strokeWidth:1,strokeDasharray:"4 4",opacity:.5,style:{color:"var(--color-secondary-400)"}}),jsxRuntime.jsx("line",{x1:C.plotLeft,x2:C.plotLeft,y1:C.plotTop,y2:C.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),Y.map(S=>{let ce=pe(S);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:C.plotLeft-4,x2:C.plotLeft,y1:ce,y2:ce,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:C.plotLeft-6,y:ce,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(S,r?.format)})]},S)}),r?.label&&jsxRuntime.jsx("text",{x:-(C.plotTop+C.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),n&&G&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:C.plotRight,x2:C.plotRight,y1:C.plotTop,y2:C.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),me.map(S=>{let ce=G(S);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:C.plotRight,x2:C.plotRight+4,y1:ce,y2:ce,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:C.plotRight+6,y:ce,textAnchor:"start",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(S,n?.format)})]},S)}),n?.label&&jsxRuntime.jsx("text",{x:C.plotTop+C.plotHeight/2,y:-(C.width-14),textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(90)",children:n.label})]}),jsxRuntime.jsx("line",{x1:C.plotLeft,x2:C.plotRight,y1:C.plotBottom,y2:C.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),(re?_:W).map((S,ce)=>{let oe=de(S);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:oe,x2:oe,y1:C.plotBottom,y2:C.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:oe,y:C.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(S,t?.format)})]},ce)}),t?.label&&jsxRuntime.jsx("text",{x:C.plotLeft+C.plotWidth/2,y:C.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label}),jsxRuntime.jsx("rect",{x:C.plotLeft,y:C.plotTop,width:C.plotWidth,height:C.plotHeight,fill:"transparent",onMouseMove:l,onMouseLeave:D,onTouchStart:X,onTouchMove:X,onTouchEnd:D,style:{cursor:"crosshair"}})]}),Te=m==="left"||m==="right";return jsxRuntime.jsxs("div",{ref:f,className:i(dt(),T),children:[u&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:u}),x&&m==="top"&&jsxRuntime.jsx(Ln,{items:$,position:"top",onToggle:H}),jsxRuntime.jsxs("div",{className:i("flex items-start",Te&&"gap-0"),children:[x&&m==="left"&&jsxRuntime.jsx(Ln,{items:$,position:"left",onToggle:H}),jsxRuntime.jsx("div",{ref:w,className:"flex-1 min-w-0 overflow-hidden",children:se?ue:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:c},children:d})}),x&&m==="right"&&jsxRuntime.jsx(Ln,{items:$,position:"right",onToggle:H})]}),x&&m==="bottom"&&jsxRuntime.jsx(Ln,{items:$,position:"bottom",onToggle:H}),k&&jsxRuntime.jsxs("div",{className:pt(),style:{left:k.x,top:k.y},role:"tooltip",children:[k.label&&jsxRuntime.jsx("div",{className:"mb-1 font-medium text-primary-200",children:k.label}),k.items.map((S,ce)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:S.color}}),jsxRuntime.jsxs("span",{className:"text-primary-300",children:[S.name,":"]}),jsxRuntime.jsx("span",{className:"font-medium",children:S.value})]},ce))]})]})}function is(e,t){let r=new Set,n=[];for(let o of e)if(t.has(o.id))for(let a of o.data){let s=String(a.x);r.has(s)||(r.add(s),n.push(s));}return n}function ss(e,t,r,n){if(r){let o=0;for(let s of e)if(t.has(s.id))for(let p of s.data)p.y>o&&(o=p.y);o===0&&(o=1);let[,a]=St(0,o,.05);return [n?.min??0,n?.max??a]}else {let o=new Map;for(let p of e)if(t.has(p.id))for(let b of p.data){let u=String(b.x);o.set(u,(o.get(u)??0)+b.y);}let a=Math.max(0,...o.values()),[,s]=St(0,a===0?1:a,.05);return [n?.min??0,n?.max??s]}}function ls(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:s=>o+(s-r)/(n-r)*(a-o)}function cs(e,t=5){return pr(e[0],e[1],t)}function ds(e,t,r,n,o,a,s,p,b,u,c){let T=e.filter(h=>t.has(h.id)),x=r.length,m=T.length;if(x===0||m===0)return [];let g=a/x,d=g*(1-u),f=m>0?d*(1-c)/m:0,w=[];for(let h=0;h<r.length;h++){let P=r[h],k=o+h*g+(g-d)/2;for(let N=0;N<T.length;N++){let F=T[N],R=F.data.find(H=>String(H.x)===P);if(!R)continue;let E=k+N*(f+d*c/m),A=b(R.y);w.push({seriesId:F.id,category:P,x:E,y:A,width:Math.max(f,1),height:Math.max(s-A,0),stackBase:s,value:R.y,color:n.get(F.id)??"var(--color-chart-1)"});}}return w}function ms(e,t,r,n,o,a,s,p,b,u){let c=e.filter(w=>t.has(w.id)),T=r.length,x=c.length;if(T===0||x===0)return [];let m=s/T,g=m*(1-b),d=x>0?g*(1-u)/x:0,f=[];for(let w=0;w<r.length;w++){let h=r[w],P=a+w*m+(m-g)/2;for(let k=0;k<c.length;k++){let N=c[k],F=N.data.find(A=>String(A.x)===h);if(!F)continue;let R=P+k*(d+g*u/Math.max(x,1)),E=p(F.y);f.push({seriesId:N.id,category:h,x:o,y:R,width:Math.max(E-o,0),height:Math.max(d,1),stackBase:o,value:F.y,color:n.get(N.id)??"var(--color-chart-1)"});}}return f}function ps(e,t,r,n,o,a,s,p,b){let u=e.filter(g=>t.has(g.id)),c=r.length;if(c===0)return [];let T=s/c*(1-b),x=[],m=new Map;r.forEach(g=>m.set(g,o));for(let g of u)for(let d of r){let f=g.data.find(N=>String(N.x)===d);if(!f)continue;let w=m.get(d)??o,h=Math.max(p(f.y)-o,0),P=r.indexOf(d),k=a+(P+.5)*(s/c);x.push({seriesId:g.id,category:d,x:w,y:k-T/2,width:h,height:Math.max(T,1),stackBase:w,value:f.y,color:n.get(g.id)??"var(--color-chart-1)"}),m.set(d,w+h);}return x}function us(e,t,r,n,o,a,s,p,b){let u=e.filter(g=>t.has(g.id)),c=r.length;if(c===0)return [];let T=a/c*(1-b),x=[],m=new Map;r.forEach(g=>m.set(g,s));for(let g of u)for(let d of r){let f=g.data.find(F=>String(F.x)===d);if(!f)continue;let w=m.get(d)??s,h=Math.max(s-p(f.y),0),P=w-h,k=r.indexOf(d),N=o+(k+.5)*(a/c);x.push({seriesId:g.id,category:d,x:N-T/2,y:P,width:Math.max(T,1),height:h,stackBase:w,value:f.y,color:n.get(g.id)??"var(--color-chart-1)"}),m.set(d,P);}return x}function En({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:mt({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:i("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-5 rounded-sm shrink-0",style:{background:n.color}}),n.label]},n.id))})}function Va({series:e,xAxis:t,yAxis:r,orientation:n="vertical",grouped:o=true,barRadius:a=4,barPadding:s=.2,groupPadding:p=.3,title:b,height:u=300,className:c,legend:T=true,legendPosition:x="bottom",animateOnMount:m=true,emptyText:g="No data to display"}){let d=Nr.useRef(null),f=Nr.useRef(null),[w,h]=Nr.useState(600),[P,k]=Nr.useState(null);Nr.useEffect(()=>{let l=f.current;if(!l)return;let D=l.getBoundingClientRect().width;D>0&&h(D);let X=new ResizeObserver($=>{let se=$[0]?.contentRect.width;se&&se>0&&h(se);});return X.observe(l),()=>X.disconnect()},[]);let N=Nr.useMemo(()=>e.map(l=>l.id),[e]),{visible:F,toggle:R,isVisible:E}=Rt(N),A=Nr.useMemo(()=>Mt(e.length),[e.length]),H=Nr.useMemo(()=>new Map(e.map((l,D)=>[l.id,l.color??A[D]])),[e,A]),y=n==="horizontal",O=Nr.useMemo(()=>Lt(!!t?.label,!!r?.label,false),[t?.label,r?.label]),v=Nr.useMemo(()=>Et(w,u,O),[w,u,O]),ne=Nr.useMemo(()=>is(e,F),[e,F]),C=Nr.useMemo(()=>ss(e,F,o,y?t:r),[e,F,o,y,t,r]),re=Nr.useMemo(()=>ls(C,y?[v.plotLeft,v.plotRight]:[v.plotBottom,v.plotTop]),[C,v,y]),_=Nr.useMemo(()=>cs(C,(y?t:r)?.tickCount??5),[C,y,t,r]),de=Nr.useMemo(()=>y?o?ms(e,F,ne,H,v.plotLeft,v.plotTop,v.plotHeight,re,p,s):ps(e,F,ne,H,v.plotLeft,v.plotTop,v.plotHeight,re,p):o?ds(e,F,ne,H,v.plotLeft,v.plotWidth,v.plotBottom,v.plotTop,re,p,s):us(e,F,ne,H,v.plotLeft,v.plotWidth,v.plotBottom,re,p),[e,F,ne,H,v,re,o,y,p,s]),j=ne.length>0?v.plotWidth/ne.length:1,pe=ne.length>0?v.plotHeight/ne.length:1,Y=Nr.useCallback((l,D)=>{let X=d.current?.getBoundingClientRect();if(!X)return;let $=e.filter(se=>E(se.id)).map(se=>{let ue=se.data.find(Te=>String(Te.x)===D);return {name:se.name,value:ue?Pe(ue.y,r?.format):"\u2014",color:H.get(se.id)??"var(--color-chart-1)"}});k({x:l.clientX-X.left+12,y:l.clientY-X.top-10,category:D,items:$});},[e,E,H,r?.format]),V=Nr.useMemo(()=>e.map((l,D)=>({id:l.id,label:l.name,color:l.color??A[D],visible:E(l.id)})),[e,A,E]),G=e.some(l=>l.data.length>0),me=x==="left"||x==="right",W=jsxRuntime.jsxs("svg",{role:"img","aria-label":b??"Bar chart",width:v.width,height:v.height,viewBox:`0 0 ${v.width} ${v.height}`,shapeRendering:"geometricPrecision",children:[_.map(l=>{let D=re(l);return y?jsxRuntime.jsx("line",{x1:D,x2:D,y1:v.plotTop,y2:v.plotBottom,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},l):jsxRuntime.jsx("line",{x1:v.plotLeft,x2:v.plotRight,y1:D,y2:D,stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},l)}),de.map(l=>{let D=Math.min(a,l.width/2,l.height/2),X=`${l.seriesId}-${l.category}`;return y?jsxRuntime.jsx("rect",{x:l.x,y:l.y,width:l.width,height:l.height,rx:D,fill:l.color,className:i("chart-bar-h",m&&"chart-bar-animate"),onMouseMove:$=>Y($,l.category),onMouseLeave:()=>k(null)},X):jsxRuntime.jsx("rect",{x:l.x,y:l.y,width:l.width,height:l.height,rx:D,fill:l.color,className:i("chart-bar-v",m&&"chart-bar-animate"),onMouseMove:$=>Y($,l.category),onMouseLeave:()=>k(null)},X)}),jsxRuntime.jsx("line",{x1:v.plotLeft,x2:v.plotLeft,y1:v.plotTop,y2:v.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("line",{x1:v.plotLeft,x2:v.plotRight,y1:v.plotBottom,y2:v.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),!y&&_.map(l=>{let D=re(l);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:v.plotLeft-4,x2:v.plotLeft,y1:D,y2:D,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:v.plotLeft-6,y:D,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(l,r?.format)})]},l)}),y&&_.map(l=>{let D=re(l);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:D,x2:D,y1:v.plotBottom,y2:v.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:D,y:v.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(l,t?.format)})]},l)}),ne.map((l,D)=>{if(y){let $=v.plotTop+(D+.5)*pe;return jsxRuntime.jsx("text",{x:v.plotLeft-6,y:$,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:l},l)}let X=v.plotLeft+(D+.5)*j;return jsxRuntime.jsx("text",{x:X,y:v.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:l},l)}),r?.label&&!y&&jsxRuntime.jsx("text",{x:-(v.plotTop+v.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),t?.label&&jsxRuntime.jsx("text",{x:v.plotLeft+v.plotWidth/2,y:v.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label})]});return jsxRuntime.jsxs("div",{ref:d,className:i(dt(),c),children:[b&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:b}),T&&x==="top"&&jsxRuntime.jsx(En,{items:V,position:"top",onToggle:R}),jsxRuntime.jsxs("div",{className:i("flex items-start",me&&"gap-0"),children:[T&&x==="left"&&jsxRuntime.jsx(En,{items:V,position:"left",onToggle:R}),jsxRuntime.jsx("div",{ref:f,className:"flex-1 min-w-0 overflow-hidden",children:G?W:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:u},children:g})}),T&&x==="right"&&jsxRuntime.jsx(En,{items:V,position:"right",onToggle:R})]}),T&&x==="bottom"&&jsxRuntime.jsx(En,{items:V,position:"bottom",onToggle:R}),P&&jsxRuntime.jsxs("div",{className:pt(),style:{left:P.x,top:P.y},role:"tooltip",children:[jsxRuntime.jsx("div",{className:"mb-1 font-medium text-primary-200",children:P.category}),P.items.map((l,D)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:l.color}}),jsxRuntime.jsxs("span",{className:"text-primary-300",children:[l.name,":"]}),jsxRuntime.jsx("span",{className:"font-medium",children:l.value})]},D))]})]})}function hs(e,t,r,n,o,a,s,p,b){let u=e.filter(g=>t.has(g.id)),c=u.reduce((g,d)=>g+d.value,0);if(c===0)return [];let T=new Map(e.map((g,d)=>[g.id,g.color??r[d%r.length]])),x=[],m=p;for(let g of u){let d=g.value/c*360,f=b/2,w=m+f,h=m+d-f,P=(w+h)/2,k;if(Math.abs(h-w)>=359.9){let N=Qe(a,s,n,w),F=Qe(a,s,n,w+180);k=`M ${N.x.toFixed(3)} ${N.y.toFixed(3)} A ${n} ${n} 0 1 1 ${F.x.toFixed(3)} ${F.y.toFixed(3)} A ${n} ${n} 0 1 1 ${N.x.toFixed(3)} ${N.y.toFixed(3)} Z`;}else if(o>0){let N=Qe(a,s,n,w),F=Qe(a,s,n,h),R=Qe(a,s,o,h),E=Qe(a,s,o,w),A=h-w>180?1:0;k=`M ${N.x.toFixed(3)} ${N.y.toFixed(3)} A ${n} ${n} 0 ${A} 1 ${F.x.toFixed(3)} ${F.y.toFixed(3)} L ${R.x.toFixed(3)} ${R.y.toFixed(3)} A ${o} ${o} 0 ${A} 0 ${E.x.toFixed(3)} ${E.y.toFixed(3)} Z`;}else {let N=Qe(a,s,n,w),F=Qe(a,s,n,h),R=h-w>180?1:0;k=`M ${a.toFixed(3)} ${s.toFixed(3)} L ${N.x.toFixed(3)} ${N.y.toFixed(3)} A ${n} ${n} 0 ${R} 1 ${F.x.toFixed(3)} ${F.y.toFixed(3)} Z`;}x.push({id:g.id,label:g.label,value:g.value,percent:Math.round(g.value/c*1e3)/10,color:T.get(g.id)??"var(--color-chart-1)",startAngle:w,endAngle:h,midAngle:P,path:k,outerR:n,innerR:o,cx:a,cy:s}),m+=d;}return x}function bs(e,t){let r=(e-90)*Math.PI/180;return {dx:Math.cos(r)*t,dy:Math.sin(r)*t}}function Dn({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:mt({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:i("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:n.color}}),jsxRuntime.jsx("span",{children:n.label}),jsxRuntime.jsxs("span",{className:"text-secondary-400",children:["(",n.percent,"%)"]})]},n.id))})}function Ha({data:e,donut:t=false,donutThickness:r=.5,startAngle:n=-90,padAngle:o=0,labelType:a="percent",centerLabel:s,centerSubLabel:p,explodeOnHover:b=true,explodeOffset:u=8,title:c,height:T=300,className:x,legend:m=true,legendPosition:g="bottom",animateOnMount:d=true,emptyText:f="No data to display"}){let w=Nr.useRef(null),h=Nr.useRef(null),[P,k]=Nr.useState(400),[N,F]=Nr.useState(null),[R,E]=Nr.useState(null),[A,H]=Nr.useState({}),y=Nr.useRef(null);Nr.useEffect(()=>{let z=h.current;if(!z)return;let J=z.getBoundingClientRect().width;J>0&&k(J);let B=new ResizeObserver(q=>{let be=q[0]?.contentRect.width;be&&be>0&&k(be);});return B.observe(z),()=>B.disconnect()},[]),Nr.useEffect(()=>{function z(B){let q=y.current;if(!q)return;"touches"in B&&B.cancelable&&B.preventDefault();let be="touches"in B?B.touches[0]?.clientX??q.startX:B.clientX,De="touches"in B?B.touches[0]?.clientY??q.startY:B.clientY;H(He=>({...He,[q.id]:{dx:q.origDx+be-q.startX,dy:q.origDy+De-q.startY}}));}function J(){y.current=null;}return window.addEventListener("mousemove",z),window.addEventListener("mouseup",J),window.addEventListener("touchmove",z,{passive:false}),window.addEventListener("touchend",J),()=>{window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",J),window.removeEventListener("touchmove",z),window.removeEventListener("touchend",J);}},[]);let O=Nr.useMemo(()=>e.map(z=>z.id),[e]),{visible:v,toggle:ne,isVisible:C}=Rt(O),re=Nr.useMemo(()=>Mt(e.length),[e.length]),_=10,de=6.4,j=18,pe=14,Y=6,V=P,G=T,me=V/2,W=G/2,l=a!=="none"?j+Y+4:Y+4,D=Math.max(Math.min(me,W)-l,20),X=t?D*r:0,$=Nr.useMemo(()=>hs(e,v,re,D,X,me,W,n,o),[e,v,re,D,X,me,W,n,o]),se=Nr.useMemo(()=>$.map(z=>z.id).join(","),[$]);Nr.useEffect(()=>{H({});},[se]);let ue=Nr.useCallback((z,J)=>{if(y.current)return;let B=w.current?.getBoundingClientRect();if(!B)return;F(J);let q=$.find(be=>be.id===J);q&&E({x:z.clientX-B.left+12,y:z.clientY-B.top-10,items:[{label:q.label,value:Pe(q.value),percent:`${q.percent}%`,color:q.color}]});},[$]),Te=Nr.useCallback(()=>{F(null),E(null);},[]),S=Nr.useCallback((z,J,B)=>{let q=A[z]??{dx:0,dy:0};y.current={id:z,startX:J,startY:B,origDx:q.dx,origDy:q.dy};},[A]),ce=Nr.useCallback((z,J)=>{z.preventDefault(),F(J);let B=w.current?.getBoundingClientRect();if(!B)return;let q=z.touches[0];if(!q)return;let be=$.find(De=>De.id===J);be&&E({x:q.clientX-B.left+12,y:q.clientY-B.top-10,items:[{label:be.label,value:Pe(be.value),percent:`${be.percent}%`,color:be.color}]});},[$]),oe=Nr.useMemo(()=>{let z=e.reduce((J,B)=>J+B.value,0);return e.map((J,B)=>({id:J.id,label:J.label,color:J.color??re[B],visible:C(J.id),percent:z>0?Math.round(J.value/z*1e3)/10:0}))},[e,re,C]),he=e.length>0&&e.some(z=>z.value>0),fe=g==="left"||g==="right",Re=Nr.useMemo(()=>{if(a==="none")return [];let z=_+3,J=Y+_*.5,B=G-Y-_*.5,q=$.filter(K=>K.percent>=3).map(K=>{let xe="";switch(a){case "percent":xe=`${K.percent}%`;break;case "value":xe=Pe(K.value);break;case "label":xe=K.label;break;case "label+percent":xe=`${K.label} ${K.percent}%`;break}let L=Qe(K.cx,K.cy,K.outerR+2,K.midAngle),Z=Qe(K.cx,K.cy,K.outerR+j,K.midAngle),ee=(K.midAngle-90)*Math.PI/180,I=Math.cos(ee)>=0,ge=Math.ceil(xe.length*de);return {id:K.id,color:K.color,text:xe,textW:ge,p1:L,elbowX:Z.x,y:Z.y,isRight:I}}),be=q.filter(K=>K.isRight).sort((K,xe)=>K.y-xe.y),De=q.filter(K=>!K.isRight).sort((K,xe)=>K.y-xe.y);function He(K){if(K.length!==0)for(let xe=0;xe<20;xe++){let L=false;for(let ee=1;ee<K.length;ee++){let I=K[ee].y-K[ee-1].y;if(I<z){let ge=(z-I)/2;K[ee-1].y-=ge,K[ee].y+=ge,L=true;}}K[0].y<J&&(K[0].y=J);for(let ee=1;ee<K.length;ee++)K[ee].y<K[ee-1].y+z&&(K[ee].y=K[ee-1].y+z);let Z=K.length-1;K[Z].y>B&&(K[Z].y=B);for(let ee=Z-1;ee>=0;ee--)K[ee].y>K[ee+1].y-z&&(K[ee].y=K[ee+1].y-z);for(let ee of K)ee.y=Math.max(J,Math.min(B,ee.y));if(!L)break}}return He(be),He(De),[...De,...be]},[$,a,G]),ye=jsxRuntime.jsxs("svg",{role:"img","aria-label":c??"Pie chart",width:V,height:G,viewBox:`0 0 ${V} ${G}`,shapeRendering:"geometricPrecision",children:[jsxRuntime.jsxs("g",{className:d?"chart-pie-animate":"",children:[$.map((z,J)=>{let B=N===z.id,q=b&&B,be=bs(z.midAngle,q?u:0);return jsxRuntime.jsx("path",{d:z.path,fill:z.color,transform:q?`translate(${be.dx}, ${be.dy})`:void 0,className:i("chart-slice",d&&`chart-slice-animate-${Math.min(J,7)}`,B&&"chart-slice--exploded"),stroke:z.color,strokeWidth:.6,onMouseMove:De=>ue(De,z.id),onMouseLeave:Te,onTouchStart:De=>ce(De,z.id),onTouchEnd:Te,"aria-label":`${z.label}: ${z.percent}%`},z.id)}),Re.map(z=>{let J=A[z.id]??{dx:0,dy:0},B=z.elbowX+J.dx,q=z.y+J.dy,be=B+(z.isRight?pe:-pe),De=z.isRight?be+3:be-3,He=pe+3+z.textW+6,K=z.isRight?B:B-He,xe=q-_-2,L=_*2+4;return jsxRuntime.jsxs("g",{style:{userSelect:"none"},children:[jsxRuntime.jsx("polyline",{points:[`${z.p1.x.toFixed(2)},${z.p1.y.toFixed(2)}`,`${B.toFixed(2)},${q.toFixed(2)}`,`${be.toFixed(2)},${q.toFixed(2)}`].join(" "),fill:"none",stroke:z.color,strokeWidth:1.2,opacity:.85,strokeLinejoin:"round",strokeLinecap:"round",style:{pointerEvents:"none"}}),jsxRuntime.jsx("text",{x:De.toFixed(2),y:q.toFixed(2),textAnchor:z.isRight?"start":"end",dominantBaseline:"middle",fontSize:_,fill:"currentColor",className:"text-primary-700 dark:text-primary-300",style:{pointerEvents:"none"},children:z.text}),jsxRuntime.jsx("rect",{x:K,y:xe,width:He,height:L,fill:"transparent",style:{cursor:"grab",touchAction:"none"},onMouseDown:Z=>{Z.stopPropagation(),S(z.id,Z.clientX,Z.clientY);},onTouchStart:Z=>{Z.stopPropagation();let ee=Z.touches[0];ee&&S(z.id,ee.clientX,ee.clientY);}})]},`label-${z.id}`)})]}),t&&jsxRuntime.jsx("g",{style:{pointerEvents:"none"},children:N&&$.find(z=>z.id===N)?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("text",{x:me,y:W-8,textAnchor:"middle",dominantBaseline:"middle",fontSize:18,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:[$.find(z=>z.id===N)?.percent,"%"]}),jsxRuntime.jsx("text",{x:me,y:W+12,textAnchor:"middle",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:$.find(z=>z.id===N)?.label})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s&&jsxRuntime.jsx("text",{x:me,y:W-(p?8:0),textAnchor:"middle",dominantBaseline:"middle",fontSize:16,fontWeight:600,fill:"currentColor",className:"text-primary-800 dark:text-primary-100",children:s}),p&&jsxRuntime.jsx("text",{x:me,y:W+14,textAnchor:"middle",dominantBaseline:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:p})]})})]});return jsxRuntime.jsxs("div",{ref:w,className:i(dt(),x),children:[c&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:c}),m&&g==="top"&&jsxRuntime.jsx(Dn,{items:oe,position:"top",onToggle:ne}),jsxRuntime.jsxs("div",{className:i("flex items-start justify-center",fe&&"gap-0"),children:[m&&g==="left"&&jsxRuntime.jsx(Dn,{items:oe,position:"left",onToggle:ne}),jsxRuntime.jsx("div",{ref:h,className:"flex-1 min-w-0 overflow-hidden",children:he?ye:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:T},children:f})}),m&&g==="right"&&jsxRuntime.jsx(Dn,{items:oe,position:"right",onToggle:ne})]}),m&&g==="bottom"&&jsxRuntime.jsx(Dn,{items:oe,position:"bottom",onToggle:ne}),R&&jsxRuntime.jsx("div",{className:pt(),style:{left:R.x,top:R.y},role:"tooltip",children:R.items.map((z,J)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:z.color}}),jsxRuntime.jsxs("span",{className:"font-medium",children:[z.label,":"]}),jsxRuntime.jsx("span",{children:z.value}),jsxRuntime.jsxs("span",{className:"text-primary-300",children:["(",z.percent,")"]})]},J))})]})}function ys(e,t,r){let n=1/0,o=-1/0;for(let p of e)if(t.has(p.id))for(let b of p.data){let u=Number(b.x);u<n&&(n=u),u>o&&(o=u);}if(!isFinite(n))return [0,1];let[a,s]=St(n,o);return [r?.min??a,r?.max??s]}function vs(e,t,r){let n=1/0,o=-1/0;for(let p of e)if(t.has(p.id))for(let b of p.data)b.y<n&&(n=b.y),b.y>o&&(o=b.y);if(!isFinite(n))return [0,1];let[a,s]=St(n,o);return [r?.min??a,r?.max??s]}function Fa(e,t){let[r,n]=e,[o,a]=t;return n===r?()=>(o+a)/2:s=>o+(s-r)/(n-r)*(a-o)}function Aa(e,t=5){return pr(e[0],e[1],t)}function ws(e,t,r){let n=1.618033988749895,o=e*137+t,a=o*n%1*2-1,s=o*n*n%1*2-1;return [a*r,s*r]}function ks(e,t,r=12){if(e.length<2)return null;let n=Math.min(...e),o=Math.max(...e),a=Math.min(...t),s=Math.max(...t);return {cx:(n+o)/2,cy:(a+s)/2,rx:(o-n)/2+r,ry:(s-a)/2+r}}function In({items:e,position:t,onToggle:r}){return jsxRuntime.jsx("div",{className:mt({position:t}),children:e.map(n=>jsxRuntime.jsxs("button",{onClick:()=>r(n.id),className:i("flex items-center gap-1.5 cursor-pointer rounded px-1.5 py-1 text-xs text-primary-700 transition-opacity hover:bg-primary-100 dark:text-primary-300 dark:hover:bg-primary-800",!n.visible&&"opacity-40"),"aria-pressed":n.visible,children:[jsxRuntime.jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:n.color}}),n.label]},n.id))})}function za({series:e,xAxis:t,yAxis:r,dotRadius:n=5,dotOpacity:o=.75,clusters:a=false,jitter:s=false,jitterAmount:p=12,linkedLines:b=false,title:u,height:c=300,className:T,legend:x=true,legendPosition:m="bottom",animateOnMount:g=true,emptyText:d="No data to display"}){let f=Nr.useRef(null),w=Nr.useRef(null),[h,P]=Nr.useState(600),[k,N]=Nr.useState(null);Nr.useEffect(()=>{let l=w.current;if(!l)return;let D=l.getBoundingClientRect().width;D>0&&P(D);let X=new ResizeObserver($=>{let se=$[0]?.contentRect.width;se&&se>0&&P(se);});return X.observe(l),()=>X.disconnect()},[]);let F=Nr.useMemo(()=>e.map(l=>l.id),[e]),{visible:R,toggle:E,isVisible:A}=Rt(F),H=Nr.useMemo(()=>Mt(e.length),[e.length]),y=Nr.useMemo(()=>new Map(e.map((l,D)=>[l.id,l.color??H[D]])),[e,H]),O=Nr.useMemo(()=>Lt(!!t?.label,!!r?.label,false),[t?.label,r?.label]),v=Nr.useMemo(()=>Et(h,c,O),[h,c,O]),ne=Nr.useMemo(()=>ys(e,R,t),[e,R,t]),C=Nr.useMemo(()=>vs(e,R,r),[e,R,r]),re=Nr.useMemo(()=>Fa(ne,[v.plotLeft,v.plotRight]),[ne,v]),_=Nr.useMemo(()=>Fa(C,[v.plotBottom,v.plotTop]),[C,v]),de=Nr.useMemo(()=>Aa(ne,t?.tickCount??6),[ne,t?.tickCount]),j=Nr.useMemo(()=>Aa(C,r?.tickCount??5),[C,r?.tickCount]),pe=Nr.useCallback((l,D,X,$,se)=>{let ue=f.current?.getBoundingClientRect();ue&&N({x:l.clientX-ue.left+12,y:l.clientY-ue.top-10,seriesName:D,xVal:Pe(X,t?.format),yVal:Pe($,r?.format),color:se});},[t?.format,r?.format]),Y=Nr.useCallback((l,D,X,$,se)=>{l.preventDefault();let ue=f.current?.getBoundingClientRect();if(!ue)return;let Te=l.touches[0];Te&&N({x:Te.clientX-ue.left+12,y:Te.clientY-ue.top-10,seriesName:D,xVal:Pe(X,t?.format),yVal:Pe($,r?.format),color:se});},[t?.format,r?.format]),V=Nr.useMemo(()=>e.map((l,D)=>({id:l.id,label:l.name,color:l.color??H[D],visible:A(l.id)})),[e,H,A]),G=e.some(l=>l.data.length>0),me=m==="left"||m==="right",W=jsxRuntime.jsxs("svg",{role:"img","aria-label":u??"Scatter chart",width:v.width,height:v.height,viewBox:`0 0 ${v.width} ${v.height}`,shapeRendering:"geometricPrecision",children:[j.map(l=>jsxRuntime.jsx("line",{x1:v.plotLeft,x2:v.plotRight,y1:_(l),y2:_(l),stroke:"currentColor",strokeWidth:.5,strokeDasharray:"4 4",className:"text-secondary-200 dark:text-secondary-700"},l)),a&&e.map((l,D)=>{if(!A(l.id)||l.data.length<2)return null;let X=y.get(l.id)??"var(--color-chart-1)",$=l.data.map(Te=>re(Number(Te.x))),se=l.data.map(Te=>_(Te.y)),ue=ks($,se,16);return ue?jsxRuntime.jsx("ellipse",{cx:ue.cx,cy:ue.cy,rx:ue.rx,ry:ue.ry,fill:X,fillOpacity:.06,stroke:X,strokeOpacity:.3,strokeWidth:1.5,strokeDasharray:"5 3",className:g?"chart-cluster-ellipse":"",style:{animationDelay:`${D*.1}s`}},`cluster-${l.id}`):null}),b&&e.map(l=>{if(!A(l.id)||l.data.length<2)return null;let D=y.get(l.id)??"var(--color-chart-1)",$=[...l.data].sort((se,ue)=>Number(se.x)-Number(ue.x)).map(se=>`${re(Number(se.x)).toFixed(2)},${_(se.y).toFixed(2)}`).join(" ");return jsxRuntime.jsx("polyline",{points:$,fill:"none",stroke:D,strokeWidth:1.5,className:"chart-scatter-link"},`link-${l.id}`)}),e.map((l,D)=>{if(!A(l.id))return null;let X=y.get(l.id)??"var(--color-chart-1)";return jsxRuntime.jsx("g",{className:"chart-scatter-group",children:l.data.map(($,se)=>{let[ue,Te]=s?ws(D,se,p):[0,0],S=re(Number($.x))+ue,ce=_($.y)+Te;return jsxRuntime.jsx("circle",{cx:S,cy:ce,r:n,fill:X,fillOpacity:o,stroke:X,strokeWidth:1,strokeOpacity:.5,className:i("chart-scatter-dot",g&&"chart-scatter-dot--animate"),style:{color:X},onMouseMove:oe=>pe(oe,l.name,$.x,$.y,X),onMouseLeave:()=>N(null),onTouchStart:oe=>Y(oe,l.name,$.x,$.y,X),onTouchEnd:()=>N(null)},se)})},l.id)}),jsxRuntime.jsx("line",{x1:v.plotLeft,x2:v.plotLeft,y1:v.plotTop,y2:v.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("line",{x1:v.plotLeft,x2:v.plotRight,y1:v.plotBottom,y2:v.plotBottom,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),j.map(l=>{let D=_(l);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:v.plotLeft-4,x2:v.plotLeft,y1:D,y2:D,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:v.plotLeft-6,y:D,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(l,r?.format)})]},l)}),de.map(l=>{let D=re(l);return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:D,x2:D,y1:v.plotBottom,y2:v.plotBottom+4,stroke:"currentColor",strokeWidth:1,className:"text-secondary-300 dark:text-secondary-600"}),jsxRuntime.jsx("text",{x:D,y:v.plotBottom+14,textAnchor:"middle",fontSize:10,fill:"currentColor",className:"text-secondary-500 dark:text-secondary-400",children:Pe(l,t?.format)})]},l)}),r?.label&&jsxRuntime.jsx("text",{x:-(v.plotTop+v.plotHeight/2),y:14,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",transform:"rotate(-90)",children:r.label}),t?.label&&jsxRuntime.jsx("text",{x:v.plotLeft+v.plotWidth/2,y:v.height-4,textAnchor:"middle",fontSize:11,fill:"currentColor",className:"text-secondary-600 dark:text-secondary-400",children:t.label})]});return jsxRuntime.jsxs("div",{ref:f,className:i(dt(),T),children:[u&&jsxRuntime.jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:u}),x&&m==="top"&&jsxRuntime.jsx(In,{items:V,position:"top",onToggle:E}),jsxRuntime.jsxs("div",{className:i("flex items-start",me&&"gap-0"),children:[x&&m==="left"&&jsxRuntime.jsx(In,{items:V,position:"left",onToggle:E}),jsxRuntime.jsx("div",{ref:w,className:"flex-1 min-w-0 overflow-hidden",children:G?W:jsxRuntime.jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:c},children:d})}),x&&m==="right"&&jsxRuntime.jsx(In,{items:V,position:"right",onToggle:E})]}),x&&m==="bottom"&&jsxRuntime.jsx(In,{items:V,position:"bottom",onToggle:E}),k&&jsxRuntime.jsxs("div",{className:pt(),style:{left:k.x,top:k.y},role:"tooltip",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:k.color}}),jsxRuntime.jsx("span",{className:"font-medium",children:k.seriesName})]}),jsxRuntime.jsxs("div",{className:"text-primary-300",children:["X: ",jsxRuntime.jsx("span",{className:"font-medium text-primary-50",children:k.xVal})," ","Y: ",jsxRuntime.jsx("span",{className:"font-medium text-primary-50",children:k.yVal})]})]})]})}var Ep={LineChart:Pa,BarChart:Va,PieChart:Ha,ScatterChart:za},Ba=Ep;var Pp={Primitives:no,Layout:lo,DataDisplay:ko,Navigation:So,Disclosure:Vo,Overlay:Oo,Feedback:Qo,Extras:ba,Forms:ka,Chart:Ba},wx=Pp;exports.Accordion=Eo;exports.AccordionContent=Ac;exports.AccordionItem=Hc;exports.AccordionTrigger=Fc;exports.Alert=Yo;exports.AlertContent=hd;exports.AlertDescription=bd;exports.AlertIcon=gd;exports.AlertTitle=fd;exports.Badge=Gn;exports.BarChart=Va;exports.Button=Yt;exports.Card=oo;exports.CardContent=wl;exports.CardDescription=vl;exports.CardFooter=kl;exports.CardHeader=xl;exports.CardTitle=yl;exports.Chart=Ba;exports.Chat=bo;exports.Checkbox=eo;exports.CinePlayer=ia;exports.CodeBlock=wo;exports.DataDisplay=ko;exports.DataTable=Xl;exports.Dialog=Lr;exports.DialogClose=ed;exports.DialogContent=Fo;exports.DialogDescription=Bo;exports.DialogFooter=_o;exports.DialogHeader=Ao;exports.DialogTitle=zo;exports.Disclosure=Vo;exports.Dropdown=On;exports.DropdownButton=qt;exports.Extras=ba;exports.Feedback=Qo;exports.FileExplorer=pa;exports.FilmReel=ra;exports.Form=wa;exports.FormItem=wp;exports.FormSection=kp;exports.Forms=ka;exports.Header=Ro;exports.HorizontalCard=Nl;exports.ImageCard=ao;exports.ImageCardActions=Sl;exports.ImageCardBody=Tl;exports.ImageCardDescription=Ml;exports.ImageCardTitle=Rl;exports.Indicator=Un;exports.Input=Zn;exports.Label=qn;exports.Layout=lo;exports.LineChart=Pa;exports.List=fo;exports.ListItem=Gl;exports.Masonry=ha;exports.MiniPlayer=oa;exports.NavLink=Mo;exports.Navigation=So;exports.Overlay=Oo;exports.Panel=io;exports.PanelContent=El;exports.PanelHeader=Ll;exports.PieChart=Ha;exports.Primitives=no;exports.ProgressBar=qo;exports.Radio=ro;exports.RadioGroup=to;exports.ScatterChart=za;exports.SideNav=To;exports.SortableTable=Kl;exports.Spin=Jo;exports.Switch=Qn;exports.TabContent=Wc;exports.TabList=$c;exports.TabPanels=Kc;exports.TabTrigger=Oc;exports.Table=kr;exports.TableBody=po;exports.TableCell=Ht;exports.TableEmpty=uo;exports.TableHead=It;exports.TableHeader=mo;exports.TableRow=wr;exports.Tabs=Po;exports.TextBox=Jn;exports.Tooltip=$o;exports.Tree=go;exports.TreeItem=tc;exports.TypewriterText=Tn;exports.accordionContentVariants=on;exports.accordionTriggerVariants=nn;exports.accordionVariants=an;exports.alertVariants=Er;exports.badgeVariants=Ir;exports.buttonVariants=Xt;exports.cardVariants=br;exports.chartContainerVariants=dt;exports.chartLegendVariants=mt;exports.chartTooltipVariants=pt;exports.checkboxVariants=Ar;exports.cn=i;exports.codeBlockVariants=yr;exports.configureAlertTopOffset=wd;exports.default=wx;exports.dialogContentVariants=Sr;exports.indicatorVariants=Hr;exports.inputVariants=jt;exports.labelVariants=Fr;exports.listItemVariants=Ur;exports.listVariants=Gr;exports.navLinkVariants=tn;exports.panelVariants=jr;exports.progressBarVariants=pn;exports.radioVariants=zr;exports.spinVariants=rr;exports.switchTrackVariants=Br;exports.tabListVariants=sn;exports.tabTriggerVariants=ln;exports.tableVariants=Yr;exports.tooltipVariants=mn;exports.treeItemVariants=qr;exports.useAlert=Ld;exports.useSpin=Od;