import{c as x,g as N,q as w,s as C,as as k,h as P,o as E,r as p,t as u,j as e,m as n,B as q,p as D,k as c,ab as S,x as A,F as $,E as f,A as L}from"./index-DszW2bOJ.js";import{R,S as Q}from"./switch-CgfzYKbb.js";import{S as _}from"./ConfirmDialog-CYD3yS9a.js";import{C as y}from"./card-Bxc0HrZ8.js";/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const F=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],K=x("ChevronRight",F);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],v=x("CircleAlert",z);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]],O=x("CircleArrowRight",B);/**
 * @license lucide-react v0.479.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],M=x("Clock",T);function Z(s){return N({queryKey:w.projects.detail(s),queryFn:()=>C.projects.getById(s),enabled:!!s})}function ee(s){const t=k(),a=P(),{updateProject:o,deleteProject:r}=E(),[h,l]=p.useState(!1),[i,d]=p.useState(!1),[g,b]=p.useState(!1);return{editModalOpen:h,setEditModalOpen:l,deleteDialogOpen:i,setDeleteDialogOpen:d,autoRefresh:g,setAutoRefresh:b,handleRefresh:()=>{s&&(a.invalidateQueries({queryKey:["projects","getById",s]}),a.invalidateQueries({queryKey:["logs","metrics",s]}),a.invalidateQueries({queryKey:["logs","metadataKeys",s]}),a.invalidateQueries({queryKey:["projects","config",s]}))},handleDeleteProject:()=>{d(!0)},handleConfirmDelete:()=>{r.mutate(s,{onSuccess:()=>{u.success("Project deleted successfully"),t({to:"/projects"})},onError:m=>{u.error("Failed to delete project",{description:m instanceof Error?m.message:"Unknown error occurred"})}})},handleEditProject:()=>{l(!0)},handleEditSubmit:m=>{o.mutate({id:s,data:m},{onSuccess:()=>{l(!1),u.success("Project updated successfully")},onError:j=>{u.error("Failed to update project",{description:j instanceof Error?j.message:"Unknown error occurred"})}})},updateProject:o,deleteProject:r}}function se({project:s,isRefreshing:t,autoRefresh:a,onAutoRefreshChange:o,onEdit:r,onDelete:h,onRefresh:l}){const i=new Date(s.createdAt),d=i.toLocaleDateString(),g=i.toLocaleTimeString();return e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start gap-4 bg-white/60 backdrop-blur-sm border-gray-200/50 shadow-lg p-6 rounded-lg",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(n,{to:"/projects",className:"text-sm text-muted-foreground hover:text-foreground transition-colors flex items-center",children:[e.jsx(O,{className:"h-3.5 w-3.5 mr-1 rotate-180"}),"Projects"]}),e.jsx(K,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:s.name})]}),e.jsx("h1",{className:"text-3xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-foreground to-foreground/70",children:s.name}),s.description&&e.jsx("p",{className:"text-muted-foreground max-w-2xl",children:s.description}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-1",children:[e.jsx(q,{variant:"outline",className:"font-mono text-xs",children:s.id}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(D,{className:"h-3 w-3"}),d]}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(M,{className:"h-3 w-3"}),g]})]})]}),e.jsxs("div",{className:"flex space-x-2 mt-4 md:mt-0 items-center",children:[e.jsxs(c,{variant:"outline",size:"sm",onClick:r,className:"transition-all hover:border-primary/50 hover:bg-primary/5",children:[e.jsx(_,{className:"h-4 w-4 mr-2"}),"Edit"]}),e.jsxs(c,{variant:"destructive",size:"sm",onClick:h,className:"transition-all hover:bg-destructive/90",children:[e.jsx(S,{className:"h-4 w-4 mr-2"}),"Delete"]}),e.jsxs(c,{variant:"outline",size:"sm",onClick:l,disabled:t,className:"transition-all hover:border-primary/50 hover:bg-primary/5",children:[t?e.jsx("span",{className:"mr-2 border-2 border-primary/30 border-t-primary rounded-full w-4 h-4 animate-spin inline-block"}):e.jsx(R,{className:"h-4 w-4 mr-2"}),"Refresh"]}),e.jsxs("div",{className:"flex items-center ml-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground mr-2",children:"Auto-refresh"}),e.jsx(Q,{checked:a,onCheckedChange:o,disabled:t,id:"auto-refresh-toggle"})]})]})]})}function re(){return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-10rem)]",children:e.jsx(y,{className:"w-full max-w-md p-6 shadow-lg",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-4",children:[e.jsx(v,{className:"h-12 w-12 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Project Not Found"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Unable to load project details"})]}),e.jsx(c,{asChild:!0,children:e.jsx(n,{to:"/projects",children:"Go to Projects"})})]})})})}function te(){return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-10rem)]",children:e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsx("div",{className:"border-4 border-primary/30 border-t-primary rounded-full w-12 h-12 animate-spin"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading project details..."})]})})}function ae({projectId:s,project:t}){return e.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-10rem)]",children:e.jsx(y,{className:"w-full max-w-md p-6 shadow-lg",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center space-y-4",children:[e.jsx(v,{className:"h-12 w-12 text-destructive"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Error Loading Project"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:t?"An error occurred while fetching project data":`Project not found (ID: ${s})`})]}),e.jsx(c,{asChild:!0,children:e.jsx(n,{to:"/projects",children:"Go to Projects"})})]})})})}function oe({projectId:s,currentPage:t}){const a=A(),r=t||(a.pathname.includes("/logs")?"logs":a.pathname.includes("/traces")?"traces":"details");return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-8",children:[e.jsx(n,{to:"/projects/$projectId/logs",params:{projectId:s},className:`group bg-white/60 backdrop-blur-sm border border-gray-200/50 shadow-lg rounded-lg p-6 hover:shadow-xl transition-all duration-200 hover:bg-gradient-to-r hover:from-blue-50 hover:to-purple-50 ${r==="logs"?"ring-2 ring-blue-500 bg-blue-50/30":""}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg transition-colors ${r==="logs"?"bg-blue-200 group-hover:bg-blue-300":"bg-blue-100 group-hover:bg-blue-200"}`,children:e.jsx($,{className:"h-6 w-6 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Project Logs"}),e.jsx("p",{className:"text-sm text-gray-600",children:r==="logs"?"Currently viewing logs - manage and filter entries":"View and manage application logs"})]})]}),e.jsx(f,{className:`h-5 w-5 transition-colors ${r==="logs"?"text-blue-600":"text-gray-400 group-hover:text-blue-600"}`})]})}),e.jsx(n,{to:"/projects/$projectId/traces",params:{projectId:s},className:`group bg-white/60 backdrop-blur-sm border border-gray-200/50 shadow-lg rounded-lg p-6 hover:shadow-xl transition-all duration-200 hover:bg-gradient-to-r hover:from-purple-50 hover:to-indigo-50 ${r==="traces"?"ring-2 ring-purple-500 bg-purple-50/30":""}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg transition-colors ${r==="traces"?"bg-purple-200 group-hover:bg-purple-300":"bg-purple-100 group-hover:bg-purple-200"}`,children:e.jsx(L,{className:"h-6 w-6 text-purple-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Project Traces"}),e.jsx("p",{className:"text-sm text-gray-600",children:r==="traces"?"Currently viewing traces - analyze distributed requests":"Analyze distributed tracing data"})]})]}),e.jsx(f,{className:`h-5 w-5 transition-colors ${r==="traces"?"text-purple-600":"text-gray-400 group-hover:text-purple-600"}`})]})})]})}export{v as C,re as P,oe as Q,ee as a,te as b,ae as c,se as d,K as e,M as f,Z as u};
