import{j as a}from"./@radix-D8tIKeo-.js";import{r as C,T as h,bU as j,e as v,C as S,o as y,q as T,t as w,s as k,aJ as P,aK as b,aN as I,aO as d,aP as u,bV as U,d as _,a3 as E,aQ as x}from"./index-B44sgOyQ.js";import{S as L}from"./scrolling-tabs-list-PzSayIJ0.js";import{a as N}from"./@monaco-editor-CuNQBT0l.js";import{S as O}from"./chevron-down-C9YWkVDM.js";import{S as A}from"./transform-DsIiQtL0.js";import{L as D,f as K,c as R}from"./@react-router-D1ODL_Ub.js";import{K as n,N as V}from"./KeyValue-BtlwXwcP.js";import{z as f}from"./@zod-2qqdh1cM.js";function z({connectorName:s,connectorId:e}){return a.jsx(D,{to:C.settings.connectors.detail.configuration(e),children:a.jsxs(h,{color:"yellow",rounded:!1,className:"w-fit gap-0.5",emphasis:"subtle",children:[a.jsx(A,{width:20,height:20,className:"shrink-0 fill-warning-900"}),a.jsx("span",{children:s})]})})}function B({componentId:s}){return a.jsxs("section",{className:"grid grid-cols-1 gap-5 @5xl:grid-cols-2",children:[a.jsx("div",{children:a.jsx(F,{componentId:s})}),a.jsx("div",{children:a.jsx(M,{componentId:s})})]})}function F({componentId:s}){const[e,m]=N.useState(!0),o=j(s);if(o.isError)return null;if(o.isPending)return a.jsx(v,{className:"h-[150px] w-full"});const t=o.data,r=t.resources?.user,l=t.body?.created,c=t.body?.updated,i=t.metadata?.connector;return a.jsxs(S,{open:e,onOpenChange:m,children:[a.jsx(y,{className:"flex items-center gap-[10px]",children:a.jsxs(T,{className:"flex w-full items-center",children:[a.jsx(O,{className:` ${e?"":"-rotate-90"} mr-2 h-5 w-5 rounded-md fill-neutral-500 transition-transform duration-200 hover:bg-neutral-200`}),"Basic Parameters"]})}),a.jsx(w,{className:"border-t border-theme-border-moderate bg-theme-surface-primary px-5 py-3",children:a.jsxs("dl",{className:"grid grid-cols-1 gap-x-[10px] gap-y-2 md:grid-cols-3 md:gap-y-4",children:[a.jsx(n,{label:"Component Name",value:t.name}),a.jsx(n,{label:"Flavor",value:a.jsxs(h,{rounded:!1,className:"w-fit gap-0.5 text-theme-text-primary",color:"grey",emphasis:"minimal",children:[a.jsx("img",{width:20,height:20,src:k(t.body?.logo_url||""),alt:"Flavor Icon of Component"}),a.jsx("p",{className:"truncate",children:t.resources?.flavor?.body?.display_name})]})}),a.jsx(n,{label:"Author",value:r?a.jsx(P,{avatarUrl:r.body?.avatar_url??void 0,username:r.name,isServiceAccount:!!r.body?.is_service_account}):"Not available"}),a.jsx(n,{label:"Service Connector",value:i?a.jsx(z,{connectorName:i.name,connectorId:i.id}):"Not available"}),a.jsx(n,{label:"Updated",value:c?a.jsx(b,{dateString:c}):"Not available"}),a.jsx(n,{label:"Created",value:l?a.jsx(b,{dateString:l}):"Not available"})]})})]})}function M({componentId:s}){const e=j(s);return e.isError?null:e.isPending?a.jsx(v,{className:"h-[150px] w-full"}):a.jsx(V,{isInitialOpen:!0,intent:"primary",title:"Configuration",data:e.data.metadata?.configuration})}const Q=f.object({tab:f.enum(["configuration","stacks","runs"]).optional().default("configuration").catch("configuration")});function $(){const[s]=K(),{tab:e}=Q.parse({tab:s.get("tab")||void 0});return e}function ea({componentId:s,isPanel:e,stacksTabContent:m,runsTabContent:o}){const[t,r]=N.useState("configuration"),l=$(),c=R();function i(p){if(e){r(p);return}const g=new URLSearchParams;g.set("tab",p),c(`?${g.toString()}`)}return a.jsx("div",{className:"p-5",children:a.jsxs(I,{value:e?t:l,onValueChange:i,children:[a.jsxs(L,{children:[a.jsxs(d,{className:"flex items-center gap-2 text-text-md",value:"configuration",children:[a.jsx(u,{icon:U}),a.jsx("span",{children:"Configuration"})]}),a.jsxs(d,{className:"flex items-center gap-2 text-text-md",value:"stacks",children:[a.jsx(u,{icon:_}),a.jsx("span",{children:"Stacks"})]}),a.jsxs(d,{className:"flex items-center gap-2 text-text-md",value:"runs",children:[a.jsx(u,{icon:E}),a.jsx("span",{children:"Runs"})]})]}),a.jsx(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"configuration",children:a.jsx(B,{componentId:s})}),a.jsx(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"stacks",children:m}),a.jsx(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"runs",children:o})]})})}export{ea as S};
