hive-am 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -1
- package/README.md +26 -4
- package/package.json +1 -1
- package/server/dist/api.js +86 -1
- package/server/dist/connections/addressing.js +87 -0
- package/server/dist/connections/channel-skill.js +50 -0
- package/server/dist/connections/fake.js +1 -0
- package/server/dist/connections/format.js +9 -1
- package/server/dist/connections/manager.js +19 -0
- package/server/dist/connections/prompt.js +8 -3
- package/server/dist/connections/rate.js +20 -0
- package/server/dist/connections/router.js +53 -21
- package/server/dist/connections/secrets.js +52 -0
- package/server/dist/connections/store.js +2 -0
- package/server/dist/connections/telegram.js +62 -11
- package/server/dist/cron.js +137 -0
- package/server/dist/history/claude.js +13 -0
- package/server/dist/index.js +8 -0
- package/server/dist/instructions.js +17 -11
- package/server/dist/providers/claude.js +2 -0
- package/server/dist/providers/kiro.js +2 -0
- package/server/dist/providers/opencode-server.js +164 -0
- package/server/dist/providers/opencode.js +62 -36
- package/server/dist/runtime.js +2 -1
- package/server/dist/schedules.js +241 -0
- package/server/dist/skills/defaults.js +83 -0
- package/server/dist/wake.js +152 -0
- package/server/dist/watch.js +207 -0
- package/server/mcp/dispatch.mjs +100 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/app-build-manifest.json +47 -39
- package/web/.next/app-path-routes-manifest.json +6 -5
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +64 -40
- package/web/.next/routes-manifest.json +6 -0
- package/web/.next/server/app/_not-found/page.js +1 -1
- package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_not-found.html +1 -1
- package/web/.next/server/app/_not-found.rsc +3 -3
- package/web/.next/server/app/agents/[id]/page.js +4 -4
- package/web/.next/server/app/agents/[id]/page.js.nft.json +1 -1
- package/web/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/agents/page.js +1 -1
- package/web/.next/server/app/agents/page.js.nft.json +1 -1
- package/web/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/agents.html +1 -1
- package/web/.next/server/app/agents.rsc +4 -4
- package/web/.next/server/app/connections/page.js +1 -1
- package/web/.next/server/app/connections/page.js.nft.json +1 -1
- package/web/.next/server/app/connections/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/connections.html +1 -1
- package/web/.next/server/app/connections.rsc +4 -4
- package/web/.next/server/app/index.html +1 -1
- package/web/.next/server/app/index.rsc +4 -4
- package/web/.next/server/app/page.js +1 -1
- package/web/.next/server/app/page.js.nft.json +1 -1
- package/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/relations/page.js +1 -1
- package/web/.next/server/app/relations/page.js.nft.json +1 -1
- package/web/.next/server/app/relations/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/relations.html +1 -1
- package/web/.next/server/app/relations.rsc +4 -4
- package/web/.next/server/app/schedules/page.js +2 -0
- package/web/.next/server/app/schedules/page.js.nft.json +1 -0
- package/web/.next/server/app/schedules/page_client-reference-manifest.js +1 -0
- package/web/.next/server/app/schedules.html +1 -0
- package/web/.next/server/app/schedules.meta +15 -0
- package/web/.next/server/app/schedules.rsc +24 -0
- package/web/.next/server/app/sessions/page.js +1 -1
- package/web/.next/server/app/sessions/page.js.nft.json +1 -1
- package/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/sessions.html +1 -1
- package/web/.next/server/app/sessions.rsc +4 -4
- package/web/.next/server/app/skills/page.js +1 -1
- package/web/.next/server/app/skills/page.js.nft.json +1 -1
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills.html +1 -1
- package/web/.next/server/app/skills.rsc +4 -4
- package/web/.next/server/app/types/page.js +1 -1
- package/web/.next/server/app/types/page.js.nft.json +1 -1
- package/web/.next/server/app/types/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/types.html +1 -1
- package/web/.next/server/app/types.rsc +4 -4
- package/web/.next/server/app-paths-manifest.json +6 -5
- package/web/.next/server/chunks/{149.js → 484.js} +2 -2
- package/web/.next/server/chunks/851.js +1 -1
- package/web/.next/server/pages/404.html +1 -1
- package/web/.next/server/pages/500.html +1 -1
- package/web/.next/server/server-reference-manifest.json +1 -1
- package/web/.next/static/_z2hBOHhwiR5ytdI_8alh/_buildManifest.js +1 -0
- package/web/.next/static/chunks/493-50d2adf9fd5ec680.js +1 -0
- package/web/.next/static/chunks/{351-65da8c1a6e25f93b.js → 589-8bf536f331de4269.js} +1 -1
- package/web/.next/static/chunks/app/agents/[id]/page-a8b7a43d2c18483f.js +1 -0
- package/web/.next/static/chunks/app/connections/page-477f36fcd5b13d78.js +1 -0
- package/web/.next/static/chunks/app/layout-a2d38e3de5911b1b.js +1 -0
- package/web/.next/static/chunks/app/schedules/page-39befd15b3b20586.js +1 -0
- package/web/.next/static/css/da22f0402b1c40ae.css +1 -0
- package/web/.next/trace +23 -23
- package/web/.next/types/app/schedules/page.ts +84 -0
- package/web/.next/types/routes.d.ts +2 -1
- package/web/.next/types/validator.ts +9 -0
- package/web/.next/static/84BpRSahg2BTwk3mX6AG8/_buildManifest.js +0 -1
- package/web/.next/static/chunks/493-92266798be872b8f.js +0 -1
- package/web/.next/static/chunks/app/agents/[id]/page-5eaf094fec246f1b.js +0 -1
- package/web/.next/static/chunks/app/connections/page-c6afd90abd82d47a.js +0 -1
- package/web/.next/static/chunks/app/layout-c415d5a847cd94b3.js +0 -1
- package/web/.next/static/css/abe1a6216491f944.css +0 -1
- /package/web/.next/static/{84BpRSahg2BTwk3mX6AG8 → _z2hBOHhwiR5ytdI_8alh}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var a={};a.id=969,a.ids=[969],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1708:a=>{"use strict";a.exports=require("node:process")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},26530:(a,b,c)=>{Promise.resolve().then(c.bind(c,27769))},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},27769:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(85972).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/hugh/Documentos/projects/personal/hive-am/dist/stage/web/app/agents/[id]/page.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/hugh/Documentos/projects/personal/hive-am/dist/stage/web/app/agents/[id]/page.tsx","default")},28354:a=>{"use strict";a.exports=require("util")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},49519:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GlobalError:()=>F.a,__next_app__:()=>L,handler:()=>N,pages:()=>K,routeModule:()=>M,tree:()=>J});var d=c(62009),e=c(51640),f=c(52679),g=c(69985),h=c(91790),i=c(81200),j=c(54530),k=c(35977),l=c(234),m=c(43472),n=c(12698),o=c(28976),p=c(54084),q=c(16307),r=c(53063),s=c(72428),t=c(261),u=c(48291),v=c(56032),w=c(26713),x=c(83370),y=c(10143),z=c(27155),A=c(77620),B=c(13428),C=c(50164),D=c(86439),E=c(2972),F=c.n(E),G=c(94672),H=c(18313),I={};for(let a in G)0>["default","tree","pages","GlobalError","__next_app__","routeModule","handler"].indexOf(a)&&(I[a]=()=>G[a]);c.d(b,I);let J={children:["",{children:["agents",{children:["[id]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,27769)),"/home/hugh/Documentos/projects/personal/hive-am/dist/stage/web/app/agents/[id]/page.tsx"]}]},{}]},{metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,84507))).default(a),async a=>(await Promise.resolve().then(c.bind(c,23575))).default(a)],apple:[async a=>(await Promise.resolve().then(c.bind(c,54287))).default(a)],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(c.bind(c,73137)),"/home/hugh/Documentos/projects/personal/hive-am/dist/stage/web/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,2972,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,96298,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,60075,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,79678,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,84507))).default(a),async a=>(await Promise.resolve().then(c.bind(c,23575))).default(a)],apple:[async a=>(await Promise.resolve().then(c.bind(c,54287))).default(a)],openGraph:[],twitter:[],manifest:void 0}}]}.children,K=["/home/hugh/Documentos/projects/personal/hive-am/dist/stage/web/app/agents/[id]/page.tsx"],L={require:c,loadChunk:()=>Promise.resolve()},M=new e.AppPageRouteModule({definition:{kind:f.RouteKind.APP_PAGE,page:"/agents/[id]/page",pathname:"/agents/[id]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:J},distDir:".next",relativeProjectDir:""});async function N(a,b,e){var E;let I="/agents/[id]/page";"/index"===I&&(I="/");let O=(0,i.getRequestMeta)(a,"postponed"),P=(0,i.getRequestMeta)(a,"minimalMode"),Q=await M.prepare(a,b,{srcPage:I,multiZoneDraftMode:!1});if(!Q)return b.statusCode=400,b.end("Bad Request"),null==e.waitUntil||e.waitUntil.call(e,Promise.resolve()),null;let{buildId:R,query:S,params:T,parsedUrl:U,pageIsDynamic:V,buildManifest:W,nextFontManifest:X,reactLoadableManifest:Y,serverActionsManifest:Z,clientReferenceManifest:$,subresourceIntegrityManifest:_,prerenderManifest:aa,isDraftMode:ab,resolvedPathname:ac,revalidateOnlyGenerated:ad,routerServerContext:ae,nextConfig:af,interceptionRoutePatterns:ag}=Q,ah=U.pathname||"/",ai=(0,t.normalizeAppPath)(I),{isOnDemandRevalidate:aj}=Q,ak=M.match(ah,aa),al=!!aa.routes[ac]&&(M.isDev||(0,d.isRouteCacheOwner)(ac,M.cacheOwner,aa.routes[ac])),am=!!(ak||al||aa.routes[ai]),an=a.headers["user-agent"]||"",ao=(0,w.getBotType)(an),ap=(0,r.isHtmlBotRequest)(a),aq=(0,i.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[v.NEXT_ROUTER_PREFETCH_HEADER],ar=(0,i.getRequestMeta)(a,"isRSCRequest")??(0,o.f)(a.headers[v.RSC_HEADER]),as=(0,u.getIsPossibleServerAction)(a),at=(0,n.checkIsAppPPREnabled)(af.experimental.ppr)&&(null==(E=aa.routes[ai]??aa.dynamicRoutes[ai])?void 0:E.renderingMode)==="PARTIALLY_STATIC",au=!1,av=!1,aw=at?O:void 0,ax=at&&ar&&!aq,ay=(0,i.getRequestMeta)(a,"segmentPrefetchRSCRequest"),az=!an||(0,r.shouldServeStreamingMetadata)(an,af.htmlLimitedBots);ap&&at&&(am=!1,az=!1);let aA=!0===M.isDev||!am||"string"==typeof O||ax,aB=ap&&at,aC=null;ab||!am||aA||as||aw||ax||(aC=ac);let aD=aC;!aD&&M.isDev&&(aD=ac),M.isDev||ab||!am||!ar||ax||(0,l.d)(a.headers);let aE={...G,tree:J,pages:K,GlobalError:F(),handler:N,routeModule:M,__next_app__:L};Z&&$&&(0,q.setReferenceManifestsSingleton)({page:I,clientReferenceManifest:$,serverActionsManifest:Z,serverModuleMap:(0,s.createServerModuleMap)({serverActionsManifest:Z})});let aF=a.method||"GET",aG=(0,h.getTracer)(),aH=aG.getActiveScopeSpan();try{let d=M.getVaryHeader(ac,ag);b.setHeader("Vary",d);let g=async(c,d)=>{let e=new m.NodeNextRequest(a),f=new m.NodeNextResponse(b);return M.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=aG.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==j.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${aF} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${aF} ${a.url}`)})},l=async({span:d,postponed:f,fallbackRouteParams:h})=>{let j={query:S,params:T,page:ai,sharedContext:{buildId:R},serverComponentsHmrCache:(0,i.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:h,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aE,Component:(0,k.T)(aE),params:T,routeModule:M,page:I,postponed:f,shouldWaitOnAllReady:aB,serveStreamingMetadata:az,supportsDynamicResponse:"string"==typeof f||aA,buildManifest:W,nextFontManifest:X,reactLoadableManifest:Y,subresourceIntegrityManifest:_,serverActionsManifest:Z,clientReferenceManifest:$,setIsrStatus:null==ae?void 0:ae.setIsrStatus,dir:c(33873).join(process.cwd(),M.relativeProjectDir),isDraftMode:ab,isRevalidate:am&&!f&&!ax,botType:ao,isOnDemandRevalidate:aj,isPossibleServerAction:as,assetPrefix:af.assetPrefix,nextConfigOutput:af.output,crossOrigin:af.crossOrigin,trailingSlash:af.trailingSlash,previewProps:aa.preview,deploymentId:af.deploymentId,enableTainting:af.experimental.taint,htmlLimitedBots:af.htmlLimitedBots,devtoolSegmentExplorer:af.experimental.devtoolSegmentExplorer,reactMaxHeadersLength:af.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:(0,i.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:af.experimental.cacheLife,basePath:af.basePath,serverActions:af.experimental.serverActions,...au?{nextExport:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isRevalidate:!0,isDebugDynamicAccesses:au}:{},experimental:{isRoutePPREnabled:at,expireTime:af.expireTime,staleTimes:af.experimental.staleTimes,cacheComponents:!!af.experimental.cacheComponents,clientSegmentCache:!!af.experimental.clientSegmentCache,clientParamParsing:!!af.experimental.clientParamParsing,dynamicOnHover:!!af.experimental.dynamicOnHover,inlineCss:!!af.experimental.inlineCss,authInterrupts:!!af.experimental.authInterrupts,clientTraceMetadata:af.experimental.clientTraceMetadata||[]},waitUntil:e.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d)=>M.onRequestError(a,b,d,ae),err:(0,i.getRequestMeta)(a,"invokeError"),dev:M.isDev}},l=await g(d,j),{metadata:m}=l,{cacheControl:n,headers:o={},fetchTags:p}=m;if(p&&(o[A.NEXT_CACHE_TAGS_HEADER]=p),a.fetchMetrics=m.fetchMetrics,am&&(null==n?void 0:n.revalidate)===0&&!M.isDev&&!at){let a=m.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${ac}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
|
|
2
|
-
see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:x.CachedRouteKind.APP_PAGE,html:l,headers:o,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:n}},n=async({hasResolved:c,previousCacheEntry:d,isRevalidating:g,span:h})=>{let j,k=!1===M.isDev,m=c||b.writableEnded;if(aj&&ad&&!d&&!P)return(null==ae?void 0:ae.render404)?await ae.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(ak&&(j=(0,y.parseFallbackField)(ak.fallback)),j===y.FallbackMode.PRERENDER&&(0,w.isBot)(an)&&(!at||ap)&&(j=y.FallbackMode.BLOCKING_STATIC_RENDER),(null==d?void 0:d.isStale)===-1&&(aj=!0),aj&&(j!==y.FallbackMode.NOT_FOUND||d)&&(j=y.FallbackMode.BLOCKING_STATIC_RENDER),!P&&j!==y.FallbackMode.BLOCKING_STATIC_RENDER&&aD&&!m&&!ab&&V&&(k||!al)){let b;if((k||ak)&&j===y.FallbackMode.NOT_FOUND)throw new D.NoFallbackError;if(at&&!ar){let c="string"==typeof(null==ak?void 0:ak.fallback)?ak.fallback:k?ai:null;if(b=await M.handleResponse({cacheKey:c,req:a,nextConfig:af,routeKind:f.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:aa,isRoutePPREnabled:at,responseGenerator:async()=>l({span:h,postponed:void 0,fallbackRouteParams:k||av?(0,p.u)(ai):null}),waitUntil:e.waitUntil}),null===b)return null;if(b)return delete b.cacheControl,b}}let n=aj||g||!aw?void 0:aw;if(au&&void 0!==n)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:x.CachedRouteKind.PAGES,html:z.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let o=V&&at&&((0,i.getRequestMeta)(a,"renderFallbackShell")||av)?(0,p.u)(ah):null;return l({span:h,postponed:n,fallbackRouteParams:o})},o=async c=>{var d,g,h,j,k;let m,o=await M.handleResponse({cacheKey:aC,responseGenerator:a=>n({span:c,...a}),routeKind:f.RouteKind.APP_PAGE,isOnDemandRevalidate:aj,isRoutePPREnabled:at,req:a,nextConfig:af,prerenderManifest:aa,waitUntil:e.waitUntil});if(ab&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),M.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!o){if(aC)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(d=o.value)?void 0:d.kind)!==x.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(h=o.value)?void 0:h.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let p="string"==typeof o.value.postponed;am&&!ax&&(!p||aq)&&(P||b.setHeader("x-nextjs-cache",aj?"REVALIDATED":o.isMiss?"MISS":o.isStale?"STALE":"HIT"),b.setHeader(v.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=o;if(aw)m={revalidate:0,expire:void 0};else if(P&&ar&&!aq&&at)m={revalidate:0,expire:void 0};else if(!M.isDev)if(ab)m={revalidate:0,expire:void 0};else if(am){if(o.cacheControl)if("number"==typeof o.cacheControl.revalidate){if(o.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${o.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});m={revalidate:o.cacheControl.revalidate,expire:(null==(j=o.cacheControl)?void 0:j.expire)??af.expireTime}}else m={revalidate:A.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(m={revalidate:0,expire:void 0});if(o.cacheControl=m,"string"==typeof ay&&(null==q?void 0:q.kind)===x.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(v.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[A.NEXT_CACHE_TAGS_HEADER];P&&am&&c&&"string"==typeof c&&b.setHeader(A.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(ay);return void 0!==d?(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:z.default.fromStatic(d,v.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl}):(b.statusCode=204,(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:z.default.EMPTY,cacheControl:o.cacheControl}))}let r=(0,i.getRequestMeta)(a,"onCacheEntry");if(r&&await r({...o,value:{...o.value,kind:"PAGE"}},{url:(0,i.getRequestMeta)(a,"initURL")}))return null;if(p&&aw)throw Object.defineProperty(Error("Invariant: postponed state should not be present on a resume request"),"__NEXT_ERROR_CODE",{value:"E396",enumerable:!1,configurable:!0});if(q.headers){let a={...q.headers};for(let[c,d]of(P&&am||delete a[A.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let s=null==(g=q.headers)?void 0:g[A.NEXT_CACHE_TAGS_HEADER];if(P&&am&&s&&"string"==typeof s&&b.setHeader(A.NEXT_CACHE_TAGS_HEADER,s),!q.status||ar&&at||(b.statusCode=q.status),!P&&q.status&&H.RedirectStatusCode[q.status]&&ar&&(b.statusCode=200),p&&b.setHeader(v.NEXT_DID_POSTPONE_HEADER,"1"),ar&&!ab){if(void 0===q.rscData){if(q.postponed)throw Object.defineProperty(Error("Invariant: Expected postponed to be undefined"),"__NEXT_ERROR_CODE",{value:"E372",enumerable:!1,configurable:!0});return(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:q.html,cacheControl:ax?{revalidate:0,expire:void 0}:o.cacheControl})}return(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:z.default.fromStatic(q.rscData,v.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl})}let t=q.html;if(!p||P||ar)return(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:t,cacheControl:o.cacheControl});if(au)return t.push(new ReadableStream({start(a){a.enqueue(B.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}});let u=new TransformStream;return t.push(u.readable),l({span:c,postponed:q.postponed,fallbackRouteParams:null}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==x.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(u.writable)}).catch(a=>{u.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}})};if(!aH)return await aG.withPropagatedContext(a.headers,()=>aG.trace(j.BaseServerSpan.handleRequest,{spanName:`${aF} ${a.url}`,kind:h.SpanKind.SERVER,attributes:{"http.method":aF,"http.target":a.url}},o));await o(aH)}catch(b){throw b instanceof D.NoFallbackError||await M.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"render",revalidateReason:(0,g.c)({isRevalidate:am,isOnDemandRevalidate:aj})},ae),b}}},55511:a=>{"use strict";a.exports=require("crypto")},61034:(a,b,c)=>{Promise.resolve().then(c.bind(c,98625))},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71556:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(51537).A)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},73136:a=>{"use strict";a.exports=require("node:url")},76760:a=>{"use strict";a.exports=require("node:path")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},91313:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(51537).A)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},98625:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>bS});var d=c(55322),e=c(93674),f=c(17027),g=c(91705),h=c.n(g),i=c(66252),j=c(51537);let k=(0,j.A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),l=(0,j.A)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var m=c(38550),n=c(76516),o=c(45762),p=c(89667),q=c(93351),r=c(60570),s=c(7371),t=c(61162),u=c(37070),v=c(31826);let w=(0,j.A)("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),x=(0,j.A)("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]),y=(0,j.A)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]),z=(0,j.A)("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),A=(0,j.A)("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);var B=c(29083);let C=(0,j.A)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),D=(0,j.A)("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);var E=c(71556),F=c(60992),G=c(2335),H=c(91313);let I=(0,j.A)("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);var J=c(47087);let K=/^\[hive:channel\] (.+?) · Place: (.+?) · Thread: (.+?) · From: (.+?)((?: · (?:Addressed|Muted): \w+)*)\nMessage:\n([\s\S]*)$/,L="\n\n[hive:context]\n",M="\n\n[hive:files]\n";var N=c(93884);function O({text:a}){let{t:b}=(0,N.s9)(),c=function(a){let b=K.exec(a);if(!b)return null;let[c,...d]=b[6].split(L),[e,...f]=c.split(M),g=f.join(M).split("\n").flatMap(a=>{let b=/^- (.+) \(([^()]*)\)$/.exec(a);return b?[{path:b[1],name:b[1].replace(/^.*[\\/]/,"").replace(/^\d+-\d+-/,""),detail:b[2]}]:[]});return{platform:b[1],place:b[2],thread:b[3],from:b[4],body:e,files:g,overheard:/Addressed: no/.test(b[5]),muted:/Muted: yes/.test(b[5]),context:d.join(L)}}(a);return c?(0,d.jsx)("div",{className:"msg user",children:(0,d.jsxs)("div",{className:"bubble channel",children:[(0,d.jsxs)("div",{className:"chhead",children:[(0,d.jsx)(H.A,{size:12,"aria-hidden":!0}),(0,d.jsx)("b",{children:c.platform}),(0,d.jsx)("span",{children:c.place}),c.overheard&&(0,d.jsxs)("span",{className:"chtag",title:b("chat.channel.overheard.hint"),children:[(0,d.jsx)(I,{size:11,"aria-hidden":!0}),b("chat.channel.overheard")]}),(0,d.jsx)("span",{className:"chfrom",children:c.from.replace(/\s*\(.*\)$/,"")})]}),(0,d.jsx)("div",{className:"chbody",children:c.body}),c.files.length>0&&(0,d.jsx)("div",{className:"chfiles",children:c.files.map(a=>(0,d.jsxs)("span",{className:"chfile",title:a.path,children:[(0,d.jsx)(J.A,{size:11,"aria-hidden":!0}),a.name,(0,d.jsx)("i",{children:a.detail.split(", ").pop()})]},a.path))}),c.context&&(0,d.jsxs)("details",{className:"chctx",children:[(0,d.jsx)("summary",{children:b("chat.channel.context",{n:c.context.split("\n").filter(a=>a.startsWith("- ")).length})}),(0,d.jsx)("pre",{children:c.context.replace(/^[^\n]*\n/,"")})]})]})}):(0,d.jsx)("div",{className:"msg user",children:(0,d.jsx)("div",{className:"bubble",children:a})})}var P=c(30584);function Q({m:a}){let{t:b}=(0,N.s9)(),c=a.meta?.usage,e=a.blocks.filter(a=>"tool"===a.type).length;if(!c&&!a.durationMs&&!e)return null;let f=(0,P.RP)(c);return(0,d.jsxs)("div",{className:"replymeta",children:[a.meta?.model&&(0,d.jsx)("span",{className:"mono",children:a.meta.model.replace(/^claude-/,"").replace(/-\d{8}$/,"")}),f>0&&(0,d.jsxs)("span",{title:c?b("chat.tokenDetail",{input:c.input,output:c.output,cacheRead:c.cacheRead,cacheWrite:c.cacheWrite}):"",children:[(0,d.jsx)(w,{size:12}),b("chat.inOut",{in:(0,P.yj)(c.input+c.cacheRead+c.cacheWrite),out:(0,P.yj)(c.output)})]}),c?.credits?(0,d.jsxs)("span",{children:[(0,d.jsx)(x,{size:12}),b("chat.credits",{value:c.credits.toFixed(2)})]}):null,a.meta?.cost!==void 0&&(0,d.jsxs)("span",{title:b(a.meta.costEstimated?"stats.costEstimated":"stats.costReported"),children:[(0,d.jsx)(x,{size:12}),a.meta.costEstimated?"≈ ":"",(0,P.F0)(a.meta.cost)]}),e>0&&(0,d.jsxs)("span",{children:[(0,d.jsx)(y,{size:12}),b("chat.tools",{count:e})]}),a.durationMs?(0,d.jsxs)("span",{children:[(0,d.jsx)(z,{size:12}),(0,P.nc)(a.durationMs)]}):null]})}function R({turn:a}){let{t:b}=(0,N.s9)(),[,c]=(0,f.useState)(0),e=a.usage,g=a.blocks.filter(a=>"tool"===a.type).length;return(0,d.jsxs)("div",{className:"replymeta live",children:[(0,d.jsxs)("span",{children:[(0,d.jsx)(z,{size:12}),(0,P.nc)(Date.now()-a.startedAt)]}),g>0&&(0,d.jsxs)("span",{children:[(0,d.jsx)(y,{size:12}),b("chat.tools",{count:g})]}),e&&(e.output??0)>0&&(0,d.jsxs)("span",{children:[(0,d.jsx)(w,{size:12}),b("chat.inOut",{in:(0,P.yj)((e.input??0)+(e.cacheRead??0)+(e.cacheWrite??0)),out:(0,P.yj)(e.output??0)})]}),e?.contextPct!==void 0&&(0,d.jsx)("span",{children:b("chat.contextPct",{pct:e.contextPct.toFixed(1)})})]})}let S=(0,f.memo)(function({text:a}){return(0,d.jsx)("div",{className:"md",children:(0,d.jsx)(u.oz,{remarkPlugins:[v.A],children:a})})}),T=(0,f.memo)(function({blocks:a,streaming:b}){let{t:c}=(0,N.s9)();return(0,d.jsxs)(d.Fragment,{children:[a.map((e,f)=>"text"===e.type?(0,d.jsx)(S,{text:e.text},f):"thinking"===e.type?(0,d.jsxs)("details",{className:"fold think",children:[(0,d.jsxs)("summary",{children:[(0,d.jsx)(A,{size:14}),b&&f===a.length-1?c("activity.thinking"):c("chat.thought"),(0,d.jsx)(B.A,{size:14,className:"chev"})]}),(0,d.jsx)("pre",{children:e.text})]},f):(0,d.jsx)(G.Dm,{tool:e,streaming:b},f)),(0,d.jsx)(G.Kt,{blocks:a})]})}),U=(0,f.memo)(function({msgs:a,agent:b}){(0,N.s9)();let c=(0,f.useMemo)(()=>(function(a){let b=[],c=null;for(let d of a){let a;if("user"===d.role){c=d.ts,b.push(d);continue}let e=b[b.length-1],f=(a,b)=>{if(!a)return b;if(!b)return a;let c=a.usage,d=b.usage;return{model:b.model??a.model,endTs:b.endTs??a.endTs,cost:void 0!==a.cost||void 0!==b.cost?(a.cost??0)+(b.cost??0):void 0,costEstimated:a.costEstimated||b.costEstimated,usage:c&&d?{input:c.input+d.input,output:c.output+d.output,cacheRead:c.cacheRead+d.cacheRead,cacheWrite:c.cacheWrite+d.cacheWrite,reasoning:c.reasoning+d.reasoning,credits:(c.credits??0)+(d.credits??0)||void 0,contextPct:d.contextPct??c.contextPct}:c??d}};e?.role==="assistant"?(a={...e,blocks:[...e.blocks,...d.blocks],meta:f(e.meta,d.meta)},b[b.length-1]=a):(a={...d},b.push(a));let g=a.meta?.endTs;a.durationMs=c&&g?Math.max(0,g-c):void 0}return b})(a),[a]);return(0,d.jsx)(d.Fragment,{children:c.map(a=>"user"===a.role?(0,d.jsx)(O,{text:a.blocks.map(a=>"text"===a.type?a.text:"").join("")},a.id):(0,d.jsxs)("div",{className:"msg assistant",children:[(0,d.jsxs)("div",{className:"who",children:[(0,d.jsx)(F._h,{agent:b,size:"sm"}),b.name,(0,d.jsx)("span",{className:"stamp",children:a.ts?(0,t.KN)(a.ts):""})]}),(0,d.jsx)(T,{blocks:a.blocks}),(0,d.jsx)(Q,{m:a})]},a.id))})},(a,b)=>a.msgs===b.msgs&&a.agent.name===b.agent.name&&a.agent.provider===b.agent.provider&&a.agent.role===b.agent.role),V=(0,f.memo)(function({name:a,running:b,queued:c,readOnly:e,onSend:g,onStop:h,toolsOpen:i,onToggleTools:j}){let{t:k}=(0,N.s9)(),[l,m]=(0,f.useState)(""),n=(0,f.useRef)(null),o=()=>{let a=n.current;a&&(a.style.height="auto",a.style.height=Math.min(a.scrollHeight,200)+"px")},p=async()=>{let a=l.trim();a&&(m(""),requestAnimationFrame(o),await g(a)||(m(a),requestAnimationFrame(o)))};return(0,d.jsxs)("div",{className:"composer",children:[e?(0,d.jsx)("div",{className:"composer-box",style:{justifyContent:"space-between",alignItems:"center"},children:(0,d.jsx)("span",{className:"muted",children:k("chat.readOnly")})}):(0,d.jsxs)("div",{className:"composer-box",children:[(0,d.jsx)("textarea",{ref:n,rows:1,value:l,placeholder:b?k("chat.queuePlaceholder"):k("chat.placeholder",{name:a}),"aria-label":k("chat.messageLabel"),onChange:a=>{m(a.target.value),o()},onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),p())}}),b&&(0,d.jsxs)("button",{className:"btn",onClick:h,"aria-label":k("chat.stop"),children:[(0,d.jsx)(C,{size:14,fill:"currentColor"}),k("chat.stop")]}),(0,d.jsx)("button",{className:"btn primary icon",onClick:()=>void p(),disabled:!l.trim(),"aria-label":k("chat.send"),children:(0,d.jsx)(D,{size:18})})]}),(0,d.jsxs)("div",{className:"composer-meta",children:[(0,d.jsx)("span",{children:k("chat.keys")}),(0,d.jsx)("button",{type:"button",className:"linkbtn",onClick:j,children:k(i?"chat.collapseTools":"chat.expandTools")}),c>0&&(0,d.jsx)("span",{children:k("queue.count",{count:c})})]})]})});function W({agent:a,sessionOverride:b}){let{t:c}=(0,N.s9)(),{live:e,finished:g,clearLive:h,agents:i}=(0,r.o0)(),j=(0,F.dj)(),[k,l]=(0,f.useState)([]),[m,n]=(0,f.useState)(!1),[o,p]=(0,f.useState)(null),[t,u]=(0,f.useState)(null),v=(0,f.useRef)(null),w=(0,f.useRef)(!0),x=e[a.id],y="running"===a.status||!!x,z=void 0!==b&&b!==a.session_id;(0,f.useCallback)(()=>{let c=z?b:a.session_id;return c?s.F.get(`/agents/${a.id}/history?session=${encodeURIComponent(c)}`).then(a=>{l(a.messages),n(!0)}).catch(a=>{j(a.message,"err"),n(!0)}):(l([]),n(!0),Promise.resolve())},[a.id,a.session_id,z,b,j]),g[a.id];let A=(0,f.useCallback)(async b=>{if(z)return!1;p(b),w.current=!0;try{return await s.F.post(`/agents/${a.id}/messages`,{prompt:b}),!0}catch(a){return p(null),j(a instanceof Error?a.message:c("chat.sendFailed"),"err"),!1}},[a.id,z,j,c]),B=(0,f.useCallback)(()=>{s.F.post(`/agents/${a.id}/stop`).catch(()=>void 0)},[a.id]),C=(0,f.useCallback)(()=>u(a=>!a),[]),D=o&&!k.some(a=>"user"===a.role&&a.blocks.some(a=>"text"===a.type&&a.text.trim()===o)),H=m&&!k.length&&!x&&!o;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(G.Qh.Provider,{value:t,children:(0,d.jsx)("div",{className:"thread",ref:v,onWheel:a=>{a.deltaY<0&&(w.current=!1)},onScroll:a=>{let b=a.currentTarget;b.scrollHeight-b.scrollTop-b.clientHeight<40&&(w.current=!0)},children:(0,d.jsxs)("div",{className:"thread-inner",children:[H&&(0,d.jsxs)("div",{className:"empty",style:{marginTop:40},children:[(0,d.jsx)(F._h,{agent:a,size:"lg"}),(0,d.jsx)("h3",{children:c("chat.empty.title",{name:a.name})}),(0,d.jsx)("p",{children:"orchestrator"===a.role?c("chat.empty.orchestrator"):c("chat.empty.worker")})]}),(0,d.jsx)(U,{msgs:k,agent:a}),D&&!x?.prompt&&(0,d.jsx)(O,{text:o??""}),x&&(0,d.jsxs)(d.Fragment,{children:["dispatch"===x.source?(0,d.jsxs)("div",{className:"delegation-card",children:[(0,d.jsxs)("div",{className:"head",children:[(0,d.jsx)(q.A,{size:14}),c("chat.delegatedFrom",{name:i.find(a=>a.id===x.from)?.name??c("chat.anOrchestrator")})]}),(0,d.jsx)("p",{children:x.prompt}),(0,d.jsx)("span",{className:"hint",children:c("chat.delegatedNote")})]}):!k.some(a=>"user"===a.role&&a.blocks.some(a=>"text"===a.type&&a.text.trim()===x.prompt.trim()))&&(0,d.jsx)(O,{text:x.prompt}),(0,d.jsxs)("div",{className:"msg assistant",children:[(0,d.jsxs)("div",{className:"who",children:[(0,d.jsx)(F._h,{agent:a,size:"sm"}),a.name]}),(0,d.jsx)(T,{blocks:x.blocks,streaming:!0}),!x.error&&(0,d.jsxs)("span",{className:"typing","aria-label":c("common.working"),children:[(0,d.jsx)("i",{}),(0,d.jsx)("i",{}),(0,d.jsx)("i",{})]}),(0,d.jsx)(R,{turn:x}),x.error&&(0,d.jsxs)("div",{className:"banner err",children:[(0,d.jsx)(E.A,{size:16}),(0,d.jsx)("div",{className:"grow",children:(0,N.YF)(x.error)}),(0,d.jsx)("button",{className:"btn sm",onClick:()=>h(a.id),children:c("common.dismiss")})]})]})]})]})})}),(0,d.jsx)(V,{name:a.name,running:y,queued:a.queued??0,readOnly:z,onSend:A,onStop:B,toolsOpen:t,onToggleTools:C})]})}let X=(0,j.A)("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),Y=(0,j.A)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),Z=(0,j.A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);function $({agent:a,session:b}){let{t:c}=(0,N.s9)(),{finished:e,live:g}=(0,r.o0)(),[h,i]=(0,f.useState)(null),[j,k]=(0,f.useState)(!1);e[a.id];let l=g[a.id];if(!h||0===h.turns&&!l)return null;let m=l?.usage,n=(0,P.RP)(h.usage)+(m?(0,P.RP)({input:m.input??0,output:m.output??0,cacheRead:m.cacheRead??0,cacheWrite:m.cacheWrite??0}):0),o=(h.cost??0)+(l?.cost??0),p=(h.usage.credits??0)+(m?.credits??0),q=m?.contextPct??h.contextPct??(h.lastContext?Math.min(100,h.lastContext/2e5*100):null),s=null!==h.cost||l?.cost!==void 0,t=h.usage,u=Math.max(1,t.input+t.output+t.cacheRead+t.cacheWrite),v=Math.max(1,...h.tools.map(a=>a.count)),A=Math.max(1,...h.timeline.map(a=>a.tokens));return(0,d.jsxs)("div",{className:"stats-wrap",children:[(0,d.jsxs)("button",{className:"statsbar",onClick:()=>k(a=>!a),"aria-expanded":j,children:[(0,d.jsxs)("span",{className:"sb",title:c("stats.contextTitle"),children:[(0,d.jsx)(X,{size:14}),(0,d.jsx)("b",{children:null!==q?`${q.toFixed(+(q<10))}%`:(0,P.yj)(h.lastContext)}),c("stats.context")]}),(0,d.jsxs)("span",{className:"sb",children:[(0,d.jsx)(w,{size:14}),(0,d.jsx)("b",{children:(0,P.yj)(n)}),c("stats.tokens")]}),p>0&&(0,d.jsxs)("span",{className:"sb",children:[(0,d.jsx)(x,{size:14}),(0,d.jsx)("b",{children:p.toFixed(2)}),c("stats.credits")]}),s&&(0,d.jsxs)("span",{className:"sb",title:h.costEstimated?c("stats.costEstimated"):c("stats.costReported"),children:[(0,d.jsx)(x,{size:14}),(0,d.jsxs)("b",{children:[h.costEstimated?"≈ ":"",(0,P.F0)(o)]})]}),(0,d.jsxs)("span",{className:"sb",children:[(0,d.jsx)(Y,{size:14}),(0,d.jsx)("b",{children:h.turns}),c("stats.turns",{count:h.turns})]}),(0,d.jsxs)("span",{className:"sb",children:[(0,d.jsx)(y,{size:14}),(0,d.jsx)("b",{children:h.toolCalls}),c("stats.toolCalls",{count:h.toolCalls}),h.toolErrors>0&&(0,d.jsxs)("em",{className:"tbad",children:[" \xb7 ",c("stats.failed",{count:h.toolErrors})]})]}),h.durationMs>0&&(0,d.jsxs)("span",{className:"sb",children:[(0,d.jsx)(z,{size:14}),(0,d.jsx)("b",{children:(0,P.nc)(h.durationMs)}),c("stats.working")]}),(0,d.jsx)(Z,{size:15,className:`chev2 ${j?"open":""}`})]}),j&&(0,d.jsxs)("div",{className:"statspanel",children:[(0,d.jsxs)("section",{children:[(0,d.jsx)("div",{className:"eyebrow",children:c("stats.mix")}),(0,d.jsxs)("div",{className:"mixbar",role:"img","aria-label":c("stats.mix"),children:[(0,d.jsx)("i",{style:{width:`${t.cacheRead/u*100}%`,background:"var(--p-opencode)"}}),(0,d.jsx)("i",{style:{width:`${t.cacheWrite/u*100}%`,background:"var(--p-kiro)"}}),(0,d.jsx)("i",{style:{width:`${t.input/u*100}%`,background:"var(--honey)"}}),(0,d.jsx)("i",{style:{width:`${t.output/u*100}%`,background:"var(--p-claude)"}})]}),(0,d.jsxs)("dl",{className:"legend",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("i",{style:{background:"var(--p-opencode)"}}),(0,d.jsx)("dt",{children:c("stats.cacheRead")}),(0,d.jsx)("dd",{children:(0,P.yj)(t.cacheRead)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("i",{style:{background:"var(--p-kiro)"}}),(0,d.jsx)("dt",{children:c("stats.cacheWrite")}),(0,d.jsx)("dd",{children:(0,P.yj)(t.cacheWrite)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("i",{style:{background:"var(--honey)"}}),(0,d.jsx)("dt",{children:c("stats.input")}),(0,d.jsx)("dd",{children:(0,P.yj)(t.input)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("i",{style:{background:"var(--p-claude)"}}),(0,d.jsx)("dt",{children:c("stats.output")}),(0,d.jsxs)("dd",{children:[(0,P.yj)(t.output),t.reasoning>0&&(0,d.jsxs)("span",{className:"muted",children:[" (",c("stats.thinking",{tokens:(0,P.yj)(t.reasoning)}),")"]})]})]})]}),h.models.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"eyebrow",style:{marginTop:14},children:c("stats.models")}),h.models.map(a=>(0,d.jsxs)("div",{className:"row small",style:{justifyContent:"space-between"},children:[(0,d.jsx)("span",{className:"mono",children:a.model}),(0,d.jsx)("span",{className:"muted",children:c("stats.modelLine",{count:a.messages,out:(0,P.yj)(a.output)})})]},a.model))]})]}),(0,d.jsxs)("section",{children:[(0,d.jsxs)("div",{className:"eyebrow",children:[c("stats.toolsUsed")," ",h.toolTimeMs>0&&(0,d.jsxs)("span",{className:"muted",children:["\xb7 ",c("stats.totalTime",{time:(0,P.nc)(h.toolTimeMs)})]})]}),0===h.tools.length?(0,d.jsx)("p",{className:"muted small",style:{margin:"6px 0 0"},children:c("stats.noTools")}):h.tools.slice(0,9).map(a=>(0,d.jsxs)("div",{className:"toolrow",title:c("stats.toolTitle",{count:a.count,time:(0,P.nc)(a.totalMs)}),children:[(0,d.jsx)("span",{className:"mono tn",children:a.name.replace(/^mcp__/,"").replace("__"," \xb7 ")}),(0,d.jsx)("span",{className:"tbar",children:(0,d.jsx)("i",{style:{width:`${a.count/v*100}%`}})}),(0,d.jsxs)("span",{className:"tc",children:[a.count,a.errors>0&&(0,d.jsxs)("em",{className:"tbad",children:[" (",a.errors,"✗)"]})]}),(0,d.jsx)("span",{className:"td muted",children:a.totalMs?(0,P.nc)(a.totalMs/a.count):""})]},a.name))]}),(0,d.jsxs)("section",{style:{gridColumn:"1 / -1"},children:[(0,d.jsx)("div",{className:"eyebrow",children:c("stats.perTurn")}),(0,d.jsx)("div",{className:"spark",role:"list",children:h.timeline.slice(-40).map((a,b)=>(0,d.jsx)("div",{className:"sbar",role:"listitem",title:`${a.prompt||c("stats.promptFallback")}
|
|
3
|
-
${c("stats.turnLine",{tokens:(0,P.yj)(a.tokens),tools:a.tools,time:(0,P.nc)(a.durationMs)})}${null!==a.cost?` \xb7 ${(0,P.F0)(a.cost)}`:""}`,children:(0,d.jsx)("i",{style:{height:`${Math.max(4,a.tokens/A*100)}%`}})},b))})]})]})]})}let _=(0,j.A)("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]),aa=(0,j.A)("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);var ab=c(71267),ac=c(16487),ad=c(54842),ae=c(3936),af=c(36143);function ag({activeId:a,collapsed:b=!1,onToggle:c}){let{t:e}=(0,N.s9)(),{agents:g,colonies:i,live:j}=(0,r.o0)(),k=(0,ae.z)(),[l,m]=(0,f.useState)(""),[n,o]=(0,f.useState)(!1),p=(0,f.useMemo)(()=>{let a=a=>!l||`${a.name} ${a.description} ${a.provider} ${a.model}`.toLowerCase().includes(l.toLowerCase()),b=i.map(b=>({key:b.id,name:b.name,color:b.color||"var(--honey)",items:g.filter(c=>c.colony_id===b.id&&a(c))}));return b.push({key:"free",name:e("common.noColony"),color:null,items:g.filter(b=>(!b.colony_id||!i.some(a=>a.id===b.colony_id))&&a(b))}),b.filter(a=>a.items.length)},[g,i,l,e]),q=c&&(0,d.jsx)("button",{className:"btn ghost icon sm",onClick:c,"aria-label":b?e("switcher.expand"):e("switcher.collapse"),title:b?e("switcher.expand"):e("switcher.collapse"),"aria-expanded":!b,children:b?(0,d.jsx)(_,{size:17}):(0,d.jsx)(aa,{size:17})});return b?(0,d.jsxs)("aside",{className:"switcher mini","aria-label":e("nav.agents"),children:[(0,d.jsxs)("div",{className:"switcher-head",children:[q,(0,d.jsx)("button",{className:"btn ghost icon sm",onClick:()=>o(!0),"aria-label":e("newAgent.title"),title:e("newAgent.title"),children:(0,d.jsx)(ab.A,{size:16})})]}),(0,d.jsx)("div",{className:"switcher-list",children:p.map(b=>(0,d.jsxs)("div",{className:"mini-group",children:[(0,d.jsx)("div",{className:"mini-sep",title:`${b.name} \xb7 ${b.items.length}`,style:b.color?{"--c":b.color}:void 0}),b.items.map(b=>(0,d.jsx)(h(),{href:`/agents/${b.id}`,className:"sw-item mini","aria-current":b.id===a?"page":void 0,"aria-label":b.name,...k.bind(b.id),children:(0,d.jsxs)("span",{className:"sw-av",children:[(0,d.jsx)(F._h,{agent:b}),"idle"!==b.status&&(0,d.jsx)("i",{className:`pip ${"error"===b.status?"err":""}`})]})},b.id))]},b.key))}),n&&(0,d.jsx)(af.b,{onClose:()=>o(!1)}),k.node]}):(0,d.jsxs)("aside",{className:"switcher","aria-label":e("nav.agents"),children:[(0,d.jsxs)("div",{className:"switcher-head",children:[(0,d.jsxs)("div",{className:"row",children:[(0,d.jsx)("b",{style:{fontFamily:"var(--font-display)",fontSize:16},className:"grow",children:e("nav.agents")}),q,(0,d.jsx)("button",{className:"btn ghost icon sm",onClick:()=>o(!0),"aria-label":e("newAgent.title"),children:(0,d.jsx)(ab.A,{size:16})})]}),(0,d.jsxs)("div",{className:"search",children:[(0,d.jsx)(ac.A,{size:15}),(0,d.jsx)("input",{className:"input",placeholder:e("switcher.find"),value:l,onChange:a=>m(a.target.value),"aria-label":e("switcher.find")})]})]}),(0,d.jsxs)("div",{className:"switcher-list",children:[0===p.length&&(0,d.jsx)("p",{className:"muted small",style:{padding:16},children:e("switcher.noMatch",{query:l})}),p.map(b=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"switcher-group",children:[b.color&&(0,d.jsx)("i",{className:"cdot",style:{background:b.color}}),b.name,(0,d.jsx)("span",{children:b.items.length})]}),b.items.map(b=>{let c=(0,ad.E)(j[b.id]);return(0,d.jsxs)(h(),{href:`/agents/${b.id}`,className:"sw-item","aria-current":b.id===a?"page":void 0,...k.bind(b.id),children:[(0,d.jsxs)("span",{className:"sw-av",children:[(0,d.jsx)(F._h,{agent:b}),"idle"!==b.status&&(0,d.jsx)("i",{className:`pip ${"error"===b.status?"err":""}`})]}),(0,d.jsxs)("span",{className:"sw-body",children:[(0,d.jsxs)("span",{className:"sw-top",children:[(0,d.jsx)("b",{children:b.name}),"orchestrator"===b.role&&(0,d.jsx)("em",{children:e("role.orchestrator")})]}),(0,d.jsx)("span",{className:`sw-sub ${c?"live":b.description?"":"blank"}`,children:c??("error"===b.status?e("status.error"):b.description||e("switcher.noDescription"))}),(0,d.jsxs)("span",{className:"sw-meta",children:[(0,d.jsx)("i",{style:{background:t.xq[b.provider].color}}),t.xq[b.provider].short,b.model?` \xb7 ${b.model}`:"",(0,d.jsx)("span",{className:"sw-ago",children:b.queued&&b.queued>0?e("queue.count",{count:b.queued}):(0,t.KN)(b.updated_at)})]})]})]},b.id)})]},b.key))]}),n&&(0,d.jsx)(af.b,{onClose:()=>o(!1)}),k.node]})}let ah=(0,j.A)("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);var ai=c(78381);let aj=(0,j.A)("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]),ak=(0,j.A)("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]),al=(0,j.A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var am=c(31251);let an=(0,j.A)("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);var ao=c(4111);let ap=(0,j.A)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),aq=(0,j.A)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),ar=(0,j.A)("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);function as(a){let b={meta:[],hunks:[],binary:!1},c=null,d=0,e=0;for(let f of a.split("\n")){let a=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@ ?(.*)$/.exec(f);if(a){d=Number(a[1]),e=Number(a[2]),c={header:f,section:a[3]??"",lines:[]},b.hunks.push(c);continue}if(!c){/^Binary files .* differ$/.test(f)||f.startsWith("GIT binary patch")?b.binary=!0:(/^(rename|copy) (from|to) /.test(f)||/^(new|deleted) file mode/.test(f)||/^similarity index/.test(f))&&b.meta.push(f);continue}let g=f[0];if("+"===g)c.lines.push({kind:"add",newNo:e++,text:f.slice(1)});else if("-"===g)c.lines.push({kind:"del",oldNo:d++,text:f.slice(1)});else if(" "===g)c.lines.push({kind:"ctx",oldNo:d++,newNo:e++,text:f.slice(1)});else if("\\"===g){let a=c.lines[c.lines.length-1];a&&(a.noEol=!0)}}return b}let at=a=>/^(@@ [^@]+@@)/.exec(a)?.[1]??a;var au=c(25538),av=c(18355),aw=c(35360),ax=c(91432),ay=c(33430),az=c(16870),aA=c(28118),aB=c(26379),aC=c(68459),aD=c(30055),aE=c(89373),aF=c(77502),aG=c(18743),aH=c(33976),aI=c(91033),aJ=c(15892),aK=c(1164),aL=c(59817),aM=c(67607),aN=c(79589),aO=c(39483),aP=c(40449),aQ=c(62033),aR=c(83410),aS=c(91030),aT=c(76444),aU=c(1526);for(let[a,b]of Object.entries({bash:av.A,c:aw.A,cpp:ax.A,csharp:ay.A,css:az.A,diff:aA.A,dockerfile:aB.A,go:aC.A,ini:aD.A,java:aE.A,javascript:aF.A,json:aG.A,kotlin:aH.A,makefile:aI.A,markdown:aJ.A,perl:aK.A,php:aL.A,python:aM.A,ruby:aN.A,rust:aO.A,scss:aP.A,sql:aQ.A,swift:aR.A,typescript:aS.A,xml:aT.A,yaml:aU.A}))au.A.registerLanguage(a,b);let aV={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",json:"json",css:"css",scss:"scss",html:"xml",htm:"xml",xml:"xml",svg:"xml",vue:"xml",svelte:"xml",md:"markdown",mdx:"markdown",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",h:"c",cpp:"cpp",cc:"cpp",hpp:"cpp",cs:"csharp",php:"php",pl:"perl",pm:"perl",sh:"bash",bash:"bash",zsh:"bash",yml:"yaml",yaml:"yaml",toml:"ini",ini:"ini",conf:"ini",cfg:"ini",sql:"sql",diff:"diff",patch:"diff",mk:"makefile"};function aW(a){let b=a.slice(a.lastIndexOf("/")+1).toLowerCase();return"dockerfile"===b?"dockerfile":"makefile"===b?"makefile":aV[b.includes(".")?b.slice(b.lastIndexOf(".")+1):""]??null}let aX=a=>a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function aY(a,b){let c,d,e=aW(b);if(!e||a.length>12e5)c=aX(a);else try{c=au.A.highlight(a,{language:e,ignoreIllegals:!0}).value}catch{c=aX(a)}let f=[],g=[],h="",i=/<span [^>]*>|<\/span>|\n|[^<\n]+/g;for(;d=i.exec(c);){let a=d[0];"\n"===a?(f.push(h+"</span>".repeat(g.length)),h=g.join("")):(a.startsWith("<span")?g.push(a):"</span>"===a&&g.pop(),h+=a)}return f.push(h+"</span>".repeat(g.length)),f}function aZ(a){return a.replace(/(^|>)([^<]+)/g,(a,b,c)=>b+c.replace(/[\t ]/g,a=>" "===a?'<i class="ws-t"> </i>':'<i class="ws-s"> </i>'))}function a$(a,b,c=0){let d=a.length<=15e3,e=(0,f.useMemo)(()=>d?aY(a,b):null,[d,a,b]),g=(0,f.useMemo)(()=>d?[]:a.split("\n"),[d,a]),[h,i]=(0,f.useState)(null);return(0,f.useMemo)(()=>{if(e)return e;if(!h||h.path!==b)return g.map(aX);let a=h.raws,c=0;for(;c<g.length&&c<a.length&&g[c]===a[c];)c++;let d=0;for(;d<g.length-c&&d<a.length-c&&g[g.length-1-d]===a[a.length-1-d];)d++;return g.map((b,e)=>e<c?h.html[e]:e>=g.length-d?h.html[a.length-(g.length-e)]:aX(b))},[e,h,b,g])}let a_=[{id:"app",label:"Hive",dark:!1,swatch:["#f6f4ee","#9a6a00","#2f8f5b","#2f5bea"]},{id:"gitlab-light",label:"GitLab Light",dark:!1,swatch:["#ffffff","#a31515","#0451a5","#6f42c1"]},{id:"gitlab-dark",label:"GitLab Dark",dark:!0,swatch:["#1f1e24","#ff7b72","#a5d6ff","#d2a8ff"]},{id:"solarized-light",label:"Solarized Light",dark:!1,swatch:["#fdf6e3","#859900","#2aa198","#268bd2"]},{id:"solarized-dark",label:"Solarized Dark",dark:!0,swatch:["#002b36","#859900","#2aa198","#268bd2"]},{id:"monokai",label:"Monokai",dark:!0,swatch:["#272822","#f92672","#e6db74","#66d9ef"]},{id:"dracula",label:"Dracula",dark:!0,swatch:["#282a36","#ff79c6","#f1fa8c","#8be9fd"]}],a0={theme:"app",whitespace:!1,tabSize:4,showIgnored:!0},a1=a0,a2=new Set;function a3(){}function a4(a){a1={...a1,...a};try{localStorage.setItem("hive-git-view",JSON.stringify(a1))}catch{}a2.forEach(a=>a())}function a5(){return(0,f.useSyncExternalStore)(a=>(a2.add(a),()=>a2.delete(a)),()=>(a3(),a1),()=>a0)}var a6=c(48881),a7=c(28923),a8=c(2838);function a9(){let{t:a}=(0,N.s9)(),b=a5(),[c,e]=(0,f.useState)(!1),g=(0,f.useRef)(null);return(0,a8.s)(c,g,()=>e(!1)),(0,d.jsxs)("div",{className:"gx-brmenu gx-set",ref:g,children:[(0,d.jsx)("button",{type:"button",className:"btn ghost icon sm","aria-expanded":c,"aria-haspopup":"dialog","aria-label":a("git.set.title"),title:a("git.set.title"),onClick:()=>e(a=>!a),children:(0,d.jsx)(a6.A,{size:15})}),c&&(0,d.jsxs)("div",{className:"gx-pop gx-setpop",role:"dialog","aria-label":a("git.set.title"),children:[(0,d.jsx)("div",{className:"gx-brhead",style:{padding:"0 2px"},children:a("git.set.theme")}),(0,d.jsx)("div",{className:"gx-themes",role:"radiogroup","aria-label":a("git.set.theme"),children:a_.map(c=>(0,d.jsxs)("button",{type:"button",role:"radio","aria-checked":b.theme===c.id,className:`gx-theme ${b.theme===c.id?"on":""}`,onClick:()=>a4({theme:c.id}),children:[(0,d.jsxs)("span",{className:"sw",style:{background:c.swatch[0]},children:[(0,d.jsx)("i",{style:{background:c.swatch[1]}}),(0,d.jsx)("i",{style:{background:c.swatch[2]}}),(0,d.jsx)("i",{style:{background:c.swatch[3]}})]}),(0,d.jsx)("span",{className:"nm",children:"app"===c.id?a("git.set.themeApp"):c.label}),b.theme===c.id&&(0,d.jsx)(a7.A,{size:14})]},c.id))}),(0,d.jsxs)("label",{className:"gx-opt",children:[(0,d.jsx)("input",{type:"checkbox",checked:b.whitespace,onChange:a=>a4({whitespace:a.target.checked})}),(0,d.jsxs)("span",{children:[(0,d.jsx)("b",{children:a("git.set.whitespace")}),(0,d.jsx)("small",{children:a("git.set.whitespace.hint")})]})]}),(0,d.jsxs)("label",{className:"gx-opt",children:[(0,d.jsx)("input",{type:"checkbox",checked:b.showIgnored,onChange:a=>a4({showIgnored:a.target.checked})}),(0,d.jsxs)("span",{children:[(0,d.jsx)("b",{children:a("git.set.ignored")}),(0,d.jsx)("small",{children:a("git.set.ignored.hint")})]})]}),(0,d.jsxs)("div",{className:"gx-opt",children:[(0,d.jsx)("span",{children:(0,d.jsx)("b",{children:a("git.set.tab")})}),(0,d.jsx)("div",{className:"seg",role:"group",children:[2,4,8].map(a=>(0,d.jsx)("button",{type:"button","aria-pressed":b.tabSize===a,onClick:()=>a4({tabSize:a}),children:a},a))})]}),(0,d.jsx)("p",{className:"small muted",style:{margin:0},children:a("git.set.note")})]})]})}function ba({html:a}){let{whitespace:b}=a5(),c=(0,f.useMemo)(()=>b?aZ(a):a,[a,b]);return(0,d.jsx)("span",{dangerouslySetInnerHTML:{__html:c||" "}})}let bb=(0,f.memo)(function({html:a,ws:b}){let c=(0,f.useMemo)(()=>b?aZ(a):a,[a,b]);return(0,d.jsx)("span",{dangerouslySetInnerHTML:{__html:c||" "}})});function bc({text:a,path:b}){let c=(0,f.useMemo)(()=>aY(a,b).join("\n"),[a,b]);return(0,d.jsx)(ba,{html:c})}let bd=(0,f.memo)(function({text:a,path:b,ws:c}){let e=(0,f.useMemo)(()=>aY(a,b)[0]??"",[a,b]);return(0,d.jsx)(bb,{html:e,ws:c})});var be=c(61593);function bf({count:a,width:b,render:c,overscan:e=20,overlay:g,reveal:h}){let i=(0,f.useRef)(null),j=(0,f.useRef)(0),[k,l]=(0,f.useState)({top:0,h:800,w:900}),m=(0,f.useCallback)(()=>{cancelAnimationFrame(j.current),j.current=requestAnimationFrame(()=>{let a=i.current;a&&l(b=>b.top===a.scrollTop&&b.h===a.clientHeight&&b.w===a.clientWidth?b:{top:a.scrollTop,h:a.clientHeight,w:a.clientWidth})})},[]),n=Math.max(0,Math.floor(k.top/20)-e),o=Math.min(a,Math.ceil((k.top+k.h)/20)+e),p=[];for(let a=n;a<o;a++)p.push(c(a));return(0,d.jsx)("div",{className:"vl",ref:i,onScroll:m,style:{"--vl-vw":`${k.w}px`},children:(0,d.jsxs)("div",{className:"vl-space",style:{height:20*a,minWidth:b},children:[(0,d.jsx)("div",{className:"vl-win",style:{top:20*n},children:p}),g&&(0,d.jsx)("div",{className:"vl-peekwrap",style:{top:g.top},children:g.node})]})})}let bg=(0,f.memo)(function({row:a,path:b,ws:c,actions:e,picking:f,onPick:g}){let{t:h}=(0,N.s9)();if("hunk"===a.t)return(0,d.jsxs)("div",{className:"vl-row hunk",children:[(0,d.jsx)("div",{className:"vl-ln",style:{left:0},children:"⋯"}),(0,d.jsx)("div",{className:"vl-ln",style:{left:"calc(6ch + 16px)"},children:"⋯"}),(0,d.jsxs)("div",{className:"vl-hl",children:[(0,d.jsx)("span",{className:"rng mono",children:a.header}),a.section&&(0,d.jsx)("span",{className:"hs",title:a.section,children:a.section}),e&&f?.hunk===a.idx?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",className:"hk-btn on",onClick:()=>e.pickAll(a.idx,a.changed),children:h("git.discard.lines.all")}),(0,d.jsxs)("button",{type:"button",className:"hk-btn danger on",disabled:!f.picked.size,onClick:()=>e.discardPicked(a.idx,a.header),children:[(0,d.jsx)(an,{size:12}),h("git.discard.lines.go",{count:f.picked.size})]}),(0,d.jsx)("button",{type:"button",className:"hk-btn on",onClick:e.stopPicking,children:h("common.cancel")})]}):e&&(0,d.jsxs)(d.Fragment,{children:[a.changed>0&&e.canPick&&(0,d.jsxs)("button",{type:"button",className:"hk-btn",title:h("git.discard.lines.hint"),onClick:()=>e.startPicking(a.idx),children:[(0,d.jsx)(be.A,{size:12}),h("git.discard.lines")]}),(0,d.jsxs)("button",{type:"button",className:"hk-btn",title:h("git.discard.hunk.hint"),onClick:()=>e.discardHunk(a.idx,a.header),children:[(0,d.jsx)(an,{size:12}),h("git.discard.hunk")]})]})]})]});if("line"===a.t){let e=a.l;return(0,d.jsxs)("div",{className:`vl-row ${e.kind} ${g&&void 0!==a.k&&f?.picked.has(a.k)?"picked":""}`,onClick:g&&void 0!==a.k?()=>g(a.k):void 0,children:[(0,d.jsx)("div",{className:"vl-ln",style:{left:0},children:e.oldNo??""}),(0,d.jsx)("div",{className:"vl-ln",style:{left:"calc(6ch + 16px)"},children:e.newNo??""}),(0,d.jsx)("div",{className:"vl-sg",children:g&&void 0!==a.k?(0,d.jsx)("input",{type:"checkbox",checked:!!f?.picked.has(a.k),onChange:()=>void 0,"aria-label":h("git.discard.lines.pick")}):"add"===e.kind?"+":"del"===e.kind?"−":""}),(0,d.jsx)("div",{className:"vl-cd",children:(0,d.jsx)(bd,{text:e.text,path:b,ws:c})})]})}let{left:i,right:j}=a.r;return(0,d.jsxs)("div",{className:"vl-row split",children:[(0,d.jsx)("div",{className:`vl-ln ${i?.kind??"void"}`,style:{left:0},children:i?.oldNo??""}),(0,d.jsx)("div",{className:`vl-cd ${i?.kind??"void"}`,title:i&&i.text.length>60?i.text:void 0,children:i?(0,d.jsx)(bd,{text:i.text,path:b,ws:c}):null}),(0,d.jsx)("div",{className:`vl-ln ${j?.kind??"void"}`,children:j?.newNo??""}),(0,d.jsx)("div",{className:`vl-cd ${j?.kind??"void"}`,title:j&&j.text.length>60?j.text:void 0,children:j?(0,d.jsx)(bd,{text:j.text,path:b,ws:c}):null})]})});function bh({parsed:a,layout:b,path:c,cutOff:e=!1,firstIndex:g=0,onDiscardHunk:h,onDiscardLines:i}){let{whitespace:j}=a5(),k=(0,f.useMemo)(()=>(function(a,b,c,d=0){let e=[],f=(a=>{let b=aW(a);return!!b&&!["markdown","yaml","json","ini","xml","diff","dockerfile","makefile"].includes(b)})(c);return a.hunks.forEach((a,c)=>{e.push({t:"hunk",idx:c+d,header:at(a.header),section:f?a.section:"",changed:a.lines.filter(a=>"ctx"!==a.kind).length});let g=0;if("unified"===b)for(let b of a.lines)e.push({t:"line",l:b,hunk:c+d,k:"ctx"===b.kind?void 0:g++});else for(let b of function(a){let b=[];for(let c=0;c<a.length;){let d=a[c];if("ctx"===d.kind){b.push({left:d,right:d}),c++;continue}let e=[],f=[];for(;c<a.length&&"del"===a[c].kind;)e.push(a[c++]);for(;c<a.length&&"add"===a[c].kind;)f.push(a[c++]);for(let a=0;a<Math.max(e.length,f.length);a++)b.push({left:e[a],right:f[a]})}return b}(a.lines))e.push({t:"pair",r:b})}),e})(a,b,c,g),[a,b,c,g]),l=(0,f.useMemo)(()=>a.hunks.reduce((a,b)=>b.lines.reduce((a,b)=>Math.max(a,b.text.length),a),0),[a]),m="unified"===b?`calc(12ch + 32px + 18px + ${l}ch + 24px)`:void 0,n=(0,f.useRef)(null),o=(0,f.useRef)(null),[p,q]=(0,f.useState)({max:0,track:0}),[r,s]=(0,f.useState)(null),t=a=>s(b=>{if(!b)return b;let c=new Set(b.picked);return c.has(a)?c.delete(a):c.add(a),{...b,picked:c}}),u=h?{canPick:"unified"===b&&!!i,discardHunk:h,startPicking:a=>s({hunk:a,picked:new Set}),stopPicking:()=>s(null),pickAll:(a,b)=>s({hunk:a,picked:new Set(Array.from({length:b},(a,b)=>b))}),discardPicked:(a,b)=>{if(r&&i){let c=[...r.picked].sort((a,b)=>a-b);s(null),i(a,b,c)}}}:void 0;return(0,d.jsxs)("div",{className:`vf is-${b}`,ref:n,style:{"--vl-left":"0px","--hx":"0px"},children:[a.meta.length>0&&(0,d.jsx)("div",{className:"gx-meta",children:a.meta.join(" \xb7 ")}),(0,d.jsx)("div",{className:"vf-main",children:(0,d.jsx)(bf,{count:k.length,width:m,render:b=>{let f=k[b],g="line"===f.t&&r?.hunk===f.hunk;return(0,d.jsx)(bg,{row:f,path:c,ws:j,actions:"hunk"!==f.t||e&&f.idx===a.hunks.length-1?void 0:u,picking:"hunk"===f.t||g?r:void 0,onPick:g?t:void 0},b)}})}),"split"===b&&p.max>0&&(0,d.jsx)("div",{className:"hbar",ref:o,onScroll:a=>n.current?.style.setProperty("--hx",`${a.currentTarget.scrollLeft}px`),"aria-label":"Scroll sideways",children:(0,d.jsx)("div",{style:{width:p.track+p.max,height:1}})})]})}let bi={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"U",conflict:"!",typechange:"T"};function bj({status:a,titled:b=!1}){let{t:c}=(0,N.s9)();return(0,d.jsx)("span",{className:`stl st-${a}`,title:b?c(`git.status.${a}`):void 0,children:bi[a]})}function bk(a){let b=a.split("\n"),c=[];for(let a=0;a<b.length;a++){if(!/^<{7}( |$)/.test(b[a]))continue;let d=-1,e=-1,f=-1;for(let c=a+1;c<b.length&&!/^<{7}( |$)/.test(b[c]);c++)if(/^\|{7}( |$)/.test(b[c])&&d<0)e=c;else if("======="===b[c]&&d<0)d=c;else if(/^>{7}( |$)/.test(b[c])&&d>=0){f=c;break}d<0||f<0||(c.push({start:a,end:f,ours:b.slice(a+1,e>=0?e:d),base:e>=0?b.slice(e+1,d):void 0,theirs:b.slice(d+1,f),oursLabel:b[a].slice(8).trim(),theirsLabel:b[f].slice(8).trim()}),a=f)}return c}function bl(a,b,c){let d=bk(a)[b];if(!d)return a;let e={ours:d.ours,theirs:d.theirs,"ours-theirs":[...d.ours,...d.theirs],"theirs-ours":[...d.theirs,...d.ours]}[c],f=a.split("\n");return f.splice(d.start,d.end-d.start+1,...e),f.join("\n")}function bm({value:a,onChange:b,path:c,id:e,label:g}){let h=a5(),i=(0,f.useRef)(null),j=(0,f.useRef)(null),k=(0,f.useRef)(0),[l,m]=(0,f.useState)({top:0,h:600}),n=a$(a,c,150),o=(0,f.useMemo)(()=>a.split("\n"),[a]),p=(0,f.useMemo)(()=>o.reduce((a,b)=>Math.max(a,b.length),0),[o]),q=String(n.length).length+2,r=Math.max(0,Math.floor(l.top/20)-20),s=Math.min(n.length,Math.ceil((l.top+l.h)/20)+20),t=[];for(let a=r;a<s;a++){let b=o[a]??"",c=/^(<{7}|>{7})( |$)/.test(b)?"mk-edge":"======="===b?"mk-mid":"";t.push((0,d.jsxs)("div",{className:`ce-row ${c}`,children:[(0,d.jsx)("span",{className:"ce-no",children:a+1}),(0,d.jsx)("span",{className:"ce-code",children:(0,d.jsx)(bb,{html:n[a],ws:h.whitespace})})]},a))}return(0,d.jsxs)("div",{className:"ce",style:{"--g-tab":h.tabSize,"--ce-gw":`${q}ch`},children:[(0,d.jsx)("div",{className:"ce-layer",ref:j,"aria-hidden":!0,children:(0,d.jsx)("div",{className:"ce-space",style:{height:20*o.length,minWidth:`calc(${q}ch + ${p}ch + 40px)`},children:(0,d.jsx)("div",{className:"ce-win",style:{top:20*r},children:t})})}),(0,d.jsx)("textarea",{ref:i,id:e,"aria-label":g,className:"ce-area",value:a,spellCheck:!1,wrap:"off",onChange:a=>b(a.target.value),onScroll:()=>{let a=i.current,b=j.current;a&&b&&(b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft,cancelAnimationFrame(k.current),k.current=requestAnimationFrame(()=>m(b=>b.top===a.scrollTop&&b.h===a.clientHeight?b:{top:a.scrollTop,h:a.clientHeight})))},onKeyDown:c=>{if("Tab"!==c.key)return;c.preventDefault();let d=c.currentTarget,e=d.selectionStart,f=d.selectionEnd,g=" ".repeat(h.tabSize);if(e===f&&!c.shiftKey){b(a.slice(0,e)+g+a.slice(f)),requestAnimationFrame(()=>d.setSelectionRange(e+g.length,e+g.length));return}let i=a.lastIndexOf("\n",e-1)+1,j=a.indexOf("\n",f),k=-1===j?a.length:j,l=a.slice(i,k).split("\n").map(a=>c.shiftKey?a.replace(RegExp(`^ {1,${h.tabSize}}`),""):g+a).join("\n");b(a.slice(0,i)+l+a.slice(k)),requestAnimationFrame(()=>d.setSelectionRange(i,i+l.length))}})]})}function bn({agent:a,path:b,state:c,a:e,onResolved:g}){let{t:h}=(0,N.s9)(),[i,j]=(0,f.useState)(null),[k,m]=(0,f.useState)(""),[n,o]=(0,f.useState)(null),[p,q]=(0,f.useState)(0),r=(0,f.useMemo)(()=>bk(k),[k]),s="rebase"!==c&&"stash"!==c,t=a=>"mine"===a===s?"ours":"theirs",u=a=>"both-mine"===a?s?"ours-theirs":"theirs-ours":"both-remote"===a?s?"theirs-ours":"ours-theirs":t(a),v=/^(<{7}|>{7})( |$)/m.test(k),w=!!i&&!i.binary&&!i.truncated,x=!!e.busy,y=async a=>{await e.run("resolve",h("git.res.done"),"resolve-side",{path:b,side:t(a)})&&g()},z=async()=>{await e.run("resolve",h("git.res.done"),"resolve",{path:b,content:k})&&g()},A=async()=>{await e.run("unresolve",h("git.res.restored"),"unresolve",{path:b})&&q(a=>a+1)},B=b.lastIndexOf("/"),C=B>=0?b.slice(0,B+1):"",D=b.slice(B+1);return(0,d.jsxs)("section",{className:"gx-preview gx-resolver","aria-label":b,children:[(0,d.jsxs)("header",{className:"gx-phead",children:[(0,d.jsxs)("div",{className:"gx-ptitle",children:[(0,d.jsxs)("span",{className:"gx-path mono",title:b,children:[(0,d.jsx)("span",{className:"dir",children:C}),(0,d.jsx)("b",{children:D})]}),(0,d.jsx)("span",{className:"gx-chip st-conflict",children:h("git.status.conflict")}),w&&(0,d.jsx)("span",{className:"muted small",children:r.length>0?h("git.res.left",{count:r.length}):h("git.res.none")})]}),(0,d.jsxs)("div",{className:"gx-ptools",children:[(0,d.jsx)("button",{className:"btn sm",disabled:x,title:h("git.res.allMine.hint"),onClick:()=>void y("mine"),children:h("git.res.allMine")}),(0,d.jsx)("button",{className:"btn sm",disabled:x,title:h("git.res.allRemote.hint"),onClick:()=>void y("remote"),children:h("git.res.allRemote")}),(0,d.jsx)(G.WQ,{text:b,label:h("git.copyPath")})]})]}),n?(0,d.jsx)("p",{className:"gx-note err",children:n}):i?w?(0,d.jsxs)("div",{className:"gx-rbody",children:[r.length>0&&(0,d.jsx)("div",{className:"gx-rblocks",children:r.map((a,e)=>(0,d.jsxs)("div",{className:"gx-rcard",children:[(0,d.jsxs)("div",{className:"gx-rtitle",children:[(0,d.jsx)("b",{children:h("git.res.block",{n:e+1,total:r.length})}),(0,d.jsx)("span",{className:"muted small",children:h("git.res.line",{n:a.start+1})})]}),(0,d.jsx)("div",{className:"gx-rsides",children:["mine","remote"].map(f=>{let g,i="ours"===t(f)?a.ours:a.theirs,j=!(g="ours"===t(f)?a.oursLabel:a.theirsLabel)||["HEAD","ours","theirs","Updated upstream","Stashed changes"].includes(g)?"":g;return(0,d.jsxs)("div",{className:`gx-rside ${f}`,children:[(0,d.jsxs)("div",{className:"gx-rhead",children:[(0,d.jsx)("span",{children:"mine"===f?"stash"===c?h("git.res.mine.stash"):h("git.res.mine"):"stash"===c?h("git.res.remote.stash"):h("git.res.remote")}),j&&(0,d.jsx)("i",{className:"ref",children:j})]}),(0,d.jsx)("pre",{children:i.length?(0,d.jsx)(bc,{text:i.join("\n"),path:b}):(0,d.jsx)("span",{className:"muted",children:h("git.res.empty")})}),(0,d.jsx)("button",{className:"btn sm",onClick:()=>m(a=>bl(a,e,u(f))),children:"mine"===f?h("git.res.keepMine"):h("git.res.keepRemote")})]},f)})}),(0,d.jsxs)("div",{className:"gx-rboth",children:[(0,d.jsxs)("span",{className:"small muted",children:[h("git.res.both"),":"]}),(0,d.jsx)("button",{className:"btn sm",onClick:()=>m(a=>bl(a,e,u("both-mine"))),children:h("git.res.bothMine")}),(0,d.jsx)("button",{className:"btn sm",onClick:()=>m(a=>bl(a,e,u("both-remote"))),children:h("git.res.bothRemote")})]})]},`${e}-${a.start}`))}),(0,d.jsxs)("div",{className:"gx-rresult",children:[(0,d.jsxs)("div",{className:"row",children:[(0,d.jsx)("label",{className:"label grow",htmlFor:"gx-result",children:h("git.res.result")}),(0,d.jsx)("span",{className:"small muted",children:h("git.res.editHint")})]}),(0,d.jsx)(bm,{id:"gx-result",label:h("git.res.result"),value:k,path:b,onChange:m})]}),(0,d.jsxs)("footer",{className:"gx-rfoot",children:[(0,d.jsxs)("button",{className:"btn ghost sm",disabled:x,onClick:()=>void A(),title:h("git.res.restore.hint"),children:[(0,d.jsx)(l,{size:14}),h("git.res.restore")]}),(0,d.jsx)("span",{className:"grow"}),(0,d.jsx)("button",{className:"btn primary",disabled:x||v,onClick:()=>void z(),children:h("git.res.markResolved")})]})]}):(0,d.jsx)("p",{className:"gx-note",children:h("git.res.noEdit")}):(0,d.jsx)("p",{className:"gx-note",children:h("git.loading")})]})}function bo({agent:a,plan:b,a:c,onClose:e,onGo:f}){let{t:g}=(0,N.s9)();return(0,d.jsxs)(F.aF,{title:g("git.sw.title",{branch:b.to}),onClose:e,children:[b.carried>0&&(0,d.jsx)("p",{className:"muted",style:{margin:0},children:g("git.sw.carried",{count:b.carried,from:b.from})}),(0,d.jsxs)("div",{className:"gx-sw-warn",role:"alert",children:[b.selfRunning&&(0,d.jsx)("div",{children:g("git.warn.running",{name:a.name})}),b.others.length>0&&(0,d.jsx)("div",{children:g("git.sw.others",{count:b.others.length,names:b.others.map(a=>a.name).join(", ")})})]}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:e,children:g("common.cancel")}),(0,d.jsx)("button",{className:"btn primary",disabled:!!c.busy,onClick:f,children:g("git.sw.anyway")})]})]})}let bp=(0,j.A)("PackagePlus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),bq=(0,j.A)("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);var br=c(34410);function bs({stashes:a,sel:b,onSelect:c,onSave:e,canSave:f}){let{t:g}=(0,N.s9)();return(0,d.jsxs)("div",{className:"gx-stashes",children:[(0,d.jsx)("div",{className:"gx-stash-head",children:(0,d.jsxs)("button",{className:"btn sm",disabled:!f,title:f?void 0:g("git.stash.nothing"),onClick:e,children:[(0,d.jsx)(bp,{size:14}),g("git.stash.save")]})}),a?0===a.length?(0,d.jsx)("p",{className:"gx-note",children:g("git.stash.empty")}):(0,d.jsx)("div",{className:"gx-hist",role:"listbox","aria-label":g("git.tab.stashes"),children:a.map(a=>(0,d.jsxs)("button",{role:"option","aria-selected":b===a.sha,className:`gx-commit ${b===a.sha?"sel":""}`,onClick:()=>c(a.sha),children:[(0,d.jsx)("span",{className:"subj",children:a.message||"—"}),(0,d.jsxs)("span",{className:"meta",children:[a.branch&&(0,d.jsxs)(d.Fragment,{children:[a.branch," \xb7 "]}),(0,t.KN)(Date.parse(a.date))]}),a.smart&&(0,d.jsx)("span",{className:"refs",children:(0,d.jsx)("i",{className:"ref",children:g("git.stash.smart")})})]},a.sha))}):(0,d.jsx)("p",{className:"gx-note",children:g("git.loading")})]})}function bt({a,onClose:b}){let{t:c}=(0,N.s9)(),[e,g]=(0,f.useState)(""),h=async()=>{b(),await a.run("stash",c("git.stash.saved"),"stash-save",{message:e})};return(0,d.jsxs)(F.aF,{title:c("git.stash.save"),onClose:b,children:[(0,d.jsx)("p",{className:"muted",style:{margin:0},children:c("git.stash.save.body")}),(0,d.jsx)("input",{className:"input",autoFocus:!0,value:e,maxLength:200,placeholder:c("git.stash.save.placeholder"),onChange:a=>g(a.target.value),onKeyDown:a=>{"Enter"===a.key&&h()},"aria-label":c("git.stash.save.placeholder")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:b,children:c("common.cancel")}),(0,d.jsx)("button",{className:"btn primary",disabled:!!a.busy,onClick:()=>void h(),children:c("git.stash.save")})]})]})}function bu({agent:a,stash:b,a:c}){let{t:e}=(0,N.s9)(),[g,h]=(0,f.useState)(null),[i,j]=(0,f.useState)(null),[k,l]=(0,f.useState)(null),[m,n]=(0,f.useState)(null),[o,p]=(0,f.useState)(!1),[q,r]=(0,f.useState)(null),s=(0,f.useMemo)(()=>m?as(m.diff):null,[m]),u=!!c.busy,v=a=>void c.run("stash",a?e("git.stash.popped"):e("git.stash.applied"),"stash-apply",{sha:b.sha,pop:a}),w=(i?.files.length??0)+(g?.untracked.length??0);return(0,d.jsxs)("section",{className:"gx-preview gx-commitview","aria-label":b.message,children:[(0,d.jsxs)("header",{className:"gx-chead",children:[(0,d.jsx)("h3",{children:b.message||"—"}),(0,d.jsxs)("div",{className:"muted small row gap-s wrap",children:[(0,d.jsxs)("span",{children:[b.branch&&`${b.branch} \xb7 `,(0,t.KN)(Date.parse(b.date))]}),g&&(0,d.jsxs)("span",{children:["\xb7 ",e("git.hist.files",{count:w})]})]}),(0,d.jsxs)("div",{className:"row gap-s wrap",children:[(0,d.jsxs)("button",{className:"btn sm",disabled:u,title:e("git.stash.apply.hint"),onClick:()=>v(!1),children:[(0,d.jsx)(bq,{size:14}),e("git.stash.apply")]}),(0,d.jsx)("button",{className:"btn sm primary",disabled:u,title:e("git.stash.pop.hint"),onClick:()=>v(!0),children:e("git.stash.pop")}),(0,d.jsxs)("button",{className:"btn sm danger",disabled:u,onClick:()=>p(!0),children:[(0,d.jsx)(br.A,{size:14}),e("git.stash.drop")]})]})]}),q?(0,d.jsx)("p",{className:"gx-note err",children:q}):i&&g?0===w?(0,d.jsx)("p",{className:"gx-note",children:e("git.hist.noFiles")}):(0,d.jsxs)("div",{className:"gx-cfilelist",role:"listbox",children:[i.files.map(a=>(0,d.jsxs)("button",{role:"option","aria-selected":k?.path===a.path&&!k.untracked,className:`gx-cfile ${k?.path===a.path&&!k.untracked?"sel":""}`,onClick:()=>l({path:a.path,untracked:!1,oldPath:a.oldPath}),children:[(0,d.jsx)(bj,{status:a.status}),(0,d.jsx)("span",{className:"mono nm",children:a.path}),(null!==a.additions||null!==a.deletions)&&(0,d.jsxs)("span",{className:"gx-counts sm",children:[(0,d.jsxs)("i",{className:"add",children:["+",a.additions??0]}),(0,d.jsxs)("i",{className:"del",children:["−",a.deletions??0]})]})]},`t-${a.path}`)),g.untracked.map(a=>(0,d.jsxs)("button",{role:"option","aria-selected":k?.path===a&&k.untracked,className:`gx-cfile ${k?.path===a&&k.untracked?"sel":""}`,onClick:()=>l({path:a,untracked:!0}),children:[(0,d.jsx)(bj,{status:"untracked"}),(0,d.jsx)("span",{className:"mono nm",children:a})]},`u-${a}`))]}):(0,d.jsx)("p",{className:"gx-note",children:e("git.loading")}),k&&(0,d.jsx)("div",{className:"gx-body",children:s?s.binary?(0,d.jsx)("p",{className:"gx-note",children:e("git.diff.binary")}):0===s.hunks.length?(0,d.jsx)("p",{className:"gx-note",children:e("git.diff.empty")}):(0,d.jsx)(bh,{parsed:s,layout:"unified",path:k.path,cutOff:!!m?.truncated}):(0,d.jsx)("p",{className:"gx-note",children:e("git.loading")})}),o&&(0,d.jsxs)(F.aF,{title:e("git.stash.drop.title"),onClose:()=>p(!1),children:[(0,d.jsx)("p",{className:"muted",style:{margin:0},children:e("git.stash.drop.body",{name:b.message||"—"})}),(0,d.jsx)("p",{className:"gx-lost",children:e("git.discard.all.warn")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:()=>p(!1),children:e("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",disabled:u,onClick:()=>{p(!1),c.run("stash",e("git.stash.dropped"),"stash-drop",{sha:b.sha})},children:e("git.stash.drop")})]})]})]})}let bv=(0,j.A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),bw=(0,j.A)("CloudDownload",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),bx=(0,j.A)("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),by=(0,j.A)("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]),bz=(0,j.A)("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);function bA({a}){let{t:b}=(0,N.s9)(),c=a.notice;return c?(0,d.jsxs)("div",{className:"gx-notice err",role:"alert",children:[(0,d.jsxs)("div",{className:"row",children:[(0,d.jsx)("b",{className:"grow",children:c.title}),(0,d.jsx)("button",{className:"btn ghost icon sm",onClick:()=>a.setNotice(null),"aria-label":b("common.close"),children:(0,d.jsx)(am.A,{size:14})})]}),(0,d.jsx)("pre",{children:c.text}),c.diverged&&(0,d.jsxs)("div",{className:"row gap-s wrap",children:[(0,d.jsx)("span",{className:"small muted",children:b("git.notice.diverged")}),(0,d.jsx)("button",{className:"btn sm",disabled:!!a.busy,onClick:()=>void a.run("pull",b("git.done.pull"),"pull",{mode:"merge"}),children:b("git.pull.merge")}),(0,d.jsx)("button",{className:"btn sm",disabled:!!a.busy,onClick:()=>void a.run("pull",b("git.done.pull"),"pull",{mode:"rebase"}),children:b("git.pull.rebase")})]})]}):null}function bB({a,ahead:b,behind:c,detached:e,changeCount:f,onCommit:g}){let{t:h}=(0,N.s9)(),i=!!a.busy;return(0,d.jsxs)("div",{className:"gx-acts",role:"group","aria-label":h("git.act.group"),children:[(0,d.jsxs)("button",{className:"btn sm",disabled:i,title:h("git.act.fetch.hint"),onClick:()=>void a.run("fetch",h("git.done.fetch"),"fetch"),children:["fetch"===a.busy?(0,d.jsx)(bv,{size:14,className:"spin"}):(0,d.jsx)(bw,{size:14}),h("git.act.fetch")]}),(0,d.jsxs)("button",{className:"btn sm",disabled:i,title:h("git.act.pull.hint"),onClick:()=>void a.run("pull",h("git.done.pull"),"pull"),children:["pull"===a.busy?(0,d.jsx)(bv,{size:14,className:"spin"}):(0,d.jsx)(bx,{size:14}),h("git.act.pull"),c>0&&(0,d.jsx)("span",{className:"ct",children:c})]}),(0,d.jsxs)("button",{className:"btn sm",disabled:i||e,title:h("git.act.push.hint"),onClick:()=>void a.run("push",h("git.done.push"),"push"),children:["push"===a.busy?(0,d.jsx)(bv,{size:14,className:"spin"}):(0,d.jsx)(D,{size:14}),h("git.act.push"),b>0&&(0,d.jsx)("span",{className:"ct",children:b})]}),(0,d.jsxs)("button",{className:"btn sm primary",disabled:i||0===f,title:0===f?h("git.commit.nothing"):void 0,onClick:g,children:["commit"===a.busy?(0,d.jsx)(bv,{size:14,className:"spin"}):(0,d.jsx)(by,{size:14}),h("git.act.commit"),f>0&&(0,d.jsx)("span",{className:"ct",children:f})]})]})}function bC({agent:a,a:b,current:c,onSwitch:e}){let{t:g}=(0,N.s9)(),[h,i]=(0,f.useState)(!1),[j,k]=(0,f.useState)(null),[l,m]=(0,f.useState)(""),[n,o]=(0,f.useState)(""),[p,q]=(0,f.useState)(null),[r,s]=(0,f.useState)(""),u=(0,f.useRef)(null);(0,a8.s)(h,u,()=>i(!1));let v=(0,f.useMemo)(()=>(j?.local??[]).filter(a=>a.name.toLowerCase().includes(l.toLowerCase())),[j,l]),w=(0,f.useMemo)(()=>{let a=new Set((j?.local??[]).map(a=>a.name));return(j?.remote??[]).filter(b=>!a.has(b.name.split("/").slice(1).join("/"))&&b.name.toLowerCase().includes(l.toLowerCase()))},[j,l]),x=async(a,c,d,e)=>{i(!1),await b.run(a,c,d,e)},y=/^[\w./-]+$/.test(n)&&!n.startsWith("-")&&!n.endsWith("/")&&!n.includes("..");return(0,d.jsxs)("div",{className:"gx-brmenu",ref:u,children:[(0,d.jsxs)("button",{type:"button",className:"btn sm","aria-expanded":h,"aria-haspopup":"menu",onClick:()=>i(a=>!a),children:[(0,d.jsx)(aq,{size:14}),g("git.act.branches"),(0,d.jsx)(Z,{size:13})]}),h&&(0,d.jsxs)("div",{className:"gx-pop",role:"menu",children:[(0,d.jsxs)("div",{className:"search",children:[(0,d.jsx)(ac.A,{size:14}),(0,d.jsx)("input",{className:"input",autoFocus:!0,placeholder:g("git.br.search"),value:l,onChange:a=>m(a.target.value),"aria-label":g("git.br.search")})]}),(0,d.jsxs)("div",{className:"gx-newbr",children:[(0,d.jsx)("input",{className:"input mono",placeholder:g("git.br.newPlaceholder"),value:n,onChange:a=>o(a.target.value.trim()),"aria-label":g("git.br.new",{branch:c??""}),onKeyDown:a=>{"Enter"===a.key&&y&&x("switch",g("git.done.switch",{branch:n}),"switch",{branch:n,create:!0})}}),(0,d.jsxs)("button",{className:"btn sm",disabled:!y||!!b.busy,title:g("git.br.new",{branch:c??"…"}),onClick:()=>void x("switch",g("git.done.switch",{branch:n}),"switch",{branch:n,create:!0}),children:[(0,d.jsx)(ab.A,{size:14}),g("git.br.create")]})]}),r&&(0,d.jsx)("p",{className:"gx-note err",children:r}),(0,d.jsxs)("div",{className:"gx-brlist",children:[v.length>0&&(0,d.jsx)("div",{className:"gx-brhead",children:g("git.br.local")}),v.map(a=>(0,d.jsxs)("div",{className:`gx-br ${a.name===c?"cur":""}`,children:[(0,d.jsxs)("button",{className:"grow",disabled:a.name===c||!!b.busy,onClick:()=>{i(!1),e(a.name)},title:g("git.br.switchTo",{branch:a.name}),children:[(0,d.jsxs)("span",{className:"nm",children:[a.name===c&&(0,d.jsx)(a7.A,{size:13}),a.name]}),(0,d.jsxs)("span",{className:"sub",children:[a.subject," \xb7 ",(0,t.KN)(Date.parse(a.date))]})]}),a.name!==c&&(0,d.jsx)("button",{className:"btn ghost icon sm",disabled:!!b.busy,onClick:()=>q(a.name),"aria-label":g("git.br.merge",{branch:c??""}),title:g("git.br.merge",{branch:c??""}),children:(0,d.jsx)(bz,{size:14})})]},a.name)),w.length>0&&(0,d.jsx)("div",{className:"gx-brhead",children:g("git.br.remote")}),w.map(a=>(0,d.jsxs)("div",{className:"gx-br",children:[(0,d.jsxs)("button",{className:"grow",disabled:!!b.busy,onClick:()=>{let b=a.name.split("/").slice(1).join("/");i(!1),e(b)},title:g("git.br.switchTo",{branch:a.name}),children:[(0,d.jsx)("span",{className:"nm",children:a.name}),(0,d.jsxs)("span",{className:"sub",children:[a.subject," \xb7 ",(0,t.KN)(Date.parse(a.date))]})]}),(0,d.jsx)("button",{className:"btn ghost icon sm",disabled:!!b.busy,onClick:()=>q(a.name),"aria-label":g("git.br.merge",{branch:c??""}),title:g("git.br.merge",{branch:c??""}),children:(0,d.jsx)(bz,{size:14})})]},a.name)),j&&!v.length&&!w.length&&(0,d.jsx)("p",{className:"gx-note",children:g("git.br.none")})]}),p&&(0,d.jsxs)("div",{className:"gx-mergeask",children:[(0,d.jsx)("span",{children:g("git.br.mergeAsk",{from:p,into:c??""})}),(0,d.jsxs)("div",{className:"row gap-s",children:[(0,d.jsx)("button",{className:"btn ghost sm",onClick:()=>q(null),children:g("common.cancel")}),(0,d.jsx)("button",{className:"btn primary sm",disabled:!!b.busy,onClick:()=>void x("merge",g("git.done.merge",{branch:p}),"merge",{branch:p}),children:g("git.br.mergeGo")})]})]})]})]})}function bD({changes:a,a:b,onClose:c,initialMessage:e=""}){let{t:g}=(0,N.s9)(),[h,i]=(0,f.useState)(()=>new Set(a.map(a=>a.path))),[j,k]=(0,f.useState)(e),l=a.filter(a=>h.has(a.path)),m=l.flatMap(a=>a.oldPath?[a.path,a.oldPath]:[a.path]),n=!!j.trim()&&l.length>0&&!b.busy,o=async a=>{if(!await b.run("commit",g("git.done.commit"),"commit",{message:j,paths:m}))return void c();c(),a&&await b.run("push",g("git.done.push"),"push")};return(0,d.jsxs)(F.aF,{title:g("git.commit.title"),onClose:c,children:[(0,d.jsxs)("div",{className:"gx-cfiles",children:[(0,d.jsxs)("div",{className:"row",children:[(0,d.jsx)("span",{className:"small muted grow",children:g("git.commit.selected",{n:l.length,total:a.length})}),(0,d.jsx)("button",{className:"btn ghost sm",onClick:()=>i(new Set(a.map(a=>a.path))),children:g("git.commit.all")}),(0,d.jsx)("button",{className:"btn ghost sm",onClick:()=>i(new Set),children:g("git.commit.none")})]}),(0,d.jsx)("div",{className:"gx-clist",children:a.map(a=>(0,d.jsxs)("label",{className:"gx-crow",title:a.path,children:[(0,d.jsx)("input",{type:"checkbox",checked:h.has(a.path),onChange:()=>{let b;return b=a.path,i(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})}}),(0,d.jsx)(bj,{status:a.status}),(0,d.jsx)("span",{className:"mono nm",children:a.path}),(null!==a.additions||null!==a.deletions)&&(0,d.jsxs)("span",{className:"gx-counts sm",children:[(0,d.jsxs)("i",{className:"add",children:["+",a.additions??0]}),(0,d.jsxs)("i",{className:"del",children:["−",a.deletions??0]})]})]},a.path))})]}),(0,d.jsxs)("div",{className:"field",children:[(0,d.jsx)("label",{children:g("git.commit.message")}),(0,d.jsx)("textarea",{className:"textarea",rows:4,autoFocus:!0,value:j,onChange:a=>k(a.target.value),placeholder:g("git.commit.placeholder"),onKeyDown:a=>{(a.ctrlKey||a.metaKey)&&"Enter"===a.key&&n&&o(!1)}}),(0,d.jsx)("span",{className:"hint",children:g("git.commit.hint")})]}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:c,children:g("common.cancel")}),(0,d.jsx)("button",{className:"btn",disabled:!n,onClick:()=>void o(!1),children:"commit"===b.busy?g("git.commit.committing"):g("git.commit.go")}),(0,d.jsx)("button",{className:"btn primary",disabled:!n,onClick:()=>void o(!0),children:g("git.commit.goPush")})]})]})}function bE({agent:a,head:b,sel:c,onSelect:e}){let{t:g}=(0,N.s9)(),[h,i]=(0,f.useState)(null),[j,k]=(0,f.useState)(!1),[l,m]=(0,f.useState)(!1),[n,o]=(0,f.useState)(""),p=async b=>{m(!0);try{let c=await s.F.get(`/agents/${a.id}/git/log?skip=${b}`);i(a=>0===b?c.commits:[...a??[],...c.commits]),k(c.hasMore),o("")}catch(a){o(a instanceof Error?a.message:"error")}finally{m(!1)}};return n?(0,d.jsx)("p",{className:"gx-note err",children:n}):h?h.length?(0,d.jsxs)("div",{className:"gx-hist",role:"listbox","aria-label":g("git.tab.history"),children:[h.map(a=>(0,d.jsxs)("button",{role:"option","aria-selected":c===a.sha,className:`gx-commit ${c===a.sha?"sel":""}`,onClick:()=>e(a.sha),children:[(0,d.jsx)("span",{className:"subj",children:a.subject||"—"}),(0,d.jsxs)("span",{className:"meta",children:[(0,d.jsx)("span",{className:"mono sha",children:a.short})," \xb7 ",a.author," \xb7 ",(0,t.KN)(Date.parse(a.date))]}),(a.refs.length>0||a.merge)&&(0,d.jsxs)("span",{className:"refs",children:[a.merge&&(0,d.jsx)("i",{className:"ref",children:g("git.hist.merge")}),a.refs.slice(0,3).map(a=>(0,d.jsx)("i",{className:"ref",children:a},a))]})]},a.sha)),j&&(0,d.jsx)("button",{className:"btn sm",style:{margin:10},disabled:l,onClick:()=>void p(h.length),children:l?g("git.loading"):g("git.hist.more")})]}):(0,d.jsx)("p",{className:"gx-note",children:g("git.hist.empty")}):(0,d.jsx)("p",{className:"gx-note",children:g("git.loading")})}function bF({files:a,all:b,summary:c,file:e,busy:f,onConfirm:g,onClose:h}){let{t:i}=(0,N.s9)(),j=(0,d.jsxs)("ul",{className:"gx-dlist",children:[a.slice(0,8).map(a=>(0,d.jsx)("li",{className:"mono",children:a},a)),a.length>8&&(0,d.jsx)("li",{className:"muted",children:i("hover.more",{count:a.length-8})})]});if(!b&&e&&!a.length){let a=e.add||e.del?` (+${e.add} −${e.del})`:"";return(0,d.jsxs)(F.aF,{title:i("git.discard.file.title"),onClose:h,children:[(0,d.jsx)("p",{className:"gx-file-eff mono",children:e.path}),(0,d.jsx)("p",{style:{margin:0},children:"deleted"===e.status?i("git.discard.file.deleted"):"renamed"===e.status?i("git.discard.file.renamed",{from:e.oldPath??""}):i("git.discard.file.modified",{lines:a})}),(0,d.jsx)("p",{className:"gx-lost",children:i("git.discard.all.warn")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:h,children:i("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",disabled:f,onClick:g,children:i("git.discard.file.go")})]})]})}return b?(0,d.jsxs)(F.aF,{title:i("git.discard.all.title"),onClose:h,children:[(0,d.jsxs)("ul",{className:"gx-effects",children:[c&&c.restore>0&&(0,d.jsx)("li",{children:i("git.discard.all.restore",{count:c.restore})}),a.length>0&&(0,d.jsxs)("li",{className:"bad",children:[(0,d.jsx)("b",{children:i("git.discard.all.delete",{count:a.length})}),j]})]}),c&&(0,d.jsx)("p",{className:"muted small",style:{margin:0},children:i("git.discard.all.lines",{add:c.add,del:c.del})}),(0,d.jsx)("p",{className:"gx-lost",children:i("git.discard.all.warn")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:h,children:i("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",disabled:f,onClick:g,children:i("git.discard.all.go")})]})]}):(0,d.jsxs)(F.aF,{title:i("git.discard.confirm.title"),onClose:h,children:[(0,d.jsx)("p",{className:"muted",style:{margin:0},children:i("git.discard.confirm.body",{count:a.length})}),j,(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:h,children:i("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",disabled:f,onClick:g,children:i("git.discard.confirm.go")})]})]})}let bG=/\.(png|jpe?g|gif|webp|svg|ico|bmp|avif)$/i;function bH({name:a}){return bG.test(a)?(0,d.jsx)(ah,{size:15}):/\.(md|mdx|txt|rst)$/i.test(a)?(0,d.jsx)(ai.A,{size:15}):aW(a)?(0,d.jsx)(aj,{size:15}):(0,d.jsx)(ak,{size:15})}function bI({path:a,hunk:b,index:c,total:e,extent:g,onClose:h,onGo:i}){let{t:j}=(0,N.s9)(),k=(0,f.useMemo)(()=>({meta:[],hunks:[b],binary:!1}),[b]),l=b.lines.length+1;return(0,d.jsxs)("div",{className:"vl-peek",role:"dialog","aria-label":j("git.peek.title"),onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"vl-peek-head",children:[(0,d.jsx)("b",{children:g?g.from===g.to?j("git.peek.line",{n:g.from}):j("git.peek.lines",{from:g.from,to:g.to}):j("git.peek.title")}),(0,d.jsx)("span",{className:"muted mono small grow",children:at(b.header)}),(0,d.jsx)("span",{className:"small muted",children:j("git.peek.count",{n:c+1,total:e})}),(0,d.jsx)("button",{type:"button",className:"btn ghost icon sm",disabled:c<=0,onClick:()=>i(c-1),"aria-label":j("git.peek.prev"),title:`${j("git.peek.prev")} (Alt+↑)`,children:(0,d.jsx)(al,{size:15})}),(0,d.jsx)("button",{type:"button",className:"btn ghost icon sm",disabled:c>=e-1,onClick:()=>i(c+1),"aria-label":j("git.peek.next"),title:`${j("git.peek.next")} (Alt+↓)`,children:(0,d.jsx)(Z,{size:15})}),(0,d.jsx)("button",{type:"button",className:"btn ghost icon sm",onClick:h,"aria-label":j("common.close"),children:(0,d.jsx)(am.A,{size:14})})]}),(0,d.jsx)("div",{className:"vl-peek-body",style:{height:Math.min(20*l+4,260)},children:(0,d.jsx)(bh,{parsed:k,layout:"unified",path:a,firstIndex:c})})]})}function bJ({f:a,agent:b,blame:c,onOpenCommit:e,marks:g,allNew:h}){let i=g?.groups??[],[j,k]=(0,f.useState)(null),l=(0,f.useMemo)(()=>{let b=a.content.split("\n").length;return i.map(a=>({from:Math.min(a.from,b),to:Math.min(a.to,b)}))},[i,a.content]),m=j?l[j.block]??null:null,[n,o]=(0,f.useState)(),p=(b,c)=>{let d={from:b.from,to:Math.min(b.to,a.content.split("\n").length)};return(d.to-(c+1)<=25?Math.max(d.to,c+1):c+1)*20},q=a=>34+Math.min((a.view.lines.length+1)*20+4,260)+14,{t:r}=(0,N.s9)(),{whitespace:s}=a5(),[u,v]=(0,f.useState)(null),[w,x]=(0,f.useState)(null),y=a$(a.content,a.path),z=(0,f.useMemo)(()=>y.length&&""===y[y.length-1]?y.slice(0,-1):y,[y]),A=(0,f.useMemo)(()=>a.content.split("\n").reduce((a,b)=>Math.max(a,b.length),0),[a.content]),B=(0,f.useMemo)(()=>{if(!u)return null;let a=-1;return u.lines.map((b,c)=>{let d=b!==u.lines[c-1];return d&&a++,{first:d,g:a%2}})},[u]);if(a.binary)return(0,d.jsx)("p",{className:"gx-note",children:r("git.file.binary")});if(0===z.length)return(0,d.jsx)("p",{className:"gx-note",children:r("git.file.empty")});let C=210*!!u;return(0,d.jsxs)("div",{className:"vf",children:["head"===a.source&&(0,d.jsx)("div",{className:"gx-banner",children:r("git.file.deleted")}),a.truncated&&(0,d.jsx)("div",{className:"gx-banner",children:r("git.file.truncated")}),w&&(0,d.jsx)("div",{className:"gx-banner",children:w}),u?.truncated&&(0,d.jsx)("div",{className:"gx-banner",children:r("git.blame.truncated",{count:u.lines.length})}),(0,d.jsx)("div",{className:"vf-main",style:{"--vl-left":`${C}px`},children:(0,d.jsx)(bf,{count:z.length,width:`calc(${C}px + 6ch + ${A}ch + 40px)`,overlay:j&&i[j.block]?{top:p(i[j.block],j.row),node:(0,d.jsx)(bI,{path:a.path,hunk:i[j.block].view,index:j.block,extent:m,onClose:()=>k(null),total:i.length,onGo:a=>{let b=l[a];if(!b)return;let c=Math.max(0,b.from-1);k({row:c,block:a}),o({top:20*c,bottom:p(i[a],c)+q(i[a]),key:Date.now()})}})}:void 0,reveal:n,render:b=>{let c=u?.lines[b],f=c?u.commits[c]:void 0,l=B?.[b],n="worktree"===a.source?h?"add":g?.lines.get(b+1):void 0,v=!!g&&g.removedBefore.has(b+1),w=!!g&&b===z.length-1&&g.removedBefore.has(z.length+1),x=g&&"worktree"===a.source?g.blockOfLine.get(b+1)??(v?g.blockOfRemoval.get(b+1):w?g.blockOfRemoval.get(z.length+1):void 0):void 0;return(0,d.jsxs)("div",{className:`vl-row ${l?`bl-g${l.g}`:""} ${n?`m-${n}`:""} ${v?"m-delb":w?"m-dela":""} ${void 0!==x?"has-peek":""} ${m&&b+1>=m.from&&b+1<=m.to?"in-peek":""}`,onClick:void 0!==x?a=>{if(!a.target.closest(".bl-btn")&&(a.target.closest(".vl-ln")||window.getSelection()?.isCollapsed)){if(j?.row===b)return void k(null);k({row:b,block:x}),o({top:20*b,bottom:p(i[x],b)+q(i[x]),key:Date.now()})}}:void 0,title:void 0!==x?r("git.peek.hint"):void 0,children:[u&&(0,d.jsx)("div",{className:`vl-bl ${l?.first?"first":""}`,children:l?.first&&f&&(f.uncommitted?(0,d.jsx)("span",{className:"muted",children:r("git.blame.uncommitted")}):(0,d.jsxs)("button",{type:"button",className:"bl-btn",title:`${f.summary}
|
|
4
|
-
${f.author} \xb7 ${(0,P.v7)(f.time)}`,onClick:()=>e(c),children:[(0,d.jsx)("span",{className:"mono sha",children:f.short}),(0,d.jsx)("span",{className:"who",children:f.author}),(0,d.jsx)("span",{className:"when",children:(0,t.KN)(f.time)})]}))}),(0,d.jsx)("div",{className:"vl-ln",children:b+1}),(0,d.jsx)("div",{className:"vl-cd",children:(0,d.jsx)(bb,{html:z[b],ws:s})})]},b)}})})]})}function bK({agent:a,path:b,ignored:c=!1,change:e,stamp:g,onOpenCommit:h,onDiscard:i,onDiscardHunk:j,onDiscardLines:k}){let{t:l}=(0,N.s9)(),[m,n]=(0,f.useState)(!1),o=!!e&&!bG.test(b),[p,q]=(0,f.useState)(o?"diff":"file"),[r,s]=(0,f.useState)("unified"),[t,u]=(0,f.useState)(null),[v,w]=(0,f.useState)(null),[x,y]=(0,f.useState)(null),[z,A]=(0,f.useState)(!1),[B,C]=(0,f.useState)(!1),D=bG.test(b),E=(0,f.useMemo)(()=>t&&t.path===b?as(t.diff):null,[t,b]),[H,I]=(0,f.useState)(null),J=e?.status==="untracked"||e?.status==="added"&&!e.oldPath,K=(0,f.useMemo)(()=>H&&H.path===b?as(H.diff):null,[H,b]),L=(0,f.useMemo)(()=>K?function(a){let b=new Map,c=new Set,d=new Map,e=new Map,f=[];for(let g of a.hunks){let a=g.lines,h=[],i=Number(/\+(\d+)/.exec(g.header)?.[1]??1);for(let b=0;b<a.length;b++)h[b]=i,"del"!==a[b].kind&&(i=(a[b].newNo??i)+1);let j=[];for(let b=0;b<a.length;){if("ctx"===a[b].kind){b++;continue}let c=b;for(;b<a.length&&"ctx"!==a[b].kind;)b++;j.push([c,b-1])}for(let[g,k]of j){let j=f.length,l=1/0,m=-1/0;for(let f=g;f<=k;){if("ctx"===a[f].kind){f++;continue}let g=[],n=[];for(;f<=k&&"del"===a[f].kind;)g.push(a[f++]);for(;f<=k&&"add"===a[f].kind;)n.push(a[f++]);n.forEach((a,c)=>{let e=a.newNo;b.set(e,c<g.length?"mod":"add"),d.set(e,j),l=Math.min(l,e),m=Math.max(m,e)});let o=n.length?n[n.length-1].newNo+1:f<a.length?h[f]:i;g.length>n.length&&(c.add(o),e.set(o,j),l=Math.min(l,o),m=Math.max(m,o))}let n=g;for(let b=0;b<3&&n>0&&"ctx"===a[n-1].kind;b++)n--;let o=k;for(let b=0;b<3&&o<a.length-1&&"ctx"===a[o+1].kind;b++)o++;let p=a.slice(n,o+1),q=p.filter(a=>void 0!==a.oldNo),r=p.filter(a=>void 0!==a.newNo);f.push({from:l,to:m,view:{header:`@@ -${q[0]?.oldNo??0},${q.length} +${r[0]?.newNo??0},${r.length} @@`,section:"",lines:p}})}}return{lines:b,removedBefore:c,blockOfLine:d,blockOfRemoval:e,groups:f}}(K):null,[K]),M=b.lastIndexOf("/"),O=M>=0?b.slice(0,M+1):"",Q=b.slice(M+1);return(0,d.jsxs)("section",{className:"gx-preview","aria-label":b,children:[(0,d.jsxs)("header",{className:"gx-phead",children:[(0,d.jsxs)("div",{className:"gx-ptitle",children:[(0,d.jsxs)("span",{className:"gx-path mono",title:b,children:[(0,d.jsx)("span",{className:"dir",children:O}),(0,d.jsx)("b",{children:Q})]}),c&&(0,d.jsx)("span",{className:"gx-chip soft",title:l("git.ignored.hint"),children:l("git.ignored.chip")}),e&&(0,d.jsx)("span",{className:`gx-chip st-${e.status}`,children:l(`git.status.${e.status}`)}),e?.staged&&(0,d.jsx)("span",{className:"gx-chip soft",children:l("git.staged")}),e?.unstaged&&"untracked"!==e.status&&(0,d.jsx)("span",{className:"gx-chip soft",children:l("git.unstaged")}),e&&(null!==e.additions||null!==e.deletions)&&(0,d.jsxs)("span",{className:"gx-counts",children:[(0,d.jsxs)("i",{className:"add",children:["+",e.additions??0]}),(0,d.jsxs)("i",{className:"del",children:["−",e.deletions??0]})]}),v&&!e&&(0,d.jsx)("span",{className:"muted small",children:(0,P.zi)(v.size)})]}),(0,d.jsxs)("div",{className:"gx-ptools",children:[e&&(0,d.jsx)(F.$q,{value:p,onChange:q,options:[{id:"diff",label:l("git.view.diff")},{id:"file",label:l("git.view.file")}]}),"diff"===p&&e&&(0,d.jsx)(F.$q,{value:r,onChange:s,options:[{id:"unified",label:l("git.layout.unified")},{id:"split",label:l("git.layout.split")}]}),!D&&!c&&e?.status!=="deleted"&&e?.status!=="untracked"&&e?.status!=="conflict"&&(()=>{let a=m&&"file"===p;return(0,d.jsx)("button",{type:"button",className:`btn sm ${a?"primary":""}`,"aria-pressed":a,title:l("git.blame.hint"),onClick:()=>{"file"!==p?(q("file"),n(!0)):n(a=>!a)},children:l("git.blame")})})(),e&&"conflict"!==e.status&&(0,d.jsxs)("button",{type:"button",className:"btn sm",title:l("git.discard.hint"),onClick:()=>i(e),children:[(0,d.jsx)(an,{size:14}),l("git.discard")]}),(0,d.jsx)(G.WQ,{text:b,label:l("git.copyPath")})]})]}),e?.oldPath&&(0,d.jsx)("div",{className:"gx-banner",children:l("git.renamedFrom",{path:e.oldPath})}),(0,d.jsx)("div",{className:"gx-body",children:x?(0,d.jsx)("p",{className:"gx-note err",children:x}):!z||E||v?"diff"===p&&e?E?E.binary?(0,d.jsx)("p",{className:"gx-note",children:l("git.diff.binary")}):0===E.hunks.length?(0,d.jsx)("p",{className:"gx-note",children:l("git.diff.empty")}):(0,d.jsxs)(d.Fragment,{children:[t?.truncated&&(0,d.jsx)("div",{className:"gx-banner",children:l("git.diff.truncated")}),(0,d.jsx)(bh,{parsed:E,layout:r,path:b,cutOff:!!t?.truncated,onDiscardHunk:e?.status==="modified"?(a,c)=>j(b,a,c):void 0,onDiscardLines:e?.status==="modified"?(a,c,d)=>k(b,a,c,d):void 0})]}):null:D&&!B&&e?.status!=="deleted"?(0,d.jsx)("div",{className:"gx-image",children:(0,d.jsx)("img",{src:`/api/agents/${a.id}/git/raw?path=${encodeURIComponent(b)}&v=${g}`,alt:Q,onError:()=>C(!0)})}):v&&v.path===b?(0,d.jsx)(bJ,{f:v,agent:a,blame:m,onOpenCommit:h,marks:L,allNew:J}):D&&B?(0,d.jsx)("p",{className:"gx-note",children:l("git.file.binary")}):null:(0,d.jsx)("p",{className:"gx-note",children:l("git.loading")})})]})}function bL({agent:a,git:b}){let{t:c}=(0,N.s9)(),{status:e,tree:g,loading:h,error:i,refresh:j}=b,[k,l]=(0,f.useState)(null),[m,n]=(0,f.useState)(new Set),[o,p]=(0,f.useState)(""),[q,r]=(0,f.useState)(!1),[u,v]=(0,f.useState)(!1),[w,x]=(0,f.useState)("files"),[y,z]=(0,f.useState)(null),[A,C]=(0,f.useState)(null),[D,E]=(0,f.useState)(!1),[H,I]=(0,f.useState)(null),[J,K]=(0,f.useState)(!1),[L,M]=(0,f.useState)(null),[O,Q]=(0,f.useState)(!1),R=function(a,b){let{t:c}=(0,N.s9)(),d=(0,F.dj)(),[e,g]=(0,f.useState)(null),[h,i]=(0,f.useState)(null),j=async(e,f,h,j={})=>{g(e),i(null);try{let e=await s.F.post(`/agents/${a.id}/git/${h}`,j),g=(e.output??"").split("\n").filter(Boolean).pop()??"",i=["conflicts"===e.pending?c("git.pending.conflicts"):"",e.kept?.length?c("git.sw.kept",{count:e.kept.length,names:e.kept.slice(0,3).join(", ")}):""].filter(Boolean).join(" — ");return d(i?`${f} — ${i}`:g&&g.length<90?`${f} — ${g}`:f),await b(),!0}catch(d){let a=d instanceof Error?d.message:"error";return i({title:c("git.notice.failed",{action:f}),text:a,diverged:/fast-forward|divergent/i.test(a)}),await b(),!1}finally{g(null)}};return{busy:e,notice:h,setNotice:i,run:j}}(a,()=>j()),[S,T]=(0,f.useState)(null),U=a5();(0,f.useRef)(new Set);let V=(0,f.useRef)(null),W=e&&e.isRepo?e:null,X=g&&g.isRepo?g.files:null,Y=g&&g.isRepo?g.ignored:null,[$,_]=(0,f.useState)({}),aa=(0,f.useMemo)(()=>W&&X?function(a,b,c=[],d={}){let e=new Map(b.map(a=>[a.path,a])),f=new Set(a);for(let a of b)f.add(a.path);let g={name:"",path:"",type:"dir",children:[],changed:0,additions:0,deletions:0},h=new Map([["",g]]),i=a=>{let b=h.get(a);if(b)return b;let c=a.lastIndexOf("/"),d=i(c<0?"":a.slice(0,c)),e={name:a.slice(c+1),path:a,type:"dir",children:[],changed:0,additions:0,deletions:0};return d.children.push(e),h.set(a,e),e};for(let a of f){let b=a.lastIndexOf("/");i(b<0?"":a.slice(0,b)).children.push({name:a.slice(b+1),path:a,type:"file",children:[],change:e.get(a),changed:+!!e.has(a),additions:e.get(a)?.additions??0,deletions:e.get(a)?.deletions??0})}let j=(a,b,c)=>{if(a.children.some(a=>a.path===b))return;let e={name:b.slice(b.lastIndexOf("/")+1),path:b,type:c?"dir":"file",children:[],ignored:!0,lazy:c&&!(b in d),changed:0,additions:0,deletions:0};if(a.children.push(e),c&&h.set(b,e),c)for(let a of d[b]??[])j(e,`${b}/${a.name}`,a.dir)};for(let a of c){let b=a.endsWith("/"),c=b?a.slice(0,-1):a,d=c.lastIndexOf("/");j(i(d<0?"":c.slice(0,d)),c,b)}let k=a=>{for(let b of(a.children.sort((a,b)=>a.type===b.type?a.name.localeCompare(b.name):"dir"===a.type?-1:1),a.children))"dir"===b.type&&k(b),a.changed+=(b.type,b.changed),a.additions+=b.additions,a.deletions+=b.deletions;a.children=a.children.map(a=>{let b=a;for(;"dir"===b.type&&1===b.children.length&&"dir"===b.children[0].type;){let a=b.children[0];b={...a,name:`${b.name}/${a.name}`}}return b})};return k(g),g}(X,W.changes,U.showIgnored?Y??[]:[],$):null,[W,X,Y,$,U.showIgnored]),ab=(0,f.useMemo)(()=>{let a=(Y??[]).map(a=>a.replace(/\/$/,""));return b=>a.some(a=>b===a||b.startsWith(`${a}/`))},[Y]),ad=(0,f.useMemo)(()=>new Map((W?.changes??[]).map(a=>[a.path,a])),[W]),ae=(0,f.useMemo)(()=>(W?.changes??[]).reduce((a,b)=>({add:a.add+(b.additions??0),del:a.del+(b.deletions??0)}),{add:0,del:0}),[W]),af=(0,f.useMemo)(()=>aa?function(a,b,c){let d=c.query.trim().toLowerCase(),e=a=>(!c.onlyChanged||0!==a.changed)&&(!d||("file"===a.type?a.path.toLowerCase().includes(d):a.children.some(e))),f=[],g=(a,h)=>{for(let i of a.children)e(i)&&(f.push({node:i,depth:h}),"dir"===i.type&&(d||c.onlyChanged||b.has(i.path))&&g(i,h+1))};return g(a,0),f}(aa,m,{query:o,onlyChanged:q}):[],[aa,m,o,q]),ag=af.slice(0,2e3);if(i&&!e)return(0,d.jsx)("div",{className:"gx",children:(0,d.jsxs)("div",{className:"gx-empty",children:[(0,d.jsx)("h3",{children:c("git.error.title")}),(0,d.jsx)("p",{children:i}),(0,d.jsx)("button",{className:"btn",onClick:()=>void j(),children:c("git.refresh")})]})});if(!e)return(0,d.jsx)("div",{className:"gx",children:(0,d.jsx)("div",{className:"gx-empty",children:(0,d.jsx)("p",{children:c("git.loading")})})});if(!e.isRepo)return(0,d.jsx)("div",{className:"gx",children:(0,d.jsxs)("div",{className:"gx-empty",children:[(0,d.jsx)(ao.A,{size:26,className:"muted"}),(0,d.jsx)("h3",{children:"not-repo"===e.reason?c("git.notRepo.title"):"no-git"===e.reason?c("git.noGit.title"):c("git.error.title")}),(0,d.jsx)("p",{children:"not-repo"===e.reason?c("git.notRepo.body",{path:e.cwd.replace(/^\/home\/[^/]+/,"~")}):"no-git"===e.reason?c("git.noGit.body"):e.message}),(0,d.jsxs)("button",{className:"btn",onClick:()=>void j(),children:[(0,d.jsx)(ap,{size:14}),c("git.refresh")]})]})});let ah=k?ad.get(k):void 0,ai=a=>R.run("switch",a.carried?c("git.done.switchCarried",{branch:a.to,count:a.carried}):c("git.done.switch",{branch:a.to}),a.overlap.length||a.collisions.length?"switch-smart":"switch",{branch:a.to}),aj=async b=>{try{let c=await s.F.get(`/agents/${a.id}/git/switch-plan?branch=${encodeURIComponent(b)}`);c.others.length||c.selfRunning?I(c):await ai(c)}catch(a){R.setNotice({title:c("git.notice.failed",{action:c("git.done.switch",{branch:b})}),text:a instanceof Error?a.message:"error",diverged:!1})}},ak=a=>a.filter(a=>"untracked"===a.status||"added"===a.status&&!a.oldPath).map(a=>a.path),al=new Date(e.generatedAt).toLocaleTimeString((0,N.VR)());return(0,d.jsxs)("div",{className:"gx","data-gx-theme":U.theme,style:{"--g-tab":U.tabSize},children:[(0,d.jsxs)("div",{className:"gx-bar",children:[(0,d.jsxs)("button",{type:"button",className:"gx-branch","aria-expanded":u,"aria-controls":"gx-info",title:c("git.info.toggle"),onClick:()=>v(a=>!a),children:[(0,d.jsx)(aq,{size:14}),(0,d.jsx)("span",{className:"bn",children:e.branch??(e.head?`${c("git.detached")} ${e.head.sha}`:c("git.noCommitsBranch"))}),e.head&&(0,d.jsx)("span",{className:"sha",children:e.head.sha}),e.upstream&&(e.upstream.ahead>0||e.upstream.behind>0)&&(0,d.jsxs)("span",{className:"ab",title:c("git.upstream"),children:[e.upstream.ahead>0&&`↑${e.upstream.ahead}`,e.upstream.ahead>0&&e.upstream.behind>0&&" ",e.upstream.behind>0&&`↓${e.upstream.behind}`]}),u?(0,d.jsx)(Z,{size:14}):(0,d.jsx)(B.A,{size:14})]}),(0,d.jsx)("span",{className:"grow"}),(0,d.jsx)("span",{className:"gx-sum",children:0===e.changes.length?(0,d.jsx)("span",{className:"muted",children:c("git.clean")}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("b",{children:c("git.summary",{count:e.changes.length})})," ",(0,d.jsxs)("i",{className:"add",children:["+",(0,P._E)(ae.add)]})," ",(0,d.jsxs)("i",{className:"del",children:["−",(0,P._E)(ae.del)]})]})}),(0,d.jsx)(bC,{agent:a,a:R,current:e.branch,onSwitch:a=>void aj(a)}),(0,d.jsx)(bB,{a:R,ahead:e.upstream?.ahead??0,behind:e.upstream?.behind??0,detached:!e.branch,changeCount:e.changes.length,onCommit:()=>Q(!0)}),(0,d.jsx)("button",{className:"btn ghost icon sm",disabled:!!R.busy||0===e.changes.length||!!e.state,onClick:()=>{let a=ak(e.changes);T({files:a,all:!0,summary:{restore:e.changes.length-a.length,add:ae.add,del:ae.del},go:async()=>{let a=await R.run("discard-all",c("git.done.discard"),"discard-all");return a&&l(null),a}})},"aria-label":c("git.discard.all"),title:e.state?c("git.discard.all.blocked"):c("git.discard.all"),children:(0,d.jsx)(an,{size:15})}),(0,d.jsx)(a9,{}),(0,d.jsx)("button",{className:"btn ghost icon sm",onClick:()=>void j(),"aria-label":c("git.refresh"),title:`${c("git.refresh")} \xb7 ${c("git.updated",{time:al})}`,children:(0,d.jsx)(ap,{size:15,className:h?"spin":""})})]}),u&&(0,d.jsxs)("dl",{id:"gx-info",className:"gx-info",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.branch")}),(0,d.jsxs)("dd",{className:"mono",children:[e.branch??(e.head?`${c("git.detached")} ${e.head.sha}`:c("git.noCommitsBranch")),e.branch&&(0,d.jsx)(G.WQ,{text:e.branch,label:c("git.info.copyBranch")})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.upstreamLabel")}),(0,d.jsx)("dd",{children:e.upstream?0===e.upstream.ahead&&0===e.upstream.behind?c("git.info.inSync"):c("git.info.upstreamStatus",{ahead:e.upstream.ahead,behind:e.upstream.behind}):(0,d.jsx)("span",{className:"muted",children:c("git.info.noUpstream")})})]}),e.head?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.commit")}),(0,d.jsxs)("dd",{className:"mono",children:[e.head.sha,(0,d.jsx)(G.WQ,{text:e.head.sha,label:c("git.info.copySha")})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.message")}),(0,d.jsx)("dd",{className:"msg",children:e.head.subject||(0,d.jsx)("span",{className:"muted",children:"—"})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.author")}),(0,d.jsx)("dd",{children:e.head.author})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.when")}),(0,d.jsxs)("dd",{children:[(0,P.v7)(e.head.when)," ",(0,d.jsxs)("span",{className:"muted",children:["\xb7 ",(0,t.KN)(Date.parse(e.head.when))]})]})]})]}):(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.commit")}),(0,d.jsx)("dd",{className:"muted",children:c("git.noCommits")})]})]}),"running"===a.status&&(0,d.jsx)("div",{className:"gx-warn",children:c("git.warn.running",{name:a.name})}),e.state&&(()=>{let a=e.changes.filter(a=>"conflict"===a.status),b="merge"===e.state?c("git.state.merge"):"rebase"===e.state?c("git.state.rebase"):c("git.state.stash");return(0,d.jsxs)("div",{className:"gx-state",role:"status",children:[(0,d.jsx)("b",{children:b}),(0,d.jsxs)("span",{className:"grow",children:["stash"===e.state&&e.stash&&(0,d.jsxs)(d.Fragment,{children:[c("git.state.stash.hint",{from:e.stash.from,to:e.stash.to})," \xb7 "]}),a.length>0?c("git.state.conflicts",{count:a.length}):c("git.state.ready")]}),0===a.length&&("merge"===e.state?(0,d.jsx)("button",{className:"btn primary sm",disabled:!!R.busy,onClick:()=>Q(!0),children:c("git.state.finishMerge")}):"rebase"===e.state?(0,d.jsx)("button",{className:"btn primary sm",disabled:!!R.busy,onClick:()=>void R.run("continue",c("git.done.rebaseContinue"),"rebase-continue"),children:c("git.state.continueRebase")}):(0,d.jsx)("button",{className:"btn primary sm",disabled:!!R.busy,onClick:()=>void R.run("smart",c("git.done.smartFinish"),"smart-finish"),children:c("git.state.finishStash")})),"stash"===e.state?(0,d.jsx)("button",{className:"btn sm danger",disabled:!!R.busy,onClick:()=>K(!0),children:c("git.state.cancelStash")}):(0,d.jsx)("button",{className:"btn sm danger",disabled:!!R.busy,onClick:()=>void R.run("abort",c("git.done.mergeAbort"),"merge-abort"),children:"merge"===e.state?c("git.state.abortMerge"):c("git.state.abortRebase")})]})})(),(0,d.jsx)(bA,{a:R}),e.scope&&(0,d.jsx)("div",{className:"gx-scope",children:c("git.scope",{path:e.scope})}),(0,d.jsxs)("div",{className:"gx-main",children:[(0,d.jsxs)("aside",{className:"gx-tree","aria-label":c("git.filesLabel"),children:[(0,d.jsx)("div",{className:"gx-tabs",children:(0,d.jsx)(F.$q,{value:w,onChange:x,options:[{id:"files",label:c("git.tab.files")},{id:"history",label:c("git.tab.history")},{id:"stashes",label:`${c("git.tab.stashes")}${y?.length?` \xb7 ${y.length}`:""}`}]})}),"stashes"===w?(0,d.jsx)(bs,{stashes:y,sel:A,onSelect:C,onSave:()=>E(!0),canSave:e.changes.length>0&&!e.state}):"history"===w?(0,d.jsx)(bE,{agent:a,head:e.head?.sha,sel:L,onSelect:M}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"gx-filter",children:[(0,d.jsxs)("div",{className:"search",children:[(0,d.jsx)(ac.A,{size:14}),(0,d.jsx)("input",{className:"input",placeholder:c("git.filterPlaceholder"),value:o,onChange:a=>p(a.target.value),"aria-label":c("git.filterPlaceholder")})]}),(0,d.jsx)(F.$q,{value:q?"changed":"all",onChange:a=>r("changed"===a),options:[{id:"all",label:c("git.filter.all")},{id:"changed",label:`${c("git.filter.changed")}${e.changes.length?` \xb7 ${e.changes.length}`:""}`}]})]}),(0,d.jsxs)("div",{className:"gx-list",ref:V,onKeyDown:a=>{let b=[...V.current?.querySelectorAll("[data-row]")??[]],c=b.indexOf(document.activeElement);if("ArrowDown"===a.key)a.preventDefault(),b[Math.min(b.length-1,c+1)]?.focus();else if("ArrowUp"===a.key)a.preventDefault(),b[Math.max(0,c-1)]?.focus();else if(c>=0&&("ArrowRight"===a.key||"ArrowLeft"===a.key)){let d=b[c];if("1"!==d.dataset.dir)return;let e="true"===d.getAttribute("aria-expanded");("ArrowRight"===a.key&&!e||"ArrowLeft"===a.key&&e)&&(a.preventDefault(),d.click())}},role:"tree",children:[aa?0===ag.length?(0,d.jsx)("p",{className:"gx-note",children:o?c("git.noMatch",{query:o}):q?c("git.clean"):c("git.noFiles")}):ag.map(({node:b,depth:e})=>{let f="dir"===b.type,g=f&&(o||q||m.has(b.path)),h=b.change;return(0,d.jsxs)("button",{"data-row":!0,"data-dir":f?"1":"0","data-path":b.path,type:"button",role:"treeitem","aria-level":e+1,"aria-expanded":f?!!g:void 0,"aria-selected":!f&&k===b.path,className:`gx-row ${f?"dir":"file"} ${b.ignored?"ignored":""} ${h?`changed st-${h.status}`:""} ${!f&&k===b.path?"sel":""} ${f&&b.changed?"has-changes":""}`,style:{paddingLeft:8+14*e},title:b.ignored?`${b.path} — ${c("git.ignored.hint")}`:b.path,onClick:()=>{let c;return f?void(c=b.path,n(a=>{let b=new Set(a);return b.has(c)?b.delete(c):b.add(c),b}),b.ignored&&b.lazy&&!(b.path in $)&&s.F.get(`/agents/${a.id}/git/ls?path=${encodeURIComponent(b.path)}`).then(a=>_(c=>({...c,[b.path]:a.entries}))).catch(()=>_(a=>({...a,[b.path]:[]})))):l(b.path)},children:[(0,d.jsx)("span",{className:"chev",children:f?g?(0,d.jsx)(Z,{size:14}):(0,d.jsx)(B.A,{size:14}):null}),(0,d.jsx)("span",{className:"ico",children:f?g?(0,d.jsx)(ar,{size:15}):(0,d.jsx)(ao.A,{size:15}):(0,d.jsx)(bH,{name:b.name})}),(0,d.jsx)("span",{className:"nm",children:b.name}),f&&b.changed>0&&(0,d.jsx)("span",{className:"dirdot",title:c("git.dirChanged",{count:b.changed}),children:b.changed}),h&&(0,d.jsxs)("span",{className:"meta",children:[(null!==h.additions||null!==h.deletions)&&(0,d.jsxs)("span",{className:"gx-counts sm",children:[(0,d.jsxs)("i",{className:"add",children:["+",h.additions??0]}),(0,d.jsxs)("i",{className:"del",children:["−",h.deletions??0]})]}),(0,d.jsx)(bj,{status:h.status,titled:!0})]})]},`${b.ignored?"i:":""}${b.path}`)}):(0,d.jsx)("p",{className:"gx-note",children:c("git.loading")}),af.length>ag.length&&(0,d.jsx)("p",{className:"gx-note",children:c("git.rowsCapped",{count:ag.length})}),g?.isRepo&&g.truncated&&(0,d.jsx)("p",{className:"gx-note",children:c("git.treeTruncated",{count:g.files.length})})]})]})]}),"stashes"===w?y?.find(a=>a.sha===A)?(0,d.jsx)(bu,{agent:a,stash:y.find(a=>a.sha===A),a:R},A):(0,d.jsx)("div",{className:"gx-preview",children:(0,d.jsx)("div",{className:"gx-empty",children:(0,d.jsx)("p",{children:c("git.stash.empty")})})}):"history"===w?L?(0,d.jsx)(bM,{agent:a,sha:L},L):(0,d.jsx)("div",{className:"gx-preview",children:(0,d.jsx)("div",{className:"gx-empty",children:(0,d.jsx)("p",{children:c("git.hist.select")})})}):k&&ah?.status==="conflict"?(0,d.jsx)(bn,{agent:a,path:k,state:e.state,a:R,onResolved:()=>{j()}},k):k?(0,d.jsx)(bK,{agent:a,path:k,ignored:ab(k),change:ah,stamp:e.generatedAt,onOpenCommit:a=>{M(a),x("history")},onDiscard:a=>T({files:ak([a]),all:!1,file:{path:a.path,status:a.status,oldPath:a.oldPath,add:a.additions??0,del:a.deletions??0},go:async()=>{let b=await R.run("discard",c("git.done.discard"),"discard",{path:a.path,oldPath:a.oldPath});return b&&ak([a]).length&&l(null),b}}),onDiscardHunk:(a,b,d)=>void R.run("discard-hunk",c("git.done.discard"),"discard-hunk",{path:a,index:b,header:d}),onDiscardLines:(a,b,d,e)=>void R.run("discard-lines",c("git.done.discard"),"discard-lines",{path:a,index:b,header:d,lines:e})},k):(0,d.jsx)("div",{className:"gx-preview",children:(0,d.jsx)("div",{className:"gx-empty",children:(0,d.jsx)("p",{children:c("git.select")})})})]}),H&&(0,d.jsx)(bo,{agent:a,plan:H,a:R,onClose:()=>I(null),onGo:()=>{I(null),ai(H)}}),D&&(0,d.jsx)(bt,{a:R,onClose:()=>E(!1)}),J&&e.stash&&(0,d.jsxs)(F.aF,{title:c("git.state.cancelStash.title"),onClose:()=>K(!1),children:[(0,d.jsx)("p",{className:"muted",style:{margin:0},children:c("git.state.cancelStash.body",{from:e.stash.from})}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:()=>K(!1),children:c("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",disabled:!!R.busy,onClick:()=>{K(!1),R.run("smart",c("git.done.smartCancel"),"smart-cancel")},children:c("git.state.cancelStash.go")})]})]}),S&&(0,d.jsx)(bF,{files:S.files,all:S.all,summary:S.summary,file:S.file,busy:!!R.busy,onClose:()=>T(null),onConfirm:async()=>{let a=S.go;T(null),await a()}}),O&&(0,d.jsx)(bD,{changes:e.changes,a:R,initialMessage:e.mergeMsg,onClose:()=>Q(!1)})]})}function bM({agent:a,sha:b}){let{t:c}=(0,N.s9)(),[e,g]=(0,f.useState)(null),[h,i]=(0,f.useState)(null),[j,k]=(0,f.useState)(null),[l,m]=(0,f.useState)("unified"),[n,o]=(0,f.useState)(null),p=e?.files.find(a=>a.path===h),q=(0,f.useMemo)(()=>j&&p&&j.path===p.path?as(j.diff):null,[j,p]);if(n)return(0,d.jsx)("section",{className:"gx-preview",children:(0,d.jsx)("p",{className:"gx-note err",children:n})});if(!e)return(0,d.jsx)("section",{className:"gx-preview",children:(0,d.jsx)("p",{className:"gx-note",children:c("git.loading")})});let[r,...s]=e.message.split("\n"),t=s.join("\n").trim();return(0,d.jsxs)("section",{className:"gx-preview gx-commitview","aria-label":r,children:[(0,d.jsxs)("header",{className:"gx-chead",children:[(0,d.jsx)("h3",{children:r}),t&&(0,d.jsx)("pre",{className:"gx-cbody",children:t}),(0,d.jsxs)("div",{className:"muted small row gap-s wrap",children:[(0,d.jsx)("span",{className:"mono",children:e.sha.slice(0,10)}),(0,d.jsx)(G.WQ,{text:e.sha,label:c("git.info.copySha")}),(0,d.jsxs)("span",{children:["\xb7 ",e.author," \xb7 ",(0,P.v7)(e.date)]}),(0,d.jsxs)("span",{children:["\xb7 ",c("git.hist.files",{count:e.files.length})]})]})]}),0===e.files.length?(0,d.jsx)("p",{className:"gx-note",children:c("git.hist.noFiles")}):(0,d.jsx)("div",{className:"gx-cfilelist",role:"listbox",children:e.files.map(a=>(0,d.jsxs)("button",{role:"option","aria-selected":h===a.path,className:`gx-cfile ${h===a.path?"sel":""}`,onClick:()=>i(a.path),title:a.oldPath?`${a.oldPath} → ${a.path}`:a.path,children:[(0,d.jsx)(bj,{status:a.status}),(0,d.jsx)("span",{className:"mono nm",children:a.path}),(null!==a.additions||null!==a.deletions)&&(0,d.jsxs)("span",{className:"gx-counts sm",children:[(0,d.jsxs)("i",{className:"add",children:["+",a.additions??0]}),(0,d.jsxs)("i",{className:"del",children:["−",a.deletions??0]})]})]},a.path))}),p&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"gx-ptools",style:{padding:"6px 14px"},children:(0,d.jsx)(F.$q,{value:l,onChange:m,options:[{id:"unified",label:c("git.layout.unified")},{id:"split",label:c("git.layout.split")}]})}),(0,d.jsx)("div",{className:"gx-body",children:q?q.binary?(0,d.jsx)("p",{className:"gx-note",children:c("git.diff.binary")}):0===q.hunks.length?(0,d.jsx)("p",{className:"gx-note",children:c("git.diff.empty")}):(0,d.jsxs)(d.Fragment,{children:[j?.truncated&&(0,d.jsx)("div",{className:"gx-banner",children:c("git.diff.truncated")}),(0,d.jsx)(bh,{parsed:q,layout:l,path:p.path})]}):(0,d.jsx)("p",{className:"gx-note",children:c("git.loading")})})]})]})}var bN=c(15964),bO=c(40123),bP=c(59686);function bQ({agent:a}){let{t:b}=(0,N.s9)(),{refresh:c}=(0,r.o0)(),e=(0,F.dj)(),[g,h]=(0,f.useState)(null),[i,j]=(0,f.useState)(""),[k,l]=(0,f.useState)(""),[m,n]=(0,f.useState)(!1),[o,p]=(0,f.useState)(!1),q=(0,f.useRef)(""),u=!!g&&i!==q.current,v=(0,f.useRef)(!1);v.current=u;let w=(0,f.useCallback)(async(b=!1)=>{try{let c=await s.F.get(`/agents/${a.id}/notebook`);h(a=>a&&a.version===c.version&&a.enabled===c.enabled?a:c),(b||!v.current)&&(q.current=c.content,j(c.content))}catch(a){l(a instanceof Error?a.message:String(a))}},[a.id]),x=async(c=i)=>{if(g){n(!0),l("");try{let d=await s.F.put(`/agents/${a.id}/notebook`,{content:c,version:g.version});h({...g,...d}),q.current=d.content,j(d.content),e(b("notebook.saved"))}catch(a){l(a instanceof Error?a.message:String(a))}n(!1)}},y=async()=>{try{await s.F.patch(`/agents/${a.id}`,{skill_ids:[...new Set([...a.skill_ids,g.skill_id])]}),await c(["agents"]),await w(!0)}catch(a){l(a instanceof Error?a.message:String(a))}};if(!g)return(0,d.jsx)("div",{className:"pane",children:(0,d.jsx)("p",{className:"hint",children:k||b("git.loading")})});let z=i.length,A=z>g.max,B=z>.8*g.max;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"pane",children:[(0,d.jsx)("p",{className:"hint",style:{margin:0},children:b("notebook.intro")}),!g.enabled&&(0,d.jsxs)("div",{className:"banner honey",children:[(0,d.jsx)(E.A,{size:16}),(0,d.jsx)("div",{className:"grow",children:b("notebook.off")}),(0,d.jsx)("button",{className:"btn sm",onClick:y,children:b("notebook.on")})]}),k&&(0,d.jsxs)("div",{className:"banner err",children:[(0,d.jsx)(E.A,{size:16}),(0,d.jsx)("div",{className:"grow",children:k}),(0,d.jsxs)("button",{className:"btn sm",onClick:()=>{l(""),w(!0)},children:[(0,d.jsx)(ap,{size:13}),b("notebook.reload")]})]}),(0,d.jsxs)("div",{className:"row small muted",style:{justifyContent:"space-between"},children:[(0,d.jsxs)("span",{children:[(0,d.jsx)(bO.A,{size:12,style:{verticalAlign:"-1px"}})," ",g.updated_at?b("notebook.updated",{who:b("user"===g.updated_by?"notebook.by.you":"notebook.by.agent"),when:(0,t.KN)(g.updated_at)}):b("notebook.never")]}),(0,d.jsxs)("span",{style:{color:A?"var(--danger, #c0392b)":B?"var(--honey)":void 0},children:[z.toLocaleString()," / ",g.max.toLocaleString()]})]}),(0,d.jsx)(bP.n,{value:i,onChange:j,placeholder:b("notebook.placeholder"),defaultView:"write",minHeight:320})]}),(0,d.jsxs)("div",{className:"savebar col",children:[(0,d.jsx)("span",{className:"muted small",children:u?b("agent.unsavedChanges"):b("agent.allSaved")}),(0,d.jsxs)("div",{className:"row",children:[(0,d.jsxs)("button",{className:"btn danger sm",style:{marginRight:"auto"},disabled:!i.trim()||m,onClick:()=>p(!0),children:[(0,d.jsx)(br.A,{size:14}),b("notebook.clear")]}),u&&(0,d.jsx)("button",{className:"btn ghost sm",onClick:()=>j(q.current),children:b("common.discard")}),(0,d.jsx)("button",{className:"btn primary sm",disabled:!u||m||A,onClick:()=>void x(),children:b("notebook.save")})]})]}),o&&(0,d.jsxs)(F.aF,{title:b("notebook.clear.title"),onClose:()=>p(!1),children:[(0,d.jsx)("p",{style:{margin:0},className:"muted",children:b("notebook.clear.confirm")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:()=>p(!1),children:b("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",onClick:()=>{p(!1),x("")},children:b("notebook.clear")})]})]})]})}let bR=()=>Math.max(340,window.innerWidth-80);function bS({params:a}){let{id:b}=(0,f.use)(a);return(0,d.jsx)(bT,{id:b},b)}function bT({id:a}){let{t:b}=(0,N.s9)(),{agent:c,agents:g,colonies:j,ready:u,refresh:v}=(0,r.o0)(),w=c(a),x=(0,i.useRouter)(),y=(0,F.dj)(),[z,A]=(0,f.useState)(!1),[B,C]=(0,f.useState)("config"),[D,E]=(0,f.useState)([]),[G,H]=(0,f.useState)(void 0),[I,J]=(0,f.useState)(null),[K,L]=(0,f.useState)("chat"),[M,O]=(0,f.useState)(!1),P=()=>O(a=>{try{localStorage.setItem("hive-switcher-collapsed",a?"0":"1")}catch{}return!a}),Q=function(a,b){let{finished:c}=(0,r.o0)(),d=a?.id??"";c[d];let[e,g]=(0,f.useState)(null),[h,i]=(0,f.useState)(null),[j,k]=(0,f.useState)(!1),[l,m]=(0,f.useState)(null),n=(0,f.useRef)(0);a?.effective.cwd,a?.status;let o=(0,f.useCallback)(async a=>{if(!d)return;let b=++n.current;k(!0);try{let[c,e]=await Promise.all([s.F.get(`/agents/${d}/git/status`),a?s.F.get(`/agents/${d}/git/tree`):Promise.resolve(null)]);if(b!==n.current)return;g(c),e&&i(e),m(null)}catch(a){b===n.current&&m(a instanceof Error?a.message:"error")}finally{b===n.current&&k(!1)}},[d]);return{status:e,tree:h,loading:j,error:l,refresh:(0,f.useCallback)(()=>o(!0),[o])}}(w,0),R=Q.status&&Q.status.isRepo?Q.status.changes.length:0,[S,T]=(0,f.useState)(400),U=a=>{try{localStorage.setItem("hive-cfg-width",String(Math.round(a)))}catch{}},V=S>440,X=()=>{let a=V?400:Math.min(bR(),Math.round(window.innerWidth/2));T(a),U(a)},Y=(a,b)=>{A(a),b&&C(b);try{localStorage.setItem("hive-cfg-open",a?"1":"0")}catch{}},Z=(0,e.A)(w,{onDeleted:()=>x.push("/agents")}),{draft:_,setDraft:aa,errors:ab,dirty:ac,saving:ad}=Z;if(!w)return(0,d.jsxs)("div",{className:`ws ${M?"sw-collapsed":""}`,children:[(0,d.jsx)(ag,{activeId:a,collapsed:M,onToggle:P}),(0,d.jsx)("div",{className:"page",children:u?(0,d.jsxs)("div",{className:"empty",children:[(0,d.jsx)("h3",{children:b("agent.missing.title")}),(0,d.jsx)("p",{children:b("agent.missing.body")}),(0,d.jsx)(h(),{className:"btn",href:"/agents",children:b("agent.missing.back")})]}):null})]});let ae=async c=>{await s.F.post(`/agents/${a}/resume-session`,{session_id:c}),H(void 0),y(b("agent.resumed"))},af=D.filter(a=>"delegation"!==a.kind),ah=D.filter(a=>"delegation"===a.kind);return(0,d.jsxs)("div",{className:`ws ${z?"with-config":""} ${M?"sw-collapsed":""}`,style:{"--cfg":`${S}px`},children:[(0,d.jsx)(ag,{activeId:a,collapsed:M,onToggle:P}),(0,d.jsxs)("section",{className:"ws-chat",children:[(0,d.jsxs)("header",{className:"ws-head",children:[(0,d.jsx)(h(),{href:"/",className:"btn ghost icon","aria-label":b("agent.backToColony"),children:(0,d.jsx)(k,{size:18})}),(0,d.jsx)(F._h,{agent:w}),(0,d.jsxs)("div",{className:"grow",children:[(0,d.jsx)("h1",{children:w.name}),(0,d.jsxs)("div",{className:"row gap-s wrap",style:{marginTop:3},children:[(0,d.jsx)(F.PW,{role:w.role}),(0,d.jsx)(F.dJ,{provider:w.provider}),(0,d.jsx)("span",{className:"muted small",children:w.model||b("model.cliDefault")}),(0,d.jsx)(F.P5,{status:w.status})]})]}),(0,d.jsxs)("div",{className:"seg",role:"group","aria-label":b("git.tab.label"),children:[(0,d.jsx)("button",{type:"button","aria-pressed":"chat"===K,onClick:()=>L("chat"),children:b("git.tab.chat")}),(0,d.jsxs)("button",{type:"button","aria-pressed":"changes"===K,onClick:()=>L("changes"),children:[b("git.tab.changes"),R>0&&(0,d.jsx)("span",{className:"tabcount",children:R})]})]}),G&&(0,d.jsx)("button",{className:"btn primary sm",onClick:()=>ae(G),disabled:D.find(a=>a.session_id===G)?.kind==="delegation",children:b("agent.makeCurrent")}),G&&(0,d.jsx)("button",{className:"btn sm",onClick:()=>H(void 0),children:b("agent.backToCurrent")}),(0,d.jsxs)("button",{className:"btn sm",onClick:()=>J("new"),disabled:!w.session_id||"running"===w.status,children:[(0,d.jsx)(l,{size:14}),b("agent.newConversation")]}),(0,d.jsxs)("button",{className:`btn sm ${z?"primary":""}`,onClick:()=>Y(!z),"aria-expanded":z,"aria-label":b("colony.agentSettings"),children:[(0,d.jsx)(m.A,{size:14}),b("agent.settings"),ac&&(0,d.jsx)("i",{className:"dot run",title:b("agent.unsaved")})]})]}),(0,d.jsxs)("div",{className:"chat-pane",hidden:"chat"!==K,children:[(0,d.jsx)($,{agent:w,session:G}),(0,d.jsx)(W,{agent:w,sessionOverride:G})]}),"changes"===K&&(0,d.jsx)(bL,{agent:w,git:Q})]}),z&&(0,d.jsxs)("aside",{className:"ws-side",children:[(0,d.jsx)("div",{className:"ws-grip",onPointerDown:a=>{a.preventDefault();let b=a.currentTarget;b.setPointerCapture(a.pointerId);let c=S,d=a=>{T(c=Math.min(bR(),Math.max(340,window.innerWidth-a.clientX)))},e=()=>{b.removeEventListener("pointermove",d),b.removeEventListener("pointerup",e),U(c)};b.addEventListener("pointermove",d),b.addEventListener("pointerup",e)},onDoubleClick:X,role:"separator","aria-orientation":"vertical","aria-label":b("drawer.resize"),title:b("drawer.resize")}),(0,d.jsxs)("div",{className:"tabs",role:"tablist",style:{padding:"0 12px",position:"sticky",top:0,background:"var(--surface)",zIndex:2},children:[(0,d.jsx)("button",{className:"tab",role:"tab","aria-selected":"config"===B,onClick:()=>C("config"),children:b("agent.tab.config")}),(0,d.jsx)("button",{className:"tab",role:"tab","aria-selected":"notebook"===B,onClick:()=>C("notebook"),children:b("agent.tab.notebook")}),(0,d.jsx)("button",{className:"tab",role:"tab","aria-selected":"sessions"===B,onClick:()=>C("sessions"),children:b("nav.sessions")}),(0,d.jsx)("button",{className:"btn ghost icon sm",style:{marginLeft:"auto",alignSelf:"center"},onClick:X,"aria-label":V?b("drawer.shrink"):b("drawer.expand"),title:V?b("drawer.shrink"):b("drawer.expand"),children:V?(0,d.jsx)(n.A,{size:15}):(0,d.jsx)(o.A,{size:15})}),(0,d.jsx)("button",{className:"btn ghost sm",style:{alignSelf:"center"},onClick:()=>Y(!1),children:b("common.hide")})]}),"config"===B&&_&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"pane",children:(0,d.jsx)(bN.SU,{draft:_,onChange:aa,errors:ab,selfId:a})}),(0,d.jsxs)("div",{className:"savebar col",children:[(0,d.jsxs)("span",{className:"muted small",children:[ac?b("agent.unsavedChanges"):b("agent.allSaved"),ac&&"running"===w.status?` ${b("agent.appliesNextTurn")}`:""]}),(0,d.jsx)("div",{className:"row",children:Z.actions({size:"sm"})})]})]}),"notebook"===B&&(0,d.jsx)(bQ,{agent:w}),"sessions"===B&&(0,d.jsxs)("div",{className:"pane",children:[(0,d.jsx)("p",{className:"hint",style:{margin:0},children:b("agent.sessions.intro",{path:(0,t._1)(w.effective.cwd)})}),(0,d.jsx)("div",{className:"eyebrow",children:b("agent.sessions.conversations")}),0===af.length?(0,d.jsxs)("div",{className:"empty",style:{padding:24},children:[(0,d.jsx)(p.A,{size:22}),(0,d.jsx)("p",{children:b("agent.sessions.empty")})]}):af.map(a=>{let c=a.session_id===w.session_id;return(0,d.jsxs)("div",{className:"card card-pad col",style:{gap:8,borderColor:G===a.session_id?"var(--honey)":void 0},children:[(0,d.jsxs)("div",{className:"row",children:[(0,d.jsxs)("span",{className:"mono grow",children:[a.session_id.slice(0,18),"…"]}),c&&(0,d.jsx)("span",{className:"chip honey",children:b("sessions.current")})]}),(0,d.jsx)("span",{className:"muted small",children:b("agent.sessions.started",{started:(0,t.KN)(a.first_seen),last:(0,t.KN)(a.last_seen)})}),(0,d.jsxs)("div",{className:"row gap-s",children:[(0,d.jsx)("button",{className:"btn sm",onClick:()=>H(c?void 0:a.session_id),children:G===a.session_id?b("agent.sessions.viewing"):b("agent.sessions.read")}),!c&&(0,d.jsx)("button",{className:"btn sm",onClick:()=>ae(a.session_id),children:b("agent.sessions.resume")})]})]},a.session_id)}),ah.length>0&&(0,d.jsx)("div",{className:"eyebrow",style:{marginTop:6},children:b("agent.sessions.delegated")}),ah.map(a=>(0,d.jsxs)("div",{className:"card card-pad col",style:{gap:8,borderColor:G===a.session_id?"var(--honey)":void 0},children:[(0,d.jsxs)("div",{className:"row gap-s",children:[(0,d.jsx)(q.A,{size:14,className:"muted"}),(0,d.jsx)("b",{className:"grow",children:b("agent.sessions.from",{name:a.from_name??b("chat.anOrchestrator")})}),(0,d.jsx)("span",{className:"muted small",children:(0,t.KN)(a.last_seen)})]}),a.task&&(0,d.jsx)("span",{className:"small",style:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"},children:a.task}),(0,d.jsx)("div",{className:"row gap-s",children:(0,d.jsx)("button",{className:"btn sm",onClick:()=>H(G===a.session_id?void 0:a.session_id),children:G===a.session_id?b("agent.sessions.viewing"):b("agent.sessions.read")})})]},a.session_id))]})]}),Z.deleteModal,"new"===I&&(0,d.jsxs)(F.aF,{title:b("agent.newConvTitle"),onClose:()=>J(null),children:[(0,d.jsx)("p",{style:{margin:0},className:"muted",children:b("agent.newConvBody")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:()=>J(null),children:b("common.cancel")}),(0,d.jsx)("button",{className:"btn primary",onClick:async()=>{await s.F.post(`/agents/${a}/new-session`),await v(["agents"]),J(null),y(b("agent.newConvStarted"))},children:b("agent.newConvStart")})]})]})]})}}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[691,149,335,593,247,851,143,932],()=>b(b.s=49519));module.exports=c})();
|
|
1
|
+
(()=>{var a={};a.id=969,a.ids=[969],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},1708:a=>{"use strict";a.exports=require("node:process")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},18869:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(51537).A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21251:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>bU});var d=c(55322),e=c(93674),f=c(17027),g=c(91705),h=c.n(g),i=c(66252),j=c(51537);let k=(0,j.A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),l=(0,j.A)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var m=c(38550),n=c(76516),o=c(45762),p=c(89667),q=c(93351),r=c(60570),s=c(7371),t=c(61162),u=c(37070),v=c(31826);let w=(0,j.A)("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),x=(0,j.A)("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]),y=(0,j.A)("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]),z=(0,j.A)("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),A=(0,j.A)("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);var B=c(29083);let C=(0,j.A)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),D=(0,j.A)("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);var E=c(71556),F=c(60992),G=c(2335);let H=(0,j.A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);var I=c(91313);let J=(0,j.A)("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);var K=c(47087);let L=/^\[hive:channel\] (.+?) · Place: (.+?) · Thread: (.+?) · From: (.+?)((?: · (?:Addressed|Muted): \w+| · To: [^·\n]+)*)(?: · Now: [^\n]*)?\nMessage:\n([\s\S]*)$/,M="\n\n[hive:context]\n",N="\n\n[hive:files]\n";var O=c(93884);function P({text:a,badge:b}){let{t:c}=(0,O.s9)(),e=function(a){let b=L.exec(a);if(!b)return null;let[c,...d]=b[6].split(M),[e,...f]=c.split(N),g=f.join(N).split("\n").flatMap(a=>{let b=/^- (.+) \(([^()]*)\)$/.exec(a);return b?[{path:b[1],name:b[1].replace(/^.*[\\/]/,"").replace(/^\d+-\d+-/,""),detail:b[2]}]:[]});return{platform:b[1],place:b[2],thread:b[3],from:b[4],body:e,files:g,overheard:/Addressed: no/.test(b[5]),muted:/Muted: yes/.test(b[5]),context:d.join(M)}}(a);return e?(0,d.jsx)("div",{className:"msg user",children:(0,d.jsxs)("div",{className:"bubble channel",children:[(0,d.jsxs)("div",{className:"chhead",children:[(0,d.jsx)(I.A,{size:12,"aria-hidden":!0}),(0,d.jsx)("b",{children:e.platform}),(0,d.jsx)("span",{children:e.place}),e.overheard&&(0,d.jsxs)("span",{className:"chtag",title:c("chat.channel.overheard.hint"),children:[(0,d.jsx)(J,{size:11,"aria-hidden":!0}),c("chat.channel.overheard")]}),(0,d.jsx)("span",{className:"chfrom",children:e.from.replace(/\s*\(.*\)$/,"")})]}),(0,d.jsx)("div",{className:"chbody",children:e.body}),e.files.length>0&&(0,d.jsx)("div",{className:"chfiles",children:e.files.map(a=>(0,d.jsxs)("span",{className:"chfile",title:a.path,children:[(0,d.jsx)(K.A,{size:11,"aria-hidden":!0}),a.name,(0,d.jsx)("i",{children:a.detail.split(", ").pop()})]},a.path))}),e.context&&(0,d.jsxs)("details",{className:"chctx",children:[(0,d.jsx)("summary",{children:c("chat.channel.context",{n:e.context.split("\n").filter(a=>a.startsWith("- ")).length})}),(0,d.jsx)("pre",{children:e.context.replace(/^[^\n]*\n/,"")})]})]})}):(0,d.jsxs)("div",{className:`msg user${b?" queued":""}`,children:[(0,d.jsx)("div",{className:"bubble",children:a}),b&&(0,d.jsxs)("span",{className:"queued-tag",children:[(0,d.jsx)(H,{size:11,"aria-hidden":!0}),b]})]})}var Q=c(30584);function R({m:a}){let{t:b}=(0,O.s9)(),c=a.meta?.usage,e=a.blocks.filter(a=>"tool"===a.type).length;if(!c&&!a.durationMs&&!e)return null;let f=(0,Q.RP)(c);return(0,d.jsxs)("div",{className:"replymeta",children:[a.meta?.model&&(0,d.jsx)("span",{className:"mono",children:a.meta.model.replace(/^claude-/,"").replace(/-\d{8}$/,"")}),f>0&&(0,d.jsxs)("span",{title:c?b("chat.tokenDetail",{input:c.input,output:c.output,cacheRead:c.cacheRead,cacheWrite:c.cacheWrite}):"",children:[(0,d.jsx)(w,{size:12}),b("chat.inOut",{in:(0,Q.yj)(c.input+c.cacheRead+c.cacheWrite),out:(0,Q.yj)(c.output)})]}),c?.credits?(0,d.jsxs)("span",{children:[(0,d.jsx)(x,{size:12}),b("chat.credits",{value:c.credits.toFixed(2)})]}):null,a.meta?.cost!==void 0&&(0,d.jsxs)("span",{title:b(a.meta.costEstimated?"stats.costEstimated":"stats.costReported"),children:[(0,d.jsx)(x,{size:12}),a.meta.costEstimated?"≈ ":"",(0,Q.F0)(a.meta.cost)]}),e>0&&(0,d.jsxs)("span",{children:[(0,d.jsx)(y,{size:12}),b("chat.tools",{count:e})]}),a.durationMs?(0,d.jsxs)("span",{children:[(0,d.jsx)(z,{size:12}),(0,Q.nc)(a.durationMs)]}):null]})}function S({turn:a}){let{t:b}=(0,O.s9)(),[,c]=(0,f.useState)(0),e=a.usage,g=a.blocks.filter(a=>"tool"===a.type).length;return(0,d.jsxs)("div",{className:"replymeta live",children:[(0,d.jsxs)("span",{children:[(0,d.jsx)(z,{size:12}),(0,Q.nc)(Date.now()-a.startedAt)]}),g>0&&(0,d.jsxs)("span",{children:[(0,d.jsx)(y,{size:12}),b("chat.tools",{count:g})]}),e&&(e.output??0)>0&&(0,d.jsxs)("span",{children:[(0,d.jsx)(w,{size:12}),b("chat.inOut",{in:(0,Q.yj)((e.input??0)+(e.cacheRead??0)+(e.cacheWrite??0)),out:(0,Q.yj)(e.output??0)})]}),e?.contextPct!==void 0&&(0,d.jsx)("span",{children:b("chat.contextPct",{pct:e.contextPct.toFixed(1)})})]})}let T=(0,f.memo)(function({text:a}){return(0,d.jsx)("div",{className:"md",children:(0,d.jsx)(u.oz,{remarkPlugins:[v.A],children:a})})}),U=(0,f.memo)(function({blocks:a,streaming:b}){let{t:c}=(0,O.s9)();return(0,d.jsxs)(d.Fragment,{children:[a.map((e,f)=>"text"===e.type?(0,d.jsx)(T,{text:e.text},f):"thinking"===e.type?(0,d.jsxs)("details",{className:"fold think",children:[(0,d.jsxs)("summary",{children:[(0,d.jsx)(A,{size:14}),b&&f===a.length-1?c("activity.thinking"):c("chat.thought"),(0,d.jsx)(B.A,{size:14,className:"chev"})]}),(0,d.jsx)("pre",{children:e.text})]},f):(0,d.jsx)(G.Dm,{tool:e,streaming:b},f)),(0,d.jsx)(G.Kt,{blocks:a})]})}),V=(0,f.memo)(function({msgs:a,agent:b}){(0,O.s9)();let c=(0,f.useMemo)(()=>(function(a){let b=[],c=null;for(let d of a){let a;if("user"===d.role){c=d.ts,b.push(d);continue}let e=b[b.length-1],f=(a,b)=>{if(!a)return b;if(!b)return a;let c=a.usage,d=b.usage;return{model:b.model??a.model,endTs:b.endTs??a.endTs,cost:void 0!==a.cost||void 0!==b.cost?(a.cost??0)+(b.cost??0):void 0,costEstimated:a.costEstimated||b.costEstimated,usage:c&&d?{input:c.input+d.input,output:c.output+d.output,cacheRead:c.cacheRead+d.cacheRead,cacheWrite:c.cacheWrite+d.cacheWrite,reasoning:c.reasoning+d.reasoning,credits:(c.credits??0)+(d.credits??0)||void 0,contextPct:d.contextPct??c.contextPct}:c??d}};e?.role==="assistant"?(a={...e,blocks:[...e.blocks,...d.blocks],meta:f(e.meta,d.meta)},b[b.length-1]=a):(a={...d},b.push(a));let g=a.meta?.endTs;a.durationMs=c&&g?Math.max(0,g-c):void 0}return b})(a),[a]);return(0,d.jsx)(d.Fragment,{children:c.map(a=>"user"===a.role?(0,d.jsx)(P,{text:a.blocks.map(a=>"text"===a.type?a.text:"").join("")},a.id):(0,d.jsxs)("div",{className:"msg assistant",children:[(0,d.jsxs)("div",{className:"who",children:[(0,d.jsx)(F._h,{agent:b,size:"sm"}),b.name,(0,d.jsx)("span",{className:"stamp",children:a.ts?(0,t.KN)(a.ts):""})]}),(0,d.jsx)(U,{blocks:a.blocks}),(0,d.jsx)(R,{m:a})]},a.id))})},(a,b)=>a.msgs===b.msgs&&a.agent.name===b.agent.name&&a.agent.provider===b.agent.provider&&a.agent.role===b.agent.role),W=(0,f.memo)(function({name:a,running:b,queued:c,readOnly:e,onSend:g,onStop:h,toolsOpen:i,onToggleTools:j}){let{t:k}=(0,O.s9)(),[l,m]=(0,f.useState)(""),n=(0,f.useRef)(null),o=()=>{let a=n.current;a&&(a.style.height="auto",a.style.height=Math.min(a.scrollHeight,200)+"px")},p=async()=>{let a=l.trim();a&&(m(""),requestAnimationFrame(o),await g(a)||(m(a),requestAnimationFrame(o)))};return(0,d.jsxs)("div",{className:"composer",children:[e?(0,d.jsx)("div",{className:"composer-box",style:{justifyContent:"space-between",alignItems:"center"},children:(0,d.jsx)("span",{className:"muted",children:k("chat.readOnly")})}):(0,d.jsxs)("div",{className:"composer-box",children:[(0,d.jsx)("textarea",{ref:n,rows:1,value:l,placeholder:b?k("chat.queuePlaceholder"):k("chat.placeholder",{name:a}),"aria-label":k("chat.messageLabel"),onChange:a=>{m(a.target.value),o()},onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),p())}}),b&&(0,d.jsxs)("button",{className:"btn",onClick:h,"aria-label":k("chat.stop"),children:[(0,d.jsx)(C,{size:14,fill:"currentColor"}),k("chat.stop")]}),(0,d.jsx)("button",{className:"btn primary icon",onClick:()=>void p(),disabled:!l.trim(),"aria-label":k("chat.send"),children:(0,d.jsx)(D,{size:18})})]}),(0,d.jsxs)("div",{className:"composer-meta",children:[(0,d.jsx)("span",{children:k("chat.keys")}),(0,d.jsx)("button",{type:"button",className:"linkbtn",onClick:j,children:k(i?"chat.collapseTools":"chat.expandTools")}),c>0&&(0,d.jsx)("span",{children:k("queue.count",{count:c})})]})]})});function X({agent:a,sessionOverride:b}){let{t:c}=(0,O.s9)(),{live:e,finished:g,clearLive:h,agents:i}=(0,r.o0)(),j=(0,F.dj)(),[k,l]=(0,f.useState)([]),[m,n]=(0,f.useState)(!1),[o,p]=(0,f.useState)(60),[t,u]=(0,f.useState)(0),v=(0,f.useRef)(null),[w,x]=(0,f.useState)([]),[y,z]=(0,f.useState)(null),A=(0,f.useRef)(null),B=(0,f.useRef)(!0),C=e[a.id],D="running"===a.status||!!C,H=void 0!==b&&b!==a.session_id;(0,f.useCallback)(()=>{let c=H?b:a.session_id;return c?s.F.get(`/agents/${a.id}/history?session=${encodeURIComponent(c)}&limit=${o}`).then(a=>{l(a.messages),u(a.total??a.messages.length),n(!0)}).catch(a=>{j(a.message,"err"),n(!0)}):(l([]),n(!0),Promise.resolve())},[a.id,a.session_id,H,b,j,o]);let I=(0,f.useCallback)(()=>{v.current=A.current?.scrollHeight??null,B.current=!1,p(a=>a+120)},[]);g[a.id],(0,f.useRef)(!0).current=!C&&"running"!==a.status&&!a.queued;let J=(0,f.useCallback)(async b=>{if(H)return!1;x(a=>[...a,b]),B.current=!0;try{return await s.F.post(`/agents/${a.id}/messages`,{prompt:b}),!0}catch(a){return x(a=>{let c=a.lastIndexOf(b);return c<0?a:a.filter((a,b)=>b!==c)}),j(a instanceof Error?a.message:c("chat.sendFailed"),"err"),!1}},[a.id,H,j,c]),K=(0,f.useCallback)(()=>{s.F.post(`/agents/${a.id}/stop`).catch(()=>void 0)},[a.id]),L=(0,f.useCallback)(()=>z(a=>!a),[]),M=w.filter((a,b)=>!(C&&b===w.findIndex(a=>a.trim()===C.prompt.trim()))),N=m&&!k.length&&!C&&!w.length;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(G.Qh.Provider,{value:y,children:(0,d.jsx)("div",{className:"thread",ref:A,onWheel:a=>{a.deltaY<0&&(B.current=!1)},onScroll:a=>{let b=a.currentTarget;b.scrollHeight-b.scrollTop-b.clientHeight<40&&(B.current=!0)},children:(0,d.jsxs)("div",{className:"thread-inner",children:[N&&(0,d.jsxs)("div",{className:"empty",style:{marginTop:40},children:[(0,d.jsx)(F._h,{agent:a,size:"lg"}),(0,d.jsx)("h3",{children:c("chat.empty.title",{name:a.name})}),(0,d.jsx)("p",{children:"orchestrator"===a.role?c("chat.empty.orchestrator"):c("chat.empty.worker")})]}),t>k.length&&(0,d.jsx)("button",{type:"button",className:"btn sm chat-earlier",onClick:I,children:c("chat.earlier",{n:t-k.length})}),(0,d.jsx)(V,{msgs:k,agent:a}),C&&(0,d.jsxs)(d.Fragment,{children:["dispatch"===C.source?(0,d.jsxs)("div",{className:"delegation-card",children:[(0,d.jsxs)("div",{className:"head",children:[(0,d.jsx)(q.A,{size:14}),c("chat.delegatedFrom",{name:i.find(a=>a.id===C.from)?.name??c("chat.anOrchestrator")})]}),(0,d.jsx)("p",{children:C.prompt}),(0,d.jsx)("span",{className:"hint",children:c("chat.delegatedNote")})]}):!k.some(a=>"user"===a.role&&a.blocks.some(a=>"text"===a.type&&a.text.trim()===C.prompt.trim()))&&(0,d.jsx)(P,{text:C.prompt}),(0,d.jsxs)("div",{className:"msg assistant",children:[(0,d.jsxs)("div",{className:"who",children:[(0,d.jsx)(F._h,{agent:a,size:"sm"}),a.name]}),(0,d.jsx)(U,{blocks:C.blocks,streaming:!0}),!C.error&&(0,d.jsxs)("span",{className:"typing","aria-label":c("common.working"),children:[(0,d.jsx)("i",{}),(0,d.jsx)("i",{}),(0,d.jsx)("i",{})]}),(0,d.jsx)(S,{turn:C}),C.error&&(0,d.jsxs)("div",{className:"banner err",children:[(0,d.jsx)(E.A,{size:16}),(0,d.jsx)("div",{className:"grow",children:(0,O.YF)(C.error)}),(0,d.jsx)("button",{className:"btn sm",onClick:()=>h(a.id),children:c("common.dismiss")})]})]})]}),M.map((a,b)=>(0,d.jsx)(P,{text:a,badge:C?c("chat.queuedBadge"):void 0},`${b}:${a}`))]})})}),(0,d.jsx)(W,{name:a.name,running:D,queued:a.queued??0,readOnly:H,onSend:J,onStop:K,toolsOpen:y,onToggleTools:L})]})}let Y=(0,j.A)("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),Z=(0,j.A)("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);var $=c(18869);function _({agent:a,session:b}){let{t:c}=(0,O.s9)(),{finished:e,live:g}=(0,r.o0)(),[h,i]=(0,f.useState)(null),[j,k]=(0,f.useState)(!1);e[a.id];let l=g[a.id];if(!h||0===h.turns&&!l)return null;let m=l?.usage,n=(0,Q.RP)(h.usage)+(m?(0,Q.RP)({input:m.input??0,output:m.output??0,cacheRead:m.cacheRead??0,cacheWrite:m.cacheWrite??0}):0),o=(h.cost??0)+(l?.cost??0),p=(h.usage.credits??0)+(m?.credits??0),q=m?.contextPct??h.contextPct??(h.lastContext?Math.min(100,h.lastContext/2e5*100):null),s=null!==h.cost||l?.cost!==void 0,t=h.usage,u=Math.max(1,t.input+t.output+t.cacheRead+t.cacheWrite),v=Math.max(1,...h.tools.map(a=>a.count)),A=Math.max(1,...h.timeline.map(a=>a.tokens));return(0,d.jsxs)("div",{className:"stats-wrap",children:[(0,d.jsxs)("button",{className:"statsbar",onClick:()=>k(a=>!a),"aria-expanded":j,children:[(0,d.jsxs)("span",{className:"sb",title:c("stats.contextTitle"),children:[(0,d.jsx)(Y,{size:14}),(0,d.jsx)("b",{children:null!==q?`${q.toFixed(+(q<10))}%`:(0,Q.yj)(h.lastContext)}),c("stats.context")]}),(0,d.jsxs)("span",{className:"sb",children:[(0,d.jsx)(w,{size:14}),(0,d.jsx)("b",{children:(0,Q.yj)(n)}),c("stats.tokens")]}),p>0&&(0,d.jsxs)("span",{className:"sb",children:[(0,d.jsx)(x,{size:14}),(0,d.jsx)("b",{children:p.toFixed(2)}),c("stats.credits")]}),s&&(0,d.jsxs)("span",{className:"sb",title:h.costEstimated?c("stats.costEstimated"):c("stats.costReported"),children:[(0,d.jsx)(x,{size:14}),(0,d.jsxs)("b",{children:[h.costEstimated?"≈ ":"",(0,Q.F0)(o)]})]}),(0,d.jsxs)("span",{className:"sb",children:[(0,d.jsx)(Z,{size:14}),(0,d.jsx)("b",{children:h.turns}),c("stats.turns",{count:h.turns})]}),(0,d.jsxs)("span",{className:"sb",children:[(0,d.jsx)(y,{size:14}),(0,d.jsx)("b",{children:h.toolCalls}),c("stats.toolCalls",{count:h.toolCalls}),h.toolErrors>0&&(0,d.jsxs)("em",{className:"tbad",children:[" \xb7 ",c("stats.failed",{count:h.toolErrors})]})]}),h.durationMs>0&&(0,d.jsxs)("span",{className:"sb",children:[(0,d.jsx)(z,{size:14}),(0,d.jsx)("b",{children:(0,Q.nc)(h.durationMs)}),c("stats.working")]}),(0,d.jsx)($.A,{size:15,className:`chev2 ${j?"open":""}`})]}),j&&(0,d.jsxs)("div",{className:"statspanel",children:[(0,d.jsxs)("section",{children:[(0,d.jsx)("div",{className:"eyebrow",children:c("stats.mix")}),(0,d.jsxs)("div",{className:"mixbar",role:"img","aria-label":c("stats.mix"),children:[(0,d.jsx)("i",{style:{width:`${t.cacheRead/u*100}%`,background:"var(--p-opencode)"}}),(0,d.jsx)("i",{style:{width:`${t.cacheWrite/u*100}%`,background:"var(--p-kiro)"}}),(0,d.jsx)("i",{style:{width:`${t.input/u*100}%`,background:"var(--honey)"}}),(0,d.jsx)("i",{style:{width:`${t.output/u*100}%`,background:"var(--p-claude)"}})]}),(0,d.jsxs)("dl",{className:"legend",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("i",{style:{background:"var(--p-opencode)"}}),(0,d.jsx)("dt",{children:c("stats.cacheRead")}),(0,d.jsx)("dd",{children:(0,Q.yj)(t.cacheRead)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("i",{style:{background:"var(--p-kiro)"}}),(0,d.jsx)("dt",{children:c("stats.cacheWrite")}),(0,d.jsx)("dd",{children:(0,Q.yj)(t.cacheWrite)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("i",{style:{background:"var(--honey)"}}),(0,d.jsx)("dt",{children:c("stats.input")}),(0,d.jsx)("dd",{children:(0,Q.yj)(t.input)})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("i",{style:{background:"var(--p-claude)"}}),(0,d.jsx)("dt",{children:c("stats.output")}),(0,d.jsxs)("dd",{children:[(0,Q.yj)(t.output),t.reasoning>0&&(0,d.jsxs)("span",{className:"muted",children:[" (",c("stats.thinking",{tokens:(0,Q.yj)(t.reasoning)}),")"]})]})]})]}),h.models.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"eyebrow",style:{marginTop:14},children:c("stats.models")}),h.models.map(a=>(0,d.jsxs)("div",{className:"row small",style:{justifyContent:"space-between"},children:[(0,d.jsx)("span",{className:"mono",children:a.model}),(0,d.jsx)("span",{className:"muted",children:c("stats.modelLine",{count:a.messages,out:(0,Q.yj)(a.output)})})]},a.model))]})]}),(0,d.jsxs)("section",{children:[(0,d.jsxs)("div",{className:"eyebrow",children:[c("stats.toolsUsed")," ",h.toolTimeMs>0&&(0,d.jsxs)("span",{className:"muted",children:["\xb7 ",c("stats.totalTime",{time:(0,Q.nc)(h.toolTimeMs)})]})]}),0===h.tools.length?(0,d.jsx)("p",{className:"muted small",style:{margin:"6px 0 0"},children:c("stats.noTools")}):h.tools.slice(0,9).map(a=>(0,d.jsxs)("div",{className:"toolrow",title:c("stats.toolTitle",{count:a.count,time:(0,Q.nc)(a.totalMs)}),children:[(0,d.jsx)("span",{className:"mono tn",children:a.name.replace(/^mcp__/,"").replace("__"," \xb7 ")}),(0,d.jsx)("span",{className:"tbar",children:(0,d.jsx)("i",{style:{width:`${a.count/v*100}%`}})}),(0,d.jsxs)("span",{className:"tc",children:[a.count,a.errors>0&&(0,d.jsxs)("em",{className:"tbad",children:[" (",a.errors,"✗)"]})]}),(0,d.jsx)("span",{className:"td muted",children:a.totalMs?(0,Q.nc)(a.totalMs/a.count):""})]},a.name))]}),(0,d.jsxs)("section",{style:{gridColumn:"1 / -1"},children:[(0,d.jsx)("div",{className:"eyebrow",children:c("stats.perTurn")}),(0,d.jsx)("div",{className:"spark",role:"list",children:h.timeline.slice(-40).map((a,b)=>(0,d.jsx)("div",{className:"sbar",role:"listitem",title:`${a.prompt||c("stats.promptFallback")}
|
|
2
|
+
${c("stats.turnLine",{tokens:(0,Q.yj)(a.tokens),tools:a.tools,time:(0,Q.nc)(a.durationMs)})}${null!==a.cost?` \xb7 ${(0,Q.F0)(a.cost)}`:""}`,children:(0,d.jsx)("i",{style:{height:`${Math.max(4,a.tokens/A*100)}%`}})},b))})]})]})]})}let aa=(0,j.A)("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]),ab=(0,j.A)("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);var ac=c(71267),ad=c(16487),ae=c(54842),af=c(3936),ag=c(36143);function ah({activeId:a,collapsed:b=!1,onToggle:c}){let{t:e}=(0,O.s9)(),{agents:g,colonies:i,live:j}=(0,r.o0)(),k=(0,af.z)(),[l,m]=(0,f.useState)(""),[n,o]=(0,f.useState)(!1),p=(0,f.useMemo)(()=>{let a=a=>!l||`${a.name} ${a.description} ${a.provider} ${a.model}`.toLowerCase().includes(l.toLowerCase()),b=i.map(b=>({key:b.id,name:b.name,color:b.color||"var(--honey)",items:g.filter(c=>c.colony_id===b.id&&a(c))}));return b.push({key:"free",name:e("common.noColony"),color:null,items:g.filter(b=>(!b.colony_id||!i.some(a=>a.id===b.colony_id))&&a(b))}),b.filter(a=>a.items.length)},[g,i,l,e]),q=c&&(0,d.jsx)("button",{className:"btn ghost icon sm",onClick:c,"aria-label":b?e("switcher.expand"):e("switcher.collapse"),title:b?e("switcher.expand"):e("switcher.collapse"),"aria-expanded":!b,children:b?(0,d.jsx)(aa,{size:17}):(0,d.jsx)(ab,{size:17})});return b?(0,d.jsxs)("aside",{className:"switcher mini","aria-label":e("nav.agents"),children:[(0,d.jsxs)("div",{className:"switcher-head",children:[q,(0,d.jsx)("button",{className:"btn ghost icon sm",onClick:()=>o(!0),"aria-label":e("newAgent.title"),title:e("newAgent.title"),children:(0,d.jsx)(ac.A,{size:16})})]}),(0,d.jsx)("div",{className:"switcher-list",children:p.map(b=>(0,d.jsxs)("div",{className:"mini-group",children:[(0,d.jsx)("div",{className:"mini-sep",title:`${b.name} \xb7 ${b.items.length}`,style:b.color?{"--c":b.color}:void 0}),b.items.map(b=>(0,d.jsx)(h(),{href:`/agents/${b.id}`,className:"sw-item mini","aria-current":b.id===a?"page":void 0,"aria-label":b.name,...k.bind(b.id),children:(0,d.jsxs)("span",{className:"sw-av",children:[(0,d.jsx)(F._h,{agent:b}),"idle"!==b.status&&(0,d.jsx)("i",{className:`pip ${"error"===b.status?"err":""}`})]})},b.id))]},b.key))}),n&&(0,d.jsx)(ag.b,{onClose:()=>o(!1)}),k.node]}):(0,d.jsxs)("aside",{className:"switcher","aria-label":e("nav.agents"),children:[(0,d.jsxs)("div",{className:"switcher-head",children:[(0,d.jsxs)("div",{className:"row",children:[(0,d.jsx)("b",{style:{fontFamily:"var(--font-display)",fontSize:16},className:"grow",children:e("nav.agents")}),q,(0,d.jsx)("button",{className:"btn ghost icon sm",onClick:()=>o(!0),"aria-label":e("newAgent.title"),children:(0,d.jsx)(ac.A,{size:16})})]}),(0,d.jsxs)("div",{className:"search",children:[(0,d.jsx)(ad.A,{size:15}),(0,d.jsx)("input",{className:"input",placeholder:e("switcher.find"),value:l,onChange:a=>m(a.target.value),"aria-label":e("switcher.find")})]})]}),(0,d.jsxs)("div",{className:"switcher-list",children:[0===p.length&&(0,d.jsx)("p",{className:"muted small",style:{padding:16},children:e("switcher.noMatch",{query:l})}),p.map(b=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"switcher-group",children:[b.color&&(0,d.jsx)("i",{className:"cdot",style:{background:b.color}}),b.name,(0,d.jsx)("span",{children:b.items.length})]}),b.items.map(b=>{let c=(0,ae.E)(j[b.id]);return(0,d.jsxs)(h(),{href:`/agents/${b.id}`,className:"sw-item","aria-current":b.id===a?"page":void 0,...k.bind(b.id),children:[(0,d.jsxs)("span",{className:"sw-av",children:[(0,d.jsx)(F._h,{agent:b}),"idle"!==b.status&&(0,d.jsx)("i",{className:`pip ${"error"===b.status?"err":""}`})]}),(0,d.jsxs)("span",{className:"sw-body",children:[(0,d.jsxs)("span",{className:"sw-top",children:[(0,d.jsx)("b",{children:b.name}),"orchestrator"===b.role&&(0,d.jsx)("em",{children:e("role.orchestrator")})]}),(0,d.jsx)("span",{className:`sw-sub ${c?"live":b.description?"":"blank"}`,children:c??("error"===b.status?e("status.error"):b.description||e("switcher.noDescription"))}),(0,d.jsxs)("span",{className:"sw-meta",children:[(0,d.jsx)("i",{style:{background:t.xq[b.provider].color}}),t.xq[b.provider].short,b.model?` \xb7 ${b.model}`:"",(0,d.jsx)("span",{className:"sw-ago",children:b.queued&&b.queued>0?e("queue.count",{count:b.queued}):(0,t.KN)(b.updated_at)})]})]})]},b.id)})]},b.key))]}),n&&(0,d.jsx)(ag.b,{onClose:()=>o(!1)}),k.node]})}let ai=(0,j.A)("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);var aj=c(78381);let ak=(0,j.A)("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]),al=(0,j.A)("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);var am=c(23124),an=c(31251);let ao=(0,j.A)("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);var ap=c(4111);let aq=(0,j.A)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),ar=(0,j.A)("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),as=(0,j.A)("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);function at(a){let b={meta:[],hunks:[],binary:!1},c=null,d=0,e=0;for(let f of a.split("\n")){let a=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@ ?(.*)$/.exec(f);if(a){d=Number(a[1]),e=Number(a[2]),c={header:f,section:a[3]??"",lines:[]},b.hunks.push(c);continue}if(!c){/^Binary files .* differ$/.test(f)||f.startsWith("GIT binary patch")?b.binary=!0:(/^(rename|copy) (from|to) /.test(f)||/^(new|deleted) file mode/.test(f)||/^similarity index/.test(f))&&b.meta.push(f);continue}let g=f[0];if("+"===g)c.lines.push({kind:"add",newNo:e++,text:f.slice(1)});else if("-"===g)c.lines.push({kind:"del",oldNo:d++,text:f.slice(1)});else if(" "===g)c.lines.push({kind:"ctx",oldNo:d++,newNo:e++,text:f.slice(1)});else if("\\"===g){let a=c.lines[c.lines.length-1];a&&(a.noEol=!0)}}return b}let au=a=>/^(@@ [^@]+@@)/.exec(a)?.[1]??a;var av=c(25538),aw=c(18355),ax=c(35360),ay=c(91432),az=c(33430),aA=c(16870),aB=c(28118),aC=c(26379),aD=c(68459),aE=c(30055),aF=c(89373),aG=c(77502),aH=c(18743),aI=c(33976),aJ=c(91033),aK=c(15892),aL=c(1164),aM=c(59817),aN=c(67607),aO=c(79589),aP=c(39483),aQ=c(40449),aR=c(62033),aS=c(83410),aT=c(91030),aU=c(76444),aV=c(1526);for(let[a,b]of Object.entries({bash:aw.A,c:ax.A,cpp:ay.A,csharp:az.A,css:aA.A,diff:aB.A,dockerfile:aC.A,go:aD.A,ini:aE.A,java:aF.A,javascript:aG.A,json:aH.A,kotlin:aI.A,makefile:aJ.A,markdown:aK.A,perl:aL.A,php:aM.A,python:aN.A,ruby:aO.A,rust:aP.A,scss:aQ.A,sql:aR.A,swift:aS.A,typescript:aT.A,xml:aU.A,yaml:aV.A}))av.A.registerLanguage(a,b);let aW={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",json:"json",css:"css",scss:"scss",html:"xml",htm:"xml",xml:"xml",svg:"xml",vue:"xml",svelte:"xml",md:"markdown",mdx:"markdown",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",h:"c",cpp:"cpp",cc:"cpp",hpp:"cpp",cs:"csharp",php:"php",pl:"perl",pm:"perl",sh:"bash",bash:"bash",zsh:"bash",yml:"yaml",yaml:"yaml",toml:"ini",ini:"ini",conf:"ini",cfg:"ini",sql:"sql",diff:"diff",patch:"diff",mk:"makefile"};function aX(a){let b=a.slice(a.lastIndexOf("/")+1).toLowerCase();return"dockerfile"===b?"dockerfile":"makefile"===b?"makefile":aW[b.includes(".")?b.slice(b.lastIndexOf(".")+1):""]??null}let aY=a=>a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function aZ(a,b){let c,d,e=aX(b);if(!e||a.length>12e5)c=aY(a);else try{c=av.A.highlight(a,{language:e,ignoreIllegals:!0}).value}catch{c=aY(a)}let f=[],g=[],h="",i=/<span [^>]*>|<\/span>|\n|[^<\n]+/g;for(;d=i.exec(c);){let a=d[0];"\n"===a?(f.push(h+"</span>".repeat(g.length)),h=g.join("")):(a.startsWith("<span")?g.push(a):"</span>"===a&&g.pop(),h+=a)}return f.push(h+"</span>".repeat(g.length)),f}function a$(a){return a.replace(/(^|>)([^<]+)/g,(a,b,c)=>b+c.replace(/[\t ]/g,a=>" "===a?'<i class="ws-t"> </i>':'<i class="ws-s"> </i>'))}function a_(a,b,c=0){let d=a.length<=15e3,e=(0,f.useMemo)(()=>d?aZ(a,b):null,[d,a,b]),g=(0,f.useMemo)(()=>d?[]:a.split("\n"),[d,a]),[h,i]=(0,f.useState)(null);return(0,f.useMemo)(()=>{if(e)return e;if(!h||h.path!==b)return g.map(aY);let a=h.raws,c=0;for(;c<g.length&&c<a.length&&g[c]===a[c];)c++;let d=0;for(;d<g.length-c&&d<a.length-c&&g[g.length-1-d]===a[a.length-1-d];)d++;return g.map((b,e)=>e<c?h.html[e]:e>=g.length-d?h.html[a.length-(g.length-e)]:aY(b))},[e,h,b,g])}let a0=[{id:"app",label:"Hive",dark:!1,swatch:["#f6f4ee","#9a6a00","#2f8f5b","#2f5bea"]},{id:"gitlab-light",label:"GitLab Light",dark:!1,swatch:["#ffffff","#a31515","#0451a5","#6f42c1"]},{id:"gitlab-dark",label:"GitLab Dark",dark:!0,swatch:["#1f1e24","#ff7b72","#a5d6ff","#d2a8ff"]},{id:"solarized-light",label:"Solarized Light",dark:!1,swatch:["#fdf6e3","#859900","#2aa198","#268bd2"]},{id:"solarized-dark",label:"Solarized Dark",dark:!0,swatch:["#002b36","#859900","#2aa198","#268bd2"]},{id:"monokai",label:"Monokai",dark:!0,swatch:["#272822","#f92672","#e6db74","#66d9ef"]},{id:"dracula",label:"Dracula",dark:!0,swatch:["#282a36","#ff79c6","#f1fa8c","#8be9fd"]}],a1={theme:"app",whitespace:!1,tabSize:4,showIgnored:!0},a2=a1,a3=new Set;function a4(){}function a5(a){a2={...a2,...a};try{localStorage.setItem("hive-git-view",JSON.stringify(a2))}catch{}a3.forEach(a=>a())}function a6(){return(0,f.useSyncExternalStore)(a=>(a3.add(a),()=>a3.delete(a)),()=>(a4(),a2),()=>a1)}var a7=c(48881),a8=c(28923),a9=c(2838);function ba(){let{t:a}=(0,O.s9)(),b=a6(),[c,e]=(0,f.useState)(!1),g=(0,f.useRef)(null);return(0,a9.s)(c,g,()=>e(!1)),(0,d.jsxs)("div",{className:"gx-brmenu gx-set",ref:g,children:[(0,d.jsx)("button",{type:"button",className:"btn ghost icon sm","aria-expanded":c,"aria-haspopup":"dialog","aria-label":a("git.set.title"),title:a("git.set.title"),onClick:()=>e(a=>!a),children:(0,d.jsx)(a7.A,{size:15})}),c&&(0,d.jsxs)("div",{className:"gx-pop gx-setpop",role:"dialog","aria-label":a("git.set.title"),children:[(0,d.jsx)("div",{className:"gx-brhead",style:{padding:"0 2px"},children:a("git.set.theme")}),(0,d.jsx)("div",{className:"gx-themes",role:"radiogroup","aria-label":a("git.set.theme"),children:a0.map(c=>(0,d.jsxs)("button",{type:"button",role:"radio","aria-checked":b.theme===c.id,className:`gx-theme ${b.theme===c.id?"on":""}`,onClick:()=>a5({theme:c.id}),children:[(0,d.jsxs)("span",{className:"sw",style:{background:c.swatch[0]},children:[(0,d.jsx)("i",{style:{background:c.swatch[1]}}),(0,d.jsx)("i",{style:{background:c.swatch[2]}}),(0,d.jsx)("i",{style:{background:c.swatch[3]}})]}),(0,d.jsx)("span",{className:"nm",children:"app"===c.id?a("git.set.themeApp"):c.label}),b.theme===c.id&&(0,d.jsx)(a8.A,{size:14})]},c.id))}),(0,d.jsxs)("label",{className:"gx-opt",children:[(0,d.jsx)("input",{type:"checkbox",checked:b.whitespace,onChange:a=>a5({whitespace:a.target.checked})}),(0,d.jsxs)("span",{children:[(0,d.jsx)("b",{children:a("git.set.whitespace")}),(0,d.jsx)("small",{children:a("git.set.whitespace.hint")})]})]}),(0,d.jsxs)("label",{className:"gx-opt",children:[(0,d.jsx)("input",{type:"checkbox",checked:b.showIgnored,onChange:a=>a5({showIgnored:a.target.checked})}),(0,d.jsxs)("span",{children:[(0,d.jsx)("b",{children:a("git.set.ignored")}),(0,d.jsx)("small",{children:a("git.set.ignored.hint")})]})]}),(0,d.jsxs)("div",{className:"gx-opt",children:[(0,d.jsx)("span",{children:(0,d.jsx)("b",{children:a("git.set.tab")})}),(0,d.jsx)("div",{className:"seg",role:"group",children:[2,4,8].map(a=>(0,d.jsx)("button",{type:"button","aria-pressed":b.tabSize===a,onClick:()=>a5({tabSize:a}),children:a},a))})]}),(0,d.jsx)("p",{className:"small muted",style:{margin:0},children:a("git.set.note")})]})]})}function bb({html:a}){let{whitespace:b}=a6(),c=(0,f.useMemo)(()=>b?a$(a):a,[a,b]);return(0,d.jsx)("span",{dangerouslySetInnerHTML:{__html:c||" "}})}let bc=(0,f.memo)(function({html:a,ws:b}){let c=(0,f.useMemo)(()=>b?a$(a):a,[a,b]);return(0,d.jsx)("span",{dangerouslySetInnerHTML:{__html:c||" "}})});function bd({text:a,path:b}){let c=(0,f.useMemo)(()=>aZ(a,b).join("\n"),[a,b]);return(0,d.jsx)(bb,{html:c})}let be=(0,f.memo)(function({text:a,path:b,ws:c}){let e=(0,f.useMemo)(()=>aZ(a,b)[0]??"",[a,b]);return(0,d.jsx)(bc,{html:e,ws:c})});var bf=c(61593);function bg({count:a,width:b,render:c,overscan:e=20,overlay:g,reveal:h}){let i=(0,f.useRef)(null),j=(0,f.useRef)(0),[k,l]=(0,f.useState)({top:0,h:800,w:900}),m=(0,f.useCallback)(()=>{cancelAnimationFrame(j.current),j.current=requestAnimationFrame(()=>{let a=i.current;a&&l(b=>b.top===a.scrollTop&&b.h===a.clientHeight&&b.w===a.clientWidth?b:{top:a.scrollTop,h:a.clientHeight,w:a.clientWidth})})},[]),n=Math.max(0,Math.floor(k.top/20)-e),o=Math.min(a,Math.ceil((k.top+k.h)/20)+e),p=[];for(let a=n;a<o;a++)p.push(c(a));return(0,d.jsx)("div",{className:"vl",ref:i,onScroll:m,style:{"--vl-vw":`${k.w}px`},children:(0,d.jsxs)("div",{className:"vl-space",style:{height:20*a,minWidth:b},children:[(0,d.jsx)("div",{className:"vl-win",style:{top:20*n},children:p}),g&&(0,d.jsx)("div",{className:"vl-peekwrap",style:{top:g.top},children:g.node})]})})}let bh=(0,f.memo)(function({row:a,path:b,ws:c,actions:e,picking:f,onPick:g}){let{t:h}=(0,O.s9)();if("hunk"===a.t)return(0,d.jsxs)("div",{className:"vl-row hunk",children:[(0,d.jsx)("div",{className:"vl-ln",style:{left:0},children:"⋯"}),(0,d.jsx)("div",{className:"vl-ln",style:{left:"calc(6ch + 16px)"},children:"⋯"}),(0,d.jsxs)("div",{className:"vl-hl",children:[(0,d.jsx)("span",{className:"rng mono",children:a.header}),a.section&&(0,d.jsx)("span",{className:"hs",title:a.section,children:a.section}),e&&f?.hunk===a.idx?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",className:"hk-btn on",onClick:()=>e.pickAll(a.idx,a.changed),children:h("git.discard.lines.all")}),(0,d.jsxs)("button",{type:"button",className:"hk-btn danger on",disabled:!f.picked.size,onClick:()=>e.discardPicked(a.idx,a.header),children:[(0,d.jsx)(ao,{size:12}),h("git.discard.lines.go",{count:f.picked.size})]}),(0,d.jsx)("button",{type:"button",className:"hk-btn on",onClick:e.stopPicking,children:h("common.cancel")})]}):e&&(0,d.jsxs)(d.Fragment,{children:[a.changed>0&&e.canPick&&(0,d.jsxs)("button",{type:"button",className:"hk-btn",title:h("git.discard.lines.hint"),onClick:()=>e.startPicking(a.idx),children:[(0,d.jsx)(bf.A,{size:12}),h("git.discard.lines")]}),(0,d.jsxs)("button",{type:"button",className:"hk-btn",title:h("git.discard.hunk.hint"),onClick:()=>e.discardHunk(a.idx,a.header),children:[(0,d.jsx)(ao,{size:12}),h("git.discard.hunk")]})]})]})]});if("line"===a.t){let e=a.l;return(0,d.jsxs)("div",{className:`vl-row ${e.kind} ${g&&void 0!==a.k&&f?.picked.has(a.k)?"picked":""}`,onClick:g&&void 0!==a.k?()=>g(a.k):void 0,children:[(0,d.jsx)("div",{className:"vl-ln",style:{left:0},children:e.oldNo??""}),(0,d.jsx)("div",{className:"vl-ln",style:{left:"calc(6ch + 16px)"},children:e.newNo??""}),(0,d.jsx)("div",{className:"vl-sg",children:g&&void 0!==a.k?(0,d.jsx)("input",{type:"checkbox",checked:!!f?.picked.has(a.k),onChange:()=>void 0,"aria-label":h("git.discard.lines.pick")}):"add"===e.kind?"+":"del"===e.kind?"−":""}),(0,d.jsx)("div",{className:"vl-cd",children:(0,d.jsx)(be,{text:e.text,path:b,ws:c})})]})}let{left:i,right:j}=a.r;return(0,d.jsxs)("div",{className:"vl-row split",children:[(0,d.jsx)("div",{className:`vl-ln ${i?.kind??"void"}`,style:{left:0},children:i?.oldNo??""}),(0,d.jsx)("div",{className:`vl-cd ${i?.kind??"void"}`,title:i&&i.text.length>60?i.text:void 0,children:i?(0,d.jsx)(be,{text:i.text,path:b,ws:c}):null}),(0,d.jsx)("div",{className:`vl-ln ${j?.kind??"void"}`,children:j?.newNo??""}),(0,d.jsx)("div",{className:`vl-cd ${j?.kind??"void"}`,title:j&&j.text.length>60?j.text:void 0,children:j?(0,d.jsx)(be,{text:j.text,path:b,ws:c}):null})]})});function bi({parsed:a,layout:b,path:c,cutOff:e=!1,firstIndex:g=0,onDiscardHunk:h,onDiscardLines:i}){let{whitespace:j}=a6(),k=(0,f.useMemo)(()=>(function(a,b,c,d=0){let e=[],f=(a=>{let b=aX(a);return!!b&&!["markdown","yaml","json","ini","xml","diff","dockerfile","makefile"].includes(b)})(c);return a.hunks.forEach((a,c)=>{e.push({t:"hunk",idx:c+d,header:au(a.header),section:f?a.section:"",changed:a.lines.filter(a=>"ctx"!==a.kind).length});let g=0;if("unified"===b)for(let b of a.lines)e.push({t:"line",l:b,hunk:c+d,k:"ctx"===b.kind?void 0:g++});else for(let b of function(a){let b=[];for(let c=0;c<a.length;){let d=a[c];if("ctx"===d.kind){b.push({left:d,right:d}),c++;continue}let e=[],f=[];for(;c<a.length&&"del"===a[c].kind;)e.push(a[c++]);for(;c<a.length&&"add"===a[c].kind;)f.push(a[c++]);for(let a=0;a<Math.max(e.length,f.length);a++)b.push({left:e[a],right:f[a]})}return b}(a.lines))e.push({t:"pair",r:b})}),e})(a,b,c,g),[a,b,c,g]),l=(0,f.useMemo)(()=>a.hunks.reduce((a,b)=>b.lines.reduce((a,b)=>Math.max(a,b.text.length),a),0),[a]),m="unified"===b?`calc(12ch + 32px + 18px + ${l}ch + 24px)`:void 0,n=(0,f.useRef)(null),o=(0,f.useRef)(null),[p,q]=(0,f.useState)({max:0,track:0}),[r,s]=(0,f.useState)(null),t=a=>s(b=>{if(!b)return b;let c=new Set(b.picked);return c.has(a)?c.delete(a):c.add(a),{...b,picked:c}}),u=h?{canPick:"unified"===b&&!!i,discardHunk:h,startPicking:a=>s({hunk:a,picked:new Set}),stopPicking:()=>s(null),pickAll:(a,b)=>s({hunk:a,picked:new Set(Array.from({length:b},(a,b)=>b))}),discardPicked:(a,b)=>{if(r&&i){let c=[...r.picked].sort((a,b)=>a-b);s(null),i(a,b,c)}}}:void 0;return(0,d.jsxs)("div",{className:`vf is-${b}`,ref:n,style:{"--vl-left":"0px","--hx":"0px"},children:[a.meta.length>0&&(0,d.jsx)("div",{className:"gx-meta",children:a.meta.join(" \xb7 ")}),(0,d.jsx)("div",{className:"vf-main",children:(0,d.jsx)(bg,{count:k.length,width:m,render:b=>{let f=k[b],g="line"===f.t&&r?.hunk===f.hunk;return(0,d.jsx)(bh,{row:f,path:c,ws:j,actions:"hunk"!==f.t||e&&f.idx===a.hunks.length-1?void 0:u,picking:"hunk"===f.t||g?r:void 0,onPick:g?t:void 0},b)}})}),"split"===b&&p.max>0&&(0,d.jsx)("div",{className:"hbar",ref:o,onScroll:a=>n.current?.style.setProperty("--hx",`${a.currentTarget.scrollLeft}px`),"aria-label":"Scroll sideways",children:(0,d.jsx)("div",{style:{width:p.track+p.max,height:1}})})]})}let bj={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"U",conflict:"!",typechange:"T"};function bk({status:a,titled:b=!1}){let{t:c}=(0,O.s9)();return(0,d.jsx)("span",{className:`stl st-${a}`,title:b?c(`git.status.${a}`):void 0,children:bj[a]})}function bl(a){let b=a.split("\n"),c=[];for(let a=0;a<b.length;a++){if(!/^<{7}( |$)/.test(b[a]))continue;let d=-1,e=-1,f=-1;for(let c=a+1;c<b.length&&!/^<{7}( |$)/.test(b[c]);c++)if(/^\|{7}( |$)/.test(b[c])&&d<0)e=c;else if("======="===b[c]&&d<0)d=c;else if(/^>{7}( |$)/.test(b[c])&&d>=0){f=c;break}d<0||f<0||(c.push({start:a,end:f,ours:b.slice(a+1,e>=0?e:d),base:e>=0?b.slice(e+1,d):void 0,theirs:b.slice(d+1,f),oursLabel:b[a].slice(8).trim(),theirsLabel:b[f].slice(8).trim()}),a=f)}return c}function bm(a,b,c){let d=bl(a)[b];if(!d)return a;let e={ours:d.ours,theirs:d.theirs,"ours-theirs":[...d.ours,...d.theirs],"theirs-ours":[...d.theirs,...d.ours]}[c],f=a.split("\n");return f.splice(d.start,d.end-d.start+1,...e),f.join("\n")}function bn({value:a,onChange:b,path:c,id:e,label:g}){let h=a6(),i=(0,f.useRef)(null),j=(0,f.useRef)(null),k=(0,f.useRef)(0),[l,m]=(0,f.useState)({top:0,h:600}),n=a_(a,c,150),o=(0,f.useMemo)(()=>a.split("\n"),[a]),p=(0,f.useMemo)(()=>o.reduce((a,b)=>Math.max(a,b.length),0),[o]),q=String(n.length).length+2,r=Math.max(0,Math.floor(l.top/20)-20),s=Math.min(n.length,Math.ceil((l.top+l.h)/20)+20),t=[];for(let a=r;a<s;a++){let b=o[a]??"",c=/^(<{7}|>{7})( |$)/.test(b)?"mk-edge":"======="===b?"mk-mid":"";t.push((0,d.jsxs)("div",{className:`ce-row ${c}`,children:[(0,d.jsx)("span",{className:"ce-no",children:a+1}),(0,d.jsx)("span",{className:"ce-code",children:(0,d.jsx)(bc,{html:n[a],ws:h.whitespace})})]},a))}return(0,d.jsxs)("div",{className:"ce",style:{"--g-tab":h.tabSize,"--ce-gw":`${q}ch`},children:[(0,d.jsx)("div",{className:"ce-layer",ref:j,"aria-hidden":!0,children:(0,d.jsx)("div",{className:"ce-space",style:{height:20*o.length,minWidth:`calc(${q}ch + ${p}ch + 40px)`},children:(0,d.jsx)("div",{className:"ce-win",style:{top:20*r},children:t})})}),(0,d.jsx)("textarea",{ref:i,id:e,"aria-label":g,className:"ce-area",value:a,spellCheck:!1,wrap:"off",onChange:a=>b(a.target.value),onScroll:()=>{let a=i.current,b=j.current;a&&b&&(b.scrollTop=a.scrollTop,b.scrollLeft=a.scrollLeft,cancelAnimationFrame(k.current),k.current=requestAnimationFrame(()=>m(b=>b.top===a.scrollTop&&b.h===a.clientHeight?b:{top:a.scrollTop,h:a.clientHeight})))},onKeyDown:c=>{if("Tab"!==c.key)return;c.preventDefault();let d=c.currentTarget,e=d.selectionStart,f=d.selectionEnd,g=" ".repeat(h.tabSize);if(e===f&&!c.shiftKey){b(a.slice(0,e)+g+a.slice(f)),requestAnimationFrame(()=>d.setSelectionRange(e+g.length,e+g.length));return}let i=a.lastIndexOf("\n",e-1)+1,j=a.indexOf("\n",f),k=-1===j?a.length:j,l=a.slice(i,k).split("\n").map(a=>c.shiftKey?a.replace(RegExp(`^ {1,${h.tabSize}}`),""):g+a).join("\n");b(a.slice(0,i)+l+a.slice(k)),requestAnimationFrame(()=>d.setSelectionRange(i,i+l.length))}})]})}function bo({agent:a,path:b,state:c,a:e,onResolved:g}){let{t:h}=(0,O.s9)(),[i,j]=(0,f.useState)(null),[k,m]=(0,f.useState)(""),[n,o]=(0,f.useState)(null),[p,q]=(0,f.useState)(0),r=(0,f.useMemo)(()=>bl(k),[k]),s="rebase"!==c&&"stash"!==c,t=a=>"mine"===a===s?"ours":"theirs",u=a=>"both-mine"===a?s?"ours-theirs":"theirs-ours":"both-remote"===a?s?"theirs-ours":"ours-theirs":t(a),v=/^(<{7}|>{7})( |$)/m.test(k),w=!!i&&!i.binary&&!i.truncated,x=!!e.busy,y=async a=>{await e.run("resolve",h("git.res.done"),"resolve-side",{path:b,side:t(a)})&&g()},z=async()=>{await e.run("resolve",h("git.res.done"),"resolve",{path:b,content:k})&&g()},A=async()=>{await e.run("unresolve",h("git.res.restored"),"unresolve",{path:b})&&q(a=>a+1)},B=b.lastIndexOf("/"),C=B>=0?b.slice(0,B+1):"",D=b.slice(B+1);return(0,d.jsxs)("section",{className:"gx-preview gx-resolver","aria-label":b,children:[(0,d.jsxs)("header",{className:"gx-phead",children:[(0,d.jsxs)("div",{className:"gx-ptitle",children:[(0,d.jsxs)("span",{className:"gx-path mono",title:b,children:[(0,d.jsx)("span",{className:"dir",children:C}),(0,d.jsx)("b",{children:D})]}),(0,d.jsx)("span",{className:"gx-chip st-conflict",children:h("git.status.conflict")}),w&&(0,d.jsx)("span",{className:"muted small",children:r.length>0?h("git.res.left",{count:r.length}):h("git.res.none")})]}),(0,d.jsxs)("div",{className:"gx-ptools",children:[(0,d.jsx)("button",{className:"btn sm",disabled:x,title:h("git.res.allMine.hint"),onClick:()=>void y("mine"),children:h("git.res.allMine")}),(0,d.jsx)("button",{className:"btn sm",disabled:x,title:h("git.res.allRemote.hint"),onClick:()=>void y("remote"),children:h("git.res.allRemote")}),(0,d.jsx)(G.WQ,{text:b,label:h("git.copyPath")})]})]}),n?(0,d.jsx)("p",{className:"gx-note err",children:n}):i?w?(0,d.jsxs)("div",{className:"gx-rbody",children:[r.length>0&&(0,d.jsx)("div",{className:"gx-rblocks",children:r.map((a,e)=>(0,d.jsxs)("div",{className:"gx-rcard",children:[(0,d.jsxs)("div",{className:"gx-rtitle",children:[(0,d.jsx)("b",{children:h("git.res.block",{n:e+1,total:r.length})}),(0,d.jsx)("span",{className:"muted small",children:h("git.res.line",{n:a.start+1})})]}),(0,d.jsx)("div",{className:"gx-rsides",children:["mine","remote"].map(f=>{let g,i="ours"===t(f)?a.ours:a.theirs,j=!(g="ours"===t(f)?a.oursLabel:a.theirsLabel)||["HEAD","ours","theirs","Updated upstream","Stashed changes"].includes(g)?"":g;return(0,d.jsxs)("div",{className:`gx-rside ${f}`,children:[(0,d.jsxs)("div",{className:"gx-rhead",children:[(0,d.jsx)("span",{children:"mine"===f?"stash"===c?h("git.res.mine.stash"):h("git.res.mine"):"stash"===c?h("git.res.remote.stash"):h("git.res.remote")}),j&&(0,d.jsx)("i",{className:"ref",children:j})]}),(0,d.jsx)("pre",{children:i.length?(0,d.jsx)(bd,{text:i.join("\n"),path:b}):(0,d.jsx)("span",{className:"muted",children:h("git.res.empty")})}),(0,d.jsx)("button",{className:"btn sm",onClick:()=>m(a=>bm(a,e,u(f))),children:"mine"===f?h("git.res.keepMine"):h("git.res.keepRemote")})]},f)})}),(0,d.jsxs)("div",{className:"gx-rboth",children:[(0,d.jsxs)("span",{className:"small muted",children:[h("git.res.both"),":"]}),(0,d.jsx)("button",{className:"btn sm",onClick:()=>m(a=>bm(a,e,u("both-mine"))),children:h("git.res.bothMine")}),(0,d.jsx)("button",{className:"btn sm",onClick:()=>m(a=>bm(a,e,u("both-remote"))),children:h("git.res.bothRemote")})]})]},`${e}-${a.start}`))}),(0,d.jsxs)("div",{className:"gx-rresult",children:[(0,d.jsxs)("div",{className:"row",children:[(0,d.jsx)("label",{className:"label grow",htmlFor:"gx-result",children:h("git.res.result")}),(0,d.jsx)("span",{className:"small muted",children:h("git.res.editHint")})]}),(0,d.jsx)(bn,{id:"gx-result",label:h("git.res.result"),value:k,path:b,onChange:m})]}),(0,d.jsxs)("footer",{className:"gx-rfoot",children:[(0,d.jsxs)("button",{className:"btn ghost sm",disabled:x,onClick:()=>void A(),title:h("git.res.restore.hint"),children:[(0,d.jsx)(l,{size:14}),h("git.res.restore")]}),(0,d.jsx)("span",{className:"grow"}),(0,d.jsx)("button",{className:"btn primary",disabled:x||v,onClick:()=>void z(),children:h("git.res.markResolved")})]})]}):(0,d.jsx)("p",{className:"gx-note",children:h("git.res.noEdit")}):(0,d.jsx)("p",{className:"gx-note",children:h("git.loading")})]})}function bp({agent:a,plan:b,a:c,onClose:e,onGo:f}){let{t:g}=(0,O.s9)();return(0,d.jsxs)(F.aF,{title:g("git.sw.title",{branch:b.to}),onClose:e,children:[b.carried>0&&(0,d.jsx)("p",{className:"muted",style:{margin:0},children:g("git.sw.carried",{count:b.carried,from:b.from})}),(0,d.jsxs)("div",{className:"gx-sw-warn",role:"alert",children:[b.selfRunning&&(0,d.jsx)("div",{children:g("git.warn.running",{name:a.name})}),b.others.length>0&&(0,d.jsx)("div",{children:g("git.sw.others",{count:b.others.length,names:b.others.map(a=>a.name).join(", ")})})]}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:e,children:g("common.cancel")}),(0,d.jsx)("button",{className:"btn primary",disabled:!!c.busy,onClick:f,children:g("git.sw.anyway")})]})]})}let bq=(0,j.A)("PackagePlus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]),br=(0,j.A)("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);var bs=c(34410);function bt({stashes:a,sel:b,onSelect:c,onSave:e,canSave:f}){let{t:g}=(0,O.s9)();return(0,d.jsxs)("div",{className:"gx-stashes",children:[(0,d.jsx)("div",{className:"gx-stash-head",children:(0,d.jsxs)("button",{className:"btn sm",disabled:!f,title:f?void 0:g("git.stash.nothing"),onClick:e,children:[(0,d.jsx)(bq,{size:14}),g("git.stash.save")]})}),a?0===a.length?(0,d.jsx)("p",{className:"gx-note",children:g("git.stash.empty")}):(0,d.jsx)("div",{className:"gx-hist",role:"listbox","aria-label":g("git.tab.stashes"),children:a.map(a=>(0,d.jsxs)("button",{role:"option","aria-selected":b===a.sha,className:`gx-commit ${b===a.sha?"sel":""}`,onClick:()=>c(a.sha),children:[(0,d.jsx)("span",{className:"subj",children:a.message||"—"}),(0,d.jsxs)("span",{className:"meta",children:[a.branch&&(0,d.jsxs)(d.Fragment,{children:[a.branch," \xb7 "]}),(0,t.KN)(Date.parse(a.date))]}),a.smart&&(0,d.jsx)("span",{className:"refs",children:(0,d.jsx)("i",{className:"ref",children:g("git.stash.smart")})})]},a.sha))}):(0,d.jsx)("p",{className:"gx-note",children:g("git.loading")})]})}function bu({a,onClose:b}){let{t:c}=(0,O.s9)(),[e,g]=(0,f.useState)(""),h=async()=>{b(),await a.run("stash",c("git.stash.saved"),"stash-save",{message:e})};return(0,d.jsxs)(F.aF,{title:c("git.stash.save"),onClose:b,children:[(0,d.jsx)("p",{className:"muted",style:{margin:0},children:c("git.stash.save.body")}),(0,d.jsx)("input",{className:"input",autoFocus:!0,value:e,maxLength:200,placeholder:c("git.stash.save.placeholder"),onChange:a=>g(a.target.value),onKeyDown:a=>{"Enter"===a.key&&h()},"aria-label":c("git.stash.save.placeholder")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:b,children:c("common.cancel")}),(0,d.jsx)("button",{className:"btn primary",disabled:!!a.busy,onClick:()=>void h(),children:c("git.stash.save")})]})]})}function bv({agent:a,stash:b,a:c}){let{t:e}=(0,O.s9)(),[g,h]=(0,f.useState)(null),[i,j]=(0,f.useState)(null),[k,l]=(0,f.useState)(null),[m,n]=(0,f.useState)(null),[o,p]=(0,f.useState)(!1),[q,r]=(0,f.useState)(null),s=(0,f.useMemo)(()=>m?at(m.diff):null,[m]),u=!!c.busy,v=a=>void c.run("stash",a?e("git.stash.popped"):e("git.stash.applied"),"stash-apply",{sha:b.sha,pop:a}),w=(i?.files.length??0)+(g?.untracked.length??0);return(0,d.jsxs)("section",{className:"gx-preview gx-commitview","aria-label":b.message,children:[(0,d.jsxs)("header",{className:"gx-chead",children:[(0,d.jsx)("h3",{children:b.message||"—"}),(0,d.jsxs)("div",{className:"muted small row gap-s wrap",children:[(0,d.jsxs)("span",{children:[b.branch&&`${b.branch} \xb7 `,(0,t.KN)(Date.parse(b.date))]}),g&&(0,d.jsxs)("span",{children:["\xb7 ",e("git.hist.files",{count:w})]})]}),(0,d.jsxs)("div",{className:"row gap-s wrap",children:[(0,d.jsxs)("button",{className:"btn sm",disabled:u,title:e("git.stash.apply.hint"),onClick:()=>v(!1),children:[(0,d.jsx)(br,{size:14}),e("git.stash.apply")]}),(0,d.jsx)("button",{className:"btn sm primary",disabled:u,title:e("git.stash.pop.hint"),onClick:()=>v(!0),children:e("git.stash.pop")}),(0,d.jsxs)("button",{className:"btn sm danger",disabled:u,onClick:()=>p(!0),children:[(0,d.jsx)(bs.A,{size:14}),e("git.stash.drop")]})]})]}),q?(0,d.jsx)("p",{className:"gx-note err",children:q}):i&&g?0===w?(0,d.jsx)("p",{className:"gx-note",children:e("git.hist.noFiles")}):(0,d.jsxs)("div",{className:"gx-cfilelist",role:"listbox",children:[i.files.map(a=>(0,d.jsxs)("button",{role:"option","aria-selected":k?.path===a.path&&!k.untracked,className:`gx-cfile ${k?.path===a.path&&!k.untracked?"sel":""}`,onClick:()=>l({path:a.path,untracked:!1,oldPath:a.oldPath}),children:[(0,d.jsx)(bk,{status:a.status}),(0,d.jsx)("span",{className:"mono nm",children:a.path}),(null!==a.additions||null!==a.deletions)&&(0,d.jsxs)("span",{className:"gx-counts sm",children:[(0,d.jsxs)("i",{className:"add",children:["+",a.additions??0]}),(0,d.jsxs)("i",{className:"del",children:["−",a.deletions??0]})]})]},`t-${a.path}`)),g.untracked.map(a=>(0,d.jsxs)("button",{role:"option","aria-selected":k?.path===a&&k.untracked,className:`gx-cfile ${k?.path===a&&k.untracked?"sel":""}`,onClick:()=>l({path:a,untracked:!0}),children:[(0,d.jsx)(bk,{status:"untracked"}),(0,d.jsx)("span",{className:"mono nm",children:a})]},`u-${a}`))]}):(0,d.jsx)("p",{className:"gx-note",children:e("git.loading")}),k&&(0,d.jsx)("div",{className:"gx-body",children:s?s.binary?(0,d.jsx)("p",{className:"gx-note",children:e("git.diff.binary")}):0===s.hunks.length?(0,d.jsx)("p",{className:"gx-note",children:e("git.diff.empty")}):(0,d.jsx)(bi,{parsed:s,layout:"unified",path:k.path,cutOff:!!m?.truncated}):(0,d.jsx)("p",{className:"gx-note",children:e("git.loading")})}),o&&(0,d.jsxs)(F.aF,{title:e("git.stash.drop.title"),onClose:()=>p(!1),children:[(0,d.jsx)("p",{className:"muted",style:{margin:0},children:e("git.stash.drop.body",{name:b.message||"—"})}),(0,d.jsx)("p",{className:"gx-lost",children:e("git.discard.all.warn")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:()=>p(!1),children:e("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",disabled:u,onClick:()=>{p(!1),c.run("stash",e("git.stash.dropped"),"stash-drop",{sha:b.sha})},children:e("git.stash.drop")})]})]})]})}let bw=(0,j.A)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),bx=(0,j.A)("CloudDownload",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]),by=(0,j.A)("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),bz=(0,j.A)("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]),bA=(0,j.A)("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);function bB({a}){let{t:b}=(0,O.s9)(),c=a.notice;return c?(0,d.jsxs)("div",{className:"gx-notice err",role:"alert",children:[(0,d.jsxs)("div",{className:"row",children:[(0,d.jsx)("b",{className:"grow",children:c.title}),(0,d.jsx)("button",{className:"btn ghost icon sm",onClick:()=>a.setNotice(null),"aria-label":b("common.close"),children:(0,d.jsx)(an.A,{size:14})})]}),(0,d.jsx)("pre",{children:c.text}),c.diverged&&(0,d.jsxs)("div",{className:"row gap-s wrap",children:[(0,d.jsx)("span",{className:"small muted",children:b("git.notice.diverged")}),(0,d.jsx)("button",{className:"btn sm",disabled:!!a.busy,onClick:()=>void a.run("pull",b("git.done.pull"),"pull",{mode:"merge"}),children:b("git.pull.merge")}),(0,d.jsx)("button",{className:"btn sm",disabled:!!a.busy,onClick:()=>void a.run("pull",b("git.done.pull"),"pull",{mode:"rebase"}),children:b("git.pull.rebase")})]})]}):null}function bC({a,ahead:b,behind:c,detached:e,changeCount:f,onCommit:g}){let{t:h}=(0,O.s9)(),i=!!a.busy;return(0,d.jsxs)("div",{className:"gx-acts",role:"group","aria-label":h("git.act.group"),children:[(0,d.jsxs)("button",{className:"btn sm",disabled:i,title:h("git.act.fetch.hint"),onClick:()=>void a.run("fetch",h("git.done.fetch"),"fetch"),children:["fetch"===a.busy?(0,d.jsx)(bw,{size:14,className:"spin"}):(0,d.jsx)(bx,{size:14}),h("git.act.fetch")]}),(0,d.jsxs)("button",{className:"btn sm",disabled:i,title:h("git.act.pull.hint"),onClick:()=>void a.run("pull",h("git.done.pull"),"pull"),children:["pull"===a.busy?(0,d.jsx)(bw,{size:14,className:"spin"}):(0,d.jsx)(by,{size:14}),h("git.act.pull"),c>0&&(0,d.jsx)("span",{className:"ct",children:c})]}),(0,d.jsxs)("button",{className:"btn sm",disabled:i||e,title:h("git.act.push.hint"),onClick:()=>void a.run("push",h("git.done.push"),"push"),children:["push"===a.busy?(0,d.jsx)(bw,{size:14,className:"spin"}):(0,d.jsx)(D,{size:14}),h("git.act.push"),b>0&&(0,d.jsx)("span",{className:"ct",children:b})]}),(0,d.jsxs)("button",{className:"btn sm primary",disabled:i||0===f,title:0===f?h("git.commit.nothing"):void 0,onClick:g,children:["commit"===a.busy?(0,d.jsx)(bw,{size:14,className:"spin"}):(0,d.jsx)(bz,{size:14}),h("git.act.commit"),f>0&&(0,d.jsx)("span",{className:"ct",children:f})]})]})}function bD({agent:a,a:b,current:c,onSwitch:e}){let{t:g}=(0,O.s9)(),[h,i]=(0,f.useState)(!1),[j,k]=(0,f.useState)(null),[l,m]=(0,f.useState)(""),[n,o]=(0,f.useState)(""),[p,q]=(0,f.useState)(null),[r,s]=(0,f.useState)(""),u=(0,f.useRef)(null);(0,a9.s)(h,u,()=>i(!1));let v=(0,f.useMemo)(()=>(j?.local??[]).filter(a=>a.name.toLowerCase().includes(l.toLowerCase())),[j,l]),w=(0,f.useMemo)(()=>{let a=new Set((j?.local??[]).map(a=>a.name));return(j?.remote??[]).filter(b=>!a.has(b.name.split("/").slice(1).join("/"))&&b.name.toLowerCase().includes(l.toLowerCase()))},[j,l]),x=async(a,c,d,e)=>{i(!1),await b.run(a,c,d,e)},y=/^[\w./-]+$/.test(n)&&!n.startsWith("-")&&!n.endsWith("/")&&!n.includes("..");return(0,d.jsxs)("div",{className:"gx-brmenu",ref:u,children:[(0,d.jsxs)("button",{type:"button",className:"btn sm","aria-expanded":h,"aria-haspopup":"menu",onClick:()=>i(a=>!a),children:[(0,d.jsx)(ar,{size:14}),g("git.act.branches"),(0,d.jsx)($.A,{size:13})]}),h&&(0,d.jsxs)("div",{className:"gx-pop",role:"menu",children:[(0,d.jsxs)("div",{className:"search",children:[(0,d.jsx)(ad.A,{size:14}),(0,d.jsx)("input",{className:"input",autoFocus:!0,placeholder:g("git.br.search"),value:l,onChange:a=>m(a.target.value),"aria-label":g("git.br.search")})]}),(0,d.jsxs)("div",{className:"gx-newbr",children:[(0,d.jsx)("input",{className:"input mono",placeholder:g("git.br.newPlaceholder"),value:n,onChange:a=>o(a.target.value.trim()),"aria-label":g("git.br.new",{branch:c??""}),onKeyDown:a=>{"Enter"===a.key&&y&&x("switch",g("git.done.switch",{branch:n}),"switch",{branch:n,create:!0})}}),(0,d.jsxs)("button",{className:"btn sm",disabled:!y||!!b.busy,title:g("git.br.new",{branch:c??"…"}),onClick:()=>void x("switch",g("git.done.switch",{branch:n}),"switch",{branch:n,create:!0}),children:[(0,d.jsx)(ac.A,{size:14}),g("git.br.create")]})]}),r&&(0,d.jsx)("p",{className:"gx-note err",children:r}),(0,d.jsxs)("div",{className:"gx-brlist",children:[v.length>0&&(0,d.jsx)("div",{className:"gx-brhead",children:g("git.br.local")}),v.map(a=>(0,d.jsxs)("div",{className:`gx-br ${a.name===c?"cur":""}`,children:[(0,d.jsxs)("button",{className:"grow",disabled:a.name===c||!!b.busy,onClick:()=>{i(!1),e(a.name)},title:g("git.br.switchTo",{branch:a.name}),children:[(0,d.jsxs)("span",{className:"nm",children:[a.name===c&&(0,d.jsx)(a8.A,{size:13}),a.name]}),(0,d.jsxs)("span",{className:"sub",children:[a.subject," \xb7 ",(0,t.KN)(Date.parse(a.date))]})]}),a.name!==c&&(0,d.jsx)("button",{className:"btn ghost icon sm",disabled:!!b.busy,onClick:()=>q(a.name),"aria-label":g("git.br.merge",{branch:c??""}),title:g("git.br.merge",{branch:c??""}),children:(0,d.jsx)(bA,{size:14})})]},a.name)),w.length>0&&(0,d.jsx)("div",{className:"gx-brhead",children:g("git.br.remote")}),w.map(a=>(0,d.jsxs)("div",{className:"gx-br",children:[(0,d.jsxs)("button",{className:"grow",disabled:!!b.busy,onClick:()=>{let b=a.name.split("/").slice(1).join("/");i(!1),e(b)},title:g("git.br.switchTo",{branch:a.name}),children:[(0,d.jsx)("span",{className:"nm",children:a.name}),(0,d.jsxs)("span",{className:"sub",children:[a.subject," \xb7 ",(0,t.KN)(Date.parse(a.date))]})]}),(0,d.jsx)("button",{className:"btn ghost icon sm",disabled:!!b.busy,onClick:()=>q(a.name),"aria-label":g("git.br.merge",{branch:c??""}),title:g("git.br.merge",{branch:c??""}),children:(0,d.jsx)(bA,{size:14})})]},a.name)),j&&!v.length&&!w.length&&(0,d.jsx)("p",{className:"gx-note",children:g("git.br.none")})]}),p&&(0,d.jsxs)("div",{className:"gx-mergeask",children:[(0,d.jsx)("span",{children:g("git.br.mergeAsk",{from:p,into:c??""})}),(0,d.jsxs)("div",{className:"row gap-s",children:[(0,d.jsx)("button",{className:"btn ghost sm",onClick:()=>q(null),children:g("common.cancel")}),(0,d.jsx)("button",{className:"btn primary sm",disabled:!!b.busy,onClick:()=>void x("merge",g("git.done.merge",{branch:p}),"merge",{branch:p}),children:g("git.br.mergeGo")})]})]})]})]})}function bE({changes:a,a:b,onClose:c,initialMessage:e=""}){let{t:g}=(0,O.s9)(),[h,i]=(0,f.useState)(()=>new Set(a.map(a=>a.path))),[j,k]=(0,f.useState)(e),l=a.filter(a=>h.has(a.path)),m=l.flatMap(a=>a.oldPath?[a.path,a.oldPath]:[a.path]),n=!!j.trim()&&l.length>0&&!b.busy,o=async a=>{if(!await b.run("commit",g("git.done.commit"),"commit",{message:j,paths:m}))return void c();c(),a&&await b.run("push",g("git.done.push"),"push")};return(0,d.jsxs)(F.aF,{title:g("git.commit.title"),onClose:c,children:[(0,d.jsxs)("div",{className:"gx-cfiles",children:[(0,d.jsxs)("div",{className:"row",children:[(0,d.jsx)("span",{className:"small muted grow",children:g("git.commit.selected",{n:l.length,total:a.length})}),(0,d.jsx)("button",{className:"btn ghost sm",onClick:()=>i(new Set(a.map(a=>a.path))),children:g("git.commit.all")}),(0,d.jsx)("button",{className:"btn ghost sm",onClick:()=>i(new Set),children:g("git.commit.none")})]}),(0,d.jsx)("div",{className:"gx-clist",children:a.map(a=>(0,d.jsxs)("label",{className:"gx-crow",title:a.path,children:[(0,d.jsx)("input",{type:"checkbox",checked:h.has(a.path),onChange:()=>{let b;return b=a.path,i(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})}}),(0,d.jsx)(bk,{status:a.status}),(0,d.jsx)("span",{className:"mono nm",children:a.path}),(null!==a.additions||null!==a.deletions)&&(0,d.jsxs)("span",{className:"gx-counts sm",children:[(0,d.jsxs)("i",{className:"add",children:["+",a.additions??0]}),(0,d.jsxs)("i",{className:"del",children:["−",a.deletions??0]})]})]},a.path))})]}),(0,d.jsxs)("div",{className:"field",children:[(0,d.jsx)("label",{children:g("git.commit.message")}),(0,d.jsx)("textarea",{className:"textarea",rows:4,autoFocus:!0,value:j,onChange:a=>k(a.target.value),placeholder:g("git.commit.placeholder"),onKeyDown:a=>{(a.ctrlKey||a.metaKey)&&"Enter"===a.key&&n&&o(!1)}}),(0,d.jsx)("span",{className:"hint",children:g("git.commit.hint")})]}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:c,children:g("common.cancel")}),(0,d.jsx)("button",{className:"btn",disabled:!n,onClick:()=>void o(!1),children:"commit"===b.busy?g("git.commit.committing"):g("git.commit.go")}),(0,d.jsx)("button",{className:"btn primary",disabled:!n,onClick:()=>void o(!0),children:g("git.commit.goPush")})]})]})}function bF({agent:a,head:b,sel:c,onSelect:e}){let{t:g}=(0,O.s9)(),[h,i]=(0,f.useState)(null),[j,k]=(0,f.useState)(!1),[l,m]=(0,f.useState)(!1),[n,o]=(0,f.useState)(""),p=async b=>{m(!0);try{let c=await s.F.get(`/agents/${a.id}/git/log?skip=${b}`);i(a=>0===b?c.commits:[...a??[],...c.commits]),k(c.hasMore),o("")}catch(a){o(a instanceof Error?a.message:"error")}finally{m(!1)}};return n?(0,d.jsx)("p",{className:"gx-note err",children:n}):h?h.length?(0,d.jsxs)("div",{className:"gx-hist",role:"listbox","aria-label":g("git.tab.history"),children:[h.map(a=>(0,d.jsxs)("button",{role:"option","aria-selected":c===a.sha,className:`gx-commit ${c===a.sha?"sel":""}`,onClick:()=>e(a.sha),children:[(0,d.jsx)("span",{className:"subj",children:a.subject||"—"}),(0,d.jsxs)("span",{className:"meta",children:[(0,d.jsx)("span",{className:"mono sha",children:a.short})," \xb7 ",a.author," \xb7 ",(0,t.KN)(Date.parse(a.date))]}),(a.refs.length>0||a.merge)&&(0,d.jsxs)("span",{className:"refs",children:[a.merge&&(0,d.jsx)("i",{className:"ref",children:g("git.hist.merge")}),a.refs.slice(0,3).map(a=>(0,d.jsx)("i",{className:"ref",children:a},a))]})]},a.sha)),j&&(0,d.jsx)("button",{className:"btn sm",style:{margin:10},disabled:l,onClick:()=>void p(h.length),children:l?g("git.loading"):g("git.hist.more")})]}):(0,d.jsx)("p",{className:"gx-note",children:g("git.hist.empty")}):(0,d.jsx)("p",{className:"gx-note",children:g("git.loading")})}function bG({files:a,all:b,summary:c,file:e,busy:f,onConfirm:g,onClose:h}){let{t:i}=(0,O.s9)(),j=(0,d.jsxs)("ul",{className:"gx-dlist",children:[a.slice(0,8).map(a=>(0,d.jsx)("li",{className:"mono",children:a},a)),a.length>8&&(0,d.jsx)("li",{className:"muted",children:i("hover.more",{count:a.length-8})})]});if(!b&&e&&!a.length){let a=e.add||e.del?` (+${e.add} −${e.del})`:"";return(0,d.jsxs)(F.aF,{title:i("git.discard.file.title"),onClose:h,children:[(0,d.jsx)("p",{className:"gx-file-eff mono",children:e.path}),(0,d.jsx)("p",{style:{margin:0},children:"deleted"===e.status?i("git.discard.file.deleted"):"renamed"===e.status?i("git.discard.file.renamed",{from:e.oldPath??""}):i("git.discard.file.modified",{lines:a})}),(0,d.jsx)("p",{className:"gx-lost",children:i("git.discard.all.warn")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:h,children:i("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",disabled:f,onClick:g,children:i("git.discard.file.go")})]})]})}return b?(0,d.jsxs)(F.aF,{title:i("git.discard.all.title"),onClose:h,children:[(0,d.jsxs)("ul",{className:"gx-effects",children:[c&&c.restore>0&&(0,d.jsx)("li",{children:i("git.discard.all.restore",{count:c.restore})}),a.length>0&&(0,d.jsxs)("li",{className:"bad",children:[(0,d.jsx)("b",{children:i("git.discard.all.delete",{count:a.length})}),j]})]}),c&&(0,d.jsx)("p",{className:"muted small",style:{margin:0},children:i("git.discard.all.lines",{add:c.add,del:c.del})}),(0,d.jsx)("p",{className:"gx-lost",children:i("git.discard.all.warn")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:h,children:i("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",disabled:f,onClick:g,children:i("git.discard.all.go")})]})]}):(0,d.jsxs)(F.aF,{title:i("git.discard.confirm.title"),onClose:h,children:[(0,d.jsx)("p",{className:"muted",style:{margin:0},children:i("git.discard.confirm.body",{count:a.length})}),j,(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:h,children:i("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",disabled:f,onClick:g,children:i("git.discard.confirm.go")})]})]})}let bH=/\.(md|markdown|mdx)$/i,bI=/\.(png|jpe?g|gif|webp|svg|ico|bmp|avif)$/i;function bJ({name:a}){return bI.test(a)?(0,d.jsx)(ai,{size:15}):/\.(md|mdx|txt|rst)$/i.test(a)?(0,d.jsx)(aj.A,{size:15}):aX(a)?(0,d.jsx)(ak,{size:15}):(0,d.jsx)(al,{size:15})}function bK({path:a,hunk:b,index:c,total:e,extent:g,onClose:h,onGo:i}){let{t:j}=(0,O.s9)(),k=(0,f.useMemo)(()=>({meta:[],hunks:[b],binary:!1}),[b]),l=b.lines.length+1;return(0,d.jsxs)("div",{className:"vl-peek",role:"dialog","aria-label":j("git.peek.title"),onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"vl-peek-head",children:[(0,d.jsx)("b",{children:g?g.from===g.to?j("git.peek.line",{n:g.from}):j("git.peek.lines",{from:g.from,to:g.to}):j("git.peek.title")}),(0,d.jsx)("span",{className:"muted mono small grow",children:au(b.header)}),(0,d.jsx)("span",{className:"small muted",children:j("git.peek.count",{n:c+1,total:e})}),(0,d.jsx)("button",{type:"button",className:"btn ghost icon sm",disabled:c<=0,onClick:()=>i(c-1),"aria-label":j("git.peek.prev"),title:`${j("git.peek.prev")} (Alt+↑)`,children:(0,d.jsx)(am.A,{size:15})}),(0,d.jsx)("button",{type:"button",className:"btn ghost icon sm",disabled:c>=e-1,onClick:()=>i(c+1),"aria-label":j("git.peek.next"),title:`${j("git.peek.next")} (Alt+↓)`,children:(0,d.jsx)($.A,{size:15})}),(0,d.jsx)("button",{type:"button",className:"btn ghost icon sm",onClick:h,"aria-label":j("common.close"),children:(0,d.jsx)(an.A,{size:14})})]}),(0,d.jsx)("div",{className:"vl-peek-body",style:{height:Math.min(20*l+4,260)},children:(0,d.jsx)(bi,{parsed:k,layout:"unified",path:a,firstIndex:c})})]})}function bL({f:a,agent:b,blame:c,onOpenCommit:e,marks:g,allNew:h}){let i=g?.groups??[],[j,k]=(0,f.useState)(null),l=(0,f.useMemo)(()=>{let b=a.content.split("\n").length;return i.map(a=>({from:Math.min(a.from,b),to:Math.min(a.to,b)}))},[i,a.content]),m=j?l[j.block]??null:null,[n,o]=(0,f.useState)(),p=(b,c)=>{let d={from:b.from,to:Math.min(b.to,a.content.split("\n").length)};return(d.to-(c+1)<=25?Math.max(d.to,c+1):c+1)*20},q=a=>34+Math.min((a.view.lines.length+1)*20+4,260)+14,{t:r}=(0,O.s9)(),{whitespace:s}=a6(),[u,v]=(0,f.useState)(null),[w,x]=(0,f.useState)(null),y=a_(a.content,a.path),z=(0,f.useMemo)(()=>y.length&&""===y[y.length-1]?y.slice(0,-1):y,[y]),A=(0,f.useMemo)(()=>a.content.split("\n").reduce((a,b)=>Math.max(a,b.length),0),[a.content]),B=(0,f.useMemo)(()=>{if(!u)return null;let a=-1;return u.lines.map((b,c)=>{let d=b!==u.lines[c-1];return d&&a++,{first:d,g:a%2}})},[u]);if(a.binary)return(0,d.jsx)("p",{className:"gx-note",children:r("git.file.binary")});if(0===z.length)return(0,d.jsx)("p",{className:"gx-note",children:r("git.file.empty")});let C=210*!!u;return(0,d.jsxs)("div",{className:"vf",children:["head"===a.source&&(0,d.jsx)("div",{className:"gx-banner",children:r("git.file.deleted")}),a.truncated&&(0,d.jsx)("div",{className:"gx-banner",children:r("git.file.truncated")}),w&&(0,d.jsx)("div",{className:"gx-banner",children:w}),u?.truncated&&(0,d.jsx)("div",{className:"gx-banner",children:r("git.blame.truncated",{count:u.lines.length})}),(0,d.jsx)("div",{className:"vf-main",style:{"--vl-left":`${C}px`},children:(0,d.jsx)(bg,{count:z.length,width:`calc(${C}px + 6ch + ${A}ch + 40px)`,overlay:j&&i[j.block]?{top:p(i[j.block],j.row),node:(0,d.jsx)(bK,{path:a.path,hunk:i[j.block].view,index:j.block,extent:m,onClose:()=>k(null),total:i.length,onGo:a=>{let b=l[a];if(!b)return;let c=Math.max(0,b.from-1);k({row:c,block:a}),o({top:20*c,bottom:p(i[a],c)+q(i[a]),key:Date.now()})}})}:void 0,reveal:n,render:b=>{let c=u?.lines[b],f=c?u.commits[c]:void 0,l=B?.[b],n="worktree"===a.source?h?"add":g?.lines.get(b+1):void 0,v=!!g&&g.removedBefore.has(b+1),w=!!g&&b===z.length-1&&g.removedBefore.has(z.length+1),x=g&&"worktree"===a.source?g.blockOfLine.get(b+1)??(v?g.blockOfRemoval.get(b+1):w?g.blockOfRemoval.get(z.length+1):void 0):void 0;return(0,d.jsxs)("div",{className:`vl-row ${l?`bl-g${l.g}`:""} ${n?`m-${n}`:""} ${v?"m-delb":w?"m-dela":""} ${void 0!==x?"has-peek":""} ${m&&b+1>=m.from&&b+1<=m.to?"in-peek":""}`,onClick:void 0!==x?a=>{if(!a.target.closest(".bl-btn")&&(a.target.closest(".vl-ln")||window.getSelection()?.isCollapsed)){if(j?.row===b)return void k(null);k({row:b,block:x}),o({top:20*b,bottom:p(i[x],b)+q(i[x]),key:Date.now()})}}:void 0,title:void 0!==x?r("git.peek.hint"):void 0,children:[u&&(0,d.jsx)("div",{className:`vl-bl ${l?.first?"first":""}`,children:l?.first&&f&&(f.uncommitted?(0,d.jsx)("span",{className:"muted",children:r("git.blame.uncommitted")}):(0,d.jsxs)("button",{type:"button",className:"bl-btn",title:`${f.summary}
|
|
3
|
+
${f.author} \xb7 ${(0,Q.v7)(f.time)}`,onClick:()=>e(c),children:[(0,d.jsx)("span",{className:"mono sha",children:f.short}),(0,d.jsx)("span",{className:"who",children:f.author}),(0,d.jsx)("span",{className:"when",children:(0,t.KN)(f.time)})]}))}),(0,d.jsx)("div",{className:"vl-ln",children:b+1}),(0,d.jsx)("div",{className:"vl-cd",children:(0,d.jsx)(bc,{html:z[b],ws:s})})]},b)}})})]})}function bM({agent:a,path:b,ignored:c=!1,change:e,stamp:g,onOpenCommit:h,onDiscard:i,onDiscardHunk:j,onDiscardLines:k}){let{t:l}=(0,O.s9)(),[m,n]=(0,f.useState)(!1),o=!!e&&!bI.test(b),p=bH.test(b),[q,r]=(0,f.useState)(o?"diff":p?"preview":"file"),[s,t]=(0,f.useState)("unified"),[w,x]=(0,f.useState)(null),[y,z]=(0,f.useState)(null),[A,B]=(0,f.useState)(null),[C,D]=(0,f.useState)(!1),[E,H]=(0,f.useState)(!1),I=bI.test(b),J=(0,f.useMemo)(()=>w&&w.path===b?at(w.diff):null,[w,b]),[K,L]=(0,f.useState)(null),M=e?.status==="untracked"||e?.status==="added"&&!e.oldPath,N=(0,f.useMemo)(()=>K&&K.path===b?at(K.diff):null,[K,b]),P=(0,f.useMemo)(()=>N?function(a){let b=new Map,c=new Set,d=new Map,e=new Map,f=[];for(let g of a.hunks){let a=g.lines,h=[],i=Number(/\+(\d+)/.exec(g.header)?.[1]??1);for(let b=0;b<a.length;b++)h[b]=i,"del"!==a[b].kind&&(i=(a[b].newNo??i)+1);let j=[];for(let b=0;b<a.length;){if("ctx"===a[b].kind){b++;continue}let c=b;for(;b<a.length&&"ctx"!==a[b].kind;)b++;j.push([c,b-1])}for(let[g,k]of j){let j=f.length,l=1/0,m=-1/0;for(let f=g;f<=k;){if("ctx"===a[f].kind){f++;continue}let g=[],n=[];for(;f<=k&&"del"===a[f].kind;)g.push(a[f++]);for(;f<=k&&"add"===a[f].kind;)n.push(a[f++]);n.forEach((a,c)=>{let e=a.newNo;b.set(e,c<g.length?"mod":"add"),d.set(e,j),l=Math.min(l,e),m=Math.max(m,e)});let o=n.length?n[n.length-1].newNo+1:f<a.length?h[f]:i;g.length>n.length&&(c.add(o),e.set(o,j),l=Math.min(l,o),m=Math.max(m,o))}let n=g;for(let b=0;b<3&&n>0&&"ctx"===a[n-1].kind;b++)n--;let o=k;for(let b=0;b<3&&o<a.length-1&&"ctx"===a[o+1].kind;b++)o++;let p=a.slice(n,o+1),q=p.filter(a=>void 0!==a.oldNo),r=p.filter(a=>void 0!==a.newNo);f.push({from:l,to:m,view:{header:`@@ -${q[0]?.oldNo??0},${q.length} +${r[0]?.newNo??0},${r.length} @@`,section:"",lines:p}})}}return{lines:b,removedBefore:c,blockOfLine:d,blockOfRemoval:e,groups:f}}(N):null,[N]),R=b.lastIndexOf("/"),S=R>=0?b.slice(0,R+1):"",T=b.slice(R+1);return(0,d.jsxs)("section",{className:"gx-preview","aria-label":b,children:[(0,d.jsxs)("header",{className:"gx-phead",children:[(0,d.jsxs)("div",{className:"gx-ptitle",children:[(0,d.jsxs)("span",{className:"gx-path mono",title:b,children:[(0,d.jsx)("span",{className:"dir",children:S}),(0,d.jsx)("b",{children:T})]}),c&&(0,d.jsx)("span",{className:"gx-chip soft",title:l("git.ignored.hint"),children:l("git.ignored.chip")}),e&&(0,d.jsx)("span",{className:`gx-chip st-${e.status}`,children:l(`git.status.${e.status}`)}),e?.staged&&(0,d.jsx)("span",{className:"gx-chip soft",children:l("git.staged")}),e?.unstaged&&"untracked"!==e.status&&(0,d.jsx)("span",{className:"gx-chip soft",children:l("git.unstaged")}),e&&(null!==e.additions||null!==e.deletions)&&(0,d.jsxs)("span",{className:"gx-counts",children:[(0,d.jsxs)("i",{className:"add",children:["+",e.additions??0]}),(0,d.jsxs)("i",{className:"del",children:["−",e.deletions??0]})]}),y&&!e&&(0,d.jsx)("span",{className:"muted small",children:(0,Q.zi)(y.size)})]}),(0,d.jsxs)("div",{className:"gx-ptools",children:[(e||p)&&(0,d.jsx)(F.$q,{value:q,onChange:r,options:[...e?[{id:"diff",label:l("git.view.diff")}]:[],...p?[{id:"preview",label:l("git.view.preview")}]:[],{id:"file",label:l(p?"git.view.source":"git.view.file")}]}),"diff"===q&&e&&(0,d.jsx)(F.$q,{value:s,onChange:t,options:[{id:"unified",label:l("git.layout.unified")},{id:"split",label:l("git.layout.split")}]}),!I&&!c&&e?.status!=="deleted"&&e?.status!=="untracked"&&e?.status!=="conflict"&&(()=>{let a=m&&"file"===q;return(0,d.jsx)("button",{type:"button",className:`btn sm ${a?"primary":""}`,"aria-pressed":a,title:l("git.blame.hint"),onClick:()=>{"file"!==q?(r("file"),n(!0)):n(a=>!a)},children:l("git.blame")})})(),e&&"conflict"!==e.status&&(0,d.jsxs)("button",{type:"button",className:"btn sm",title:l("git.discard.hint"),onClick:()=>i(e),children:[(0,d.jsx)(ao,{size:14}),l("git.discard")]}),(0,d.jsx)(G.WQ,{text:b,label:l("git.copyPath")})]})]}),e?.oldPath&&(0,d.jsx)("div",{className:"gx-banner",children:l("git.renamedFrom",{path:e.oldPath})}),(0,d.jsx)("div",{className:"gx-body",children:A?(0,d.jsx)("p",{className:"gx-note err",children:A}):!C||J||y?"diff"===q&&e?J?J.binary?(0,d.jsx)("p",{className:"gx-note",children:l("git.diff.binary")}):0===J.hunks.length?(0,d.jsx)("p",{className:"gx-note",children:l("git.diff.empty")}):(0,d.jsxs)(d.Fragment,{children:[w?.truncated&&(0,d.jsx)("div",{className:"gx-banner",children:l("git.diff.truncated")}),(0,d.jsx)(bi,{parsed:J,layout:s,path:b,cutOff:!!w?.truncated,onDiscardHunk:e?.status==="modified"?(a,c)=>j(b,a,c):void 0,onDiscardLines:e?.status==="modified"?(a,c,d)=>k(b,a,c,d):void 0})]}):null:I&&!E&&e?.status!=="deleted"?(0,d.jsx)("div",{className:"gx-image",children:(0,d.jsx)("img",{src:`/api/agents/${a.id}/git/raw?path=${encodeURIComponent(b)}&v=${g}`,alt:T,onError:()=>H(!0)})}):"preview"===q&&y&&y.path===b?(0,d.jsxs)("div",{className:"gx-md md",children:[y.truncated&&(0,d.jsx)("div",{className:"gx-banner",children:l("git.diff.truncated")}),(0,d.jsx)(u.oz,{remarkPlugins:[v.A],components:{a:a=>(0,d.jsx)("a",{...a,target:"_blank",rel:"noreferrer"})},children:y.content})]}):y&&y.path===b?(0,d.jsx)(bL,{f:y,agent:a,blame:m,onOpenCommit:h,marks:P,allNew:M}):I&&E?(0,d.jsx)("p",{className:"gx-note",children:l("git.file.binary")}):null:(0,d.jsx)("p",{className:"gx-note",children:l("git.loading")})})]})}function bN({agent:a,git:b}){let{t:c}=(0,O.s9)(),{status:e,tree:g,loading:h,error:i,refresh:j}=b,[k,l]=(0,f.useState)(null),[m,n]=(0,f.useState)(new Set),[o,p]=(0,f.useState)(""),[q,r]=(0,f.useState)(!1),[u,v]=(0,f.useState)(!1),[w,x]=(0,f.useState)("files"),[y,z]=(0,f.useState)(null),[A,C]=(0,f.useState)(null),[D,E]=(0,f.useState)(!1),[H,I]=(0,f.useState)(null),[J,K]=(0,f.useState)(!1),[L,M]=(0,f.useState)(null),[N,P]=(0,f.useState)(!1),R=function(a,b){let{t:c}=(0,O.s9)(),d=(0,F.dj)(),[e,g]=(0,f.useState)(null),[h,i]=(0,f.useState)(null),j=async(e,f,h,j={})=>{g(e),i(null);try{let e=await s.F.post(`/agents/${a.id}/git/${h}`,j),g=(e.output??"").split("\n").filter(Boolean).pop()??"",i=["conflicts"===e.pending?c("git.pending.conflicts"):"",e.kept?.length?c("git.sw.kept",{count:e.kept.length,names:e.kept.slice(0,3).join(", ")}):""].filter(Boolean).join(" — ");return d(i?`${f} — ${i}`:g&&g.length<90?`${f} — ${g}`:f),await b(),!0}catch(d){let a=d instanceof Error?d.message:"error";return i({title:c("git.notice.failed",{action:f}),text:a,diverged:/fast-forward|divergent/i.test(a)}),await b(),!1}finally{g(null)}};return{busy:e,notice:h,setNotice:i,run:j}}(a,()=>j()),[S,T]=(0,f.useState)(null),U=a6();(0,f.useRef)(new Set);let V=(0,f.useRef)(null),W=e&&e.isRepo?e:null,X=g&&g.isRepo?g.files:null,Y=g&&g.isRepo?g.ignored:null,[Z,_]=(0,f.useState)({}),aa=(0,f.useMemo)(()=>W&&X?function(a,b,c=[],d={}){let e=new Map(b.map(a=>[a.path,a])),f=new Set(a);for(let a of b)f.add(a.path);let g={name:"",path:"",type:"dir",children:[],changed:0,additions:0,deletions:0},h=new Map([["",g]]),i=a=>{let b=h.get(a);if(b)return b;let c=a.lastIndexOf("/"),d=i(c<0?"":a.slice(0,c)),e={name:a.slice(c+1),path:a,type:"dir",children:[],changed:0,additions:0,deletions:0};return d.children.push(e),h.set(a,e),e};for(let a of f){let b=a.lastIndexOf("/");i(b<0?"":a.slice(0,b)).children.push({name:a.slice(b+1),path:a,type:"file",children:[],change:e.get(a),changed:+!!e.has(a),additions:e.get(a)?.additions??0,deletions:e.get(a)?.deletions??0})}let j=(a,b,c)=>{if(a.children.some(a=>a.path===b))return;let e={name:b.slice(b.lastIndexOf("/")+1),path:b,type:c?"dir":"file",children:[],ignored:!0,lazy:c&&!(b in d),changed:0,additions:0,deletions:0};if(a.children.push(e),c&&h.set(b,e),c)for(let a of d[b]??[])j(e,`${b}/${a.name}`,a.dir)};for(let a of c){let b=a.endsWith("/"),c=b?a.slice(0,-1):a,d=c.lastIndexOf("/");j(i(d<0?"":c.slice(0,d)),c,b)}let k=a=>{for(let b of(a.children.sort((a,b)=>a.type===b.type?a.name.localeCompare(b.name):"dir"===a.type?-1:1),a.children))"dir"===b.type&&k(b),a.changed+=(b.type,b.changed),a.additions+=b.additions,a.deletions+=b.deletions;a.children=a.children.map(a=>{let b=a;for(;"dir"===b.type&&1===b.children.length&&"dir"===b.children[0].type;){let a=b.children[0];b={...a,name:`${b.name}/${a.name}`}}return b})};return k(g),g}(X,W.changes,U.showIgnored?Y??[]:[],Z):null,[W,X,Y,Z,U.showIgnored]),ab=(0,f.useMemo)(()=>{let a=(Y??[]).map(a=>a.replace(/\/$/,""));return b=>a.some(a=>b===a||b.startsWith(`${a}/`))},[Y]),ac=(0,f.useMemo)(()=>new Map((W?.changes??[]).map(a=>[a.path,a])),[W]),ae=(0,f.useMemo)(()=>(W?.changes??[]).reduce((a,b)=>({add:a.add+(b.additions??0),del:a.del+(b.deletions??0)}),{add:0,del:0}),[W]),af=(0,f.useMemo)(()=>aa?function(a,b,c){let d=c.query.trim().toLowerCase(),e=a=>(!c.onlyChanged||0!==a.changed)&&(!d||("file"===a.type?a.path.toLowerCase().includes(d):a.children.some(e))),f=[],g=(a,h)=>{for(let i of a.children)e(i)&&(f.push({node:i,depth:h}),"dir"===i.type&&(d||c.onlyChanged||b.has(i.path))&&g(i,h+1))};return g(a,0),f}(aa,m,{query:o,onlyChanged:q}):[],[aa,m,o,q]),ag=af.slice(0,2e3);if(i&&!e)return(0,d.jsx)("div",{className:"gx",children:(0,d.jsxs)("div",{className:"gx-empty",children:[(0,d.jsx)("h3",{children:c("git.error.title")}),(0,d.jsx)("p",{children:i}),(0,d.jsx)("button",{className:"btn",onClick:()=>void j(),children:c("git.refresh")})]})});if(!e)return(0,d.jsx)("div",{className:"gx",children:(0,d.jsx)("div",{className:"gx-empty",children:(0,d.jsx)("p",{children:c("git.loading")})})});if(!e.isRepo)return(0,d.jsx)("div",{className:"gx",children:(0,d.jsxs)("div",{className:"gx-empty",children:[(0,d.jsx)(ap.A,{size:26,className:"muted"}),(0,d.jsx)("h3",{children:"not-repo"===e.reason?c("git.notRepo.title"):"no-git"===e.reason?c("git.noGit.title"):c("git.error.title")}),(0,d.jsx)("p",{children:"not-repo"===e.reason?c("git.notRepo.body",{path:e.cwd.replace(/^\/home\/[^/]+/,"~")}):"no-git"===e.reason?c("git.noGit.body"):e.message}),(0,d.jsxs)("button",{className:"btn",onClick:()=>void j(),children:[(0,d.jsx)(aq,{size:14}),c("git.refresh")]})]})});let ah=k?ac.get(k):void 0,ai=a=>R.run("switch",a.carried?c("git.done.switchCarried",{branch:a.to,count:a.carried}):c("git.done.switch",{branch:a.to}),a.overlap.length||a.collisions.length?"switch-smart":"switch",{branch:a.to}),aj=async b=>{try{let c=await s.F.get(`/agents/${a.id}/git/switch-plan?branch=${encodeURIComponent(b)}`);c.others.length||c.selfRunning?I(c):await ai(c)}catch(a){R.setNotice({title:c("git.notice.failed",{action:c("git.done.switch",{branch:b})}),text:a instanceof Error?a.message:"error",diverged:!1})}},ak=a=>a.filter(a=>"untracked"===a.status||"added"===a.status&&!a.oldPath).map(a=>a.path),al=new Date(e.generatedAt).toLocaleTimeString((0,O.VR)());return(0,d.jsxs)("div",{className:"gx","data-gx-theme":U.theme,style:{"--g-tab":U.tabSize},children:[(0,d.jsxs)("div",{className:"gx-bar",children:[(0,d.jsxs)("button",{type:"button",className:"gx-branch","aria-expanded":u,"aria-controls":"gx-info",title:c("git.info.toggle"),onClick:()=>v(a=>!a),children:[(0,d.jsx)(ar,{size:14}),(0,d.jsx)("span",{className:"bn",children:e.branch??(e.head?`${c("git.detached")} ${e.head.sha}`:c("git.noCommitsBranch"))}),e.head&&(0,d.jsx)("span",{className:"sha",children:e.head.sha}),e.upstream&&(e.upstream.ahead>0||e.upstream.behind>0)&&(0,d.jsxs)("span",{className:"ab",title:c("git.upstream"),children:[e.upstream.ahead>0&&`↑${e.upstream.ahead}`,e.upstream.ahead>0&&e.upstream.behind>0&&" ",e.upstream.behind>0&&`↓${e.upstream.behind}`]}),u?(0,d.jsx)($.A,{size:14}):(0,d.jsx)(B.A,{size:14})]}),(0,d.jsx)("span",{className:"grow"}),(0,d.jsx)("span",{className:"gx-sum",children:0===e.changes.length?(0,d.jsx)("span",{className:"muted",children:c("git.clean")}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("b",{children:c("git.summary",{count:e.changes.length})})," ",(0,d.jsxs)("i",{className:"add",children:["+",(0,Q._E)(ae.add)]})," ",(0,d.jsxs)("i",{className:"del",children:["−",(0,Q._E)(ae.del)]})]})}),(0,d.jsx)(bD,{agent:a,a:R,current:e.branch,onSwitch:a=>void aj(a)}),(0,d.jsx)(bC,{a:R,ahead:e.upstream?.ahead??0,behind:e.upstream?.behind??0,detached:!e.branch,changeCount:e.changes.length,onCommit:()=>P(!0)}),(0,d.jsx)("button",{className:"btn ghost icon sm",disabled:!!R.busy||0===e.changes.length||!!e.state,onClick:()=>{let a=ak(e.changes);T({files:a,all:!0,summary:{restore:e.changes.length-a.length,add:ae.add,del:ae.del},go:async()=>{let a=await R.run("discard-all",c("git.done.discard"),"discard-all");return a&&l(null),a}})},"aria-label":c("git.discard.all"),title:e.state?c("git.discard.all.blocked"):c("git.discard.all"),children:(0,d.jsx)(ao,{size:15})}),(0,d.jsx)(ba,{}),(0,d.jsx)("button",{className:"btn ghost icon sm",onClick:()=>void j(),"aria-label":c("git.refresh"),title:`${c("git.refresh")} \xb7 ${c("git.updated",{time:al})}`,children:(0,d.jsx)(aq,{size:15,className:h?"spin":""})})]}),u&&(0,d.jsxs)("dl",{id:"gx-info",className:"gx-info",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.branch")}),(0,d.jsxs)("dd",{className:"mono",children:[e.branch??(e.head?`${c("git.detached")} ${e.head.sha}`:c("git.noCommitsBranch")),e.branch&&(0,d.jsx)(G.WQ,{text:e.branch,label:c("git.info.copyBranch")})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.upstreamLabel")}),(0,d.jsx)("dd",{children:e.upstream?0===e.upstream.ahead&&0===e.upstream.behind?c("git.info.inSync"):c("git.info.upstreamStatus",{ahead:e.upstream.ahead,behind:e.upstream.behind}):(0,d.jsx)("span",{className:"muted",children:c("git.info.noUpstream")})})]}),e.head?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.commit")}),(0,d.jsxs)("dd",{className:"mono",children:[e.head.sha,(0,d.jsx)(G.WQ,{text:e.head.sha,label:c("git.info.copySha")})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.message")}),(0,d.jsx)("dd",{className:"msg",children:e.head.subject||(0,d.jsx)("span",{className:"muted",children:"—"})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.author")}),(0,d.jsx)("dd",{children:e.head.author})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.when")}),(0,d.jsxs)("dd",{children:[(0,Q.v7)(e.head.when)," ",(0,d.jsxs)("span",{className:"muted",children:["\xb7 ",(0,t.KN)(Date.parse(e.head.when))]})]})]})]}):(0,d.jsxs)("div",{children:[(0,d.jsx)("dt",{children:c("git.info.commit")}),(0,d.jsx)("dd",{className:"muted",children:c("git.noCommits")})]})]}),"running"===a.status&&(0,d.jsx)("div",{className:"gx-warn",children:c("git.warn.running",{name:a.name})}),e.state&&(()=>{let a=e.changes.filter(a=>"conflict"===a.status),b="merge"===e.state?c("git.state.merge"):"rebase"===e.state?c("git.state.rebase"):c("git.state.stash");return(0,d.jsxs)("div",{className:"gx-state",role:"status",children:[(0,d.jsx)("b",{children:b}),(0,d.jsxs)("span",{className:"grow",children:["stash"===e.state&&e.stash&&(0,d.jsxs)(d.Fragment,{children:[c("git.state.stash.hint",{from:e.stash.from,to:e.stash.to})," \xb7 "]}),a.length>0?c("git.state.conflicts",{count:a.length}):c("git.state.ready")]}),0===a.length&&("merge"===e.state?(0,d.jsx)("button",{className:"btn primary sm",disabled:!!R.busy,onClick:()=>P(!0),children:c("git.state.finishMerge")}):"rebase"===e.state?(0,d.jsx)("button",{className:"btn primary sm",disabled:!!R.busy,onClick:()=>void R.run("continue",c("git.done.rebaseContinue"),"rebase-continue"),children:c("git.state.continueRebase")}):(0,d.jsx)("button",{className:"btn primary sm",disabled:!!R.busy,onClick:()=>void R.run("smart",c("git.done.smartFinish"),"smart-finish"),children:c("git.state.finishStash")})),"stash"===e.state?(0,d.jsx)("button",{className:"btn sm danger",disabled:!!R.busy,onClick:()=>K(!0),children:c("git.state.cancelStash")}):(0,d.jsx)("button",{className:"btn sm danger",disabled:!!R.busy,onClick:()=>void R.run("abort",c("git.done.mergeAbort"),"merge-abort"),children:"merge"===e.state?c("git.state.abortMerge"):c("git.state.abortRebase")})]})})(),(0,d.jsx)(bB,{a:R}),e.scope&&(0,d.jsx)("div",{className:"gx-scope",children:c("git.scope",{path:e.scope})}),(0,d.jsxs)("div",{className:"gx-main",children:[(0,d.jsxs)("aside",{className:"gx-tree","aria-label":c("git.filesLabel"),children:[(0,d.jsx)("div",{className:"gx-tabs",children:(0,d.jsx)(F.$q,{value:w,onChange:x,options:[{id:"files",label:c("git.tab.files")},{id:"history",label:c("git.tab.history")},{id:"stashes",label:`${c("git.tab.stashes")}${y?.length?` \xb7 ${y.length}`:""}`}]})}),"stashes"===w?(0,d.jsx)(bt,{stashes:y,sel:A,onSelect:C,onSave:()=>E(!0),canSave:e.changes.length>0&&!e.state}):"history"===w?(0,d.jsx)(bF,{agent:a,head:e.head?.sha,sel:L,onSelect:M}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"gx-filter",children:[(0,d.jsxs)("div",{className:"search",children:[(0,d.jsx)(ad.A,{size:14}),(0,d.jsx)("input",{className:"input",placeholder:c("git.filterPlaceholder"),value:o,onChange:a=>p(a.target.value),"aria-label":c("git.filterPlaceholder")})]}),(0,d.jsx)(F.$q,{value:q?"changed":"all",onChange:a=>r("changed"===a),options:[{id:"all",label:c("git.filter.all")},{id:"changed",label:`${c("git.filter.changed")}${e.changes.length?` \xb7 ${e.changes.length}`:""}`}]})]}),(0,d.jsxs)("div",{className:"gx-list",ref:V,onKeyDown:a=>{let b=[...V.current?.querySelectorAll("[data-row]")??[]],c=b.indexOf(document.activeElement);if("ArrowDown"===a.key)a.preventDefault(),b[Math.min(b.length-1,c+1)]?.focus();else if("ArrowUp"===a.key)a.preventDefault(),b[Math.max(0,c-1)]?.focus();else if(c>=0&&("ArrowRight"===a.key||"ArrowLeft"===a.key)){let d=b[c];if("1"!==d.dataset.dir)return;let e="true"===d.getAttribute("aria-expanded");("ArrowRight"===a.key&&!e||"ArrowLeft"===a.key&&e)&&(a.preventDefault(),d.click())}},role:"tree",children:[aa?0===ag.length?(0,d.jsx)("p",{className:"gx-note",children:o?c("git.noMatch",{query:o}):q?c("git.clean"):c("git.noFiles")}):ag.map(({node:b,depth:e})=>{let f="dir"===b.type,g=f&&(o||q||m.has(b.path)),h=b.change;return(0,d.jsxs)("button",{"data-row":!0,"data-dir":f?"1":"0","data-path":b.path,type:"button",role:"treeitem","aria-level":e+1,"aria-expanded":f?!!g:void 0,"aria-selected":!f&&k===b.path,className:`gx-row ${f?"dir":"file"} ${b.ignored?"ignored":""} ${h?`changed st-${h.status}`:""} ${!f&&k===b.path?"sel":""} ${f&&b.changed?"has-changes":""}`,style:{paddingLeft:8+14*e},title:b.ignored?`${b.path} — ${c("git.ignored.hint")}`:b.path,onClick:()=>{let c;return f?void(c=b.path,n(a=>{let b=new Set(a);return b.has(c)?b.delete(c):b.add(c),b}),b.ignored&&b.lazy&&!(b.path in Z)&&s.F.get(`/agents/${a.id}/git/ls?path=${encodeURIComponent(b.path)}`).then(a=>_(c=>({...c,[b.path]:a.entries}))).catch(()=>_(a=>({...a,[b.path]:[]})))):l(b.path)},children:[(0,d.jsx)("span",{className:"chev",children:f?g?(0,d.jsx)($.A,{size:14}):(0,d.jsx)(B.A,{size:14}):null}),(0,d.jsx)("span",{className:"ico",children:f?g?(0,d.jsx)(as,{size:15}):(0,d.jsx)(ap.A,{size:15}):(0,d.jsx)(bJ,{name:b.name})}),(0,d.jsx)("span",{className:"nm",children:b.name}),f&&b.changed>0&&(0,d.jsx)("span",{className:"dirdot",title:c("git.dirChanged",{count:b.changed}),children:b.changed}),h&&(0,d.jsxs)("span",{className:"meta",children:[(null!==h.additions||null!==h.deletions)&&(0,d.jsxs)("span",{className:"gx-counts sm",children:[(0,d.jsxs)("i",{className:"add",children:["+",h.additions??0]}),(0,d.jsxs)("i",{className:"del",children:["−",h.deletions??0]})]}),(0,d.jsx)(bk,{status:h.status,titled:!0})]})]},`${b.ignored?"i:":""}${b.path}`)}):(0,d.jsx)("p",{className:"gx-note",children:c("git.loading")}),af.length>ag.length&&(0,d.jsx)("p",{className:"gx-note",children:c("git.rowsCapped",{count:ag.length})}),g?.isRepo&&g.truncated&&(0,d.jsx)("p",{className:"gx-note",children:c("git.treeTruncated",{count:g.files.length})})]})]})]}),"stashes"===w?y?.find(a=>a.sha===A)?(0,d.jsx)(bv,{agent:a,stash:y.find(a=>a.sha===A),a:R},A):(0,d.jsx)("div",{className:"gx-preview",children:(0,d.jsx)("div",{className:"gx-empty",children:(0,d.jsx)("p",{children:c("git.stash.empty")})})}):"history"===w?L?(0,d.jsx)(bO,{agent:a,sha:L},L):(0,d.jsx)("div",{className:"gx-preview",children:(0,d.jsx)("div",{className:"gx-empty",children:(0,d.jsx)("p",{children:c("git.hist.select")})})}):k&&ah?.status==="conflict"?(0,d.jsx)(bo,{agent:a,path:k,state:e.state,a:R,onResolved:()=>{j()}},k):k?(0,d.jsx)(bM,{agent:a,path:k,ignored:ab(k),change:ah,stamp:e.generatedAt,onOpenCommit:a=>{M(a),x("history")},onDiscard:a=>T({files:ak([a]),all:!1,file:{path:a.path,status:a.status,oldPath:a.oldPath,add:a.additions??0,del:a.deletions??0},go:async()=>{let b=await R.run("discard",c("git.done.discard"),"discard",{path:a.path,oldPath:a.oldPath});return b&&ak([a]).length&&l(null),b}}),onDiscardHunk:(a,b,d)=>void R.run("discard-hunk",c("git.done.discard"),"discard-hunk",{path:a,index:b,header:d}),onDiscardLines:(a,b,d,e)=>void R.run("discard-lines",c("git.done.discard"),"discard-lines",{path:a,index:b,header:d,lines:e})},k):(0,d.jsx)("div",{className:"gx-preview",children:(0,d.jsx)("div",{className:"gx-empty",children:(0,d.jsx)("p",{children:c("git.select")})})})]}),H&&(0,d.jsx)(bp,{agent:a,plan:H,a:R,onClose:()=>I(null),onGo:()=>{I(null),ai(H)}}),D&&(0,d.jsx)(bu,{a:R,onClose:()=>E(!1)}),J&&e.stash&&(0,d.jsxs)(F.aF,{title:c("git.state.cancelStash.title"),onClose:()=>K(!1),children:[(0,d.jsx)("p",{className:"muted",style:{margin:0},children:c("git.state.cancelStash.body",{from:e.stash.from})}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:()=>K(!1),children:c("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",disabled:!!R.busy,onClick:()=>{K(!1),R.run("smart",c("git.done.smartCancel"),"smart-cancel")},children:c("git.state.cancelStash.go")})]})]}),S&&(0,d.jsx)(bG,{files:S.files,all:S.all,summary:S.summary,file:S.file,busy:!!R.busy,onClose:()=>T(null),onConfirm:async()=>{let a=S.go;T(null),await a()}}),N&&(0,d.jsx)(bE,{changes:e.changes,a:R,initialMessage:e.mergeMsg,onClose:()=>P(!1)})]})}function bO({agent:a,sha:b}){let{t:c}=(0,O.s9)(),[e,g]=(0,f.useState)(null),[h,i]=(0,f.useState)(null),[j,k]=(0,f.useState)(null),[l,m]=(0,f.useState)("unified"),[n,o]=(0,f.useState)(null),p=e?.files.find(a=>a.path===h),q=(0,f.useMemo)(()=>j&&p&&j.path===p.path?at(j.diff):null,[j,p]);if(n)return(0,d.jsx)("section",{className:"gx-preview",children:(0,d.jsx)("p",{className:"gx-note err",children:n})});if(!e)return(0,d.jsx)("section",{className:"gx-preview",children:(0,d.jsx)("p",{className:"gx-note",children:c("git.loading")})});let[r,...s]=e.message.split("\n"),t=s.join("\n").trim();return(0,d.jsxs)("section",{className:"gx-preview gx-commitview","aria-label":r,children:[(0,d.jsxs)("header",{className:"gx-chead",children:[(0,d.jsx)("h3",{children:r}),t&&(0,d.jsx)("pre",{className:"gx-cbody",children:t}),(0,d.jsxs)("div",{className:"muted small row gap-s wrap",children:[(0,d.jsx)("span",{className:"mono",children:e.sha.slice(0,10)}),(0,d.jsx)(G.WQ,{text:e.sha,label:c("git.info.copySha")}),(0,d.jsxs)("span",{children:["\xb7 ",e.author," \xb7 ",(0,Q.v7)(e.date)]}),(0,d.jsxs)("span",{children:["\xb7 ",c("git.hist.files",{count:e.files.length})]})]})]}),0===e.files.length?(0,d.jsx)("p",{className:"gx-note",children:c("git.hist.noFiles")}):(0,d.jsx)("div",{className:"gx-cfilelist",role:"listbox",children:e.files.map(a=>(0,d.jsxs)("button",{role:"option","aria-selected":h===a.path,className:`gx-cfile ${h===a.path?"sel":""}`,onClick:()=>i(a.path),title:a.oldPath?`${a.oldPath} → ${a.path}`:a.path,children:[(0,d.jsx)(bk,{status:a.status}),(0,d.jsx)("span",{className:"mono nm",children:a.path}),(null!==a.additions||null!==a.deletions)&&(0,d.jsxs)("span",{className:"gx-counts sm",children:[(0,d.jsxs)("i",{className:"add",children:["+",a.additions??0]}),(0,d.jsxs)("i",{className:"del",children:["−",a.deletions??0]})]})]},a.path))}),p&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"gx-ptools",style:{padding:"6px 14px"},children:(0,d.jsx)(F.$q,{value:l,onChange:m,options:[{id:"unified",label:c("git.layout.unified")},{id:"split",label:c("git.layout.split")}]})}),(0,d.jsx)("div",{className:"gx-body",children:q?q.binary?(0,d.jsx)("p",{className:"gx-note",children:c("git.diff.binary")}):0===q.hunks.length?(0,d.jsx)("p",{className:"gx-note",children:c("git.diff.empty")}):(0,d.jsxs)(d.Fragment,{children:[j?.truncated&&(0,d.jsx)("div",{className:"gx-banner",children:c("git.diff.truncated")}),(0,d.jsx)(bi,{parsed:q,layout:l,path:p.path})]}):(0,d.jsx)("p",{className:"gx-note",children:c("git.loading")})})]})]})}var bP=c(15964),bQ=c(40123),bR=c(59686);function bS({agent:a}){let{t:b}=(0,O.s9)(),{refresh:c}=(0,r.o0)(),e=(0,F.dj)(),[g,h]=(0,f.useState)(null),[i,j]=(0,f.useState)(""),[k,l]=(0,f.useState)(""),[m,n]=(0,f.useState)(!1),[o,p]=(0,f.useState)(!1),q=(0,f.useRef)(""),u=!!g&&i!==q.current,v=(0,f.useRef)(!1);v.current=u;let w=(0,f.useCallback)(async(b=!1)=>{try{let c=await s.F.get(`/agents/${a.id}/notebook`);h(a=>a&&a.version===c.version&&a.enabled===c.enabled?a:c),(b||!v.current)&&(q.current=c.content,j(c.content))}catch(a){l(a instanceof Error?a.message:String(a))}},[a.id]),x=async(c=i)=>{if(g){n(!0),l("");try{let d=await s.F.put(`/agents/${a.id}/notebook`,{content:c,version:g.version});h({...g,...d}),q.current=d.content,j(d.content),e(b("notebook.saved"))}catch(a){l(a instanceof Error?a.message:String(a))}n(!1)}},y=async()=>{try{await s.F.patch(`/agents/${a.id}`,{skill_ids:[...new Set([...a.skill_ids,g.skill_id])]}),await c(["agents"]),await w(!0)}catch(a){l(a instanceof Error?a.message:String(a))}};if(!g)return(0,d.jsx)("div",{className:"pane",children:(0,d.jsx)("p",{className:"hint",children:k||b("git.loading")})});let z=i.length,A=z>g.max,B=z>.8*g.max;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"pane",children:[(0,d.jsx)("p",{className:"hint",style:{margin:0},children:b("notebook.intro")}),!g.enabled&&(0,d.jsxs)("div",{className:"banner honey",children:[(0,d.jsx)(E.A,{size:16}),(0,d.jsx)("div",{className:"grow",children:b("notebook.off")}),(0,d.jsx)("button",{className:"btn sm",onClick:y,children:b("notebook.on")})]}),k&&(0,d.jsxs)("div",{className:"banner err",children:[(0,d.jsx)(E.A,{size:16}),(0,d.jsx)("div",{className:"grow",children:k}),(0,d.jsxs)("button",{className:"btn sm",onClick:()=>{l(""),w(!0)},children:[(0,d.jsx)(aq,{size:13}),b("notebook.reload")]})]}),(0,d.jsxs)("div",{className:"row small muted",style:{justifyContent:"space-between"},children:[(0,d.jsxs)("span",{children:[(0,d.jsx)(bQ.A,{size:12,style:{verticalAlign:"-1px"}})," ",g.updated_at?b("notebook.updated",{who:b("user"===g.updated_by?"notebook.by.you":"notebook.by.agent"),when:(0,t.KN)(g.updated_at)}):b("notebook.never")]}),(0,d.jsxs)("span",{style:{color:A?"var(--danger, #c0392b)":B?"var(--honey)":void 0},children:[z.toLocaleString()," / ",g.max.toLocaleString()]})]}),(0,d.jsx)(bR.n,{value:i,onChange:j,placeholder:b("notebook.placeholder"),defaultView:"write",minHeight:320})]}),(0,d.jsxs)("div",{className:"savebar col",children:[(0,d.jsx)("span",{className:"muted small",children:u?b("agent.unsavedChanges"):b("agent.allSaved")}),(0,d.jsxs)("div",{className:"row",children:[(0,d.jsxs)("button",{className:"btn danger sm",style:{marginRight:"auto"},disabled:!i.trim()||m,onClick:()=>p(!0),children:[(0,d.jsx)(bs.A,{size:14}),b("notebook.clear")]}),u&&(0,d.jsx)("button",{className:"btn ghost sm",onClick:()=>j(q.current),children:b("common.discard")}),(0,d.jsx)("button",{className:"btn primary sm",disabled:!u||m||A,onClick:()=>void x(),children:b("notebook.save")})]})]}),o&&(0,d.jsxs)(F.aF,{title:b("notebook.clear.title"),onClose:()=>p(!1),children:[(0,d.jsx)("p",{style:{margin:0},className:"muted",children:b("notebook.clear.confirm")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:()=>p(!1),children:b("common.cancel")}),(0,d.jsx)("button",{className:"btn danger",onClick:()=>{p(!1),x("")},children:b("notebook.clear")})]})]})]})}let bT=()=>Math.max(340,window.innerWidth-80);function bU({params:a}){let{id:b}=(0,f.use)(a);return(0,d.jsx)(bV,{id:b},b)}function bV({id:a}){let{t:b}=(0,O.s9)(),{agent:c,agents:g,colonies:j,ready:u,refresh:v}=(0,r.o0)(),w=c(a),x=(0,i.useRouter)(),y=(0,F.dj)(),[z,A]=(0,f.useState)(!1),[B,C]=(0,f.useState)("config"),[D,E]=(0,f.useState)([]),[G,H]=(0,f.useState)(void 0),[I,J]=(0,f.useState)(null),[K,L]=(0,f.useState)("chat"),[M,N]=(0,f.useState)(!1),P=()=>N(a=>{try{localStorage.setItem("hive-switcher-collapsed",a?"0":"1")}catch{}return!a}),Q=function(a,b){let{finished:c}=(0,r.o0)(),d=a?.id??"";c[d];let[e,g]=(0,f.useState)(null),[h,i]=(0,f.useState)(null),[j,k]=(0,f.useState)(!1),[l,m]=(0,f.useState)(null),n=(0,f.useRef)(0);a?.effective.cwd,a?.status;let o=(0,f.useCallback)(async a=>{if(!d)return;let b=++n.current;k(!0);try{let[c,e]=await Promise.all([s.F.get(`/agents/${d}/git/status`),a?s.F.get(`/agents/${d}/git/tree`):Promise.resolve(null)]);if(b!==n.current)return;g(c),e&&i(e),m(null)}catch(a){b===n.current&&m(a instanceof Error?a.message:"error")}finally{b===n.current&&k(!1)}},[d]);return{status:e,tree:h,loading:j,error:l,refresh:(0,f.useCallback)(()=>o(!0),[o])}}(w,0),R=Q.status&&Q.status.isRepo?Q.status.changes.length:0,[S,T]=(0,f.useState)(400),U=a=>{try{localStorage.setItem("hive-cfg-width",String(Math.round(a)))}catch{}},V=S>440,W=()=>{let a=V?400:Math.min(bT(),Math.round(window.innerWidth/2));T(a),U(a)},Y=(a,b)=>{A(a),b&&C(b);try{localStorage.setItem("hive-cfg-open",a?"1":"0")}catch{}},Z=(0,e.A)(w,{onDeleted:()=>x.push("/agents")}),{draft:$,setDraft:aa,errors:ab,dirty:ac,saving:ad}=Z;if(!w)return(0,d.jsxs)("div",{className:`ws ${M?"sw-collapsed":""}`,children:[(0,d.jsx)(ah,{activeId:a,collapsed:M,onToggle:P}),(0,d.jsx)("div",{className:"page",children:u?(0,d.jsxs)("div",{className:"empty",children:[(0,d.jsx)("h3",{children:b("agent.missing.title")}),(0,d.jsx)("p",{children:b("agent.missing.body")}),(0,d.jsx)(h(),{className:"btn",href:"/agents",children:b("agent.missing.back")})]}):null})]});let ae=async c=>{await s.F.post(`/agents/${a}/resume-session`,{session_id:c}),H(void 0),y(b("agent.resumed"))},af=D.filter(a=>"delegation"!==a.kind),ag=D.filter(a=>"delegation"===a.kind);return(0,d.jsxs)("div",{className:`ws ${z?"with-config":""} ${M?"sw-collapsed":""}`,style:{"--cfg":`${S}px`},children:[(0,d.jsx)(ah,{activeId:a,collapsed:M,onToggle:P}),(0,d.jsxs)("section",{className:"ws-chat",children:[(0,d.jsxs)("header",{className:"ws-head",children:[(0,d.jsx)(h(),{href:"/",className:"btn ghost icon","aria-label":b("agent.backToColony"),children:(0,d.jsx)(k,{size:18})}),(0,d.jsx)(F._h,{agent:w}),(0,d.jsxs)("div",{className:"grow",children:[(0,d.jsx)("h1",{children:w.name}),(0,d.jsxs)("div",{className:"row gap-s wrap",style:{marginTop:3},children:[(0,d.jsx)(F.PW,{role:w.role}),(0,d.jsx)(F.dJ,{provider:w.provider}),(0,d.jsx)("span",{className:"muted small",children:w.model||b("model.cliDefault")}),(0,d.jsx)(F.P5,{status:w.status})]})]}),(0,d.jsxs)("div",{className:"seg",role:"group","aria-label":b("git.tab.label"),children:[(0,d.jsx)("button",{type:"button","aria-pressed":"chat"===K,onClick:()=>L("chat"),children:b("git.tab.chat")}),(0,d.jsxs)("button",{type:"button","aria-pressed":"changes"===K,onClick:()=>L("changes"),children:[b("git.tab.changes"),R>0&&(0,d.jsx)("span",{className:"tabcount",children:R})]})]}),G&&(0,d.jsx)("button",{className:"btn primary sm",onClick:()=>ae(G),disabled:D.find(a=>a.session_id===G)?.kind==="delegation",children:b("agent.makeCurrent")}),G&&(0,d.jsx)("button",{className:"btn sm",onClick:()=>H(void 0),children:b("agent.backToCurrent")}),(0,d.jsxs)("button",{className:"btn sm",onClick:()=>J("new"),disabled:!w.session_id||"running"===w.status,children:[(0,d.jsx)(l,{size:14}),b("agent.newConversation")]}),(0,d.jsxs)("button",{className:`btn sm ${z?"primary":""}`,onClick:()=>Y(!z),"aria-expanded":z,"aria-label":b("colony.agentSettings"),children:[(0,d.jsx)(m.A,{size:14}),b("agent.settings"),ac&&(0,d.jsx)("i",{className:"dot run",title:b("agent.unsaved")})]})]}),(0,d.jsxs)("div",{className:"chat-pane",hidden:"chat"!==K,children:[(0,d.jsx)(_,{agent:w,session:G}),(0,d.jsx)(X,{agent:w,sessionOverride:G})]}),"changes"===K&&(0,d.jsx)(bN,{agent:w,git:Q})]}),z&&(0,d.jsxs)("aside",{className:"ws-side",children:[(0,d.jsx)("div",{className:"ws-grip",onPointerDown:a=>{a.preventDefault();let b=a.currentTarget;b.setPointerCapture(a.pointerId);let c=S,d=a=>{T(c=Math.min(bT(),Math.max(340,window.innerWidth-a.clientX)))},e=()=>{b.removeEventListener("pointermove",d),b.removeEventListener("pointerup",e),U(c)};b.addEventListener("pointermove",d),b.addEventListener("pointerup",e)},onDoubleClick:W,role:"separator","aria-orientation":"vertical","aria-label":b("drawer.resize"),title:b("drawer.resize")}),(0,d.jsxs)("div",{className:"tabs",role:"tablist",style:{padding:"0 12px",position:"sticky",top:0,background:"var(--surface)",zIndex:2},children:[(0,d.jsx)("button",{className:"tab",role:"tab","aria-selected":"config"===B,onClick:()=>C("config"),children:b("agent.tab.config")}),(0,d.jsx)("button",{className:"tab",role:"tab","aria-selected":"notebook"===B,onClick:()=>C("notebook"),children:b("agent.tab.notebook")}),(0,d.jsx)("button",{className:"tab",role:"tab","aria-selected":"sessions"===B,onClick:()=>C("sessions"),children:b("nav.sessions")}),(0,d.jsx)("button",{className:"btn ghost icon sm",style:{marginLeft:"auto",alignSelf:"center"},onClick:W,"aria-label":V?b("drawer.shrink"):b("drawer.expand"),title:V?b("drawer.shrink"):b("drawer.expand"),children:V?(0,d.jsx)(n.A,{size:15}):(0,d.jsx)(o.A,{size:15})}),(0,d.jsx)("button",{className:"btn ghost sm",style:{alignSelf:"center"},onClick:()=>Y(!1),children:b("common.hide")})]}),"config"===B&&$&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"pane",children:(0,d.jsx)(bP.SU,{draft:$,onChange:aa,errors:ab,selfId:a})}),(0,d.jsxs)("div",{className:"savebar col",children:[(0,d.jsxs)("span",{className:"muted small",children:[ac?b("agent.unsavedChanges"):b("agent.allSaved"),ac&&"running"===w.status?` ${b("agent.appliesNextTurn")}`:""]}),(0,d.jsx)("div",{className:"row",children:Z.actions({size:"sm"})})]})]}),"notebook"===B&&(0,d.jsx)(bS,{agent:w}),"sessions"===B&&(0,d.jsxs)("div",{className:"pane",children:[(0,d.jsx)("p",{className:"hint",style:{margin:0},children:b("agent.sessions.intro",{path:(0,t._1)(w.effective.cwd)})}),(0,d.jsx)("div",{className:"eyebrow",children:b("agent.sessions.conversations")}),0===af.length?(0,d.jsxs)("div",{className:"empty",style:{padding:24},children:[(0,d.jsx)(p.A,{size:22}),(0,d.jsx)("p",{children:b("agent.sessions.empty")})]}):af.map(a=>{let c=a.session_id===w.session_id;return(0,d.jsxs)("div",{className:"card card-pad col",style:{gap:8,borderColor:G===a.session_id?"var(--honey)":void 0},children:[(0,d.jsxs)("div",{className:"row",children:[(0,d.jsxs)("span",{className:"mono grow",children:[a.session_id.slice(0,18),"…"]}),c&&(0,d.jsx)("span",{className:"chip honey",children:b("sessions.current")})]}),(0,d.jsx)("span",{className:"muted small",children:b("agent.sessions.started",{started:(0,t.KN)(a.first_seen),last:(0,t.KN)(a.last_seen)})}),(0,d.jsxs)("div",{className:"row gap-s",children:[(0,d.jsx)("button",{className:"btn sm",onClick:()=>H(c?void 0:a.session_id),children:G===a.session_id?b("agent.sessions.viewing"):b("agent.sessions.read")}),!c&&(0,d.jsx)("button",{className:"btn sm",onClick:()=>ae(a.session_id),children:b("agent.sessions.resume")})]})]},a.session_id)}),ag.length>0&&(0,d.jsx)("div",{className:"eyebrow",style:{marginTop:6},children:b("agent.sessions.delegated")}),ag.map(a=>(0,d.jsxs)("div",{className:"card card-pad col",style:{gap:8,borderColor:G===a.session_id?"var(--honey)":void 0},children:[(0,d.jsxs)("div",{className:"row gap-s",children:[(0,d.jsx)(q.A,{size:14,className:"muted"}),(0,d.jsx)("b",{className:"grow",children:b("agent.sessions.from",{name:a.from_name??b("chat.anOrchestrator")})}),(0,d.jsx)("span",{className:"muted small",children:(0,t.KN)(a.last_seen)})]}),a.task&&(0,d.jsx)("span",{className:"small",style:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"},children:a.task}),(0,d.jsx)("div",{className:"row gap-s",children:(0,d.jsx)("button",{className:"btn sm",onClick:()=>H(G===a.session_id?void 0:a.session_id),children:G===a.session_id?b("agent.sessions.viewing"):b("agent.sessions.read")})})]},a.session_id))]})]}),Z.deleteModal,"new"===I&&(0,d.jsxs)(F.aF,{title:b("agent.newConvTitle"),onClose:()=>J(null),children:[(0,d.jsx)("p",{style:{margin:0},className:"muted",children:b("agent.newConvBody")}),(0,d.jsxs)("div",{className:"row",style:{justifyContent:"flex-end"},children:[(0,d.jsx)("button",{className:"btn ghost",onClick:()=>J(null),children:b("common.cancel")}),(0,d.jsx)("button",{className:"btn primary",onClick:async()=>{await s.F.post(`/agents/${a}/new-session`),await v(["agents"]),J(null),y(b("agent.newConvStarted"))},children:b("agent.newConvStart")})]})]})]})}},23124:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(51537).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},26530:(a,b,c)=>{Promise.resolve().then(c.bind(c,27769))},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},27769:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(85972).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/hugh/Documentos/projects/personal/hive-am/dist/stage/web/app/agents/[id]/page.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/hugh/Documentos/projects/personal/hive-am/dist/stage/web/app/agents/[id]/page.tsx","default")},28354:a=>{"use strict";a.exports=require("util")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},49519:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GlobalError:()=>F.a,__next_app__:()=>L,handler:()=>N,pages:()=>K,routeModule:()=>M,tree:()=>J});var d=c(62009),e=c(51640),f=c(52679),g=c(69985),h=c(91790),i=c(81200),j=c(54530),k=c(35977),l=c(234),m=c(43472),n=c(12698),o=c(28976),p=c(54084),q=c(16307),r=c(53063),s=c(72428),t=c(261),u=c(48291),v=c(56032),w=c(26713),x=c(83370),y=c(10143),z=c(27155),A=c(77620),B=c(13428),C=c(50164),D=c(86439),E=c(2972),F=c.n(E),G=c(94672),H=c(18313),I={};for(let a in G)0>["default","tree","pages","GlobalError","__next_app__","routeModule","handler"].indexOf(a)&&(I[a]=()=>G[a]);c.d(b,I);let J={children:["",{children:["agents",{children:["[id]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,27769)),"/home/hugh/Documentos/projects/personal/hive-am/dist/stage/web/app/agents/[id]/page.tsx"]}]},{}]},{metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,84507))).default(a),async a=>(await Promise.resolve().then(c.bind(c,23575))).default(a)],apple:[async a=>(await Promise.resolve().then(c.bind(c,54287))).default(a)],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(c.bind(c,73137)),"/home/hugh/Documentos/projects/personal/hive-am/dist/stage/web/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,2972,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,96298,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,60075,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,79678,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,84507))).default(a),async a=>(await Promise.resolve().then(c.bind(c,23575))).default(a)],apple:[async a=>(await Promise.resolve().then(c.bind(c,54287))).default(a)],openGraph:[],twitter:[],manifest:void 0}}]}.children,K=["/home/hugh/Documentos/projects/personal/hive-am/dist/stage/web/app/agents/[id]/page.tsx"],L={require:c,loadChunk:()=>Promise.resolve()},M=new e.AppPageRouteModule({definition:{kind:f.RouteKind.APP_PAGE,page:"/agents/[id]/page",pathname:"/agents/[id]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:J},distDir:".next",relativeProjectDir:""});async function N(a,b,e){var E;let I="/agents/[id]/page";"/index"===I&&(I="/");let O=(0,i.getRequestMeta)(a,"postponed"),P=(0,i.getRequestMeta)(a,"minimalMode"),Q=await M.prepare(a,b,{srcPage:I,multiZoneDraftMode:!1});if(!Q)return b.statusCode=400,b.end("Bad Request"),null==e.waitUntil||e.waitUntil.call(e,Promise.resolve()),null;let{buildId:R,query:S,params:T,parsedUrl:U,pageIsDynamic:V,buildManifest:W,nextFontManifest:X,reactLoadableManifest:Y,serverActionsManifest:Z,clientReferenceManifest:$,subresourceIntegrityManifest:_,prerenderManifest:aa,isDraftMode:ab,resolvedPathname:ac,revalidateOnlyGenerated:ad,routerServerContext:ae,nextConfig:af,interceptionRoutePatterns:ag}=Q,ah=U.pathname||"/",ai=(0,t.normalizeAppPath)(I),{isOnDemandRevalidate:aj}=Q,ak=M.match(ah,aa),al=!!aa.routes[ac]&&(M.isDev||(0,d.isRouteCacheOwner)(ac,M.cacheOwner,aa.routes[ac])),am=!!(ak||al||aa.routes[ai]),an=a.headers["user-agent"]||"",ao=(0,w.getBotType)(an),ap=(0,r.isHtmlBotRequest)(a),aq=(0,i.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[v.NEXT_ROUTER_PREFETCH_HEADER],ar=(0,i.getRequestMeta)(a,"isRSCRequest")??(0,o.f)(a.headers[v.RSC_HEADER]),as=(0,u.getIsPossibleServerAction)(a),at=(0,n.checkIsAppPPREnabled)(af.experimental.ppr)&&(null==(E=aa.routes[ai]??aa.dynamicRoutes[ai])?void 0:E.renderingMode)==="PARTIALLY_STATIC",au=!1,av=!1,aw=at?O:void 0,ax=at&&ar&&!aq,ay=(0,i.getRequestMeta)(a,"segmentPrefetchRSCRequest"),az=!an||(0,r.shouldServeStreamingMetadata)(an,af.htmlLimitedBots);ap&&at&&(am=!1,az=!1);let aA=!0===M.isDev||!am||"string"==typeof O||ax,aB=ap&&at,aC=null;ab||!am||aA||as||aw||ax||(aC=ac);let aD=aC;!aD&&M.isDev&&(aD=ac),M.isDev||ab||!am||!ar||ax||(0,l.d)(a.headers);let aE={...G,tree:J,pages:K,GlobalError:F(),handler:N,routeModule:M,__next_app__:L};Z&&$&&(0,q.setReferenceManifestsSingleton)({page:I,clientReferenceManifest:$,serverActionsManifest:Z,serverModuleMap:(0,s.createServerModuleMap)({serverActionsManifest:Z})});let aF=a.method||"GET",aG=(0,h.getTracer)(),aH=aG.getActiveScopeSpan();try{let d=M.getVaryHeader(ac,ag);b.setHeader("Vary",d);let g=async(c,d)=>{let e=new m.NodeNextRequest(a),f=new m.NodeNextResponse(b);return M.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=aG.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==j.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${aF} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${aF} ${a.url}`)})},l=async({span:d,postponed:f,fallbackRouteParams:h})=>{let j={query:S,params:T,page:ai,sharedContext:{buildId:R},serverComponentsHmrCache:(0,i.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:h,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aE,Component:(0,k.T)(aE),params:T,routeModule:M,page:I,postponed:f,shouldWaitOnAllReady:aB,serveStreamingMetadata:az,supportsDynamicResponse:"string"==typeof f||aA,buildManifest:W,nextFontManifest:X,reactLoadableManifest:Y,subresourceIntegrityManifest:_,serverActionsManifest:Z,clientReferenceManifest:$,setIsrStatus:null==ae?void 0:ae.setIsrStatus,dir:c(33873).join(process.cwd(),M.relativeProjectDir),isDraftMode:ab,isRevalidate:am&&!f&&!ax,botType:ao,isOnDemandRevalidate:aj,isPossibleServerAction:as,assetPrefix:af.assetPrefix,nextConfigOutput:af.output,crossOrigin:af.crossOrigin,trailingSlash:af.trailingSlash,previewProps:aa.preview,deploymentId:af.deploymentId,enableTainting:af.experimental.taint,htmlLimitedBots:af.htmlLimitedBots,devtoolSegmentExplorer:af.experimental.devtoolSegmentExplorer,reactMaxHeadersLength:af.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:(0,i.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:af.experimental.cacheLife,basePath:af.basePath,serverActions:af.experimental.serverActions,...au?{nextExport:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isRevalidate:!0,isDebugDynamicAccesses:au}:{},experimental:{isRoutePPREnabled:at,expireTime:af.expireTime,staleTimes:af.experimental.staleTimes,cacheComponents:!!af.experimental.cacheComponents,clientSegmentCache:!!af.experimental.clientSegmentCache,clientParamParsing:!!af.experimental.clientParamParsing,dynamicOnHover:!!af.experimental.dynamicOnHover,inlineCss:!!af.experimental.inlineCss,authInterrupts:!!af.experimental.authInterrupts,clientTraceMetadata:af.experimental.clientTraceMetadata||[]},waitUntil:e.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d)=>M.onRequestError(a,b,d,ae),err:(0,i.getRequestMeta)(a,"invokeError"),dev:M.isDev}},l=await g(d,j),{metadata:m}=l,{cacheControl:n,headers:o={},fetchTags:p}=m;if(p&&(o[A.NEXT_CACHE_TAGS_HEADER]=p),a.fetchMetrics=m.fetchMetrics,am&&(null==n?void 0:n.revalidate)===0&&!M.isDev&&!at){let a=m.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${ac}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
|
|
4
|
+
see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:x.CachedRouteKind.APP_PAGE,html:l,headers:o,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:n}},n=async({hasResolved:c,previousCacheEntry:d,isRevalidating:g,span:h})=>{let j,k=!1===M.isDev,m=c||b.writableEnded;if(aj&&ad&&!d&&!P)return(null==ae?void 0:ae.render404)?await ae.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(ak&&(j=(0,y.parseFallbackField)(ak.fallback)),j===y.FallbackMode.PRERENDER&&(0,w.isBot)(an)&&(!at||ap)&&(j=y.FallbackMode.BLOCKING_STATIC_RENDER),(null==d?void 0:d.isStale)===-1&&(aj=!0),aj&&(j!==y.FallbackMode.NOT_FOUND||d)&&(j=y.FallbackMode.BLOCKING_STATIC_RENDER),!P&&j!==y.FallbackMode.BLOCKING_STATIC_RENDER&&aD&&!m&&!ab&&V&&(k||!al)){let b;if((k||ak)&&j===y.FallbackMode.NOT_FOUND)throw new D.NoFallbackError;if(at&&!ar){let c="string"==typeof(null==ak?void 0:ak.fallback)?ak.fallback:k?ai:null;if(b=await M.handleResponse({cacheKey:c,req:a,nextConfig:af,routeKind:f.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:aa,isRoutePPREnabled:at,responseGenerator:async()=>l({span:h,postponed:void 0,fallbackRouteParams:k||av?(0,p.u)(ai):null}),waitUntil:e.waitUntil}),null===b)return null;if(b)return delete b.cacheControl,b}}let n=aj||g||!aw?void 0:aw;if(au&&void 0!==n)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:x.CachedRouteKind.PAGES,html:z.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let o=V&&at&&((0,i.getRequestMeta)(a,"renderFallbackShell")||av)?(0,p.u)(ah):null;return l({span:h,postponed:n,fallbackRouteParams:o})},o=async c=>{var d,g,h,j,k;let m,o=await M.handleResponse({cacheKey:aC,responseGenerator:a=>n({span:c,...a}),routeKind:f.RouteKind.APP_PAGE,isOnDemandRevalidate:aj,isRoutePPREnabled:at,req:a,nextConfig:af,prerenderManifest:aa,waitUntil:e.waitUntil});if(ab&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),M.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!o){if(aC)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(d=o.value)?void 0:d.kind)!==x.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(h=o.value)?void 0:h.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let p="string"==typeof o.value.postponed;am&&!ax&&(!p||aq)&&(P||b.setHeader("x-nextjs-cache",aj?"REVALIDATED":o.isMiss?"MISS":o.isStale?"STALE":"HIT"),b.setHeader(v.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=o;if(aw)m={revalidate:0,expire:void 0};else if(P&&ar&&!aq&&at)m={revalidate:0,expire:void 0};else if(!M.isDev)if(ab)m={revalidate:0,expire:void 0};else if(am){if(o.cacheControl)if("number"==typeof o.cacheControl.revalidate){if(o.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${o.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});m={revalidate:o.cacheControl.revalidate,expire:(null==(j=o.cacheControl)?void 0:j.expire)??af.expireTime}}else m={revalidate:A.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(m={revalidate:0,expire:void 0});if(o.cacheControl=m,"string"==typeof ay&&(null==q?void 0:q.kind)===x.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(v.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[A.NEXT_CACHE_TAGS_HEADER];P&&am&&c&&"string"==typeof c&&b.setHeader(A.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(ay);return void 0!==d?(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:z.default.fromStatic(d,v.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl}):(b.statusCode=204,(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:z.default.EMPTY,cacheControl:o.cacheControl}))}let r=(0,i.getRequestMeta)(a,"onCacheEntry");if(r&&await r({...o,value:{...o.value,kind:"PAGE"}},{url:(0,i.getRequestMeta)(a,"initURL")}))return null;if(p&&aw)throw Object.defineProperty(Error("Invariant: postponed state should not be present on a resume request"),"__NEXT_ERROR_CODE",{value:"E396",enumerable:!1,configurable:!0});if(q.headers){let a={...q.headers};for(let[c,d]of(P&&am||delete a[A.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let s=null==(g=q.headers)?void 0:g[A.NEXT_CACHE_TAGS_HEADER];if(P&&am&&s&&"string"==typeof s&&b.setHeader(A.NEXT_CACHE_TAGS_HEADER,s),!q.status||ar&&at||(b.statusCode=q.status),!P&&q.status&&H.RedirectStatusCode[q.status]&&ar&&(b.statusCode=200),p&&b.setHeader(v.NEXT_DID_POSTPONE_HEADER,"1"),ar&&!ab){if(void 0===q.rscData){if(q.postponed)throw Object.defineProperty(Error("Invariant: Expected postponed to be undefined"),"__NEXT_ERROR_CODE",{value:"E372",enumerable:!1,configurable:!0});return(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:q.html,cacheControl:ax?{revalidate:0,expire:void 0}:o.cacheControl})}return(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:z.default.fromStatic(q.rscData,v.RSC_CONTENT_TYPE_HEADER),cacheControl:o.cacheControl})}let t=q.html;if(!p||P||ar)return(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:t,cacheControl:o.cacheControl});if(au)return t.push(new ReadableStream({start(a){a.enqueue(B.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}});let u=new TransformStream;return t.push(u.readable),l({span:c,postponed:q.postponed,fallbackRouteParams:null}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==x.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(u.writable)}).catch(a=>{u.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,C.sendRenderResult)({req:a,res:b,generateEtags:af.generateEtags,poweredByHeader:af.poweredByHeader,result:t,cacheControl:{revalidate:0,expire:void 0}})};if(!aH)return await aG.withPropagatedContext(a.headers,()=>aG.trace(j.BaseServerSpan.handleRequest,{spanName:`${aF} ${a.url}`,kind:h.SpanKind.SERVER,attributes:{"http.method":aF,"http.target":a.url}},o));await o(aH)}catch(b){throw b instanceof D.NoFallbackError||await M.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"render",revalidateReason:(0,g.c)({isRevalidate:am,isOnDemandRevalidate:aj})},ae),b}}},55511:a=>{"use strict";a.exports=require("crypto")},61034:(a,b,c)=>{Promise.resolve().then(c.bind(c,21251))},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},71556:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(51537).A)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},73136:a=>{"use strict";a.exports=require("node:url")},76760:a=>{"use strict";a.exports=require("node:path")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},91313:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(51537).A)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[691,484,335,593,247,851,143,932],()=>b(b.s=49519));module.exports=c})();
|