@jacshuo/onyx 1.4.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Chart/BarChart.cjs +1 -0
- package/dist/Chart/BarChart.css +1 -0
- package/dist/Chart/BarChart.d.cts +2 -0
- package/dist/Chart/BarChart.d.ts +2 -0
- package/dist/Chart/BarChart.js +1 -0
- package/dist/Chart/LineChart.cjs +1 -0
- package/dist/Chart/LineChart.css +1 -0
- package/dist/Chart/LineChart.d.cts +2 -0
- package/dist/Chart/LineChart.d.ts +2 -0
- package/dist/Chart/LineChart.js +1 -0
- package/dist/Chart/PieChart.cjs +1 -0
- package/dist/Chart/PieChart.css +1 -0
- package/dist/Chart/PieChart.d.cts +2 -0
- package/dist/Chart/PieChart.d.ts +2 -0
- package/dist/Chart/PieChart.js +1 -0
- package/dist/Chart/ScatterChart.cjs +1 -0
- package/dist/Chart/ScatterChart.css +1 -0
- package/dist/Chart/ScatterChart.d.cts +2 -0
- package/dist/Chart/ScatterChart.d.ts +2 -0
- package/dist/Chart/ScatterChart.js +1 -0
- package/dist/Chart/index.cjs +1 -0
- package/dist/Chart/index.css +1 -0
- package/dist/Chart/index.d.cts +12 -0
- package/dist/Chart/index.d.ts +12 -0
- package/dist/Chart/index.js +1 -0
- package/dist/DataDisplay/index.d.cts +1 -1
- package/dist/DataDisplay/index.d.ts +1 -1
- package/dist/Disclosure/index.d.cts +1 -1
- package/dist/Disclosure/index.d.ts +1 -1
- package/dist/Extras/TypewriterText.cjs +1 -0
- package/dist/Extras/TypewriterText.css +1 -0
- package/dist/Extras/TypewriterText.d.cts +2 -0
- package/dist/Extras/TypewriterText.d.ts +2 -0
- package/dist/Extras/TypewriterText.js +1 -0
- package/dist/Extras/index.cjs +4 -4
- package/dist/Extras/index.css +1 -0
- package/dist/Extras/index.d.cts +3 -1
- package/dist/Extras/index.d.ts +3 -1
- package/dist/Extras/index.js +4 -4
- package/dist/Feedback/index.d.cts +1 -1
- package/dist/Feedback/index.d.ts +1 -1
- package/dist/Forms/index.d.cts +1 -1
- package/dist/Forms/index.d.ts +1 -1
- package/dist/Layout/index.d.cts +1 -1
- package/dist/Layout/index.d.ts +1 -1
- package/dist/Navigation/index.d.cts +1 -1
- package/dist/Navigation/index.d.ts +1 -1
- package/dist/Overlay/index.d.cts +1 -1
- package/dist/Overlay/index.d.ts +1 -1
- package/dist/Primitives/index.d.cts +1 -1
- package/dist/Primitives/index.d.ts +1 -1
- package/dist/_tsup-dts-rollup.d.cts +481 -11
- package/dist/_tsup-dts-rollup.d.ts +481 -11
- package/dist/index.cjs +5 -5
- package/dist/index.css +1 -0
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +5 -5
- package/dist/styles/Chart/BarChart.css +44 -0
- package/dist/styles/Chart/LineChart.css +72 -0
- package/dist/styles/Chart/PieChart.css +56 -0
- package/dist/styles/Chart/ScatterChart.css +45 -0
- package/dist/styles/Extras/TypewriterText.css +55 -0
- package/dist/styles/base.css +140 -0
- package/dist/styles/tokens/core.css +10 -0
- package/dist/styles.css +344 -0
- package/dist/theme.cjs +1 -1
- package/dist/theme.d.cts +3 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,Fragment,jsxs}from'react/jsx-runtime';import er,{createContext,useSyncExternalStore,useEffect,useState,useRef,useCallback,useMemo,useId,useContext,useLayoutEffect}from'react';import {Heart,ThumbsDown,Bookmark,Share2,Download,Info,CheckCircle,AlertTriangle,AlertCircle,ChevronDown,Check,Inbox,Plus,Trash2,Pencil,ArrowUpDown,ArrowUp,ArrowDown,ChevronRight,Menu,ChevronsLeft,X,PanelLeft,MoreHorizontal,ZoomIn,ZoomOut,ChevronLeft,Camera,Aperture,Calendar,MapPin,ListMusic,Shuffle,Repeat1,SkipBack,Pause,Play,SkipForward,VolumeX,Volume2,Disc3,ListVideo,Theater,Minimize,Maximize,HardDrive,LayoutGrid,LayoutList,Minus,Minimize2,Maximize2,FolderUp,Search,CornerRightDown,Folder,FileArchive,Database,FileSpreadsheet,FileText,Terminal,FileCode,Video,Music,Image,File,CircleX,TriangleAlert,CircleCheck}from'lucide-react';import {createPortal}from'react-dom';import {createRoot}from'react-dom/client';function n(...e){return twMerge(clsx(e))}var Nt=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"}}),pr=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"}}),mr=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"}}),Ct=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"}}),ur=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"}}),fr=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"}}),gr=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=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 Tt({intent:e,size:t,className:r,...a}){return jsx("button",{className:n(Nt({intent:e,size:t}),r),...a})}function rn(e,t){for(let r of e){if(r.value===t)return r;if(r.children){let a=rn(r.children,t);if(a)return a}}}function nn(e){let t=[];for(let r of e)r.children?.length||t.push(r),r.children&&t.push(...nn(r.children));return t}var vr=40,is=200,an=150,Ka=120;function hr(e,t,r,a){if(!a)return {};if(r){let o=(t-1-e)*vr;return {animation:`dropdown-item-out ${an}ms ease-in both ${o}ms`}}let s=e*vr;return {animation:`dropdown-item-in ${is}ms ease-out both ${s}ms`}}function $a(e,t,r){if(!r)return {};if(t){let a=Math.max(e-1,0)*vr+an;return {animation:`dropdown-container-out ${Ka}ms ease-in both ${a}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function ja({options:e,onSelect:t,animated:r=true,closing:a=false,depth:s=0}){let[o,i]=useState(null),d=useRef(void 0),y=l=>{d.current&&clearTimeout(d.current),i(l);},m=()=>{d.current=setTimeout(()=>i(null),150);};return useEffect(()=>()=>{d.current&&clearTimeout(d.current);},[]),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%"}:{},...$a(e.length,a,r)},role:"listbox",children:e.map((l,w)=>{let b=!!l.children?.length,p=o===l.value;return jsxs("div",{className:"relative",style:hr(w,e.length,a,r),onMouseEnter:()=>y(l.value),onMouseLeave:m,children:[jsxs("div",{role:"option","aria-selected":false,"aria-disabled":l.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",l.disabled&&"pointer-events-none opacity-50"),onClick:()=>{l.disabled||b||t(l.value,l);},children:[l.icon&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:l.icon}),jsx("span",{className:"flex-1 truncate",children:l.label??l.value}),b&&jsx(ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),b&&p&&jsx(ja,{options:l.children,onSelect:t,animated:r,depth:s+1})]},l.value)})})}function ls({options:e,filter:t,multiple:r,selected:a,canAdd:s,animated:o=true,closing:i=false,onSelect:d,onToggle:y,onAdd:m}){let l=useMemo(()=>nn(e),[e]),w=t.toLowerCase(),b=t?l.filter(c=>(c.label??c.value).toLowerCase().includes(w)||c.value.toLowerCase().includes(w)):l,p=b.length===0&&!s||s?1:0,v=b.length+p;return 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:$a(v,i,o),children:[b.map((c,u)=>{let k=r&&a.includes(c.value);return jsxs("div",{role:"option","aria-selected":r?k: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"),style:hr(u,v,i,o),onClick:()=>{c.disabled||(r?y(c.value):d(c.value,c));},children:[r&&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&&jsx(Check,{className:"h-3 w-3"})}),c.icon&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:c.icon}),jsx("span",{className:"truncate",children:c.label??c.value})]},c.value)}),b.length===0&&!s&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:hr(0,1,i,o),children:"No matches"}),s&&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:hr(b.length,v,i,o),onClick:m,children:[jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxs("span",{className:"truncate",children:["Add \u201C",t.trim(),"\u201D"]})]})]})}function on(e){let{options:t,placeholder:r="Select\u2026",editable:a=false,onAddItem:s,disabled:o=false,align:i="left",className:d,size:y="md",animated:m=true}=e,l=e.multiple===true,[w,b]=useState(l?void 0:e.defaultValue),[p,v]=useState(l?e.defaultSelected??[]:[]),c=l?e.selected??p:[],[u,k]=useState(false),[g,E]=useState(false),[C,R]=useState(""),$=useRef(null),N=useRef(null),M=useRef(void 0),I=useCallback(()=>{if(!m||!u){k(false),R("");return}E(true);let P=(Math.max(t.length,1)-1)*vr+an+Ka+20;M.current=setTimeout(()=>{k(false),E(false),R("");},P);},[m,u,t.length]);useEffect(()=>()=>{M.current&&clearTimeout(M.current);},[]);let V=l?void 0:e.value??w,x=useMemo(()=>V?rn(t,V):void 0,[t,V]);useEffect(()=>{if(!u)return;let _=P=>{$.current&&!$.current.contains(P.target)&&I();};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[u,I]),useEffect(()=>{if(!u)return;let _=P=>{P.key==="Escape"&&I();};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u,I]);let K=useCallback((_,P)=>{l||(e.value===void 0&&b(_),e.onChange?.(_,P)),M.current&&clearTimeout(M.current),k(false),E(false),R("");},[l,e]),U=useCallback(_=>{if(!l)return;let P=e.selected??p,X=P.includes(_)?P.filter(J=>J!==_):[...P,_];e.selected===void 0&&v(X),e.onSelectionChange?.(X);},[l,p,e]),ie=C.toLowerCase(),W=useMemo(()=>!a||!C.trim()?false:!nn(t).some(P=>P.value.toLowerCase()===ie||(P.label??P.value).toLowerCase()===ie),[a,ie,t]),me=useCallback(()=>{let _=C.trim();_&&(s?.(_),R(""));},[C,s]),G=useCallback(_=>{_.key==="Enter"&&W&&(_.preventDefault(),me());},[W,me]),Q=useCallback(()=>{o||(u?I():(M.current&&clearTimeout(M.current),E(false),k(true),R(""),a&&requestAnimationFrame(()=>N.current?.focus())));},[o,u,I,a]),F;if(l){let _=c.length;_===0?F="":_<=2?F=c.map(P=>rn(t,P)).map(P=>P?P.label??P.value:"").filter(Boolean).join(", "):F=`${_} selected`;}else F=x?x.label??x.value:"";let le=l||a;return jsxs("div",{ref:$,className:n("relative inline-block min-w-44",d),children:[jsxs("div",{className:n(Ct({state:"default",size:y}),"flex cursor-pointer items-center gap-1",o&&"pointer-events-none opacity-50"),onClick:Q,role:"combobox","aria-expanded":u,"aria-haspopup":"listbox",children:[a?jsx("input",{ref:N,className:"min-w-0 flex-1 bg-transparent outline-none placeholder:text-secondary-400 dark:placeholder:text-secondary-600",value:u?C:F,placeholder:r,disabled:o,onChange:_=>{R(_.target.value),u||k(true);},onKeyDown:G,onClick:_=>{_.stopPropagation(),u||k(true);}}):jsx("span",{className:n("flex-1 truncate",!F&&"text-secondary-400 dark:text-secondary-600"),children:F||r}),x?.icon&&!a&&!l&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:x.icon}),l&&c.length>0&&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:c.length}),jsx(ChevronDown,{className:n("text-primary-400 h-4 w-4 shrink-0 transition-transform",u&&"rotate-180")})]}),u&&jsx("div",{className:n(i==="right"?"right-0":"left-0","absolute w-full"),children:le?jsx(ls,{options:t,filter:C,multiple:l,selected:c,canAdd:W,animated:m,closing:g,onSelect:K,onToggle:U,onAdd:me}):jsx(ja,{options:t,onSelect:K,animated:m,closing:g})})]})}function ms(e,t){return e.key??(typeof e.label=="string"?e.label:String(t))}var wr=40,us=200,pn=150,Xa=120;function dn(e,t,r,a){if(!a)return {};if(r){let o=(t-1-e)*wr;return {animation:`dropdown-item-out ${pn}ms ease-in both ${o}ms`}}let s=e*wr;return {animation:`dropdown-item-in ${us}ms ease-out both ${s}ms`}}function fs(e,t,r){if(!r)return {};if(t){let a=Math.max(e-1,0)*wr+pn;return {animation:`dropdown-container-out ${Xa}ms ease-in both ${a}ms`}}return {animation:"var(--animate-dropdown-container-in)"}}function Pt({label:e,items:t,intent:r,size:a,align:s="left",className:o,disabled:i,editable:d=false,onAddItem:y,multiple:m=false,selected:l=[],onSelectionChange:w,animated:b=true,chevron:p=true,...v}){let[c,u]=useState(false),[k,g]=useState(false),[E,C]=useState(""),R=useRef(null),$=useRef(null),N=useRef(void 0);useEffect(()=>()=>{N.current&&clearTimeout(N.current);},[]);let M=useCallback(()=>{if(!b||!c){u(false),C("");return}g(true);let le=(Math.max(t.length,1)-1)*wr+pn+Xa+20;N.current=setTimeout(()=>{u(false),g(false),C("");},le);},[b,c,t.length]),I=useCallback(()=>{i||(c?M():(N.current&&clearTimeout(N.current),g(false),u(true),C(""),d&&requestAnimationFrame(()=>$.current?.focus())));},[i,c,M,d]);useEffect(()=>{if(!c)return;let F=le=>{R.current&&!R.current.contains(le.target)&&M();};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[c,M]),useEffect(()=>{if(!c)return;let F=le=>{le.key==="Escape"&&M();};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[c,M]);let V=E.toLowerCase(),x=useMemo(()=>E?t.filter(F=>(typeof F.label=="string"?F.label:F.key??"").toLowerCase().includes(V)):t,[t,V]),K=useMemo(()=>!d||!E.trim()?false:!t.some(F=>(typeof F.label=="string"?F.label:F.key??"").toLowerCase()===V),[d,V,t]),U=useCallback(()=>{let F=E.trim();F&&(y?.(F),C(""));},[E,y]),ie=useCallback(F=>{F.key==="Enter"&&K&&(F.preventDefault(),U());},[K,U]),W=useCallback(F=>{let le=l.includes(F)?l.filter(_=>_!==F):[...l,F];w?.(le);},[l,w]),me=m&&l.length>0?jsxs(Fragment,{children:[e," ",jsx("span",{className:"ml-1 rounded-full bg-white/20 px-1.5 text-xs font-semibold",children:l.length})]}):e,G=x.length===0&&!K||K?1:0,Q=x.length+G;return jsxs("div",{ref:R,className:"relative inline-block",children:[jsxs("button",{type:"button",onClick:I,disabled:i,className:n(Nt({intent:r,size:a}),"inline-flex items-center gap-1",o),"aria-haspopup":m?"listbox":"true","aria-expanded":c?"true":"false",...v,children:[me,p&&jsx(ChevronDown,{className:n("h-3.5 w-3.5 transition-transform",c&&"rotate-180")})]}),c&&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:fs(Q,k,b),role:m?"listbox":"menu","aria-multiselectable":m||void 0,children:[d&&jsx("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children:jsx("input",{ref:$,type:"text",value:E,onChange:F=>C(F.target.value),onKeyDown:ie,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"})}),jsxs("div",{className:"max-h-60 overflow-y-auto",children:[x.map((F,le)=>{let _=ms(F,le),P=m&&l.includes(_);return jsxs(er.Fragment,{children:[F.divider&&jsx("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),jsxs("button",{type:"button",role:m?"option":"menuitem","aria-selected":m?P: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:dn(le,Q,k,b),onClick:()=>{m?W(_):(F.onClick?.(),N.current&&clearTimeout(N.current),u(false),g(false),C(""));},children:[m&&jsx("span",{className:n("flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",P?"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:P&&jsx(Check,{className:"h-3 w-3"})}),jsx("span",{className:"flex-1 truncate",children:F.label})]})]},_)}),x.length===0&&!K&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:dn(0,1,k,b),children:"No matches"}),K&&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:dn(x.length,Q,k,b),onClick:U,children:[jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxs("span",{className:"truncate",children:["Add \u201C",E.trim(),"\u201D"]})]})]})]})]})}function mn({intent:e,size:t,className:r,...a}){return jsx("span",{className:n(pr({intent:e,size:t}),r),...a})}var xs={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:a,intent:s="danger",size:o="md",placement:i="top-right",pulse:d=false,className:y}){let m=a??r==null,l=m?null:typeof r=="number"?r>99?"99+":String(r):r;return jsxs("div",{className:"relative inline-flex",children:[e,t&&jsxs("span",{className:n(mr({intent:s,size:o,dot:m,placement:i}),y),role:typeof r=="number"?"status":void 0,"aria-label":typeof r=="number"?String(r):void 0,children:[d&&jsx("span",{className:n("absolute inset-0 rounded-full animate-ping opacity-60",xs[s??"danger"]),"aria-hidden":"true"}),l]})]})}function fn({intent:e,size:t,className:r,...a}){return jsx("label",{className:n(ur({intent:e,size:t}),r),...a})}var vs={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"}},ws={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 gn({state:e="default",inputSize:t="md",className:r,prefix:a,suffix:s,action:o,...i}){if(!a&&!s&&!o)return jsx("input",{className:n(Ct({state:e,size:t}),r),...i});let d=vs[t??"md"],y=ws[e??"default"];return jsxs("div",{className:n("flex w-full items-center overflow-hidden rounded-md border bg-white transition-colors dark:bg-secondary-900",d.wrapper,y,r),children:[a&&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",d.prefix),children:a}),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",d.input,a&&"pl-2"),...i}),s&&jsx("span",{className:n("pointer-events-none flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",d.icon),children:s}),o&&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",d.icon),children:o.icon})]})}var Rs={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]"},Ms={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 i=s.trim();i&&(a+=i.split(/\s+/).length),s="";};for(let i of e)r.test(i)?(o(),a+=1):s+=i;return o(),a}function bn({state:e="default",size:t="md",showWordCount:r=false,maxWords:a,className:s,value:o,defaultValue:i,onChange:d,disabled:y,...m}){let[l,w]=useState(()=>i??""),b=o!==void 0?String(o):l,p=useCallback(u=>{o===void 0&&w(u.target.value),d?.(u);},[o,d]),v=useMemo(()=>Ps(b),[b]),c=a!=null&&v>a;return jsxs("div",{className:n("inline-flex w-full flex-col",s),children:[jsx("textarea",{value:b,onChange:p,disabled:y,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",Rs[t],Ms[c?"error":e],y&&"pointer-events-none opacity-50"),...m}),(r||a!=null)&&jsx("span",{className:n("mt-1 self-end text-xs",c?"text-danger-500 dark:text-danger-400":"text-secondary-400 dark:text-secondary-500"),children:a!=null?`${v} / ${a} words`:`${v} words`})]})}var Ds={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"}},Is={primary:"text-primary-100",secondary:"text-secondary-100",danger:"text-danger-100",warning:"text-warning-100",success:"text-success-100"};function xn({checked:e,defaultChecked:t=false,onCheckedChange:r,checkedContent:a,uncheckedContent:s,intent:o,size:i,label:d,id:y,className:m,disabled:l,...w}){let b=useId(),p=y??b,v=i??"md",c=o??"primary",u=Ds[v],k=a!=null||s!=null,[g,E]=useState(t),C=e??g,R=useCallback($=>{let N=$.target.checked;e===void 0&&E(N),r?.(N);},[e,r]);return jsxs("label",{htmlFor:p,className:n("inline-flex cursor-pointer items-center gap-2",l&&"pointer-events-none opacity-50",m),children:[jsx("input",{...w,id:p,type:"checkbox",role:"switch",className:"sr-only",checked:C,disabled:l,onChange:R,"aria-checked":C}),jsxs("span",{className:n("relative inline-flex shrink-0 items-center rounded-full transition-colors duration-200",k?u.trackH:u.trackFixed,br({intent:o,size:i,checked:C?"on":"off"})),children:[k?jsxs(Fragment,{children:[jsxs("span",{className:n("pointer-events-none invisible inline-grid",u.icon),children:[jsx("span",{className:n("[grid-area:1/1] whitespace-nowrap",u.pad),children:a}),jsx("span",{className:n("[grid-area:1/1] whitespace-nowrap",u.pad),children:s})]}),jsx("span",{className:n("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",u.contentLeft,u.icon,Is[c],C?"opacity-100":"opacity-0"),children:a}),jsx("span",{className:n("absolute top-1/2 -translate-y-1/2 whitespace-nowrap font-medium leading-none transition-opacity duration-200",u.contentRight,u.icon,"text-primary-400 dark:text-primary-500",C?"opacity-0":"opacity-100"),children:s})]}):null,jsx("span",{className:n("pointer-events-none absolute rounded-full bg-white shadow-sm transition-[left] duration-200 ease-in-out",u.thumb,u.thumbTop,C?u.thumbOn:u.thumbOff)})]}),d&&jsx("span",{className:"select-none text-sm text-primary-700 dark:text-primary-300",children:d})]})}var zs={sm:"h-3 w-3",md:"h-3.5 w-3.5",lg:"h-4 w-4"};function yn({checked:e,defaultChecked:t=false,indeterminate:r=false,onCheckedChange:a,intent:s,size:o,label:i,id:d,className:y,disabled:m,...l}){let w=useId(),b=d??w,p=o??"md",[v,c]=useState(t),u=e??v,k=useCallback(E=>{let C=E.target.checked;e===void 0&&c(C),a?.(C);},[e,a]),g=u||r;return jsxs("label",{htmlFor:b,className:n("inline-flex cursor-pointer items-center gap-2 select-none",m&&"pointer-events-none opacity-50",y),children:[jsx("input",{...l,id:b,type:"checkbox",className:"sr-only",checked:u,disabled:m,onChange:k}),jsx("span",{className:n(fr({intent:s,size:o,checked:g?"on":"off"})),children:jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:n("text-white transition-all duration-200",zs[p],g?"scale-100 opacity-100":"scale-0 opacity-0"),children:r?jsx("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}):jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),i&&jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:i})]})}var Za=createContext(null);function hn({name:e,value:t,defaultValue:r,onValueChange:a,intent:s,size:o,disabled:i,orientation:d="vertical",className:y,children:m}){let l=useId(),w=e??l,[b,p]=useState(r),v=t??b,c=useCallback(u=>{t===void 0&&p(u),a?.(u);},[t,a]);return jsx(Za.Provider,{value:{name:w,value:v,onChange:c,intent:s,size:o,disabled:i},children:jsx("div",{role:"radiogroup",className:n("flex gap-2",d==="vertical"?"flex-col":"flex-row flex-wrap",y),children:m})})}var js={sm:"h-1.5 w-1.5",md:"h-2 w-2",lg:"h-2.5 w-2.5"};function vn({value:e,intent:t,size:r,label:a,id:s,className:o,disabled:i,...d}){let y=useId(),m=s??y,l=useContext(Za),w=t??l?.intent,b=r??l?.size,p=b??"md",v=i??l?.disabled,c=d.name??l?.name,u=l?l.value===e:void 0,k=useCallback(g=>{g.target.checked&&l?.onChange(e);},[l,e]);return jsxs("label",{htmlFor:m,className:n("inline-flex cursor-pointer items-center gap-2 select-none",v&&"pointer-events-none opacity-50",o),children:[jsx("input",{...d,id:m,type:"radio",name:c,value:e,className:"sr-only",checked:u,disabled:v,onChange:k}),jsx("span",{className:n(gr({intent:w,size:b,checked:u?"on":"off"})),children:jsx("span",{className:n("rounded-full bg-white transition-all duration-200",js[p],u?"scale-100 opacity-100":"scale-0 opacity-0")})}),a&&jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:a})]})}var Xs={Button:Tt,Dropdown:on,DropdownButton:Pt,Badge:mn,Indicator:un,Label:fn,Input:gn,TextBox:bn,Switch:xn,Checkbox:yn,Radio:vn,RadioGroup:hn},wn=Xs;var Ut=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"}}),Nr=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 kn({intent:e,size:t,className:r,...a}){return jsx("div",{className:n(Ut({intent:e,size:t}),r),...a})}function Ws({className:e,...t}){return jsx("div",{className:n("mb-4 space-y-1",e),...t})}function Us({className:e,...t}){return jsx("h3",{className:n("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function qs({className:e,...t}){return jsx("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Ys({className:e,...t}){return jsx("div",{className:n("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function Zs({className:e,...t}){return 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 Qs({intent:e,media:t,mediaPosition:r="left",stackOnMobile:a=false,className:s,children:o,...i}){let d=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?jsx("img",{src:t.src,alt:t.alt??"",className:"h-full w-full object-cover",draggable:false}):t.icon?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 jsxs("div",{className:n(Ut({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),...i,children:[d,jsx("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:o})]})}function Nn({src:e,alt:t="",aspectRatio:r="16/9",className:a,children:s,...o}){return 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:[jsxs("div",{className:"relative overflow-hidden",style:{aspectRatio:r},children:[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}),jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100","aria-hidden":true,children:jsx("div",{className:"animate-light-sweep absolute inset-0"})})]}),s]})}function ei({className:e,...t}){return jsx("div",{className:n("space-y-2 p-4",e),...t})}function ti({className:e,...t}){return jsx("h3",{className:n("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function ri({className:e,...t}){return jsx("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function ni({className:e,...t}){return 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 Cn({intent:e,size:t,className:r,...a}){return jsx("div",{className:n(Nr({intent:e,size:t}),r),...a})}function ai({className:e,...t}){return 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 oi({className:e,...t}){return jsx("div",{className:n("text-primary-700 dark:text-primary-300 text-sm",e),...t})}var si={Card:kn,ImageCard:Nn,Panel:Cn},Rn=si;var Cr=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"}}),Tr=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"}}),Rr=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"}}),Mr=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"}}),Yt=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 Jt({intent:e,density:t,className:r,...a}){return jsx("div",{className:"w-full overflow-auto",children:jsx("table",{className:n(Cr({intent:e,density:t}),r),...a})})}function Pn({className:e,...t}){return jsx("thead",{className:n("bg-primary-50 text-primary-600 dark:bg-primary-800/50 dark:text-primary-400",e),...t})}function Ln({className:e,...t}){return jsx("tbody",{className:n("[&_tr:last-child]:border-0",e),...t})}function Qt({className:e,...t}){return 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 ct({className:e,...t}){return jsx("th",{className:n("px-4 py-3 text-left text-xs font-semibold tracking-wider uppercase",e),...t})}function dt({className:e,...t}){return jsx("td",{className:n("text-primary-700 dark:text-primary-300 px-4 py-3",e),...t})}function En({icon:e,text:t="No data",className:r}){return 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??jsx(Inbox,{className:"h-12 w-12 stroke-[1.2]"}),jsx("span",{className:"text-sm",children:t})]})}var eo={sm:"hidden sm:table-cell",md:"hidden md:table-cell",lg:"hidden lg:table-cell"};function yi({columns:e,data:t,sort:r,onSortChange:a,defaultSort:s=null,rowKey:o,rowActions:i,intent:d,density:y,className:m,empty:l}){let[w,b]=useState(s),p=r??w,v=useCallback(u=>{let k=p?.column===u?p.direction==="asc"?{column:u,direction:"desc"}:null:{column:u,direction:"asc"};a?a(k):b(k);},[p,a]),c=useMemo(()=>{if(!p)return t;let u=e.find(E=>E.key===p.column);if(!u)return t;let k=u.compareFn??((E,C)=>{let R=u.cell(E),$=u.cell(C);return R==null&&$==null?0:R==null?-1:$==null?1:typeof R=="number"&&typeof $=="number"?R-$:String(R).localeCompare(String($))}),g=[...t].sort(k);return p.direction==="desc"?g.reverse():g},[t,p,e]);return jsxs(Jt,{intent:d,density:y,className:m,children:[jsx(Pn,{children:jsxs(Qt,{children:[e.map(u=>{let k=u.sortable!==false,g=p?.column===u.key;return jsx(ct,{className:n(k&&"cursor-pointer select-none",u.headerClassName,u.hideBelow&&eo[u.hideBelow]),onClick:k?()=>v(u.key):void 0,"aria-sort":g?p.direction==="asc"?"ascending":"descending":void 0,children:jsxs("span",{className:"inline-flex items-center gap-1",children:[u.header,k&&jsx(to,{active:g,direction:g?p.direction:null})]})},u.key)}),i&&jsx(ct,{className:"w-20 text-right",children:"Actions"})]})}),jsx(Ln,{children:c.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(i?1:0),children:jsx(En,{...l})})}):c.map((u,k)=>jsxs(Qt,{children:[e.map(g=>jsx(dt,{className:n(g.cellClassName,g.hideBelow&&eo[g.hideBelow]),children:g.cell(u)},g.key)),i&&jsx(dt,{className:"text-right",children:jsx("span",{className:"inline-flex items-center gap-1",children:i(u)})})]},o?o(u,k):k))})]})}function hi({value:e,onCommit:t,onCancel:r}){let[a,s]=useState(e),o=useRef(null);useEffect(()=>{o.current?.focus(),o.current?.select();},[]);let i=()=>t(a);return jsxs("span",{className:"flex items-center gap-1",children:[jsx("input",{ref:o,type:"text",value:a,onChange:d=>s(d.target.value),onKeyDown:d=>{d.key==="Enter"&&i(),d.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"}),jsx("button",{type:"button",onClick:i,className:"text-success-600 hover:text-success-700 dark:text-success-400","aria-label":"Confirm",children:jsx(Check,{className:"h-3.5 w-3.5"})}),jsx("button",{type:"button",onClick:r,className:"text-danger-500 hover:text-danger-600 dark:text-danger-400","aria-label":"Cancel",children:jsx(X,{className:"h-3.5 w-3.5"})})]})}function vi({columns:e,data:t,rowKey:r,sort:a,onSortChange:s,defaultSort:o=null,selectionMode:i="none",selected:d,onSelectionChange:y,editable:m=false,onCellEdit:l,toolbar:w=false,onAdd:b,onDelete:p,rowActions:v,intent:c,density:u,className:k,empty:g}){let[E,C]=useState(o),R=a??E,$=useCallback(P=>{let X=R?.column===P?R.direction==="asc"?{column:P,direction:"desc"}:null:{column:P,direction:"asc"};s?s(X):C(X);},[R,s]),N=useMemo(()=>{if(!R)return t;let P=e.find(O=>O.key===R.column);if(!P)return t;let X=P.compareFn??((O,L)=>{let te=P.cell(O),ee=P.cell(L);return te==null&&ee==null?0:te==null?-1:ee==null?1:typeof te=="number"&&typeof ee=="number"?te-ee:String(te).localeCompare(String(ee))}),J=[...t].sort(X);return R.direction==="desc"?J.reverse():J},[t,R,e]),[M,I]=useState([]),V=d??M,x=y??I,K=useMemo(()=>N.map((P,X)=>r(P,X)),[N,r]),U=i==="multiple"&&K.length>0&&K.every(P=>V.includes(P)),ie=i==="multiple"&&V.length>0&&!U,W=useCallback(P=>{i==="single"?x(V.includes(P)?[]:[P]):i==="multiple"&&x(V.includes(P)?V.filter(X=>X!==P):[...V,P]);},[i,V,x]),me=useCallback(()=>{x(U?[]:K);},[U,K,x]),[G,Q]=useState(null),F=useCallback((P,X,J)=>{m&&J!==false&&Q({rowKey:P,colKey:X});},[m]),le=useCallback((P,X,J)=>{l?.(P,X,J),Q(null);},[l]);return jsxs("div",{className:"space-y-2",children:[w&&jsxs("div",{className:"flex items-center gap-2",children:[b&&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:[jsx(Plus,{className:"h-3.5 w-3.5"})," Add"]}),p&&jsxs("button",{type:"button",onClick:()=>p(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:[jsx(Trash2,{className:"h-3.5 w-3.5"})," Delete",V.length>0&&` (${V.length})`]}),m&&V.length===1&&jsxs("button",{type:"button",onClick:()=>{let P=e.find(X=>X.editable!==false);P&&Q({rowKey:V[0],colKey:P.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:[jsx(Pencil,{className:"h-3.5 w-3.5"})," Edit"]}),V.length>0&&jsxs("span",{className:"ml-auto text-sm text-secondary-500 dark:text-secondary-400",children:[V.length," row",V.length>1?"s":""," selected"]})]}),jsxs(Jt,{intent:c,density:u,className:k,children:[jsx(Pn,{children:jsxs(Qt,{children:[i==="multiple"&&jsx(ct,{className:"w-10",children:jsx("input",{type:"checkbox",checked:U,ref:P=>{P&&(P.indeterminate=ie);},onChange:me,className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select all"})}),i==="single"&&jsx(ct,{className:"w-10"}),e.map(P=>{let X=P.sortable!==false,J=R?.column===P.key;return jsx(ct,{className:n(X&&"cursor-pointer select-none",P.headerClassName),onClick:X?()=>$(P.key):void 0,"aria-sort":J?R.direction==="asc"?"ascending":"descending":void 0,children:jsxs("span",{className:"inline-flex items-center gap-1",children:[P.header,X&&jsx(to,{active:J,direction:J?R.direction:null})]})},P.key)}),v&&jsx(ct,{className:"w-20 text-right",children:"Actions"})]})}),jsx(Ln,{children:N.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(i!=="none"?1:0)+(v?1:0),children:jsx(En,{...g})})}):N.map((P,X)=>{let J=r(P,X),O=V.includes(J);return jsxs(Qt,{className:n(O&&"bg-primary-50/60 dark:bg-primary-900/20"),onClick:()=>{i!=="none"&&W(J);},children:[i==="multiple"&&jsx(dt,{className:"w-10",children:jsx("input",{type:"checkbox",checked:O,onChange:()=>W(J),onClick:L=>L.stopPropagation(),className:"h-4 w-4 cursor-pointer rounded border-secondary-300 accent-primary-600","aria-label":"Select row"})}),i==="single"&&jsx(dt,{className:"w-10",children:jsx("input",{type:"radio",checked:O,onChange:()=>W(J),onClick:L=>L.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-primary-600","aria-label":"Select row"})}),e.map(L=>{let te=G?.rowKey===J&&G?.colKey===L.key,ee=L.editValue?.(P)??(()=>{let re=L.cell(P);return typeof re=="string"||typeof re=="number"?String(re):""})();return jsx(dt,{className:n(L.cellClassName,m&&L.editable!==false&&"cursor-text"),onDoubleClick:re=>{re.stopPropagation(),F(J,L.key,L.editable);},children:te?jsx(hi,{value:ee,onCommit:re=>le(J,L.key,re),onCancel:()=>Q(null)}):L.cell(P)},L.key)}),v&&jsx(dt,{className:"text-right",onClick:L=>L.stopPropagation(),children:jsx("span",{className:"inline-flex items-center gap-1",children:v(P)})})]},J)})})]})]})}function to({active:e,direction:t}){let r="h-3.5 w-3.5 shrink-0";return !e||!t?jsx(ArrowUpDown,{className:n(r,"opacity-30")}):t==="asc"?jsx(ArrowUp,{className:n(r,"opacity-70")}):jsx(ArrowDown,{className:n(r,"opacity-70")})}var ro=createContext({size:"md"});function Sn({intent:e,size:t="md",className:r,...a}){return jsx(ro.Provider,{value:{size:t},children:jsx("ul",{className:n(Tr({intent:e}),r),...a})})}function Ni({actions:e,className:t,children:r,...a}){let{size:s}=useContext(ro);return jsxs("li",{className:n(Rr({size:s}),t),...a,children:[jsx("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:r}),e&&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 oo=createContext({showLines:true,expandedKeys:null,onToggleKey:()=>{},size:"md"});function Vn({showLines:e=true,showRoot:t=true,expandedKeys:r,defaultExpandedKeys:a="all",onExpandedKeysChange:s,size:o="md",className:i,children:d,...y}){let [m,l]=useState(()=>a),b=useCallback(v=>{if(r){let c=new Set(r);c.has(v)?c.delete(v):c.add(v),s?.(c);}else l(c=>{if(c==="all")return new Set(["__ALL_MINUS__",v]);let u=new Set(c);return u.has(v)?u.delete(v):u.add(v),u});},[r,s]),p=r??(m==="all"?null:m);return jsx(oo.Provider,{value:{showLines:e,expandedKeys:p,onToggleKey:b,size:o},children:t?jsx("ul",{className:n("text-sm",i),role:"tree",...y,children:d}):jsx("ul",{className:n("text-sm",i),role:"tree",...y,children:jsx(Li,{children:d})})})}function Li({children:e}){let t=so(e);return jsx(Fragment,{children:t.map(r=>er.isValidElement(r)&&r.props.children?r.props.children:null)})}function so(e){let t=[];return er.Children.forEach(e,r=>{er.isValidElement(r)&&r.type===er.Fragment?t.push(...so(r.props.children)):t.push(r);}),t}function Ei({nodeKey:e,label:t,icon:r,actions:a,defaultExpanded:s=false,expanded:o,onToggle:i,children:d,className:y}){let{showLines:m,expandedKeys:l,onToggleKey:w,size:b}=useContext(oo),[p,v]=useState(s),c=er.Children.count(d)>0,u=e??(typeof t=="string"?t:""),k;o!=null?k=o:l!=null&&u?l.has("__ALL_MINUS__")?k=!l.has(u):k=l.has(u):k=p;let g=()=>{let E=!k;i?i(E):l!=null&&u?w(u):v(E);};return jsxs("li",{className:n("select-none",y),role:"treeitem","aria-expanded":c?k:void 0,children:[jsxs("div",{className:n("group hover:bg-primary-50 dark:hover:bg-primary-800/50 rounded-md px-1",Mr({size:b}),c?"cursor-pointer":"cursor-default"),onClick:c?g:void 0,children:[c?jsx(ChevronRight,{className:n("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",k&&"rotate-90")}):jsx("span",{className:"w-4 shrink-0"}),r&&jsx("span",{className:"shrink-0",children:r}),jsx("span",{className:"text-primary-700 dark:text-primary-300 min-w-0 flex-1 truncate",children:t}),a&&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:E=>E.stopPropagation(),children:a})]}),c&&jsx("div",{className:n("grid transition-[grid-template-rows] duration-200 ease-out",k?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children:jsx("ul",{className:n("ml-4 pl-2",m&&"border-primary-200 dark:border-primary-700 border-l"),role:"group",children:d})})})]})}function Ii({avatar:e,sender:t}){return e?typeof e=="string"?/^(?:https?|data|blob):/.test(e)?jsx("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:false}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function Ai({msg:e,alignRight:t}){return jsxs("div",{className:n("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsx(Ii,{avatar:e.avatar,sender:e.sender}),jsxs("div",{className:n("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[jsx("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),jsx("div",{className: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&&jsx("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function In({messages:e,mode:t="split",autoScroll:r=true,className:a,...s}){let o=useRef(null);return useEffect(()=>{r&&o.current?.scrollIntoView({behavior:"smooth"});},[e,r]),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(i=>{let d=t==="split"&&!!i.self;return jsx(Ai,{msg:i,alignRight:d},i.id)}),jsx("div",{ref:o})]})}var _i={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)"}}]},zi={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')},Fn=null,io=new Set;function Oi(){return Fn||(Fn=Promise.all([import('shiki/core'),import('shiki/engine/javascript')]).then(([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>e({themes:[_i],langs:[],engine:t()}))),Fn}async function Bi(e,t,r){let a=await Oi();if(t&&!io.has(t)){let o=zi[t];if(o)try{let i=await o();await a.loadLanguage(i.default??i),io.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 _n({code:e,language:t="text",lineNumbers:r=false,editable:a=false,onCodeChange:s,size:o,className:i,...d}){let[y,m]=useState(""),l=useRef(null),w=useRef(null),b=useRef(null);useEffect(()=>{let C=false;return Bi(e,t,a?false:r).then(R=>{C||m(R);}),()=>{C=true;}},[e,t,r,a]);let p=useCallback(()=>{let C=w.current,R=b.current?.querySelector("pre"),$=l.current?.querySelector("[data-gutter]");C&&R&&(R.scrollTop=C.scrollTop,R.scrollLeft=C.scrollLeft),C&&$&&($.scrollTop=C.scrollTop);},[]),v=useCallback(C=>{s?.(C.target.value);},[s]),c=useCallback(C=>{if(C.key==="Tab"){C.preventDefault();let R=C.currentTarget,$=R.selectionStart,N=R.selectionEnd,M=R.value.substring(0,$)+" "+R.value.substring(N);s?.(M),requestAnimationFrame(()=>{R.selectionStart=R.selectionEnd=$+2;});}},[s]),u=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,E=e.split(`
|
|
2
|
-
`).length;return a?jsxs("div",{ref:l,className:n(Yt({size:o}),"flex border border-primary-200 dark:border-primary-700",i),style:{background:"var(--color-syntax-bg)"},...d,children:[r&&jsx("div",{"data-gutter":true,"aria-hidden":true,className:"shrink-0 select-none overflow-hidden py-4 pl-3 pr-1 text-right text-secondary-400",style:{fontFamily:k,lineHeight:g,width:"3rem"},children:Array.from({length:E},(C,R)=>jsx("div",{children:R+1},R))}),jsxs("div",{className:"relative min-w-0 flex-1",children:[jsx("textarea",{ref:w,value:e,onChange:v,onScroll:p,onKeyDown:c,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"}}),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:y?{__html:y}:void 0})]})]}):jsx("div",{ref:l,className:n(Yt({size:o}),"border border-primary-200 dark:border-primary-700",u,i),style:{background:"var(--color-syntax-bg)"},...d,children:jsx("div",{ref:b,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:y?{__html:y}:void 0,children:y?void 0:jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children:jsx("code",{children:e})})})})}var Ki={Table:Jt,List:Sn,Tree:Vn,Chat:In,CodeBlock:_n},zn=Ki;var ut="flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors cursor-pointer",po="bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100 font-medium",Vt="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",Dt="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 Yi({to:e,className:t,style:r,children:a}){let s=typeof t=="function"?t({isActive:false}):t;return jsx("a",{href:e,className:s,style:r,children:a})}var On=["expanded","icons","mini"];function Zi(e){let t=On.indexOf(e);return On[(t+1)%On.length]}function mo(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 mo(r.children))t.add(a);}return t}function uo({item:e,basePath:t,depth:r,onItemClick:a,LinkComponent:s,showLines:o,expandedKeys:i,onToggle:d}){let y=e.key??e.label,m=e.children&&e.children.length>0,[l,w]=useState(e.defaultOpen??true),b=i?i.has(y):l,p=useCallback(()=>{i?d(y):w(c=>!c);},[i,d,y]),v=r>0?`${r*1.25}rem`:void 0;if(m)return jsxs("div",{children:[jsxs("button",{type:"button",onClick:p,className:n(ut,Vt,"justify-between"),style:{paddingLeft:v},children:[jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),jsx(ChevronRight,{className:n("h-3.5 w-3.5 transition-transform",b&&"rotate-90")})]}),b&&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(c=>jsx(uo,{item:c,basePath:t,depth:r+1,onItemClick:a,LinkComponent:s,showLines:o,expandedKeys:i,onToggle:d},c.key??c.path??c.label))})]});if(e.path!=null){let c=t+e.path;return a?jsxs("button",{type:"button",onClick:()=>a(e,c),className:n(ut,Vt),style:{paddingLeft:v},children:[e.icon,e.label]}):jsxs(s,{to:c,className:({isActive:u})=>n(ut,u?po:Vt),style:{paddingLeft:v},children:[e.icon,e.label]})}return jsxs("span",{className:n(ut,Vt,"cursor-default"),style:{paddingLeft:v},children:[e.icon,e.label]})}function Qi({item:e,basePath:t,onItemClick:r,LinkComponent:a}){let[s,o]=useState(false),i=useRef(null),d=useRef(void 0),[y,m]=useState({top:0,left:0}),l=()=>{clearTimeout(d.current),o(true);},w=()=>{d.current=setTimeout(()=>o(false),200);};useLayoutEffect(()=>{if(s&&i.current){let p=i.current.getBoundingClientRect();m({top:p.top,left:p.right+4});}},[s]);let b=e.icon||jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return jsxs("div",{onMouseEnter:l,onMouseLeave:w,children:[jsx("button",{ref:i,type:"button",className:n(Dt,"w-full"),title:e.label,onClick:()=>o(p=>!p),children:b}),s&&createPortal(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:y.top,left:y.left},onMouseEnter:l,onMouseLeave:w,children:[jsx("div",{className:"px-2.5 py-1.5 text-xs font-semibold uppercase text-primary-500 dark:text-primary-400",children:e.label}),jsx("div",{className:"flex flex-col gap-0.5",children:e.children?.map(p=>{let v=p.key??p.path??p.label;if(p.path!=null){let c=t+p.path;return r?jsxs("button",{type:"button",onClick:()=>{r(p,c),o(false);},className:n(ut,Vt),children:[p.icon,p.label]},v):jsxs(a,{to:c,className:({isActive:u})=>n(ut,u?po:Vt),children:[p.icon,p.label]},v)}return jsxs("span",{className:n(ut,"cursor-default text-primary-400"),children:[p.icon,p.label]},v)})})]}),document.body)]})}function Ji({item:e,basePath:t,onItemClick:r,LinkComponent:a}){let s=e.icon||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?jsx("button",{type:"button",onClick:()=>r(e,o),className:n(Dt,"w-full"),title:e.label,children:s}):jsx(a,{to:o,className:({isActive:i})=>n(Dt,"w-full",i&&"bg-primary-200 dark:bg-primary-700/50 text-primary-900 dark:text-primary-100"),children:jsx("span",{title:e.label,children:s})})}return jsx("span",{className:n(Dt,"w-full cursor-default"),title:e.label,children:s})}function Kn({items:e,title:t,basePath:r="/",onItemClick:a,LinkComponent:s=Yi,collapsible:o,collapseMode:i,defaultCollapseMode:d="expanded",onCollapseModeChange:y,showLines:m=true,expandedKeys:l,defaultExpandedKeys:w="all",onExpandedKeysChange:b,className:p,responsive:v=true,mobileBreakpoint:c=768,mobileTopOffset:u=48,...k}){let[g,E]=useState(d),C=i??g,R=er.useMemo(()=>mo(e),[e]),[$,N]=useState(()=>w==="all"?new Set(R):new Set(w)),M=l??null,I=M??$,V=useCallback(O=>{let L=new Set(I);L.has(O)?L.delete(O):L.add(O),N(L),b?.(L);},[I,b]),x=useCallback(()=>{let O=Zi(C);E(O),y?.(O);},[C,y]),[K,U]=useState(()=>v&&typeof window<"u"&&window.innerWidth<c),[ie,W]=useState(false);useEffect(()=>{if(!v||typeof window>"u"||!window.matchMedia)return;let O=window.matchMedia(`(max-width: ${c-1}px)`),L=te=>{U(te.matches),te.matches||W(false);};return O.addEventListener("change",L),()=>O.removeEventListener("change",L)},[v,c]);let me=useCallback(O=>{O.target.closest("a")&&W(false);},[]),G=useRef(null),Q=useRef({startX:0,startY:0,dragging:false}),le=useCallback(O=>{let L=O.touches[0];Q.current={startX:L.clientX,startY:L.clientY,dragging:true};},[]),_=useCallback(O=>{if(!Q.current.dragging||!G.current)return;let L=O.touches[0],te=L.clientX-Q.current.startX,ee=L.clientY-Q.current.startY;te>=0||Math.abs(ee)>Math.abs(te)||(G.current.style.transform=`translateX(${Math.max(te,-224)}px)`,G.current.style.transition="none");},[]),P=useCallback(O=>{if(!Q.current.dragging||!G.current)return;Q.current.dragging=false;let L=O.changedTouches[0],te=L.clientX-Q.current.startX,ee=L.clientY-Q.current.startY;G.current.style.transition="",G.current.style.transform="",te<-60&&Math.abs(te)>Math.abs(ee)&&W(false);},[]),X$1=useMemo(()=>!K||!a?a:(O,L)=>{W(false),a(O,L);},[K,a]),J=jsxs(Fragment,{children:[o&&!K&&jsx("div",{className:n("flex shrink-0 mb-1",C==="expanded"?"justify-end":"justify-center"),children:jsx("button",{type:"button",onClick:x,className:Dt,"aria-label":C==="mini"?"Expand sidebar":"Collapse sidebar",title:C==="mini"?"Expand sidebar":"Collapse sidebar",children:C==="mini"?jsx(Menu,{className:"h-5 w-5"}):jsx(ChevronsLeft,{className:"h-4 w-4"})})}),(K||C==="expanded")&&jsxs(Fragment,{children:[t&&jsx("h2",{className:"text-primary-500 dark:text-primary-400 mb-3 text-sm font-semibold uppercase",children:t}),e.map(O=>jsx(uo,{item:O,basePath:r,depth:0,onItemClick:X$1,LinkComponent:s,showLines:m,expandedKeys:M,onToggle:V},O.key??O.path??O.label))]}),!K&&C==="icons"&&e.map(O=>{let L=O.key??O.path??O.label;return O.children&&O.children.length>0?jsx(Qi,{item:O,basePath:r,onItemClick:X$1,LinkComponent:s},L):jsx(Ji,{item:O,basePath:r,onItemClick:X$1,LinkComponent:s},L)})]});return v&&K?jsxs(Fragment,{children:[ie&&createPortal(jsx("div",{className:"fixed inset-0 z-40 bg-black/50",style:{top:u},onClick:()=>W(false)}),document.body),createPortal(jsxs("aside",{ref:G,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",ie?"translate-x-0":"-translate-x-full"),style:{top:u},onClick:me,onTouchStart:le,onTouchMove:_,onTouchEnd:P,children:[jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:[jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-500 dark:text-primary-400",children:"Navigation"}),jsx("button",{type:"button",onClick:O=>{O.stopPropagation(),W(false);},className:n(Dt,"h-7 w-7 p-1"),"aria-label":"Close navigation",children:jsx(X,{className:"h-4 w-4"})})]}),jsx("div",{className:"flex-1 overflow-y-auto overscroll-y-contain p-3",children:jsx("nav",{className:"flex flex-col gap-0.5",children:J})})]}),document.body),!ie&&createPortal(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% + ${u/2}px)`,transform:"translateY(-50%)"},onClick:()=>W(true),"aria-label":"Open navigation",children:jsx(ChevronRight,{className:"h-3.5 w-3.5"})}),document.body)]}):jsx("nav",{className:n("flex flex-col gap-0.5",C==="mini"&&"items-center",p),...k,children:J})}function rl({href:e,className:t,onClick:r,children:a}){return jsx("a",{href:e,className:t,onClick:r,children:a})}function $n({brand:e,onBrandClick:t,navItems:r=[],actions:a=[],linkComponent:s=rl,height:o="h-12",mobileMenu:i=false,navMenuIcon:d,actionsMenuIcon:y,className:m,children:l}){let w=i&&r.length>0,b=i&&a.length>0,p="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",c="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",u=r.map((g,E)=>({key:typeof g.label=="string"?g.label:String(E),label:g.active?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,E)=>({key:g.key??String(E),label:jsxs("span",{className:"flex items-center gap-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:[g.icon,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 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,m),children:[jsxs("div",{className:"flex items-center gap-2 md:gap-6",children:[e&&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&&jsx(Pt,{intent:"ghost",size:"sm",className:p,label:d??jsx(PanelLeft,{className:"h-5 w-5"}),items:u,align:"left",chevron:false,"aria-label":"Open navigation"}),r.length>0&&jsx("nav",{className:n("flex items-center gap-4 text-sm",i?"hidden md:flex":"flex"),children:r.map((g,E)=>{let C=typeof g.label=="string"?g.label:E,R=v(g.active);return g.href?jsx(s,{href:g.href,className:R,onClick:g.onClick,children:g.label},C):jsx("button",{type:"button",className:n(R,"cursor-pointer"),onClick:g.onClick,children:g.label},C)})})]}),l&&jsx("div",{className:"flex items-center",children:l}),jsxs("div",{className:"flex items-center gap-1",children:[a.length>0&&jsx("div",{className:n("flex items-center gap-1",i?"hidden md:flex":"flex"),children:a.map((g,E)=>g.href?jsx("a",{href:g.href,target:g.external?"_blank":void 0,rel:g.external?"noopener noreferrer":void 0,className:c,"aria-label":g.ariaLabel,onClick:g.onClick,children:g.icon},g.key??E):jsx("button",{type:"button",className:c,"aria-label":g.ariaLabel,onClick:g.onClick,children:g.icon},g.key??E))}),b&&jsx(Pt,{intent:"ghost",size:"sm",className:p,label:y??jsx(MoreHorizontal,{className:"h-5 w-5"}),items:k,align:"right",chevron:false,"aria-label":"Open menu"})]})]})}var Vr=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 al(e,t){return !!(t==="_blank"||e&&/^https?:\/\//.test(e))}var ol=e=>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:[jsx("path",{d:"M15 3h6v6"}),jsx("path",{d:"M10 14 21 3"}),jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]});function jn({intent:e,size:t,underline:r,external:a,className:s,children:o,href:i,target:d,rel:y,...m}){let l=a??al(i,d);return jsxs("a",{href:i,target:l&&!d?"_blank":d,rel:l&&!y?"noopener noreferrer":y,className:n(Vr({intent:e,size:t,underline:r}),s),...m,children:[o,l&&jsx(ol,{})]})}var sl={SideNav:Kn,Header:$n,NavLink:jn},Gn=sl;var Ir=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"}}),Ar=cva("",{variants:{size:{sm:"pb-2 text-xs",md:"pb-3 text-sm",lg:"pb-4 text-base"}},defaultVariants:{size:"md"}}),Hr=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"}}),Fr=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"}}),_r=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 zr=createContext(null),Xn=createContext(null);function Wn({type:e="single",defaultValue:t=[],value:r,onValueChange:a,intent:s,size:o,className:i,children:d,...y}){let[m,l]=useState(t),w=r??m,b=useCallback(p=>{let v=c=>c.includes(p)?c.filter(u=>u!==p):e==="single"?[p]:[...c,p];a?a(v(w)):l(v);},[e,w,a]);return jsx(zr.Provider,{value:{expandedItems:w,toggleItem:b,size:o},children:jsx("div",{className:n(Hr({intent:s}),i),...y,children:d})})}function dl({value:e,className:t,children:r,...a}){let o=useContext(zr)?.expandedItems.includes(e)??false;return jsx(Xn.Provider,{value:{value:e,isExpanded:o},children:jsx("div",{className:n("",t),...a,children:r})})}function pl({className:e,children:t,...r}){let a=useContext(zr),s=useContext(Xn);return 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",Ir({size:a?.size}),e),onClick:()=>s&&a?.toggleItem(s.value),"aria-expanded":s?.isExpanded?"true":"false",...r,children:[jsx("span",{className:"flex items-center gap-1.5 [&_svg]:shrink-0",children:t}),jsx(ChevronDown,{className:n("shrink-0 transition-transform duration-200",s?.isExpanded&&"rotate-180")})]})}function ml({className:e,children:t,...r}){let a=useContext(zr),s=useContext(Xn);return jsx("div",{className:n("grid transition-[grid-template-rows] duration-200 ease-out",s?.isExpanded?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children:jsx("div",{className:n("text-primary-500 dark:text-primary-400",Ar({size:a?.size}),e),...r,children:t})})})}var ar=createContext(null),vo=createContext(false);function Un({defaultValue:e="",value:t,onValueChange:r,intent:a,children:s,className:o}){let[i,d]=useState(e),y=t??i,m=useRef(new Map),l=useCallback(b=>{r?r(b):d(b);},[r]),w=useCallback((b,p)=>{p?m.current.set(b,p):m.current.delete(b);},[]);return jsx(ar.Provider,{value:{activeValue:y,setActiveValue:l,intent:a,registerTrigger:w},children:jsx("div",{className:o,children:s})})}function bl({className:e,scrollable:t,...r}){let a=useContext(ar),s=useRef(null),[o,i]=useState(null),d=useCallback(()=>{if(!a||!s.current)return;let w=s.current.querySelectorAll('[role="tab"][data-active="true"]')[0];if(!w){i(null);return}let b=s.current.getBoundingClientRect(),p=w.getBoundingClientRect();i({left:p.left-b.left,width:p.width});},[a]);useLayoutEffect(d,[a?.activeValue,d]),useEffect(()=>{let l=new ResizeObserver(d);return s.current&&l.observe(s.current),()=>l.disconnect()},[d]);let y=a?.intent??"line",m=o&&(y==="line"||y==="underline");return jsxs("div",{ref:s,className:n(Fr({intent:a?.intent}),"relative",t&&"overflow-x-auto",e),role:"tablist",...r,children:[r.children,m&&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 xl({value:e,className:t,children:r,...a}){let s=useContext(ar),o=s?.activeValue===e,i=useCallback(d=>s?.registerTrigger(e,d),[s,e]);return jsx("button",{ref:i,className:n(_r({intent:s?.intent}),t),role:"tab","data-active":o,"aria-selected":o,onClick:()=>s?.setActiveValue(e),...a,children:r})}function yl({className:e,children:t,...r}){let a=useContext(ar);if(!a)return null;let s=er.Children.toArray(t).filter(i=>er.isValidElement(i)),o=Math.max(0,s.findIndex(i=>i.props.value===a.activeValue));return jsx("div",{className:n("overflow-hidden",e),...r,children:jsx(vo.Provider,{value:true,children:jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${o*100}%)`},children:s.map((i,d)=>jsx("div",{className:"w-full shrink-0","aria-hidden":d!==o,children:i},i.props.value??d))})})})}function hl({value:e,className:t,children:r,...a}){let s=useContext(ar);return useContext(vo)?jsx("div",{className:n("pt-4",t),role:"tabpanel",...a,children:r}):s?.activeValue!==e?null:jsx("div",{className:n("pt-4",t),role:"tabpanel",...a,children:r})}var wl={Accordion:Wn,Tabs:Un},qn=wl;var or=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"}}),Br=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 tt=[];function Rl(e){tt.push(e);}function Ml(e){let t=tt.indexOf(e);t!==-1&&tt.splice(t,1);}function Zn(e){return tt.length>0&&tt[tt.length-1]===e}function Pl(e){let t=tt.indexOf(e);return t!==-1?t:tt.length}var Qn=createContext(null);function sr({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:a=false,children:s}){let o=useId();return useEffect(()=>{if(e)return Rl(o),()=>Ml(o)},[e,o]),useEffect(()=>{if(!e||!r)return;let i=d=>{d.key==="Escape"&&Zn(o)&&t(false);};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e,r,t,o]),useEffect(()=>{if(!e||!r)return;let i=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=i;}},[e,r]),e?jsx(Qn.Provider,{value:{id:o,onOpenChange:t,modal:r,closeOnOutsideClick:a},children:createPortal(s,document.body)}):null}function Jn({size:e,position:t="center",className:r,children:a,...s}){let o=useContext(Qn);if(!o)return null;let d=200+Pl(o.id)*10,y=()=>{o.closeOnOutsideClick&&Zn(o.id)&&o.onOpenChange(false);},m=t==="bottom";return o.modal?jsx("div",{className:n("animate-fade-in fixed inset-0 bg-black/50",m?"flex items-end justify-center":"flex items-center justify-center p-4"),style:{zIndex:d},onClick:y,children:jsx("div",{className:n(or({size:e}),m?"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:l=>l.stopPropagation(),...s,children:a})}):jsx("div",{className:n("fixed inset-0 flex items-center justify-center p-4",o.closeOnOutsideClick?"pointer-events-auto":"pointer-events-none"),style:{zIndex:d},onClick:o.closeOnOutsideClick&&Zn(o.id)?()=>o.onOpenChange(false):void 0,children:jsx("div",{className:n(or({size:e}),"animate-scale-in pointer-events-auto shadow-2xl",r),role:"dialog",onClick:o.closeOnOutsideClick?l=>l.stopPropagation():void 0,...s,children:a})})}function ea({className:e,...t}){return jsx("div",{className:n("mb-4 space-y-1",e),...t})}function ta({className:e,...t}){return 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 ra({className:e,...t}){return jsx("p",{className:n("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function na({className:e,...t}){return jsx("div",{className:n("mt-6 flex justify-end gap-2",e),...t})}function Ll({className:e,...t}){let r=useContext(Qn);return 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:jsx(X,{className:"h-4 w-4"})})}var El={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 aa({content:e,position:t="top",intent:r,delay:a=200,maxWidth:s,children:o,className:i}){let[d,y]=useState(false),[m,l]=useState();return jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>{let p=setTimeout(()=>y(true),a);l(p);},onMouseLeave:()=>{clearTimeout(m),y(false);},children:[o,d&&jsx("span",{className:n(Br({intent:r}),El[t],"pointer-events-none",s?"whitespace-normal":"whitespace-nowrap",i),style:s!==void 0?{maxWidth:s}:void 0,role:"tooltip",children:e})]})}var Dl={Dialog:sr,Tooltip:aa},oa=Dl;var Kr=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"}}),It=cva("text-primary-500 dark:text-primary-400",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),ir=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 da({intent:e,className:t,children:r,...a}){return jsx("div",{className:n(ir({intent:e}),t),role:"alert",...a,children:r})}function $l({className:e,...t}){return jsx("h5",{className:n("flex items-center gap-1.5 font-semibold [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",e),...t})}function jl({className:e,...t}){return jsx("span",{className:n("mt-0.5 shrink-0 [&_svg]:h-5 [&_svg]:w-5",e),...t})}function Gl({className:e,...t}){return jsx("div",{className:n("flex-1 min-w-0 space-y-1",e),...t})}function Xl({className:e,...t}){return jsx("p",{className:n("text-sm opacity-90",e),...t})}var Wl=0,ft=[],$r=new Map,ia=new Set;function Ul(){return ft}function la(){ia.forEach(e=>e());}function pa(e){let t=$r.get(e);t&&(clearTimeout(t),$r.delete(e)),ft=ft.map(r=>r.id===e?{...r,exiting:true}:r),la(),setTimeout(()=>{ft=ft.filter(r=>r.id!==e),la();},200);}function ql(e){let t=`alert-${++Wl}`;ft=[...ft,{...e,id:t}],la();let r=e.duration??5e3;if(r>0){let a=setTimeout(()=>{$r.delete(t),pa(t);},r);$r.set(t,a);}return t}var ca=16;function Yl(e){ca=e;}var Zl={"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"},Ql={"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"},Jl={success:CircleCheck,warning:TriangleAlert,error:CircleX,info:Info};function ec({alert:e,onClose:t}){let r=e.intent??"info",a=Jl[r],s=e.position??"top-right";return jsxs("div",{className:n(ir({intent:r}),Ql[s],e.exiting&&"opacity-0 transition-opacity duration-200","w-80 max-w-[calc(100vw-2rem)]"),role:"alert",children:[jsx(a,{className:"mt-0.5 h-5 w-5 shrink-0"}),jsxs("div",{className:"flex-1",children:[e.title&&jsx("p",{className:"font-semibold",children:e.title}),jsx("p",{className:n(e.title&&"text-sm opacity-90"),children:e.message})]}),jsx("button",{onClick:t,"aria-label":"Close notification",className:"shrink-0 cursor-pointer opacity-50 transition-opacity hover:opacity-100",children:jsx(X,{className:"h-4 w-4"})})]})}var tc=e=>e.startsWith("top");function rc(){let e=useSyncExternalStore(a=>(ia.add(a),()=>ia.delete(a)),Ul),t=useRef(ca);if(useEffect(()=>{t.current=ca;},[]),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 createPortal(jsx(Fragment,{children:Object.entries(r).map(([a,s])=>jsx("div",{style:tc(a)?{top:`${t.current}px`}:void 0,className:n("pointer-events-none fixed z-100 flex flex-col gap-2",Zl[a]),children:s.map(o=>jsx(ec,{alert:o,onClose:()=>pa(o.id)},o.id))},a))}),document.body)}var Co=false;function nc(){if(Co)return;Co=true;let e=document.createElement("div");e.id="alert-toast-root",document.body.appendChild(e),createRoot(e).render(jsx(rc,{}));}function ac(){return useEffect(()=>{nc();},[]),{addAlert:ql,removeAlert:pa}}function ua({value:e=0,size:t,intent:r,edge:a,showLabel:s=false,indeterminate:o=false,animated:i=false,duration:d=500,className:y,...m}){let l=Math.max(0,Math.min(100,e)),[w,b]=useState(0),p=useRef(0);useEffect(()=>{if(!o)return p.current=requestAnimationFrame(()=>{b(l);}),()=>{p.current&&cancelAnimationFrame(p.current);}},[l,o]);let v=s&&!o&&t!=="xs"&&t!=="sm",c=jsx("div",{role:"progressbar","aria-valuenow":o?void 0:l,"aria-valuemin":0,"aria-valuemax":100,className:n(Kr({size:t,intent:r,edge:a}),y),...m,children:o?jsx("div",{className:"progress-fill absolute top-0 h-full rounded-full animate-progress-indeterminate"}):jsx("div",{className:n("progress-fill h-full rounded-full transition-[width] ease-out",i&&"animate-progress-shine"),style:{width:`${w}%`,transitionDuration:`${d}ms`},children:v&&jsxs("span",{className:"flex h-full items-center justify-end pr-2 text-[10px] font-semibold text-white",children:[Math.round(l),"%"]})})});return a==="top"||a==="bottom"?createPortal(c,document.body):c}function jr({size:e}){let t=e==="sm"?20:e==="lg"?40:28;return 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: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 ga({spinning:e=true,tip:t,size:r,className:a,children:s,...o}){return s?jsxs("div",{className:n("relative w-fit",a),...o,children:[jsx("div",{className:n("transition-all duration-200",e&&"pointer-events-none select-none blur-[1px]"),children:s}),e&&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:[jsx(jr,{size:r}),t&&jsx("span",{className:n(It({size:r}),"select-none"),children:t})]})]}):e?jsxs("div",{className:n("inline-flex flex-col items-center gap-2",a),...o,children:[jsx(jr,{size:r}),t&&jsx("span",{className:n(It({size:r}),"select-none"),children:t})]}):null}var uc=0,cr=[],fa=new Set;function fc(){return cr}function Eo(){fa.forEach(e=>e());}function gc(e,t){let r=++uc;return cr=[...cr,{id:r,target:e,tip:t}],Eo(),()=>bc(r)}function bc(e){cr=cr.filter(t=>t.id!==e),Eo();}function xc(){return gc}var Po=false;function yc(){if(Po||typeof document>"u")return;Po=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(jsx(kc,{}));});}var Gr=new Map;function hc(e){let t=Gr.get(e);if(t){t.count++;return}let r=getComputedStyle(e),a=e.style.position;r.position==="static"&&(e.style.position="relative"),Gr.set(e,{count:1,original:a});}function vc(e){let t=Gr.get(e);t&&(t.count--,t.count<=0&&(e.style.position=t.original,Gr.delete(e)));}function wc({entry:e}){return useEffect(()=>{let t=e.target;if(!Lo(t))return hc(t),()=>vc(t)},[e.target]),Lo(e.target)?createPortal(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:[jsx(jr,{size:"lg"}),e.tip&&jsx("span",{className:"select-none text-sm text-primary-100",children:e.tip})]}),document.body):createPortal(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:[jsx(jr,{size:"md"}),e.tip&&jsx("span",{className:n(It({size:"md"}),"select-none"),children:e.tip})]}),e.target)}function kc(){let e=useSyncExternalStore(t=>(fa.add(t),()=>fa.delete(t)),()=>fc());return e.length===0?null:jsx(Fragment,{children:e.map(t=>jsx(wc,{entry:t},t.id))})}function Lo(e){return e===document.documentElement||e===document.body}typeof document<"u"&&yc();var Cc={Alert:da,ProgressBar:ua,Spin:ga},ba=Cc;var Io="#1c1914",Ao="#130f0b",Oc="#2e261e",ya="#504638",At="#6b5d4d",Wr=`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")`,Bc=[{key:"like",icon:jsx(Heart,{className:"h-5 w-5"}),activeIcon:jsx(Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsx(ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsx(Bookmark,{className:"h-5 w-5"}),activeIcon:jsx(Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsx(Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsx(Download,{className:"h-5 w-5"}),label:"Download"}];function ha({photos:e,layout:t="strip",actions:r=Bc,onAction:a,className:s,showGrain:o=true,sheetTitle:i,sheetLabel:d}){let[y,m]=useState(null),[l,w]=useState(new Set),b=useCallback(u=>m(u),[]),p=useCallback(()=>m(null),[]),v=useCallback((u,k)=>{if(r.find(E=>E.key===u)?.toggle){let E=`${k}-${u}`;w(C=>{let R=new Set(C);return R.has(E)?R.delete(E):R.add(E),R});}a?.(u,e[k],k);},[r,a,e]);return jsxs(Fragment,{children:[jsx(t==="strip"?Kc:t==="sheet"?$c:jc,{photos:e,onPhotoClick:b,showGrain:o,className:s,sheetTitle:i,sheetLabel:d}),y!==null&&createPortal(jsx(Gc,{photos:e,currentIndex:y,onIndexChange:m,onClose:p,actions:r,activeActions:l,onAction:v,showGrain:o}),document.body)]})}function Do({count:e=30}){return jsx("div",{className:"flex shrink-0 items-center justify-between px-3",style:{height:22,background:Io},children:Array.from({length:e}).map((t,r)=>jsx("div",{className:"rounded-xs",style:{width:12,height:8,background:Oc}},r))})}function Kc({photos:e,onPhotoClick:t,showGrain:r,className:a}){let s=useRef(null);return jsxs("div",{className:n("select-none rounded-lg overflow-hidden",a),style:{background:Ao},children:[jsx(Do,{count:Math.max(30,e.length*6)}),jsx("div",{ref:s,className:"flex gap-1 overflow-x-auto scroll-smooth px-1 py-1",style:{background:Io,scrollSnapType:"x mandatory"},children:e.map((o,i)=>jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(i),children:[jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:ya,width:280,height:187},children:[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}),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&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-[0.06]",style:{backgroundImage:Wr,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 transition-opacity duration-300 group-hover:opacity-50",style:{background:"radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%)"}})]}),jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:At},children:[String(i+1).padStart(2,"0"),i%2===0?"":"A"]})]},i))}),jsx(Do,{count:Math.max(30,e.length*6)})]})}function $c({photos:e,onPhotoClick:t,showGrain:r,className:a,sheetTitle:s,sheetLabel:o}){return jsxs("div",{className:n("rounded-lg p-5",a),style:{background:Ao},children:[jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:At},children:s??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:At},children:o??"Contact Sheet"})]}),jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((i,d)=>jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${d*50}ms both`},onClick:()=>t(d),children:[jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:At},children:String(d+1).padStart(2,"0")}),jsxs("div",{className:"relative overflow-hidden rounded-[1px] border transition-all duration-300 group-hover:border-amber-600/50 group-hover:shadow-[0_0_20px_rgba(217,171,89,0.15)]",style:{borderColor:ya,aspectRatio:"3/2"},children:[jsx("img",{src:i.src,alt:i.alt??"",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105",draggable:false}),r&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Wr}}),jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 translate-y-full bg-linear-to-t from-black/70 to-transparent p-2 pt-6 transition-transform duration-300 group-hover:translate-y-0",children:jsx("span",{className:"text-xs font-medium text-white/90",children:i.title})})]})]},d))})]})}function jc({photos:e,onPhotoClick:t,showGrain:r,className:a}){let[s,o]=useState(false),[i,d]=useState(null),y=Math.min(e.length,8),m=e.slice(0,y),l=b=>{let p=Math.sin(b*137.508+1)*1e4,v=(p%12-6).toFixed(1),c=(p/7%8-4).toFixed(1),u=(p/13%6-3).toFixed(1);return `rotate(${v}deg) translate(${c}px, ${u}px)`},w=(b,p)=>{let v=(p-1)/2,c=((b-v)*7).toFixed(1),u=((b-v)*110).toFixed(0),k=(-Math.abs(b-v)*10+(i===b?-18:0)).toFixed(0);return `translateX(${u}px) translateY(${k}px) rotate(${c}deg)`};return jsxs("div",{className:n("flex flex-col items-center gap-4",a),children:[jsx("div",{className:"relative flex h-85 w-full items-center justify-center",onMouseEnter:()=>o(true),onMouseLeave:()=>{o(false),d(null);},children:m.map((b,p)=>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?`${p*35}ms`:`${(y-p)*25}ms`,transform:s?w(p,m.length):l(p),zIndex:s?p+1:m.length-p,width:220,height:147},onClick:()=>t(p),onMouseEnter:()=>s&&d(p),onMouseLeave:()=>d(null),children:jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-lg border transition-shadow duration-300",style:{borderColor:s&&i===p?"rgba(217,171,89,0.5)":ya,boxShadow:s&&i===p?"0 25px 50px rgba(0,0,0,0.5), 0 0 30px rgba(217,171,89,0.1)":"0 10px 30px rgba(0,0,0,0.4)"},children:[jsx("img",{src:b.src,alt:b.alt??"",className:"h-full w-full object-cover",draggable:false}),r&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:Wr}}),jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%)"}}),s&&i===p&&jsx("div",{className:"absolute inset-x-0 bottom-0 bg-linear-to-t from-black/80 to-transparent p-3 pt-8",style:{animation:"reveal-up 0.25s ease-out"},children:jsx("span",{className:"text-sm font-medium text-white/90",children:b.title})})]})},p))}),e.length>y&&jsxs("span",{className:"font-mono text-xs",style:{color:At},children:["+ ",e.length-y," more"]}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] transition-opacity duration-300",style:{color:At,opacity:s?0:.7},children:"Hover to explore"})]})}function Gc({photos:e,currentIndex:t,onIndexChange:r,onClose:a,actions:s,activeActions:o,onAction:i,showGrain:d}){let y=e[t],[m,l]=useState(1),[w,b]=useState({x:0,y:0}),[p,v]=useState(false),[c,u]=useState(false),k=useRef(false),g=useRef({x:0,y:0}),E=useRef(null);useLayoutEffect(()=>{requestAnimationFrame(()=>u(true));},[]),useEffect(()=>{let x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=x;}},[]),useEffect(()=>{let x=K=>{switch(K.key){case "Escape":a();break;case "ArrowLeft":C(-1);break;case "ArrowRight":C(1);break;case "i":case "I":v(U=>!U);break}};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)}),useEffect(()=>{let x=E.current;if(!x)return;let K=U=>{U.preventDefault();let ie=U.deltaY<0?1.12:.89;l(W=>{let me=Math.min(8,Math.max(1,W*ie));return me<=1&&b({x:0,y:0}),me});};return x.addEventListener("wheel",K,{passive:false}),()=>x.removeEventListener("wheel",K)},[]);let C=useCallback(x=>{let K=t+x;K>=0&&K<e.length&&(r(K),l(1),b({x:0,y:0}));},[t,e.length,r]),R=useCallback(x=>{m<=1||(k.current=true,g.current={x:x.clientX,y:x.clientY},x.target.setPointerCapture(x.pointerId));},[m]),$=useCallback(x=>{if(!k.current)return;let K=x.clientX-g.current.x,U=x.clientY-g.current.y;g.current={x:x.clientX,y:x.clientY},b(ie=>({x:ie.x+K/m,y:ie.y+U/m}));},[m]),N=useCallback(()=>{k.current=false;},[]),M=useCallback(()=>{m>1?(l(1),b({x:0,y:0})):l(2.5);},[m]),I=x=>o.has(`${t}-${x}`),V=y.metadata;return jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsx("div",{className:"absolute inset-0 bg-black/95",onClick:a}),d&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:Wr,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxs("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[m.toFixed(1),"x"]}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>l(x=>Math.min(8,x*1.3)),title:"Zoom in",children:jsx(ZoomIn,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{l(x=>{let K=Math.max(1,x*.7);return K<=1&&b({x:0,y:0}),K});},title:"Zoom out",children:jsx(ZoomOut,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:a,title:"Close",children:jsx(X,{className:"h-5 w-5"})})]})]}),jsxs("div",{ref:E,className:"relative flex flex-1 items-center justify-center overflow-hidden",style:{cursor:m>1?"grab":"default"},onPointerDown:R,onPointerMove:$,onPointerUp:N,onDoubleClick:M,children:[jsx("img",{src:y.src,alt:y.alt??y.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(${m}) translate(${w.x}px, ${w.y}px)`,transition:k.current?"none":"transform 0.15s ease-out"},draggable:false},t),t>0&&jsx("button",{className:"absolute left-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:x=>{x.stopPropagation(),C(-1);},children:jsx(ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:x=>{x.stopPropagation(),C(1);},children:jsx(ChevronRight,{className:"h-6 w-6"})})]}),jsx("div",{className:n("absolute inset-x-0 bottom-0 z-20 transition-all duration-400",p?"translate-y-0 opacity-100":"pointer-events-none translate-y-full opacity-0"),children:jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[y.title&&jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:y.title}),y.description&&jsx("p",{className:"mb-4 max-w-xl border-l-2 border-amber-500/40 pl-4 text-sm leading-relaxed text-white/60 italic",style:{animation:"reveal-up 0.4s ease-out 0.1s both"},children:y.description}),V&&jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[V.camera&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",V.camera,V.lens&&jsx("span",{className:"text-white/40",children:"\xB7"}),V.lens&&V.lens]}),(V.aperture||V.shutter||V.iso)&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(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&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",V.date]}),V.location&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",V.location]})]})]})}),jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[s.map(x=>{let K=x.toggle&&I(x.key);return 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:()=>i(x.key,t),title:x.label,children:K&&x.activeIcon?x.activeIcon:x.icon},x.key)}),jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),jsx("button",{className:n("rounded-full p-2.5 transition-all duration-200",p?"text-amber-400 hover:text-amber-300":"text-white/60 hover:bg-white/10 hover:text-white"),onClick:()=>v(x=>!x),title:"Photo info (I)",children:jsx(Info,{className:"h-5 w-5"})})]})})]})}var va="data:image/svg+xml,"+encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
|
|
1
|
+
import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsx,Fragment,jsxs}from'react/jsx-runtime';import Nr,{createContext,useSyncExternalStore,useEffect,useState,useRef,useCallback,useMemo,useId,useContext,useLayoutEffect}from'react';import {Heart,ThumbsDown,Bookmark,Share2,Download,Info,CheckCircle,AlertTriangle,AlertCircle,ChevronDown,Check,Inbox,Plus,Trash2,Pencil,ArrowUpDown,ArrowUp,ArrowDown,ChevronRight,Menu,ChevronsLeft,X,PanelLeft,MoreHorizontal,ZoomIn,ZoomOut,ChevronLeft,Camera,Aperture,Calendar,MapPin,ListMusic,Shuffle,Repeat1,SkipBack,Pause,Play,SkipForward,VolumeX,Volume2,Disc3,ListVideo,Theater,Minimize,Maximize,HardDrive,LayoutGrid,LayoutList,Minus,Minimize2,Maximize2,FolderUp,Search,CornerRightDown,Folder,FileArchive,Database,FileSpreadsheet,FileText,Terminal,FileCode,Video,Music,Image,File,CircleX,TriangleAlert,CircleCheck}from'lucide-react';import {createPortal}from'react-dom';import {createRoot}from'react-dom/client';function i(...e){return twMerge(clsx(e))}var Xt=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=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=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=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=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=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=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=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 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]=useState(null),p=useRef(void 0),b=c=>{p.current&&clearTimeout(p.current),s(c);},u=()=>{p.current=setTimeout(()=>s(null),150);};return useEffect(()=>()=>{p.current&&clearTimeout(p.current);},[]),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 jsxs("div",{className:"relative",style:Or(T,e.length,n,r),onMouseEnter:()=>b(c.value),onMouseLeave:u,children:[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&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:c.icon}),jsx("span",{className:"flex-1 truncate",children:c.label??c.value}),x&&jsx(ChevronRight,{className:"text-primary-400 h-3.5 w-3.5 shrink-0"})]}),x&&m&&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=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 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 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&&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&&jsx(Check,{className:"h-3 w-3"})}),d.icon&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:d.icon}),jsx("span",{className:"truncate",children:d.label??d.value})]},d.value)}),x.length===0&&!o&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:Or(0,1,s,a),children:"No matches"}),o&&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:[jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),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]=useState(c?void 0:e.defaultValue),[m,g]=useState(c?e.defaultSelected??[]:[]),d=c?e.selected??m:[],[f,w]=useState(false),[h,P]=useState(false),[k,N]=useState(""),F=useRef(null),R=useRef(null),E=useRef(void 0),A=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]);useEffect(()=>()=>{E.current&&clearTimeout(E.current);},[]);let H=c?void 0:e.value??T,y=useMemo(()=>H?Bn(t,H):void 0,[t,H]);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]),useEffect(()=>{if(!f)return;let Y=V=>{V.key==="Escape"&&A();};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[f,A]);let O=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=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=useMemo(()=>!n||!k.trim()?false:!_n(t).some(V=>V.value.toLowerCase()===ne||(V.label??V.value).toLowerCase()===ne),[n,ne,t]),re=useCallback(()=>{let Y=k.trim();Y&&(o?.(Y),N(""));},[k,o]),_=useCallback(Y=>{Y.key==="Enter"&&C&&(Y.preventDefault(),re());},[C,re]),de=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 jsxs("div",{ref:F,className:i("relative inline-block min-w-44",p),children:[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?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);}}):jsx("span",{className:i("flex-1 truncate",!j&&"text-secondary-400 dark:text-secondary-600"),children:j||r}),y?.icon&&!n&&!c&&jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center",children:y.icon}),c&&d.length>0&&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}),jsx(ChevronDown,{className:i("text-primary-400 h-4 w-4 shrink-0 transition-transform",f&&"rotate-180")})]}),f&&jsx("div",{className:i(s==="right"?"right-0":"left-0","absolute w-full"),children:pe?jsx(Ds,{options:t,filter:k,multiple:c,selected:d,canAdd:C,animated:u,closing:h,onSelect:O,onToggle:v,onAdd:re}):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]=useState(false),[w,h]=useState(false),[P,k]=useState(""),N=useRef(null),F=useRef(null),R=useRef(void 0);useEffect(()=>()=>{R.current&&clearTimeout(R.current);},[]);let E=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=useCallback(()=>{s||(d?E():(R.current&&clearTimeout(R.current),h(false),f(true),k(""),p&&requestAnimationFrame(()=>F.current?.focus())));},[s,d,E,p]);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]),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=useMemo(()=>P?t.filter(j=>(typeof j.label=="string"?j.label:j.key??"").toLowerCase().includes(H)):t,[t,H]),O=useMemo(()=>!p||!P.trim()?false:!t.some(j=>(typeof j.label=="string"?j.label:j.key??"").toLowerCase()===H),[p,H,t]),v=useCallback(()=>{let j=P.trim();j&&(b?.(j),k(""));},[P,b]),ne=useCallback(j=>{j.key==="Enter"&&O&&(j.preventDefault(),v());},[O,v]),C=useCallback(j=>{let pe=c.includes(j)?c.filter(Y=>Y!==j):[...c,j];T?.(pe);},[c,T]),re=u&&c.length>0?jsxs(Fragment,{children:[e," ",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 jsxs("div",{ref:N,className:"relative inline-block",children:[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&&jsx(ChevronDown,{className:i("h-3.5 w-3.5 transition-transform",d&&"rotate-180")})]}),d&&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&&jsx("div",{className:"border-primary-200 dark:border-primary-700 border-b px-2 pb-1.5 pt-1",children: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"})}),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 jsxs(Nr.Fragment,{children:[j.divider&&jsx("div",{className:"border-primary-200 dark:border-primary-700 my-1 border-t"}),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&&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&&jsx(Check,{className:"h-3 w-3"})}),jsx("span",{className:"flex-1 truncate",children:j.label})]})]},Y)}),y.length===0&&!O&&jsx("div",{className:"text-primary-400 px-3 py-2 text-center text-sm",style:jn(0,1,w,x),children:"No matches"}),O&&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:[jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center text-lg leading-none",children:"+"}),jsxs("span",{className:"truncate",children:["Add \u201C",P.trim(),"\u201D"]})]})]})]})]})}function Gn({intent:e,size:t,className:r,...n}){return 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 jsxs("div",{className:"relative inline-flex",children:[e,t&&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&&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 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 jsx("input",{className:i(jt({state:e,size:t}),r),...s});let p=Xs[t??"md"],b=js[e??"default"];return 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&&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}),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&&jsx("span",{className:i("pointer-events-none flex shrink-0 items-center text-secondary-400 dark:text-secondary-500",p.icon),children:o}),a&&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]=useState(()=>s??""),x=a!==void 0?String(a):c,m=useCallback(f=>{a===void 0&&T(f.target.value),p?.(f);},[a,p]),g=useMemo(()=>Qs(x),[x]),d=n!=null&&g>n;return jsxs("div",{className:i("inline-flex w-full flex-col",o),children:[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)&&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=useId(),m=b??x,g=s??"md",d=a??"primary",f=ol[g],w=n!=null||o!=null,[h,P]=useState(t),k=e??h,N=useCallback(F=>{let R=F.target.checked;e===void 0&&P(R),r?.(R);},[e,r]);return jsxs("label",{htmlFor:m,className:i("inline-flex cursor-pointer items-center gap-2",c&&"pointer-events-none opacity-50",u),children:[jsx("input",{...T,id:m,type:"checkbox",role:"switch",className:"sr-only",checked:k,disabled:c,onChange:N,"aria-checked":k}),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?jsxs(Fragment,{children:[jsxs("span",{className:i("pointer-events-none invisible inline-grid",f.icon),children:[jsx("span",{className:i("[grid-area:1/1] whitespace-nowrap",f.pad),children:n}),jsx("span",{className:i("[grid-area:1/1] whitespace-nowrap",f.pad),children:o})]}),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}),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,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&&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=useId(),x=p??T,m=a??"md",[g,d]=useState(t),f=e??g,w=useCallback(P=>{let k=P.target.checked;e===void 0&&d(k),n?.(k);},[e,n]),h=f||r;return jsxs("label",{htmlFor:x,className:i("inline-flex cursor-pointer items-center gap-2 select-none",u&&"pointer-events-none opacity-50",b),children:[jsx("input",{...c,id:x,type:"checkbox",className:"sr-only",checked:f,disabled:u,onChange:w}),jsx("span",{className:i(Ar({intent:o,size:a,checked:h?"on":"off"})),children: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?jsx("line",{x1:"3",y1:"8",x2:"13",y2:"8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"}):jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),s&&jsx("span",{className:"text-sm text-primary-700 dark:text-primary-300",children:s})]})}var Za=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=useId(),T=e??c,[x,m]=useState(r),g=t??x,d=useCallback(f=>{t===void 0&&m(f),n?.(f);},[t,n]);return jsx(Za.Provider,{value:{name:T,value:g,onChange:d,intent:o,size:a,disabled:s},children: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=useId(),u=o??b,c=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=useCallback(h=>{h.target.checked&&c?.onChange(e);},[c,e]);return jsxs("label",{htmlFor:u,className:i("inline-flex cursor-pointer items-center gap-2 select-none",g&&"pointer-events-none opacity-50",a),children:[jsx("input",{...p,id:u,type:"radio",name:d,value:e,className:"sr-only",checked:f,disabled:g,onChange:w}),jsx("span",{className:i(zr({intent:T,size:x,checked:f?"on":"off"})),children:jsx("span",{className:i("rounded-full bg-white transition-all duration-200",gl[m],f?"scale-100 opacity-100":"scale-0 opacity-0")})}),n&&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=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=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 jsx("div",{className:i(br({intent:e,size:t}),r),...n})}function xl({className:e,...t}){return jsx("div",{className:i("mb-4 space-y-1",e),...t})}function yl({className:e,...t}){return jsx("h3",{className:i("text-primary-900 dark:text-primary-100 text-lg font-semibold",e),...t})}function vl({className:e,...t}){return jsx("p",{className:i("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function wl({className:e,...t}){return jsx("div",{className:i("text-primary-700 dark:text-primary-300 text-sm",e),...t})}function kl({className:e,...t}){return 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=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?jsx("img",{src:t.src,alt:t.alt??"",className:"h-full w-full object-cover",draggable:false}):t.icon?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 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,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 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:[jsxs("div",{className:"relative overflow-hidden",style:{aspectRatio:r},children:[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}),jsx("div",{className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100","aria-hidden":true,children:jsx("div",{className:"animate-light-sweep absolute inset-0"})})]}),o]})}function Tl({className:e,...t}){return jsx("div",{className:i("space-y-2 p-4",e),...t})}function Rl({className:e,...t}){return jsx("h3",{className:i("text-primary-900 dark:text-primary-100 text-base font-semibold",e),...t})}function Ml({className:e,...t}){return jsx("p",{className:i("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function Sl({className:e,...t}){return 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 jsx("div",{className:i(jr({intent:e,size:t}),r),...n})}function Ll({className:e,...t}){return 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 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=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=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=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=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=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 jsx("div",{className:"w-full overflow-auto",children:jsx("table",{className:i(Yr({intent:e,density:t}),r),...n})})}function mo({className:e,...t}){return 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 jsx("tbody",{className:i("[&_tr:last-child]:border-0",e),...t})}function wr({className:e,...t}){return 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 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 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 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??jsx(Inbox,{className:"h-12 w-12 stroke-[1.2]"}),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]=useState(o),m=r??T,g=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=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 jsxs(kr,{intent:p,density:b,className:u,children:[jsx(mo,{children:jsxs(wr,{children:[e.map(f=>{let w=f.sortable!==false,h=m?.column===f.key;return 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:jsxs("span",{className:"inline-flex items-center gap-1",children:[f.header,w&&jsx(ti,{active:h,direction:h?m.direction:null})]})},f.key)}),s&&jsx(It,{className:"w-20 text-right",children:"Actions"})]})}),jsx(po,{children:d.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(s?1:0),children:jsx(uo,{...c})})}):d.map((f,w)=>jsxs(wr,{children:[e.map(h=>jsx(Ht,{className:i(h.cellClassName,h.hideBelow&&ei[h.hideBelow]),children:h.cell(f)},h.key)),s&&jsx(Ht,{className:"text-right",children: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]=useState(e),a=useRef(null);useEffect(()=>{a.current?.focus(),a.current?.select();},[]);let s=()=>t(n);return jsxs("span",{className:"flex items-center gap-1",children:[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"}),jsx("button",{type:"button",onClick:s,className:"text-success-600 hover:text-success-700 dark:text-success-400","aria-label":"Confirm",children:jsx(Check,{className:"h-3.5 w-3.5"})}),jsx("button",{type:"button",onClick:r,className:"text-danger-500 hover:text-danger-600 dark:text-danger-400","aria-label":"Cancel",children:jsx(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]=useState(a),N=n??P,F=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=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]=useState([]),H=p??E,y=b??A,O=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=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=useCallback(()=>{y(v?[]:O);},[v,O,y]),[_,de]=useState(null),j=useCallback((V,G,me)=>{u&&me!==false&&de({rowKey:V,colKey:G});},[u]),pe=useCallback((V,G,me)=>{c?.(V,G,me),de(null);},[c]);return jsxs("div",{className:"space-y-2",children:[T&&jsxs("div",{className:"flex items-center gap-2",children:[x&&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:[jsx(Plus,{className:"h-3.5 w-3.5"})," Add"]}),m&&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:[jsx(Trash2,{className:"h-3.5 w-3.5"})," Delete",H.length>0&&` (${H.length})`]}),u&&H.length===1&&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:[jsx(Pencil,{className:"h-3.5 w-3.5"})," Edit"]}),H.length>0&&jsxs("span",{className:"ml-auto text-sm text-secondary-500 dark:text-secondary-400",children:[H.length," row",H.length>1?"s":""," selected"]})]}),jsxs(kr,{intent:d,density:f,className:w,children:[jsx(mo,{children:jsxs(wr,{children:[s==="multiple"&&jsx(It,{className:"w-10",children: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"&&jsx(It,{className:"w-10"}),e.map(V=>{let G=V.sortable!==false,me=N?.column===V.key;return 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:jsxs("span",{className:"inline-flex items-center gap-1",children:[V.header,G&&jsx(ti,{active:me,direction:me?N.direction:null})]})},V.key)}),g&&jsx(It,{className:"w-20 text-right",children:"Actions"})]})}),jsx(po,{children:R.length===0?jsx("tr",{children:jsx("td",{colSpan:e.length+(s!=="none"?1:0)+(g?1:0),children:jsx(uo,{...h})})}):R.map((V,G)=>{let me=r(V,G),W=H.includes(me);return jsxs(wr,{className:i(W&&"bg-primary-50/60 dark:bg-primary-900/20"),onClick:()=>{s!=="none"&&C(me);},children:[s==="multiple"&&jsx(Ht,{className:"w-10",children: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"&&jsx(Ht,{className:"w-10",children: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 jsx(Ht,{className:i(l.cellClassName,u&&l.editable!==false&&"cursor-text"),onDoubleClick:$=>{$.stopPropagation(),j(me,l.key,l.editable);},children:D?jsx(Wl,{value:X,onCommit:$=>pe(me,l.key,$),onCancel:()=>de(null)}):l.cell(V)},l.key)}),g&&jsx(Ht,{className:"text-right",onClick:l=>l.stopPropagation(),children: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?jsx(ArrowUpDown,{className:i(r,"opacity-30")}):t==="asc"?jsx(ArrowUp,{className:i(r,"opacity-70")}):jsx(ArrowDown,{className:i(r,"opacity-70")})}var ri=createContext({size:"md"});function fo({intent:e,size:t="md",className:r,...n}){return jsx(ri.Provider,{value:{size:t},children:jsx("ul",{className:i(Gr({intent:e}),r),...n})})}function Gl({actions:e,className:t,children:r,...n}){let{size:o}=useContext(ri);return jsxs("li",{className:i(Ur({size:o}),t),...n,children:[jsx("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:r}),e&&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=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]=useState(()=>n),x=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 jsx(ai.Provider,{value:{showLines:e,expandedKeys:m,onToggleKey:x,size:a},children:t?jsx("ul",{className:i("text-sm",s),role:"tree",...b,children:p}):jsx("ul",{className:i("text-sm",s),role:"tree",...b,children:jsx(ec,{children:p})})})}function ec({children:e}){let t=ii(e);return jsx(Fragment,{children:t.map(r=>Nr.isValidElement(r)&&r.props.children?r.props.children:null)})}function ii(e){let t=[];return Nr.Children.forEach(e,r=>{Nr.isValidElement(r)&&r.type===Nr.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}=useContext(ai),[m,g]=useState(o),d=Nr.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 jsxs("li",{className:i("select-none",b),role:"treeitem","aria-expanded":d?w:void 0,children:[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?jsx(ChevronRight,{className:i("text-primary-400 h-4 w-4 shrink-0 transition-transform duration-200",w&&"rotate-90")}):jsx("span",{className:"w-4 shrink-0"}),r&&jsx("span",{className:"shrink-0",children:r}),jsx("span",{className:"text-primary-700 dark:text-primary-300 min-w-0 flex-1 truncate",children:t}),n&&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&&jsx("div",{className:i("grid transition-[grid-template-rows] duration-200 ease-out",w?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children: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)?jsx("img",{src:e,alt:t,className:"h-8 w-8 shrink-0 rounded-full object-cover",draggable:false}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-lg select-none",children:e}):jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full",children:e}):jsx("div",{className:"bg-primary-200 text-primary-600 dark:bg-primary-700 dark:text-primary-300 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-semibold select-none",children:t.charAt(0).toUpperCase()})}function ic({msg:e,alignRight:t}){return jsxs("div",{className:i("flex gap-2.5",t?"flex-row-reverse":"flex-row"),children:[jsx(ac,{avatar:e.avatar,sender:e.sender}),jsxs("div",{className:i("flex max-w-[75%] flex-col gap-0.5",t?"items-end":"items-start"),children:[jsx("span",{className:"text-primary-500 dark:text-primary-400 text-xs",children:e.sender}),jsx("div",{className:i("rounded-xl px-3 py-2 text-sm leading-relaxed",t?"rounded-tr-sm bg-primary-500 text-white dark:bg-primary-600":"bg-primary-100 text-primary-800 dark:bg-primary-800 dark:text-primary-200 rounded-tl-sm"),children:e.content}),e.time&&jsx("span",{className:"text-primary-400 dark:text-primary-500 text-[10px]",children:e.time})]})]})}function bo({messages:e,mode:t="split",autoScroll:r=true,className:n,...o}){let a=useRef(null);return useEffect(()=>{r&&a.current?.scrollIntoView({behavior:"smooth"});},[e,r]),jsxs("div",{className:i("flex flex-col gap-4 overflow-y-auto rounded-lg border p-4","border-primary-200 dark:border-primary-700 dark:bg-primary-900 bg-white",n),...o,children:[e.map(s=>{let p=t==="split"&&!!s.self;return jsx(ic,{msg:s,alignRight:p},s.id)}),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]=useState(""),c=useRef(null),T=useRef(null),x=useRef(null);useEffect(()=>{let k=false;return pc(e,t,n?false:r).then(N=>{k||u(N);}),()=>{k=true;}},[e,t,r,n]);let m=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=useCallback(k=>{o?.(k.target.value);},[o]),d=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?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&&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)=>jsx("div",{children:N+1},N))}),jsxs("div",{className:"relative min-w-0 flex-1",children:[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"}}),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})]})]}):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:jsx("div",{ref:x,className:"[&_pre]:m-0 [&_pre]:p-4",dangerouslySetInnerHTML:b?{__html:b}:void 0,children:b?void 0:jsx("pre",{className:"m-0 p-4",style:{background:"var(--color-syntax-bg)"},children: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 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]=useState(e.defaultOpen??true),x=s?s.has(b):c,m=useCallback(()=>{s?p(b):T(d=>!d);},[s,p,b]),g=r>0?`${r*1.25}rem`:void 0;if(u)return jsxs("div",{children:[jsxs("button",{type:"button",onClick:m,className:i(zt,er,"justify-between"),style:{paddingLeft:g},children:[jsxs("span",{className:"flex items-center gap-2",children:[e.icon,e.label]}),jsx(ChevronRight,{className:i("h-3.5 w-3.5 transition-transform",x&&"rotate-90")})]}),x&&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=>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?jsxs("button",{type:"button",onClick:()=>n(e,d),className:i(zt,er),style:{paddingLeft:g},children:[e.icon,e.label]}):jsxs(o,{to:d,className:({isActive:f})=>i(zt,f?di:er),style:{paddingLeft:g},children:[e.icon,e.label]})}return 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]=useState(false),s=useRef(null),p=useRef(void 0),[b,u]=useState({top:0,left:0}),c=()=>{clearTimeout(p.current),a(true);},T=()=>{p.current=setTimeout(()=>a(false),200);};useLayoutEffect(()=>{if(o&&s.current){let m=s.current.getBoundingClientRect();u({top:m.top,left:m.right+4});}},[o]);let x=e.icon||jsx("span",{className:"text-xs font-bold leading-none",children:e.label.charAt(0).toUpperCase()});return jsxs("div",{onMouseEnter:c,onMouseLeave:T,children:[jsx("button",{ref:s,type:"button",className:i(tr,"w-full"),title:e.label,onClick:()=>a(m=>!m),children:x}),o&&createPortal(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:[jsx("div",{className:"px-2.5 py-1.5 text-xs font-semibold uppercase text-primary-500 dark:text-primary-400",children:e.label}),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?jsxs("button",{type:"button",onClick:()=>{r(m,d),a(false);},className:i(zt,er),children:[m.icon,m.label]},g):jsxs(n,{to:d,className:({isActive:f})=>i(zt,f?di:er),children:[m.icon,m.label]},g)}return 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||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?jsx("button",{type:"button",onClick:()=>r(e,a),className:i(tr,"w-full"),title:e.label,children:o}):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:jsx("span",{title:e.label,children:o})})}return 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]=useState(p),k=s??h,N=Nr.useMemo(()=>mi(e),[e]),[F,R]=useState(()=>T==="all"?new Set(N):new Set(T)),E=c??null,A=E??F,H=useCallback(W=>{let l=new Set(A);l.has(W)?l.delete(W):l.add(W),R(l),x?.(l);},[A,x]),y=useCallback(()=>{let W=kc(k);P(W),b?.(W);},[k,b]),[O,v]=useState(()=>g&&typeof window<"u"&&window.innerWidth<d),[ne,C]=useState(false);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=useCallback(W=>{W.target.closest("a")&&C(false);},[]),_=useRef(null),de=useRef({startX:0,startY:0,dragging:false}),pe=useCallback(W=>{let l=W.touches[0];de.current={startX:l.clientX,startY:l.clientY,dragging:true};},[]),Y=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=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=useMemo(()=>!O||!n?n:(W,l)=>{C(false),n(W,l);},[O,n]),me=jsxs(Fragment,{children:[a&&!O&&jsx("div",{className:i("flex shrink-0 mb-1",k==="expanded"?"justify-end":"justify-center"),children: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"?jsx(Menu,{className:"h-5 w-5"}):jsx(ChevronsLeft,{className:"h-4 w-4"})})}),(O||k==="expanded")&&jsxs(Fragment,{children:[t&&jsx("h2",{className:"text-primary-500 dark:text-primary-400 mb-3 text-sm font-semibold uppercase",children:t}),e.map(W=>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?jsx(Nc,{item:W,basePath:r,onItemClick:G,LinkComponent:o},l):jsx(Cc,{item:W,basePath:r,onItemClick:G,LinkComponent:o},l)})]});return g&&O?jsxs(Fragment,{children:[ne&&createPortal(jsx("div",{className:"fixed inset-0 z-40 bg-black/50",style:{top:f},onClick:()=>C(false)}),document.body),createPortal(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:[jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-primary-200 px-3 py-2 dark:border-primary-700",children:[jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-primary-500 dark:text-primary-400",children:"Navigation"}),jsx("button",{type:"button",onClick:W=>{W.stopPropagation(),C(false);},className:i(tr,"h-7 w-7 p-1"),"aria-label":"Close navigation",children:jsx(X,{className:"h-4 w-4"})})]}),jsx("div",{className:"flex-1 overflow-y-auto overscroll-y-contain p-3",children:jsx("nav",{className:"flex flex-col gap-0.5",children:me})})]}),document.body),!ne&&createPortal(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:jsx(ChevronRight,{className:"h-3.5 w-3.5"})}),document.body)]}):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 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?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:jsxs("span",{className:"flex items-center gap-2 [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",children:[h.icon,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 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:[jsxs("div",{className:"flex items-center gap-2 md:gap-6",children:[e&&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&&jsx(qt,{intent:"ghost",size:"sm",className:m,label:p??jsx(PanelLeft,{className:"h-5 w-5"}),items:f,align:"left",chevron:false,"aria-label":"Open navigation"}),r.length>0&&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?jsx(o,{href:h.href,className:N,onClick:h.onClick,children:h.label},k):jsx("button",{type:"button",className:i(N,"cursor-pointer"),onClick:h.onClick,children:h.label},k)})})]}),c&&jsx("div",{className:"flex items-center",children:c}),jsxs("div",{className:"flex items-center gap-1",children:[n.length>0&&jsx("div",{className:i("flex items-center gap-1",s?"hidden md:flex":"flex"),children:n.map((h,P)=>h.href?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):jsx("button",{type:"button",className:d,"aria-label":h.ariaLabel,onClick:h.onClick,children:h.icon},h.key??P))}),x&&jsx(qt,{intent:"ghost",size:"sm",className:m,label:b??jsx(MoreHorizontal,{className:"h-5 w-5"}),items:w,align:"right",chevron:false,"aria-label":"Open menu"})]})]})}var tn=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=>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:[jsx("path",{d:"M15 3h6v6"}),jsx("path",{d:"M10 14 21 3"}),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 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&&jsx(Ec,{})]})}var Pc={SideNav:To,Header:Ro,NavLink:Mo},So=Pc;var nn=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=cva("",{variants:{size:{sm:"pb-2 text-xs",md:"pb-3 text-sm",lg:"pb-4 text-base"}},defaultVariants:{size:"md"}}),an=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=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=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=createContext(null),Lo=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]=useState(t),T=r??u,x=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 jsx(cn.Provider,{value:{expandedItems:T,toggleItem:x,size:a},children:jsx("div",{className:i(an({intent:o}),s),...b,children:p})})}function Hc({value:e,className:t,children:r,...n}){let a=useContext(cn)?.expandedItems.includes(e)??false;return jsx(Lo.Provider,{value:{value:e,isExpanded:a},children:jsx("div",{className:i("",t),...n,children:r})})}function Fc({className:e,children:t,...r}){let n=useContext(cn),o=useContext(Lo);return 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:[jsx("span",{className:"flex items-center gap-1.5 [&_svg]:shrink-0",children:t}),jsx(ChevronDown,{className:i("shrink-0 transition-transform duration-200",o?.isExpanded&&"rotate-180")})]})}function Ac({className:e,children:t,...r}){let n=useContext(cn),o=useContext(Lo);return jsx("div",{className:i("grid transition-[grid-template-rows] duration-200 ease-out",o?.isExpanded?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children:jsx("div",{className:i("text-primary-500 dark:text-primary-400",on({size:n?.size}),e),...r,children:t})})})}var Mr=createContext(null),yi=createContext(false);function Po({defaultValue:e="",value:t,onValueChange:r,intent:n,children:o,className:a}){let[s,p]=useState(e),b=t??s,u=useRef(new Map),c=useCallback(x=>{r?r(x):p(x);},[r]),T=useCallback((x,m)=>{m?u.current.set(x,m):u.current.delete(x);},[]);return jsx(Mr.Provider,{value:{activeValue:b,setActiveValue:c,intent:n,registerTrigger:T},children:jsx("div",{className:a,children:o})})}function $c({className:e,scrollable:t,...r}){let n=useContext(Mr),o=useRef(null),[a,s]=useState(null),p=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]);useLayoutEffect(p,[n?.activeValue,p]),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 jsxs("div",{ref:o,className:i(sn({intent:n?.intent}),"relative",t&&"overflow-x-auto",e),role:"tablist",...r,children:[r.children,u&&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=useContext(Mr),a=o?.activeValue===e,s=useCallback(p=>o?.registerTrigger(e,p),[o,e]);return 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=useContext(Mr);if(!n)return null;let o=Nr.Children.toArray(t).filter(s=>Nr.isValidElement(s)),a=Math.max(0,o.findIndex(s=>s.props.value===n.activeValue));return jsx("div",{className:i("overflow-hidden",e),...r,children:jsx(yi.Provider,{value:true,children:jsx("div",{className:"flex transition-transform duration-300 ease-in-out",style:{transform:`translateX(-${a*100}%)`},children:o.map((s,p)=>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=useContext(Mr);return useContext(yi)?jsx("div",{className:i("pt-4",t),role:"tabpanel",...n,children:r}):o?.activeValue!==e?null:jsx("div",{className:i("pt-4",t),role:"tabpanel",...n,children:r})}var jc={Accordion:Eo,Tabs:Po},Vo=jc;var Sr=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=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=createContext(null);function Lr({open:e,onOpenChange:t,modal:r=true,closeOnOutsideClick:n=false,children:o}){let a=useId();return useEffect(()=>{if(e)return Zc(a),()=>Jc(a)},[e,a]),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]),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?jsx(Ho.Provider,{value:{id:a,onOpenChange:t,modal:r,closeOnOutsideClick:n},children:createPortal(o,document.body)}):null}function Fo({size:e,position:t="center",className:r,children:n,...o}){let a=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?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: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})}):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: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 jsx("div",{className:i("mb-4 space-y-1",e),...t})}function zo({className:e,...t}){return 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 jsx("p",{className:i("text-primary-500 dark:text-primary-400 text-sm",e),...t})}function _o({className:e,...t}){return jsx("div",{className:i("mt-6 flex justify-end gap-2",e),...t})}function ed({className:e,...t}){let r=useContext(Ho);return 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:jsx(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]=useState(false),[u,c]=useState();return jsxs("span",{className:"relative inline-flex",onMouseEnter:()=>{let m=setTimeout(()=>b(true),n);c(m);},onMouseLeave:()=>{clearTimeout(u),b(false);},children:[a,p&&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=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=cva("text-primary-500 dark:text-primary-400",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),Er=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 jsx("div",{className:i(Er({intent:e}),t),role:"alert",...n,children:r})}function fd({className:e,...t}){return 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 jsx("span",{className:i("mt-0.5 shrink-0 [&_svg]:h-5 [&_svg]:w-5",e),...t})}function hd({className:e,...t}){return jsx("div",{className:i("flex-1 min-w-0 space-y-1",e),...t})}function bd({className:e,...t}){return 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:CircleCheck,warning:TriangleAlert,error:CircleX,info:Info};function Td({alert:e,onClose:t}){let r=e.intent??"info",n=Cd[r],o=e.position??"top-right";return 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:[jsx(n,{className:"mt-0.5 h-5 w-5 shrink-0"}),jsxs("div",{className:"flex-1",children:[e.title&&jsx("p",{className:"font-semibold",children:e.title}),jsx("p",{className:i(e.title&&"text-sm opacity-90"),children:e.message})]}),jsx("button",{onClick:t,"aria-label":"Close notification",className:"shrink-0 cursor-pointer opacity-50 transition-opacity hover:opacity-100",children:jsx(X,{className:"h-4 w-4"})})]})}var Rd=e=>e.startsWith("top");function Md(){let e=useSyncExternalStore(n=>(Wo.add(n),()=>Wo.delete(n)),yd),t=useRef(jo);if(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 createPortal(jsx(Fragment,{children:Object.entries(r).map(([n,o])=>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=>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),createRoot(e).render(jsx(Md,{}));}function Ld(){return 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]=useState(0),m=useRef(0);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=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?jsx("div",{className:"progress-fill absolute top-0 h-full rounded-full animate-progress-indeterminate"}):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&&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"?createPortal(d,document.body):d}function fn({size:e}){let t=e==="sm"?20:e==="lg"?40:28;return 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: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?jsxs("div",{className:i("relative w-fit",n),...a,children:[jsx("div",{className:i("transition-all duration-200",e&&"pointer-events-none select-none blur-[1px]"),children:o}),e&&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:[jsx(fn,{size:r}),t&&jsx("span",{className:i(rr({size:r}),"select-none"),children:t})]})]}):e?jsxs("div",{className:i("inline-flex flex-col items-center gap-2",n),...a,children:[jsx(fn,{size:r}),t&&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(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 useEffect(()=>{let t=e.target;if(!Si(t))return Wd(t),()=>Xd(t)},[e.target]),Si(e.target)?createPortal(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:[jsx(fn,{size:"lg"}),e.tip&&jsx("span",{className:"select-none text-sm text-primary-100",children:e.tip})]}),document.body):createPortal(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:[jsx(fn,{size:"md"}),e.tip&&jsx("span",{className:i(rr({size:"md"}),"select-none"),children:e.tip})]}),e.target)}function Yd(){let e=useSyncExternalStore(t=>(Zo.add(t),()=>Zo.delete(t)),()=>Bd());return e.length===0?null:jsx(Fragment,{children:e.map(t=>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:jsx(Heart,{className:"h-5 w-5"}),activeIcon:jsx(Heart,{className:"h-5 w-5",fill:"currentColor"}),label:"Like",toggle:true},{key:"dislike",icon:jsx(ThumbsDown,{className:"h-5 w-5"}),label:"Dislike"},{key:"bookmark",icon:jsx(Bookmark,{className:"h-5 w-5"}),activeIcon:jsx(Bookmark,{className:"h-5 w-5",fill:"currentColor"}),label:"Bookmark",toggle:true},{key:"share",icon:jsx(Share2,{className:"h-5 w-5"}),label:"Share"},{key:"download",icon:jsx(Download,{className:"h-5 w-5"}),label:"Download"}];function ra({photos:e,layout:t="strip",actions:r=pm,onAction:n,className:o,showGrain:a=true,sheetTitle:s,sheetLabel:p}){let[b,u]=useState(null),[c,T]=useState(new Set),x=useCallback(f=>u(f),[]),m=useCallback(()=>u(null),[]),g=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 jsxs(Fragment,{children:[jsx(t==="strip"?um:t==="sheet"?fm:gm,{photos:e,onPhotoClick:x,showGrain:a,className:o,sheetTitle:s,sheetLabel:p}),b!==null&&createPortal(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 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)=>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=useRef(null);return jsxs("div",{className:i("select-none rounded-lg overflow-hidden",n),style:{background:Ii},children:[jsx(Vi,{count:Math.max(30,e.length*6)}),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)=>jsxs("div",{className:"group relative shrink-0 cursor-pointer",style:{scrollSnapAlign:"center"},onClick:()=>t(s),children:[jsxs("div",{className:"overflow-hidden rounded-xs border",style:{borderColor:ta,width:280,height:187},children:[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}),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&&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"}}),jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 transition-opacity duration-300 group-hover:opacity-50",style:{background:"radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%)"}})]}),jsxs("div",{className:"mt-0.5 text-center font-mono text-[9px] tracking-widest",style:{color:nr},children:[String(s+1).padStart(2,"0"),s%2===0?"":"A"]})]},s))}),jsx(Vi,{count:Math.max(30,e.length*6)})]})}function fm({photos:e,onPhotoClick:t,showGrain:r,className:n,sheetTitle:o,sheetLabel:a}){return jsxs("div",{className:i("rounded-lg p-5",n),style:{background:Ii},children:[jsxs("div",{className:"mb-4 flex items-center justify-between",children:[jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:nr},children:o??`JAC\xB7Film 35mm \xB7 ${e.length} exposures`}),jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em]",style:{color:nr},children:a??"Contact Sheet"})]}),jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6",children:e.map((s,p)=>jsxs("div",{className:"group cursor-pointer",style:{animation:`reveal-up 0.4s ease-out ${p*50}ms both`},onClick:()=>t(p),children:[jsx("div",{className:"mb-0.5 font-mono text-[9px] tracking-wider",style:{color:nr},children:String(p+1).padStart(2,"0")}),jsxs("div",{className:"relative overflow-hidden rounded-[1px] border transition-all duration-300 group-hover:border-amber-600/50 group-hover:shadow-[0_0_20px_rgba(217,171,89,0.15)]",style:{borderColor:ta,aspectRatio:"3/2"},children:[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&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:bn}}),jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 translate-y-full bg-linear-to-t from-black/70 to-transparent p-2 pt-6 transition-transform duration-300 group-hover:translate-y-0",children:jsx("span",{className:"text-xs font-medium text-white/90",children:s.title})})]})]},p))})]})}function gm({photos:e,onPhotoClick:t,showGrain:r,className:n}){let[o,a]=useState(false),[s,p]=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 jsxs("div",{className:i("flex flex-col items-center gap-4",n),children:[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)=>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: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:[jsx("img",{src:x.src,alt:x.alt??"",className:"h-full w-full object-cover",draggable:false}),r&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.04]",style:{backgroundImage:bn}}),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&&jsx("div",{className:"absolute inset-x-0 bottom-0 bg-linear-to-t from-black/80 to-transparent p-3 pt-8",style:{animation:"reveal-up 0.25s ease-out"},children:jsx("span",{className:"text-sm font-medium text-white/90",children:x.title})})]})},m))}),e.length>b&&jsxs("span",{className:"font-mono text-xs",style:{color:nr},children:["+ ",e.length-b," more"]}),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]=useState(1),[T,x]=useState({x:0,y:0}),[m,g]=useState(false),[d,f]=useState(false),w=useRef(false),h=useRef({x:0,y:0}),P=useRef(null);useLayoutEffect(()=>{requestAnimationFrame(()=>f(true));},[]),useEffect(()=>{let y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=y;}},[]),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)}),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=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=useCallback(y=>{u<=1||(w.current=true,h.current={x:y.clientX,y:y.clientY},y.target.setPointerCapture(y.pointerId));},[u]),F=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=useCallback(()=>{w.current=false;},[]),E=useCallback(()=>{u>1?(c(1),x({x:0,y:0})):c(2.5);},[u]),A=y=>a.has(`${t}-${y}`),H=b.metadata;return jsxs("div",{className:"fixed inset-0 z-200 flex flex-col",style:{animation:"lightbox-backdrop-in 0.35s ease-out"},children:[jsx("div",{className:"absolute inset-0 bg-black/95",onClick:n}),p&&jsx("div",{className:"pointer-events-none absolute inset-0 opacity-[0.025]",style:{backgroundImage:bn,animation:"film-grain-shift 0.6s steps(5) infinite"}}),jsxs("div",{className:"relative z-10 flex h-12 shrink-0 items-center justify-between px-4",children:[jsxs("span",{className:"font-mono text-sm text-white/50",children:[t+1," / ",e.length]}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("span",{className:"mr-2 font-mono text-xs text-white/40",children:[u.toFixed(1),"x"]}),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:jsx(ZoomIn,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:()=>{c(y=>{let O=Math.max(1,y*.7);return O<=1&&x({x:0,y:0}),O});},title:"Zoom out",children:jsx(ZoomOut,{className:"h-4 w-4"})}),jsx("button",{className:"rounded-full p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",onClick:n,title:"Close",children:jsx(X,{className:"h-5 w-5"})})]})]}),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:[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&&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:jsx(ChevronLeft,{className:"h-6 w-6"})}),t<e.length-1&&jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 rounded-full bg-black/40 p-2.5 text-white/70 backdrop-blur-sm transition-all hover:bg-black/60 hover:text-white",onClick:y=>{y.stopPropagation(),k(1);},children:jsx(ChevronRight,{className:"h-6 w-6"})})]}),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:jsxs("div",{className:"bg-linear-to-t from-black/90 via-black/75 to-transparent px-6 pb-24 pt-16",children:[b.title&&jsx("h3",{className:"mb-3 text-xl font-semibold text-white",children:b.title}),b.description&&jsx("p",{className:"mb-4 max-w-xl border-l-2 border-amber-500/40 pl-4 text-sm leading-relaxed text-white/60 italic",style:{animation:"reveal-up 0.4s ease-out 0.1s both"},children:b.description}),H&&jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm text-white/70",children:[H.camera&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Camera,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",H.camera,H.lens&&jsx("span",{className:"text-white/40",children:"\xB7"}),H.lens&&H.lens]}),(H.aperture||H.shutter||H.iso)&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(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&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(Calendar,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",H.date]}),H.location&&jsxs("span",{className:"flex items-center gap-1.5",children:[jsx(MapPin,{className:"h-3.5 w-3.5 text-amber-400/80"})," ",H.location]})]})]})}),jsx("div",{className:"relative z-20 flex h-16 shrink-0 items-center justify-center gap-1",children:jsxs("div",{className:"flex items-center gap-0.5 rounded-full bg-white/6 px-2 py-1.5 backdrop-blur-xl",children:[o.map(y=>{let O=y.toggle&&A(y.key);return 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)}),jsx("div",{className:"mx-1 h-5 w-px bg-white/10"}),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:jsx(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 Fo(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 ad(e){return e.startsWith("bottom")?"bottom":e.startsWith("top")?"top":"right"}var od={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"},sd={"bottom-right":"bottom-4 right-0","bottom-left":"bottom-4 left-0","top-right":"top-4 right-0","top-left":"top-4 left-0"},id={"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 wa({playlist:e,initialTrack:t=0,position:r="bottom-right",entrance:a,theme:s,docked:o=false,visible:i,onVisibleChange:d,onTrackChange:y,onLike:m,autoPlay:l=true,shuffle:w=false,loop:b=false,accent:p="#8b5cf6",className:v}){let [c,u]=useState(t),[k,g]=useState(false),[E,C]=useState(0),[R,$]=useState(0),[N,M]=useState(.8),[I,V]=useState(false),[x,K]=useState(new Set),[U,ie]=useState(false),[W,me]=useState(i??!o),[G,Q]=useState(false),[F,le]=useState(false),[_,P]=useState(w),[X$1,J]=useState(b),O=useRef(false),L=useRef(null),te=useRef(null),ee=useRef(void 0),re=useRef(null),ge=useRef(null),Pe=i??W,_e=a??ad(r),Y=e[c],ue=o,Te=s==="dark"?"dark":s==="light"?"light":"",He="bg-(--mp-bg)",ze="text-(--mp-text)",be="text-(--mp-text-muted)",Ke="text-(--accent)",fe="border-(--mp-border)";useEffect(()=>{let T=L.current;T&&(T.src=Y.src,T.load(),k&&T.play().catch(()=>{}));},[c,Y.src]),useEffect(()=>{if(!l||O.current)return;let T=L.current;if(!T)return;let Z=()=>{O.current=true,g(true),T.play().catch(()=>{});};return T.addEventListener("canplaythrough",Z,{once:true}),()=>T.removeEventListener("canplaythrough",Z)},[l]),useEffect(()=>{let T=L.current;T&&(k?T.play().catch(()=>{}):T.pause());},[k]),useEffect(()=>{let T=L.current;T&&(T.muted=I,ge.current?ge.current.gain.value=I?0:N:T.volume=N);},[N,I]),useEffect(()=>{let T=L.current;if(!T)return;let Z=()=>C(T.currentTime),ye=()=>$(T.duration),Oe=()=>{X$1?(T.currentTime=0,T.play().catch(()=>{})):$e();};return T.addEventListener("timeupdate",Z),T.addEventListener("loadedmetadata",ye),T.addEventListener("ended",Oe),()=>{T.removeEventListener("timeupdate",Z),T.removeEventListener("loadedmetadata",ye),T.removeEventListener("ended",Oe);}},[c,e.length]);let q=useCallback(T=>{let Z=(T%e.length+e.length)%e.length;u(Z),C(0),y?.(Z,e[Z]),Pe||(me(true),d?.(true));},[e,Pe,y,d]),$e=useCallback(()=>{if(_){let T;do T=Math.floor(Math.random()*e.length);while(T===c&&e.length>1);q(T);}else q(c+1);},[q,c,_,e.length]),ht=useCallback(()=>{if(_){let T;do T=Math.floor(Math.random()*e.length);while(T===c&&e.length>1);q(T);}else q(c-1);},[q,c,_,e.length]),vt=useCallback(()=>{let T=x.has(c);K(Z=>{let ye=new Set(Z);return T?ye.delete(c):ye.add(c),ye}),m?.(c,Y,!T);},[c,x,m,Y]),jt=useCallback(T=>{let Z=T.currentTarget.getBoundingClientRect(),Oe=Math.max(0,Math.min(1,(T.clientX-Z.left)/Z.width))*R;L.current&&(L.current.currentTime=Oe),C(Oe);},[R]),ke=useCallback(()=>{Q(true);let T=ue?200:400;ee.current=setTimeout(()=>{Q(false),me(false),d?.(false);},T);},[ue,d]);useEffect(()=>()=>{ee.current&&clearTimeout(ee.current);},[]),useEffect(()=>()=>{re.current?.close();},[]);function Le(){if(re.current||!L.current){re.current?.resume();return}try{let T=window.AudioContext??window.webkitAudioContext;if(!T)return;let Z=new T,ye=Z.createGain();ye.gain.value=I?0:N,Z.createMediaElementSource(L.current).connect(ye).connect(Z.destination),re.current=Z,ge.current=ye,Z.resume();}catch{}}let h=F?"fade-in 0.2s ease-out both":`mp-enter-${_e} 0.45s cubic-bezier(0.16, 1, 0.3, 1) both`,j=F?"fade-in 0.2s ease-in reverse both":`mp-exit-${_e} 0.4s cubic-bezier(0.7, 0, 0.84, 0) both`,ce=R>0?E/R*100:0;return ue&&!Pe&&!G?jsxs(Fragment,{children:[jsx("audio",{ref:L,preload:"metadata",crossOrigin:"anonymous"}),jsxs("div",{className:n("fixed z-100 cursor-pointer transition-all duration-300",id[r]),style:{"--accent":p},onMouseEnter:()=>{le(true),me(true),d?.(true);},children:[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&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!Pe&&!G?jsx("audio",{ref:L,preload:"metadata",crossOrigin:"anonymous"}):jsxs(Fragment,{children:[jsx("audio",{ref:L,preload:"metadata",crossOrigin:"anonymous"}),jsx("div",{className:n("fixed z-100",ue?sd[r]:od[r],Te),style:{"--accent":p,...G?{animation:j}:{animation:h}},onMouseEnter:()=>{ue&&(ee.current&&(clearTimeout(ee.current),ee.current=void 0),G&&Q(false),le(true));},onMouseLeave:()=>{ue&&(le(false),ke());},children:jsxs("div",{className:n("w-[320px] overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl",He,fe,ue&&"rounded-none",r.endsWith("right")&&ue&&"rounded-l-2xl",r.endsWith("left")&&ue&&"rounded-r-2xl",v),children:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:Y.cover||va,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:k?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:Y.cover||va,alt:Y.album??Y.title,className:"h-full w-full object-cover",draggable:false}),jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),k&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:n("truncate text-sm font-semibold",ze),children:Y.title}),Y.artist&&jsx("div",{className:n("truncate text-xs",be),children:Y.artist}),Y.album&&jsx("div",{className:n("mt-0.5 truncate text-[10px] tracking-wide",be,"opacity-60"),children:Y.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[jsx("button",{className:n("rounded-full p-1.5 transition-all duration-200",x.has(c)?"text-rose-500 hover:text-rose-400":n(be,"hover:text-rose-500")),onClick:vt,title:"Like",children:jsx(Heart,{className:"h-4 w-4",fill:x.has(c)?"currentColor":"none"})}),jsx("button",{className:n("rounded-full p-1.5 transition-colors",be,"hover:"+ze.split(" ")[0]),onClick:()=>ie(T=>!T),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!ue&&jsx("button",{className:n("rounded-full p-1.5 transition-colors",be,"hover:"+ze.split(" ")[0]),onClick:ke,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:te,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:jt,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${ce}%`}}),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(${ce}% - 6px)`}})]}),jsxs("div",{className:n("mt-1 flex justify-between text-[10px] font-mono",be),children:[jsx("span",{children:Fo(E)}),jsx("span",{children:Fo(R)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[jsx("button",{className:n("rounded-full p-1.5 transition-colors",_?Ke:be,"hover:text-(--mp-text)"),onClick:()=>P(T=>!T),title:_?"Shuffle On":"Shuffle Off",children:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),jsx("button",{className:n("rounded-full p-1.5 transition-colors",X$1?Ke:be,"hover:text-(--mp-text)"),onClick:()=>J(T=>!T),title:X$1?"Loop On":"Loop Off",children:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:n("rounded-full p-2 transition-colors",be,"hover:text-(--mp-text)"),onClick:ht,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),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:()=>{Le(),g(T=>!T);},title:k?"Pause":"Play",children:k?jsx(Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsx(Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:n("rounded-full p-2 transition-colors",be,"hover:text-(--mp-text)"),onClick:$e,title:"Next",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsx("button",{className:n("rounded-full p-1 transition-colors",be,"hover:text-(--mp-text)"),onClick:()=>{Le();let T=!I;V(T),ge.current&&(ge.current.gain.value=T?0:N);},title:I?"Unmute":"Mute",children:I||N===0?jsx(VolumeX,{className:"h-3.5 w-3.5"}):jsx(Volume2,{className:"h-3.5 w-3.5"})}),jsx("input",{type:"range",min:0,max:1,step:.01,value:I?0:N,onChange:T=>{Le();let Z=Number(T.target.value);M(Z),I&&V(false),ge.current&&(ge.current.gain.value=Z);},className:"mp-volume-slider h-1 w-14 cursor-pointer appearance-none rounded-full bg-(--mp-surface) accent-(--accent)"})]})]}),jsx("div",{className:n("overflow-hidden transition-all duration-300 ease-in-out",U?"max-h-60":"max-h-0"),children:jsx("div",{className:n("border-t px-2 py-2",fe),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((T,Z)=>{let ye=Z===c;return 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",ye?"bg-(--accent)/10 dark:bg-(--accent)/15":"hover:bg-(--mp-surface-hover)"),onClick:()=>{q(Z),g(true);},children:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:ye&&k?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(Oe=>jsx("div",{className:"w-0.75 rounded-full bg-(--accent)",style:{height:`${8+Oe*4}px`,animation:`mp-eq-bar ${.4+Oe*.15}s ease-in-out infinite alternate`}},Oe))}):ye?jsx(Disc3,{className:n("h-4 w-4",Ke)}):jsx("span",{className:n("text-xs font-mono",be),children:Z+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:T.cover||va,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:n("truncate text-xs font-medium",ye?Ke:ze),children:T.title}),T.artist&&jsx("div",{className:n("truncate text-[10px]",be),children:T.artist})]}),x.has(Z)&&jsx(Heart,{className:"h-3 w-3 shrink-0 text-rose-500",fill:"currentColor"})]},Z)})})})})]})})]})}function qr(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 Nd={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 Na({playlist:e,initialTrack:t=0,autoPlay:r=false,shuffle:a=false,loop:s=false,onTrackChange:o,onPlayChange:i,accent:d="#8b5cf6",className:y}){let[m,l]=useState(t),[w,b]=useState(false),[p,v]=useState(0),[c,u]=useState(0),[k,g]=useState(0),[E,C]=useState(.8),[R,$]=useState(false),[N,M]=useState(a),[I,V]=useState(s),[x,K]=useState(false),[U,ie]=useState("title"),[W,me]=useState(true),[G,Q]=useState(false),[F,le]=useState(false),[_,P]=useState(false),[X$1,J]=useState(true),[O,L]=useState(false),[te,ee]=useState(null),re=useRef(null),ge=useRef(null),Pe=useRef(void 0),_e=useRef(false),Y=e[m],yt=er.useMemo(()=>{let h=e.map((j,ce)=>({media:j,originalIndex:ce}));return h.sort((j,ce)=>{let T=Nd[U](j.media,ce.media);return W?T:-T}),h},[e,U,W]);useEffect(()=>{let h=re.current;if(!h)return;L(true),h.src=Y.src,Y.poster&&(h.poster=Y.poster),h.load();let j=()=>{L(false),w&&h.play().catch(()=>{});};return h.addEventListener("loadeddata",j,{once:true}),()=>h.removeEventListener("loadeddata",j)},[m,Y.src]),useEffect(()=>{if(!r||_e.current)return;let h=re.current;if(!h)return;let j=()=>{_e.current=true,b(true),h.play().catch(()=>{});};return h.addEventListener("canplaythrough",j,{once:true}),()=>h.removeEventListener("canplaythrough",j)},[r]),useEffect(()=>{let h=re.current;h&&(w?h.play().catch(()=>{}):h.pause(),i?.(w));},[w]),useEffect(()=>{let h=re.current;h&&(h.volume=R?0:E);},[E,R]),useEffect(()=>{let h=re.current;if(!h)return;let j=()=>v(h.currentTime),ce=()=>u(h.duration),T=()=>{h.buffered.length>0&&g(h.buffered.end(h.buffered.length-1));},Z=()=>{I?(h.currentTime=0,h.play().catch(()=>{})):He();};return h.addEventListener("timeupdate",j),h.addEventListener("loadedmetadata",ce),h.addEventListener("progress",T),h.addEventListener("ended",Z),()=>{h.removeEventListener("timeupdate",j),h.removeEventListener("loadedmetadata",ce),h.removeEventListener("progress",T),h.removeEventListener("ended",Z);}},[m,e.length,I]);let ue=useCallback(()=>{J(true),Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(()=>{w&&J(false);},3e3);},[w]);useEffect(()=>{w?ue():(J(true),Pe.current&&clearTimeout(Pe.current));},[w,ue]),useEffect(()=>()=>{Pe.current&&clearTimeout(Pe.current);},[]);let Te=useCallback(h=>{let j=(h%e.length+e.length)%e.length;l(j),v(0),b(true),o?.(j,e[j]);},[e,o]),He=useCallback(()=>{if(N){let h;do h=Math.floor(Math.random()*e.length);while(h===m&&e.length>1);Te(h);}else Te(m+1);},[Te,m,N,e.length]),ze=useCallback(()=>{if(N){let h;do h=Math.floor(Math.random()*e.length);while(h===m&&e.length>1);Te(h);}else Te(m-1);},[Te,m,N,e.length]),be=useCallback(h=>{let j=h.currentTarget.getBoundingClientRect(),T=Math.max(0,Math.min(1,(h.clientX-j.left)/j.width))*c;re.current&&(re.current.currentTime=T),v(T);},[c]),Ke=useCallback(h=>{let j=h.currentTarget.getBoundingClientRect(),ce=Math.max(0,Math.min(1,(h.clientX-j.left)/j.width));ee(ce*c);},[c]),fe=useCallback(()=>{ge.current&&(document.fullscreenElement?document.exitFullscreen():ge.current.requestFullscreen());},[]);useEffect(()=>{let h=()=>P(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",h),()=>document.removeEventListener("fullscreenchange",h)},[]);let q=useCallback(()=>{G?(le(true),setTimeout(()=>{Q(false),le(false);},500)):Q(true);},[G]),$e=useCallback(()=>{K(h=>!h);},[]),ht=useCallback(()=>{let h=["title","type","duration"],j=h.indexOf(U);W?me(false):(me(true),ie(h[(j+1)%h.length]));},[U,W]);useEffect(()=>{let h=j=>{if(!(j.target instanceof HTMLInputElement||j.target instanceof HTMLTextAreaElement))switch(j.key){case " ":case "k":j.preventDefault(),b(ce=>!ce);break;case "f":j.preventDefault(),fe();break;case "t":j.preventDefault(),q();break;case "ArrowLeft":j.preventDefault(),re.current&&(re.current.currentTime=Math.max(0,p-5));break;case "ArrowRight":j.preventDefault(),re.current&&(re.current.currentTime=Math.min(c,p+5));break;case "ArrowUp":j.preventDefault(),C(ce=>Math.min(1,ce+.05));break;case "ArrowDown":j.preventDefault(),C(ce=>Math.max(0,ce-.05));break;case "Escape":G&&q();break;case "n":j.preventDefault(),He();break;case "p":j.preventDefault(),ze();break;case "l":j.preventDefault(),$e();break}};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[fe,q,$e,He,ze,p,c,G]);let vt=c>0?p/c*100:0,jt=c>0?k/c*100:0,ke="text-(--accent)",Le=jsxs("div",{ref:ge,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]",y),style:{"--accent":d,background:"var(--cp-bg)"},tabIndex:0,children:[jsxs("div",{className:n("relative flex-1 min-w-0 h-full overflow-hidden",O&&"animate-[cp-track-transition_0.6s_ease-out]"),onMouseMove:ue,onMouseLeave:()=>{w&&J(false);},children:[jsx("video",{ref:re,className:"h-full w-full object-contain",poster:Y.poster,playsInline:true,preload:"metadata",onClick:()=>b(h=>!h)}),!w&&!O&&jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>b(true),children:jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full backdrop-blur-md transition-transform hover:scale-110 active:scale-95",style:{background:"var(--cp-surface-hover)"},children:jsx(Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),O&&!X$1&&jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:Y.title}),Y.subtitle&&jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:Y.subtitle})]})}),jsx("div",{className:n("absolute inset-x-0 top-0 z-10 bg-linear-to-b from-black/70 to-transparent px-5 pb-8 pt-4 transition-opacity duration-500",X$1?"opacity-100":"pointer-events-none opacity-0"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:Y.title}),Y.subtitle&&jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:Y.subtitle})]}),Y.type&&jsx("span",{className:"rounded-full bg-(--accent)/70 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider backdrop-blur-sm",style:{color:"var(--cp-text-strong)"},children:Y.type})]})}),jsxs("div",{className:n("absolute inset-x-0 bottom-0 z-10 bg-linear-to-t from-black/80 via-black/40 to-transparent px-4 pb-3 pt-10 transition-all duration-500",X$1?"translate-y-0 opacity-100":"pointer-events-none translate-y-2 opacity-0"),children:[jsxs("div",{className:"group/seek relative mb-3 h-1 cursor-pointer rounded-full transition-[height] duration-200 hover:h-1.5",style:{background:"var(--cp-seek-track)"},onClick:be,onMouseMove:Ke,onMouseLeave:()=>ee(null),children:[jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${jt}%`,background:"var(--cp-seek-buffer)"}}),jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${vt}%`}}),te!==null&&jsx("div",{className:"absolute -top-8 -translate-x-1/2 rounded px-2 py-0.5 text-[10px] font-mono",style:{left:`${te/c*100}%`,background:"var(--cp-panel-bg)",color:"var(--cp-text-strong)"},children:qr(te)}),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(${vt}% - 7px)`}})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{className:"cp-btn",onClick:()=>b(h=>!h),title:w?"Pause (k)":"Play (k)",children:w?jsx(Pause,{className:"h-5 w-5",fill:"currentColor"}):jsx(Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:ze,title:"Previous (p)",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:He,title:"Next (n)",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsx("button",{className:"cp-btn",onClick:()=>$(h=>!h),title:R?"Unmute":"Mute",children:R||E===0?jsx(VolumeX,{className:"h-4 w-4"}):jsx(Volume2,{className:"h-4 w-4"})}),jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsx("input",{type:"range",min:0,max:1,step:.01,value:R?0:E,onChange:h=>{C(Number(h.target.value)),R&&$(false);},className:"h-1 w-full cursor-pointer appearance-none rounded-full accent-(--accent)",style:{background:"var(--cp-seek-track)"}})})]}),jsxs("span",{className:"ml-2 min-w-0 shrink-0 font-mono text-xs",style:{color:"var(--cp-text-muted)"},children:[qr(p)," / ",qr(c)]}),jsx("div",{className:"flex-1"}),jsx("button",{className:n("cp-btn",N&&ke),onClick:()=>M(h=>!h),title:"Shuffle",children:jsx(Shuffle,{className:"h-4 w-4"})}),jsx("button",{className:n("cp-btn",I&&ke),onClick:()=>V(h=>!h),title:"Loop",children:jsx(Repeat1,{className:"h-4 w-4"})}),jsx("button",{className:n("cp-btn",x&&ke),onClick:$e,title:"Playlist",children:jsx(ListVideo,{className:"h-4 w-4"})}),jsx("button",{className:n("cp-btn",G&&ke),onClick:q,title:"Cinema mode (t)",children:jsx(Theater,{className:"h-4 w-4"})}),jsx("button",{className:"cp-btn",onClick:fe,title:"Fullscreen (f)",children:_?jsx(Minimize,{className:"h-4 w-4"}):jsx(Maximize,{className:"h-4 w-4"})})]})]})]}),jsx("div",{className:n("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",x?"w-72":"w-0"),children:jsxs("div",{className:"flex h-full w-72 flex-col backdrop-blur-xl",style:{borderLeft:"1px solid var(--cp-border)",background:"var(--cp-panel-bg)"},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("button",{className:"flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors",style:{color:"var(--cp-text-muted)"},onClick:ht,title:`Sort: ${U} ${W?"\u2191":"\u2193"}`,children:[jsx(ArrowUpDown,{className:"h-3 w-3"}),U,W?" \u2191":" \u2193"]}),jsx("button",{className:"cp-btn p-1!",onClick:$e,title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:yt.map(({media:h,originalIndex:j})=>{let ce=j===m;return jsxs("button",{className:n("flex w-full items-center gap-3 px-4 py-2.5 text-left transition-all duration-200",ce?"bg-(--accent)/20 text-(--accent)":"hover:text-(--cp-text-strong)"),style:ce?void 0:{color:"var(--cp-text)"},onClick:()=>{Te(j);},children:[jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[h.poster?jsx("img",{src:h.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsx(Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),ce&&w&&jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(T=>jsx("div",{className:"w-0.5 rounded-full bg-(--accent)",style:{height:`${6+T*3}px`,animation:`mp-eq-bar ${.3+T*.12}s ease-in-out infinite alternate`}},T))})})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:"truncate text-xs font-medium",children:h.title}),jsxs("div",{className:"flex items-center gap-2",children:[h.type&&jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:h.type}),h.duration!=null&&jsx("span",{className:"font-mono text-[10px] opacity-40",children:qr(h.duration)})]})]}),ce&&jsx(ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},j)})})]})}),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]=useState(t),[w,h]=useState(false),[P,k]=useState(0),[N,F]=useState(0),[R,E]=useState(.8),[A,H]=useState(false),[y,O]=useState(new Set),[v,ne]=useState(false),[C,re]=useState(s??!a),[_,de]=useState(false),[j,pe]=useState(false),[Y,V]=useState(T),[G,me]=useState(x),W=useRef(false),l=useRef(null),D=useRef(null),X$1=useRef(void 0),$=useRef(null),se=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)";useEffect(()=>{let I=l.current;I&&(I.src=S.src,I.load(),w&&I.play().catch(()=>{}));},[d,S.src]),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]),useEffect(()=>{let I=l.current;I&&(w?I.play().catch(()=>{}):I.pause());},[w]),useEffect(()=>{let I=l.current;I&&(I.muted=A,se.current?se.current.gain.value=A?0:R:I.volume=R);},[R,A]),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=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=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=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=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=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=useCallback(()=>{de(true);let I=oe?200:400;X$1.current=setTimeout(()=>{de(false),re(false),p?.(false);},I);},[oe,p]);useEffect(()=>()=>{X$1.current&&clearTimeout(X$1.current);},[]),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&&!_?jsxs(Fragment,{children:[jsx("audio",{ref:l,preload:"metadata",crossOrigin:"anonymous"}),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:[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&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/30",style:{animation:"mp-pulse-ring 2s ease-out infinite"}})]})]}):!ue&&!_?jsx("audio",{ref:l,preload:"metadata",crossOrigin:"anonymous"}):jsxs(Fragment,{children:[jsx("audio",{ref:l,preload:"metadata",crossOrigin:"anonymous"}),jsx("div",{className:i("fixed z-100",oe?Pm[r]:Em[r],he),style:{"--accent":m,..._?{animation:Z}:{animation:L}},onMouseEnter:()=>{oe&&(X$1.current&&(clearTimeout(X$1.current),X$1.current=void 0),_&&de(false),pe(true));},onMouseLeave:()=>{oe&&(pe(false),K());},children: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:[jsxs("div",{className:"relative",children:[jsx("div",{className:"absolute inset-0 overflow-hidden",children:jsx("img",{src:S.cover||na,alt:"",className:"h-full w-full scale-110 object-cover opacity-30 blur-2xl",draggable:false})}),jsxs("div",{className:"relative flex items-center gap-3.5 p-4 pb-3",children:[jsxs("div",{className:"relative h-14 w-14 shrink-0",children:[jsxs("div",{className:"h-14 w-14 overflow-hidden rounded-full border-2 border-white/10 shadow-lg",style:w?{animation:"mp-vinyl-spin 4s linear infinite"}:void 0,children:[jsx("img",{src:S.cover||na,alt:S.album??S.title,className:"h-full w-full object-cover",draggable:false}),jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsx("div",{className:"h-3 w-3 rounded-full bg-black/60 ring-1 ring-white/10"})})]}),w&&jsx("div",{className:"absolute inset-0 rounded-full bg-(--accent)/20",style:{animation:"mp-pulse-ring 2.5s ease-out infinite"}})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:i("truncate text-sm font-semibold",Re),children:S.title}),S.artist&&jsx("div",{className:i("truncate text-xs",ye),children:S.artist}),S.album&&jsx("div",{className:i("mt-0.5 truncate text-[10px] tracking-wide",ye,"opacity-60"),children:S.album})]}),jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[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:jsx(Heart,{className:"h-4 w-4",fill:y.has(d)?"currentColor":"none"})}),jsx("button",{className:i("rounded-full p-1.5 transition-colors",ye,"hover:"+Re.split(" ")[0]),onClick:()=>ne(I=>!I),title:"Playlist",children:jsx(ListMusic,{className:"h-4 w-4"})}),!oe&&jsx("button",{className:i("rounded-full p-1.5 transition-colors",ye,"hover:"+Re.split(" ")[0]),onClick:K,title:"Dismiss",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]})]}),jsxs("div",{className:"px-4",children:[jsxs("div",{ref:D,className:"group relative h-1.5 cursor-pointer rounded-full bg-(--mp-surface)",onClick:He,children:[jsx("div",{className:"h-full rounded-full bg-(--accent) transition-[width] duration-150",style:{width:`${ee}%`}}),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)`}})]}),jsxs("div",{className:i("mt-1 flex justify-between text-[10px] font-mono",ye),children:[jsx("span",{children:Fi(P)}),jsx("span",{children:Fi(N)})]})]}),jsxs("div",{className:"flex items-center justify-center gap-2 px-4 pb-3 pt-1",children:[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:jsx(Shuffle,{className:"h-3.5 w-3.5"})}),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:jsx(Repeat1,{className:"h-3.5 w-3.5"})}),jsx("button",{className:i("rounded-full p-2 transition-colors",ye,"hover:text-(--mp-text)"),onClick:be,title:"Previous",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),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?jsx(Pause,{className:"h-4.5 w-4.5",fill:"currentColor"}):jsx(Play,{className:"h-4.5 w-4.5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:i("rounded-full p-2 transition-colors",ye,"hover:text-(--mp-text)"),onClick:q,title:"Next",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"ml-2 flex items-center gap-1.5",children:[jsx("button",{className: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?jsx(VolumeX,{className:"h-3.5 w-3.5"}):jsx(Volume2,{className:"h-3.5 w-3.5"})}),jsx("input",{type:"range",min:0,max:1,step:.01,value: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)"})]})]}),jsx("div",{className:i("overflow-hidden transition-all duration-300 ease-in-out",v?"max-h-60":"max-h-0"),children:jsx("div",{className:i("border-t px-2 py-2",J),children:jsx("div",{className:"max-h-52 space-y-0.5 overflow-y-auto",children:e.map((I,ge)=>{let Fe=ge===d;return 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:[jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center",children:Fe&&w?jsx("div",{className:"flex items-end gap-0.5",children:[1,2,3].map(tt=>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?jsx(Disc3,{className:i("h-4 w-4",z)}):jsx("span",{className:i("text-xs font-mono",ye),children:ge+1})}),jsx("div",{className:"h-8 w-8 shrink-0 overflow-hidden rounded",children:jsx("img",{src:I.cover||na,alt:"",className:"h-full w-full object-cover",draggable:false})}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:i("truncate text-xs font-medium",Fe?z:Re),children:I.title}),I.artist&&jsx("div",{className:i("truncate text-[10px]",ye),children:I.artist})]}),y.has(ge)&&jsx(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]=useState(t),[T,x]=useState(false),[m,g]=useState(0),[d,f]=useState(0),[w,h]=useState(0),[P,k]=useState(.8),[N,F]=useState(false),[R,E]=useState(n),[A,H]=useState(o),[y,O]=useState(false),[v,ne]=useState("title"),[C,re]=useState(true),[_,de]=useState(false),[j,pe]=useState(false),[Y,V]=useState(false),[G,me]=useState(true),[W,l]=useState(false),[D,X$1]=useState(null),$=useRef(null),se=useRef(null),ue=useRef(void 0),Te=useRef(false),S=e[u],ce=Nr.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]);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]),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]),useEffect(()=>{let L=$.current;L&&(T?L.play().catch(()=>{}):L.pause(),s?.(T));},[T]),useEffect(()=>{let L=$.current;L&&(L.volume=N?0:P);},[P,N]),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=useCallback(()=>{me(true),ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>{T&&me(false);},3e3);},[T]);useEffect(()=>{T?oe():(me(true),ue.current&&clearTimeout(ue.current));},[T,oe]),useEffect(()=>()=>{ue.current&&clearTimeout(ue.current);},[]);let he=useCallback(L=>{let Z=(L%e.length+e.length)%e.length;c(Z),g(0),x(true),a?.(Z,e[Z]);},[e,a]),fe=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=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=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=useCallback(L=>{let Z=L.currentTarget.getBoundingClientRect(),ee=Math.max(0,Math.min(1,(L.clientX-Z.left)/Z.width));X$1(ee*d);},[d]),J=useCallback(()=>{se.current&&(document.fullscreenElement?document.exitFullscreen():se.current.requestFullscreen());},[]);useEffect(()=>{let L=()=>V(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",L),()=>document.removeEventListener("fullscreenchange",L)},[]);let B=useCallback(()=>{_?(pe(true),setTimeout(()=>{de(false),pe(false);},500)):de(true);},[_]),q=useCallback(()=>{O(L=>!L);},[]),be=useCallback(()=>{let L=["title","type","duration"],Z=L.indexOf(v);C?re(false):(re(true),ne(L[(Z+1)%L.length]));},[v,C]);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=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:[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:[jsx("video",{ref:$,className:"h-full w-full object-contain",poster:S.poster,playsInline:true,preload:"metadata",onClick:()=>x(L=>!L)}),!T&&!W&&jsx("div",{className:"absolute inset-0 flex cursor-pointer items-center justify-center",style:{background:"var(--cp-overlay)"},onClick:()=>x(true),children:jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full backdrop-blur-md transition-transform hover:scale-110 active:scale-95",style:{background:"var(--cp-surface-hover)"},children:jsx(Play,{className:"h-10 w-10 translate-x-0.5",fill:"currentColor",style:{color:"var(--cp-text-strong)"}})})}),W&&!G&&jsx("div",{className:"absolute left-6 top-6 z-20 animate-[fade-in_0.4s_ease-out]",children:jsxs("div",{className:"rounded-lg px-4 py-2 backdrop-blur-md",style:{background:"var(--cp-panel-bg)"},children:[jsx("div",{className:"text-sm font-semibold",style:{color:"var(--cp-text-strong)"},children:S.title}),S.subtitle&&jsx("div",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:S.subtitle})]})}),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:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold drop-shadow-md",style:{color:"var(--cp-text-strong)"},children:S.title}),S.subtitle&&jsx("p",{className:"text-xs",style:{color:"var(--cp-text-muted)"},children:S.subtitle})]}),S.type&&jsx("span",{className:"rounded-full bg-(--accent)/70 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider backdrop-blur-sm",style:{color:"var(--cp-text-strong)"},children:S.type})]})}),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:[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$1(null),children:[jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${He}%`,background:"var(--cp-seek-buffer)"}}),jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-(--accent) transition-[width] duration-100",style:{width:`${De}%`}}),D!==null&&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)}),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)`}})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{className:"cp-btn",onClick:()=>x(L=>!L),title:T?"Pause (k)":"Play (k)",children:T?jsx(Pause,{className:"h-5 w-5",fill:"currentColor"}):jsx(Play,{className:"h-5 w-5 translate-x-px",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:Re,title:"Previous (p)",children:jsx(SkipBack,{className:"h-4 w-4",fill:"currentColor"})}),jsx("button",{className:"cp-btn",onClick:fe,title:"Next (n)",children:jsx(SkipForward,{className:"h-4 w-4",fill:"currentColor"})}),jsxs("div",{className:"group/vol ml-1 flex items-center",children:[jsx("button",{className:"cp-btn",onClick:()=>F(L=>!L),title:N?"Unmute":"Mute",children:N||P===0?jsx(VolumeX,{className:"h-4 w-4"}):jsx(Volume2,{className:"h-4 w-4"})}),jsx("div",{className:"flex w-0 items-center overflow-hidden transition-all duration-300 group-hover/vol:w-20",children:jsx("input",{type:"range",min:0,max:1,step:.01,value: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)"}})})]}),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)]}),jsx("div",{className:"flex-1"}),jsx("button",{className:i("cp-btn",R&&K),onClick:()=>E(L=>!L),title:"Shuffle",children:jsx(Shuffle,{className:"h-4 w-4"})}),jsx("button",{className:i("cp-btn",A&&K),onClick:()=>H(L=>!L),title:"Loop",children:jsx(Repeat1,{className:"h-4 w-4"})}),jsx("button",{className:i("cp-btn",y&&K),onClick:q,title:"Playlist",children:jsx(ListVideo,{className:"h-4 w-4"})}),jsx("button",{className:i("cp-btn",_&&K),onClick:B,title:"Cinema mode (t)",children:jsx(Theater,{className:"h-4 w-4"})}),jsx("button",{className:"cp-btn",onClick:J,title:"Fullscreen (f)",children:Y?jsx(Minimize,{className:"h-4 w-4"}):jsx(Maximize,{className:"h-4 w-4"})})]})]})]}),jsx("div",{className:i("h-full shrink-0 overflow-hidden transition-[width] duration-300 ease-out",y?"w-72":"w-0"),children:jsxs("div",{className:"flex h-full w-72 flex-col backdrop-blur-xl",style:{borderLeft:"1px solid var(--cp-border)",background:"var(--cp-panel-bg)"},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--cp-border)"},children:[jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--cp-text)"},children:"Playlist"}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("button",{className:"flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors",style:{color:"var(--cp-text-muted)"},onClick:be,title:`Sort: ${v} ${C?"\u2191":"\u2193"}`,children:[jsx(ArrowUpDown,{className:"h-3 w-3"}),v,C?" \u2191":" \u2193"]}),jsx("button",{className:"cp-btn p-1!",onClick:q,title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto",children:ce.map(({media:L,originalIndex:Z})=>{let ee=Z===u;return 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:[jsxs("div",{className:"relative h-10 w-16 shrink-0 overflow-hidden rounded",style:{background:"var(--cp-surface)"},children:[L.poster?jsx("img",{src:L.poster,alt:"",className:"h-full w-full object-cover",draggable:false}):jsx("div",{className:"flex h-full w-full items-center justify-center",children:jsx(Play,{className:"h-4 w-4",style:{color:"var(--cp-seek-track)"}})}),ee&&T&&jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{background:"var(--cp-overlay)"},children:jsx("div",{className:"flex items-end gap-px",children:[1,2,3,4].map(I=>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))})})]}),jsxs("div",{className:"min-w-0 flex-1",children:[jsx("div",{className:"truncate text-xs font-medium",children:L.title}),jsxs("div",{className:"flex items-center gap-2",children:[L.type&&jsx("span",{className:"text-[10px] uppercase tracking-wide opacity-50",children:L.type}),L.duration!=null&&jsx("span",{className:"font-mono text-[10px] opacity-40",children:yn(L.duration)})]})]}),ee&&jsx(ChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-(--accent)"})]},Z)})})]})}),jsx("style",{children:`
|
|
8
8
|
.cp-btn {
|
|
9
9
|
display: flex;
|
|
10
10
|
align-items: center;
|
|
@@ -20,7 +20,7 @@ import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'cl
|
|
|
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 jsx("div",{className:n(G&&"fixed inset-0 z-100 flex items-center justify-center p-8",G&&(F?"animate-[cp-cinema-out_0.5s_ease-in_both]":"animate-[cp-cinema-in_0.5s_ease-out_both]")),onClick:G?h=>{h.target===h.currentTarget&&q();}:void 0,children:jsx("div",{className:n(G&&"w-full",G&&!_&&"max-w-5xl"),children:Le})})}function Yr(e){let t=e.lastIndexOf(".");return t>0?e.slice(t).toLowerCase():""}function $o(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 Ma(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 Hd={".png":Image,".jpg":Image,".jpeg":Image,".gif":Image,".svg":Image,".webp":Image,".ico":Image,".bmp":Image,".mp3":Music,".wav":Music,".flac":Music,".ogg":Music,".aac":Music,".m4a":Music,".mp4":Video,".mkv":Video,".avi":Video,".mov":Video,".wmv":Video,".webm":Video,".ts":FileCode,".tsx":FileCode,".js":FileCode,".jsx":FileCode,".json":FileCode,".html":FileCode,".css":FileCode,".scss":FileCode,".py":FileCode,".rs":FileCode,".go":FileCode,".java":FileCode,".c":FileCode,".cpp":FileCode,".h":FileCode,".sh":Terminal,".bat":Terminal,".ps1":Terminal,".md":FileText,".txt":FileText,".pdf":FileText,".doc":FileText,".docx":FileText,".rtf":FileText,".csv":FileSpreadsheet,".xls":FileSpreadsheet,".xlsx":FileSpreadsheet,".db":Database,".sqlite":Database,".sql":Database,".zip":FileArchive,".tar":FileArchive,".gz":FileArchive,".rar":FileArchive,".7z":FileArchive};function Pa(e){if(e.type==="directory")return Folder;let t=e.extension||Yr(e.name);return Hd[t]||File}function Kt(e,t,r){return Math.max(t,Math.min(r,e))}function jo(e){return e<480?"xs":e<640?"sm":e<1024?"md":"lg"}function Go(e,t){if(e<480)return {size:{width:e-16,height:t-48},pos:{x:8,y:24}};if(e<640){let s=e-24,o=Math.min(t-64,540);return {size:{width:s,height:o},pos:{x:12,y:32}}}if(e<1024){let s=Math.min(640,e-32),o=Math.min(480,t-64);return {size:{width:s,height:o},pos:{x:Math.max(0,Math.round((e-s)/2)),y:Math.max(0,Math.round((t-o)/2))}}}let r=720,a=520;return {size:{width:r,height:a},pos:{x:Math.max(0,Math.round((e-r)/2)),y:Math.max(0,Math.round((t-a)/2))}}}function La({files:e,title:t="File Explorer",accent:r="#8b5cf6",defaultView:a="list",initialPosition:s,initialSize:o,dockable:i=false,dockSide:d="right",visible:y=true,onFileOpen:m,onSelectionChange:l,onNavigate:w,onDelete:b,onClose:p,onMinimize:v,onPathSubmit:c,defaultInputMode:u="search",actions:k,resizable:g=true,minSize:E={width:400,height:300},className:C}){let[R,$]=useState(a),[N,M]=useState(new Set),[I,V]=useState(null),[x,K]=useState(false),[U,ie]=useState(false),[W,me]=useState(""),[G,Q]=useState(u),[F,le]=useState(y),[_,P]=useState(false),[X$1,J]=useState({w:window.innerWidth,h:window.innerHeight}),O=Go(window.innerWidth,window.innerHeight),[L,te]=useState(s??O.pos),[ee,re]=useState(o??O.size),[ge,Pe]=useState(null),_e=useRef(false),Y=useRef({x:0,y:0}),yt=useRef(null),ue=useRef(false),Te=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),He=useRef(false),ze=useRef(x);useEffect(()=>{ze.current=x;},[x]);let be=y!==void 0?y:F,Ke=useMemo(()=>{let f=e.filter(ne=>ne.type==="directory"),H=e.filter(ne=>ne.type==="file");return f.sort((ne,ae)=>ne.name.localeCompare(ae.name)),H.sort((ne,ae)=>ne.name.localeCompare(ae.name)),[...f,...H]},[e]),fe=useMemo(()=>{if(G!=="search"||!W.trim())return Ke;let f=W.toLowerCase();return Ke.filter(H=>H.name.toLowerCase().includes(f))},[Ke,W,G]),q=I!=null?fe[I]:null;useEffect(()=>{let f=jo(window.innerWidth),H=()=>{let ne=window.innerWidth,ae=window.innerHeight;if(J({w:ne,h:ae}),ze.current)return;let pe=jo(ne);if(pe!==f&&!He.current&&!o){let Fe=Go(ne,ae);re(Fe.size),te(Fe.pos);}f=pe;};return window.addEventListener("resize",H),()=>window.removeEventListener("resize",H)},[o]);let $e=useCallback((f,H)=>{M(ne=>{let ae=new Set(ne);return H.ctrlKey||H.metaKey?ae.has(f)?ae.delete(f):ae.add(f):(ae.clear(),ae.add(f)),ae}),V(f);},[]);useEffect(()=>{if(!l)return;let f=Array.from(N).map(H=>fe[H]).filter(Boolean);l(f);},[N]);let ht=useCallback(f=>{let H=fe[f];H&&(H.type==="directory"?w?.(H.path):m?.(H));},[fe,m,w]),vt=useCallback(f=>{x||f.target.closest("button")||(He.current=true,_e.current=true,Y.current={x:f.clientX-L.x,y:f.clientY-L.y},f.preventDefault());},[L,x]),jt=useCallback(f=>{if(x||f.target.closest("button"))return;He.current=true;let H=f.touches[0];_e.current=true,Y.current={x:H.clientX-L.x,y:H.clientY-L.y};},[L,x]);useEffect(()=>{let f=ae=>{if(!_e.current)return;let pe=window.innerWidth-100,Fe=window.innerHeight-40;te({x:Kt(ae.clientX-Y.current.x,0,pe),y:Kt(ae.clientY-Y.current.y,0,Fe)});},H=ae=>{if(!_e.current)return;ae.preventDefault();let pe=ae.touches[0],Fe=window.innerWidth-100,st=window.innerHeight-40;te({x:Kt(pe.clientX-Y.current.x,0,Fe),y:Kt(pe.clientY-Y.current.y,0,st)});},ne=()=>{_e.current=false,ue.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",f),window.addEventListener("mouseup",ne),window.addEventListener("touchmove",H,{passive:false}),window.addEventListener("touchend",ne),()=>{window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",ne),window.removeEventListener("touchmove",H),window.removeEventListener("touchend",ne);}},[]);let ke=useCallback((f,H)=>{x||(H.preventDefault(),H.stopPropagation(),He.current=true,ue.current=f,Te.current={x:H.clientX,y:H.clientY,w:ee.width,h:ee.height,px:L.x,py:L.y},document.body.style.cursor=f==="e"||f==="w"?"ew-resize":f==="n"||f==="s"?"ns-resize":f==="nw"||f==="se"?"nwse-resize":"nesw-resize",document.body.style.userSelect="none");},[x,ee,L]),Le=useCallback((f,H)=>{if(x)return;H.preventDefault(),H.stopPropagation(),He.current=true;let ne=H.touches[0];ue.current=f,Te.current={x:ne.clientX,y:ne.clientY,w:ee.width,h:ee.height,px:L.x,py:L.y},document.body.style.userSelect="none";},[x,ee,L]);useEffect(()=>{let f=(pe,Fe)=>{let st=ue.current;if(!st)return;let Oa=pe-Te.current.x,Ba=Fe-Te.current.y,{w:wt,h:kt,px:Jr,py:en}=Te.current;if(st.includes("e")&&(wt=Math.max(E.width,wt+Oa)),st.includes("w")){let Gt=Math.max(E.width,wt-Oa);Jr=Jr+(wt-Gt),wt=Gt;}if(st.includes("s")&&(kt=Math.max(E.height,kt+Ba)),st.includes("n")){let Gt=Math.max(E.height,kt-Ba);en=en+(kt-Gt),kt=Gt;}re({width:wt,height:kt}),te({x:Jr,y:en});},H=pe=>{ue.current&&f(pe.clientX,pe.clientY);},ne=pe=>{ue.current&&(pe.preventDefault(),f(pe.touches[0].clientX,pe.touches[0].clientY));},ae=()=>{ue.current=false,document.body.style.cursor="",document.body.style.userSelect="";};return window.addEventListener("mousemove",H),window.addEventListener("mouseup",ae),window.addEventListener("touchmove",ne,{passive:false}),window.addEventListener("touchend",ae),()=>{window.removeEventListener("mousemove",H),window.removeEventListener("mouseup",ae),window.removeEventListener("touchmove",ne),window.removeEventListener("touchend",ae);}},[E]);let h=useCallback(()=>{x?(ge&&(te(ge.pos),re(ge.size)),K(false)):(Pe({pos:L,size:ee}),K(true));},[x,L,ee,ge]),j=useCallback(()=>{U?ie(false):(x&&(K(false),ge&&(te(ge.pos),re(ge.size))),ie(true),v?.());},[U,x,ge,v]);useEffect(()=>{if(!be||U)return;let f=H=>{if(!(!yt.current?.contains(document.activeElement)&&document.activeElement!==yt.current)){if(H.key==="Escape"&&(V(null),M(new Set)),H.ctrlKey&&H.key==="a"){H.preventDefault();let ne=new Set(fe.map((ae,pe)=>pe));M(ne);}H.key==="Delete"&&N.size>0&&b&&(H.preventDefault(),P(true));}};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[be,U,fe,N,b]);let ce={"--fe-accent":r};if(U)return jsx("div",{className:n("fixed z-100 cursor-pointer transition-all duration-300",d==="right"?"right-0 top-1/2 -translate-y-1/2":"left-0 top-1/2 -translate-y-1/2"),style:ce,onClick:()=>ie(false),title:`Restore ${t}`,children:jsxs("div",{className:"fe-dock flex items-center gap-1.5 rounded-l-lg px-2 py-3 backdrop-blur-md",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:[jsx(HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})});if(!be)return null;let T=x?X$1.w:Math.min(ee.width,X$1.w-8),Z=x?X$1.h:Math.min(ee.height,X$1.h-8),ye=x?0:Kt(L.x,0,Math.max(0,X$1.w-T)),Oe=x?0:Kt(L.y,0,Math.max(0,X$1.h-40)),Qr=T<500;return jsxs("div",{ref:yt,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]",x&&"rounded-none",C),style:{...ce,left:ye,top:Oe,width:T,height:Z,transition:x?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":void 0},tabIndex:0,children:[jsxs("div",{className:"fe-titlebar group/titlebar flex h-10 shrink-0 cursor-grab items-center justify-between px-3 select-none active:cursor-grabbing",onMouseDown:vt,onTouchStart:jt,onDoubleClick:h,children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:"color-mix(in srgb, var(--fe-accent) 25%, transparent)"},children:jsx(HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{className:"fe-btn mr-1",onClick:()=>$(f=>f==="list"?"grid":"list"),title:R==="list"?"Grid view":"List view",children:R==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),i&&jsx("button",{className:"fe-btn",onClick:j,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:h,title:x?"Restore":"Maximize",children:x?jsx(Minimize2,{className:"h-3.5 w-3.5"}):jsx(Maximize2,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{p?.(),le(false);},title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsx("button",{className:"fe-btn p-1",onClick:()=>w?.(".."),title:"Go up",children:jsx(FolderUp,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:G==="navigate"?{color:"var(--fe-accent)",background:"color-mix(in srgb, var(--fe-accent) 15%, transparent)"}:void 0,onClick:()=>Q(f=>f==="search"?"navigate":"search"),title:G==="search"?"Switch to path navigation":"Switch to file search",children:G==="search"?jsx(Search,{className:"h-3 w-3"}):jsx(CornerRightDown,{className:"h-3 w-3"})}),jsx("div",{className:"relative flex-1",children:jsx("input",{type:"text",value:W,onChange:f=>me(f.target.value),onKeyDown:f=>{f.key==="Enter"&&W.trim()&&G==="navigate"&&(c?c(W.trim()):w?.(W.trim()));},placeholder:G==="search"?"Search files\u2026":"Enter path and press Enter\u2026",className:"h-6 w-full rounded border border-(--fe-input-border) bg-(--fe-input-bg) px-2 text-[11px] text-(--fe-text-strong) placeholder:text-(--fe-text-muted) outline-none transition-colors focus:border-(--fe-accent)/40 focus:bg-(--fe-input-bg)"})}),jsxs("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:[fe.length," item",fe.length!==1?"s":"",N.size>0&&` \xB7 ${N.size} selected`]})]}),jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:f=>{f.target===f.currentTarget&&(M(new Set),V(null));},children:fe.length===0?jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsx(Folder,{className:"mb-2 h-10 w-10"}),jsx("span",{className:"text-xs",children:"No files found"})]}):R==="list"?jsx("div",{className:"space-y-px",children:fe.map((f,H)=>{let ne=Pa(f),ae=N.has(H),pe=f.extension||Yr(f.name);return 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",ae?"bg-(--fe-accent)/15 text-(--fe-text-strong)":"hover:bg-(--fe-surface-hover) hover:text-(--fe-text-strong)"),style:ae?{boxShadow:"inset 2px 0 0 var(--fe-accent)"}:void 0,onClick:Fe=>$e(H,Fe),onDoubleClick:()=>ht(H),children:[jsx(ne,{className:n("h-4 w-4 shrink-0",f.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:f.name}),pe&&f.type==="file"&&jsx("span",{className:"shrink-0 rounded bg-(--fe-badge-bg) px-1.5 py-0.5 font-mono text-[9px] uppercase text-(--fe-text-muted)",children:pe}),f.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:$o(f.size)}),f.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:Ma(f.modifiedAt)})]},f.path+H)})}):jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(90px,1fr))] gap-1.5 p-1",children:fe.map((f,H)=>{let ne=Pa(f),ae=N.has(H),pe=f.extension||Yr(f.name);return 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",ae?"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:Fe=>$e(H,Fe),onDoubleClick:()=>ht(H),children:[jsx(ne,{className:n("h-7 w-7",f.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:f.name}),pe&&f.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:pe})]},f.path+H)})})}),jsx("div",{className:n("overflow-hidden transition-[width,opacity] duration-300 ease-out",Qr?n("absolute right-0 top-0 bottom-0 z-10",q?"w-44 opacity-100":"w-0 opacity-0 pointer-events-none"):n("shrink-0",q?"w-56":"w-0")),children:q&&jsxs("div",{className:n("flex h-full flex-col p-4",Qr?"fe-panel-narrow w-44":"fe-panel w-56 border-l border-(--fe-border)"),children:[Qr&&jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{V(null),M(new Set);},title:"Close panel",children:jsx(X,{className:"h-3.5 w-3.5"})}),jsxs("div",{className:"mb-3 flex flex-col items-center",children:[er.createElement(Pa(q),{className:n("h-10 w-10 mb-2",q.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:q.name})]}),jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsx($t,{label:"Type",value:q.type==="directory"?"Directory":q.mimeType||q.extension||Yr(q.name)||"File"}),q.size!=null&&jsx($t,{label:"Size",value:$o(q.size)}),jsx($t,{label:"Path",value:q.path,mono:true}),q.extension&&jsx($t,{label:"Extension",value:q.extension}),q.modifiedAt&&jsx($t,{label:"Modified",value:Ma(q.modifiedAt)}),q.createdAt&&jsx($t,{label:"Created",value:Ma(q.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[q.type==="file"&&m&&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:()=>m(q),children:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),k?.map(f=>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:()=>f.onClick(q),children:[f.icon&&er.createElement(f.icon,{className:"h-3 w-3"}),f.label]},f.key))]})]})})]}),jsxs("div",{className:"fe-statusbar flex h-6 shrink-0 items-center justify-between px-3 text-[9px] font-mono text-(--fe-text-muted)",children:[jsxs("span",{children:[fe.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[N.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[N.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),g&&!x&&jsxs(Fragment,{children:[jsx("div",{className:"absolute top-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:f=>ke("n",f),onTouchStart:f=>Le("n",f)}),jsx("div",{className:"absolute bottom-0 left-4 right-4 h-3 cursor-ns-resize",onMouseDown:f=>ke("s",f),onTouchStart:f=>Le("s",f)}),jsx("div",{className:"absolute top-4 left-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:f=>ke("w",f),onTouchStart:f=>Le("w",f)}),jsx("div",{className:"absolute top-4 right-0 bottom-4 w-3 cursor-ew-resize",onMouseDown:f=>ke("e",f),onTouchStart:f=>Le("e",f)}),jsx("div",{className:"absolute top-0 left-0 h-6 w-6 cursor-nwse-resize",onMouseDown:f=>ke("nw",f),onTouchStart:f=>Le("nw",f)}),jsx("div",{className:"absolute top-0 right-0 h-6 w-6 cursor-nesw-resize",onMouseDown:f=>ke("ne",f),onTouchStart:f=>Le("ne",f)}),jsx("div",{className:"absolute bottom-0 left-0 h-6 w-6 cursor-nesw-resize",onMouseDown:f=>ke("sw",f),onTouchStart:f=>Le("sw",f)}),jsx("div",{className:"absolute bottom-0 right-0 h-6 w-6 cursor-nwse-resize",onMouseDown:f=>ke("se",f),onTouchStart:f=>Le("se",f)})]}),jsx("style",{children:`
|
|
23
|
+
`})]});return 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: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":Image,".jpg":Image,".jpeg":Image,".gif":Image,".svg":Image,".webp":Image,".ico":Image,".bmp":Image,".mp3":Music,".wav":Music,".flac":Music,".ogg":Music,".aac":Music,".m4a":Music,".mp4":Video,".mkv":Video,".avi":Video,".mov":Video,".wmv":Video,".webm":Video,".ts":FileCode,".tsx":FileCode,".js":FileCode,".jsx":FileCode,".json":FileCode,".html":FileCode,".css":FileCode,".scss":FileCode,".py":FileCode,".rs":FileCode,".go":FileCode,".java":FileCode,".c":FileCode,".cpp":FileCode,".h":FileCode,".sh":Terminal,".bat":Terminal,".ps1":Terminal,".md":FileText,".txt":FileText,".pdf":FileText,".doc":FileText,".docx":FileText,".rtf":FileText,".csv":FileSpreadsheet,".xls":FileSpreadsheet,".xlsx":FileSpreadsheet,".db":Database,".sqlite":Database,".sql":Database,".zip":FileArchive,".tar":FileArchive,".gz":FileArchive,".rar":FileArchive,".7z":FileArchive};function ma(e){if(e.type==="directory")return Folder;let t=e.extension||vn(e.name);return sp[t]||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]=useState(n),[R,E]=useState(new Set),[A,H]=useState(null),[y,O]=useState(false),[v,ne]=useState(false),[C,re]=useState(""),[_,de]=useState(f),[j,pe]=useState(b),[Y,V]=useState(false),[G,me]=useState({w:window.innerWidth,h:window.innerHeight}),W=Wi(window.innerWidth,window.innerHeight),[l,D]=useState(o??W.pos),[X$1,$]=useState(a??W.size),[se,ue]=useState(null),Te=useRef(false),S=useRef({x:0,y:0}),ce=useRef(null),oe=useRef(false),he=useRef({x:0,y:0,w:0,h:0,px:0,py:0}),fe=useRef(false),Re=useRef(y);useEffect(()=>{Re.current=y;},[y]);let ye=b!==void 0?b:j,z=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=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;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=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);},[]);useEffect(()=>{if(!c)return;let M=Array.from(R).map(ae=>J[ae]).filter(Boolean);c(M);},[R]);let be=useCallback(M=>{let ae=J[M];ae&&(ae.type==="directory"?T?.(ae.path):u?.(ae));},[J,u,T]),De=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=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]);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=useCallback((M,ae)=>{y||(ae.preventDefault(),ae.stopPropagation(),fe.current=true,oe.current=M,he.current={x:ae.clientX,y:ae.clientY,w:X$1.width,h:X$1.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$1,l]),xe=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$1.width,h:X$1.height,px:l.x,py:l.y},document.body.style.userSelect="none";},[y,X$1,l]);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=useCallback(()=>{y?(se&&(D(se.pos),$(se.size)),O(false)):(ue({pos:l,size:X$1}),O(true));},[y,l,X$1,se]),Z=useCallback(()=>{v?ne(false):(y&&(O(false),se&&(D(se.pos),$(se.size))),ne(true),g?.());},[v,y,se,g]);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 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:jsxs("div",{className:"fe-dock flex items-center gap-1.5 rounded-l-lg px-2 py-3 backdrop-blur-md",style:{writingMode:"vertical-rl",textOrientation:"mixed"},children:[jsx(HardDrive,{className:"h-3.5 w-3.5 text-(--fe-accent)"}),jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-(--fe-text)",children:t})]})});if(!ye)return null;let I=y?G.w:Math.min(X$1.width,G.w-8),ge=y?G.h:Math.min(X$1.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 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:[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:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded",style:{background:"color-mix(in srgb, var(--fe-accent) 25%, transparent)"},children:jsx(HardDrive,{className:"h-3 w-3 text-(--fe-accent)"})}),jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-(--fe-text)",children:t}),jsx("div",{className:"ml-2 hidden h-px w-20 md:block",style:{background:"linear-gradient(90deg, var(--fe-accent), transparent)",opacity:.3}})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{className:"fe-btn mr-1",onClick:()=>F(M=>M==="list"?"grid":"list"),title:N==="list"?"Grid view":"List view",children:N==="list"?jsx(LayoutGrid,{className:"h-3.5 w-3.5"}):jsx(LayoutList,{className:"h-3.5 w-3.5"})}),s&&jsx("button",{className:"fe-btn",onClick:Z,title:"Dock to edge",children:jsx(Minus,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn",onClick:L,title:y?"Restore":"Maximize",children:y?jsx(Minimize2,{className:"h-3.5 w-3.5"}):jsx(Maximize2,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn hover:bg-red-500/40! hover:text-red-300!",onClick:()=>{m?.(),pe(false);},title:"Close",children:jsx(X,{className:"h-3.5 w-3.5"})})]})]}),jsxs("div",{className:"fe-toolbar flex h-9 shrink-0 items-center gap-2 px-3",children:[jsx("button",{className:"fe-btn p-1",onClick:()=>T?.(".."),title:"Go up",children:jsx(FolderUp,{className:"h-3.5 w-3.5"})}),jsx("button",{className:"fe-btn shrink-0 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:_==="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"?jsx(Search,{className:"h-3 w-3"}):jsx(CornerRightDown,{className:"h-3 w-3"})}),jsx("div",{className:"relative flex-1",children:jsx("input",{type:"text",value: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)"})}),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`]})]}),jsxs("div",{className:"relative flex flex-1 min-h-0",children:[jsx("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-1.5",onClick:M=>{M.target===M.currentTarget&&(E(new Set),H(null));},children:J.length===0?jsxs("div",{className:"flex h-full flex-col items-center justify-center text-(--fe-text-muted)",children:[jsx(Folder,{className:"mb-2 h-10 w-10"}),jsx("span",{className:"text-xs",children:"No files found"})]}):N==="list"?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 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:[jsx(we,{className:i("h-4 w-4 shrink-0",M.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"flex-1 truncate text-xs font-medium",children:M.name}),Ee&&M.type==="file"&&jsx("span",{className:"shrink-0 rounded bg-(--fe-badge-bg) px-1.5 py-0.5 font-mono text-[9px] uppercase text-(--fe-text-muted)",children:Ee}),M.size!=null&&jsx("span",{className:"shrink-0 font-mono text-[10px] text-(--fe-text-muted)",children:Oi(M.size)}),M.modifiedAt&&jsx("span",{className:"hidden shrink-0 font-mono text-[10px] text-(--fe-text-muted) lg:inline",children:da(M.modifiedAt)})]},M.path+ae)})}):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 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:[jsx(we,{className:i("h-7 w-7",M.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full truncate text-[10px] font-medium leading-tight",children:M.name}),Ee&&M.type==="file"&&jsx("span",{className:"font-mono text-[8px] uppercase text-(--fe-text-muted)",children:Ee})]},M.path+ae)})})}),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&&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&&jsx("button",{className:"fe-btn mb-2 self-end",onClick:()=>{H(null),E(new Set);},title:"Close panel",children:jsx(X,{className:"h-3.5 w-3.5"})}),jsxs("div",{className:"mb-3 flex flex-col items-center",children:[Nr.createElement(ma(B),{className:i("h-10 w-10 mb-2",B.type==="directory"?"text-(--fe-accent)":"text-(--fe-text-muted)")}),jsx("span",{className:"w-full text-center text-xs font-semibold text-(--fe-text-strong) break-all leading-tight",children:B.name})]}),jsxs("div",{className:"space-y-2.5 text-[10px]",children:[jsx(mr,{label:"Type",value:B.type==="directory"?"Directory":B.mimeType||B.extension||vn(B.name)||"File"}),B.size!=null&&jsx(mr,{label:"Size",value:Oi(B.size)}),jsx(mr,{label:"Path",value:B.path,mono:true}),B.extension&&jsx(mr,{label:"Extension",value:B.extension}),B.modifiedAt&&jsx(mr,{label:"Modified",value:da(B.modifiedAt)}),B.createdAt&&jsx(mr,{label:"Created",value:da(B.createdAt)})]}),jsxs("div",{className:"mt-auto flex flex-col gap-1.5",children:[B.type==="file"&&u&&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:[jsx(ArrowUp,{className:"h-3 w-3 rotate-45"}),"Open"]}),w?.map(M=>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.createElement(M.icon,{className:"h-3 w-3"}),M.label]},M.key))]})]})})]}),jsxs("div",{className:"fe-statusbar flex h-6 shrink-0 items-center justify-between px-3 text-[9px] font-mono text-(--fe-text-muted)",children:[jsxs("span",{children:[J.length," items"]}),jsxs("div",{className:"flex items-center gap-2",children:[R.size>0&&jsxs("span",{className:"text-(--fe-accent)/70",children:[R.size," selected"]}),jsx("span",{className:"opacity-50",children:"Ctrl+Click multi-select \xB7 Esc clear"})]})]}),h&&!y&&jsxs(Fragment,{children:[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)}),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)}),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)}),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)}),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)}),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)}),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)}),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)})]}),jsx("style",{children:`
|
|
24
24
|
.fe-window {
|
|
25
25
|
background: var(--fe-bg);
|
|
26
26
|
box-shadow: var(--fe-shadow);
|
|
@@ -81,4 +81,4 @@ import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'cl
|
|
|
81
81
|
from { opacity: 0; transform: translateX(-4px); }
|
|
82
82
|
to { opacity: 1; transform: translateX(0); }
|
|
83
83
|
}
|
|
84
|
-
`}),jsx(sr,{open:_,onOpenChange:P,children:jsxs(Jn,{size:"sm",children:[jsxs(ea,{children:[jsxs(ta,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),jsxs(ra,{children:[N.size===1?`Are you sure you want to delete "${fe[Array.from(N)[0]]?.name}"?`:`Are you sure you want to delete ${N.size} selected items?`," ","This action cannot be undone."]})]}),jsxs(na,{children:[jsx(Tt,{intent:"ghost",onClick:()=>P(false),children:"Cancel"}),jsxs(Tt,{intent:"danger",onClick:()=>{let f=Array.from(N).map(H=>fe[H]).filter(Boolean);b?.(f),M(new Set),V(null),P(false);},children:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function $t({label:e,value:t,mono:r}){return jsxs("div",{children:[jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),jsx("div",{className:n("text-(--fe-text) break-all leading-snug",r&&"font-mono text-[9px]"),children:t})]})}function zd(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,i=document.createElement("span");i.className="masonry-ripple",i.style.width=`${a}px`,i.style.height=`${a}px`,i.style.left=`${s}px`,i.style.top=`${o}px`,t.appendChild(i),i.addEventListener("animationend",()=>i.remove());}function Da({columns:e,columnWidth:t=240,gap:r=16,items:a,onItemClick:s,className:o,style:i,children:d,...y}){let m=useRef(null),l=useRef([]),[w,b]=useState(()=>e??1),[p,v]=useState([]),[c,u]=useState(0),k=a?a.map((N,M)=>({key:N.key??M,node:N.content})):er.Children.toArray(d).map((N,M)=>({key:N.key??M,node:N})),g=k.length,E=useCallback(N=>e??Math.max(1,Math.floor((N+r)/(t+r))),[e,t,r]),C=useCallback(()=>{let N=m.current;if(!N)return;let M=N.clientWidth,I=E(M);b(I);let V=(M-(I-1)*r)/I,x=new Array(I).fill(0),K=[];for(let ie=0;ie<g;ie++){let W=l.current[ie],me=W?W.offsetHeight:0,G=0;for(let Q=1;Q<I;Q++)x[Q]<x[G]&&(G=Q);K.push({top:x[G],left:G*(V+r),width:V}),x[G]+=me+r;}let U=Math.max(0,...x)-(g?r:0);v(K),u(U);},[g,E,r]);useEffect(()=>{let N=m.current;if(!N)return;let M=new ResizeObserver(()=>C());return M.observe(N),()=>M.disconnect()},[C]),useEffect(()=>{let N=requestAnimationFrame(C);return ()=>cancelAnimationFrame(N)},[C]),useEffect(()=>{let N=new ResizeObserver(()=>C());return l.current.forEach(M=>{M&&N.observe(M);}),()=>N.disconnect()},[g,w,C]);let R=useCallback((N,M)=>{let I=N.currentTarget;zd(N,I),s?.(a?.[M],M);},[s,a]),$=N=>{if(!a)return false;let M=a[N];return !!(M.title||M.description||M.actions)};return jsx("div",{ref:m,className:n("relative",o),style:{...i,height:c},...y,children:k.map((N,M)=>jsxs("div",{ref:I=>{l.current[M]=I;},className:"masonry-item",role:"button",tabIndex:0,onClick:I=>R(I,M),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),s?.(a?.[M],M));},style:{position:"absolute",top:p[M]?.top??0,left:p[M]?.left??0,width:p[M]?.width??"100%"},children:[N.node,$(M)&&jsxs("div",{className:"masonry-item-overlay",children:[a[M].title&&jsx("p",{className:"masonry-item-overlay-title",children:a[M].title}),a[M].description&&jsx("p",{className:"masonry-item-overlay-desc",children:a[M].description}),a[M].actions&&jsx("div",{className:"masonry-item-overlay-actions",children:a[M].actions})]})]},N.key))})}var Od={FilmReel:ha,MiniPlayer:wa,CinePlayer:Na,FileExplorer:La,Masonry:Da},Ia=Od;var qo=cva("w-full",{variants:{intent:{default:"",card:"rounded-(--form-radius) border border-primary-200 bg-white p-6 shadow-sm dark:border-primary-700 dark:bg-primary-900",inset:"rounded-(--form-radius) bg-primary-50 p-6 dark:bg-primary-800/50"},size:{sm:"",md:"",lg:""}},defaultVariants:{intent:"default",size:"md"}});cva("flex w-full",{variants:{layout:{stacked:"flex-col gap-1.5",inline:"flex-row items-start gap-(--form-item-gap-md)"},size:{sm:"",md:"",lg:""}},defaultVariants:{layout:"stacked",size:"md"}});var Yo=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 Fa=createContext({layout:"stacked",size:"md",labelWidth:"var(--form-label-w-md, 7rem)",bulkErrors:{}}),Wd={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 _a({children:e,className:t,intent:r,size:a="md",layout:s="stacked",title:o,description:i,footer:d,onValues:y,onSubmit:m,...l}){let w=Wd[a??"md"],[b,p]=useState({}),v=useCallback(c=>{if(c.preventDefault(),m?.(c),y){let u=Object.fromEntries(new FormData(c.currentTarget).entries()),k=y(u,c),g=E=>{if(!E)return;let C={};for(let[R,{result:$,reason:N}]of Object.entries(E))N&&(C[R]={status:$?"success":"error",message:N});p(C);};k instanceof Promise?k.then(g).catch(()=>{}):g(k);}},[m,y]);return jsx(Fa.Provider,{value:{layout:s??"stacked",size:a??"md",labelWidth:w,bulkErrors:b},children:jsxs("form",{className:n(qo({intent:r,size:a}),"flex flex-col",t),onSubmit:v,...l,children:[(o||i)&&jsxs("div",{className:"mb-(--form-header-mb)",children:[o&&jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:o}),i&&jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:i})]}),jsx("div",{className:n("flex flex-col",es[a??"md"]),children:e}),d&&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:d})]})})}var Ud={error:jsx(AlertCircle,{}),warning:jsx(AlertTriangle,{}),success:jsx(CheckCircle,{}),hint:jsx(Info,{})};function qd({label:e,layout:t,required:r,hint:a,validation:s,name:o,onValidate:i,className:d,children:y}){let m=useContext(Fa),l=useId(),[w,b]=useState(void 0),p=o?m.bulkErrors[o]:void 0,v=s??w??p,u=(t??m.layout)==="inline",k=useCallback($=>{let N=$!=null&&typeof $=="object"&&"target"in $?$.target.value:$;if(o&&m.bulkErrors[o]&&(m.bulkErrors[o]=void 0),!i){b(void 0);return}let{result:M,reason:I}=i(N);b(I?{status:M?"success":"error",message:I}:void 0);},[i,o,m.bulkErrors]),g=v?`${l}-validation`:a?`${l}-hint`:void 0,E=er.Children.map(y,($,N)=>{if(N!==0||!er.isValidElement($))return $;let M=$,I={};if(M.props.id||(I.id=l),g&&!M.props["aria-describedby"]&&(I["aria-describedby"]=g),v?.status==="error"&&!M.props["aria-invalid"]&&(I["aria-invalid"]=true),o&&!M.props.name&&(I.name=o),i){let V=M.props.onChange;I.onChange=x=>{V?.(x),k(x);};}return Object.keys(I).length?er.cloneElement(M,I):$}),C=e!=null&&jsx("label",{htmlFor:l,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-['*']",u&&"pt-1.75"),style:u?{width:m.labelWidth,minWidth:m.labelWidth}:void 0,children:e}),R=s?`${l}-validation`:a?`${l}-hint`:void 0;return jsxs("div",{className:n("flex w-full flex-col gap-1.5",u&&"md:flex-row md:items-start md:gap-(--form-item-gap-md)",d),children:[C,jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[E,v&&jsxs("p",{id:`${l}-validation`,className:n(Yo({status:v.status})),role:v.status==="error"?"alert":void 0,children:[Ud[v.status],jsx("span",{children:v.message})]}),a&&jsx("p",{id:R===`${l}-hint`?R:void 0,className:"mt-1 text-xs text-primary-400 dark:text-primary-500",children:a})]})]})}function Yd({title:e,description:t,className:r,children:a}){let{size:s}=useContext(Fa);return jsxs("fieldset",{className:n("flex flex-col rounded-(--form-radius) border border-primary-200 p-4 dark:border-primary-700",es[s],r),children:[(e||t)&&jsxs("legend",{className:"px-1.5 pb-1",children:[e&&jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:e}),t&&jsx("span",{className:"ml-2 text-xs text-primary-400 dark:text-primary-500",children:t})]}),a]})}var Zd={Form:_a},za=Zd;var Qd={Primitives:wn,Layout:Rn,DataDisplay:zn,Navigation:Gn,Disclosure:qn,Overlay:oa,Feedback:ba,Extras:Ia,Forms:za},gg=Qd;export{Wn as Accordion,ml as AccordionContent,dl as AccordionItem,pl as AccordionTrigger,da as Alert,Gl as AlertContent,Xl as AlertDescription,jl as AlertIcon,$l as AlertTitle,mn as Badge,Tt as Button,kn as Card,Ys as CardContent,qs as CardDescription,Zs as CardFooter,Ws as CardHeader,Us as CardTitle,In as Chat,yn as Checkbox,Na as CinePlayer,_n as CodeBlock,zn as DataDisplay,vi as DataTable,sr as Dialog,Ll as DialogClose,Jn as DialogContent,ra as DialogDescription,na as DialogFooter,ea as DialogHeader,ta as DialogTitle,qn as Disclosure,on as Dropdown,Pt as DropdownButton,Ia as Extras,ba as Feedback,La as FileExplorer,ha as FilmReel,_a as Form,qd as FormItem,Yd as FormSection,za as Forms,$n as Header,Qs as HorizontalCard,Nn as ImageCard,ni as ImageCardActions,ei as ImageCardBody,ri as ImageCardDescription,ti as ImageCardTitle,un as Indicator,gn as Input,fn as Label,Rn as Layout,Sn as List,Ni as ListItem,Da as Masonry,wa as MiniPlayer,jn as NavLink,Gn as Navigation,oa as Overlay,Cn as Panel,oi as PanelContent,ai as PanelHeader,wn as Primitives,ua as ProgressBar,vn as Radio,hn as RadioGroup,Kn as SideNav,yi as SortableTable,ga as Spin,xn as Switch,hl as TabContent,bl as TabList,yl as TabPanels,xl as TabTrigger,Jt as Table,Ln as TableBody,dt as TableCell,En as TableEmpty,ct as TableHead,Pn as TableHeader,Qt as TableRow,Un as Tabs,bn as TextBox,aa as Tooltip,Vn as Tree,Ei as TreeItem,Ar as accordionContentVariants,Ir as accordionTriggerVariants,Hr as accordionVariants,ir as alertVariants,pr as badgeVariants,Nt as buttonVariants,Ut as cardVariants,fr as checkboxVariants,n as cn,Yt as codeBlockVariants,Yl as configureAlertTopOffset,gg as default,or as dialogContentVariants,mr as indicatorVariants,Ct as inputVariants,ur as labelVariants,Rr as listItemVariants,Tr as listVariants,Vr as navLinkVariants,Nr as panelVariants,Kr as progressBarVariants,gr as radioVariants,It as spinVariants,br as switchTrackVariants,Fr as tabListVariants,_r as tabTriggerVariants,Cr as tableVariants,Br as tooltipVariants,Mr as treeItemVariants,ac as useAlert,xc as useSpin};
|
|
84
|
+
`}),jsx(Lr,{open:Y,onOpenChange:V,children:jsxs(Fo,{size:"sm",children:[jsxs(Ao,{children:[jsxs(zo,{children:[jsx(AlertTriangle,{className:"text-danger-500"}),"Confirm Deletion"]}),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."]})]}),jsxs(_o,{children:[jsx(Yt,{intent:"ghost",onClick:()=>V(false),children:"Cancel"}),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:[jsx(Trash2,{className:"h-4 w-4"}),"Delete"]})]})]})})]})}function mr({label:e,value:t,mono:r}){return jsxs("div",{children:[jsx("div",{className:"mb-0.5 font-semibold uppercase tracking-wider text-(--fe-text-muted)",children:e}),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=useRef(null),c=useRef([]),[T,x]=useState(()=>e??1),[m,g]=useState([]),[d,f]=useState(0),w=n?n.map((R,E)=>({key:R.key??E,node:R.content})):Nr.Children.toArray(p).map((R,E)=>({key:R.key??E,node:R})),h=w.length,P=useCallback(R=>e??Math.max(1,Math.floor((R+r)/(t+r))),[e,t,r]),k=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]);useEffect(()=>{let R=u.current;if(!R)return;let E=new ResizeObserver(()=>k());return E.observe(R),()=>E.disconnect()},[k]),useEffect(()=>{let R=requestAnimationFrame(k);return ()=>cancelAnimationFrame(R)},[k]),useEffect(()=>{let R=new ResizeObserver(()=>k());return c.current.forEach(E=>{E&&R.observe(E);}),()=>R.disconnect()},[h,T,k]);let N=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 jsx("div",{ref:u,className:i("relative",a),style:{...s,height:d},...b,children:w.map((R,E)=>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)&&jsxs("div",{className:"masonry-item-overlay",children:[n[E].title&&jsx("p",{className:"masonry-item-overlay-title",children:n[E].title}),n[E].description&&jsx("p",{className:"masonry-item-overlay-desc",children:n[E].description}),n[E].actions&&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]=useState(t==="instant"?e:""),[m,g]=useState(false),[d,f]=useState(t==="instant"),[w,h]=useState(false),P=useRef(0),k=useRef(b);k.current=b;let N=useRef(e);N.current=e,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]),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]),useEffect(()=>{t==="instant"&&(x(e),g(false),f(true));},[e,t]);let F=useRef(s);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 jsxs(u,{className:i(c),children:[a&&!T&&jsx("span",{"aria-hidden":"true",children:"\u200B"}),T,R&&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=cva("w-full",{variants:{intent:{default:"",card:"rounded-(--form-radius) border border-primary-200 bg-white p-6 shadow-sm dark:border-primary-700 dark:bg-primary-900",inset:"rounded-(--form-radius) bg-primary-50 p-6 dark:bg-primary-800/50"},size:{sm:"",md:"",lg:""}},defaultVariants:{intent:"default",size:"md"}});cva("flex w-full",{variants:{layout:{stacked:"flex-col gap-1.5",inline:"flex-row items-start gap-(--form-item-gap-md)"},size:{sm:"",md:"",lg:""}},defaultVariants:{layout:"stacked",size:"md"}});var qi=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=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]=useState({}),g=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 jsx(va.Provider,{value:{layout:o??"stacked",size:n??"md",labelWidth:T,bulkErrors:x},children:jsxs("form",{className:i(Ui({intent:r,size:n}),"flex flex-col",t),onSubmit:g,...c,children:[(a||s)&&jsxs("div",{className:"mb-(--form-header-mb)",children:[a&&jsx("h2",{className:"text-base font-semibold text-primary-900 dark:text-primary-100",children:a}),s&&jsx("p",{className:"mt-1 text-xs text-primary-500 dark:text-primary-400",children:s})]}),jsx("div",{className:i("flex flex-col",es[n??"md"]),children:e}),p&&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:jsx(AlertCircle,{}),warning:jsx(AlertTriangle,{}),success:jsx(CheckCircle,{}),hint:jsx(Info,{})};function wp({label:e,layout:t,required:r,hint:n,validation:o,name:a,onValidate:s,className:p,children:b}){let u=useContext(va),c=useId(),[T,x]=useState(void 0),m=a?u.bulkErrors[a]:void 0,g=o??T??m,f=(t??u.layout)==="inline",w=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.Children.map(b,(F,R)=>{if(R!==0||!Nr.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.cloneElement(E,A):F}),k=e!=null&&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 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,jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[P,g&&jsxs("p",{id:`${c}-validation`,className:i(qi({status:g.status})),role:g.status==="error"?"alert":void 0,children:[vp[g.status],jsx("span",{children:g.message})]}),n&&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}=useContext(va);return 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)&&jsxs("legend",{className:"px-1.5 pb-1",children:[e&&jsx("span",{className:"text-sm font-semibold text-primary-700 dark:text-primary-300",children:e}),t&&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=cva("relative w-full font-sans select-none",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),mt=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=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]=useState(()=>new Set(e)),n=useCallback(s=>{r(p=>{let b=new Set(p);return b.has(s)?b.delete(s):b.add(s),b});},[]),o=useCallback(s=>t.has(s),[t]),a=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 jsx("div",{className:mt({position:t}),children:e.map(n=>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:[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=useRef(null),w=useRef(null),[h,P]=useState(600),[k,N]=useState(null),[F,R]=useState(null);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=useMemo(()=>e.map(S=>S.id),[e]),{visible:A,toggle:H,isVisible:y}=Rt(E),O=useMemo(()=>Mt(e.length),[e.length]),v=useMemo(()=>new Map(e.map((S,ce)=>[S.id,S.color??O[ce]])),[e,O]),ne=useMemo(()=>Lt(!!t?.label,!!r?.label,!!n),[t?.label,r?.label,n]),C=useMemo(()=>Et(h,c,ne),[h,c,ne]),re=useMemo(()=>os(e),[e]),_=useMemo(()=>re?ts(e,A):[],[e,A,re]),de=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=useMemo(()=>Ta(e,A,r),[e,A,r]),pe=useMemo(()=>Rn(j,[C.plotBottom,C.plotTop]),[j,C]),Y=useMemo(()=>Sn(j,r?.tickCount??5),[j,r?.tickCount]),V=useMemo(()=>{if(!n)return null;let S=e.filter(ce=>o.includes(ce.id));return Ta(S,A,n)},[n,e,o,A]),G=useMemo(()=>V?Rn(V,[C.plotBottom,C.plotTop]):null,[V,C]),me=useMemo(()=>V?Sn(V,n?.tickCount??5):[],[V,n?.tickCount]),W=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=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=useCallback(()=>{N(null),R(null);},[]),X=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]),$=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=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 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 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?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):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)=>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&&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)"}}),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 jsxs("g",{children:[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"}),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&&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&&jsxs(Fragment,{children:[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 jsxs("g",{children:[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"}),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&&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})]}),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 jsxs("g",{children:[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"}),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&&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}),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 jsxs("div",{ref:f,className:i(dt(),T),children:[u&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:u}),x&&m==="top"&&jsx(Ln,{items:$,position:"top",onToggle:H}),jsxs("div",{className:i("flex items-start",Te&&"gap-0"),children:[x&&m==="left"&&jsx(Ln,{items:$,position:"left",onToggle:H}),jsx("div",{ref:w,className:"flex-1 min-w-0 overflow-hidden",children:se?ue:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:c},children:d})}),x&&m==="right"&&jsx(Ln,{items:$,position:"right",onToggle:H})]}),x&&m==="bottom"&&jsx(Ln,{items:$,position:"bottom",onToggle:H}),k&&jsxs("div",{className:pt(),style:{left:k.x,top:k.y},role:"tooltip",children:[k.label&&jsx("div",{className:"mb-1 font-medium text-primary-200",children:k.label}),k.items.map((S,ce)=>jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:S.color}}),jsxs("span",{className:"text-primary-300",children:[S.name,":"]}),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 jsx("div",{className:mt({position:t}),children:e.map(n=>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:[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=useRef(null),f=useRef(null),[w,h]=useState(600),[P,k]=useState(null);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=useMemo(()=>e.map(l=>l.id),[e]),{visible:F,toggle:R,isVisible:E}=Rt(N),A=useMemo(()=>Mt(e.length),[e.length]),H=useMemo(()=>new Map(e.map((l,D)=>[l.id,l.color??A[D]])),[e,A]),y=n==="horizontal",O=useMemo(()=>Lt(!!t?.label,!!r?.label,false),[t?.label,r?.label]),v=useMemo(()=>Et(w,u,O),[w,u,O]),ne=useMemo(()=>is(e,F),[e,F]),C=useMemo(()=>ss(e,F,o,y?t:r),[e,F,o,y,t,r]),re=useMemo(()=>ls(C,y?[v.plotLeft,v.plotRight]:[v.plotBottom,v.plotTop]),[C,v,y]),_=useMemo(()=>cs(C,(y?t:r)?.tickCount??5),[C,y,t,r]),de=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=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=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=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?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):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?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):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)}),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"}),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 jsxs("g",{children:[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"}),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 jsxs("g",{children:[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"}),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 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 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&&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&&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 jsxs("div",{ref:d,className:i(dt(),c),children:[b&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:b}),T&&x==="top"&&jsx(En,{items:V,position:"top",onToggle:R}),jsxs("div",{className:i("flex items-start",me&&"gap-0"),children:[T&&x==="left"&&jsx(En,{items:V,position:"left",onToggle:R}),jsx("div",{ref:f,className:"flex-1 min-w-0 overflow-hidden",children:G?W:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:u},children:g})}),T&&x==="right"&&jsx(En,{items:V,position:"right",onToggle:R})]}),T&&x==="bottom"&&jsx(En,{items:V,position:"bottom",onToggle:R}),P&&jsxs("div",{className:pt(),style:{left:P.x,top:P.y},role:"tooltip",children:[jsx("div",{className:"mb-1 font-medium text-primary-200",children:P.category}),P.items.map((l,D)=>jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{background:l.color}}),jsxs("span",{className:"text-primary-300",children:[l.name,":"]}),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 jsx("div",{className:mt({position:t}),children:e.map(n=>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:[jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:n.color}}),jsx("span",{children:n.label}),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=useRef(null),h=useRef(null),[P,k]=useState(400),[N,F]=useState(null),[R,E]=useState(null),[A,H]=useState({}),y=useRef(null);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()},[]),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=useMemo(()=>e.map(z=>z.id),[e]),{visible:v,toggle:ne,isVisible:C}=Rt(O),re=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,$=useMemo(()=>hs(e,v,re,D,X,me,W,n,o),[e,v,re,D,X,me,W,n,o]),se=useMemo(()=>$.map(z=>z.id).join(","),[$]);useEffect(()=>{H({});},[se]);let ue=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=useCallback(()=>{F(null),E(null);},[]),S=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=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=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=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=jsxs("svg",{role:"img","aria-label":c??"Pie chart",width:V,height:G,viewBox:`0 0 ${V} ${G}`,shapeRendering:"geometricPrecision",children:[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 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 jsxs("g",{style:{userSelect:"none"},children:[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"}}),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}),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&&jsx("g",{style:{pointerEvents:"none"},children:N&&$.find(z=>z.id===N)?jsxs(Fragment,{children:[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,"%"]}),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})]}):jsxs(Fragment,{children:[s&&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&&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 jsxs("div",{ref:w,className:i(dt(),x),children:[c&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:c}),m&&g==="top"&&jsx(Dn,{items:oe,position:"top",onToggle:ne}),jsxs("div",{className:i("flex items-start justify-center",fe&&"gap-0"),children:[m&&g==="left"&&jsx(Dn,{items:oe,position:"left",onToggle:ne}),jsx("div",{ref:h,className:"flex-1 min-w-0 overflow-hidden",children:he?ye:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:T},children:f})}),m&&g==="right"&&jsx(Dn,{items:oe,position:"right",onToggle:ne})]}),m&&g==="bottom"&&jsx(Dn,{items:oe,position:"bottom",onToggle:ne}),R&&jsx("div",{className:pt(),style:{left:R.x,top:R.y},role:"tooltip",children:R.items.map((z,J)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{background:z.color}}),jsxs("span",{className:"font-medium",children:[z.label,":"]}),jsx("span",{children:z.value}),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 jsx("div",{className:mt({position:t}),children:e.map(n=>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:[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=useRef(null),w=useRef(null),[h,P]=useState(600),[k,N]=useState(null);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=useMemo(()=>e.map(l=>l.id),[e]),{visible:R,toggle:E,isVisible:A}=Rt(F),H=useMemo(()=>Mt(e.length),[e.length]),y=useMemo(()=>new Map(e.map((l,D)=>[l.id,l.color??H[D]])),[e,H]),O=useMemo(()=>Lt(!!t?.label,!!r?.label,false),[t?.label,r?.label]),v=useMemo(()=>Et(h,c,O),[h,c,O]),ne=useMemo(()=>ys(e,R,t),[e,R,t]),C=useMemo(()=>vs(e,R,r),[e,R,r]),re=useMemo(()=>Fa(ne,[v.plotLeft,v.plotRight]),[ne,v]),_=useMemo(()=>Fa(C,[v.plotBottom,v.plotTop]),[C,v]),de=useMemo(()=>Aa(ne,t?.tickCount??6),[ne,t?.tickCount]),j=useMemo(()=>Aa(C,r?.tickCount??5),[C,r?.tickCount]),pe=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=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=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=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=>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?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 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 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 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)}),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"}),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 jsxs("g",{children:[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"}),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 jsxs("g",{children:[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"}),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&&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&&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 jsxs("div",{ref:f,className:i(dt(),T),children:[u&&jsx("h3",{className:"mb-2 text-sm font-semibold text-primary-700 dark:text-primary-200",children:u}),x&&m==="top"&&jsx(In,{items:V,position:"top",onToggle:E}),jsxs("div",{className:i("flex items-start",me&&"gap-0"),children:[x&&m==="left"&&jsx(In,{items:V,position:"left",onToggle:E}),jsx("div",{ref:w,className:"flex-1 min-w-0 overflow-hidden",children:G?W:jsx("div",{className:"flex items-center justify-center text-secondary-400 dark:text-secondary-500",style:{height:c},children:d})}),x&&m==="right"&&jsx(In,{items:V,position:"right",onToggle:E})]}),x&&m==="bottom"&&jsx(In,{items:V,position:"bottom",onToggle:E}),k&&jsxs("div",{className:pt(),style:{left:k.x,top:k.y},role:"tooltip",children:[jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[jsx("span",{className:"h-2 w-2 rounded-full",style:{background:k.color}}),jsx("span",{className:"font-medium",children:k.seriesName})]}),jsxs("div",{className:"text-primary-300",children:["X: ",jsx("span",{className:"font-medium text-primary-50",children:k.xVal})," ","Y: ",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;export{Eo as Accordion,Ac as AccordionContent,Hc as AccordionItem,Fc as AccordionTrigger,Yo as Alert,hd as AlertContent,bd as AlertDescription,gd as AlertIcon,fd as AlertTitle,Gn as Badge,Va as BarChart,Yt as Button,oo as Card,wl as CardContent,vl as CardDescription,kl as CardFooter,xl as CardHeader,yl as CardTitle,Ba as Chart,bo as Chat,eo as Checkbox,ia as CinePlayer,wo as CodeBlock,ko as DataDisplay,Xl as DataTable,Lr as Dialog,ed as DialogClose,Fo as DialogContent,Bo as DialogDescription,_o as DialogFooter,Ao as DialogHeader,zo as DialogTitle,Vo as Disclosure,On as Dropdown,qt as DropdownButton,ba as Extras,Qo as Feedback,pa as FileExplorer,ra as FilmReel,wa as Form,wp as FormItem,kp as FormSection,ka as Forms,Ro as Header,Nl as HorizontalCard,ao as ImageCard,Sl as ImageCardActions,Tl as ImageCardBody,Ml as ImageCardDescription,Rl as ImageCardTitle,Un as Indicator,Zn as Input,qn as Label,lo as Layout,Pa as LineChart,fo as List,Gl as ListItem,ha as Masonry,oa as MiniPlayer,Mo as NavLink,So as Navigation,Oo as Overlay,io as Panel,El as PanelContent,Ll as PanelHeader,Ha as PieChart,no as Primitives,qo as ProgressBar,ro as Radio,to as RadioGroup,za as ScatterChart,To as SideNav,Kl as SortableTable,Jo as Spin,Qn as Switch,Wc as TabContent,$c as TabList,Kc as TabPanels,Oc as TabTrigger,kr as Table,po as TableBody,Ht as TableCell,uo as TableEmpty,It as TableHead,mo as TableHeader,wr as TableRow,Po as Tabs,Jn as TextBox,$o as Tooltip,go as Tree,tc as TreeItem,Tn as TypewriterText,on as accordionContentVariants,nn as accordionTriggerVariants,an as accordionVariants,Er as alertVariants,Ir as badgeVariants,Xt as buttonVariants,br as cardVariants,dt as chartContainerVariants,mt as chartLegendVariants,pt as chartTooltipVariants,Ar as checkboxVariants,i as cn,yr as codeBlockVariants,wd as configureAlertTopOffset,wx as default,Sr as dialogContentVariants,Hr as indicatorVariants,jt as inputVariants,Fr as labelVariants,Ur as listItemVariants,Gr as listVariants,tn as navLinkVariants,jr as panelVariants,pn as progressBarVariants,zr as radioVariants,rr as spinVariants,Br as switchTrackVariants,sn as tabListVariants,ln as tabTriggerVariants,Yr as tableVariants,mn as tooltipVariants,qr as treeItemVariants,Ld as useAlert,Od as useSpin};
|