import"../chunks/CWj6FrbW.js";import{o as L}from"../chunks/DujX6kBV.js";import{p as M,e as b,g as N,u as U,h as t,i as _,f as C,j as V,b as r,c as z,$ as D,d as i,s as y,a as G,k as A,l as H,n as l,r as c}from"../chunks/CVHvdSBf.js";import{g as d}from"../chunks/ZH2wGpZM.js";import{g as I}from"../chunks/CNvyTQrC.js";import{t as J}from"../chunks/BEJ5fU19.js";import{A as K}from"../chunks/Cf8q8_nj.js";import{T as O,a as T}from"../chunks/axPa8Xqj.js";import{p as w}from"../chunks/uS7H_Vea.js";var Q=C("<!> <!>",1),R=C('<div class="flex h-screen"><!> <div class="flex h-full min-w-0 flex-1 flex-col bg-rc-gray-980 pb-3 pr-4 pt-2"><nav class="flex flex-none items-center justify-center bg-rc-gray-980"><!></nav> <main class="flex-1 pr-80 pt-40"><div class="flex h-full items-start justify-center text-rc-gray-200">Select an agent on the left panel to start editing</div></main></div></div>');function ne(S,k){M(k,!0);const{onAgentSelect:f,onError:E}=I();let a=b(N([])),p=b(!1);const g=H(()=>w.url.pathname.split("/")[1]);function j({value:e}){if(e!==t(g)){if(e==="edit")return d("/edit");if(e==="view")return d("/view");d("/"+e)}}function P(e){f(e)}U(()=>{t(p)||w.url.pathname==="/edit"&&t(a).length&&(_(p,!0),f(t(a)[0]))}),L(async()=>{try{_(a,await J.agents.list.query(),!0)}catch(e){const h=e instanceof Error?e.message:e?String(e):"Unknown error";console.error("Failed to load agents:",e),E(`Failed to load agents: ${h}`)}});var s=R();V(e=>{D.title="Bosun: Edit"});var u=i(s);K(u,{className:"flex-none",get agents(){return t(a)},currentAgent:"",onAgentClick:P});var m=y(u,2),v=i(m),F=i(v);O(F,{get value(){return t(g)},ariaLabel:"Top tabs",onChange:j,children:(e,h)=>{var $=Q(),x=G($);T(x,{value:"edit",children:(n,B)=>{l();var o=A("Edit");r(n,o)},$$slots:{default:!0}});var q=y(x,2);T(q,{value:"view",children:(n,B)=>{l();var o=A("View");r(n,o)},$$slots:{default:!0}}),r(e,$)},$$slots:{default:!0}}),c(v),l(2),c(m),c(s),r(S,s),z()}export{ne as component};
