vite-plugin-asset-manager 1.0.2 → 1.0.3

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.
@@ -1,11 +1,11 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D5_jxj65.js","assets/vendor-react-CZ2o2ZY4.js","assets/vendor-icons-BoR7i9s2.js","assets/vendor-ui-CBXnYcgF.js","assets/vendor-virtual-Cr-nkJSX.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DqMF0zb0.js","assets/vendor-react-CZ2o2ZY4.js","assets/vendor-icons-BoR7i9s2.js","assets/vendor-ui-CBXnYcgF.js","assets/vendor-virtual-Cr-nkJSX.js"])))=>i.map(i=>d[i]);
2
2
  import{r as n,j as e,e as ls,c as cs}from"./vendor-react-CZ2o2ZY4.js";import{c as ds,o as kt,e as ve,a as lt,b as ct,d as us,t as Ct,f as dt,g as q,h as oe,i as Fe,j as Q,k as Me,l as Te,m as be,n as ut,p as de,q as St,r as K,s as ms,u as mt,v as ft,w as pt,x as se,y as fs,z as ps,A as hs,B as zt,C as ht,D as xs,E as J,F as gs,G as bs,H as vs,I as ws,J as js,K as $t,L as _t,M as Re,N as It,O as ys,P as Ns,Q as ks,R as Cs,S as xt,T as Ss,U as zs,V as $s,W as _s,X as Is,Y as Ds,Z as Es,_ as As,$ as Ps}from"./vendor-icons-BoR7i9s2.js";import{t as Fs,c as Ms,B as Ts,a as Rs,M as Os,b as Ls,d as Dt,e as Et,f as At,g as Pt,C as Us,h as Bs,S as Vs,i as Gs,j as Hs,k as Ks,l as Zs,A as Js,D as Ft,m as Ws,n as Ys,o as Mt,p as Tt,q as Rt,r as qs,s as I,u as Qs,v as Xs,w as ea,x as ta,y as sa,z as aa,E as na,F as oa,G as ra,H as ia,I as la,J as ca,K as da,L as ua,N as ma,O as fa,P as pa,T as ha}from"./vendor-ui-CBXnYcgF.js";import{u as xa}from"./vendor-virtual-Cr-nkJSX.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function a(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=a(o);fetch(o.href,l)}})();const ga="modulepreload",ba=function(t){return"/__asset_manager__/"+t},gt={},va=function(s,a,r){let o=Promise.resolve();if(a&&a.length>0){let d=function(c){return Promise.all(c.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),i=u?.nonce||u?.getAttribute("nonce");o=d(a.map(c=>{if(c=ba(c),c in gt)return;gt[c]=!0;const m=c.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${p}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":ga,m||(g.as="script"),g.crossOrigin="",g.href=c,i&&g.setAttribute("nonce",i),document.head.appendChild(g),m)return new Promise((f,v)=>{g.addEventListener("load",f),g.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${c}`)))})}))}function l(u){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=u,window.dispatchEvent(i),!i.defaultPrevented)throw u}return o.then(u=>{for(const i of u||[])i.status==="rejected"&&l(i.reason);return s().catch(l)})},Ot=n.forwardRef(function({value:s,onChange:a,searching:r,onFocus:o},l){return e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:r?e.jsx(ds,{weight:"bold",className:"w-4 h-4 text-muted-foreground animate-spin"}):e.jsx(kt,{weight:"bold",className:"w-4 h-4 text-muted-foreground group-focus-within:text-primary transition-colors"})}),e.jsx("input",{ref:l,type:"text",value:s,onChange:u=>a(u.target.value),onFocus:o,placeholder:"Search assets...",className:`
3
3
  w-full pl-9 sm:pl-10 pr-10 sm:pr-20 py-2
4
4
  bg-input/50 border border-border rounded-lg
5
5
  text-sm text-foreground placeholder:text-muted-foreground
6
6
  focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary/50
7
7
  transition-all duration-200
8
- `}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-2 flex items-center gap-1",children:s?e.jsx("button",{onClick:()=>a(""),className:"p-1 rounded-md hover:bg-muted transition-colors","aria-label":"Clear search",children:e.jsx(ve,{weight:"bold",className:"w-3.5 h-3.5 text-muted-foreground hover:text-foreground"})}):e.jsx("kbd",{className:"hidden sm:flex items-center px-1.5 py-0.5 rounded border border-border bg-muted/50 text-[10px] font-mono text-muted-foreground",children:e.jsx("span",{children:"/"})})})]})});Ot.displayName="SearchBar";function w(...t){return Fs(Ms(t))}const wa=Rs("focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium focus-visible:ring-[2px] aria-invalid:ring-[2px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border dark:bg-input/30 hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",destructive:"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",xs:"h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-2.5",sm:"h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",lg:"h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-4",icon:"size-7 [&_svg:not([class*='size-'])]:size-3.5","icon-xs":"size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5","icon-sm":"size-6 [&_svg:not([class*='size-'])]:size-3","icon-lg":"size-8 [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default",size:"default"}});function P({className:t,variant:s="default",size:a="default",...r}){return e.jsx(Ts,{"data-slot":"button",className:w(wa({variant:s,size:a,className:t})),...r})}function Lt({...t}){return e.jsx(Os,{"data-slot":"dropdown-menu",...t})}function Ut({...t}){return e.jsx(Ls,{"data-slot":"dropdown-menu-trigger",...t})}function Bt({align:t="start",alignOffset:s=0,side:a="bottom",sideOffset:r=4,positionMethod:o="fixed",className:l,...u}){return e.jsx(Dt,{children:e.jsx(Et,{className:"isolate z-50 outline-none",align:t,alignOffset:s,side:a,sideOffset:r,positionMethod:o,children:e.jsx(At,{"data-slot":"dropdown-menu-content",className:w("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden",l),...u})})})}function De({className:t,inset:s,variant:a="default",...r}){return e.jsx(Pt,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":a,className:w("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r})}const ja={theme:"system",setTheme:()=>null},Vt=n.createContext(ja);function ya({children:t,defaultTheme:s="system",storageKey:a="vite-asset-manager-theme",...r}){const[o,l]=n.useState(()=>localStorage.getItem(a)||s);n.useEffect(()=>{const i=window.document.documentElement,d=window.matchMedia("(prefers-color-scheme: dark)"),c=m=>{i.classList.remove("light","dark"),i.classList.add(m)};if(o==="system"){c(d.matches?"dark":"light");const m=p=>{c(p.matches?"dark":"light")};return d.addEventListener("change",m),()=>d.removeEventListener("change",m)}c(o)},[o]);const u={theme:o,setTheme:i=>{localStorage.setItem(a,i),l(i)}};return e.jsx(Vt.Provider,{...r,value:u,children:t})}const Na=()=>{const t=n.useContext(Vt);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t};function ka(){const{setTheme:t}=Na();return e.jsxs(Lt,{children:[e.jsxs(Ut,{openOnHover:!0,render:e.jsx(P,{variant:"ghost",size:"icon-xs"}),children:[e.jsx(lt,{className:"size-3 scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90"}),e.jsx(ct,{className:"absolute size-3 scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0"}),e.jsx("span",{className:"sr-only",children:"Toggle theme"})]}),e.jsxs(Bt,{align:"end",side:"top",children:[e.jsxs(De,{onClick:()=>t("light"),children:[e.jsx(lt,{className:"size-3"}),"Light"]}),e.jsxs(De,{onClick:()=>t("dark"),children:[e.jsx(ct,{className:"size-3"}),"Dark"]}),e.jsxs(De,{onClick:()=>t("system"),children:[e.jsx(us,{className:"size-3"}),"System"]})]})]})}const Ca="1.0.2",Sa={version:Ca};let W=null;const ae=new Map;let he=null,xe=0,ge=0,Oe="disconnected";const Le=new Set;function ne(t){Oe!==t&&(Oe=t,Le.forEach(s=>s()))}function za(t){return Le.add(t),()=>Le.delete(t)}function $a(){return Oe}const _a=10,Ia=1e3;function Gt(){if(!(W?.readyState===EventSource.OPEN||W?.readyState===EventSource.CONNECTING))try{ne("connecting");const t=new EventSource("/__asset_manager__/api/events");W=t,t.onopen=()=>{xe=0,ne("connected")},t.onmessage=s=>{try{const a=JSON.parse(s.data);if(a.type==="connected")return;if(a.event){const r=ae.get(a.event);r&&r.forEach(o=>o(a.data))}}catch{}},t.onerror=()=>{W?.close(),W=null,ge>0&&xe<_a?(xe++,ne("reconnecting"),he=window.setTimeout(()=>{Gt()},Ia)):ne("disconnected")}}catch{ne("disconnected")}}function Da(){he&&(clearTimeout(he),he=null),W&&(W.close(),W=null),xe=0,ne("disconnected")}function we(){const t=n.useSyncExternalStore(za,$a);return n.useEffect(()=>(ge++,Gt(),()=>{ge--,ge===0&&Da()}),[]),{subscribe:n.useCallback((a,r)=>(ae.has(a)||ae.set(a,new Set),ae.get(a).add(r),()=>{const o=ae.get(a);o&&(o.delete(r),o.size===0&&ae.delete(a))}),[]),status:t}}const Ea={violet:"text-violet-400 bg-violet-500/10",pink:"text-pink-400 bg-pink-500/10",cyan:"text-cyan-400 bg-cyan-500/10",amber:"text-amber-400 bg-amber-500/10",rose:"text-rose-400 bg-rose-500/10",emerald:"text-emerald-400 bg-emerald-500/10",purple:"text-purple-400 bg-purple-500/10",zinc:"text-zinc-400 bg-zinc-500/10",blue:"text-blue-400 bg-blue-500/10"},Aa={connecting:{dotClass:"bg-amber-500 animate-pulse",label:"Connecting..."},connected:{dotClass:"bg-emerald-500 animate-pulse",label:"Watching"},reconnecting:{dotClass:"bg-amber-500 animate-pulse",label:"Reconnecting..."},disconnected:{dotClass:"bg-zinc-500",label:"Disconnected"}},bt=n.memo(function({total:s,searchQuery:a,onSearchChange:r,searching:o,searchInputRef:l,onSearchFocus:u,selectedType:i,onTypeSelect:d,showUnusedOnly:c,onUnusedFilterToggle:m,showDuplicatesOnly:p,onDuplicatesFilterToggle:g,stats:f}){const{status:v}=we(),{dotClass:k,label:b}=Aa[v];return e.jsxs("aside",{className:"w-full md:w-72 bg-sidebar border-r border-sidebar-border flex flex-col noise-bg h-full",children:[e.jsx("div",{className:"p-5 border-b border-sidebar-border",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-linear-to-br from-violet-500 to-purple-600 flex items-center justify-center shadow-lg shadow-violet-500/20",children:e.jsx(Ct,{weight:"fill"})}),e.jsx("div",{className:`absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-sidebar ${k}`})]}),e.jsxs("div",{children:[e.jsx("h1",{className:"font-mono text-sm font-semibold tracking-wide text-foreground",children:"ASSET MANAGER"}),e.jsx("p",{className:"text-[10px] text-muted-foreground font-mono tracking-wider",children:"VITE PLUGIN"})]})]})}),e.jsx("div",{className:"p-4",children:e.jsx(Ot,{ref:l,value:a,onChange:r,searching:o,onFocus:u})}),e.jsx("div",{className:"px-3 sm:px-4 pb-4",children:e.jsxs("div",{className:"rounded-lg bg-card/50 border border-border p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Total Assets"}),e.jsx("span",{className:"font-mono text-xl sm:text-2xl font-bold text-foreground tabular-nums",children:s})]}),f&&e.jsxs("div",{className:"grid grid-cols-2 gap-1.5 sm:gap-2",children:[e.jsx(V,{icon:e.jsx(dt,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Images",count:f.images,color:"violet",onClick:()=>d("image"),active:i==="image"}),e.jsx(V,{icon:e.jsx(q,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Videos",count:f.videos,color:"pink",onClick:()=>d("video"),active:i==="video"}),e.jsx(V,{icon:e.jsx(oe,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Audio",count:f.audio,color:"cyan",onClick:()=>d("audio"),active:i==="audio"}),e.jsx(V,{icon:e.jsx(Fe,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Docs",count:f.documents,color:"amber",onClick:()=>d("document"),active:i==="document"}),e.jsx(V,{icon:e.jsx(Q,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Fonts",count:f.fonts,color:"rose",onClick:()=>d("font"),active:i==="font"}),e.jsx(V,{icon:e.jsx(Me,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Data",count:f.data,color:"emerald",onClick:()=>d("data"),active:i==="data"}),e.jsx(V,{icon:e.jsx(Te,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Text",count:f.text,color:"purple",onClick:()=>d("text"),active:i==="text"}),e.jsx(V,{icon:e.jsx(be,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Other",count:f.other,color:"zinc",onClick:()=>d("other"),active:i==="other"}),e.jsx(V,{icon:e.jsx(ut,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Unused",count:f.unused,color:"amber",onClick:m,active:c}),e.jsx(V,{icon:e.jsx(de,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Dupes",count:f.duplicateFiles,color:"blue",onClick:g,active:p})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-2",children:[e.jsx("div",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider mb-2 px-2",children:"Browse"}),e.jsxs("nav",{className:"space-y-1",children:[e.jsx(O,{icon:e.jsx(St,{weight:"duotone",className:"w-4 h-4"}),label:"All Assets",count:s,active:i===null,onClick:()=>d(null)}),f&&e.jsxs(e.Fragment,{children:[e.jsx(O,{icon:e.jsx(dt,{weight:"duotone",className:"w-4 h-4"}),label:"Images",count:f.images,active:i==="image",onClick:()=>d("image")}),e.jsx(O,{icon:e.jsx(q,{weight:"duotone",className:"w-4 h-4"}),label:"Videos",count:f.videos,active:i==="video",onClick:()=>d("video")}),e.jsx(O,{icon:e.jsx(oe,{weight:"duotone",className:"w-4 h-4"}),label:"Audio",count:f.audio,active:i==="audio",onClick:()=>d("audio")}),e.jsx(O,{icon:e.jsx(Fe,{weight:"duotone",className:"w-4 h-4"}),label:"Documents",count:f.documents,active:i==="document",onClick:()=>d("document")}),e.jsx(O,{icon:e.jsx(Q,{weight:"duotone",className:"w-4 h-4"}),label:"Fonts",count:f.fonts,active:i==="font",onClick:()=>d("font")}),e.jsx(O,{icon:e.jsx(Me,{weight:"duotone",className:"w-4 h-4"}),label:"Data",count:f.data,active:i==="data",onClick:()=>d("data")}),e.jsx(O,{icon:e.jsx(Te,{weight:"duotone",className:"w-4 h-4"}),label:"Text",count:f.text,active:i==="text",onClick:()=>d("text")}),e.jsx(O,{icon:e.jsx(be,{weight:"duotone",className:"w-4 h-4"}),label:"Other",count:f.other,active:i==="other",onClick:()=>d("other")}),e.jsx("div",{className:"my-2 border-t border-sidebar-border"}),e.jsx(O,{icon:e.jsx(ut,{weight:"duotone",className:"w-4 h-4"}),label:"Unused Assets",count:f.unused,active:c,onClick:m}),e.jsx(O,{icon:e.jsx(de,{weight:"duotone",className:"w-4 h-4"}),label:"Duplicates",count:f.duplicateFiles,active:p,onClick:g})]})]})]}),e.jsx("div",{className:"p-4 border-t border-sidebar-border",children:e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${k}`}),e.jsx("span",{className:"font-mono",children:b})]}),e.jsxs("div",{className:"flex relative items-center gap-2",children:[e.jsx(ka,{}),e.jsxs("span",{className:"font-mono opacity-50",children:["v",Sa.version]})]})]})})]})}),V=n.memo(function({icon:s,label:a,count:r,color:o,onClick:l,active:u=!1}){return e.jsxs("button",{onClick:l,className:`
8
+ `}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-2 flex items-center gap-1",children:s?e.jsx("button",{onClick:()=>a(""),className:"p-1 rounded-md hover:bg-muted transition-colors","aria-label":"Clear search",children:e.jsx(ve,{weight:"bold",className:"w-3.5 h-3.5 text-muted-foreground hover:text-foreground"})}):e.jsx("kbd",{className:"hidden sm:flex items-center px-1.5 py-0.5 rounded border border-border bg-muted/50 text-[10px] font-mono text-muted-foreground",children:e.jsx("span",{children:"/"})})})]})});Ot.displayName="SearchBar";function w(...t){return Fs(Ms(t))}const wa=Rs("focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium focus-visible:ring-[2px] aria-invalid:ring-[2px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border dark:bg-input/30 hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",destructive:"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",xs:"h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-2.5",sm:"h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",lg:"h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-4",icon:"size-7 [&_svg:not([class*='size-'])]:size-3.5","icon-xs":"size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5","icon-sm":"size-6 [&_svg:not([class*='size-'])]:size-3","icon-lg":"size-8 [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default",size:"default"}});function P({className:t,variant:s="default",size:a="default",...r}){return e.jsx(Ts,{"data-slot":"button",className:w(wa({variant:s,size:a,className:t})),...r})}function Lt({...t}){return e.jsx(Os,{"data-slot":"dropdown-menu",...t})}function Ut({...t}){return e.jsx(Ls,{"data-slot":"dropdown-menu-trigger",...t})}function Bt({align:t="start",alignOffset:s=0,side:a="bottom",sideOffset:r=4,positionMethod:o="fixed",className:l,...u}){return e.jsx(Dt,{children:e.jsx(Et,{className:"isolate z-50 outline-none",align:t,alignOffset:s,side:a,sideOffset:r,positionMethod:o,children:e.jsx(At,{"data-slot":"dropdown-menu-content",className:w("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden",l),...u})})})}function De({className:t,inset:s,variant:a="default",...r}){return e.jsx(Pt,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":a,className:w("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r})}const ja={theme:"system",setTheme:()=>null},Vt=n.createContext(ja);function ya({children:t,defaultTheme:s="system",storageKey:a="vite-asset-manager-theme",...r}){const[o,l]=n.useState(()=>localStorage.getItem(a)||s);n.useEffect(()=>{const i=window.document.documentElement,d=window.matchMedia("(prefers-color-scheme: dark)"),c=m=>{i.classList.remove("light","dark"),i.classList.add(m)};if(o==="system"){c(d.matches?"dark":"light");const m=p=>{c(p.matches?"dark":"light")};return d.addEventListener("change",m),()=>d.removeEventListener("change",m)}c(o)},[o]);const u={theme:o,setTheme:i=>{localStorage.setItem(a,i),l(i)}};return e.jsx(Vt.Provider,{...r,value:u,children:t})}const Na=()=>{const t=n.useContext(Vt);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t};function ka(){const{setTheme:t}=Na();return e.jsxs(Lt,{children:[e.jsxs(Ut,{openOnHover:!0,render:e.jsx(P,{variant:"ghost",size:"icon-xs"}),children:[e.jsx(lt,{className:"size-3 scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90"}),e.jsx(ct,{className:"absolute size-3 scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0"}),e.jsx("span",{className:"sr-only",children:"Toggle theme"})]}),e.jsxs(Bt,{align:"end",side:"top",children:[e.jsxs(De,{onClick:()=>t("light"),children:[e.jsx(lt,{className:"size-3"}),"Light"]}),e.jsxs(De,{onClick:()=>t("dark"),children:[e.jsx(ct,{className:"size-3"}),"Dark"]}),e.jsxs(De,{onClick:()=>t("system"),children:[e.jsx(us,{className:"size-3"}),"System"]})]})]})}const Ca="1.0.3",Sa={version:Ca};let W=null;const ae=new Map;let he=null,xe=0,ge=0,Oe="disconnected";const Le=new Set;function ne(t){Oe!==t&&(Oe=t,Le.forEach(s=>s()))}function za(t){return Le.add(t),()=>Le.delete(t)}function $a(){return Oe}const _a=10,Ia=1e3;function Gt(){if(!(W?.readyState===EventSource.OPEN||W?.readyState===EventSource.CONNECTING))try{ne("connecting");const t=new EventSource("/__asset_manager__/api/events");W=t,t.onopen=()=>{xe=0,ne("connected")},t.onmessage=s=>{try{const a=JSON.parse(s.data);if(a.type==="connected")return;if(a.event){const r=ae.get(a.event);r&&r.forEach(o=>o(a.data))}}catch{}},t.onerror=()=>{W?.close(),W=null,ge>0&&xe<_a?(xe++,ne("reconnecting"),he=window.setTimeout(()=>{Gt()},Ia)):ne("disconnected")}}catch{ne("disconnected")}}function Da(){he&&(clearTimeout(he),he=null),W&&(W.close(),W=null),xe=0,ne("disconnected")}function we(){const t=n.useSyncExternalStore(za,$a);return n.useEffect(()=>(ge++,Gt(),()=>{ge--,ge===0&&Da()}),[]),{subscribe:n.useCallback((a,r)=>(ae.has(a)||ae.set(a,new Set),ae.get(a).add(r),()=>{const o=ae.get(a);o&&(o.delete(r),o.size===0&&ae.delete(a))}),[]),status:t}}const Ea={violet:"text-violet-400 bg-violet-500/10",pink:"text-pink-400 bg-pink-500/10",cyan:"text-cyan-400 bg-cyan-500/10",amber:"text-amber-400 bg-amber-500/10",rose:"text-rose-400 bg-rose-500/10",emerald:"text-emerald-400 bg-emerald-500/10",purple:"text-purple-400 bg-purple-500/10",zinc:"text-zinc-400 bg-zinc-500/10",blue:"text-blue-400 bg-blue-500/10"},Aa={connecting:{dotClass:"bg-amber-500 animate-pulse",label:"Connecting..."},connected:{dotClass:"bg-emerald-500 animate-pulse",label:"Watching"},reconnecting:{dotClass:"bg-amber-500 animate-pulse",label:"Reconnecting..."},disconnected:{dotClass:"bg-zinc-500",label:"Disconnected"}},bt=n.memo(function({total:s,searchQuery:a,onSearchChange:r,searching:o,searchInputRef:l,onSearchFocus:u,selectedType:i,onTypeSelect:d,showUnusedOnly:c,onUnusedFilterToggle:m,showDuplicatesOnly:p,onDuplicatesFilterToggle:g,stats:f}){const{status:v}=we(),{dotClass:k,label:b}=Aa[v];return e.jsxs("aside",{className:"w-full md:w-72 bg-sidebar border-r border-sidebar-border flex flex-col noise-bg h-full",children:[e.jsx("div",{className:"p-5 border-b border-sidebar-border",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-linear-to-br from-violet-500 to-purple-600 flex items-center justify-center shadow-lg shadow-violet-500/20",children:e.jsx(Ct,{weight:"fill"})}),e.jsx("div",{className:`absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-sidebar ${k}`})]}),e.jsxs("div",{children:[e.jsx("h1",{className:"font-mono text-sm font-semibold tracking-wide text-foreground",children:"ASSET MANAGER"}),e.jsx("p",{className:"text-[10px] text-muted-foreground font-mono tracking-wider",children:"VITE PLUGIN"})]})]})}),e.jsx("div",{className:"p-4",children:e.jsx(Ot,{ref:l,value:a,onChange:r,searching:o,onFocus:u})}),e.jsx("div",{className:"px-3 sm:px-4 pb-4",children:e.jsxs("div",{className:"rounded-lg bg-card/50 border border-border p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Total Assets"}),e.jsx("span",{className:"font-mono text-xl sm:text-2xl font-bold text-foreground tabular-nums",children:s})]}),f&&e.jsxs("div",{className:"grid grid-cols-2 gap-1.5 sm:gap-2",children:[e.jsx(V,{icon:e.jsx(dt,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Images",count:f.images,color:"violet",onClick:()=>d("image"),active:i==="image"}),e.jsx(V,{icon:e.jsx(q,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Videos",count:f.videos,color:"pink",onClick:()=>d("video"),active:i==="video"}),e.jsx(V,{icon:e.jsx(oe,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Audio",count:f.audio,color:"cyan",onClick:()=>d("audio"),active:i==="audio"}),e.jsx(V,{icon:e.jsx(Fe,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Docs",count:f.documents,color:"amber",onClick:()=>d("document"),active:i==="document"}),e.jsx(V,{icon:e.jsx(Q,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Fonts",count:f.fonts,color:"rose",onClick:()=>d("font"),active:i==="font"}),e.jsx(V,{icon:e.jsx(Me,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Data",count:f.data,color:"emerald",onClick:()=>d("data"),active:i==="data"}),e.jsx(V,{icon:e.jsx(Te,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Text",count:f.text,color:"purple",onClick:()=>d("text"),active:i==="text"}),e.jsx(V,{icon:e.jsx(be,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Other",count:f.other,color:"zinc",onClick:()=>d("other"),active:i==="other"}),e.jsx(V,{icon:e.jsx(ut,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Unused",count:f.unused,color:"amber",onClick:m,active:c}),e.jsx(V,{icon:e.jsx(de,{weight:"fill",className:"w-3.5 h-3.5"}),label:"Dupes",count:f.duplicateFiles,color:"blue",onClick:g,active:p})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-2",children:[e.jsx("div",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider mb-2 px-2",children:"Browse"}),e.jsxs("nav",{className:"space-y-1",children:[e.jsx(O,{icon:e.jsx(St,{weight:"duotone",className:"w-4 h-4"}),label:"All Assets",count:s,active:i===null,onClick:()=>d(null)}),f&&e.jsxs(e.Fragment,{children:[e.jsx(O,{icon:e.jsx(dt,{weight:"duotone",className:"w-4 h-4"}),label:"Images",count:f.images,active:i==="image",onClick:()=>d("image")}),e.jsx(O,{icon:e.jsx(q,{weight:"duotone",className:"w-4 h-4"}),label:"Videos",count:f.videos,active:i==="video",onClick:()=>d("video")}),e.jsx(O,{icon:e.jsx(oe,{weight:"duotone",className:"w-4 h-4"}),label:"Audio",count:f.audio,active:i==="audio",onClick:()=>d("audio")}),e.jsx(O,{icon:e.jsx(Fe,{weight:"duotone",className:"w-4 h-4"}),label:"Documents",count:f.documents,active:i==="document",onClick:()=>d("document")}),e.jsx(O,{icon:e.jsx(Q,{weight:"duotone",className:"w-4 h-4"}),label:"Fonts",count:f.fonts,active:i==="font",onClick:()=>d("font")}),e.jsx(O,{icon:e.jsx(Me,{weight:"duotone",className:"w-4 h-4"}),label:"Data",count:f.data,active:i==="data",onClick:()=>d("data")}),e.jsx(O,{icon:e.jsx(Te,{weight:"duotone",className:"w-4 h-4"}),label:"Text",count:f.text,active:i==="text",onClick:()=>d("text")}),e.jsx(O,{icon:e.jsx(be,{weight:"duotone",className:"w-4 h-4"}),label:"Other",count:f.other,active:i==="other",onClick:()=>d("other")}),e.jsx("div",{className:"my-2 border-t border-sidebar-border"}),e.jsx(O,{icon:e.jsx(ut,{weight:"duotone",className:"w-4 h-4"}),label:"Unused Assets",count:f.unused,active:c,onClick:m}),e.jsx(O,{icon:e.jsx(de,{weight:"duotone",className:"w-4 h-4"}),label:"Duplicates",count:f.duplicateFiles,active:p,onClick:g})]})]})]}),e.jsx("div",{className:"p-4 border-t border-sidebar-border",children:e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${k}`}),e.jsx("span",{className:"font-mono",children:b})]}),e.jsxs("div",{className:"flex relative items-center gap-2",children:[e.jsx(ka,{}),e.jsxs("span",{className:"font-mono opacity-50",children:["v",Sa.version]})]})]})})]})}),V=n.memo(function({icon:s,label:a,count:r,color:o,onClick:l,active:u=!1}){return e.jsxs("button",{onClick:l,className:`
9
9
  relative flex items-center gap-1.5 sm:gap-2 px-2 sm:px-2.5 py-1.5 rounded-md
10
10
  transition-all duration-200 ease-out
11
11
  ${Ea[o]}
@@ -127,7 +127,7 @@ import data from '${t.path}'
127
127
  ${o?"ring-1 ring-violet-500/70 border-violet-500/50 bg-violet-500/5":""}
128
128
  ${l?"ring-2 ring-blue-500 ring-offset-1 ring-offset-white dark:ring-offset-zinc-950":""}
129
129
  `,children:[u&&e.jsx("div",{className:`absolute top-2 left-2 z-10 transition-opacity duration-100 ${o?"opacity-100":"opacity-0 group-hover:opacity-100 sm:group-hover:opacity-100"}`,onClick:M=>M.stopPropagation(),children:e.jsx(on,{checked:o,onCheckedChange:C,className:"border-zinc-400 dark:border-zinc-600 data-[state=checked]:bg-violet-500 data-[state=checked]:border-violet-500 min-h-11 min-w-11 sm:min-h-0 sm:min-w-0"})}),e.jsxs("div",{className:"relative h-45 bg-zinc-100 dark:bg-zinc-950/50",children:[e.jsx("div",{className:"absolute inset-0 checkerboard opacity-30"}),e.jsx("div",{className:"relative w-full h-full flex items-center justify-center p-3",children:v&&!c?e.jsx("img",{src:k,alt:s.name,className:"max-w-full max-h-full object-contain",loading:"lazy",onError:x}):s.type==="video"?e.jsx(Fa,{asset:s}):s.type==="font"?e.jsx(Ma,{asset:s}):e.jsx(Ue,{extension:s.extension,className:"w-12 h-12 opacity-60"})}),e.jsx("div",{className:"absolute inset-0 bg-white/70 dark:bg-zinc-950/70 opacity-0 group-hover:opacity-100 transition-opacity duration-150 flex items-center justify-center backdrop-blur-[2px]",children:e.jsx("button",{onClick:_,className:"flex items-center gap-1.5 px-2.5 py-1.5 sm:px-2.5 sm:py-1.5 min-h-11 sm:min-h-0 rounded-md bg-zinc-900/10 dark:bg-white/10 hover:bg-zinc-900/20 dark:hover:bg-white/20 transition-colors text-xs text-zinc-600 dark:text-zinc-300 hover:text-zinc-900 dark:hover:text-white",title:"Copy path","aria-label":"Copy file path",children:i?e.jsxs(e.Fragment,{children:[e.jsx(J,{weight:"bold",className:"w-3.5 h-3.5 text-emerald-400"}),e.jsx("span",{className:"text-emerald-400",children:"Copied"})]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{weight:"bold",className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Copy path"})]})})})]}),e.jsxs("div",{className:"px-3 py-2.5 border-t border-zinc-200 dark:border-zinc-800/50",children:[e.jsx("p",{className:"text-[13px] font-medium text-zinc-800 dark:text-zinc-200 truncate leading-tight",title:s.name,children:s.name}),e.jsxs("div",{className:"flex items-center justify-between gap-2 mt-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[e.jsx("span",{className:`text-[10px] font-mono font-medium uppercase px-1.5 py-0.5 rounded-sm ${z} bg-current/10 shrink-0`,children:e.jsx("span",{className:z,children:s.extension.replace(".","")})}),s.importersCount===0&&!g&&e.jsx("span",{className:"text-[10px] font-mono font-medium uppercase px-1.5 py-0.5 rounded-sm bg-amber-500/10 text-amber-500 shrink-0",children:"unused"}),s.importersCount===0&&g&&e.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] font-mono font-medium uppercase px-1.5 py-0.5 rounded-sm bg-zinc-200 dark:bg-zinc-800 text-zinc-500 shrink-0",children:[e.jsx(_t,{weight:"fill",className:"w-2.5 h-2.5"}),"ignored"]}),(s.duplicatesCount??0)>0&&e.jsxs("span",{className:"text-[10px] font-mono font-medium uppercase px-1.5 py-0.5 rounded-sm bg-blue-500/10 text-blue-400 shrink-0",children:[s.duplicatesCount," dupe",s.duplicatesCount===1?"":"s"]})]}),e.jsx("span",{className:"text-[11px] text-zinc-500 font-mono tabular-nums shrink-0",children:rn(s.size)})]})]})]})})});function cn({items:t,columns:s,scrollElement:a,rowHeight:r,gap:o=16,overscan:l=2}){const u=Math.ceil(t.length/s),i=xa({count:u,getScrollElement:()=>a.current,estimateSize:()=>r+o,overscan:l}),d=n.useCallback(m=>{const p=m*s;return t.slice(p,p+s)},[t,s]),c=n.useCallback(m=>{const p=Math.floor(m/s);i.scrollToIndex(p,{align:"center"})},[s,i]);return{virtualRows:i.getVirtualItems(),totalHeight:i.getTotalSize(),getRowItems:d,scrollToItem:c}}const dn=180,jt=24;function Ae(t){if(t<=0)return 1;const s=t-48,a=Math.floor((s+jt)/(dn+jt));return Math.max(1,a)}function Yt(t){const[s,a]=n.useState(()=>typeof window>"u"?3:Ae(window.innerWidth));return n.useEffect(()=>{const r=t?.current,o=()=>{a(Ae(r?r.clientWidth:window.innerWidth))};if(o(),r&&typeof ResizeObserver<"u"){const l=new ResizeObserver(o);return l.observe(r),()=>l.disconnect()}else return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[t]),s}const un=180,mn=60,yt=24,fn=180,pn=n.memo(function({assets:s,scrollContainerRef:a,onPreview:r,selectedAssets:o,focusedAssetId:l,onToggleSelect:u}){const i=Yt(a),{virtualRows:d,totalHeight:c,getRowItems:m,scrollToItem:p}=cn({items:s,columns:i,scrollElement:a,rowHeight:un+mn,gap:yt,overscan:2});n.useEffect(()=>{if(l){const f=s.findIndex(v=>v.id===l);f!==-1&&p(f)}},[l,s,p]);const g=n.useCallback((f,v)=>f*i+v,[i]);return s.length===0?null:e.jsx("div",{role:"grid","aria-multiselectable":"true",className:"px-6 pt-4",children:e.jsx("div",{style:{height:c,position:"relative"},children:d.map(f=>{const v=m(f.index);return e.jsx("div",{role:"row",style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${f.start}px)`,display:"grid",gridTemplateColumns:`repeat(${i}, minmax(${fn}px, 1fr))`,gap:yt},children:v.map((k,b)=>e.jsx(ln,{asset:k,index:g(f.index,b),onPreview:r,isSelected:o?.has(k.id),isFocused:k.id===l,onToggleSelect:u},k.id))},f.key)})})})}),hn=ea;function xn({className:t,...s}){return e.jsx(aa,{"data-slot":"select-value",className:w("flex flex-1 text-left",t),...s})}function gn({className:t,size:s="default",children:a,...r}){return e.jsxs(ta,{"data-slot":"select-trigger","data-size":s,className:w("border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r,children:[a,e.jsx(sa,{render:e.jsx(It,{className:"text-muted-foreground size-3.5 pointer-events-none"})})]})}function bn({className:t,children:s,side:a="bottom",sideOffset:r=4,align:o="center",alignOffset:l=0,alignItemWithTrigger:u=!0,...i}){return e.jsx(na,{children:e.jsx(oa,{side:a,sideOffset:r,align:o,alignOffset:l,alignItemWithTrigger:u,className:"isolate z-50",children:e.jsxs(ra,{"data-slot":"select-content","data-align-trigger":u,className:w("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 rounded-lg shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none",t),...i,children:[e.jsx(wn,{}),e.jsx(ia,{children:s}),e.jsx(jn,{})]})})})}function vn({className:t,children:s,...a}){return e.jsxs(la,{"data-slot":"select-item",className:w("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...a,children:[e.jsx(ca,{className:"flex flex-1 gap-2 shrink-0 whitespace-nowrap",children:s}),e.jsx(da,{render:e.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:e.jsx(J,{className:"pointer-events-none"})})]})}function wn({className:t,...s}){return e.jsx(ua,{"data-slot":"select-scroll-up-button",className:w("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 top-0 w-full",t),...s,children:e.jsx(ys,{})})}function jn({className:t,...s}){return e.jsx(ma,{"data-slot":"select-scroll-down-button",className:w("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 bottom-0 w-full",t),...s,children:e.jsx(It,{})})}const yn=[{value:"name-asc",label:"Name (A → Z)"},{value:"name-desc",label:"Name (Z → A)"},{value:"size-asc",label:"Size (Smallest)"},{value:"size-desc",label:"Size (Largest)"},{value:"mtime-desc",label:"Date (Newest)"},{value:"mtime-asc",label:"Date (Oldest)"},{value:"type-asc",label:"Type (A → Z)"},{value:"type-desc",label:"Type (Z → A)"}];function Nn(t){const[s,a]=t.split("-");return{field:s,direction:a}}function kn(t){return`${t.field}-${t.direction}`}function Cn({value:t,onChange:s}){const a=kn(t),r=o=>{o&&s(Nn(o))};return e.jsxs(hn,{value:a,onValueChange:r,children:[e.jsxs(gn,{size:"sm",className:w("h-7! px-2.5 gap-1.5","bg-input/20 dark:bg-input/30 border-border/50 hover:bg-input/30 dark:hover:bg-input/40"),children:[e.jsx(Ns,{weight:"bold",className:"w-3.5 h-3.5 text-muted-foreground"}),e.jsx(xn,{placeholder:"Sort by..."})]}),e.jsx(bn,{children:yn.map(o=>e.jsx(vn,{value:o.value,children:o.label},o.value))})]})}const Sn=n.memo(function({selectedCount:s,totalCount:a,selectedAssets:r,onSelectAll:o,onDeselectAll:l,onDelete:u,isDeleting:i,visible:d}){const[c,m]=n.useState(!1),[p,g]=n.useState(!1),f=n.useCallback(async()=>{const C=r.map(_=>_.path).join(`
130
- `);try{await navigator.clipboard.writeText(C),I.success(`Copied ${s} path${s>1?"s":""} to clipboard`)}catch{I.error("Failed to copy paths to clipboard")}},[r,s]),v=n.useCallback(async()=>{m(!0);try{const C=r.map(M=>M.path),_=await fetch("/__asset_manager__/api/bulk-download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:C})});if(!_.ok)throw new Error("Download failed");const x=await _.blob(),F=URL.createObjectURL(x),z=document.createElement("a");z.href=F,z.download=`assets-${Date.now()}.zip`,document.body.appendChild(z),z.click(),document.body.removeChild(z),URL.revokeObjectURL(F),I.success(`Downloaded ${s} asset${s>1?"s":""} as ZIP`)}catch{I.error("Failed to download assets")}finally{m(!1)}},[r,s]),k=n.useCallback(async()=>{await u(),g(!1)},[u]),b=s===a&&a>0;return e.jsxs("div",{className:`sticky top-0 md:top-0 z-10 bg-card/95 backdrop-blur border-b border-border px-3 sm:px-4 flex items-center justify-between transition-all duration-300 ease-out ${d?"h-14 sm:h-13 py-2 sm:py-3 opacity-100 translate-y-0":"h-0 py-0 opacity-0 -translate-y-full pointer-events-none overflow-hidden"}`,"aria-hidden":!d,children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx(P,{variant:"ghost",size:"icon-sm",onClick:b?l:o,title:b?"Deselect all":"Select all",children:b?e.jsx(ks,{weight:"fill",className:"w-4 h-4 sm:w-5 sm:h-5 text-primary"}):e.jsx(Cs,{weight:"regular",className:"w-4 h-4 sm:w-5 sm:h-5"})}),e.jsxs("span",{className:"text-xs sm:text-sm font-medium",children:[s," selected"]}),e.jsxs(P,{variant:"ghost",size:"sm",onClick:l,className:"text-muted-foreground hidden sm:flex",children:[e.jsx(ve,{weight:"bold",className:"w-3 h-3 mr-1"}),"Clear"]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[e.jsxs(P,{variant:"outline",size:"sm",onClick:f,disabled:s===0,className:"hidden sm:flex",children:[e.jsx(de,{weight:"bold",className:"w-4 h-4 mr-1.5"}),"Copy Paths"]}),e.jsx(P,{variant:"outline",size:"icon-sm",onClick:f,disabled:s===0,className:"sm:hidden",title:"Copy paths",children:e.jsx(de,{weight:"bold",className:"w-4 h-4"})}),e.jsxs(P,{variant:"outline",size:"sm",onClick:v,disabled:s===0||c,className:"hidden sm:flex",children:[e.jsx(xt,{weight:"bold",className:"w-4 h-4 mr-1.5"}),c?"Downloading...":"Download ZIP"]}),e.jsx(P,{variant:"outline",size:"icon-sm",onClick:v,disabled:s===0||c,className:"sm:hidden",title:"Download ZIP",children:e.jsx(xt,{weight:"bold",className:"w-4 h-4"})}),e.jsxs(Be,{open:p,onOpenChange:g,children:[e.jsx(vt,{render:e.jsxs(P,{variant:"destructive",size:"sm",disabled:s===0||i,className:"hidden sm:flex",children:[e.jsx(Re,{weight:"bold",className:"w-4 h-4 mr-1.5"}),"Delete"]})}),e.jsx(vt,{render:e.jsx(P,{variant:"destructive",size:"icon-sm",disabled:s===0||i,className:"sm:hidden",title:"Delete",children:e.jsx(Re,{weight:"bold",className:"w-4 h-4"})})}),e.jsxs(Ve,{children:[e.jsxs(Ge,{children:[e.jsxs(Ke,{children:["Delete ",s," asset",s>1?"s":"","?"]}),e.jsx(Ze,{children:"This action cannot be undone. The following files will be permanently deleted from your computer:"})]}),e.jsxs("ul",{className:"max-h-32 overflow-y-auto text-xs font-mono bg-muted/50 rounded p-2 space-y-0.5",children:[r.slice(0,10).map(C=>e.jsx("li",{className:"truncate text-muted-foreground",children:C.path},C.id)),r.length>10&&e.jsxs("li",{className:"text-muted-foreground/60",children:["...and ",r.length-10," more"]})]}),e.jsxs(He,{children:[e.jsx(We,{children:"Cancel"}),e.jsx(Je,{variant:"destructive",onClick:k,children:i?"Deleting...":"Delete"})]})]})]})]})]})}),zn=[{value:"small",label:"Small",description:"< 100 KB"},{value:"medium",label:"Medium",description:"100 KB – 1 MB"},{value:"large",label:"Large",description:"1 – 10 MB"},{value:"xlarge",label:"Extra large",description:"> 10 MB"}],$n=[{value:"today",label:"Today"},{value:"last7days",label:"Last 7 days"},{value:"last30days",label:"Last 30 days"},{value:"last90days",label:"Last 90 days"},{value:"thisYear",label:"This year"}],_n=n.memo(function({sizeFilter:s,dateFilter:a,extensionFilter:r,onSizeChange:o,onDateChange:l,onExtensionChange:u,onClearAll:i,activeCount:d,availableExtensions:c}){const[m,p]=n.useState(!1),g=b=>{s?.preset===b?o(void 0):o({preset:b})},f=b=>{a?.preset===b?l(void 0):l({preset:b})},v=b=>{const C=r?.extensions||[],_=C.includes(b)?C.filter(x=>x!==b):[...C,b];u(_.length>0?{extensions:_}:void 0)},k=()=>{i()};return e.jsxs(Lt,{open:m,onOpenChange:p,children:[e.jsx(Ut,{children:e.jsxs(P,{variant:"outline",size:"sm",className:w("h-7! gap-1.5 px-2.5 font-medium transition-all duration-200","bg-input/20 dark:bg-input/30 border-border/50 hover:bg-input/30 dark:hover:bg-input/40",d>0&&"border-primary/40 bg-primary/5 hover:bg-primary/10"),children:[e.jsx(Ss,{weight:"bold",className:w("w-3.5 h-3.5 transition-colors",d>0?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:w(d>0&&"text-primary"),children:"Filters"}),d>0&&e.jsx("span",{className:w("ml-0.5 flex items-center justify-center","min-w-4.5 h-4.5 px-1 rounded-full","bg-primary text-primary-foreground","text-[10px] font-semibold tabular-nums","animate-in zoom-in-50 duration-150"),children:d})]})}),e.jsxs(Bt,{align:"end",sideOffset:6,className:w("w-[calc(100vw-2rem)] sm:w-80 md:w-72 p-0 overflow-hidden","bg-popover/95 backdrop-blur-xl","border border-border/50","shadow-xl shadow-black/10","animate-in fade-in-0 zoom-in-95 duration-150"),children:[e.jsxs("div",{className:"max-h-105 sm:max-h-125 overflow-y-auto overscroll-contain",children:[e.jsx(Pe,{icon:e.jsx(Me,{weight:"bold",className:"w-3.5 h-3.5"}),title:"File Size",children:e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:zn.map(b=>e.jsxs(In,{selected:s?.preset===b.value,onClick:()=>g(b.value),children:[e.jsx("span",{className:"font-medium",children:b.label}),e.jsx("span",{className:"text-[10px] text-muted-foreground/80",children:b.description})]},b.value))})}),e.jsx(Pe,{icon:e.jsx(zs,{weight:"bold",className:"w-3.5 h-3.5"}),title:"Modified",children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:$n.map(b=>e.jsx(Nt,{selected:a?.preset===b.value,onClick:()=>f(b.value),children:b.label},b.value))})}),c.length>0&&e.jsx(Pe,{icon:e.jsx(be,{weight:"bold",className:"w-3.5 h-3.5"}),title:"Extensions",scrollable:!0,children:e.jsx("div",{className:"flex flex-wrap gap-1",children:c.sort().map(b=>e.jsx(Nt,{selected:r?.extensions?.includes(b),onClick:()=>v(b),mono:!0,children:b},b))})})]}),d>0&&e.jsxs("div",{className:w("flex items-center justify-between","px-3 py-2.5 border-t border-border/50","bg-muted/30"),children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[d," ",d===1?"filter":"filters"," active"]}),e.jsxs("button",{onClick:k,className:w("inline-flex items-center gap-1","text-xs font-medium text-muted-foreground","hover:text-foreground transition-colors","focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded"),children:[e.jsx(ve,{weight:"bold",className:"w-3 h-3"}),"Clear all"]})]})]})]})});function Pe({icon:t,title:s,children:a,scrollable:r}){return e.jsxs("div",{className:"px-3 py-3 border-b border-border/30 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[e.jsx("span",{className:"text-muted-foreground",children:t}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/80",children:s})]}),e.jsx("div",{className:w(r&&"max-h-28 overflow-y-auto overscroll-contain pr-1"),children:a})]})}function In({selected:t,onClick:s,children:a}){return e.jsxs("button",{onClick:s,className:w("relative flex flex-col items-start","px-2.5 py-2 rounded-lg","text-left text-xs","border transition-all duration-150","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",t?"bg-primary/10 border-primary/30 text-primary":"bg-muted/40 border-transparent hover:bg-muted/70 hover:border-border/50"),children:[t&&e.jsx(J,{weight:"bold",className:"absolute top-1.5 right-1.5 w-3 h-3 text-primary animate-in zoom-in-50 duration-100"}),a]})}function Nt({selected:t,onClick:s,children:a,mono:r}){return e.jsxs("button",{onClick:s,className:w("inline-flex items-center gap-1","px-2 py-1 rounded-md","text-xs transition-all duration-150","border focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",r&&"font-mono",t?"bg-primary/15 border-primary/30 text-primary font-medium":"bg-muted/40 border-transparent text-muted-foreground hover:bg-muted/70 hover:text-foreground"),children:[t&&e.jsx(J,{weight:"bold",className:"w-2.5 h-2.5 shrink-0"}),a]})}function Dn({...t}){return e.jsx(fa,{"data-slot":"sheet",...t})}function En({...t}){return e.jsx(Tt,{"data-slot":"sheet-portal",...t})}function An({className:t,...s}){return e.jsx(Rt,{"data-slot":"sheet-overlay",className:w("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",t),...s})}function Pn({className:t,children:s,side:a="right",showCloseButton:r=!0,...o}){return e.jsxs(En,{children:[e.jsx(An,{}),e.jsxs(Ft,{"data-slot":"sheet-content","data-side":a,className:w("bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col bg-clip-padding text-xs/relaxed shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...o,children:[s,r&&e.jsxs(Mt,{"data-slot":"sheet-close",render:e.jsx(P,{variant:"ghost",className:"absolute top-4 right-4",size:"icon-sm"}),children:[e.jsx(ve,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Fn(t,s,a){const[r,o]=n.useState([]),[l,u]=n.useState(0),[i,d]=n.useState(!0),[c,m]=n.useState(null),{subscribe:p}=we(),g=a?.toString()??"",f=n.useCallback(async()=>{try{d(!0),m(null);const v=new URLSearchParams;t&&v.append("type",t),g&&new URLSearchParams(g).forEach((F,z)=>v.append(z,F));const k=v.toString(),b=k?`/__asset_manager__/api/assets/grouped?${k}`:"/__asset_manager__/api/assets/grouped",C=await fetch(b);if(!C.ok)throw new Error("Failed to fetch assets");const _=await C.json();o(_.groups),u(_.total)}catch(v){m(v instanceof Error?v.message:"Unknown error")}finally{d(!1)}},[t,s,g]);return n.useEffect(()=>(f(),p("asset-manager:update",()=>{f()})),[f,p]),{groups:r,total:l,loading:i,error:c,refetch:f}}function Mn(t){const[s,a]=n.useState([]),[r,o]=n.useState(!1),l=t?.toString()??"",u=n.useCallback(async d=>{if(!d.trim()){a([]);return}o(!0);try{const c=new URLSearchParams;c.append("q",d),l&&new URLSearchParams(l).forEach((f,v)=>c.append(v,f));const m=await fetch(`/__asset_manager__/api/search?${c.toString()}`);if(!m.ok)throw new Error("Search failed");const p=await m.json();a(p.assets)}catch{a([])}finally{o(!1)}},[l]),i=n.useCallback(()=>{a([])},[]);return{results:s,searching:r,search:u,clear:i}}function Tn(){const[t,s]=n.useState({total:0,images:0,videos:0,audio:0,documents:0,fonts:0,data:0,text:0,other:0,unused:0,duplicateGroups:0,duplicateFiles:0,extensionBreakdown:{}}),[a,r]=n.useState(!0),[o,l]=n.useState(null),{subscribe:u}=we(),i=n.useCallback(async()=>{try{l(null);const d=await fetch("/__asset_manager__/api/stats");if(!d.ok)throw new Error("Failed to fetch stats");const c=await d.json();s({total:c.total,images:c.byType.image,videos:c.byType.video,audio:c.byType.audio,documents:c.byType.document,fonts:c.byType.font,data:c.byType.data,text:c.byType.text,other:c.byType.other,unused:c.unused,duplicateGroups:c.duplicateGroups??0,duplicateFiles:c.duplicateFiles??0,extensionBreakdown:c.extensionBreakdown??{}})}catch(d){l(d instanceof Error?d.message:"Unknown error")}finally{r(!1)}},[]);return n.useEffect(()=>(i(),u("asset-manager:update",()=>{i()})),[i,u]),{stats:t,loading:a,error:o}}function Rn(t){const{flatAssetList:s,focusedAssetId:a,setFocusedAssetId:r,isGridFocused:o,setIsGridFocused:l,selectedAssets:u,toggleSelection:i,selectAll:d,clearSelection:c,previewAsset:m,setPreviewAsset:p,searchInputRef:g,onCopyPaths:f,onDelete:v,onOpenInEditor:k,onRevealInFinder:b}=t,C=Yt();n.useEffect(()=>{const _=x=>{const F=x.target,z=F.tagName==="INPUT"||F.tagName==="TEXTAREA",N=/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?x.metaKey:x.ctrlKey,R=()=>{if(u.size>0)return s.filter($=>u.has($.id));if(a){const $=s.find(S=>S.id===a);return $?[$]:[]}return[]},L=$=>{if(s.length===0)return;const S=a?s.findIndex(X=>X.id===a):-1;let E=S;$==="ArrowRight"?E=Math.min(S+1,s.length-1):$==="ArrowLeft"?E=Math.max(S-1,0):$==="ArrowDown"||$==="j"?E=Math.min(S+C,s.length-1):($==="ArrowUp"||$==="k")&&(E=Math.max(S-C,0)),S===-1&&(E=0),E!==S&&E>=0&&E<s.length&&(r(s[E].id),l(!0))},G=$=>{if(s.length===0)return;const S=a?s.findIndex(X=>X.id===a):-1;let E;S===-1?E=$===1?0:s.length-1:E=(S+$+s.length)%s.length,r(s[E].id),l(!0)};if(x.key==="/"){x.preventDefault(),g.current?.focus(),l(!1);return}if(x.key==="Escape"){m?(p(null),l(!0)):document.activeElement===g.current&&(g.current?.blur(),l(!0));return}if(o||!z&&!m){if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","j","k"].includes(x.key)){x.preventDefault(),L(x.key);return}if(x.key===" "){x.preventDefault(),a&&i(a,!1);return}if(x.key==="Enter"){if(x.preventDefault(),a){const $=s.find(S=>S.id===a);$&&p($)}return}if(x.key==="Tab"&&!x.shiftKey){x.preventDefault(),G(1);return}if(x.key==="Tab"&&x.shiftKey){x.preventDefault(),G(-1);return}if(N&&x.key==="a"){x.preventDefault(),d();return}if(N&&x.key==="d"){x.preventDefault(),c();return}}const U=R();if(U.length!==0){if(x.key==="Delete"||x.key==="Backspace"){z||(x.preventDefault(),v(U));return}if(N&&x.key==="c"&&!z){x.preventDefault(),f(U);return}if(N&&x.key==="o"){x.preventDefault(),U.length===1&&k(U[0]);return}if(N&&x.shiftKey&&x.key==="r"){x.preventDefault(),U.length===1&&b(U[0]);return}}};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[s,a,r,o,l,u,i,d,c,m,p,g,f,v,k,b,C])}const On={small:{max:100*1024},medium:{min:100*1024,max:1024*1024},large:{min:1024*1024,max:10*1024*1024},xlarge:{min:10*1024*1024}};function Ln(t){const s=Date.now(),a=864e5;return{today:{start:s-a},last7days:{start:s-7*a},last30days:{start:s-30*a},last90days:{start:s-90*a},thisYear:{start:new Date(new Date().getFullYear(),0,1).getTime()}}[t]||{}}function Un(){const[t,s]=n.useState(),[a,r]=n.useState(),[o,l]=n.useState(),u=n.useMemo(()=>{let c=0;return t&&t.preset!=="any"&&c++,a&&a.preset!=="any"&&c++,o?.extensions.length&&c++,c},[t,a,o]),i=n.useCallback(()=>{s(void 0),r(void 0),l(void 0)},[]),d=n.useMemo(()=>{const c=new URLSearchParams;if(t&&t.preset!=="any"){const m=On[t.preset]||{};m.min&&c.append("minSize",String(m.min)),m.max&&c.append("maxSize",String(m.max))}if(a&&a.preset!=="any"){const m=Ln(a.preset);m.start&&c.append("minDate",String(m.start)),m.end&&c.append("maxDate",String(m.end))}return o?.extensions.length&&c.append("extensions",o.extensions.join(",")),c.toString()},[t,a,o]);return{sizeFilter:t,setSizeFilter:s,dateFilter:a,setDateFilter:r,extensionFilter:o,setExtensionFilter:l,activeFilterCount:u,clearAll:i,filterParamsString:d}}function Bn(t,s){const{field:a,direction:r}=s,o=r==="asc"?1:-1;return[...t].sort((l,u)=>{let i=0;switch(a){case"name":{const d=l.name,c=u.name;i=d.localeCompare(c,void 0,{sensitivity:"base"});break}case"size":{const d=l.size,c=u.size;i=d-c;break}case"mtime":{const d=l.mtime,c=u.mtime;i=d-c;break}case"type":{const d=l.type,c=u.type;i=d.localeCompare(c);break}}return i*o})}function Vn(){const[t]=n.useState(()=>typeof window>"u"?!1:new URLSearchParams(window.location.search).get("embedded")==="true");return t}const Gn=n.lazy(()=>va(()=>import("./index-D5_jxj65.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.PreviewPanel}))),Hn=e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full border-2 border-primary/30 border-t-primary animate-spin"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading assets..."})]}),Kn=t=>e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-muted-foreground",children:[e.jsx("div",{className:"w-20 h-20 rounded-2xl bg-muted/50 flex items-center justify-center mb-6",children:e.jsx(kt,{weight:"duotone",className:"w-10 h-10 text-muted-foreground/50"})}),e.jsx("p",{className:"text-lg font-medium text-foreground mb-1",children:"No results found"}),e.jsxs("p",{className:"text-sm",children:['No assets match "',t,'"']})]}),Zn=e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-muted-foreground",children:[e.jsx("div",{className:"w-20 h-20 rounded-2xl bg-muted/50 flex items-center justify-center mb-6",children:e.jsx(St,{weight:"duotone",className:"w-10 h-10 text-muted-foreground/50"})}),e.jsx("p",{className:"text-lg font-medium text-foreground mb-1",children:"No assets found"}),e.jsx("p",{className:"text-sm",children:"Add images, videos, or documents to your project"})]});function Jn(){const t=Vn(),[s,a]=n.useState(null),[r,o]=n.useState(!1),[l,u]=n.useState(!1),[i,d]=n.useState(!1),{sizeFilter:c,setSizeFilter:m,dateFilter:p,setDateFilter:g,extensionFilter:f,setExtensionFilter:v,activeFilterCount:k,clearAll:b,filterParamsString:C}=Un(),_=n.useMemo(()=>C?new URLSearchParams(C):void 0,[C]),{groups:x,loading:F}=Fn(s,void 0,_),{stats:z}=Tn(),{results:M,searching:N,search:R,clear:L}=Mn(_),{isIgnored:G}=Ye(),{isDeleting:U,bulkDelete:$}=Wt(),[S,E]=n.useState(""),[X,qe]=n.useState(()=>new Set),[ye,ue]=n.useState(null),[Ne,qt]=n.useState({field:"name",direction:"asc"}),[B,ee]=n.useState(()=>new Set),[ke,ie]=n.useState(null),[le,Qe]=n.useState(null),[Ce,Se]=n.useState(!1),[H,ze]=n.useState(null),$e=n.useRef(null),Xe=n.useRef(null),et=n.useRef(!1),[Qt,tt]=n.useState(""),st=n.useCallback(h=>{ue(h)},[]),Xt=n.useCallback(()=>{ue(null)},[]),at=n.useCallback(()=>{o(h=>!h)},[]),nt=n.useCallback(()=>{u(h=>!h)},[]);n.useEffect(()=>{ee(new Set),ie(null)},[s,r,l,S,_]),n.useEffect(()=>{x.length>0&&!et.current&&(et.current=!0,qe(new Set(x.map(h=>h.directory))))},[x]),n.useEffect(()=>{const h=setTimeout(()=>{S?R(S):L()},200);return()=>clearTimeout(h)},[S,R,L]);const T=n.useMemo(()=>{let h=x;if(S&&M.length>0){const j=new Map;M.forEach(D=>{const A=D.directory;j.has(A)||j.set(A,[]),j.get(A).push(D)}),h=Array.from(j.entries()).map(([D,A])=>({directory:D,assets:A,count:A.length}))}let y=h;return r&&(y=y.map(j=>{const D=j.assets.filter(A=>A.importersCount===0&&!G(A.path));return{...j,assets:D,count:D.length}}).filter(j=>j.count>0)),l&&(y=y.map(j=>{const D=j.assets.filter(A=>(A.duplicatesCount??0)>0);return{...j,assets:D,count:D.length}}).filter(j=>j.count>0)),y.map(j=>({...j,assets:Bn(j.assets,Ne)}))},[x,M,S,Ne,r,l,G]),me=n.useMemo(()=>T.flatMap(h=>h.assets),[T]),es=n.useCallback(h=>{qe(y=>{const j=new Set(y);return j.has(h)?j.delete(h):j.add(h),j})},[]),ot=n.useCallback((h,y)=>{ee(j=>{const D=new Set(j);if(y&&ke){const A=T.flatMap(Y=>Y.assets),fe=A.findIndex(Y=>Y.id===ke),pe=A.findIndex(Y=>Y.id===h);if(fe!==-1&&pe!==-1){const[Y,is]=fe<pe?[fe,pe]:[pe,fe];for(let Ie=Y;Ie<=is;Ie++)D.add(A[Ie].id)}}else D.has(h)?D.delete(h):D.add(h);return D}),ie(h)},[ke,T]),rt=n.useCallback(()=>{const h=T.flatMap(y=>y.assets.map(j=>j.id));ee(new Set(h))},[T]),it=n.useCallback(()=>{ee(new Set),ie(null)},[]),_e=n.useMemo(()=>T.flatMap(y=>y.assets).filter(y=>B.has(y.id)),[T,B]),ts=n.useCallback(async()=>{await $(_e)&&(ee(new Set),ie(null))},[$,_e]),ss=n.useCallback(async()=>{if(!H)return;await $(H)&&(ee(new Set),ie(null),Qe(null)),ze(null)},[$,H]),as=n.useCallback(async h=>{try{const y=h.map(j=>j.path).join(`
130
+ `);try{await navigator.clipboard.writeText(C),I.success(`Copied ${s} path${s>1?"s":""} to clipboard`)}catch{I.error("Failed to copy paths to clipboard")}},[r,s]),v=n.useCallback(async()=>{m(!0);try{const C=r.map(M=>M.path),_=await fetch("/__asset_manager__/api/bulk-download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:C})});if(!_.ok)throw new Error("Download failed");const x=await _.blob(),F=URL.createObjectURL(x),z=document.createElement("a");z.href=F,z.download=`assets-${Date.now()}.zip`,document.body.appendChild(z),z.click(),document.body.removeChild(z),URL.revokeObjectURL(F),I.success(`Downloaded ${s} asset${s>1?"s":""} as ZIP`)}catch{I.error("Failed to download assets")}finally{m(!1)}},[r,s]),k=n.useCallback(async()=>{await u(),g(!1)},[u]),b=s===a&&a>0;return e.jsxs("div",{className:`sticky top-0 md:top-0 z-10 bg-card/95 backdrop-blur border-b border-border px-3 sm:px-4 flex items-center justify-between transition-all duration-300 ease-out ${d?"h-14 sm:h-13 py-2 sm:py-3 opacity-100 translate-y-0":"h-0 py-0 opacity-0 -translate-y-full pointer-events-none overflow-hidden"}`,"aria-hidden":!d,children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx(P,{variant:"ghost",size:"icon-sm",onClick:b?l:o,title:b?"Deselect all":"Select all",children:b?e.jsx(ks,{weight:"fill",className:"w-4 h-4 sm:w-5 sm:h-5 text-primary"}):e.jsx(Cs,{weight:"regular",className:"w-4 h-4 sm:w-5 sm:h-5"})}),e.jsxs("span",{className:"text-xs sm:text-sm font-medium",children:[s," selected"]}),e.jsxs(P,{variant:"ghost",size:"sm",onClick:l,className:"text-muted-foreground hidden sm:flex",children:[e.jsx(ve,{weight:"bold",className:"w-3 h-3 mr-1"}),"Clear"]})]}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[e.jsxs(P,{variant:"outline",size:"sm",onClick:f,disabled:s===0,className:"hidden sm:flex",children:[e.jsx(de,{weight:"bold",className:"w-4 h-4 mr-1.5"}),"Copy Paths"]}),e.jsx(P,{variant:"outline",size:"icon-sm",onClick:f,disabled:s===0,className:"sm:hidden",title:"Copy paths",children:e.jsx(de,{weight:"bold",className:"w-4 h-4"})}),e.jsxs(P,{variant:"outline",size:"sm",onClick:v,disabled:s===0||c,className:"hidden sm:flex",children:[e.jsx(xt,{weight:"bold",className:"w-4 h-4 mr-1.5"}),c?"Downloading...":"Download ZIP"]}),e.jsx(P,{variant:"outline",size:"icon-sm",onClick:v,disabled:s===0||c,className:"sm:hidden",title:"Download ZIP",children:e.jsx(xt,{weight:"bold",className:"w-4 h-4"})}),e.jsxs(Be,{open:p,onOpenChange:g,children:[e.jsx(vt,{render:e.jsxs(P,{variant:"destructive",size:"sm",disabled:s===0||i,className:"hidden sm:flex",children:[e.jsx(Re,{weight:"bold",className:"w-4 h-4 mr-1.5"}),"Delete"]})}),e.jsx(vt,{render:e.jsx(P,{variant:"destructive",size:"icon-sm",disabled:s===0||i,className:"sm:hidden",title:"Delete",children:e.jsx(Re,{weight:"bold",className:"w-4 h-4"})})}),e.jsxs(Ve,{children:[e.jsxs(Ge,{children:[e.jsxs(Ke,{children:["Delete ",s," asset",s>1?"s":"","?"]}),e.jsx(Ze,{children:"This action cannot be undone. The following files will be permanently deleted from your computer:"})]}),e.jsxs("ul",{className:"max-h-32 overflow-y-auto text-xs font-mono bg-muted/50 rounded p-2 space-y-0.5",children:[r.slice(0,10).map(C=>e.jsx("li",{className:"truncate text-muted-foreground",children:C.path},C.id)),r.length>10&&e.jsxs("li",{className:"text-muted-foreground/60",children:["...and ",r.length-10," more"]})]}),e.jsxs(He,{children:[e.jsx(We,{children:"Cancel"}),e.jsx(Je,{variant:"destructive",onClick:k,children:i?"Deleting...":"Delete"})]})]})]})]})]})}),zn=[{value:"small",label:"Small",description:"< 100 KB"},{value:"medium",label:"Medium",description:"100 KB – 1 MB"},{value:"large",label:"Large",description:"1 – 10 MB"},{value:"xlarge",label:"Extra large",description:"> 10 MB"}],$n=[{value:"today",label:"Today"},{value:"last7days",label:"Last 7 days"},{value:"last30days",label:"Last 30 days"},{value:"last90days",label:"Last 90 days"},{value:"thisYear",label:"This year"}],_n=n.memo(function({sizeFilter:s,dateFilter:a,extensionFilter:r,onSizeChange:o,onDateChange:l,onExtensionChange:u,onClearAll:i,activeCount:d,availableExtensions:c}){const[m,p]=n.useState(!1),g=b=>{s?.preset===b?o(void 0):o({preset:b})},f=b=>{a?.preset===b?l(void 0):l({preset:b})},v=b=>{const C=r?.extensions||[],_=C.includes(b)?C.filter(x=>x!==b):[...C,b];u(_.length>0?{extensions:_}:void 0)},k=()=>{i()};return e.jsxs(Lt,{open:m,onOpenChange:p,children:[e.jsx(Ut,{children:e.jsxs(P,{variant:"outline",size:"sm",className:w("h-7! gap-1.5 px-2.5 font-medium transition-all duration-200","bg-input/20 dark:bg-input/30 border-border/50 hover:bg-input/30 dark:hover:bg-input/40",d>0&&"border-primary/40 bg-primary/5 hover:bg-primary/10"),children:[e.jsx(Ss,{weight:"bold",className:w("w-3.5 h-3.5 transition-colors",d>0?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:w(d>0&&"text-primary"),children:"Filters"}),d>0&&e.jsx("span",{className:w("ml-0.5 flex items-center justify-center","min-w-4.5 h-4.5 px-1 rounded-full","bg-primary text-primary-foreground","text-[10px] font-semibold tabular-nums","animate-in zoom-in-50 duration-150"),children:d})]})}),e.jsxs(Bt,{align:"end",sideOffset:6,className:w("w-[calc(100vw-2rem)] sm:w-80 md:w-72 p-0 overflow-hidden","bg-popover/95 backdrop-blur-xl","border border-border/50","shadow-xl shadow-black/10","animate-in fade-in-0 zoom-in-95 duration-150"),children:[e.jsxs("div",{className:"max-h-105 sm:max-h-125 overflow-y-auto overscroll-contain",children:[e.jsx(Pe,{icon:e.jsx(Me,{weight:"bold",className:"w-3.5 h-3.5"}),title:"File Size",children:e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:zn.map(b=>e.jsxs(In,{selected:s?.preset===b.value,onClick:()=>g(b.value),children:[e.jsx("span",{className:"font-medium",children:b.label}),e.jsx("span",{className:"text-[10px] text-muted-foreground/80",children:b.description})]},b.value))})}),e.jsx(Pe,{icon:e.jsx(zs,{weight:"bold",className:"w-3.5 h-3.5"}),title:"Modified",children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:$n.map(b=>e.jsx(Nt,{selected:a?.preset===b.value,onClick:()=>f(b.value),children:b.label},b.value))})}),c.length>0&&e.jsx(Pe,{icon:e.jsx(be,{weight:"bold",className:"w-3.5 h-3.5"}),title:"Extensions",scrollable:!0,children:e.jsx("div",{className:"flex flex-wrap gap-1",children:c.sort().map(b=>e.jsx(Nt,{selected:r?.extensions?.includes(b),onClick:()=>v(b),mono:!0,children:b},b))})})]}),d>0&&e.jsxs("div",{className:w("flex items-center justify-between","px-3 py-2.5 border-t border-border/50","bg-muted/30"),children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[d," ",d===1?"filter":"filters"," active"]}),e.jsxs("button",{onClick:k,className:w("inline-flex items-center gap-1","text-xs font-medium text-muted-foreground","hover:text-foreground transition-colors","focus:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded"),children:[e.jsx(ve,{weight:"bold",className:"w-3 h-3"}),"Clear all"]})]})]})]})});function Pe({icon:t,title:s,children:a,scrollable:r}){return e.jsxs("div",{className:"px-3 py-3 border-b border-border/30 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[e.jsx("span",{className:"text-muted-foreground",children:t}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/80",children:s})]}),e.jsx("div",{className:w(r&&"max-h-28 overflow-y-auto overscroll-contain pr-1"),children:a})]})}function In({selected:t,onClick:s,children:a}){return e.jsxs("button",{onClick:s,className:w("relative flex flex-col items-start","px-2.5 py-2 rounded-lg","text-left text-xs","border transition-all duration-150","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",t?"bg-primary/10 border-primary/30 text-primary":"bg-muted/40 border-transparent hover:bg-muted/70 hover:border-border/50"),children:[t&&e.jsx(J,{weight:"bold",className:"absolute top-1.5 right-1.5 w-3 h-3 text-primary animate-in zoom-in-50 duration-100"}),a]})}function Nt({selected:t,onClick:s,children:a,mono:r}){return e.jsxs("button",{onClick:s,className:w("inline-flex items-center gap-1","px-2 py-1 rounded-md","text-xs transition-all duration-150","border focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",r&&"font-mono",t?"bg-primary/15 border-primary/30 text-primary font-medium":"bg-muted/40 border-transparent text-muted-foreground hover:bg-muted/70 hover:text-foreground"),children:[t&&e.jsx(J,{weight:"bold",className:"w-2.5 h-2.5 shrink-0"}),a]})}function Dn({...t}){return e.jsx(fa,{"data-slot":"sheet",...t})}function En({...t}){return e.jsx(Tt,{"data-slot":"sheet-portal",...t})}function An({className:t,...s}){return e.jsx(Rt,{"data-slot":"sheet-overlay",className:w("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",t),...s})}function Pn({className:t,children:s,side:a="right",showCloseButton:r=!0,...o}){return e.jsxs(En,{children:[e.jsx(An,{}),e.jsxs(Ft,{"data-slot":"sheet-content","data-side":a,className:w("bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col bg-clip-padding text-xs/relaxed shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...o,children:[s,r&&e.jsxs(Mt,{"data-slot":"sheet-close",render:e.jsx(P,{variant:"ghost",className:"absolute top-4 right-4",size:"icon-sm"}),children:[e.jsx(ve,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Fn(t,s,a){const[r,o]=n.useState([]),[l,u]=n.useState(0),[i,d]=n.useState(!0),[c,m]=n.useState(null),{subscribe:p}=we(),g=a?.toString()??"",f=n.useCallback(async()=>{try{d(!0),m(null);const v=new URLSearchParams;t&&v.append("type",t),g&&new URLSearchParams(g).forEach((F,z)=>v.append(z,F));const k=v.toString(),b=k?`/__asset_manager__/api/assets/grouped?${k}`:"/__asset_manager__/api/assets/grouped",C=await fetch(b);if(!C.ok)throw new Error("Failed to fetch assets");const _=await C.json();o(_.groups),u(_.total)}catch(v){m(v instanceof Error?v.message:"Unknown error")}finally{d(!1)}},[t,s,g]);return n.useEffect(()=>(f(),p("asset-manager:update",()=>{f()})),[f,p]),{groups:r,total:l,loading:i,error:c,refetch:f}}function Mn(t){const[s,a]=n.useState([]),[r,o]=n.useState(!1),l=t?.toString()??"",u=n.useCallback(async d=>{if(!d.trim()){a([]);return}o(!0);try{const c=new URLSearchParams;c.append("q",d),l&&new URLSearchParams(l).forEach((f,v)=>c.append(v,f));const m=await fetch(`/__asset_manager__/api/search?${c.toString()}`);if(!m.ok)throw new Error("Search failed");const p=await m.json();a(p.assets)}catch{a([])}finally{o(!1)}},[l]),i=n.useCallback(()=>{a([])},[]);return{results:s,searching:r,search:u,clear:i}}function Tn(){const[t,s]=n.useState({total:0,images:0,videos:0,audio:0,documents:0,fonts:0,data:0,text:0,other:0,unused:0,duplicateGroups:0,duplicateFiles:0,extensionBreakdown:{}}),[a,r]=n.useState(!0),[o,l]=n.useState(null),{subscribe:u}=we(),i=n.useCallback(async()=>{try{l(null);const d=await fetch("/__asset_manager__/api/stats");if(!d.ok)throw new Error("Failed to fetch stats");const c=await d.json();s({total:c.total,images:c.byType.image,videos:c.byType.video,audio:c.byType.audio,documents:c.byType.document,fonts:c.byType.font,data:c.byType.data,text:c.byType.text,other:c.byType.other,unused:c.unused,duplicateGroups:c.duplicateGroups??0,duplicateFiles:c.duplicateFiles??0,extensionBreakdown:c.extensionBreakdown??{}})}catch(d){l(d instanceof Error?d.message:"Unknown error")}finally{r(!1)}},[]);return n.useEffect(()=>(i(),u("asset-manager:update",()=>{i()})),[i,u]),{stats:t,loading:a,error:o}}function Rn(t){const{flatAssetList:s,focusedAssetId:a,setFocusedAssetId:r,isGridFocused:o,setIsGridFocused:l,selectedAssets:u,toggleSelection:i,selectAll:d,clearSelection:c,previewAsset:m,setPreviewAsset:p,searchInputRef:g,onCopyPaths:f,onDelete:v,onOpenInEditor:k,onRevealInFinder:b}=t,C=Yt();n.useEffect(()=>{const _=x=>{const F=x.target,z=F.tagName==="INPUT"||F.tagName==="TEXTAREA",N=/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?x.metaKey:x.ctrlKey,R=()=>{if(u.size>0)return s.filter($=>u.has($.id));if(a){const $=s.find(S=>S.id===a);return $?[$]:[]}return[]},L=$=>{if(s.length===0)return;const S=a?s.findIndex(X=>X.id===a):-1;let E=S;$==="ArrowRight"?E=Math.min(S+1,s.length-1):$==="ArrowLeft"?E=Math.max(S-1,0):$==="ArrowDown"||$==="j"?E=Math.min(S+C,s.length-1):($==="ArrowUp"||$==="k")&&(E=Math.max(S-C,0)),S===-1&&(E=0),E!==S&&E>=0&&E<s.length&&(r(s[E].id),l(!0))},G=$=>{if(s.length===0)return;const S=a?s.findIndex(X=>X.id===a):-1;let E;S===-1?E=$===1?0:s.length-1:E=(S+$+s.length)%s.length,r(s[E].id),l(!0)};if(x.key==="/"){x.preventDefault(),g.current?.focus(),l(!1);return}if(x.key==="Escape"){m?(p(null),l(!0)):document.activeElement===g.current&&(g.current?.blur(),l(!0));return}if(o||!z&&!m){if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","j","k"].includes(x.key)){x.preventDefault(),L(x.key);return}if(x.key===" "){x.preventDefault(),a&&i(a,!1);return}if(x.key==="Enter"){if(x.preventDefault(),a){const $=s.find(S=>S.id===a);$&&p($)}return}if(x.key==="Tab"&&!x.shiftKey){x.preventDefault(),G(1);return}if(x.key==="Tab"&&x.shiftKey){x.preventDefault(),G(-1);return}if(N&&x.key==="a"){x.preventDefault(),d();return}if(N&&x.key==="d"){x.preventDefault(),c();return}}const U=R();if(U.length!==0){if(x.key==="Delete"||x.key==="Backspace"){z||(x.preventDefault(),v(U));return}if(N&&x.key==="c"&&!z){x.preventDefault(),f(U);return}if(N&&x.key==="o"){x.preventDefault(),U.length===1&&k(U[0]);return}if(N&&x.shiftKey&&x.key==="r"){x.preventDefault(),U.length===1&&b(U[0]);return}}};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[s,a,r,o,l,u,i,d,c,m,p,g,f,v,k,b,C])}const On={small:{max:100*1024},medium:{min:100*1024,max:1024*1024},large:{min:1024*1024,max:10*1024*1024},xlarge:{min:10*1024*1024}};function Ln(t){const s=Date.now(),a=864e5;return{today:{start:s-a},last7days:{start:s-7*a},last30days:{start:s-30*a},last90days:{start:s-90*a},thisYear:{start:new Date(new Date().getFullYear(),0,1).getTime()}}[t]||{}}function Un(){const[t,s]=n.useState(),[a,r]=n.useState(),[o,l]=n.useState(),u=n.useMemo(()=>{let c=0;return t&&t.preset!=="any"&&c++,a&&a.preset!=="any"&&c++,o?.extensions.length&&c++,c},[t,a,o]),i=n.useCallback(()=>{s(void 0),r(void 0),l(void 0)},[]),d=n.useMemo(()=>{const c=new URLSearchParams;if(t&&t.preset!=="any"){const m=On[t.preset]||{};m.min&&c.append("minSize",String(m.min)),m.max&&c.append("maxSize",String(m.max))}if(a&&a.preset!=="any"){const m=Ln(a.preset);m.start&&c.append("minDate",String(m.start)),m.end&&c.append("maxDate",String(m.end))}return o?.extensions.length&&c.append("extensions",o.extensions.join(",")),c.toString()},[t,a,o]);return{sizeFilter:t,setSizeFilter:s,dateFilter:a,setDateFilter:r,extensionFilter:o,setExtensionFilter:l,activeFilterCount:u,clearAll:i,filterParamsString:d}}function Bn(t,s){const{field:a,direction:r}=s,o=r==="asc"?1:-1;return[...t].sort((l,u)=>{let i=0;switch(a){case"name":{const d=l.name,c=u.name;i=d.localeCompare(c,void 0,{sensitivity:"base"});break}case"size":{const d=l.size,c=u.size;i=d-c;break}case"mtime":{const d=l.mtime,c=u.mtime;i=d-c;break}case"type":{const d=l.type,c=u.type;i=d.localeCompare(c);break}}return i*o})}function Vn(){const[t]=n.useState(()=>typeof window>"u"?!1:new URLSearchParams(window.location.search).get("embedded")==="true");return t}const Gn=n.lazy(()=>va(()=>import("./index-DqMF0zb0.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.PreviewPanel}))),Hn=e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full border-2 border-primary/30 border-t-primary animate-spin"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading assets..."})]}),Kn=t=>e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-muted-foreground",children:[e.jsx("div",{className:"w-20 h-20 rounded-2xl bg-muted/50 flex items-center justify-center mb-6",children:e.jsx(kt,{weight:"duotone",className:"w-10 h-10 text-muted-foreground/50"})}),e.jsx("p",{className:"text-lg font-medium text-foreground mb-1",children:"No results found"}),e.jsxs("p",{className:"text-sm",children:['No assets match "',t,'"']})]}),Zn=e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-muted-foreground",children:[e.jsx("div",{className:"w-20 h-20 rounded-2xl bg-muted/50 flex items-center justify-center mb-6",children:e.jsx(St,{weight:"duotone",className:"w-10 h-10 text-muted-foreground/50"})}),e.jsx("p",{className:"text-lg font-medium text-foreground mb-1",children:"No assets found"}),e.jsx("p",{className:"text-sm",children:"Add images, videos, or documents to your project"})]});function Jn(){const t=Vn(),[s,a]=n.useState(null),[r,o]=n.useState(!1),[l,u]=n.useState(!1),[i,d]=n.useState(!1),{sizeFilter:c,setSizeFilter:m,dateFilter:p,setDateFilter:g,extensionFilter:f,setExtensionFilter:v,activeFilterCount:k,clearAll:b,filterParamsString:C}=Un(),_=n.useMemo(()=>C?new URLSearchParams(C):void 0,[C]),{groups:x,loading:F}=Fn(s,void 0,_),{stats:z}=Tn(),{results:M,searching:N,search:R,clear:L}=Mn(_),{isIgnored:G}=Ye(),{isDeleting:U,bulkDelete:$}=Wt(),[S,E]=n.useState(""),[X,qe]=n.useState(()=>new Set),[ye,ue]=n.useState(null),[Ne,qt]=n.useState({field:"name",direction:"asc"}),[B,ee]=n.useState(()=>new Set),[ke,ie]=n.useState(null),[le,Qe]=n.useState(null),[Ce,Se]=n.useState(!1),[H,ze]=n.useState(null),$e=n.useRef(null),Xe=n.useRef(null),et=n.useRef(!1),[Qt,tt]=n.useState(""),st=n.useCallback(h=>{ue(h)},[]),Xt=n.useCallback(()=>{ue(null)},[]),at=n.useCallback(()=>{o(h=>!h)},[]),nt=n.useCallback(()=>{u(h=>!h)},[]);n.useEffect(()=>{ee(new Set),ie(null)},[s,r,l,S,_]),n.useEffect(()=>{x.length>0&&!et.current&&(et.current=!0,qe(new Set(x.map(h=>h.directory))))},[x]),n.useEffect(()=>{const h=setTimeout(()=>{S?R(S):L()},200);return()=>clearTimeout(h)},[S,R,L]);const T=n.useMemo(()=>{let h=x;if(S&&M.length>0){const j=new Map;M.forEach(D=>{const A=D.directory;j.has(A)||j.set(A,[]),j.get(A).push(D)}),h=Array.from(j.entries()).map(([D,A])=>({directory:D,assets:A,count:A.length}))}let y=h;return r&&(y=y.map(j=>{const D=j.assets.filter(A=>A.importersCount===0&&!G(A.path));return{...j,assets:D,count:D.length}}).filter(j=>j.count>0)),l&&(y=y.map(j=>{const D=j.assets.filter(A=>(A.duplicatesCount??0)>0);return{...j,assets:D,count:D.length}}).filter(j=>j.count>0)),y.map(j=>({...j,assets:Bn(j.assets,Ne)}))},[x,M,S,Ne,r,l,G]),me=n.useMemo(()=>T.flatMap(h=>h.assets),[T]),es=n.useCallback(h=>{qe(y=>{const j=new Set(y);return j.has(h)?j.delete(h):j.add(h),j})},[]),ot=n.useCallback((h,y)=>{ee(j=>{const D=new Set(j);if(y&&ke){const A=T.flatMap(Y=>Y.assets),fe=A.findIndex(Y=>Y.id===ke),pe=A.findIndex(Y=>Y.id===h);if(fe!==-1&&pe!==-1){const[Y,is]=fe<pe?[fe,pe]:[pe,fe];for(let Ie=Y;Ie<=is;Ie++)D.add(A[Ie].id)}}else D.has(h)?D.delete(h):D.add(h);return D}),ie(h)},[ke,T]),rt=n.useCallback(()=>{const h=T.flatMap(y=>y.assets.map(j=>j.id));ee(new Set(h))},[T]),it=n.useCallback(()=>{ee(new Set),ie(null)},[]),_e=n.useMemo(()=>T.flatMap(y=>y.assets).filter(y=>B.has(y.id)),[T,B]),ts=n.useCallback(async()=>{await $(_e)&&(ee(new Set),ie(null))},[$,_e]),ss=n.useCallback(async()=>{if(!H)return;await $(H)&&(ee(new Set),ie(null),Qe(null)),ze(null)},[$,H]),as=n.useCallback(async h=>{try{const y=h.map(j=>j.path).join(`
131
131
  `);await navigator.clipboard.writeText(y)}catch(y){console.error("Failed to copy paths:",y)}},[]),ns=n.useCallback(async h=>{try{const y=await fetch(`/__asset_manager__/api/importers?path=${encodeURIComponent(h.path)}`);if(y.ok){const j=await y.json();if(j.importers&&j.importers.length>0){const D=j.importers[0];await fetch(`/__asset_manager__/api/open-in-editor?file=${encodeURIComponent(D.file)}&line=${D.line}&column=${D.column}`,{method:"POST"})}}}catch(y){console.error("Failed to open in editor:",y)}},[]),os=n.useCallback(async h=>{try{await fetch(`/__asset_manager__/api/reveal-in-finder?path=${encodeURIComponent(h.path)}`,{method:"POST"})}catch(y){console.error("Failed to reveal in finder:",y)}},[]);Rn({flatAssetList:me,focusedAssetId:le,setFocusedAssetId:Qe,isGridFocused:Ce,setIsGridFocused:Se,selectedAssets:B,toggleSelection:ot,selectAll:rt,clearSelection:it,previewAsset:ye,setPreviewAsset:ue,searchInputRef:$e,onCopyPaths:as,onDelete:h=>{ze(h)},onOpenInEditor:ns,onRevealInFinder:os}),n.useEffect(()=>{if(le&&Ce){const h=me.find(y=>y.id===le);h&&tt(`Focused on ${h.name}`)}},[le,Ce,me]),n.useEffect(()=>{B.size>0&&tt(`${B.size} asset${B.size===1?"":"s"} selected`)},[B.size]);const rs=n.useMemo(()=>T.reduce((h,y)=>h+y.count,0),[T]),te=n.useMemo(()=>{let h=0;for(const y of x)for(const j of y.assets)j.importersCount===0&&G(j.path)&&h++;return{...z,unused:Math.max(0,(z.unused||0)-h),duplicateFiles:z.duplicateFiles||0,extensionBreakdown:z.extensionBreakdown||{}}},[z,x,G]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:Qt}),e.jsxs("div",{className:"flex h-screen bg-background noise-bg",children:[e.jsx("div",{className:"hidden md:block",children:e.jsx(bt,{total:te.total,searchQuery:S,onSearchChange:E,searching:N,searchInputRef:$e,onSearchFocus:()=>Se(!1),selectedType:s,onTypeSelect:a,showUnusedOnly:r,onUnusedFilterToggle:at,showDuplicatesOnly:l,onDuplicatesFilterToggle:nt,stats:te})}),e.jsx(Dn,{open:i,onOpenChange:d,children:e.jsx(Pn,{side:"left",className:"p-0 w-70 sm:w-[320px]",children:e.jsx(bt,{total:te.total,searchQuery:S,onSearchChange:E,searching:N,searchInputRef:$e,onSearchFocus:()=>Se(!1),selectedType:s,onTypeSelect:h=>{a(h),d(!1)},showUnusedOnly:r,onUnusedFilterToggle:()=>{at(),d(!1)},showDuplicatesOnly:l,onDuplicatesFilterToggle:()=>{nt(),d(!1)},stats:te})})}),e.jsxs("main",{ref:Xe,className:"flex-1 overflow-auto flex flex-col",children:[e.jsx("header",{className:`sticky top-0 z-40 w-full border-b border-border bg-background/95 backdrop-blur supports-backdrop-filter:bg-background/60 ${t?"":"md:hidden"}`,children:e.jsxs("div",{className:"flex h-14 items-center justify-between px-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[!t&&e.jsx(P,{variant:"ghost",size:"icon-sm",className:"md:hidden","aria-label":"Toggle sidebar",onClick:()=>d(!0),children:e.jsx($s,{weight:"bold",className:"h-5 w-5"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-7 h-7 rounded-md bg-linear-to-br from-violet-500 to-purple-600 flex items-center justify-center shadow-md shadow-violet-500/20",children:e.jsx(Ct,{weight:"fill",className:"w-4 h-4 text-white"})}),e.jsx("div",{children:e.jsx("h1",{className:"font-mono text-xs font-semibold tracking-wide text-foreground",children:"ASSET MANAGER"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground tabular-nums",children:te.total}),t&&e.jsx(P,{variant:"ghost",size:"icon-sm",onClick:()=>window.open(window.location.pathname,"_blank"),"aria-label":"Open full dashboard in new tab",title:"Open full dashboard in new tab",children:e.jsx(_s,{weight:"bold",className:"h-5 w-5"})})]})]})}),F?Hn:e.jsxs(e.Fragment,{children:[e.jsx(Sn,{selectedCount:B.size,totalCount:rs,selectedAssets:_e,onSelectAll:rt,onDeselectAll:it,onDelete:ts,isDeleting:U,visible:B.size>0}),e.jsxs("div",{className:"p-3 sm:p-4 md:p-6 pt-2 space-y-3 sm:space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-end gap-1.5 sm:gap-2",children:[e.jsx(_n,{sizeFilter:c,dateFilter:p,extensionFilter:f,onSizeChange:m,onDateChange:g,onExtensionChange:v,onClearAll:b,activeCount:k,availableExtensions:Object.keys(te.extensionBreakdown||{})}),e.jsx(Cn,{value:Ne,onChange:qt})]}),T.length===0?S?Kn(S):Zn:T.map(h=>e.jsxs("div",{className:"rounded-xl border border-border bg-card/30 overflow-hidden",children:[e.jsxs("button",{onClick:()=>es(h.directory),className:"w-full flex items-center justify-between cursor-pointer px-4 py-3 hover:bg-muted/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(zt,{weight:"bold",className:`w-4 h-4 text-muted-foreground transition-transform duration-200 ${X.has(h.directory)?"rotate-90":""}`}),e.jsx($t,{weight:"duotone",className:"w-5 h-5 text-amber-400"}),e.jsx("span",{className:"font-mono text-sm font-medium text-foreground",children:h.directory})]}),e.jsxs("span",{className:"text-xs text-muted-foreground font-mono bg-muted/50 px-2 py-0.5 rounded-md",children:[h.count," ",h.count===1?"item":"items"]})]}),e.jsx("div",{className:`
132
132
  overflow-hidden transition-all duration-300 ease-in-out
133
133
  ${X.has(h.directory)?"max-h-500 opacity-100":"max-h-0 opacity-0"}
@@ -1,2 +1,2 @@
1
- import{j as e,r}from"./vendor-react-CZ2o2ZY4.js";import{Z as U,a0 as S,h as L,X as B,E as T,p as C,W as $,a1 as M,x as A,a2 as W,C as V,L as X,e as H}from"./vendor-icons-BoR7i9s2.js";import{c as y,B as w,F as O,u as q,a as K,b as G,g as Y}from"./index-DJcW-X-b.js";import{S as Z,s as k,Q,R as J,U as ee,V as te,a as ae}from"./vendor-ui-CBXnYcgF.js";import"./vendor-virtual-Cr-nkJSX.js";function j({className:o,orientation:t="horizontal",...s}){return e.jsx(Z,{"data-slot":"separator",orientation:t,className:y("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",o),...s})}const se=r.memo(function({asset:t,onDimensionsLoad:s}){const[l,a]=r.useState(!1),i=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`,n=r.useCallback(u=>{const c=u.currentTarget;s?.({width:c.naturalWidth,height:c.naturalHeight})},[s]),d=r.useCallback(()=>a(!0),[]);return l?e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Failed to load image"}):e.jsxs("div",{className:"relative w-full aspect-square overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 checkerboard"}),e.jsx("img",{src:i,alt:t.name,className:"relative w-full h-full object-contain",onLoad:n,onError:d})]})}),ne=r.memo(function({asset:t}){const[s,l]=r.useState(!1),a=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`,i=`/__asset_manager__/api/thumbnail?path=${encodeURIComponent(t.path)}`,n=t.path.split(".").pop()?.toUpperCase()||"VIDEO",d=r.useCallback(()=>l(!0),[]),u=r.useCallback(()=>{const c=document.createElement("a");c.href=a,c.download=t.name,c.click()},[a,t.name]);if(s){const c=n==="AVI";return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-6 text-center",children:[e.jsx(U,{className:"w-12 h-12 text-yellow-500",weight:"duotone"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold text-foreground",children:"Unable to play video"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:c?e.jsx(e.Fragment,{children:"This AVI file uses a codec that isn't supported by your browser. Most AVI files use legacy codecs (DivX, Xvid) that HTML5 video can't play."}):e.jsxs(e.Fragment,{children:["This ",n," video format or codec isn't supported by your browser's HTML5 video player."]})}),c&&e.jsx("p",{className:"text-xs text-muted-foreground max-w-md pt-2",children:"💡 Tip: Convert to MP4 (H.264) or WebM for browser compatibility"})]}),e.jsxs(w,{onClick:u,variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(S,{className:"w-4 h-4"}),"Download Video"]})]})}return e.jsx("div",{className:"relative w-full aspect-video bg-black rounded-lg overflow-hidden",children:e.jsx("video",{src:a,poster:i,controls:!0,className:"w-full h-full object-contain",onError:d,preload:"metadata",children:"Your browser does not support the video tag."})})}),re=r.memo(function({asset:t}){const[s,l]=r.useState(!1),a=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`,i=r.useCallback(()=>l(!0),[]);return s?e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Failed to load audio"}):e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-6 bg-muted/30 rounded-lg",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(L,{weight:"duotone",className:"w-10 h-10 text-primary"})}),e.jsx("audio",{src:a,controls:!0,className:"w-full max-w-[280px]",onError:i,preload:"metadata",children:"Your browser does not support the audio tag."})]})}),I=5e4,oe=r.memo(function({asset:t}){const[s,l]=r.useState(null),[a,i]=r.useState(!0),[n,d]=r.useState(null),[u,c]=r.useState(!1);return r.useEffect(()=>{(async()=>{i(!0),d(null),c(!1);try{const g=await fetch(`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`);if(!g.ok)throw new Error("Failed to fetch file");const v=await g.text();v.length>I?(l(v.slice(0,I)),c(!0)):l(v)}catch(g){d(g instanceof Error?g.message:"Failed to load file")}finally{i(!1)}})()},[t.path]),a?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(B,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):n?e.jsx("div",{className:"flex items-center justify-center h-40 text-muted-foreground text-sm",children:n}):e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"bg-muted/50 rounded-lg p-4 overflow-x-auto text-xs font-mono max-h-80 overflow-y-auto",children:e.jsx("code",{className:"text-foreground/80 whitespace-pre-wrap wrap-break-word",children:s})}),u&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-12 bg-linear-to-t from-muted/80 to-transparent flex items-end justify-center pb-2",children:e.jsx("span",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded",children:"Content truncated (file too large)"})})]})}),ie="The quick brown fox jumps over the lazy dog",le=[14,18,24,32,48],de=r.memo(function({asset:t}){const[s,l]=r.useState(!1),[a,i]=r.useState(!1),d=`preview-font-${r.useId().replace(/:/g,"-")}`,u=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`;return r.useEffect(()=>((async()=>{try{const m=new FontFace(d,`url(${u})`);await m.load(),document.fonts.add(m),l(!0)}catch(m){console.error("Failed to load font:",m),i(!0)}})(),()=>{document.fonts.forEach(m=>{m.family===d&&document.fonts.delete(m)})}),[u,d]),a?e.jsx("div",{className:"flex items-center justify-center h-40 text-muted-foreground text-sm",children:"Failed to load font"}):s?e.jsxs("div",{className:"space-y-4 p-4 bg-muted/30 rounded-lg overflow-hidden",children:[le.map(c=>e.jsxs("div",{className:"space-y-1 overflow-hidden",children:[e.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[c,"px"]}),e.jsx("p",{style:{fontFamily:d,fontSize:c},className:"text-foreground leading-tight truncate",children:ie})]},c)),e.jsxs("div",{className:"pt-4 border-t border-border overflow-hidden",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground font-mono mb-2 block",children:"Characters"}),e.jsx("p",{style:{fontFamily:d},className:"text-lg text-foreground leading-relaxed break-all",children:"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),e.jsx("p",{style:{fontFamily:d},className:"text-lg text-foreground leading-relaxed break-all",children:"abcdefghijklmnopqrstuvwxyz"}),e.jsx("p",{style:{fontFamily:d},className:"text-lg text-foreground leading-relaxed break-all",children:"0123456789 !@#$%^&*()"})]})]}):e.jsx("div",{className:"flex items-center justify-center h-40 text-muted-foreground text-sm",children:"Loading font..."})}),E=r.memo(function({asset:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-8 bg-muted/30 rounded-lg",children:[e.jsx(O,{extension:t.extension,className:"w-20 h-20"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground mb-1",children:t.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Download to preview this file type"})]})]})}),ce=r.memo(function({asset:t,onDimensionsLoad:s}){const l=()=>{switch(t.type){case"image":return e.jsx(se,{asset:t,onDimensionsLoad:s});case"video":return e.jsx(ne,{asset:t});case"audio":return e.jsx(re,{asset:t});case"data":case"text":return e.jsx(oe,{asset:t});case"font":return e.jsx(de,{asset:t});case"document":if(t.extension===".pdf"){const a=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`;return e.jsx("iframe",{src:a,className:"w-full aspect-[3/4] rounded-lg border border-border",title:t.name})}return e.jsx(E,{asset:t});default:return e.jsx(E,{asset:t})}};return e.jsxs("div",{className:"p-4 overflow-hidden",children:[e.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-3",children:"Preview"}),l()]})});function ue(o){if(o===0)return"0 B";const t=1024,s=["B","KB","MB","GB"],l=Math.floor(Math.log(o)/Math.log(t));return parseFloat((o/Math.pow(t,l)).toFixed(1))+" "+s[l]}function me(o){const t=new Date(o),l=new Date().getTime()-t.getTime(),a=Math.floor(l/(1e3*60*60*24)),i=new Intl.DateTimeFormat("en-GB",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(t);let n="";if(a===0)n="today";else if(a===1)n="yesterday";else if(a<30)n=`${a} days ago`;else if(a<365){const d=Math.floor(a/30);n=`${d} ${d===1?"month":"months"} ago`}else{const d=Math.floor(a/365);n=`${d} ${d===1?"year":"years"} ago`}return`${i} (${n})`}function xe(o){return o.path.startsWith("public/")?"/"+o.path.slice(7):"/"+o.path}function fe(o,t){const s=(d,u)=>u===0?d:s(u,d%u),l=s(o,t),a=o/l,i=t/l;if(a===i)return"1:1";if(a<=20&&i<=20)return`${a}:${i}`;const n=o/t;return Math.abs(n-16/9)<.01?"16:9":Math.abs(n-4/3)<.01?"4:3":Math.abs(n-3/2)<.01?"3:2":Math.abs(n-21/9)<.01?"21:9":n.toFixed(2)+":1"}function he(o){return o.charAt(0).toUpperCase()+o.slice(1)}const b=r.memo(function({label:t,value:s,copyable:l,externalLink:a}){const[i,n]=r.useState(!1),d=r.useCallback(async()=>{try{await navigator.clipboard.writeText(s),n(!0),k.success("Copied to clipboard"),setTimeout(()=>n(!1),2e3)}catch{k.error("Failed to copy")}},[s]),u=r.useCallback(()=>{a&&window.open(a,"_blank")},[a]);return e.jsxs("div",{className:"flex items-start justify-between gap-2 py-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:t}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"text-xs text-foreground font-medium text-right truncate",title:s,children:s}),l&&e.jsx("button",{onClick:d,className:"p-1 rounded hover:bg-muted/50 transition-colors shrink-0","aria-label":`Copy ${t}`,children:i?e.jsx(T,{weight:"bold",className:"w-3 h-3 text-emerald-500"}):e.jsx(C,{weight:"bold",className:"w-3 h-3 text-muted-foreground"})}),a&&e.jsx("button",{onClick:u,className:"p-1 rounded hover:bg-muted/50 transition-colors shrink-0","aria-label":`Open ${t} externally`,children:e.jsx($,{weight:"bold",className:"w-3 h-3 text-muted-foreground"})})]})]})}),pe=r.memo(function({asset:t,imageDimensions:s}){const l=xe(t),a=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`;return e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Details"}),e.jsxs("div",{className:"divide-y divide-border",children:[e.jsx(b,{label:"Filepath",value:t.absolutePath,copyable:!0,externalLink:a}),e.jsx(b,{label:"Public Path",value:l,copyable:!0}),e.jsx(b,{label:"Type",value:he(t.type)}),s&&e.jsxs(e.Fragment,{children:[e.jsx(b,{label:"Image Size",value:`${s.width} x ${s.height}`}),e.jsx(b,{label:"Aspect Ratio",value:fe(s.width,s.height)})]}),e.jsx(b,{label:"File size",value:ue(t.size)}),e.jsx(b,{label:"Last modified",value:me(t.mtime)})]})]})}),ge={"es-import":"ES Import","dynamic-import":"Dynamic Import",require:"Require","css-url":"CSS url()","html-src":"HTML src","html-href":"HTML href"},be=r.memo(function({asset:t}){const{importers:s,loading:l,openInEditor:a}=q(t.path);return e.jsxs("div",{className:"p-4",children:[e.jsxs("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:["Importers ",!l&&`(${s.length})`]}),l?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground py-2",children:[e.jsx(M,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{className:"text-xs",children:"Scanning..."})]}):s.length===0?e.jsx("p",{className:"text-xs text-muted-foreground py-2",children:"No imports found"}):e.jsx("div",{className:"space-y-1",children:s.map((i,n)=>e.jsxs("button",{onClick:()=>a(i),className:"w-full text-left p-2 rounded-md hover:bg-muted/50 transition-colors group",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(A,{weight:"bold",className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-xs font-medium truncate",children:i.filePath}),e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[":",i.line]})]}),e.jsx($,{weight:"bold",className:"w-3.5 h-3.5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]}),e.jsxs("div",{className:"mt-1 pl-5",children:[e.jsx("code",{className:"text-[10px] text-muted-foreground font-mono truncate block",children:i.snippet}),e.jsx("span",{className:"text-[10px] text-muted-foreground/70",children:ge[i.importType]||i.importType})]})]},`${i.filePath}:${i.line}:${n}`))})]})});function ve(o){const[t,s]=r.useState([]),[l,a]=r.useState(!0),[i,n]=r.useState(null),{subscribe:d}=K(),u=r.useCallback(async()=>{if(!o){s([]),a(!1);return}try{a(!0),n(null);const c=await fetch(`/__asset_manager__/api/duplicates?hash=${encodeURIComponent(o)}`);if(!c.ok)throw new Error("Failed to fetch duplicates");const m=await c.json();s(m.duplicates)}catch(c){n(c instanceof Error?c.message:"Unknown error")}finally{a(!1)}},[o]);return r.useEffect(()=>{u();const c=d("asset-manager:duplicates-update",()=>{u()}),m=d("asset-manager:update",()=>{u()});return()=>{c(),m()}},[o,u,d]),{duplicates:t,loading:l,error:i}}function je(o){if(o===0)return"0 B";const t=1024,s=["B","KB","MB","GB"],l=Math.floor(Math.log(o)/Math.log(t));return parseFloat((o/Math.pow(t,l)).toFixed(1))+" "+s[l]}const we=r.memo(function({asset:t,onSelectAsset:s}){const{duplicates:l,loading:a}=ve(t.contentHash),i=l.filter(n=>n.path!==t.path);return e.jsxs("div",{className:"p-4",children:[e.jsxs("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:["Duplicates ",!a&&`(${i.length})`]}),a?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground py-2",children:[e.jsx(M,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{className:"text-xs",children:"Scanning..."})]}):i.length===0?e.jsx("p",{className:"text-xs text-muted-foreground py-2",children:"No duplicates found"}):e.jsx("div",{className:"space-y-1",children:i.map(n=>e.jsxs("button",{onClick:()=>s?.(n),className:"w-full text-left p-2 rounded-md hover:bg-muted/50 transition-colors group",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(C,{weight:"bold",className:"w-3.5 h-3.5 text-blue-400 shrink-0"}),e.jsx("span",{className:"text-xs font-medium truncate",children:n.name})]}),e.jsx("span",{className:"text-xs text-muted-foreground font-mono tabular-nums shrink-0",children:je(n.size)})]}),e.jsx("div",{className:"mt-1 pl-5",children:e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[e.jsx(W,{weight:"fill",className:"w-3 h-3"}),e.jsx("span",{className:"truncate",children:n.directory})]})})]},n.id))})]})}),ye=r.memo(function({asset:t}){const s=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`,{isIgnored:l,toggleIgnored:a}=G(),i=l(t.path),n=r.useCallback(()=>{const u=document.createElement("a");u.href=s,u.download=t.name,document.body.appendChild(u),u.click(),document.body.removeChild(u)},[s,t.name]),d=r.useCallback(()=>{a(t.path)},[t.path,a]);return e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-3",children:"Actions"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(w,{variant:"secondary",size:"sm",onClick:n,className:"w-full justify-start gap-2",children:[e.jsx(S,{weight:"bold",className:"w-4 h-4"}),"Download"]}),t.importersCount===0&&e.jsx(w,{variant:i?"default":"outline",size:"sm",onClick:d,className:"w-full justify-start gap-2",title:i?"Remove from ignore list - asset will appear in unused filter again":"Mark as intentionally unused - won't appear in unused filter",children:i?e.jsxs(e.Fragment,{children:[e.jsx(V,{weight:"bold",className:"w-4 h-4"}),"Unmark as Ignored"]}):e.jsxs(e.Fragment,{children:[e.jsx(X,{weight:"bold",className:"w-4 h-4"}),"Mark as Ignored"]})})]})]})});function Ne({className:o,orientation:t="horizontal",...s}){return e.jsx(Q,{"data-slot":"tabs","data-orientation":t,className:y("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",o),...s})}const ke=ae("rounded-lg p-[3px] group-data-horizontal/tabs:h-8 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function _e({className:o,variant:t="default",...s}){return e.jsx(J,{"data-slot":"tabs-list","data-variant":t,className:y(ke({variant:t}),o),...s})}function Ce({className:o,...t}){return e.jsx(ee,{"data-slot":"tabs-trigger",className:y("gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium group-data-vertical/tabs:py-[calc(--spacing(1.25))] [&_svg:not([class*='size-'])]:size-3.5 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",o),...t})}function Ie({className:o,...t}){return e.jsx(te,{"data-slot":"tabs-content",className:y("text-xs/relaxed flex-1 outline-none",o),...t})}const Ee=r.memo(function({asset:t}){const[s,l]=r.useState(null),a=r.useMemo(()=>Y(t),[t]),i=r.useCallback(async(n,d)=>{try{await navigator.clipboard.writeText(n),l(d),k.success("Copied to clipboard"),setTimeout(()=>l(null),2e3)}catch{k.error("Failed to copy")}},[]);return a.length===0?null:e.jsx("div",{className:"p-4",children:e.jsxs(Ne,{defaultValue:a[0].type,children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsx(_e,{variant:"line",activateOnFocus:!0,children:a.map(n=>e.jsx(Ce,{value:n.type,children:n.label},n.type))})}),a.map(n=>e.jsx(Ie,{value:n.type,children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"bg-muted/50 rounded-lg p-4 pr-12 overflow-x-auto text-xs font-mono",children:e.jsx("code",{className:"text-foreground/80",children:n.code})}),e.jsx(w,{variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2",onClick:()=>i(n.code,n.type),"aria-label":"Copy code",children:s===n.type?e.jsx(T,{weight:"bold",className:"w-4 h-4 text-emerald-500"}):e.jsx(C,{weight:"bold",className:"w-4 h-4"})})]})},n.type))]})})}),Se=300,Te=600,$e=384,Re=r.memo(function({asset:t,onClose:s,onSelectAsset:l,flatAssetList:a=[],onAssetChange:i}){const n=r.useRef(null),[d,u]=r.useState({assetId:t.id,dimensions:null}),[c,m]=r.useState($e),[g,v]=r.useState(!1),F=d.assetId===t.id?d.dimensions:null,P=r.useCallback(f=>{f.preventDefault(),v(!0);const x=f.clientX,N=c,_=h=>{const z=x-h.clientX,R=Math.min(Math.max(N+z,Se),Te);m(R)},p=()=>{v(!1),document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",p)};document.addEventListener("mousemove",_),document.addEventListener("mouseup",p)},[c]);r.useEffect(()=>{const f=x=>{x.key==="Escape"&&(x.preventDefault(),s())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[s]),r.useEffect(()=>{if(!a.length||!i)return;const f=x=>{const N=x.target;if(N.tagName==="INPUT"||N.tagName==="TEXTAREA")return;const p=a.findIndex(h=>h.id===t.id);if(p!==-1){if(x.key==="ArrowRight"||x.key==="j"){x.preventDefault();const h=Math.min(p+1,a.length-1);h!==p&&i(a[h])}else if(x.key==="ArrowLeft"||x.key==="k"){x.preventDefault();const h=Math.max(p-1,0);h!==p&&i(a[h])}}};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[t.id,a,i]),r.useEffect(()=>{n.current?.focus()},[]);const D=r.useCallback(f=>{u({assetId:t.id,dimensions:f})},[t.id]);return e.jsxs("aside",{role:"region","aria-label":`Preview of ${t.name}`,style:{width:typeof window<"u"&&window.innerWidth>=768?c:void 0},className:`fixed top-0 right-0 z-50 h-screen md:h-screen border-l border-border bg-card/80 backdrop-blur-sm flex flex-col overflow-hidden animate-slide-in-right
1
+ import{j as e,r}from"./vendor-react-CZ2o2ZY4.js";import{Z as U,a0 as S,h as L,X as B,E as T,p as C,W as $,a1 as M,x as A,a2 as W,C as V,L as X,e as H}from"./vendor-icons-BoR7i9s2.js";import{c as y,B as w,F as O,u as q,a as K,b as G,g as Y}from"./index-BiBe_7iw.js";import{S as Z,s as k,Q,R as J,U as ee,V as te,a as ae}from"./vendor-ui-CBXnYcgF.js";import"./vendor-virtual-Cr-nkJSX.js";function j({className:o,orientation:t="horizontal",...s}){return e.jsx(Z,{"data-slot":"separator",orientation:t,className:y("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",o),...s})}const se=r.memo(function({asset:t,onDimensionsLoad:s}){const[l,a]=r.useState(!1),i=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`,n=r.useCallback(u=>{const c=u.currentTarget;s?.({width:c.naturalWidth,height:c.naturalHeight})},[s]),d=r.useCallback(()=>a(!0),[]);return l?e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Failed to load image"}):e.jsxs("div",{className:"relative w-full aspect-square overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 checkerboard"}),e.jsx("img",{src:i,alt:t.name,className:"relative w-full h-full object-contain",onLoad:n,onError:d})]})}),ne=r.memo(function({asset:t}){const[s,l]=r.useState(!1),a=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`,i=`/__asset_manager__/api/thumbnail?path=${encodeURIComponent(t.path)}`,n=t.path.split(".").pop()?.toUpperCase()||"VIDEO",d=r.useCallback(()=>l(!0),[]),u=r.useCallback(()=>{const c=document.createElement("a");c.href=a,c.download=t.name,c.click()},[a,t.name]);if(s){const c=n==="AVI";return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-6 text-center",children:[e.jsx(U,{className:"w-12 h-12 text-yellow-500",weight:"duotone"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold text-foreground",children:"Unable to play video"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:c?e.jsx(e.Fragment,{children:"This AVI file uses a codec that isn't supported by your browser. Most AVI files use legacy codecs (DivX, Xvid) that HTML5 video can't play."}):e.jsxs(e.Fragment,{children:["This ",n," video format or codec isn't supported by your browser's HTML5 video player."]})}),c&&e.jsx("p",{className:"text-xs text-muted-foreground max-w-md pt-2",children:"💡 Tip: Convert to MP4 (H.264) or WebM for browser compatibility"})]}),e.jsxs(w,{onClick:u,variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(S,{className:"w-4 h-4"}),"Download Video"]})]})}return e.jsx("div",{className:"relative w-full aspect-video bg-black rounded-lg overflow-hidden",children:e.jsx("video",{src:a,poster:i,controls:!0,className:"w-full h-full object-contain",onError:d,preload:"metadata",children:"Your browser does not support the video tag."})})}),re=r.memo(function({asset:t}){const[s,l]=r.useState(!1),a=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`,i=r.useCallback(()=>l(!0),[]);return s?e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Failed to load audio"}):e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-6 bg-muted/30 rounded-lg",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(L,{weight:"duotone",className:"w-10 h-10 text-primary"})}),e.jsx("audio",{src:a,controls:!0,className:"w-full max-w-[280px]",onError:i,preload:"metadata",children:"Your browser does not support the audio tag."})]})}),I=5e4,oe=r.memo(function({asset:t}){const[s,l]=r.useState(null),[a,i]=r.useState(!0),[n,d]=r.useState(null),[u,c]=r.useState(!1);return r.useEffect(()=>{(async()=>{i(!0),d(null),c(!1);try{const g=await fetch(`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`);if(!g.ok)throw new Error("Failed to fetch file");const v=await g.text();v.length>I?(l(v.slice(0,I)),c(!0)):l(v)}catch(g){d(g instanceof Error?g.message:"Failed to load file")}finally{i(!1)}})()},[t.path]),a?e.jsx("div",{className:"flex items-center justify-center h-40",children:e.jsx(B,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):n?e.jsx("div",{className:"flex items-center justify-center h-40 text-muted-foreground text-sm",children:n}):e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"bg-muted/50 rounded-lg p-4 overflow-x-auto text-xs font-mono max-h-80 overflow-y-auto",children:e.jsx("code",{className:"text-foreground/80 whitespace-pre-wrap wrap-break-word",children:s})}),u&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-12 bg-linear-to-t from-muted/80 to-transparent flex items-end justify-center pb-2",children:e.jsx("span",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded",children:"Content truncated (file too large)"})})]})}),ie="The quick brown fox jumps over the lazy dog",le=[14,18,24,32,48],de=r.memo(function({asset:t}){const[s,l]=r.useState(!1),[a,i]=r.useState(!1),d=`preview-font-${r.useId().replace(/:/g,"-")}`,u=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`;return r.useEffect(()=>((async()=>{try{const m=new FontFace(d,`url(${u})`);await m.load(),document.fonts.add(m),l(!0)}catch(m){console.error("Failed to load font:",m),i(!0)}})(),()=>{document.fonts.forEach(m=>{m.family===d&&document.fonts.delete(m)})}),[u,d]),a?e.jsx("div",{className:"flex items-center justify-center h-40 text-muted-foreground text-sm",children:"Failed to load font"}):s?e.jsxs("div",{className:"space-y-4 p-4 bg-muted/30 rounded-lg overflow-hidden",children:[le.map(c=>e.jsxs("div",{className:"space-y-1 overflow-hidden",children:[e.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[c,"px"]}),e.jsx("p",{style:{fontFamily:d,fontSize:c},className:"text-foreground leading-tight truncate",children:ie})]},c)),e.jsxs("div",{className:"pt-4 border-t border-border overflow-hidden",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground font-mono mb-2 block",children:"Characters"}),e.jsx("p",{style:{fontFamily:d},className:"text-lg text-foreground leading-relaxed break-all",children:"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),e.jsx("p",{style:{fontFamily:d},className:"text-lg text-foreground leading-relaxed break-all",children:"abcdefghijklmnopqrstuvwxyz"}),e.jsx("p",{style:{fontFamily:d},className:"text-lg text-foreground leading-relaxed break-all",children:"0123456789 !@#$%^&*()"})]})]}):e.jsx("div",{className:"flex items-center justify-center h-40 text-muted-foreground text-sm",children:"Loading font..."})}),E=r.memo(function({asset:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-8 bg-muted/30 rounded-lg",children:[e.jsx(O,{extension:t.extension,className:"w-20 h-20"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground mb-1",children:t.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Download to preview this file type"})]})]})}),ce=r.memo(function({asset:t,onDimensionsLoad:s}){const l=()=>{switch(t.type){case"image":return e.jsx(se,{asset:t,onDimensionsLoad:s});case"video":return e.jsx(ne,{asset:t});case"audio":return e.jsx(re,{asset:t});case"data":case"text":return e.jsx(oe,{asset:t});case"font":return e.jsx(de,{asset:t});case"document":if(t.extension===".pdf"){const a=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`;return e.jsx("iframe",{src:a,className:"w-full aspect-[3/4] rounded-lg border border-border",title:t.name})}return e.jsx(E,{asset:t});default:return e.jsx(E,{asset:t})}};return e.jsxs("div",{className:"p-4 overflow-hidden",children:[e.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-3",children:"Preview"}),l()]})});function ue(o){if(o===0)return"0 B";const t=1024,s=["B","KB","MB","GB"],l=Math.floor(Math.log(o)/Math.log(t));return parseFloat((o/Math.pow(t,l)).toFixed(1))+" "+s[l]}function me(o){const t=new Date(o),l=new Date().getTime()-t.getTime(),a=Math.floor(l/(1e3*60*60*24)),i=new Intl.DateTimeFormat("en-GB",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(t);let n="";if(a===0)n="today";else if(a===1)n="yesterday";else if(a<30)n=`${a} days ago`;else if(a<365){const d=Math.floor(a/30);n=`${d} ${d===1?"month":"months"} ago`}else{const d=Math.floor(a/365);n=`${d} ${d===1?"year":"years"} ago`}return`${i} (${n})`}function xe(o){return o.path.startsWith("public/")?"/"+o.path.slice(7):"/"+o.path}function fe(o,t){const s=(d,u)=>u===0?d:s(u,d%u),l=s(o,t),a=o/l,i=t/l;if(a===i)return"1:1";if(a<=20&&i<=20)return`${a}:${i}`;const n=o/t;return Math.abs(n-16/9)<.01?"16:9":Math.abs(n-4/3)<.01?"4:3":Math.abs(n-3/2)<.01?"3:2":Math.abs(n-21/9)<.01?"21:9":n.toFixed(2)+":1"}function he(o){return o.charAt(0).toUpperCase()+o.slice(1)}const b=r.memo(function({label:t,value:s,copyable:l,externalLink:a}){const[i,n]=r.useState(!1),d=r.useCallback(async()=>{try{await navigator.clipboard.writeText(s),n(!0),k.success("Copied to clipboard"),setTimeout(()=>n(!1),2e3)}catch{k.error("Failed to copy")}},[s]),u=r.useCallback(()=>{a&&window.open(a,"_blank")},[a]);return e.jsxs("div",{className:"flex items-start justify-between gap-2 py-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:t}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"text-xs text-foreground font-medium text-right truncate",title:s,children:s}),l&&e.jsx("button",{onClick:d,className:"p-1 rounded hover:bg-muted/50 transition-colors shrink-0","aria-label":`Copy ${t}`,children:i?e.jsx(T,{weight:"bold",className:"w-3 h-3 text-emerald-500"}):e.jsx(C,{weight:"bold",className:"w-3 h-3 text-muted-foreground"})}),a&&e.jsx("button",{onClick:u,className:"p-1 rounded hover:bg-muted/50 transition-colors shrink-0","aria-label":`Open ${t} externally`,children:e.jsx($,{weight:"bold",className:"w-3 h-3 text-muted-foreground"})})]})]})}),pe=r.memo(function({asset:t,imageDimensions:s}){const l=xe(t),a=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`;return e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Details"}),e.jsxs("div",{className:"divide-y divide-border",children:[e.jsx(b,{label:"Filepath",value:t.absolutePath,copyable:!0,externalLink:a}),e.jsx(b,{label:"Public Path",value:l,copyable:!0}),e.jsx(b,{label:"Type",value:he(t.type)}),s&&e.jsxs(e.Fragment,{children:[e.jsx(b,{label:"Image Size",value:`${s.width} x ${s.height}`}),e.jsx(b,{label:"Aspect Ratio",value:fe(s.width,s.height)})]}),e.jsx(b,{label:"File size",value:ue(t.size)}),e.jsx(b,{label:"Last modified",value:me(t.mtime)})]})]})}),ge={"es-import":"ES Import","dynamic-import":"Dynamic Import",require:"Require","css-url":"CSS url()","html-src":"HTML src","html-href":"HTML href"},be=r.memo(function({asset:t}){const{importers:s,loading:l,openInEditor:a}=q(t.path);return e.jsxs("div",{className:"p-4",children:[e.jsxs("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:["Importers ",!l&&`(${s.length})`]}),l?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground py-2",children:[e.jsx(M,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{className:"text-xs",children:"Scanning..."})]}):s.length===0?e.jsx("p",{className:"text-xs text-muted-foreground py-2",children:"No imports found"}):e.jsx("div",{className:"space-y-1",children:s.map((i,n)=>e.jsxs("button",{onClick:()=>a(i),className:"w-full text-left p-2 rounded-md hover:bg-muted/50 transition-colors group",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(A,{weight:"bold",className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-xs font-medium truncate",children:i.filePath}),e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[":",i.line]})]}),e.jsx($,{weight:"bold",className:"w-3.5 h-3.5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]}),e.jsxs("div",{className:"mt-1 pl-5",children:[e.jsx("code",{className:"text-[10px] text-muted-foreground font-mono truncate block",children:i.snippet}),e.jsx("span",{className:"text-[10px] text-muted-foreground/70",children:ge[i.importType]||i.importType})]})]},`${i.filePath}:${i.line}:${n}`))})]})});function ve(o){const[t,s]=r.useState([]),[l,a]=r.useState(!0),[i,n]=r.useState(null),{subscribe:d}=K(),u=r.useCallback(async()=>{if(!o){s([]),a(!1);return}try{a(!0),n(null);const c=await fetch(`/__asset_manager__/api/duplicates?hash=${encodeURIComponent(o)}`);if(!c.ok)throw new Error("Failed to fetch duplicates");const m=await c.json();s(m.duplicates)}catch(c){n(c instanceof Error?c.message:"Unknown error")}finally{a(!1)}},[o]);return r.useEffect(()=>{u();const c=d("asset-manager:duplicates-update",()=>{u()}),m=d("asset-manager:update",()=>{u()});return()=>{c(),m()}},[o,u,d]),{duplicates:t,loading:l,error:i}}function je(o){if(o===0)return"0 B";const t=1024,s=["B","KB","MB","GB"],l=Math.floor(Math.log(o)/Math.log(t));return parseFloat((o/Math.pow(t,l)).toFixed(1))+" "+s[l]}const we=r.memo(function({asset:t,onSelectAsset:s}){const{duplicates:l,loading:a}=ve(t.contentHash),i=l.filter(n=>n.path!==t.path);return e.jsxs("div",{className:"p-4",children:[e.jsxs("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:["Duplicates ",!a&&`(${i.length})`]}),a?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground py-2",children:[e.jsx(M,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{className:"text-xs",children:"Scanning..."})]}):i.length===0?e.jsx("p",{className:"text-xs text-muted-foreground py-2",children:"No duplicates found"}):e.jsx("div",{className:"space-y-1",children:i.map(n=>e.jsxs("button",{onClick:()=>s?.(n),className:"w-full text-left p-2 rounded-md hover:bg-muted/50 transition-colors group",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(C,{weight:"bold",className:"w-3.5 h-3.5 text-blue-400 shrink-0"}),e.jsx("span",{className:"text-xs font-medium truncate",children:n.name})]}),e.jsx("span",{className:"text-xs text-muted-foreground font-mono tabular-nums shrink-0",children:je(n.size)})]}),e.jsx("div",{className:"mt-1 pl-5",children:e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[e.jsx(W,{weight:"fill",className:"w-3 h-3"}),e.jsx("span",{className:"truncate",children:n.directory})]})})]},n.id))})]})}),ye=r.memo(function({asset:t}){const s=`/__asset_manager__/api/file?path=${encodeURIComponent(t.path)}`,{isIgnored:l,toggleIgnored:a}=G(),i=l(t.path),n=r.useCallback(()=>{const u=document.createElement("a");u.href=s,u.download=t.name,document.body.appendChild(u),u.click(),document.body.removeChild(u)},[s,t.name]),d=r.useCallback(()=>{a(t.path)},[t.path,a]);return e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-3",children:"Actions"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(w,{variant:"secondary",size:"sm",onClick:n,className:"w-full justify-start gap-2",children:[e.jsx(S,{weight:"bold",className:"w-4 h-4"}),"Download"]}),t.importersCount===0&&e.jsx(w,{variant:i?"default":"outline",size:"sm",onClick:d,className:"w-full justify-start gap-2",title:i?"Remove from ignore list - asset will appear in unused filter again":"Mark as intentionally unused - won't appear in unused filter",children:i?e.jsxs(e.Fragment,{children:[e.jsx(V,{weight:"bold",className:"w-4 h-4"}),"Unmark as Ignored"]}):e.jsxs(e.Fragment,{children:[e.jsx(X,{weight:"bold",className:"w-4 h-4"}),"Mark as Ignored"]})})]})]})});function Ne({className:o,orientation:t="horizontal",...s}){return e.jsx(Q,{"data-slot":"tabs","data-orientation":t,className:y("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",o),...s})}const ke=ae("rounded-lg p-[3px] group-data-horizontal/tabs:h-8 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function _e({className:o,variant:t="default",...s}){return e.jsx(J,{"data-slot":"tabs-list","data-variant":t,className:y(ke({variant:t}),o),...s})}function Ce({className:o,...t}){return e.jsx(ee,{"data-slot":"tabs-trigger",className:y("gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium group-data-vertical/tabs:py-[calc(--spacing(1.25))] [&_svg:not([class*='size-'])]:size-3.5 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",o),...t})}function Ie({className:o,...t}){return e.jsx(te,{"data-slot":"tabs-content",className:y("text-xs/relaxed flex-1 outline-none",o),...t})}const Ee=r.memo(function({asset:t}){const[s,l]=r.useState(null),a=r.useMemo(()=>Y(t),[t]),i=r.useCallback(async(n,d)=>{try{await navigator.clipboard.writeText(n),l(d),k.success("Copied to clipboard"),setTimeout(()=>l(null),2e3)}catch{k.error("Failed to copy")}},[]);return a.length===0?null:e.jsx("div",{className:"p-4",children:e.jsxs(Ne,{defaultValue:a[0].type,children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsx(_e,{variant:"line",activateOnFocus:!0,children:a.map(n=>e.jsx(Ce,{value:n.type,children:n.label},n.type))})}),a.map(n=>e.jsx(Ie,{value:n.type,children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"bg-muted/50 rounded-lg p-4 pr-12 overflow-x-auto text-xs font-mono",children:e.jsx("code",{className:"text-foreground/80",children:n.code})}),e.jsx(w,{variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2",onClick:()=>i(n.code,n.type),"aria-label":"Copy code",children:s===n.type?e.jsx(T,{weight:"bold",className:"w-4 h-4 text-emerald-500"}):e.jsx(C,{weight:"bold",className:"w-4 h-4"})})]})},n.type))]})})}),Se=300,Te=600,$e=384,Re=r.memo(function({asset:t,onClose:s,onSelectAsset:l,flatAssetList:a=[],onAssetChange:i}){const n=r.useRef(null),[d,u]=r.useState({assetId:t.id,dimensions:null}),[c,m]=r.useState($e),[g,v]=r.useState(!1),F=d.assetId===t.id?d.dimensions:null,P=r.useCallback(f=>{f.preventDefault(),v(!0);const x=f.clientX,N=c,_=h=>{const z=x-h.clientX,R=Math.min(Math.max(N+z,Se),Te);m(R)},p=()=>{v(!1),document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",p)};document.addEventListener("mousemove",_),document.addEventListener("mouseup",p)},[c]);r.useEffect(()=>{const f=x=>{x.key==="Escape"&&(x.preventDefault(),s())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[s]),r.useEffect(()=>{if(!a.length||!i)return;const f=x=>{const N=x.target;if(N.tagName==="INPUT"||N.tagName==="TEXTAREA")return;const p=a.findIndex(h=>h.id===t.id);if(p!==-1){if(x.key==="ArrowRight"||x.key==="j"){x.preventDefault();const h=Math.min(p+1,a.length-1);h!==p&&i(a[h])}else if(x.key==="ArrowLeft"||x.key==="k"){x.preventDefault();const h=Math.max(p-1,0);h!==p&&i(a[h])}}};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[t.id,a,i]),r.useEffect(()=>{n.current?.focus()},[]);const D=r.useCallback(f=>{u({assetId:t.id,dimensions:f})},[t.id]);return e.jsxs("aside",{role:"region","aria-label":`Preview of ${t.name}`,style:{width:typeof window<"u"&&window.innerWidth>=768?c:void 0},className:`fixed top-0 right-0 z-50 h-screen md:h-screen border-l border-border bg-card/80 backdrop-blur-sm flex flex-col overflow-hidden animate-slide-in-right
2
2
  max-md:top-auto max-md:bottom-0 max-md:left-0 max-md:right-0 max-md:h-[85vh] max-md:w-full! max-md:rounded-t-2xl max-md:border-l-0 max-md:border-t`,children:[e.jsx("div",{onMouseDown:P,className:`absolute left-0 top-0 h-full w-1.5 cursor-col-resize hover:bg-primary/50 active:bg-primary/70 transition-colors z-10 max-md:hidden ${g?"bg-primary/70":""}`,"aria-hidden":"true"}),e.jsx("div",{className:"md:hidden flex justify-center pt-2 pb-1","aria-hidden":"true",children:e.jsx("div",{className:"w-10 h-1 rounded-full bg-muted-foreground/30"})}),e.jsxs("div",{className:"flex items-center justify-between p-3 md:p-4 border-b border-border shrink-0",children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground truncate pr-2 max-w-[80%]",title:t.name,children:t.name}),e.jsx(w,{ref:n,variant:"ghost",size:"icon-sm",onClick:s,"aria-label":"Close preview panel",className:"shrink-0 min-h-11 min-w-11 md:min-h-0 md:min-w-0",children:e.jsx(H,{weight:"bold",className:"w-5 h-5 md:w-4 md:h-4"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsx(ce,{asset:t,onDimensionsLoad:D}),e.jsx(j,{}),e.jsx(pe,{asset:t,imageDimensions:F}),e.jsx(j,{}),e.jsx(be,{asset:t}),(t.duplicatesCount??0)>0&&e.jsxs(e.Fragment,{children:[e.jsx(j,{}),e.jsx(we,{asset:t,onSelectAsset:l})]}),e.jsx(j,{}),e.jsx(ye,{asset:t}),e.jsx(j,{}),e.jsx(Ee,{asset:t})]})]})});export{Re as PreviewPanel};
@@ -18,7 +18,7 @@
18
18
  }
19
19
  })();
20
20
  </script>
21
- <script type="module" crossorigin src="/__asset_manager__/assets/index-DJcW-X-b.js"></script>
21
+ <script type="module" crossorigin src="/__asset_manager__/assets/index-BiBe_7iw.js"></script>
22
22
  <link rel="modulepreload" crossorigin href="/__asset_manager__/assets/vendor-react-CZ2o2ZY4.js">
23
23
  <link rel="modulepreload" crossorigin href="/__asset_manager__/assets/vendor-icons-BoR7i9s2.js">
24
24
  <link rel="modulepreload" crossorigin href="/__asset_manager__/assets/vendor-ui-CBXnYcgF.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-asset-manager",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "description": "Visual asset management for Vite",
6
6
  "author": "Ejiro Asiuwhu <ejiroasiuwhu10@gmail.com>",
@@ -23,36 +23,6 @@
23
23
  "vite-plugin-asset-manager",
24
24
  "react-vite-plugin"
25
25
  ],
26
- "scripts": {
27
- "build:ui": "vite build --config vite.config.ui.ts",
28
- "build:floating-icon": "vite build --config vite.config.floating-icon.ts",
29
- "build:plugin": "tsup",
30
- "build": "pnpm run build:ui && pnpm run build:floating-icon && pnpm run build:plugin",
31
- "build:all": "pnpm run build:packages && pnpm run build && rm -rf packages/core/dist/client && cp -r dist/client packages/core/dist/client",
32
- "dev": "tsup --watch",
33
- "lint": "eslint src/",
34
- "lint:fix": "eslint src/ --fix",
35
- "format": "prettier --write \"src/**/*.{ts,tsx}\"",
36
- "format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
37
- "prepublishOnly": "pnpm run build:all",
38
- "test": "vitest run",
39
- "test:watch": "vitest",
40
- "test:ui": "vitest --ui",
41
- "test:coverage": "vitest run --coverage",
42
- "test:server": "vitest run --project server",
43
- "test:client": "vitest run --project ui",
44
- "playground:react": "pnpm --filter playground-react dev",
45
- "playground:vue": "pnpm --filter playground-vue dev",
46
- "playground:vanilla": "pnpm --filter playground-vanilla dev",
47
- "playground:preact": "pnpm --filter playground-preact dev",
48
- "playground:lit": "pnpm --filter playground-lit dev",
49
- "playground:svelte": "pnpm --filter playground-svelte dev",
50
- "playground:solid": "pnpm --filter playground-solid dev",
51
- "playground:qwik": "pnpm --filter playground-qwik dev",
52
- "playground:tanstack": "pnpm --filter playground-tanstack dev",
53
- "playground:nuxt": "pnpm --filter playground-nuxt dev",
54
- "build:packages": "pnpm --filter @vite-asset-manager/core build && pnpm --filter @vite-asset-manager/nuxt build"
55
- },
56
26
  "publishConfig": {
57
27
  "access": "public"
58
28
  },
@@ -81,7 +51,6 @@
81
51
  "vite": ">=5.0.0"
82
52
  },
83
53
  "dependencies": {
84
- "@vite-asset-manager/core": "workspace:^",
85
54
  "@base-ui/react": "^1.1.0",
86
55
  "@phosphor-icons/react": "^2.1.10",
87
56
  "@tanstack/react-virtual": "^3.13.18",
@@ -93,7 +62,8 @@
93
62
  "shadcn": "^3.8.4",
94
63
  "sonner": "^2.0.7",
95
64
  "tailwind-merge": "^3.4.0",
96
- "tw-animate-css": "^1.4.0"
65
+ "tw-animate-css": "^1.4.0",
66
+ "@vite-asset-manager/core": "^1.0.3"
97
67
  },
98
68
  "devDependencies": {
99
69
  "@eslint/js": "^9.39.2",
@@ -125,11 +95,33 @@
125
95
  "vite": "^7.3.1",
126
96
  "vitest": "^4.0.18"
127
97
  },
128
- "pnpm": {
129
- "onlyBuiltDependencies": [
130
- "esbuild",
131
- "msw",
132
- "sharp"
133
- ]
98
+ "scripts": {
99
+ "build:ui": "vite build --config vite.config.ui.ts",
100
+ "build:floating-icon": "vite build --config vite.config.floating-icon.ts",
101
+ "build:plugin": "tsup",
102
+ "build": "pnpm run build:ui && pnpm run build:floating-icon && pnpm run build:plugin",
103
+ "build:all": "pnpm run build:packages && pnpm run build && rm -rf packages/core/dist/client && cp -r dist/client packages/core/dist/client",
104
+ "dev": "tsup --watch",
105
+ "lint": "eslint src/",
106
+ "lint:fix": "eslint src/ --fix",
107
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
108
+ "format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
109
+ "test": "vitest run",
110
+ "test:watch": "vitest",
111
+ "test:ui": "vitest --ui",
112
+ "test:coverage": "vitest run --coverage",
113
+ "test:server": "vitest run --project server",
114
+ "test:client": "vitest run --project ui",
115
+ "playground:react": "pnpm --filter playground-react dev",
116
+ "playground:vue": "pnpm --filter playground-vue dev",
117
+ "playground:vanilla": "pnpm --filter playground-vanilla dev",
118
+ "playground:preact": "pnpm --filter playground-preact dev",
119
+ "playground:lit": "pnpm --filter playground-lit dev",
120
+ "playground:svelte": "pnpm --filter playground-svelte dev",
121
+ "playground:solid": "pnpm --filter playground-solid dev",
122
+ "playground:qwik": "pnpm --filter playground-qwik dev",
123
+ "playground:tanstack": "pnpm --filter playground-tanstack dev",
124
+ "playground:nuxt": "pnpm --filter playground-nuxt dev",
125
+ "build:packages": "pnpm --filter @vite-asset-manager/core build && pnpm --filter @vite-asset-manager/nuxt build"
134
126
  }
135
- }
127
+ }