import{j as e,L as R,s as D}from"./vendor-tanstack-CvGXetsl.js";import{q as C,I as i,y as E,H as y,B as T,g as w,h as x,bC as I,bM as L,bO as B,aA as M,aB as S,aC as p,aD as h,bR as O,C as V,o as k,dQ as d,dR as z}from"./index-D51s66kn.js";import"./automation-schema-BkLl5jWe.js";import"./form-D2Aou2qB.js";import"./radio-group-IGKNqYdR.js";import{f as A}from"./event-to-trigger-BEzU9b5I.js";import{D as F,a as P,b as J,d as j}from"./dropdown-menu-0GXqpEoR.js";import{f as Q,J as _}from"./utilities-Ds1-JGfI.js";import{E as H,p as U,a as q,b as G,R as Y}from"./event-resource-display-CaFW6jFf.js";import{f as Z}from"./vendor-date-GSGg4LXF.js";import"./vendor-react-HBv6Kpyp.js";import"./vendor-radix-y_Ik_hIG.js";import"./vendor-recharts-heKD2IVO.js";import"./vendor-forms-BVeRYtt6.js";function K({event:s}){const r=()=>{navigator.clipboard.writeText(s.id),E.success("ID copied")};return e.jsxs(F,{children:[e.jsx(P,{asChild:!0,children:e.jsxs(C,{variant:"outline",className:"size-8 p-0","aria-label":"Event actions",children:[e.jsx("span",{className:"sr-only",children:"Open menu"}),e.jsx(i,{id:"MoreVertical",className:"size-4"})]})}),e.jsxs(J,{align:"end",children:[e.jsx(R,{to:"/automations/create",search:{eventId:s.id,eventDate:A(s.occurred)},children:e.jsxs(j,{children:[e.jsx(i,{id:"Zap",className:"mr-2 size-4"}),"Automate"]})}),e.jsxs(j,{onClick:r,children:[e.jsx(i,{id:"Copy",className:"mr-2 size-4"}),"Copy ID"]})]})]})}const u=({children:s})=>e.jsx("dt",{className:"text-sm font-medium",children:s}),f=({children:s})=>e.jsx("dd",{className:"text-sm",children:s});function g(s){return s["prefect.resource.role"]||null}function v(s){return s["prefect.resource.id"]||""}function W(s){return s["prefect.resource.name"]||s["prefect.name"]||s["prefect-cloud.name"]||null}function X({event:s}){const r=Z(new Date(s.occurred),"yyyy/MM/dd hh:mm:ss a"),n=(s.related??[]).filter(a=>g(a)!=="tag"),c=(s.related??[]).filter(a=>g(a)==="tag");return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("dl",{children:[e.jsx(u,{children:"Event"}),e.jsx(f,{children:s.event})]}),e.jsxs("dl",{children:[e.jsx(u,{children:"Occurred"}),e.jsx(f,{children:r})]}),e.jsx(H,{event:s}),(n.length>0||c.length>0)&&e.jsxs("dl",{children:[e.jsx(u,{children:"Related Resources"}),e.jsxs("dd",{className:"flex flex-col gap-2 text-sm",children:[n.map(a=>{const t=v(a),l=W(a),o=U(t),b=Y[o],m=G[o],N=l||t.split(".").pop()||t;return e.jsxs(q,{resource:a,relatedResources:s.related??[],className:"flex items-center gap-2 hover:underline",children:[m&&e.jsx("span",{children:m}),e.jsx(i,{id:b,className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:N})]},t)}),c.length>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{children:"Tags"}),c.map(a=>{const t=v(a),l=t.split(".").pop()||t;return e.jsx(y,{variant:"secondary",children:l},t)})]})]})]})]})}function $({event:s}){const r=Q(s.event);return e.jsx(T,{children:e.jsxs(w,{children:[e.jsx(x,{children:e.jsx(I,{to:"/events",className:"text-xl font-semibold",children:"Event Feed"})}),e.jsx(L,{}),e.jsx(x,{className:"text-xl font-semibold",children:e.jsx(B,{children:r})})]})})}function ee({event:s,defaultTab:r="details",onTabChange:n}){return e.jsxs(M,{defaultValue:r,onValueChange:n,children:[e.jsxs(S,{children:[e.jsx(p,{value:"details",children:"Details"}),e.jsx(p,{value:"raw",children:"Raw"})]}),e.jsx(h,{value:"details",className:"pt-4",children:e.jsx(X,{event:s})}),e.jsx(h,{value:"raw",className:"pt-4",children:e.jsx(_,{value:JSON.stringify(s,null,2),className:"max-h-[600px] overflow-auto"})})]})}function se({eventId:s,eventDate:r,defaultTab:n,onTabChange:c}){const{data:a}=D(O(s,r));return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx($,{event:a}),e.jsx(K,{event:a})]}),e.jsx(V,{children:e.jsx(k,{children:e.jsx(ee,{event:a,defaultTab:n,onTabChange:c})})})]})}const je=function(){const{eventDate:r,eventId:n}=d.useParams(),c=d.useSearch(),a=d.useNavigate(),t=z(r),l=o=>{a({to:".",search:{tab:o},replace:!0})};return e.jsx(se,{eventId:n,eventDate:t,defaultTab:c.tab,onTabChange:l})};export{je as component};
//# sourceMappingURL=event._eventDate._eventId-CelUdxf_.js.map
