import{j as e,r as S}from"./@radix-B1sy0Lhr.js";import{r as k,T as y,bk as T,d as w,C as P,o as _,p as D,q as E,s as I,a2 as L,z as N,ab as U,ac as A,ad as g,bl as O,b as R,ae as x}from"./index-CO6UN3UX.js";import{S as z}from"./terminal-C2tAF2XG.js";import{S as B}from"./chevron-down-Bl7WwQAL.js";import{S as F}from"./transform-S7omcvTm.js";import{L as K,f as M,c as V}from"./@react-router-CHjLNlgw.js";import{D as C}from"./DisplayDate-57lUNS79.js";import{K as o,N as $}from"./NestedCollapsible-0yviIfaA.js";function q({connectorName:s,connectorId:a}){return e.jsx(K,{to:k.settings.connectors.detail.configuration(a),children:e.jsxs(y,{color:"yellow",rounded:!1,className:"w-fit gap-0.5",emphasis:"subtle",children:[e.jsx(F,{width:20,height:20,className:"shrink-0 fill-warning-900"}),e.jsx("span",{children:s})]})})}function H({componentId:s}){return e.jsxs("section",{className:"grid grid-cols-1 gap-5 @5xl:grid-cols-2",children:[e.jsx("div",{children:e.jsx(Q,{componentId:s})}),e.jsx("div",{children:e.jsx(G,{componentId:s})})]})}function Q({componentId:s}){var c,m,p,f,h,b,j,v;const[a,r]=S.useState(!0),l=T(s);if(l.isError)return null;if(l.isPending)return e.jsx(w,{className:"h-[150px] w-full"});const t=l.data,n=(c=t.resources)==null?void 0:c.user,d=(m=t.body)==null?void 0:m.created,u=(p=t.body)==null?void 0:p.updated,i=(f=t.metadata)==null?void 0:f.connector;return e.jsxs(P,{open:a,onOpenChange:r,children:[e.jsx(_,{className:"flex items-center gap-[10px]",children:e.jsxs(D,{className:"flex w-full items-center",children:[e.jsx(B,{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(E,{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(y,{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:I(((h=t.body)==null?void 0:h.logo_url)||""),alt:"Flavor Icon of Component"}),e.jsx("p",{className:"truncate",children:(b=t.body)==null?void 0:b.flavor_name})]})}),e.jsx(o,{label:"Author",value:n?e.jsx(L,{avatarUrl:((j=n.body)==null?void 0:j.avatar_url)??void 0,username:n.name,isServiceAccount:!!((v=n.body)!=null&&v.is_service_account)}):"Not available"}),e.jsx(o,{label:"Service Connector",value:i?e.jsx(q,{connectorName:i.name,connectorId:i.id}):"Not available"}),e.jsx(o,{label:"Updated",value:u?e.jsx(C,{dateString:u}):"Not available"}),e.jsx(o,{label:"Created",value:d?e.jsx(C,{dateString:d}):"Not available"})]})})]})}function G({componentId:s}){var r;const a=T(s);return a.isError?null:a.isPending?e.jsx(w,{className:"h-[150px] w-full"}):e.jsx($,{isInitialOpen:!0,intent:"primary",title:"Configuration",data:(r=a.data.metadata)==null?void 0:r.configuration})}const J=N.object({tab:N.enum(["configuration","stacks","runs"]).optional().default("configuration").catch("configuration")});function W(){const[s]=M(),{tab:a}=J.parse({tab:s.get("tab")||void 0});return a}function ne({componentId:s,isPanel:a,stacksTabContent:r,runsTabContent:l}){const[t,n]=S.useState("configuration"),d=W(),u=V();function i(c){if(a){n(c);return}const m=new URLSearchParams;m.set("tab",c),u(`?${m.toString()}`)}return e.jsx("div",{className:"p-5",children:e.jsxs(U,{value:a?t:d,onValueChange:i,children:[e.jsxs(A,{children:[e.jsxs(g,{className:"flex items-center gap-2 text-text-md",value:"configuration",children:[e.jsx(O,{className:"h-5 w-5 shrink-0 fill-theme-text-tertiary group-data-[state=active]/trigger:fill-theme-surface-strong"}),e.jsx("span",{children:"Configuration"})]}),e.jsxs(g,{className:"flex items-center gap-2 text-text-md",value:"stacks",children:[e.jsx(R,{className:"h-5 w-5 fill-theme-text-tertiary group-data-[state=active]/trigger:fill-theme-surface-strong"}),e.jsx("span",{children:"Stacks"})]}),e.jsxs(g,{className:"flex items-center gap-2 text-text-md",value:"runs",children:[e.jsx(z,{className:"h-5 w-5 fill-theme-text-tertiary group-data-[state=active]/trigger:fill-theme-surface-strong"}),e.jsx("span",{children:"Runs"})]})]}),e.jsx(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"configuration",children:e.jsx(H,{componentId:s})}),e.jsx(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"stacks",children:r}),e.jsx(x,{className:"m-0 mt-5 border-0 bg-transparent p-0",value:"runs",children:l})]})})}export{ne as S};
