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